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" |
Chaehyun Lim | 5366012 | 2015-09-17 16:48:49 +0900 | [diff] [blame] | 3 | #include "wilc_wlan_if.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6 | |
| 7 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 8 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 9 | #endif |
| 10 | |
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 | /*! |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame^] | 139 | * @struct key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 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 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame^] | 148 | struct key_attr { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 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; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame^] | 152 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | /*! |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 158 | * @struct scan_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 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 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 167 | struct scan_attr { |
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; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 176 | tstrHiddenNetwork strHiddenNetwork; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 177 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 178 | |
| 179 | /*! |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 180 | * @struct connect_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 181 | * @brief Structure to hold Host IF Connect Attributes |
| 182 | * @details |
| 183 | * @todo |
| 184 | * @sa |
| 185 | * @author Mostafa Abu Bakr |
| 186 | * @date 25 March 2012 |
| 187 | * @version 1.0 |
| 188 | */ |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 189 | struct connect_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 190 | u8 *pu8bssid; |
| 191 | u8 *pu8ssid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 192 | size_t ssidLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 193 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 194 | size_t IEsLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 195 | u8 u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 196 | tWILCpfConnectResult pfConnectResult; |
| 197 | void *pvUserArg; |
| 198 | AUTHTYPE_T tenuAuth_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 199 | u8 u8channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 200 | void *pJoinParams; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 201 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 202 | |
| 203 | /*! |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 204 | * @struct rcvd_async_info |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 205 | * @brief Structure to hold Received General Asynchronous info |
| 206 | * @details |
| 207 | * @todo |
| 208 | * @sa |
| 209 | * @author Mostafa Abu Bakr |
| 210 | * @date 25 March 2012 |
| 211 | * @version 1.0 |
| 212 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 213 | struct rcvd_async_info { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 214 | u8 *pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 215 | u32 u32Length; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 216 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 217 | |
| 218 | /*! |
| 219 | * @struct tstrHostIFSetChan |
| 220 | * @brief Set Channel message body |
| 221 | * @details |
| 222 | * @todo |
| 223 | * @sa |
| 224 | * @author Mai Daftedar |
| 225 | * @date 25 March 2012 |
| 226 | * @version 1.0 |
| 227 | */ |
| 228 | typedef struct _tstrHostIFSetChan { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 229 | u8 u8SetChan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 230 | } tstrHostIFSetChan; |
| 231 | |
| 232 | /*! |
| 233 | * @struct tstrHostIFSetChan |
| 234 | * @brief Get Channel message body |
| 235 | * @details |
| 236 | * @todo |
| 237 | * @sa |
| 238 | * @author Mai Daftedar |
| 239 | * @date 01 Jule 2012 |
| 240 | * @version 1.0 |
| 241 | */ |
| 242 | typedef struct _tstrHostIFGetChan { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 243 | u8 u8GetChan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 244 | } tstrHostIFGetChan; |
| 245 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 246 | /*! |
| 247 | * @struct tstrScanComplete |
| 248 | * @brief hold received Async. Scan Complete message body |
| 249 | * @details |
| 250 | * @todo |
| 251 | * @sa |
| 252 | * @author zsalah |
| 253 | * @date 25 March 2012 |
| 254 | * @version 1.0 |
| 255 | */ |
| 256 | /*typedef struct _tstrScanComplete |
| 257 | * { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 258 | * u8* pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 259 | * u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 260 | * } tstrScanComplete;*/ |
| 261 | |
| 262 | /*! |
| 263 | * @struct tstrHostIFSetBeacon |
| 264 | * @brief Set Beacon message body |
| 265 | * @details |
| 266 | * @todo |
| 267 | * @sa |
| 268 | * @author Adham Abozaeid |
| 269 | * @date 10 July 2012 |
| 270 | * @version 1.0 |
| 271 | */ |
| 272 | typedef struct _tstrHostIFSetBeacon { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 273 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
| 274 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 275 | * (including the current frame) appear before the next DTIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 276 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 277 | 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] | 278 | * 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] | 279 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 280 | 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] | 281 | * after the TIM inormation element */ |
| 282 | } tstrHostIFSetBeacon; |
| 283 | |
| 284 | |
| 285 | |
| 286 | /*! |
| 287 | * @struct tstrHostIFDelBeacon |
| 288 | * @brief Del Beacon message body |
| 289 | * @details |
| 290 | * @todo |
| 291 | * @sa |
| 292 | * @author Adham Abozaeid |
| 293 | * @date 15 July 2012 |
| 294 | * @version 1.0 |
| 295 | */ |
| 296 | typedef struct _tstrHostIFDelBeacon { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 297 | u8 u8dummy; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 298 | } tstrHostIFDelBeacon; |
| 299 | |
| 300 | /*! |
| 301 | * @struct tstrHostIFSetMulti |
| 302 | * @brief set Multicast filter Address |
| 303 | * @details |
| 304 | * @todo |
| 305 | * @sa |
| 306 | * @author Abdelrahman Sobhy |
| 307 | * @date 30 August 2013 |
| 308 | * @version 1.0 Description |
| 309 | */ |
| 310 | |
| 311 | typedef struct { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 312 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 313 | u32 u32count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 314 | } tstrHostIFSetMulti; |
| 315 | |
| 316 | /*! |
| 317 | * @struct tstrHostIFDelAllSta |
| 318 | * @brief Deauth station message body |
| 319 | * @details |
| 320 | * @todo |
| 321 | * @sa |
| 322 | * @author Mai Daftedar |
| 323 | * @date 09 April 2014 |
| 324 | * @version 1.0 Description |
| 325 | */ |
| 326 | |
| 327 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 328 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
| 329 | u8 u8Num_AssocSta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 330 | } tstrHostIFDelAllSta; |
| 331 | |
| 332 | /*! |
| 333 | * @struct tstrHostIFDelSta |
| 334 | * @brief Delete station message body |
| 335 | * @details |
| 336 | * @todo |
| 337 | * @sa |
| 338 | * @author Adham Abozaeid |
| 339 | * @date 15 July 2012 |
| 340 | * @version 1.0 Description |
| 341 | */ |
| 342 | |
| 343 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 344 | u8 au8MacAddr[ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 345 | } tstrHostIFDelSta; |
| 346 | |
| 347 | /*! |
| 348 | * @struct tstrTimerCb |
| 349 | * @brief Timer callback message body |
| 350 | * @details |
| 351 | * @todo |
| 352 | * @sa |
| 353 | * @author Mostafa Abu Bakr |
| 354 | * @date 25 March 2012 |
| 355 | * @version 1.0 |
| 356 | */ |
| 357 | typedef struct _tstrTimerCb { |
| 358 | void *pvUsrArg; /*!< Private data passed at timer start */ |
| 359 | } tstrTimerCb; |
| 360 | |
| 361 | /*! |
| 362 | * @struct tstrHostIfPowerMgmtParam |
| 363 | * @brief Power management message body |
| 364 | * @details |
| 365 | * @todo |
| 366 | * @sa |
| 367 | * @author Adham Abozaeid |
| 368 | * @date 24 November 2012 |
| 369 | * @version 1.0 |
| 370 | */ |
| 371 | typedef struct { |
| 372 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 373 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 374 | u32 u32Timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 375 | } tstrHostIfPowerMgmtParam; |
| 376 | |
| 377 | /*! |
| 378 | * @struct tstrHostIFSetIPAddr |
| 379 | * @brief set IP Address message body |
| 380 | * @details |
| 381 | * @todo |
| 382 | * @sa |
| 383 | * @author Abdelrahman Sobhy |
| 384 | * @date 30 August 2013 |
| 385 | * @version 1.0 Description |
| 386 | */ |
| 387 | |
| 388 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 389 | u8 *au8IPAddr; |
| 390 | u8 idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 391 | } tstrHostIFSetIPAddr; |
| 392 | |
| 393 | /*! |
| 394 | * @struct tstrHostIfStaInactiveT |
| 395 | * @brief Get station message body |
| 396 | * @details |
| 397 | * @todo |
| 398 | * @sa |
| 399 | * @author Mai Daftedar |
| 400 | * @date 16 April 2013 |
| 401 | * @version 1.0 |
| 402 | */ |
| 403 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 404 | u8 mac[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 405 | |
| 406 | } tstrHostIfStaInactiveT; |
| 407 | /**/ |
| 408 | /*! |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 409 | * @union message_body |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 410 | * @brief Message body for the Host Interface message_q |
| 411 | * @details |
| 412 | * @todo |
| 413 | * @sa |
| 414 | * @author Mostafa Abu Bakr |
| 415 | * @date 25 March 2012 |
| 416 | * @version 1.0 |
| 417 | */ |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 418 | union message_body { |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 419 | struct scan_attr strHostIFscanAttr; /*!< Host IF Scan Request Attributes message body */ |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 420 | struct connect_attr strHostIFconnectAttr; /*!< Host IF Connect Request Attributes message body */ |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 421 | struct rcvd_net_info strRcvdNetworkInfo; /*!< Received Asynchronous Network Info message body */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 422 | struct rcvd_async_info strRcvdGnrlAsyncInfo; /*!< Received General Asynchronous Info message body */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame^] | 423 | struct key_attr strHostIFkeyAttr; /*!<>*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 424 | tstrHostIFCfgParamAttr strHostIFCfgParamAttr; /*! <CFG Parameter message Body> */ |
| 425 | tstrHostIFSetChan strHostIFSetChan; |
| 426 | tstrHostIFGetChan strHostIFGetChan; |
| 427 | tstrHostIFSetBeacon strHostIFSetBeacon; /*!< Set beacon message body */ |
| 428 | tstrHostIFDelBeacon strHostIFDelBeacon; /*!< Del beacon message body */ |
| 429 | tstrWILC_AddStaParam strAddStaParam; /*!< Add station message body */ |
| 430 | tstrHostIFDelSta strDelStaParam; /*!< Del Station message body */ |
| 431 | tstrWILC_AddStaParam strEditStaParam; /*!< Edit station message body */ |
| 432 | /* tstrScanComplete strScanComplete; / *Received Async. Scan Complete message body* / */ |
| 433 | tstrTimerCb strTimerCb; /*!< Timer callback message body */ |
| 434 | tstrHostIfPowerMgmtParam strPowerMgmtparam; /*!< Power Management message body */ |
| 435 | tstrHostIfStaInactiveT strHostIfStaInactiveT; |
| 436 | tstrHostIFSetIPAddr strHostIfSetIP; |
| 437 | tstrHostIfSetDrvHandler strHostIfSetDrvHandler; |
| 438 | tstrHostIFSetMulti strHostIfSetMulti; |
| 439 | tstrHostIfSetOperationMode strHostIfSetOperationMode; |
| 440 | tstrHostIfSetMacAddress strHostIfSetMacAddress; |
| 441 | tstrHostIfGetMacAddress strHostIfGetMacAddress; |
| 442 | tstrHostIfBASessionInfo strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 443 | tstrHostIfRemainOnChan strHostIfRemainOnChan; |
| 444 | tstrHostIfRegisterFrame strHostIfRegisterFrame; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 445 | char *pUserData; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 446 | tstrHostIFDelAllSta strHostIFDelAllSta; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 447 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 448 | |
| 449 | /*! |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 450 | * @struct struct host_if_msg |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 451 | * @brief Host Interface message |
| 452 | * @details |
| 453 | * @todo |
| 454 | * @sa |
| 455 | * @author Mostafa Abu Bakr |
| 456 | * @date 25 March 2012 |
| 457 | * @version 1.0 |
| 458 | */ |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 459 | struct host_if_msg { |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 460 | u16 id; /*!< Message ID */ |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 461 | union message_body body; /*!< Message body */ |
Johnny Kim | 11f58c8 | 2015-08-13 13:41:20 +0900 | [diff] [blame] | 462 | tstrWILC_WFIDrv *drvHandler; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 463 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 464 | |
| 465 | #ifdef CONNECT_DIRECT |
| 466 | typedef struct _tstrWidJoinReqExt { |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 467 | char SSID[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 468 | u8 u8channel; |
| 469 | u8 BSSID[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 470 | } tstrWidJoinReqExt; |
| 471 | #endif |
| 472 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 473 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 474 | /*Struct containg joinParam of each AP*/ |
| 475 | typedef struct _tstrJoinBssParam { |
| 476 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 477 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 478 | u16 beacon_period; |
| 479 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 480 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 481 | char ssid[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 482 | u8 ssidLen; |
| 483 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 484 | u8 ht_capable; |
| 485 | u8 wmm_cap; |
| 486 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 487 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 488 | u8 rsn_grp_policy; |
| 489 | u8 mode_802_11i; |
| 490 | u8 rsn_pcip_policy[3]; |
| 491 | u8 rsn_auth_policy[3]; |
| 492 | u8 rsn_cap[2]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 493 | struct _tstrJoinParam *nextJoinBss; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 494 | u32 tsf; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 495 | u8 u8NoaEnbaled; |
| 496 | u8 u8OppEnable; |
| 497 | u8 u8CtWindow; |
| 498 | u8 u8Count; |
| 499 | u8 u8Index; |
| 500 | u8 au8Duration[4]; |
| 501 | u8 au8Interval[4]; |
| 502 | u8 au8StartTime[4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 503 | } tstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 504 | /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/ |
| 505 | typedef struct _tstrBssTable { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 506 | u8 u8noBssEntries; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 507 | tstrJoinBssParam *head; |
| 508 | tstrJoinBssParam *tail; |
| 509 | } tstrBssTable; |
| 510 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 511 | |
| 512 | typedef enum { |
| 513 | SCAN_TIMER = 0, |
| 514 | CONNECT_TIMER = 1, |
| 515 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF |
| 516 | } tenuScanConnTimer; |
| 517 | |
| 518 | /*****************************************************************************/ |
| 519 | /* */ |
| 520 | /* Global Variabls */ |
| 521 | /* */ |
| 522 | /*****************************************************************************/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 523 | /* Zero is not used, because a zero ID means termination */ |
| 524 | static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
Daniel Machon | 6fdb302 | 2015-07-06 19:48:04 +0200 | [diff] [blame] | 525 | tstrWILC_WFIDrv *terminated_handle; |
| 526 | tstrWILC_WFIDrv *gWFiDrvHandle; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 527 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 528 | bool g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 529 | #endif |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 530 | u8 P2P_LISTEN_STATE; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 531 | static struct task_struct *HostIFthreadHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 532 | static WILC_MsgQueueHandle gMsgQHostIF; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 533 | static struct semaphore hSemHostIFthrdEnd; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 534 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 535 | struct semaphore hSemDeinitDrvHandle; |
| 536 | static struct semaphore hWaitResponse; |
| 537 | struct semaphore hSemHostIntDeinit; |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 538 | struct timer_list g_hPeriodicRSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 539 | |
| 540 | |
| 541 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 542 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 543 | |
| 544 | #ifndef CONNECT_DIRECT |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 545 | static u8 gapu8RcvdSurveyResults[2][MAX_SURVEY_RESULT_FRAG_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 546 | #endif |
| 547 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 548 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 549 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 550 | bool gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 551 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 552 | static s8 gs8Rssi; |
| 553 | static s8 gs8lnkspd; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 554 | static u8 gu8Chnl; |
| 555 | static u8 gs8SetIP[2][4]; |
| 556 | static u8 gs8GetIP[2][4]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 557 | static u32 gu32InactiveTime; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 558 | static u8 gu8DelBcn; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 559 | static u32 gu32WidConnRstHack; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 560 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 561 | u8 *gu8FlushedJoinReq; |
| 562 | u8 *gu8FlushedInfoElemAsoc; |
| 563 | u8 gu8Flushed11iMode; |
| 564 | u8 gu8FlushedAuthType; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 565 | u32 gu32FlushedJoinReqSize; |
| 566 | u32 gu32FlushedInfoElemAsocSize; |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 567 | tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 568 | #define REAL_JOIN_REQ 0 |
| 569 | #define FLUSHED_JOIN_REQ 1 |
| 570 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ |
| 571 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 572 | #ifdef WILC_PARSE_SCAN_IN_HOST |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 573 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
| 574 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 575 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 576 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 577 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 578 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 579 | static int add_handler_in_list(tstrWILC_WFIDrv *handler) |
| 580 | { |
| 581 | int i; |
| 582 | |
| 583 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 584 | if (!wfidrv_list[i]) { |
| 585 | wfidrv_list[i] = handler; |
| 586 | return 0; |
| 587 | } |
| 588 | } |
| 589 | |
| 590 | return -ENOBUFS; |
| 591 | } |
| 592 | |
| 593 | static int remove_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] == handler) { |
| 599 | wfidrv_list[i] = NULL; |
| 600 | return 0; |
| 601 | } |
| 602 | } |
| 603 | |
| 604 | return -EINVAL; |
| 605 | } |
| 606 | |
| 607 | static int get_id_from_handler(tstrWILC_WFIDrv *handler) |
| 608 | { |
| 609 | int i; |
| 610 | |
| 611 | if (!handler) |
| 612 | return 0; |
| 613 | |
| 614 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 615 | if (wfidrv_list[i] == handler) |
| 616 | return i; |
| 617 | } |
| 618 | |
| 619 | return 0; |
| 620 | } |
| 621 | |
| 622 | static tstrWILC_WFIDrv *get_handler_from_id(int id) |
| 623 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 624 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 625 | return NULL; |
| 626 | return wfidrv_list[id]; |
| 627 | } |
| 628 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 629 | /** |
| 630 | * @brief Handle_SetChannel |
| 631 | * @details Sending config packet to firmware to set channel |
| 632 | * @param[in] tstrHostIFSetChan* pstrHostIFSetChan |
| 633 | * @return Error code. |
| 634 | * @author |
| 635 | * @date |
| 636 | * @version 1.0 |
| 637 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 638 | static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetChan *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 639 | { |
| 640 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 641 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 642 | tstrWID strWID; |
| 643 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 644 | |
| 645 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 646 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 647 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 648 | strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan); |
| 649 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 650 | |
| 651 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
| 652 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 653 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 654 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 655 | if (s32Error) { |
| 656 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 657 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 658 | } |
| 659 | |
| 660 | return s32Error; |
| 661 | } |
| 662 | /** |
| 663 | * @brief Handle_SetWfiDrvHandler |
| 664 | * @details Sending config packet to firmware to set driver handler |
| 665 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 666 | * @return Error code. |
| 667 | * @author |
| 668 | * @date |
| 669 | * @version 1.0 |
| 670 | */ |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 671 | static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, |
| 672 | tstrHostIfSetDrvHandler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 673 | { |
| 674 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 675 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 676 | tstrWID strWID; |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 677 | tstrWILC_WFIDrv *pstrWFIDrv = drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 678 | |
| 679 | |
| 680 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 681 | strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 682 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 683 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 684 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 685 | |
| 686 | /*Sending Cfg*/ |
| 687 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 688 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 689 | pstrHostIfSetDrvHandler->u32Address); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 690 | |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 691 | if (pstrWFIDrv == NULL) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 692 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 693 | |
| 694 | |
| 695 | if (s32Error) { |
| 696 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 697 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 698 | } |
| 699 | |
| 700 | return s32Error; |
| 701 | } |
| 702 | |
| 703 | /** |
| 704 | * @brief Handle_SetWfiAPDrvHandler |
| 705 | * @details Sending config packet to firmware to set driver handler |
| 706 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 707 | * @return Error code. |
| 708 | * @author |
| 709 | * @date |
| 710 | * @version 1.0 |
| 711 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 712 | static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetOperationMode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 713 | { |
| 714 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 715 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 716 | tstrWID strWID; |
| 717 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 718 | |
| 719 | |
| 720 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 721 | strWID.u16WIDid = (u16)WID_SET_OPERATION_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 722 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 723 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetOperationMode->u32Mode); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 724 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 725 | |
| 726 | /*Sending Cfg*/ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 727 | PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 728 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 729 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 730 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 731 | |
| 732 | |
Johnny Kim | c590b9a | 2015-09-08 17:07:59 +0900 | [diff] [blame] | 733 | if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 734 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 735 | |
| 736 | |
| 737 | if (s32Error) { |
| 738 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 739 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 740 | } |
| 741 | |
| 742 | return s32Error; |
| 743 | } |
| 744 | |
| 745 | /** |
| 746 | * @brief host_int_set_IPAddress |
| 747 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 748 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 749 | * @return Error code. |
| 750 | * @author |
| 751 | * @date |
| 752 | * @version 1.0 |
| 753 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 754 | s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 755 | { |
| 756 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 757 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 758 | tstrWID strWID; |
| 759 | char firmwareIPAddress[4] = {0}; |
| 760 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 761 | |
| 762 | if (pu8IPAddr[0] < 192) |
| 763 | pu8IPAddr[0] = 0; |
| 764 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 765 | 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] | 766 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 767 | memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 768 | |
| 769 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 770 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 771 | strWID.enuWIDtype = WID_STR; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 772 | strWID.ps8WidVal = (u8 *)pu8IPAddr; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 773 | strWID.s32ValueSize = IP_ALEN; |
| 774 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 775 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 776 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 777 | |
| 778 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 779 | host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 780 | |
| 781 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 782 | PRINT_ER("Failed to set IP address\n"); |
| 783 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 784 | } |
| 785 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 786 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 787 | |
| 788 | return s32Error; |
| 789 | } |
| 790 | |
| 791 | |
| 792 | /** |
| 793 | * @brief Handle_get_IPAddress |
| 794 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 795 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 796 | * @return Error code. |
| 797 | * @author |
| 798 | * @date |
| 799 | * @version 1.0 |
| 800 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 801 | s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 802 | { |
| 803 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 804 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 805 | tstrWID strWID; |
| 806 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 807 | |
| 808 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 809 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 810 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 811 | strWID.ps8WidVal = kmalloc(IP_ALEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 812 | strWID.s32ValueSize = IP_ALEN; |
| 813 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 814 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 815 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 816 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 817 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 818 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 819 | memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 820 | |
| 821 | /*get the value by searching the local copy*/ |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 822 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 823 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 824 | if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 825 | host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 826 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 827 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 828 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 829 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 830 | } |
| 831 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 832 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
| 833 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); |
| 834 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 835 | |
| 836 | return s32Error; |
| 837 | } |
| 838 | |
| 839 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 840 | /** |
| 841 | * @brief Handle_SetMacAddress |
| 842 | * @details Setting mac address |
| 843 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 844 | * @return Error code. |
| 845 | * @author Amr Abdel-Moghny |
| 846 | * @date November 2013 |
| 847 | * @version 7.0 |
| 848 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 849 | static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfSetMacAddress *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 850 | { |
| 851 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 852 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 853 | tstrWID strWID; |
| 854 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 855 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 856 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 857 | if (mac_buf == NULL) { |
| 858 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 859 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 860 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 861 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 862 | |
| 863 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 864 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 865 | strWID.enuWIDtype = WID_STR; |
| 866 | strWID.ps8WidVal = mac_buf; |
| 867 | strWID.s32ValueSize = ETH_ALEN; |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 868 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 869 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 870 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 871 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 872 | if (s32Error) { |
| 873 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 874 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 875 | } |
| 876 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 877 | kfree(mac_buf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 878 | return s32Error; |
| 879 | } |
| 880 | |
| 881 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 882 | /** |
| 883 | * @brief Handle_GetMacAddress |
| 884 | * @details Getting mac address |
| 885 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 886 | * @return Error code. |
| 887 | * @author Amr Abdel-Moghny |
| 888 | * @date JAN 2013 |
| 889 | * @version 8.0 |
| 890 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 891 | static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 892 | { |
| 893 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 894 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 895 | tstrWID strWID; |
| 896 | |
| 897 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 898 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 899 | strWID.enuWIDtype = WID_STR; |
| 900 | strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress; |
| 901 | strWID.s32ValueSize = ETH_ALEN; |
| 902 | |
| 903 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 904 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, |
| 905 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 906 | if (s32Error) { |
| 907 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 908 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 909 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 910 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 911 | |
| 912 | return s32Error; |
| 913 | } |
| 914 | |
| 915 | |
| 916 | /** |
| 917 | * @brief Handle_CfgParam |
| 918 | * @details Sending config packet to firmware to set CFG params |
| 919 | * @param[in] tstrHostIFCfgParamAttr* strHostIFCfgParamAttr |
| 920 | * @return Error code. |
| 921 | * @author |
| 922 | * @date |
| 923 | * @version 1.0 |
| 924 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 925 | static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, tstrHostIFCfgParamAttr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 926 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 927 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 928 | tstrWID strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 929 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 930 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 931 | |
| 932 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 933 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 934 | |
| 935 | |
| 936 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 937 | |
| 938 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) { |
| 939 | /*----------------------------------------------------------*/ |
| 940 | /*Input Value: INFRASTRUCTURE = 1, */ |
| 941 | /* INDEPENDENT= 2, */ |
| 942 | /* ANY_BSS= 3 */ |
| 943 | /*----------------------------------------------------------*/ |
| 944 | /* validate input then copy>> need to check value 4 and 5 */ |
| 945 | if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) { |
| 946 | strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 947 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 948 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 949 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 950 | pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 951 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 952 | PRINT_ER("check value 6 over\n"); |
| 953 | s32Error = -EINVAL; |
| 954 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 955 | } |
| 956 | u8WidCnt++; |
| 957 | } |
| 958 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) { |
| 959 | /*------------------------------------------------------*/ |
| 960 | /*Input Values: OPEN_SYSTEM = 0, */ |
| 961 | /* SHARED_KEY = 1, */ |
| 962 | /* ANY = 2 */ |
| 963 | /*------------------------------------------------------*/ |
| 964 | /*validate Possible values*/ |
| 965 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) { |
| 966 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 967 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 968 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 969 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 970 | pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 971 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 972 | PRINT_ER("Impossible value \n"); |
| 973 | s32Error = -EINVAL; |
| 974 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 975 | } |
| 976 | u8WidCnt++; |
| 977 | } |
| 978 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) { |
| 979 | /* range is 1 to 65535. */ |
| 980 | if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) { |
| 981 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 982 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 983 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 984 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 985 | pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
| 986 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 987 | PRINT_ER("Range(1 ~ 65535) over\n"); |
| 988 | s32Error = -EINVAL; |
| 989 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 990 | } |
| 991 | u8WidCnt++; |
| 992 | } |
| 993 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) { |
| 994 | /*-----------------------------------------------------------*/ |
| 995 | /*Input Values: NO_POWERSAVE = 0, */ |
| 996 | /* MIN_FAST_PS = 1, */ |
| 997 | /* MAX_FAST_PS = 2, */ |
| 998 | /* MIN_PSPOLL_PS = 3, */ |
| 999 | /* MAX_PSPOLL_PS = 4 */ |
| 1000 | /*----------------------------------------------------------*/ |
| 1001 | if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) { |
| 1002 | strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1003 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1004 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1005 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1006 | pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1007 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1008 | PRINT_ER("Invalide power mode\n"); |
| 1009 | s32Error = -EINVAL; |
| 1010 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1011 | } |
| 1012 | u8WidCnt++; |
| 1013 | } |
| 1014 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) { |
| 1015 | /* range from 1 to 256 */ |
| 1016 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) { |
| 1017 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1018 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1019 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1020 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1021 | pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
| 1022 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1023 | PRINT_ER("Range(1~256) over\n"); |
| 1024 | s32Error = -EINVAL; |
| 1025 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1026 | } |
| 1027 | u8WidCnt++; |
| 1028 | } |
| 1029 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) { |
| 1030 | /* range from 1 to 256 */ |
| 1031 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) { |
| 1032 | strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1033 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1034 | |
| 1035 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1036 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1037 | pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
| 1038 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1039 | PRINT_ER("Range(1~256) over\n"); |
| 1040 | s32Error = -EINVAL; |
| 1041 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1042 | } |
| 1043 | u8WidCnt++; |
| 1044 | } |
| 1045 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) { |
| 1046 | |
| 1047 | if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) { |
| 1048 | strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1049 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1050 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1051 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1052 | pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
| 1053 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1054 | PRINT_ER("Threshold Range fail\n"); |
| 1055 | s32Error = -EINVAL; |
| 1056 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1057 | } |
| 1058 | u8WidCnt++; |
| 1059 | } |
| 1060 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) { |
| 1061 | /* range 256 to 65535 */ |
| 1062 | if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) { |
| 1063 | strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1064 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1065 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1066 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1067 | pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
| 1068 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1069 | PRINT_ER("Threshold Range fail\n"); |
| 1070 | s32Error = -EINVAL; |
| 1071 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1072 | } |
| 1073 | u8WidCnt++; |
| 1074 | } |
| 1075 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) { |
| 1076 | /*-----------------------------------------------------*/ |
| 1077 | /*Input Values: Short= 0, */ |
| 1078 | /* Long= 1, */ |
| 1079 | /* Auto= 2 */ |
| 1080 | /*------------------------------------------------------*/ |
| 1081 | if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) { |
| 1082 | strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1083 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1084 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1085 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1086 | pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
| 1087 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1088 | PRINT_ER("Preamle Range(0~2) over\n"); |
| 1089 | s32Error = -EINVAL; |
| 1090 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1091 | } |
| 1092 | u8WidCnt++; |
| 1093 | } |
| 1094 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SHORT_SLOT_ALLOWED) { |
| 1095 | if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) { |
| 1096 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1097 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1098 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1099 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1100 | pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1101 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1102 | PRINT_ER("Short slot(2) over\n"); |
| 1103 | s32Error = -EINVAL; |
| 1104 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1105 | } |
| 1106 | u8WidCnt++; |
| 1107 | } |
| 1108 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) { |
| 1109 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ |
| 1110 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ |
| 1111 | /* this information is useful for external supplicant */ |
| 1112 | /*Input Values: 1 for enable and 0 for disable. */ |
| 1113 | if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) { |
| 1114 | strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1115 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1116 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1117 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1118 | pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1119 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1120 | PRINT_ER("TXOP prot disable\n"); |
| 1121 | s32Error = -EINVAL; |
| 1122 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1123 | } |
| 1124 | u8WidCnt++; |
| 1125 | } |
| 1126 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) { |
| 1127 | /* range is 1 to 65535. */ |
| 1128 | if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) { |
| 1129 | strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1130 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1131 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1132 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1133 | pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
| 1134 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1135 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
| 1136 | s32Error = -EINVAL; |
| 1137 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1138 | } |
| 1139 | u8WidCnt++; |
| 1140 | } |
| 1141 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) { |
| 1142 | /* range is 1 to 255. */ |
| 1143 | if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) { |
| 1144 | strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1145 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1146 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1147 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1148 | pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
| 1149 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1150 | PRINT_ER("DTIM range(1~255) fail\n"); |
| 1151 | s32Error = -EINVAL; |
| 1152 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1153 | } |
| 1154 | u8WidCnt++; |
| 1155 | } |
| 1156 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) { |
| 1157 | /*----------------------------------------------------------------------*/ |
| 1158 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ |
| 1159 | /* SITE_SURVEY_ALL_CH = 1, */ |
| 1160 | /* SITE_SURVEY_OFF = 2 */ |
| 1161 | /*----------------------------------------------------------------------*/ |
| 1162 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) { |
| 1163 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1164 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1165 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1166 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1167 | pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1168 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1169 | PRINT_ER("Site survey disable\n"); |
| 1170 | s32Error = -EINVAL; |
| 1171 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1172 | } |
| 1173 | u8WidCnt++; |
| 1174 | } |
| 1175 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) { |
| 1176 | /* range is 1 to 65535. */ |
| 1177 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) { |
| 1178 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1179 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1180 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1181 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1182 | pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
| 1183 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1184 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
| 1185 | s32Error = -EINVAL; |
| 1186 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1187 | } |
| 1188 | u8WidCnt++; |
| 1189 | } |
| 1190 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) { |
| 1191 | /* range is 1 to 65535. */ |
| 1192 | if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) { |
| 1193 | strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1194 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1195 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1196 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1197 | pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
| 1198 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1199 | PRINT_ER("Active scan time(1~65535) over\n"); |
| 1200 | s32Error = -EINVAL; |
| 1201 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1202 | } |
| 1203 | u8WidCnt++; |
| 1204 | } |
| 1205 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) { |
| 1206 | /* range is 1 to 65535. */ |
| 1207 | if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) { |
| 1208 | strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1209 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1210 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1211 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1212 | pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
| 1213 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1214 | PRINT_ER("Passive scan time(1~65535) over\n"); |
| 1215 | s32Error = -EINVAL; |
| 1216 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1217 | } |
| 1218 | u8WidCnt++; |
| 1219 | } |
| 1220 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) { |
| 1221 | CURRENT_TX_RATE_T curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate; |
| 1222 | /*----------------------------------------------------------------------*/ |
| 1223 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ |
| 1224 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ |
| 1225 | /*----------------------------------------------------------------------*/ |
| 1226 | /* validate rate */ |
| 1227 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 1228 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 1229 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 1230 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 1231 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 1232 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
| 1233 | strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1234 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1235 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1236 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1237 | pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1238 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1239 | PRINT_ER("out of TX rate\n"); |
| 1240 | s32Error = -EINVAL; |
| 1241 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1242 | } |
| 1243 | u8WidCnt++; |
| 1244 | } |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1245 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, |
| 1246 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1247 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1248 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1249 | PRINT_ER("Error in setting CFG params\n"); |
| 1250 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1251 | ERRORHANDLER: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1252 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1253 | return s32Error; |
| 1254 | } |
| 1255 | |
| 1256 | |
| 1257 | /** |
| 1258 | * @brief Handle_wait_msg_q_empty |
| 1259 | * @details this should be the last msg and then the msg Q becomes idle |
| 1260 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1261 | * @return Error code. |
| 1262 | * @author |
| 1263 | * @date |
| 1264 | * @version 1.0 |
| 1265 | */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1266 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1267 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1268 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1269 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1270 | g_wilc_initialized = 0; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1271 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1272 | return s32Error; |
| 1273 | } |
| 1274 | |
| 1275 | /** |
| 1276 | * @brief Handle_Scan |
| 1277 | * @details Sending config packet to firmware to set the scan params |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1278 | * @param[in] struct scan_attr *pstrHostIFscanAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1279 | * @return Error code. |
| 1280 | * @author |
| 1281 | * @date |
| 1282 | * @version 1.0 |
| 1283 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1284 | static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, |
| 1285 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1286 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1287 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1288 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1289 | u32 u32WidsCount = 0; |
| 1290 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1291 | u8 *pu8Buffer; |
| 1292 | u8 valuesize = 0; |
| 1293 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1294 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1295 | |
| 1296 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1297 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1298 | |
| 1299 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; |
| 1300 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; |
| 1301 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1302 | if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) { |
| 1303 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ |
| 1304 | PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1305 | PRINT_ER("Already scan\n"); |
| 1306 | s32Error = -EBUSY; |
| 1307 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1308 | } |
| 1309 | |
| 1310 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 1311 | if (g_obtainingIP || connecting) { |
| 1312 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1313 | PRINT_ER("Don't do obss scan\n"); |
| 1314 | s32Error = -EBUSY; |
| 1315 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1316 | } |
| 1317 | #endif |
| 1318 | |
| 1319 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 1320 | |
| 1321 | |
| 1322 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
| 1323 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1324 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1325 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1326 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1327 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1328 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1329 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1330 | strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1331 | if (strWIDList[u32WidsCount].ps8WidVal != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1332 | pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; |
| 1333 | |
| 1334 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; |
| 1335 | |
| 1336 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); |
| 1337 | |
| 1338 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { |
| 1339 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1340 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1341 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 1342 | } |
| 1343 | |
| 1344 | |
| 1345 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1346 | strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1347 | u32WidsCount++; |
| 1348 | } |
| 1349 | |
| 1350 | /*filling cfg param array*/ |
| 1351 | |
| 1352 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ |
| 1353 | { |
| 1354 | /* IEs to be inserted in Probe Request */ |
| 1355 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE; |
| 1356 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1357 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs; |
| 1358 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen; |
| 1359 | u32WidsCount++; |
| 1360 | } |
| 1361 | |
| 1362 | /*Scan Type*/ |
| 1363 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE; |
| 1364 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1365 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1366 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1367 | u32WidsCount++; |
| 1368 | |
| 1369 | /*list of channels to be scanned*/ |
| 1370 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST; |
| 1371 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1372 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1373 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { |
| 1374 | int i; |
| 1375 | |
| 1376 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1377 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1378 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1379 | } |
| 1380 | } |
| 1381 | |
| 1382 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList; |
| 1383 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen; |
| 1384 | u32WidsCount++; |
| 1385 | |
| 1386 | /*Scan Request*/ |
| 1387 | strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ; |
| 1388 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1389 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1390 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1391 | u32WidsCount++; |
| 1392 | |
| 1393 | /*keep the state as is , no need to change it*/ |
| 1394 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ |
| 1395 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1396 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1397 | gbScanWhileConnected = true; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1398 | else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1399 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1400 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1401 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1402 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1403 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1404 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1405 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1406 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1407 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1408 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1409 | ERRORHANDLER: |
| 1410 | if (s32Error) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1411 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1412 | /*if there is an ongoing scan request*/ |
| 1413 | Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); |
| 1414 | } |
| 1415 | |
| 1416 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1417 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1418 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1419 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1420 | } |
| 1421 | |
| 1422 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ |
| 1423 | if (pstrHostIFscanAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1424 | kfree(pstrHostIFscanAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1425 | pstrHostIFscanAttr->pu8IEs = NULL; |
| 1426 | } |
| 1427 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1428 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1429 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
| 1430 | } |
| 1431 | |
| 1432 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1433 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1434 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1435 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1436 | } |
| 1437 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1438 | if (pu8HdnNtwrksWidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1439 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1440 | |
| 1441 | return s32Error; |
| 1442 | } |
| 1443 | |
| 1444 | /** |
| 1445 | * @brief Handle_ScanDone |
| 1446 | * @details Call scan notification callback function |
| 1447 | * @param[in] NONE |
| 1448 | * @return Error code. |
| 1449 | * @author |
| 1450 | * @date |
| 1451 | * @version 1.0 |
| 1452 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1453 | static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1454 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1455 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1456 | |
| 1457 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1458 | |
| 1459 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1460 | u8 u8abort_running_scan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1461 | tstrWID strWID; |
| 1462 | |
| 1463 | |
| 1464 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 1465 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1466 | /*Ask FW to abort the running scan, if any*/ |
| 1467 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 1468 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 1469 | u8abort_running_scan = 1; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1470 | strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1471 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1472 | strWID.ps8WidVal = (s8 *)&u8abort_running_scan; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1473 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1474 | |
| 1475 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1476 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 1477 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1478 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1479 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1480 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1481 | } |
| 1482 | } |
| 1483 | |
| 1484 | if (pstrWFIDrv == NULL) { |
| 1485 | PRINT_ER("Driver handler is NULL\n"); |
| 1486 | return s32Error; |
| 1487 | } |
| 1488 | |
| 1489 | /*if there is an ongoing scan request*/ |
| 1490 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1491 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1492 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 1493 | /*delete current scan request*/ |
| 1494 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
| 1495 | } |
| 1496 | |
| 1497 | return s32Error; |
| 1498 | } |
| 1499 | |
| 1500 | /** |
| 1501 | * @brief Handle_Connect |
| 1502 | * @details Sending config packet to firmware to starting connection |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1503 | * @param[in] struct connect_attr *pstrHostIFconnectAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1504 | * @return Error code. |
| 1505 | * @author |
| 1506 | * @date |
| 1507 | * @version 1.0 |
| 1508 | */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1509 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1510 | static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, |
| 1511 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1512 | { |
| 1513 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1514 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1515 | tstrWID strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1516 | u32 u32WidsCount = 0, dummyval = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1517 | /* char passphrase[] = "12345678"; */ |
| 1518 | #ifndef CONNECT_DIRECT |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1519 | s32 s32Err = 0; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1520 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1521 | u8 u8bssDscListIndex; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1522 | wid_site_survey_reslts_s *pstrSurveyResults = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1523 | #else |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1524 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1525 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1526 | tstrJoinBssParam *ptstrJoinBssParam; |
| 1527 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1528 | |
| 1529 | #endif |
| 1530 | |
| 1531 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1532 | |
| 1533 | #ifndef CONNECT_DIRECT |
Hari Prasath Gujulan Elango | 3a79a7f | 2015-08-20 09:59:44 +0000 | [diff] [blame] | 1534 | memset(gapu8RcvdSurveyResults, 0, sizeof(gapu8RcvdSurveyResults)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1535 | |
| 1536 | |
| 1537 | PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 1538 | s32Err = host_int_get_site_survey_results(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1539 | gapu8RcvdSurveyResults, |
| 1540 | MAX_SURVEY_RESULT_FRAG_SIZE); |
| 1541 | if (s32Err) { |
| 1542 | PRINT_ER("Failed to get site survey results\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1543 | s32Error = -EFAULT; |
| 1544 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1545 | } |
| 1546 | s32Err = ParseSurveyResults(gapu8RcvdSurveyResults, &pstrSurveyResults, |
| 1547 | &pstrWFIDrv->u32SurveyResultsCount); |
| 1548 | |
| 1549 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1550 | if (s32Err == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1551 | /* use the parsed info in pstrSurveyResults, then deallocate it */ |
| 1552 | PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n"); |
| 1553 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1554 | memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1555 | sizeof(wid_site_survey_reslts_s)); |
| 1556 | } |
| 1557 | |
| 1558 | DeallocateSurveyResults(pstrSurveyResults); |
| 1559 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1560 | PRINT_ER("ParseSurveyResults() Error\n"); |
| 1561 | s32Error = -EFAULT; |
| 1562 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1563 | } |
| 1564 | |
| 1565 | |
| 1566 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1567 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1568 | pstrHostIFconnectAttr->pu8ssid, |
| 1569 | pstrHostIFconnectAttr->ssidLen) == 0) { |
| 1570 | PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid); |
| 1571 | if (pstrHostIFconnectAttr->pu8bssid == NULL) { |
| 1572 | /* BSSID is not passed from the user, so decision of matching |
| 1573 | * is done by SSID only */ |
| 1574 | PRINT_INFO(HOSTINF_DBG, "BSSID is not passed from the user\n"); |
| 1575 | break; |
| 1576 | } else { |
| 1577 | /* BSSID is also passed from the user, so decision of matching |
| 1578 | * should consider also this passed BSSID */ |
| 1579 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1580 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1581 | pstrHostIFconnectAttr->pu8bssid, |
| 1582 | 6) == 0) { |
| 1583 | PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n"); |
| 1584 | break; |
| 1585 | } |
| 1586 | } |
| 1587 | } |
| 1588 | } |
| 1589 | |
| 1590 | if (i < pstrWFIDrv->u32SurveyResultsCount) { |
| 1591 | u8bssDscListIndex = i; |
| 1592 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1593 | 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] | 1594 | u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID, |
| 1595 | pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel); |
| 1596 | |
| 1597 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1598 | |
| 1599 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1600 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1601 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1602 | } |
| 1603 | |
| 1604 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1605 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1606 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1607 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1608 | pstrHostIFconnectAttr->ssidLen); |
| 1609 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1610 | } |
| 1611 | |
| 1612 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1613 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1614 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1615 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1616 | pstrHostIFconnectAttr->IEsLen); |
| 1617 | } |
| 1618 | |
| 1619 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1620 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1621 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1622 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1623 | |
| 1624 | |
| 1625 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1626 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1627 | { |
| 1628 | /* IEs to be inserted in Association Request */ |
| 1629 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1630 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1631 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1632 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1633 | u32WidsCount++; |
| 1634 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1635 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1636 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1637 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1638 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1639 | u32WidsCount++; |
| 1640 | |
| 1641 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1642 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1643 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1644 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1645 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1646 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1647 | u32WidsCount++; |
| 1648 | |
| 1649 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1650 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1651 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1652 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1653 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1654 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1655 | * u32WidsCount++; |
| 1656 | */ |
| 1657 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1658 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1659 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1660 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1661 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1662 | u32WidsCount++; |
| 1663 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1664 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1665 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1666 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1667 | /* ////////////////////// */ |
| 1668 | gu32WidConnRstHack = 0; |
| 1669 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1670 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1671 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1672 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1673 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1674 | PRINT_ER("failed to send config packet\n"); |
| 1675 | s32Error = -EINVAL; |
| 1676 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1677 | } else { |
| 1678 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 1679 | } |
| 1680 | |
| 1681 | } else { |
| 1682 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1683 | s32Error = -ENOENT; |
| 1684 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1685 | } |
| 1686 | |
| 1687 | #else |
| 1688 | |
| 1689 | /* if we try to connect to an already connected AP then discard the request */ |
| 1690 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1691 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1692 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1693 | s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1694 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
| 1695 | return s32Error; |
| 1696 | } |
| 1697 | |
| 1698 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1699 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1700 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1701 | ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams; |
| 1702 | if (ptstrJoinBssParam == NULL) { |
| 1703 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1704 | s32Error = -ENOENT; |
| 1705 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1706 | } |
| 1707 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1708 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1709 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1710 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1711 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1712 | } |
| 1713 | |
| 1714 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1715 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1716 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1717 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1718 | pstrHostIFconnectAttr->ssidLen); |
| 1719 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1720 | } |
| 1721 | |
| 1722 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1723 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1724 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1725 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1726 | pstrHostIFconnectAttr->IEsLen); |
| 1727 | } |
| 1728 | |
| 1729 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1730 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1731 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1732 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1733 | |
| 1734 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 1735 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1736 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1737 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1738 | u32WidsCount++; |
| 1739 | |
| 1740 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 1741 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1742 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1743 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1744 | u32WidsCount++; |
| 1745 | |
| 1746 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 1747 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1748 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1749 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1750 | u32WidsCount++; |
| 1751 | |
| 1752 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1753 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1754 | { |
| 1755 | /* IEs to be inserted in Association Request */ |
| 1756 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1757 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1758 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1759 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1760 | u32WidsCount++; |
| 1761 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1762 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1763 | |
| 1764 | gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1765 | gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1766 | memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1767 | gu32FlushedInfoElemAsocSize); |
| 1768 | } |
| 1769 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1770 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1771 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1772 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1773 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1774 | u32WidsCount++; |
| 1775 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1776 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1777 | gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; |
| 1778 | |
| 1779 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1780 | |
| 1781 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1782 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1783 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1784 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1785 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1786 | u32WidsCount++; |
| 1787 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1788 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1789 | gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1790 | |
| 1791 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1792 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1793 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1794 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1795 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1796 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1797 | * u32WidsCount++; |
| 1798 | */ |
| 1799 | |
| 1800 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
| 1801 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); |
| 1802 | |
| 1803 | |
| 1804 | #ifndef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1805 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1806 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1807 | strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1808 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1809 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1810 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
| 1811 | s32Error = -EFAULT; |
| 1812 | goto ERRORHANDLER; |
| 1813 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1814 | |
| 1815 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1816 | |
| 1817 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1818 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1819 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1820 | } |
| 1821 | pu8CurrByte += MAX_SSID_LEN; |
| 1822 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1823 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1824 | } else { |
| 1825 | PRINT_ER("Channel out of range\n"); |
| 1826 | *(pu8CurrByte++) = 0xFF; |
| 1827 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1828 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1829 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1830 | pu8CurrByte += 6; |
| 1831 | |
| 1832 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1833 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1834 | |
| 1835 | #else |
| 1836 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1837 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1838 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1839 | |
| 1840 | /*Sending NoA attributes during connection*/ |
| 1841 | strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1842 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1843 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1844 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1845 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1846 | gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1847 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1848 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
| 1849 | s32Error = -EFAULT; |
| 1850 | goto ERRORHANDLER; |
| 1851 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1852 | |
| 1853 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1854 | |
| 1855 | |
| 1856 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1857 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1858 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1859 | } |
| 1860 | pu8CurrByte += MAX_SSID_LEN; |
| 1861 | |
| 1862 | /* BSS type*/ |
| 1863 | *(pu8CurrByte++) = INFRASTRUCTURE; |
| 1864 | /* Channel*/ |
| 1865 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1866 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1867 | } else { |
| 1868 | PRINT_ER("Channel out of range\n"); |
| 1869 | *(pu8CurrByte++) = 0xFF; |
| 1870 | } |
| 1871 | /* Cap Info*/ |
| 1872 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1873 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1874 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1875 | |
| 1876 | /* sa*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1877 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1878 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1879 | pu8CurrByte += 6; |
| 1880 | |
| 1881 | /* bssid*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1882 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1883 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1884 | pu8CurrByte += 6; |
| 1885 | |
| 1886 | /* Beacon Period*/ |
| 1887 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1888 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1889 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1890 | /* DTIM Period*/ |
| 1891 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1892 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
| 1893 | /* Supported rates*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1894 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1895 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1896 | |
| 1897 | /* wmm cap*/ |
| 1898 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1899 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
| 1900 | /* uapsd cap*/ |
| 1901 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1902 | |
| 1903 | /* ht cap*/ |
| 1904 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
| 1905 | /* copy this information to the user request */ |
| 1906 | pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
| 1907 | |
| 1908 | /* rsn found*/ |
| 1909 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1910 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
| 1911 | /* rsn group policy*/ |
| 1912 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1913 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
| 1914 | /* mode_802_11i*/ |
| 1915 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1916 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
| 1917 | /* rsn pcip policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1918 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1919 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1920 | |
| 1921 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1922 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1923 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1924 | |
| 1925 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1926 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1927 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1928 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1929 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
| 1930 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1931 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; |
| 1932 | if (ptstrJoinBssParam->u8NoaEnbaled) { |
| 1933 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1934 | |
| 1935 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1936 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1937 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1938 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1939 | |
| 1940 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; |
| 1941 | |
| 1942 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; |
| 1943 | |
| 1944 | if (ptstrJoinBssParam->u8OppEnable) |
| 1945 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; |
| 1946 | |
| 1947 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; |
| 1948 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1949 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1950 | |
| 1951 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); |
| 1952 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1953 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1954 | |
| 1955 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); |
| 1956 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1957 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1958 | |
| 1959 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); |
| 1960 | |
| 1961 | } else |
| 1962 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1963 | |
| 1964 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1965 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1966 | |
| 1967 | |
| 1968 | #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/ |
| 1969 | u32WidsCount++; |
| 1970 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1971 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1972 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1973 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1974 | /* ////////////////////// */ |
| 1975 | gu32WidConnRstHack = 0; |
| 1976 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1977 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1978 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1979 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1980 | gu8FlushedJoinReqDrvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1981 | } |
| 1982 | |
| 1983 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1984 | |
| 1985 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1986 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1987 | |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1988 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
| 1989 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1990 | } |
| 1991 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1992 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1993 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1994 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1995 | PRINT_ER("failed to send config packet\n"); |
| 1996 | s32Error = -EFAULT; |
| 1997 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1998 | } else { |
| 1999 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
| 2000 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 2001 | } |
| 2002 | #endif |
| 2003 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2004 | ERRORHANDLER: |
| 2005 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2006 | tstrConnectInfo strConnectInfo; |
| 2007 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2008 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2009 | |
| 2010 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 2011 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2012 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2013 | |
| 2014 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2015 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2016 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2017 | |
| 2018 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
| 2019 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2020 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2021 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2022 | pstrHostIFconnectAttr->pu8IEs, |
| 2023 | pstrHostIFconnectAttr->IEsLen); |
| 2024 | } |
| 2025 | |
| 2026 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2027 | &strConnectInfo, |
| 2028 | MAC_DISCONNECTED, |
| 2029 | NULL, |
| 2030 | pstrHostIFconnectAttr->pvUserArg); |
| 2031 | /*Change state to idle*/ |
| 2032 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2033 | /* Deallocation */ |
| 2034 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2035 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2036 | strConnectInfo.pu8ReqIEs = NULL; |
| 2037 | } |
| 2038 | |
| 2039 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2040 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2041 | } |
| 2042 | } |
| 2043 | |
| 2044 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
| 2045 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ |
| 2046 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2047 | kfree(pstrHostIFconnectAttr->pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2048 | pstrHostIFconnectAttr->pu8bssid = NULL; |
| 2049 | } |
| 2050 | |
| 2051 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ |
| 2052 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2053 | kfree(pstrHostIFconnectAttr->pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2054 | pstrHostIFconnectAttr->pu8ssid = NULL; |
| 2055 | } |
| 2056 | |
| 2057 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ |
| 2058 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2059 | kfree(pstrHostIFconnectAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2060 | pstrHostIFconnectAttr->pu8IEs = NULL; |
| 2061 | } |
| 2062 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2063 | if (pu8CurrByte != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2064 | kfree(pu8CurrByte); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2065 | return s32Error; |
| 2066 | } |
| 2067 | |
| 2068 | /** |
| 2069 | * @brief Handle_FlushConnect |
| 2070 | * @details Sending config packet to firmware to flush an old connection |
| 2071 | * after switching FW from station one to hybrid one |
| 2072 | * @param[in] void * drvHandler |
| 2073 | * @return Error code. |
| 2074 | * @author Amr Abdel-Moghny |
| 2075 | * @date 19 DEC 2013 |
| 2076 | * @version 8.0 |
| 2077 | */ |
| 2078 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2079 | static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2080 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2081 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2082 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2083 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2084 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2085 | |
| 2086 | |
| 2087 | /* IEs to be inserted in Association Request */ |
| 2088 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 2089 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 2090 | strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc; |
| 2091 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize; |
| 2092 | u32WidsCount++; |
| 2093 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2094 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2095 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2096 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2097 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2098 | u32WidsCount++; |
| 2099 | |
| 2100 | |
| 2101 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2102 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2103 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2104 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2105 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2106 | u32WidsCount++; |
| 2107 | |
| 2108 | |
| 2109 | #ifdef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2110 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2111 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 2112 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2113 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2114 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 2115 | |
| 2116 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 2117 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 2118 | |
| 2119 | u32WidsCount++; |
| 2120 | |
| 2121 | #endif |
| 2122 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2123 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 2124 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2125 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2126 | PRINT_ER("failed to send config packet\n"); |
| 2127 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2128 | } |
| 2129 | |
| 2130 | return s32Error; |
| 2131 | } |
| 2132 | |
| 2133 | /** |
| 2134 | * @brief Handle_ConnectTimeout |
| 2135 | * @details Call connect notification callback function indicating connection failure |
| 2136 | * @param[in] NONE |
| 2137 | * @return Error code. |
| 2138 | * @author |
| 2139 | * @date |
| 2140 | * @version 1.0 |
| 2141 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2142 | static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2143 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2144 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2145 | tstrConnectInfo strConnectInfo; |
| 2146 | tstrWID strWID; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2147 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2148 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 2149 | |
| 2150 | if (pstrWFIDrv == NULL) { |
| 2151 | PRINT_ER("Driver handler is NULL\n"); |
| 2152 | return s32Error; |
| 2153 | } |
| 2154 | |
| 2155 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2156 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2157 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2158 | |
| 2159 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2160 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2161 | |
| 2162 | |
| 2163 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, |
| 2164 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2165 | * WID_DISCONNECT} */ |
| 2166 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2167 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2168 | memcpy(strConnectInfo.au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2169 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
| 2170 | } |
| 2171 | |
| 2172 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2173 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2174 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2175 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2176 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2177 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2178 | } |
| 2179 | |
| 2180 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2181 | &strConnectInfo, |
| 2182 | MAC_DISCONNECTED, |
| 2183 | NULL, |
| 2184 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2185 | |
| 2186 | /* Deallocation of strConnectInfo.pu8ReqIEs */ |
| 2187 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2188 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2189 | strConnectInfo.pu8ReqIEs = NULL; |
| 2190 | } |
| 2191 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2192 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2193 | } |
| 2194 | |
| 2195 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2196 | * WID_DISCONNECT} */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2197 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2198 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2199 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2200 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2201 | |
| 2202 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 2203 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2204 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 2205 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2206 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2207 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2208 | |
| 2209 | /* Deallocation of the Saved Connect Request in the global Handle */ |
| 2210 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2211 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2212 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2213 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2214 | } |
| 2215 | |
| 2216 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2217 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2218 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2219 | } |
| 2220 | |
| 2221 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2222 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2223 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2224 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2225 | } |
| 2226 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2227 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2228 | /*Freeing flushed join request params on connect timeout*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2229 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2230 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2231 | gu8FlushedJoinReq = NULL; |
| 2232 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2233 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2234 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2235 | gu8FlushedInfoElemAsoc = NULL; |
| 2236 | } |
| 2237 | |
| 2238 | return s32Error; |
| 2239 | } |
| 2240 | |
| 2241 | /** |
| 2242 | * @brief Handle_RcvdNtwrkInfo |
| 2243 | * @details Handling received network information |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 2244 | * @param[in] struct rcvd_net_info *pstrRcvdNetworkInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2245 | * @return Error code. |
| 2246 | * @author |
| 2247 | * @date |
| 2248 | * @version 1.0 |
| 2249 | */ |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 2250 | static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, |
| 2251 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2252 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2253 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2254 | bool bNewNtwrkFound; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2255 | |
| 2256 | |
| 2257 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2258 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2259 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 2260 | void *pJoinParams = NULL; |
| 2261 | |
| 2262 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2263 | |
| 2264 | |
| 2265 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2266 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2267 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 2268 | |
| 2269 | /*if there is a an ongoing scan request*/ |
| 2270 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2271 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
| 2272 | ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); |
| 2273 | if ((pstrNetworkInfo == NULL) |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2274 | || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2275 | PRINT_ER("driver is null\n"); |
| 2276 | s32Error = -EINVAL; |
| 2277 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2278 | } |
| 2279 | |
| 2280 | /* check whether this network is discovered before */ |
| 2281 | for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
| 2282 | |
| 2283 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && |
| 2284 | (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 2285 | if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2286 | pstrNetworkInfo->au8bssid, 6) == 0) { |
| 2287 | if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
| 2288 | /*we have already found this network with better rssi, so keep the old cached one and don't |
| 2289 | * send anything to the upper layer */ |
| 2290 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 2291 | goto done; |
| 2292 | } else { |
| 2293 | /* here the same already found network is found again but with a better rssi, so just update |
| 2294 | * the rssi for this cached network and send this updated network to the upper layer but |
| 2295 | * don't add a new record for it */ |
| 2296 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2297 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2298 | break; |
| 2299 | } |
| 2300 | } |
| 2301 | } |
| 2302 | } |
| 2303 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2304 | if (bNewNtwrkFound == true) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2305 | /* here it is confirmed that it is a new discovered network, |
| 2306 | * so add its record then call the User CallBack function */ |
| 2307 | |
| 2308 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 2309 | |
| 2310 | if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 2311 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
| 2312 | |
| 2313 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) |
| 2314 | && (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2315 | memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2316 | pstrNetworkInfo->au8bssid, 6); |
| 2317 | |
| 2318 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; |
| 2319 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2320 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2321 | /* add new BSS to JoinBssTable */ |
| 2322 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2323 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
| 2324 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 2325 | |
| 2326 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2327 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, |
| 2328 | pJoinParams); |
| 2329 | |
| 2330 | |
| 2331 | } |
| 2332 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2333 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2334 | } |
| 2335 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2336 | pstrNetworkInfo->bNewNetwork = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2337 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
| 2338 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2339 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2340 | } |
| 2341 | } |
| 2342 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2343 | done: |
| 2344 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2345 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2346 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2347 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
| 2348 | } |
| 2349 | |
| 2350 | /*free structure allocated*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2351 | if (pstrNetworkInfo != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2352 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2353 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2354 | } |
| 2355 | |
| 2356 | return s32Error; |
| 2357 | } |
| 2358 | |
| 2359 | /** |
| 2360 | * @brief Handle_RcvdGnrlAsyncInfo |
| 2361 | * @details Handling received asynchrous general network information |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2362 | * @param[in] struct rcvd_async_info *pstrRcvdGnrlAsyncInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2363 | * @return Error code. |
| 2364 | * @author |
| 2365 | * @date |
| 2366 | * @version 1.0 |
| 2367 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2368 | static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, |
| 2369 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2370 | { |
| 2371 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ |
| 2372 | /* which carries only 1 WID which have WID ID = WID_STATUS */ |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2373 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2374 | u8 u8MsgType = 0; |
| 2375 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2376 | u16 u16MsgLen = 0; |
| 2377 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2378 | u8 u8WidLen = 0; |
| 2379 | u8 u8MacStatus; |
| 2380 | u8 u8MacStatusReasonCode; |
| 2381 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2382 | tstrConnectInfo strConnectInfo; |
| 2383 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2384 | s32 s32Err = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2385 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2386 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2387 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2388 | PRINT_ER("Driver handler is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2389 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, |
| 2390 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); |
| 2391 | |
| 2392 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 2393 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 2394 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2395 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2396 | (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2397 | PRINT_ER("driver is null\n"); |
| 2398 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2399 | } |
| 2400 | |
| 2401 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; |
| 2402 | |
| 2403 | /* Check whether the received message type is 'I' */ |
| 2404 | if ('I' != u8MsgType) { |
| 2405 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2406 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2407 | } |
| 2408 | |
| 2409 | /* Extract message ID */ |
| 2410 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; |
| 2411 | |
| 2412 | /* Extract message Length */ |
| 2413 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); |
| 2414 | |
| 2415 | /* Extract WID ID [expected to be = WID_STATUS] */ |
| 2416 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); |
| 2417 | |
| 2418 | /* Extract WID Length [expected to be = 1] */ |
| 2419 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; |
| 2420 | |
| 2421 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ |
| 2422 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; |
| 2423 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; |
| 2424 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; |
| 2425 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2426 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2427 | /* 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] | 2428 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2429 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 2430 | |
| 2431 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2432 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2433 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2434 | |
| 2435 | if (u8MacStatus == MAC_CONNECTED) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2436 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2437 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2438 | host_int_get_assoc_res_info(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2439 | gapu8RcvdAssocResp, |
| 2440 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 2441 | &u32RcvdAssocRespInfoLen); |
| 2442 | |
| 2443 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 2444 | |
| 2445 | if (u32RcvdAssocRespInfoLen != 0) { |
| 2446 | |
| 2447 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
| 2448 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, |
| 2449 | &pstrConnectRespInfo); |
| 2450 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2451 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2452 | } else { |
| 2453 | /* use the necessary parsed Info from the Received Association Response */ |
| 2454 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 2455 | |
| 2456 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 2457 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
| 2458 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { |
| 2459 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
| 2460 | |
| 2461 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2462 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2463 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2464 | pstrConnectRespInfo->u16RespIEsLen); |
| 2465 | } |
| 2466 | } |
| 2467 | |
| 2468 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ |
| 2469 | if (pstrConnectRespInfo != NULL) { |
| 2470 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 2471 | pstrConnectRespInfo = NULL; |
| 2472 | } |
| 2473 | } |
| 2474 | } |
| 2475 | } |
| 2476 | |
| 2477 | /* The station has just received mac status and it also received assoc. response which |
| 2478 | * it was waiting for. |
| 2479 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ |
| 2480 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2481 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2482 | 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] | 2483 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2484 | |
| 2485 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 2486 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2487 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2488 | } |
| 2489 | |
| 2490 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ |
| 2491 | /* through a structure of type tstrConnectRespInfo */ |
| 2492 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
| 2493 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2494 | memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2495 | |
| 2496 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2497 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2498 | memcpy(pstrWFIDrv->au8AssociatedBSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2499 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
| 2500 | } |
| 2501 | } |
| 2502 | |
| 2503 | |
| 2504 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2505 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2506 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2507 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2508 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2509 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2510 | } |
| 2511 | |
| 2512 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2513 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2514 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2515 | &strConnectInfo, |
| 2516 | u8MacStatus, |
| 2517 | NULL, |
| 2518 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2519 | |
| 2520 | |
| 2521 | /* if received mac status is MAC_CONNECTED and |
| 2522 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED |
| 2523 | * else change state to IDLE */ |
| 2524 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2525 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
| 2526 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2527 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2528 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2529 | #endif |
| 2530 | |
| 2531 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
| 2532 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED; |
| 2533 | |
| 2534 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2535 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2536 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2537 | mod_timer(&hDuringIpTimer, |
| 2538 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2539 | #endif |
| 2540 | |
| 2541 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2542 | /* open a BA session if possible */ |
| 2543 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ |
| 2544 | |
| 2545 | #endif |
| 2546 | |
| 2547 | /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */ |
| 2548 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ |
| 2549 | } else { |
| 2550 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
| 2551 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2552 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2553 | } |
| 2554 | |
| 2555 | /* Deallocation */ |
| 2556 | if (strConnectInfo.pu8RespIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2557 | kfree(strConnectInfo.pu8RespIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2558 | strConnectInfo.pu8RespIEs = NULL; |
| 2559 | } |
| 2560 | |
| 2561 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2562 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2563 | strConnectInfo.pu8ReqIEs = NULL; |
| 2564 | } |
| 2565 | |
| 2566 | |
| 2567 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2568 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2569 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2570 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2571 | } |
| 2572 | |
| 2573 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2574 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2575 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2576 | } |
| 2577 | |
| 2578 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2579 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2580 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2581 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2582 | } |
| 2583 | |
| 2584 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2585 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) { |
| 2586 | /* Disassociation or Deauthentication frame has been received */ |
| 2587 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 2588 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2589 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2590 | |
| 2591 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2592 | 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] | 2593 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2594 | Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); |
| 2595 | } |
| 2596 | |
| 2597 | strDisconnectNotifInfo.u16reason = 0; |
| 2598 | strDisconnectNotifInfo.ie = NULL; |
| 2599 | strDisconnectNotifInfo.ie_len = 0; |
| 2600 | |
| 2601 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2602 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2603 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2604 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2605 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2606 | #endif |
| 2607 | |
| 2608 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2609 | NULL, |
| 2610 | 0, |
| 2611 | &strDisconnectNotifInfo, |
| 2612 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2613 | |
| 2614 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2615 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2616 | } |
| 2617 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2618 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2619 | |
| 2620 | |
| 2621 | /* Deallocation */ |
| 2622 | |
| 2623 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they |
| 2624 | * should be deallocated here */ |
| 2625 | /* |
| 2626 | * if(strDisconnectNotifInfo.ie != NULL) |
| 2627 | * { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2628 | * kfree(strDisconnectNotifInfo.ie); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2629 | * strDisconnectNotifInfo.ie = NULL; |
| 2630 | * } |
| 2631 | */ |
| 2632 | |
| 2633 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2634 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2635 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2636 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2637 | } |
| 2638 | |
| 2639 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2640 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2641 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2642 | } |
| 2643 | |
| 2644 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2645 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2646 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2647 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2648 | } |
| 2649 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2650 | /*Freeing flushed join request params on receiving*/ |
| 2651 | /*MAC_DISCONNECTED while connected*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2652 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2653 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2654 | gu8FlushedJoinReq = NULL; |
| 2655 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2656 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2657 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2658 | gu8FlushedInfoElemAsoc = NULL; |
| 2659 | } |
| 2660 | |
| 2661 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2662 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2663 | |
| 2664 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2665 | (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { |
| 2666 | 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] | 2667 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2668 | /*Abort the running scan*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2669 | del_timer(&pstrWFIDrv->hScanTimer); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2670 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2671 | Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2672 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2673 | } |
| 2674 | |
| 2675 | } |
| 2676 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2677 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2678 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2679 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2680 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
| 2681 | } |
| 2682 | |
| 2683 | return s32Error; |
| 2684 | } |
| 2685 | |
| 2686 | /** |
| 2687 | * @brief Handle_Key |
| 2688 | * @details Sending config packet to firmware to set key |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame^] | 2689 | * @param[in] struct key_attr *pstrHostIFkeyAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2690 | * @return Error code. |
| 2691 | * @author |
| 2692 | * @date |
| 2693 | * @version 1.0 |
| 2694 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame^] | 2695 | static int Handle_Key(tstrWILC_WFIDrv *drvHandler, |
| 2696 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2697 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2698 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2699 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2700 | tstrWID strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2701 | u8 i; |
| 2702 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2703 | s8 s8idxarray[1]; |
| 2704 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2705 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2706 | |
| 2707 | |
| 2708 | switch (pstrHostIFkeyAttr->enuKeyType) { |
| 2709 | |
| 2710 | |
| 2711 | case WEP: |
| 2712 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2713 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2714 | |
| 2715 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
| 2716 | 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] | 2717 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2718 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2719 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2720 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2721 | |
| 2722 | strWIDList[1].u16WIDid = WID_AUTH_TYPE; |
| 2723 | strWIDList[1].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2724 | strWIDList[1].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2725 | strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2726 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2727 | strWIDList[2].u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2728 | strWIDList[2].enuWIDtype = WID_CHAR; |
| 2729 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2730 | strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2731 | strWIDList[2].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2732 | |
| 2733 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2734 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2735 | |
| 2736 | |
| 2737 | if (pu8keybuf == NULL) { |
| 2738 | PRINT_ER("No buffer to send Key\n"); |
| 2739 | return -1; |
| 2740 | } |
| 2741 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2742 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2743 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2744 | |
| 2745 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2746 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2747 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2748 | strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2749 | strWIDList[3].enuWIDtype = WID_STR; |
| 2750 | strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2751 | strWIDList[3].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2752 | |
| 2753 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2754 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, |
| 2755 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2756 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2757 | |
| 2758 | |
| 2759 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2760 | |
| 2761 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2762 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2763 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2764 | if (pu8keybuf == NULL) { |
| 2765 | PRINT_ER("No buffer to send Key\n"); |
| 2766 | return -1; |
| 2767 | } |
| 2768 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
| 2769 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2770 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2771 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2772 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2773 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2774 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2775 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2776 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2777 | strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2778 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2779 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2780 | strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; |
| 2781 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2782 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2783 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2784 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2785 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
| 2786 | |
| 2787 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2788 | strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2789 | strWID.enuWIDtype = WID_STR; |
| 2790 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2791 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2792 | strWID.ps8WidVal = s8idxarray; |
| 2793 | strWID.s32ValueSize = 1; |
| 2794 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2795 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2796 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2797 | } else { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2798 | strWID.u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2799 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2800 | strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2801 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2802 | |
| 2803 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 2804 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2805 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2806 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2807 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2808 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2809 | break; |
| 2810 | |
| 2811 | case WPARxGtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2812 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2813 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2814 | if (pu8keybuf == NULL) { |
| 2815 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2816 | ret = -1; |
| 2817 | goto _WPARxGtk_end_case_; |
| 2818 | } |
| 2819 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2820 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2821 | |
| 2822 | |
| 2823 | /*|----------------------------------------------------------------------------| |
| 2824 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2825 | * |------------|---------|-------|------------|---------------|----------------| |
| 2826 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2827 | |
| 2828 | |
| 2829 | |
| 2830 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2831 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2832 | |
| 2833 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2834 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2835 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2836 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2837 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2838 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2839 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2840 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2841 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2842 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2843 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2844 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2845 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2846 | strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2847 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2848 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2849 | strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2850 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2851 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2852 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2853 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2854 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2855 | |
| 2856 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2857 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2858 | /* ///////////////////////// */ |
| 2859 | } |
| 2860 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2861 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2862 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 2863 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2864 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2865 | if (pu8keybuf == NULL) { |
| 2866 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2867 | ret = -1; |
| 2868 | goto _WPARxGtk_end_case_; |
| 2869 | } |
| 2870 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2871 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2872 | |
| 2873 | |
| 2874 | /*|----------------------------------------------------------------------------| |
| 2875 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2876 | * |------------|---------|-------|------------|---------------|----------------| |
| 2877 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2878 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2879 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2880 | memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2881 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2882 | 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] | 2883 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2884 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2885 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2886 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2887 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2888 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
| 2889 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2890 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2891 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2892 | strWID.u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2893 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2894 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2895 | strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2896 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2897 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2898 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2899 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2900 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2901 | |
| 2902 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2903 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2904 | /* ///////////////////////// */ |
| 2905 | } |
| 2906 | _WPARxGtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2907 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
| 2908 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2909 | if (ret == -1) |
| 2910 | return ret; |
| 2911 | |
| 2912 | break; |
| 2913 | |
| 2914 | case WPAPtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2915 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2916 | |
| 2917 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2918 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2919 | |
| 2920 | |
| 2921 | |
| 2922 | if (pu8keybuf == NULL) { |
| 2923 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2924 | ret = -1; |
| 2925 | goto _WPAPtk_end_case_; |
| 2926 | |
| 2927 | } |
| 2928 | |
| 2929 | /*|-----------------------------------------------------------------------------| |
| 2930 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2931 | * |----------------|------------ |--------------|----------------|---------------| |
| 2932 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2933 | |-----------------------------------------------------------------------------|*/ |
| 2934 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2935 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2936 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2937 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
| 2938 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2939 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2940 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2941 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2942 | |
| 2943 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2944 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2945 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2946 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2947 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2948 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2949 | strWIDList[1].u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2950 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2951 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2952 | strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; |
| 2953 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2954 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2955 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2956 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2957 | |
| 2958 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2959 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2960 | /* ///////////////////////// */ |
| 2961 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2962 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2963 | |
| 2964 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2965 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2966 | |
| 2967 | |
| 2968 | |
| 2969 | if (pu8keybuf == NULL) { |
| 2970 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2971 | ret = -1; |
| 2972 | goto _WPAPtk_end_case_; |
| 2973 | |
| 2974 | } |
| 2975 | |
| 2976 | /*|-----------------------------------------------------------------------------| |
| 2977 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2978 | * |----------------|------------|--------------|----------------|---------------| |
| 2979 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2980 | |-----------------------------------------------------------------------------|*/ |
| 2981 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2982 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2983 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2984 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2985 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2986 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2987 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2988 | |
| 2989 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2990 | strWID.u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2991 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2992 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2993 | strWID.s32ValueSize = PTK_KEY_MSG_LEN; |
| 2994 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2995 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2996 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2997 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2998 | |
| 2999 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3000 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3001 | /* ///////////////////////// */ |
| 3002 | } |
| 3003 | |
| 3004 | _WPAPtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3005 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3006 | if (ret == -1) |
| 3007 | return ret; |
| 3008 | |
| 3009 | break; |
| 3010 | |
| 3011 | |
| 3012 | case PMKSA: |
| 3013 | |
| 3014 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 3015 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3016 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3017 | if (pu8keybuf == NULL) { |
| 3018 | PRINT_ER("No buffer to send PMKSA Key\n"); |
| 3019 | return -1; |
| 3020 | } |
| 3021 | |
| 3022 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; |
| 3023 | |
| 3024 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { |
| 3025 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3026 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); |
| 3027 | 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] | 3028 | } |
| 3029 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3030 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
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 = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1; |
| 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)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3037 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3038 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3039 | break; |
| 3040 | } |
| 3041 | |
| 3042 | if (s32Error) |
| 3043 | PRINT_ER("Failed to send key config packet\n"); |
| 3044 | |
| 3045 | |
| 3046 | return s32Error; |
| 3047 | } |
| 3048 | |
| 3049 | |
| 3050 | /** |
| 3051 | * @brief Handle_Disconnect |
| 3052 | * @details Sending config packet to firmware to disconnect |
| 3053 | * @param[in] NONE |
| 3054 | * @return NONE |
| 3055 | * @author |
| 3056 | * @date |
| 3057 | * @version 1.0 |
| 3058 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3059 | static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3060 | { |
| 3061 | tstrWID strWID; |
| 3062 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3063 | s32 s32Error = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3064 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3065 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3066 | |
| 3067 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3068 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3069 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3070 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3071 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3072 | |
| 3073 | |
| 3074 | |
| 3075 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 3076 | |
| 3077 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3078 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3079 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3080 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3081 | #endif |
| 3082 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3083 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3084 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3085 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3086 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3087 | |
| 3088 | if (s32Error) { |
| 3089 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3090 | } else { |
| 3091 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 3092 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3093 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3094 | |
| 3095 | strDisconnectNotifInfo.u16reason = 0; |
| 3096 | strDisconnectNotifInfo.ie = NULL; |
| 3097 | strDisconnectNotifInfo.ie_len = 0; |
| 3098 | |
| 3099 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3100 | del_timer(&pstrWFIDrv->hScanTimer); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3101 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3102 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 3103 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3104 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3105 | } |
| 3106 | |
| 3107 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 3108 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3109 | /*Stop connect timer, if connection in progress*/ |
| 3110 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3111 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3112 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3113 | } |
| 3114 | |
| 3115 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 3116 | 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 3117 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3118 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3119 | } |
| 3120 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3121 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3122 | |
| 3123 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 3124 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3125 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3126 | |
| 3127 | |
| 3128 | /* Deallocation */ |
| 3129 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 3130 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3131 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3132 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 3133 | } |
| 3134 | |
| 3135 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3136 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3137 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 3138 | } |
| 3139 | |
| 3140 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 3141 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3142 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3143 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 3144 | } |
| 3145 | |
| 3146 | |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3147 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3148 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3149 | gu8FlushedJoinReq = NULL; |
| 3150 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3151 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3152 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3153 | gu8FlushedInfoElemAsoc = NULL; |
| 3154 | } |
| 3155 | |
| 3156 | } |
| 3157 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3158 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3159 | up(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3160 | /* ///////////////////////// */ |
| 3161 | |
| 3162 | } |
| 3163 | |
| 3164 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3165 | void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3166 | { |
| 3167 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 3168 | |
| 3169 | pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3170 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3171 | return; |
| 3172 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { |
| 3173 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3174 | host_int_disconnect(pstrWFIDrv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3175 | } |
| 3176 | } |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3177 | static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3178 | { |
| 3179 | |
| 3180 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3181 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3182 | tstrWID strWID; |
| 3183 | static char dummy = 9; |
| 3184 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3185 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3186 | strWID.u16WIDid = (u16)WID_LOGTerminal_Switch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3187 | strWID.enuWIDtype = WID_CHAR; |
| 3188 | strWID.ps8WidVal = &dummy; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3189 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3190 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3191 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3192 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3193 | |
| 3194 | |
| 3195 | if (s32Error) { |
| 3196 | PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3197 | PRINT_ER("Failed to switch log terminal\n"); |
| 3198 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3199 | } |
| 3200 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3201 | PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3202 | |
| 3203 | return s32Error; |
| 3204 | } |
| 3205 | |
| 3206 | /** |
| 3207 | * @brief Handle_GetChnl |
| 3208 | * @details Sending config packet to get channel |
| 3209 | * @param[in] NONE |
| 3210 | * @return NONE |
| 3211 | * |
| 3212 | * @author |
| 3213 | * @date |
| 3214 | * @version 1.0 |
| 3215 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3216 | static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3217 | { |
| 3218 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3219 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3220 | tstrWID strWID; |
| 3221 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 3222 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3223 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3224 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3225 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3226 | strWID.ps8WidVal = (s8 *)&gu8Chnl; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3227 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3228 | |
| 3229 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 3230 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3231 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3232 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3233 | /*get the value by searching the local copy*/ |
| 3234 | if (s32Error) { |
| 3235 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3236 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3237 | } |
| 3238 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3239 | up(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3240 | |
| 3241 | return s32Error; |
| 3242 | |
| 3243 | |
| 3244 | |
| 3245 | } |
| 3246 | |
| 3247 | |
| 3248 | /** |
| 3249 | * @brief Handle_GetRssi |
| 3250 | * @details Sending config packet to get RSSI |
| 3251 | * @param[in] NONE |
| 3252 | * @return NONE |
| 3253 | * @author |
| 3254 | * @date |
| 3255 | * @version 1.0 |
| 3256 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3257 | static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3258 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3259 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3260 | tstrWID strWID; |
| 3261 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3262 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3263 | strWID.u16WIDid = (u16)WID_RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3264 | strWID.enuWIDtype = WID_CHAR; |
| 3265 | strWID.ps8WidVal = &gs8Rssi; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3266 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3267 | |
| 3268 | /*Sending Cfg*/ |
| 3269 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 3270 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3271 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3272 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3273 | if (s32Error) { |
| 3274 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3275 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3276 | } |
| 3277 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3278 | up(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3279 | |
| 3280 | |
| 3281 | } |
| 3282 | |
| 3283 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3284 | static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3285 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3286 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3287 | tstrWID strWID; |
| 3288 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3289 | |
| 3290 | gs8lnkspd = 0; |
| 3291 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3292 | strWID.u16WIDid = (u16)WID_LINKSPEED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3293 | strWID.enuWIDtype = WID_CHAR; |
| 3294 | strWID.ps8WidVal = &gs8lnkspd; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3295 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3296 | /*Sending Cfg*/ |
| 3297 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 3298 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3299 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3300 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3301 | if (s32Error) { |
| 3302 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3303 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3304 | } |
| 3305 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3306 | up(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3307 | |
| 3308 | |
| 3309 | } |
| 3310 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3311 | s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3312 | { |
| 3313 | tstrWID strWIDList[5]; |
Chaehyun Lim | fbc2fe1 | 2015-09-15 14:06:16 +0900 | [diff] [blame] | 3314 | u32 u32WidsCount = 0, s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3315 | |
| 3316 | strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED; |
| 3317 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3318 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3319 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3320 | u32WidsCount++; |
| 3321 | |
| 3322 | strWIDList[u32WidsCount].u16WIDid = WID_RSSI; |
| 3323 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3324 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3325 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3326 | u32WidsCount++; |
| 3327 | |
| 3328 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 3329 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3330 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3331 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3332 | u32WidsCount++; |
| 3333 | |
| 3334 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 3335 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3336 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3337 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3338 | u32WidsCount++; |
| 3339 | |
| 3340 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 3341 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3342 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3343 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3344 | u32WidsCount++; |
| 3345 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3346 | s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, |
| 3347 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3348 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3349 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3350 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3351 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3352 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3353 | return 0; |
| 3354 | |
| 3355 | } |
| 3356 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3357 | /** |
| 3358 | * @brief Handle_Get_InActiveTime |
| 3359 | * @details Sending config packet to set mac adddress for station and |
| 3360 | * get inactive time |
| 3361 | * @param[in] NONE |
| 3362 | * @return NONE |
| 3363 | * |
| 3364 | * @author |
| 3365 | * @date |
| 3366 | * @version 1.0 |
| 3367 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3368 | static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, tstrHostIfStaInactiveT *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3369 | { |
| 3370 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3371 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3372 | u8 *stamac; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3373 | tstrWID strWID; |
| 3374 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3375 | |
| 3376 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3377 | strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3378 | strWID.enuWIDtype = WID_STR; |
| 3379 | strWID.s32ValueSize = ETH_ALEN; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3380 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3381 | |
| 3382 | |
| 3383 | stamac = strWID.ps8WidVal; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3384 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3385 | |
| 3386 | |
| 3387 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 3388 | |
| 3389 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3390 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3391 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3392 | /*get the value by searching the local copy*/ |
| 3393 | if (s32Error) { |
| 3394 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3395 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3396 | } |
| 3397 | |
| 3398 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3399 | strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3400 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3401 | strWID.ps8WidVal = (s8 *)&gu32InactiveTime; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3402 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3403 | |
| 3404 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3405 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3406 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3407 | /*get the value by searching the local copy*/ |
| 3408 | if (s32Error) { |
| 3409 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3410 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3411 | } |
| 3412 | |
| 3413 | |
| 3414 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); |
| 3415 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3416 | up(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3417 | |
| 3418 | return s32Error; |
| 3419 | |
| 3420 | |
| 3421 | |
| 3422 | } |
| 3423 | |
| 3424 | |
| 3425 | /** |
| 3426 | * @brief Handle_AddBeacon |
| 3427 | * @details Sending config packet to add beacon |
| 3428 | * @param[in] tstrHostIFSetBeacon* pstrSetBeaconParam |
| 3429 | * @return NONE |
| 3430 | * @author |
| 3431 | * @date |
| 3432 | * @version 1.0 |
| 3433 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3434 | static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetBeacon *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3435 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3436 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3437 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3438 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3439 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3440 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3441 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 3442 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3443 | strWID.u16WIDid = (u16)WID_ADD_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3444 | strWID.enuWIDtype = WID_BIN; |
| 3445 | strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3446 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3447 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3448 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3449 | |
| 3450 | pu8CurrByte = strWID.ps8WidVal; |
| 3451 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); |
| 3452 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); |
| 3453 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); |
| 3454 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); |
| 3455 | |
| 3456 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); |
| 3457 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); |
| 3458 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); |
| 3459 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); |
| 3460 | |
| 3461 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); |
| 3462 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); |
| 3463 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); |
| 3464 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); |
| 3465 | |
| 3466 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); |
| 3467 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; |
| 3468 | |
| 3469 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); |
| 3470 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); |
| 3471 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); |
| 3472 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); |
| 3473 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3474 | if (pstrSetBeaconParam->pu8Tail > 0) |
| 3475 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); |
| 3476 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; |
| 3477 | |
| 3478 | |
| 3479 | |
| 3480 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3481 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3482 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3483 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3484 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3485 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3486 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3487 | kfree(strWID.ps8WidVal); |
| 3488 | kfree(pstrSetBeaconParam->pu8Head); |
| 3489 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3490 | } |
| 3491 | |
| 3492 | |
| 3493 | /** |
| 3494 | * @brief Handle_AddBeacon |
| 3495 | * @details Sending config packet to delete beacon |
| 3496 | * @param[in] tstrHostIFDelBeacon* pstrDelBeacon |
| 3497 | * @return NONE |
| 3498 | * @author |
| 3499 | * @date |
| 3500 | * @version 1.0 |
| 3501 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3502 | static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelBeacon *pstrDelBeacon) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3503 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3504 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3505 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3506 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3507 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3508 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3509 | strWID.u16WIDid = (u16)WID_DEL_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3510 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3511 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3512 | strWID.ps8WidVal = &gu8DelBcn; |
| 3513 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3514 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3515 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3516 | |
| 3517 | pu8CurrByte = strWID.ps8WidVal; |
| 3518 | |
| 3519 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
| 3520 | /* TODO: build del beacon message*/ |
| 3521 | |
| 3522 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3523 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3524 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3525 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3526 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3527 | } |
| 3528 | |
| 3529 | |
| 3530 | /** |
| 3531 | * @brief WILC_HostIf_PackStaParam |
| 3532 | * @details Handling packing of the station params in a buffer |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3533 | * @param[in] u8* pu8Buffer, tstrWILC_AddStaParam* pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3534 | * @return NONE |
| 3535 | * @author |
| 3536 | * @date |
| 3537 | * @version 1.0 |
| 3538 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3539 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3540 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3541 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3542 | |
| 3543 | pu8CurrByte = pu8Buffer; |
| 3544 | |
| 3545 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3546 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3547 | pu8CurrByte += ETH_ALEN; |
| 3548 | |
| 3549 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 3550 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 3551 | |
| 3552 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3553 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3554 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3555 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 3556 | |
| 3557 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 3558 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 3559 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 3560 | |
| 3561 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3562 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3563 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 3564 | |
| 3565 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 3566 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 3567 | |
| 3568 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 3569 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 3570 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 3571 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 3572 | |
| 3573 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 3574 | |
| 3575 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 3576 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 3577 | |
| 3578 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 3579 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 3580 | |
| 3581 | return pu8CurrByte - pu8Buffer; |
| 3582 | } |
| 3583 | |
| 3584 | /** |
| 3585 | * @brief Handle_AddStation |
| 3586 | * @details Sending config packet to add station |
| 3587 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3588 | * @return NONE |
| 3589 | * @author |
| 3590 | * @date |
| 3591 | * @version 1.0 |
| 3592 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3593 | static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3594 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3595 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3596 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3597 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3598 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3599 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3600 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3601 | strWID.u16WIDid = (u16)WID_ADD_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3602 | strWID.enuWIDtype = WID_BIN; |
| 3603 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3604 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3605 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3606 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3607 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3608 | |
| 3609 | pu8CurrByte = strWID.ps8WidVal; |
| 3610 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3611 | |
| 3612 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3613 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3614 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3615 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3616 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3617 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3618 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3619 | kfree(pstrStationParam->pu8Rates); |
| 3620 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3621 | } |
| 3622 | |
| 3623 | /** |
| 3624 | * @brief Handle_DelAllSta |
| 3625 | * @details Sending config packet to delete station |
| 3626 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3627 | * @return NONE |
| 3628 | * @author |
| 3629 | * @date |
| 3630 | * @version 1.0 |
| 3631 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3632 | static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3633 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3634 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3635 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3636 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3637 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3638 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3639 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 3640 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3641 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3642 | strWID.u16WIDid = (u16)WID_DEL_ALL_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3643 | strWID.enuWIDtype = WID_STR; |
| 3644 | strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; |
| 3645 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3646 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3647 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3648 | strWID.ps8WidVal = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3649 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3650 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3651 | |
| 3652 | pu8CurrByte = strWID.ps8WidVal; |
| 3653 | |
| 3654 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; |
| 3655 | |
| 3656 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 3657 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3658 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3659 | else |
| 3660 | continue; |
| 3661 | |
| 3662 | pu8CurrByte += ETH_ALEN; |
| 3663 | } |
| 3664 | |
| 3665 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3666 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3667 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3668 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3669 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3670 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3671 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3672 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3673 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3674 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3675 | } |
| 3676 | |
| 3677 | |
| 3678 | /** |
| 3679 | * @brief Handle_DelStation |
| 3680 | * @details Sending config packet to delete station |
| 3681 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3682 | * @return NONE |
| 3683 | * @author |
| 3684 | * @date |
| 3685 | * @version 1.0 |
| 3686 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3687 | static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3688 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3689 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3690 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3691 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3692 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3693 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3694 | strWID.u16WIDid = (u16)WID_REMOVE_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3695 | strWID.enuWIDtype = WID_BIN; |
| 3696 | strWID.s32ValueSize = ETH_ALEN; |
| 3697 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3698 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3699 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3700 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3701 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3702 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3703 | |
| 3704 | pu8CurrByte = strWID.ps8WidVal; |
| 3705 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3706 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3707 | |
| 3708 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3709 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3710 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3711 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3712 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3713 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3714 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3715 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3716 | } |
| 3717 | |
| 3718 | |
| 3719 | /** |
| 3720 | * @brief Handle_EditStation |
| 3721 | * @details Sending config packet to edit station |
| 3722 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3723 | * @return NONE |
| 3724 | * @author |
| 3725 | * @date |
| 3726 | * @version 1.0 |
| 3727 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3728 | static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, tstrWILC_AddStaParam *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3729 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3730 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3731 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3732 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3733 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3734 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3735 | strWID.u16WIDid = (u16)WID_EDIT_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3736 | strWID.enuWIDtype = WID_BIN; |
| 3737 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3738 | |
| 3739 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3740 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3741 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3742 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3743 | |
| 3744 | pu8CurrByte = strWID.ps8WidVal; |
| 3745 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3746 | |
| 3747 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3748 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3749 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3750 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3751 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3752 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3753 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3754 | kfree(pstrStationParam->pu8Rates); |
| 3755 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3756 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3757 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3758 | /** |
| 3759 | * @brief Handle_RemainOnChan |
| 3760 | * @details Sending config packet to edit station |
| 3761 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3762 | * @return NONE |
| 3763 | * @author |
| 3764 | * @date |
| 3765 | * @version 1.0 |
| 3766 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3767 | static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3768 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3769 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3770 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3771 | tstrWID strWID; |
| 3772 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3773 | |
| 3774 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ |
| 3775 | if (!pstrWFIDrv->u8RemainOnChan_pendingreq) { |
| 3776 | pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 3777 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 3778 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 3779 | pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 3780 | pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
| 3781 | } else { |
| 3782 | /*Set the channel to use it as a wid val*/ |
| 3783 | pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel; |
| 3784 | } |
| 3785 | |
| 3786 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 3787 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
| 3788 | pstrWFIDrv->u8RemainOnChan_pendingreq = 1; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3789 | s32Error = -EBUSY; |
| 3790 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3791 | } |
| 3792 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3793 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3794 | s32Error = -EBUSY; |
| 3795 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3796 | } |
| 3797 | |
| 3798 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3799 | if (g_obtainingIP || connecting) { |
| 3800 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3801 | s32Error = -EBUSY; |
| 3802 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3803 | } |
| 3804 | #endif |
| 3805 | |
| 3806 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 3807 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3808 | u8remain_on_chan_flag = true; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3809 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3810 | strWID.enuWIDtype = WID_STR; |
| 3811 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3812 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3813 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3814 | if (strWID.ps8WidVal == NULL) { |
| 3815 | s32Error = -ENOMEM; |
| 3816 | goto ERRORHANDLER; |
| 3817 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3818 | |
| 3819 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3820 | strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3821 | |
| 3822 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3823 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3824 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3825 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3826 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3827 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3828 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3829 | { |
| 3830 | P2P_LISTEN_STATE = 1; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3831 | pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; |
| 3832 | mod_timer(&pstrWFIDrv->hRemainOnChannel, |
| 3833 | jiffies + |
| 3834 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3835 | |
| 3836 | /*Calling CFG ready_on_channel*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3837 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3838 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3839 | |
| 3840 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 3841 | pstrWFIDrv->u8RemainOnChan_pendingreq = 0; |
| 3842 | } |
| 3843 | return s32Error; |
| 3844 | } |
| 3845 | |
| 3846 | /** |
| 3847 | * @brief Handle_RegisterFrame |
| 3848 | * @details |
| 3849 | * @param[in] |
| 3850 | * @return NONE |
| 3851 | * @author |
| 3852 | * @date |
| 3853 | * @version 1.0 |
| 3854 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3855 | static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3856 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3857 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3858 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3859 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3860 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3861 | |
| 3862 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 3863 | |
| 3864 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3865 | strWID.u16WIDid = (u16)WID_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3866 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3867 | strWID.ps8WidVal = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3868 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3869 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3870 | |
| 3871 | pu8CurrByte = strWID.ps8WidVal; |
| 3872 | |
| 3873 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 3874 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3875 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3876 | |
| 3877 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3878 | strWID.s32ValueSize = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3879 | |
| 3880 | |
| 3881 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3882 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3883 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3884 | if (s32Error) { |
| 3885 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3886 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3887 | } |
| 3888 | |
| 3889 | return s32Error; |
| 3890 | |
| 3891 | } |
| 3892 | |
| 3893 | /** |
| 3894 | * @brief Handle_ListenStateExpired |
| 3895 | * @details Handle of listen state expiration |
| 3896 | * @param[in] NONE |
| 3897 | * @return Error code. |
| 3898 | * @author |
| 3899 | * @date |
| 3900 | * @version 1.0 |
| 3901 | */ |
| 3902 | #define FALSE_FRMWR_CHANNEL 100 |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3903 | static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3904 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3905 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3906 | tstrWID strWID; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3907 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3908 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3909 | |
| 3910 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 3911 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3912 | /*Make sure we are already in listen state*/ |
| 3913 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ |
| 3914 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3915 | u8remain_on_chan_flag = false; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3916 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3917 | strWID.enuWIDtype = WID_STR; |
| 3918 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3919 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3920 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3921 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3922 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3923 | |
| 3924 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
| 3925 | strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; |
| 3926 | |
| 3927 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3928 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3929 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3930 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3931 | PRINT_ER("Failed to set remain on channel\n"); |
| 3932 | goto _done_; |
| 3933 | } |
| 3934 | |
| 3935 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 3936 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid |
| 3937 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 3938 | } |
| 3939 | P2P_LISTEN_STATE = 0; |
| 3940 | } else { |
| 3941 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3942 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3943 | } |
| 3944 | |
| 3945 | _done_: |
| 3946 | return s32Error; |
| 3947 | } |
| 3948 | |
| 3949 | |
| 3950 | /** |
| 3951 | * @brief ListenTimerCB |
| 3952 | * @details Callback function of remain-on-channel timer |
| 3953 | * @param[in] NONE |
| 3954 | * @return Error code. |
| 3955 | * @author |
| 3956 | * @date |
| 3957 | * @version 1.0 |
| 3958 | */ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3959 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3960 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3961 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3962 | struct host_if_msg msg; |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3963 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3964 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3965 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3966 | |
| 3967 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3968 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3969 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3970 | msg.drvHandler = pstrWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 3971 | msg.body.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3972 | |
| 3973 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3974 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3975 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3976 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3977 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3978 | |
| 3979 | /** |
| 3980 | * @brief Handle_EditStation |
| 3981 | * @details Sending config packet to edit station |
| 3982 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3983 | * @return NONE |
| 3984 | * @author |
| 3985 | * @date |
| 3986 | * @version 1.0 |
| 3987 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3988 | static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, tstrHostIfPowerMgmtParam *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3989 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3990 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3991 | tstrWID strWID; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3992 | s8 s8PowerMode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3993 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3994 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3995 | strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3996 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3997 | if (strPowerMgmtParam->bIsEnabled == true) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3998 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3999 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4000 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4001 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
| 4002 | strWID.ps8WidVal = &s8PowerMode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4003 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4004 | |
| 4005 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 4006 | |
| 4007 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4008 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4009 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4010 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4011 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4012 | } |
| 4013 | |
| 4014 | /** |
| 4015 | * @brief Handle_SetMulticastFilter |
| 4016 | * @details Set Multicast filter in firmware |
| 4017 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4018 | * @return NONE |
| 4019 | * @author asobhy |
| 4020 | * @date |
| 4021 | * @version 1.0 |
| 4022 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4023 | static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, tstrHostIFSetMulti *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4024 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4025 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4026 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4027 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4028 | |
| 4029 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 4030 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4031 | strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4032 | strWID.enuWIDtype = WID_BIN; |
| 4033 | strWID.s32ValueSize = sizeof(tstrHostIFSetMulti) + ((strHostIfSetMulti->u32count) * ETH_ALEN); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4034 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4035 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4036 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4037 | |
| 4038 | pu8CurrByte = strWID.ps8WidVal; |
| 4039 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); |
| 4040 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); |
| 4041 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); |
| 4042 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); |
| 4043 | |
| 4044 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); |
| 4045 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); |
| 4046 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); |
| 4047 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); |
| 4048 | |
| 4049 | if ((strHostIfSetMulti->u32count) > 0) |
| 4050 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); |
| 4051 | |
| 4052 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4053 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 4054 | get_id_from_handler(drvHandler)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4055 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4056 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4057 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4058 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 4059 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4060 | |
| 4061 | } |
| 4062 | |
| 4063 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4064 | /** |
| 4065 | * @brief Handle_AddBASession |
| 4066 | * @details Add block ack session |
| 4067 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4068 | * @return NONE |
| 4069 | * @author Amr Abdel-Moghny |
| 4070 | * @date Feb. 2014 |
| 4071 | * @version 9.0 |
| 4072 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4073 | static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4074 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4075 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4076 | tstrWID strWID; |
| 4077 | int AddbaTimeout = 100; |
| 4078 | char *ptr = NULL; |
| 4079 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4080 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4081 | 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] | 4082 | strHostIfBASessionInfo->au8Bssid[0], |
| 4083 | strHostIfBASessionInfo->au8Bssid[1], |
| 4084 | strHostIfBASessionInfo->au8Bssid[2], |
| 4085 | strHostIfBASessionInfo->u16BufferSize, |
| 4086 | strHostIfBASessionInfo->u16SessionTimeout, |
| 4087 | strHostIfBASessionInfo->u8Ted); |
| 4088 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4089 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4090 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4091 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4092 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4093 | ptr = strWID.ps8WidVal; |
| 4094 | /* *ptr++ = 0x14; */ |
| 4095 | *ptr++ = 0x14; |
| 4096 | *ptr++ = 0x3; |
| 4097 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4098 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4099 | ptr += ETH_ALEN; |
| 4100 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4101 | /* BA Policy*/ |
| 4102 | *ptr++ = 1; |
| 4103 | /* Buffer size*/ |
| 4104 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4105 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
| 4106 | /* BA timeout*/ |
| 4107 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 4108 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4109 | /* ADDBA timeout*/ |
| 4110 | *ptr++ = (AddbaTimeout & 0xFF); |
| 4111 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
| 4112 | /* Group Buffer Max Frames*/ |
| 4113 | *ptr++ = 8; |
| 4114 | /* Group Buffer Timeout */ |
| 4115 | *ptr++ = 0; |
| 4116 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4117 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4118 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4119 | if (s32Error) |
| 4120 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 4121 | |
| 4122 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4123 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4124 | strWID.enuWIDtype = WID_STR; |
| 4125 | strWID.s32ValueSize = 15; |
| 4126 | ptr = strWID.ps8WidVal; |
| 4127 | /* *ptr++ = 0x14; */ |
| 4128 | *ptr++ = 15; |
| 4129 | *ptr++ = 7; |
| 4130 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4131 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4132 | ptr += ETH_ALEN; |
| 4133 | /* TID*/ |
| 4134 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4135 | /* Max Num MSDU */ |
| 4136 | *ptr++ = 8; |
| 4137 | /* BA timeout*/ |
| 4138 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4139 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4140 | /*Ack-Policy */ |
| 4141 | *ptr++ = 3; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4142 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4143 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4144 | |
| 4145 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4146 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4147 | |
| 4148 | return s32Error; |
| 4149 | |
| 4150 | } |
| 4151 | |
| 4152 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4153 | /** |
| 4154 | * @brief Handle_DelBASession |
| 4155 | * @details Delete block ack session |
| 4156 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4157 | * @return NONE |
| 4158 | * @author Amr Abdel-Moghny |
| 4159 | * @date Feb. 2013 |
| 4160 | * @version 9.0 |
| 4161 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4162 | static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4163 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4164 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4165 | tstrWID strWID; |
| 4166 | char *ptr = NULL; |
| 4167 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4168 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4169 | 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] | 4170 | strHostIfBASessionInfo->au8Bssid[0], |
| 4171 | strHostIfBASessionInfo->au8Bssid[1], |
| 4172 | strHostIfBASessionInfo->au8Bssid[2], |
| 4173 | strHostIfBASessionInfo->u8Ted); |
| 4174 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4175 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4176 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4177 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4178 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4179 | ptr = strWID.ps8WidVal; |
| 4180 | /* *ptr++ = 0x14; */ |
| 4181 | *ptr++ = 0x14; |
| 4182 | *ptr++ = 0x3; |
| 4183 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4184 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4185 | ptr += ETH_ALEN; |
| 4186 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4187 | /* BA direction = recipent*/ |
| 4188 | *ptr++ = 0; |
| 4189 | /* Delba Reason */ |
| 4190 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4191 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4192 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4193 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4194 | if (s32Error) |
| 4195 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4196 | |
| 4197 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4198 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4199 | strWID.enuWIDtype = WID_STR; |
| 4200 | strWID.s32ValueSize = 15; |
| 4201 | ptr = strWID.ps8WidVal; |
| 4202 | /* *ptr++ = 0x14; */ |
| 4203 | *ptr++ = 15; |
| 4204 | *ptr++ = 7; |
| 4205 | *ptr++ = 0x3; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4206 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4207 | ptr += ETH_ALEN; |
| 4208 | /* TID*/ |
| 4209 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4210 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4211 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4212 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4213 | |
| 4214 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4215 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4216 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4217 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4218 | |
| 4219 | return s32Error; |
| 4220 | |
| 4221 | } |
| 4222 | |
| 4223 | |
| 4224 | /** |
| 4225 | * @brief Handle_DelAllRxBASessions |
| 4226 | * @details Delete all Rx BA sessions |
| 4227 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4228 | * @return NONE |
| 4229 | * @author Abdelrahman Sobhy |
| 4230 | * @date Feb. 2013 |
| 4231 | * @version 9.0 |
| 4232 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4233 | static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4234 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4235 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4236 | tstrWID strWID; |
| 4237 | char *ptr = NULL; |
| 4238 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4239 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4240 | 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] | 4241 | strHostIfBASessionInfo->au8Bssid[0], |
| 4242 | strHostIfBASessionInfo->au8Bssid[1], |
| 4243 | strHostIfBASessionInfo->au8Bssid[2], |
| 4244 | strHostIfBASessionInfo->u8Ted); |
| 4245 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4246 | strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4247 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4248 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4249 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4250 | ptr = strWID.ps8WidVal; |
| 4251 | *ptr++ = 0x14; |
| 4252 | *ptr++ = 0x3; |
| 4253 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4254 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4255 | ptr += ETH_ALEN; |
| 4256 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4257 | /* BA direction = recipent*/ |
| 4258 | *ptr++ = 0; |
| 4259 | /* Delba Reason */ |
| 4260 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4261 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4262 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4263 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4264 | if (s32Error) |
| 4265 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4266 | |
| 4267 | |
| 4268 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4269 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4270 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4271 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4272 | |
| 4273 | return s32Error; |
| 4274 | |
| 4275 | } |
| 4276 | |
| 4277 | /** |
| 4278 | * @brief hostIFthread |
| 4279 | * @details Main thread to handle message queue requests |
| 4280 | * @param[in] void* pvArg |
| 4281 | * @return NONE |
| 4282 | * @author |
| 4283 | * @date |
| 4284 | * @version 1.0 |
| 4285 | */ |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4286 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4287 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4288 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4289 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4290 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 4291 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4292 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4293 | |
| 4294 | while (1) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4295 | wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), &u32Ret); |
| 4296 | pstrWFIDrv = (tstrWILC_WFIDrv *)msg.drvHandler; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4297 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4298 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 4299 | break; |
| 4300 | } |
| 4301 | |
| 4302 | |
| 4303 | /*Re-Queue HIF message*/ |
| 4304 | if ((!g_wilc_initialized)) { |
| 4305 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4306 | usleep_range(200 * 1000, 200 * 1000); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4307 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4308 | continue; |
| 4309 | } |
| 4310 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4311 | if (msg.id == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4312 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4313 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4314 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4315 | continue; |
| 4316 | } |
| 4317 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4318 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4319 | case HOST_IF_MSG_Q_IDLE: |
| 4320 | Handle_wait_msg_q_empty(); |
| 4321 | break; |
| 4322 | |
| 4323 | case HOST_IF_MSG_SCAN: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4324 | Handle_Scan(msg.drvHandler, &msg.body.strHostIFscanAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4325 | break; |
| 4326 | |
| 4327 | case HOST_IF_MSG_CONNECT: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4328 | Handle_Connect(msg.drvHandler, &msg.body.strHostIFconnectAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4329 | break; |
| 4330 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4331 | case HOST_IF_MSG_FLUSH_CONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4332 | Handle_FlushConnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4333 | break; |
| 4334 | |
| 4335 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4336 | Handle_RcvdNtwrkInfo(msg.drvHandler, &msg.body.strRcvdNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4337 | break; |
| 4338 | |
| 4339 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4340 | Handle_RcvdGnrlAsyncInfo(msg.drvHandler, &msg.body.strRcvdGnrlAsyncInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4341 | break; |
| 4342 | |
| 4343 | case HOST_IF_MSG_KEY: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4344 | Handle_Key(msg.drvHandler, &msg.body.strHostIFkeyAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4345 | break; |
| 4346 | |
| 4347 | case HOST_IF_MSG_CFG_PARAMS: |
| 4348 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4349 | Handle_CfgParam(msg.drvHandler, &msg.body.strHostIFCfgParamAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4350 | break; |
| 4351 | |
| 4352 | case HOST_IF_MSG_SET_CHANNEL: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4353 | Handle_SetChannel(msg.drvHandler, &msg.body.strHostIFSetChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4354 | break; |
| 4355 | |
| 4356 | case HOST_IF_MSG_DISCONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4357 | Handle_Disconnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4358 | break; |
| 4359 | |
| 4360 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 4361 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4362 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 4363 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4364 | /*Allow chip sleep, only if both interfaces are not connected*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4365 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4366 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4367 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4368 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4369 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4370 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4371 | Handle_RemainOnChan(msg.drvHandler, &msg.body.strHostIfRemainOnChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4372 | |
| 4373 | break; |
| 4374 | |
| 4375 | case HOST_IF_MSG_GET_RSSI: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4376 | Handle_GetRssi(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4377 | break; |
| 4378 | |
| 4379 | case HOST_IF_MSG_GET_LINKSPEED: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4380 | Handle_GetLinkspeed(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4381 | break; |
| 4382 | |
| 4383 | case HOST_IF_MSG_GET_STATISTICS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4384 | Handle_GetStatistics(msg.drvHandler, (tstrStatistics *)msg.body.pUserData); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4385 | break; |
| 4386 | |
| 4387 | case HOST_IF_MSG_GET_CHNL: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4388 | Handle_GetChnl(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4389 | break; |
| 4390 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4391 | case HOST_IF_MSG_ADD_BEACON: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4392 | Handle_AddBeacon(msg.drvHandler, &msg.body.strHostIFSetBeacon); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4393 | break; |
| 4394 | |
| 4395 | case HOST_IF_MSG_DEL_BEACON: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4396 | Handle_DelBeacon(msg.drvHandler, &msg.body.strHostIFDelBeacon); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4397 | break; |
| 4398 | |
| 4399 | case HOST_IF_MSG_ADD_STATION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4400 | Handle_AddStation(msg.drvHandler, &msg.body.strAddStaParam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4401 | break; |
| 4402 | |
| 4403 | case HOST_IF_MSG_DEL_STATION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4404 | Handle_DelStation(msg.drvHandler, &msg.body.strDelStaParam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4405 | break; |
| 4406 | |
| 4407 | case HOST_IF_MSG_EDIT_STATION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4408 | Handle_EditStation(msg.drvHandler, &msg.body.strEditStaParam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4409 | break; |
| 4410 | |
| 4411 | case HOST_IF_MSG_GET_INACTIVETIME: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4412 | Handle_Get_InActiveTime(msg.drvHandler, &msg.body.strHostIfStaInactiveT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4413 | break; |
| 4414 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4415 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 4416 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 4417 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4418 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4419 | break; |
| 4420 | |
| 4421 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4422 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4423 | Handle_ConnectTimeout(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4424 | break; |
| 4425 | |
| 4426 | case HOST_IF_MSG_POWER_MGMT: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4427 | Handle_PowerManagement(msg.drvHandler, &msg.body.strPowerMgmtparam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4428 | break; |
| 4429 | |
| 4430 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4431 | Handle_SetWfiDrvHandler(msg.drvHandler, |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4432 | &msg.body.strHostIfSetDrvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4433 | break; |
| 4434 | |
| 4435 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4436 | Handle_SetOperationMode(msg.drvHandler, &msg.body.strHostIfSetOperationMode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4437 | break; |
| 4438 | |
| 4439 | case HOST_IF_MSG_SET_IPADDRESS: |
| 4440 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4441 | Handle_set_IPAddress(msg.drvHandler, msg.body.strHostIfSetIP.au8IPAddr, msg.body.strHostIfSetIP.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4442 | break; |
| 4443 | |
| 4444 | case HOST_IF_MSG_GET_IPADDRESS: |
| 4445 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4446 | Handle_get_IPAddress(msg.drvHandler, msg.body.strHostIfSetIP.au8IPAddr, msg.body.strHostIfSetIP.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4447 | break; |
| 4448 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4449 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4450 | Handle_SetMacAddress(msg.drvHandler, &msg.body.strHostIfSetMacAddress); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4451 | break; |
| 4452 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4453 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4454 | Handle_GetMacAddress(msg.drvHandler, &msg.body.strHostIfGetMacAddress); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4455 | break; |
| 4456 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4457 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 4458 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4459 | Handle_RemainOnChan(msg.drvHandler, &msg.body.strHostIfRemainOnChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4460 | break; |
| 4461 | |
| 4462 | case HOST_IF_MSG_REGISTER_FRAME: |
| 4463 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4464 | Handle_RegisterFrame(msg.drvHandler, &msg.body.strHostIfRegisterFrame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4465 | break; |
| 4466 | |
| 4467 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4468 | Handle_ListenStateExpired(msg.drvHandler, &msg.body.strHostIfRemainOnChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4469 | break; |
| 4470 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4471 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 4472 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4473 | Handle_SetMulticastFilter(msg.drvHandler, &msg.body.strHostIfSetMulti); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4474 | break; |
| 4475 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4476 | case HOST_IF_MSG_ADD_BA_SESSION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4477 | Handle_AddBASession(msg.drvHandler, &msg.body.strHostIfBASessionInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4478 | break; |
| 4479 | |
| 4480 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4481 | Handle_DelAllRxBASessions(msg.drvHandler, &msg.body.strHostIfBASessionInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4482 | break; |
| 4483 | |
| 4484 | case HOST_IF_MSG_DEL_ALL_STA: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4485 | Handle_DelAllSta(msg.drvHandler, &msg.body.strHostIFDelAllSta); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4486 | break; |
| 4487 | |
| 4488 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4489 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4490 | break; |
| 4491 | } |
| 4492 | } |
| 4493 | |
| 4494 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4495 | up(&hSemHostIFthrdEnd); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4496 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4497 | } |
| 4498 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4499 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4500 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4501 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4502 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4503 | |
| 4504 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4505 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4506 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4507 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4508 | |
| 4509 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4510 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4511 | } |
| 4512 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4513 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4514 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4515 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4516 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4517 | |
| 4518 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4519 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4520 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4521 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4522 | |
| 4523 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4524 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4525 | } |
| 4526 | |
| 4527 | |
| 4528 | /** |
| 4529 | * @brief removes wpa/wpa2 keys |
| 4530 | * @details only in BSS STA mode if External Supplicant support is enabled. |
| 4531 | * removes all WPA/WPA2 station key entries from MAC hardware. |
| 4532 | * @param[in,out] handle to the wifi driver |
| 4533 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4534 | * @return Error code indicating success/failure |
| 4535 | * @note |
| 4536 | * @author zsalah |
| 4537 | * @date 8 March 2012 |
| 4538 | * @version 1.0 |
| 4539 | */ |
| 4540 | /* Check implementation in core adding 9 bytes to the input! */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4541 | s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4542 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4543 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4544 | tstrWID strWID; |
| 4545 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4546 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4547 | strWID.u16WIDid = (u16)WID_REMOVE_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4548 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4549 | strWID.ps8WidVal = (s8 *)pu8StaAddress; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4550 | strWID.s32ValueSize = 6; |
| 4551 | |
| 4552 | return s32Error; |
| 4553 | |
| 4554 | } |
| 4555 | |
| 4556 | /** |
| 4557 | * @brief removes WEP key |
| 4558 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4559 | * remove a WEP key entry from MAC HW. |
| 4560 | * The BSS Station automatically finds the index of the entry using its |
| 4561 | * BSS ID and removes that entry from the MAC hardware. |
| 4562 | * @param[in,out] handle to the wifi driver |
| 4563 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4564 | * @return Error code indicating success/failure |
| 4565 | * @note NO need for the STA add since it is not used for processing |
| 4566 | * @author zsalah |
| 4567 | * @date 8 March 2012 |
| 4568 | * @version 1.0 |
| 4569 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4570 | s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4571 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4572 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4573 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4574 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4575 | |
| 4576 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4577 | if (pstrWFIDrv == NULL) { |
| 4578 | s32Error = -EFAULT; |
| 4579 | PRINT_ER("Failed to send setup multicast config packet\n"); |
| 4580 | return s32Error; |
| 4581 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4582 | |
| 4583 | /* prepare the Remove Wep Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4584 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4585 | |
| 4586 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4587 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4588 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4589 | msg.body.strHostIFkeyAttr.u8KeyAction = REMOVEKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4590 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4591 | |
| 4592 | |
| 4593 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4594 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4595 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; |
| 4596 | |
| 4597 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4598 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4599 | if (s32Error) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4600 | 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] | 4601 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4602 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4603 | return s32Error; |
| 4604 | } |
| 4605 | |
| 4606 | /** |
| 4607 | * @brief sets WEP default key |
| 4608 | * @details Sets the index of the WEP encryption key in use, |
| 4609 | * in the key table |
| 4610 | * @param[in,out] handle to the wifi driver |
| 4611 | * @param[in] key index ( 0, 1, 2, 3) |
| 4612 | * @return Error code indicating success/failure |
| 4613 | * @note |
| 4614 | * @author zsalah |
| 4615 | * @date 8 March 2012 |
| 4616 | * @version 1.0 |
| 4617 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4618 | s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4619 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4620 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4621 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4622 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4623 | |
| 4624 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4625 | if (pstrWFIDrv == NULL) { |
| 4626 | s32Error = -EFAULT; |
| 4627 | PRINT_ER("driver is null\n"); |
| 4628 | return s32Error; |
| 4629 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4630 | |
| 4631 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4632 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4633 | |
| 4634 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4635 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4636 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4637 | msg.body.strHostIFkeyAttr.u8KeyAction = DEFAULTKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4638 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4639 | |
| 4640 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4641 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4642 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; |
| 4643 | |
| 4644 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4645 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4646 | if (s32Error) |
| 4647 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4648 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4649 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4650 | return s32Error; |
| 4651 | } |
| 4652 | |
| 4653 | /** |
| 4654 | * @brief sets WEP deafault key |
| 4655 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4656 | * sets WEP key entry into MAC hardware when it receives the |
| 4657 | * corresponding request from NDIS. |
| 4658 | * @param[in,out] handle to the wifi driver |
| 4659 | * @param[in] message containing WEP Key in the following format |
| 4660 | *|---------------------------------------| |
| 4661 | *|Key ID Value | Key Length | Key | |
| 4662 | *|-------------|------------|------------| |
| 4663 | | 1byte | 1byte | Key Length | |
| 4664 | ||---------------------------------------| |
| 4665 | | |
| 4666 | * @return Error code indicating success/failure |
| 4667 | * @note |
| 4668 | * @author zsalah |
| 4669 | * @date 8 March 2012 |
| 4670 | * @version 1.0 |
| 4671 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4672 | 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] | 4673 | { |
| 4674 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4675 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4676 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4677 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4678 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4679 | if (pstrWFIDrv == NULL) { |
| 4680 | s32Error = -EFAULT; |
| 4681 | PRINT_ER("driver is null\n"); |
| 4682 | return s32Error; |
| 4683 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4684 | |
| 4685 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4686 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4687 | |
| 4688 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4689 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4690 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4691 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4692 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4693 | |
| 4694 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4695 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4696 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4697 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4698 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4699 | pu8WepKey, u8WepKeylen); |
| 4700 | |
| 4701 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4702 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4703 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4704 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4705 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4706 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4707 | |
| 4708 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4709 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4710 | if (s32Error) |
| 4711 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4712 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4713 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4714 | return s32Error; |
| 4715 | |
| 4716 | } |
| 4717 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4718 | /** |
| 4719 | * |
| 4720 | * @brief host_int_add_wep_key_bss_ap |
| 4721 | * @details valid only in BSS AP mode if External Supplicant support is enabled. |
| 4722 | * sets WEP key entry into MAC hardware when it receives the |
| 4723 | * |
| 4724 | * corresponding request from NDIS. |
| 4725 | * @param[in,out] handle to the wifi driver |
| 4726 | * |
| 4727 | * |
| 4728 | * @return Error code indicating success/failure |
| 4729 | * @note |
| 4730 | * @author mdaftedar |
| 4731 | * @date 28 FEB 2013 |
| 4732 | * @version 1.0 |
| 4733 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4734 | 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] | 4735 | { |
| 4736 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4737 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4738 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4739 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4740 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4741 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4742 | if (pstrWFIDrv == NULL) { |
| 4743 | s32Error = -EFAULT; |
| 4744 | PRINT_ER("driver is null\n"); |
| 4745 | return s32Error; |
| 4746 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4747 | |
| 4748 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4749 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4750 | |
| 4751 | if (INFO) { |
| 4752 | for (i = 0; i < u8WepKeylen; i++) |
| 4753 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 4754 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4755 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4756 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4757 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4758 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4759 | |
| 4760 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4761 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4762 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4763 | |
| 4764 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4765 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4766 | pu8WepKey, (u8WepKeylen)); |
| 4767 | |
| 4768 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4769 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4770 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4771 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4772 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4773 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4774 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4775 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4776 | uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode; |
| 4777 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4778 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4779 | uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; |
| 4780 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4781 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4782 | |
| 4783 | if (s32Error) |
| 4784 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4785 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4786 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4787 | return s32Error; |
| 4788 | |
| 4789 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4790 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4791 | /** |
| 4792 | * @brief adds ptk Key |
| 4793 | * @details |
| 4794 | * @param[in,out] handle to the wifi driver |
| 4795 | * @param[in] message containing PTK Key in the following format |
| 4796 | *|-----------------------------------------------------------------------------| |
| 4797 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 4798 | *|----------------|------------|--------------|----------------|---------------| |
| 4799 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 4800 | ||-----------------------------------------------------------------------------| |
| 4801 | * @return Error code indicating success/failure |
| 4802 | * @note |
| 4803 | * @author zsalah |
| 4804 | * @date 8 March 2012 |
| 4805 | * @version 1.0 |
| 4806 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4807 | 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] | 4808 | 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] | 4809 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4810 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4811 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4812 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4813 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4814 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4815 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4816 | if (pstrWFIDrv == NULL) { |
| 4817 | s32Error = -EFAULT; |
| 4818 | PRINT_ER("driver is null\n"); |
| 4819 | return s32Error; |
| 4820 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4821 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4822 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4823 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4824 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4825 | |
| 4826 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4827 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4828 | |
| 4829 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4830 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4831 | msg.body.strHostIFkeyAttr.enuKeyType = WPAPtk; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4832 | if (mode == AP_MODE) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4833 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4834 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4835 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx; |
| 4836 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4837 | if (mode == STATION_MODE) |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4838 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4839 | |
| 4840 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4841 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4842 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4843 | |
| 4844 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4845 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4846 | pu8Ptk, u8PtkKeylen); |
| 4847 | |
| 4848 | if (pu8RxMic != NULL) { |
| 4849 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4850 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4851 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4852 | if (INFO) { |
| 4853 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 4854 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 4855 | } |
| 4856 | } |
| 4857 | if (pu8TxMic != NULL) { |
| 4858 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4859 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4860 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4861 | if (INFO) { |
| 4862 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 4863 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 4864 | } |
| 4865 | } |
| 4866 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4867 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4868 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4869 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4870 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4871 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4872 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4873 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4874 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4875 | |
| 4876 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4877 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4878 | |
| 4879 | if (s32Error) |
| 4880 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 4881 | |
| 4882 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4883 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4884 | /* /////// */ |
| 4885 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4886 | return s32Error; |
| 4887 | } |
| 4888 | |
| 4889 | /** |
| 4890 | * @brief adds Rx GTk Key |
| 4891 | * @details |
| 4892 | * @param[in,out] handle to the wifi driver |
| 4893 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic |
| 4894 | * u8GtkKeylen :The total key length |
| 4895 | * |
| 4896 | * @return Error code indicating success/failure |
| 4897 | * @note |
| 4898 | * @author zsalah |
| 4899 | * @date 8 March 2012 |
| 4900 | * @version 1.0 |
| 4901 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4902 | 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] | 4903 | u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4904 | const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4905 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4906 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4907 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4908 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4909 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4910 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4911 | if (pstrWFIDrv == NULL) { |
| 4912 | s32Error = -EFAULT; |
| 4913 | PRINT_ER("driver is null\n"); |
| 4914 | return s32Error; |
| 4915 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4916 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4917 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4918 | |
| 4919 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4920 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4921 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4922 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4923 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4924 | if (KeyRSC != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4925 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4926 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4927 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4928 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4929 | KeyRSC, u32KeyRSClen); |
| 4930 | } |
| 4931 | |
| 4932 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4933 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4934 | msg.body.strHostIFkeyAttr.enuKeyType = WPARxGtk; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4935 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4936 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4937 | if (mode == AP_MODE) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4938 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4939 | msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4940 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4941 | if (mode == STATION_MODE) |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4942 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4943 | |
| 4944 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4945 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4946 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8KeyLen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4947 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4948 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4949 | pu8RxGtk, u8GtkKeylen); |
| 4950 | |
| 4951 | if (pu8RxMic != NULL) { |
| 4952 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4953 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4954 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4955 | |
| 4956 | } |
| 4957 | if (pu8TxMic != NULL) { |
| 4958 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4959 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4960 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4961 | |
| 4962 | } |
| 4963 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4964 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4965 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4966 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4967 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4968 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4969 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4970 | uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen; |
| 4971 | |
| 4972 | |
| 4973 | |
| 4974 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4975 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4976 | if (s32Error) |
| 4977 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
| 4978 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4979 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4980 | /* /////// */ |
| 4981 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4982 | return s32Error; |
| 4983 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4984 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4985 | /** |
| 4986 | * @brief host_int_set_pmkid_info |
| 4987 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant |
| 4988 | * support is enabled. This Function sets the PMKID in firmware |
| 4989 | * when host drivr receives the corresponding request from NDIS. |
| 4990 | * The firmware then includes theset PMKID in the appropriate |
| 4991 | * management frames |
| 4992 | * @param[in,out] handle to the wifi driver |
| 4993 | * @param[in] message containing PMKID Info in the following format |
| 4994 | *|-----------------------------------------------------------------| |
| 4995 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 4996 | *|-----------|------------|----------|-------|----------|----------| |
| 4997 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 4998 | ||-----------------------------------------------------------------| |
| 4999 | * @return Error code indicating success/failure |
| 5000 | * @note |
| 5001 | * @author zsalah |
| 5002 | * @date 8 March 2012 |
| 5003 | * @version 1.0 |
| 5004 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5005 | s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5006 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5007 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5008 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5009 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5010 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5011 | |
| 5012 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5013 | if (pstrWFIDrv == NULL) { |
| 5014 | s32Error = -EFAULT; |
| 5015 | PRINT_ER("driver is null\n"); |
| 5016 | return s32Error; |
| 5017 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5018 | |
| 5019 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5020 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5021 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5022 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5023 | msg.body.strHostIFkeyAttr.enuKeyType = PMKSA; |
| 5024 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5025 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5026 | |
| 5027 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
| 5028 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5029 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5030 | ETH_ALEN); |
| 5031 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5032 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5033 | PMKID_LEN); |
| 5034 | } |
| 5035 | |
| 5036 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5037 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5038 | if (s32Error) |
| 5039 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 5040 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5041 | return s32Error; |
| 5042 | } |
| 5043 | |
| 5044 | /** |
| 5045 | * @brief gets the cached the pmkid info |
| 5046 | * @details valid only in BSS STA mode if External Supplicant |
| 5047 | * support is enabled. This Function sets the PMKID in firmware |
| 5048 | * when host drivr receives the corresponding request from NDIS. |
| 5049 | * The firmware then includes theset PMKID in the appropriate |
| 5050 | * management frames |
| 5051 | * @param[in,out] handle to the wifi driver, |
| 5052 | * message containing PMKID Info in the following format |
| 5053 | *|-----------------------------------------------------------------| |
| 5054 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 5055 | *|-----------|------------|----------|-------|----------|----------| |
| 5056 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 5057 | ||-----------------------------------------------------------------| |
| 5058 | * @param[in] |
| 5059 | * @return Error code indicating success/failure |
| 5060 | * @note |
| 5061 | * @author zsalah |
| 5062 | * @date 8 March 2012 |
| 5063 | * @version 1.0 |
| 5064 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5065 | s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5066 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5067 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5068 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5069 | tstrWID strWID; |
| 5070 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5071 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5072 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5073 | strWID.enuWIDtype = WID_STR; |
| 5074 | strWID.s32ValueSize = u32PmkidInfoLen; |
| 5075 | strWID.ps8WidVal = pu8PmkidInfoArray; |
| 5076 | |
| 5077 | return s32Error; |
| 5078 | } |
| 5079 | |
| 5080 | /** |
| 5081 | * @brief sets the pass phrase |
| 5082 | * @details AP/STA mode. This function gives the pass phrase used to |
| 5083 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5084 | * The length of the field can vary from 8 to 64 bytes, |
| 5085 | * the lower layer should get the |
| 5086 | * @param[in,out] handle to the wifi driver, |
| 5087 | * @param[in] String containing PSK |
| 5088 | * @return Error code indicating success/failure |
| 5089 | * @note |
| 5090 | * @author zsalah |
| 5091 | * @date 8 March 2012 |
| 5092 | * @version 1.0 |
| 5093 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5094 | s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5095 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5096 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5097 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5098 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5099 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5100 | /*validating psk length*/ |
| 5101 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5102 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5103 | strWID.enuWIDtype = WID_STR; |
| 5104 | strWID.ps8WidVal = pu8PassPhrase; |
| 5105 | strWID.s32ValueSize = u8Psklength; |
| 5106 | } |
| 5107 | |
| 5108 | return s32Error; |
| 5109 | } |
| 5110 | /** |
| 5111 | * @brief host_int_get_MacAddress |
| 5112 | * @details gets mac address |
| 5113 | * @param[in,out] handle to the wifi driver, |
| 5114 | * |
| 5115 | * @return Error code indicating success/failure |
| 5116 | * @note |
| 5117 | * @author mdaftedar |
| 5118 | * @date 19 April 2012 |
| 5119 | * @version 1.0 |
| 5120 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5121 | s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5122 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5123 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5124 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5125 | |
| 5126 | |
| 5127 | /* prepare the Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5128 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5129 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5130 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5131 | msg.body.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5132 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5133 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5134 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5135 | if (s32Error) { |
| 5136 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5137 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5138 | } |
| 5139 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5140 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5141 | return s32Error; |
| 5142 | } |
| 5143 | |
| 5144 | /** |
| 5145 | * @brief host_int_set_MacAddress |
| 5146 | * @details sets mac address |
| 5147 | * @param[in,out] handle to the wifi driver, |
| 5148 | * |
| 5149 | * @return Error code indicating success/failure |
| 5150 | * @note |
| 5151 | * @author mabubakr |
| 5152 | * @date 16 July 2012 |
| 5153 | * @version 1.0 |
| 5154 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5155 | s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5156 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5157 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5158 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5159 | |
| 5160 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 5161 | |
| 5162 | /* prepare setting mac address message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5163 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5164 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5165 | memcpy(msg.body.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5166 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5167 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5168 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5169 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5170 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5171 | |
| 5172 | return s32Error; |
| 5173 | |
| 5174 | } |
| 5175 | |
| 5176 | /** |
| 5177 | * @brief host_int_get_RSNAConfigPSKPassPhrase |
| 5178 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to |
| 5179 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5180 | * The length of the field can vary from 8 to 64 bytes, |
| 5181 | * the lower layer should get the |
| 5182 | * @param[in,out] handle to the wifi driver, |
| 5183 | * String containing PSK |
| 5184 | * @return Error code indicating success/failure |
| 5185 | * @note |
| 5186 | * @author zsalah |
| 5187 | * @date 8 March 2012 |
| 5188 | * @version 1.0 |
| 5189 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5190 | s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5191 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5192 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5193 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5194 | tstrWID strWID; |
| 5195 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5196 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5197 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5198 | strWID.enuWIDtype = WID_STR; |
| 5199 | strWID.s32ValueSize = u8Psklength; |
| 5200 | strWID.ps8WidVal = pu8PassPhrase; |
| 5201 | |
| 5202 | return s32Error; |
| 5203 | } |
| 5204 | |
| 5205 | /** |
| 5206 | * @brief host_int_get_site_survey_results |
| 5207 | * @details gets the site survey results |
| 5208 | * @param[in,out] handle to the wifi driver, |
| 5209 | * Message containing site survey results in the |
| 5210 | * following format |
| 5211 | *|---------------------------------------------------| |
| 5212 | | MsgLength | fragNo. | MsgBodyLength | MsgBody | |
| 5213 | ||-----------|-----------|---------------|-----------| |
| 5214 | | 1 | 1 | 1 | 1 | |
| 5215 | | ----------------------------------------- | ---------------- |
| 5216 | | |
| 5217 | ||---------------------------------------| |
| 5218 | | Network1 | Netweork2 | ... | Network5 | |
| 5219 | ||---------------------------------------| |
| 5220 | | 44 | 44 | ... | 44 | |
| 5221 | | -------------------------- | --------------------------------------- |
| 5222 | | |
| 5223 | ||---------------------------------------------------------------------| |
| 5224 | | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved | |
| 5225 | | |
| 5226 | | |
| 5227 | ||------|----------|---------|----------------|-------|------|---------| |
| 5228 | | 33 | 1 | 1 | 1 | 6 | 1 | 1 | |
| 5229 | ||---------------------------------------------------------------------| |
| 5230 | * @return Error code indicating success/failure |
| 5231 | * @note |
| 5232 | * @author zsalah |
| 5233 | * @date 8 March 2012 |
| 5234 | * @version 1.0 |
| 5235 | */ |
| 5236 | #ifndef CONNECT_DIRECT |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5237 | s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5238 | u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5239 | u32 u32MaxSiteSrvyFragLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5240 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5241 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5242 | tstrWID astrWIDList[2]; |
| 5243 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5244 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5245 | astrWIDList[0].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5246 | astrWIDList[0].enuWIDtype = WID_STR; |
| 5247 | astrWIDList[0].ps8WidVal = ppu8RcvdSiteSurveyResults[0]; |
| 5248 | astrWIDList[0].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5249 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5250 | astrWIDList[1].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5251 | astrWIDList[1].enuWIDtype = WID_STR; |
| 5252 | astrWIDList[1].ps8WidVal = ppu8RcvdSiteSurveyResults[1]; |
| 5253 | astrWIDList[1].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5254 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5255 | s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, |
| 5256 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5257 | |
| 5258 | /*get the value by searching the local copy*/ |
| 5259 | if (s32Error) { |
| 5260 | PRINT_ER("Failed to send config packet to get survey results\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5261 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5262 | } |
| 5263 | |
| 5264 | return s32Error; |
| 5265 | } |
| 5266 | #endif |
| 5267 | |
| 5268 | /** |
| 5269 | * @brief sets a start scan request |
| 5270 | * @details |
| 5271 | * @param[in,out] handle to the wifi driver, |
| 5272 | * @param[in] Scan Source one of the following values |
| 5273 | * DEFAULT_SCAN 0 |
| 5274 | * USER_SCAN BIT0 |
| 5275 | * OBSS_PERIODIC_SCAN BIT1 |
| 5276 | * OBSS_ONETIME_SCAN BIT2 |
| 5277 | * @return Error code indicating success/failure |
| 5278 | * @note |
| 5279 | * @author zsalah |
| 5280 | * @date 8 March 2012 |
| 5281 | * @version 1.0 |
| 5282 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5283 | s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5284 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5285 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5286 | tstrWID strWID; |
| 5287 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5288 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5289 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5290 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5291 | strWID.ps8WidVal = (s8 *)&scanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5292 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5293 | |
| 5294 | return s32Error; |
| 5295 | } |
| 5296 | |
| 5297 | /** |
| 5298 | * @brief host_int_get_start_scan_req |
| 5299 | * @details gets a start scan request |
| 5300 | * @param[in,out] handle to the wifi driver, |
| 5301 | * @param[in] Scan Source one of the following values |
| 5302 | * DEFAULT_SCAN 0 |
| 5303 | * USER_SCAN BIT0 |
| 5304 | * OBSS_PERIODIC_SCAN BIT1 |
| 5305 | * OBSS_ONETIME_SCAN BIT2 |
| 5306 | * @return Error code indicating success/failure |
| 5307 | * @note |
| 5308 | * @author zsalah |
| 5309 | * @date 8 March 2012 |
| 5310 | * @version 1.0 |
| 5311 | */ |
| 5312 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5313 | s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5314 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5315 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5316 | tstrWID strWID; |
| 5317 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5318 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5319 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5320 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5321 | strWID.ps8WidVal = (s8 *)pu8ScanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5322 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5323 | |
| 5324 | return s32Error; |
| 5325 | } |
| 5326 | |
| 5327 | /** |
| 5328 | * @brief host_int_set_join_req |
| 5329 | * @details sets a join request |
| 5330 | * @param[in,out] handle to the wifi driver, |
| 5331 | * @param[in] Index of the bss descriptor |
| 5332 | * @return Error code indicating success/failure |
| 5333 | * @note |
| 5334 | * @author zsalah |
| 5335 | * @date 8 March 2012 |
| 5336 | * @version 1.0 |
| 5337 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5338 | s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 5339 | const u8 *pu8ssid, size_t ssidLen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5340 | const u8 *pu8IEs, size_t IEsLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5341 | tWILCpfConnectResult pfConnectResult, void *pvUserArg, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5342 | u8 u8security, AUTHTYPE_T tenuAuth_type, |
| 5343 | u8 u8channel, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5344 | void *pJoinParams) |
| 5345 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5346 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5347 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5348 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5349 | tenuScanConnTimer enuScanConnTimer; |
| 5350 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5351 | if (pstrWFIDrv == NULL || pfConnectResult == NULL) { |
| 5352 | s32Error = -EFAULT; |
| 5353 | PRINT_ER("Driver is null\n"); |
| 5354 | return s32Error; |
| 5355 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5356 | |
| 5357 | if (hWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5358 | PRINT_ER("Driver is null\n"); |
| 5359 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5360 | } |
| 5361 | |
| 5362 | if (pJoinParams == NULL) { |
| 5363 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5364 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5365 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5366 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5367 | /* prepare the Connect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5368 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5369 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5370 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5371 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5372 | msg.body.strHostIFconnectAttr.u8security = u8security; |
| 5373 | msg.body.strHostIFconnectAttr.tenuAuth_type = tenuAuth_type; |
| 5374 | msg.body.strHostIFconnectAttr.u8channel = u8channel; |
| 5375 | msg.body.strHostIFconnectAttr.pfConnectResult = pfConnectResult; |
| 5376 | msg.body.strHostIFconnectAttr.pvUserArg = pvUserArg; |
| 5377 | msg.body.strHostIFconnectAttr.pJoinParams = pJoinParams; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5378 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5379 | |
| 5380 | if (pu8bssid != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5381 | msg.body.strHostIFconnectAttr.pu8bssid = kmalloc(6, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5382 | memcpy(msg.body.strHostIFconnectAttr.pu8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5383 | pu8bssid, 6); |
| 5384 | } |
| 5385 | |
| 5386 | if (pu8ssid != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5387 | msg.body.strHostIFconnectAttr.ssidLen = ssidLen; |
| 5388 | msg.body.strHostIFconnectAttr.pu8ssid = kmalloc(ssidLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5389 | memcpy(msg.body.strHostIFconnectAttr.pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5390 | |
| 5391 | pu8ssid, ssidLen); |
| 5392 | } |
| 5393 | |
| 5394 | if (pu8IEs != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5395 | msg.body.strHostIFconnectAttr.IEsLen = IEsLen; |
| 5396 | msg.body.strHostIFconnectAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5397 | memcpy(msg.body.strHostIFconnectAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5398 | pu8IEs, IEsLen); |
| 5399 | } |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5400 | if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5401 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5402 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5403 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); |
| 5404 | |
| 5405 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5406 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5407 | if (s32Error) { |
| 5408 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5409 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5410 | } |
| 5411 | |
| 5412 | enuScanConnTimer = CONNECT_TIMER; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5413 | pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; |
| 5414 | mod_timer(&pstrWFIDrv->hConnectTimer, |
| 5415 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5416 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5417 | return s32Error; |
| 5418 | } |
| 5419 | |
| 5420 | /** |
| 5421 | * @brief Flush a join request parameters to FW, but actual connection |
| 5422 | * @details The function is called in situation where WILC is connected to AP and |
| 5423 | * required to switch to hybrid FW for P2P connection |
| 5424 | * @param[in] handle to the wifi driver, |
| 5425 | * @return Error code indicating success/failure |
| 5426 | * @note |
| 5427 | * @author Amr Abdel-Moghny |
| 5428 | * @date 19 DEC 2013 |
| 5429 | * @version 8.0 |
| 5430 | */ |
| 5431 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5432 | s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5433 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5434 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5435 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5436 | |
| 5437 | if (!gu8FlushedJoinReq) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5438 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5439 | return s32Error; |
| 5440 | } |
| 5441 | |
| 5442 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5443 | if (hWFIDrv == NULL) { |
| 5444 | s32Error = -EFAULT; |
| 5445 | PRINT_ER("Driver is null\n"); |
| 5446 | return s32Error; |
| 5447 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5448 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5449 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5450 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5451 | |
| 5452 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5453 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5454 | if (s32Error) { |
| 5455 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5456 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5457 | } |
| 5458 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5459 | return s32Error; |
| 5460 | } |
| 5461 | |
| 5462 | /** |
| 5463 | * @brief host_int_disconnect |
| 5464 | * @details disconnects from the currently associated network |
| 5465 | * @param[in,out] handle to the wifi driver, |
| 5466 | * @param[in] Reason Code of the Disconnection |
| 5467 | * @return Error code indicating success/failure |
| 5468 | * @note |
| 5469 | * @author zsalah |
| 5470 | * @date 8 March 2012 |
| 5471 | * @version 1.0 |
| 5472 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5473 | s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5474 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5475 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5476 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5477 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5478 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5479 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5480 | PRINT_ER("Driver is null\n"); |
| 5481 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5482 | } |
| 5483 | |
| 5484 | /* prepare the Disconnect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5485 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5486 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5487 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5488 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5489 | |
| 5490 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5491 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5492 | if (s32Error) |
| 5493 | PRINT_ER("Failed to send message queue: disconnect\n"); |
| 5494 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5495 | down(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5496 | /* /////// */ |
| 5497 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5498 | return s32Error; |
| 5499 | } |
| 5500 | |
| 5501 | /** |
| 5502 | * @brief host_int_disconnect_station |
| 5503 | * @details disconnects a sta |
| 5504 | * @param[in,out] handle to the wifi driver, |
| 5505 | * @param[in] Association Id of the station to be disconnected |
| 5506 | * @return Error code indicating success/failure |
| 5507 | * @note |
| 5508 | * @author zsalah |
| 5509 | * @date 8 March 2012 |
| 5510 | * @version 1.0 |
| 5511 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5512 | s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5513 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5514 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5515 | tstrWID strWID; |
| 5516 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5517 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5518 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5519 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5520 | strWID.ps8WidVal = (s8 *)&assoc_id; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5521 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5522 | |
| 5523 | return s32Error; |
| 5524 | } |
| 5525 | |
| 5526 | /** |
| 5527 | * @brief host_int_get_assoc_req_info |
| 5528 | * @details gets a Association request info |
| 5529 | * @param[in,out] handle to the wifi driver, |
| 5530 | * Message containg assoc. req info in the following format |
| 5531 | * ------------------------------------------------------------------------ |
| 5532 | | Management Frame Format | |
| 5533 | ||-------------------------------------------------------------------| |
| 5534 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | |
| 5535 | ||-------------|--------|--|--|-----|----------------|----------|----| |
| 5536 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | |
| 5537 | ||-------------------------------------------------------------------| |
| 5538 | | | |
| 5539 | | Association Request Frame - Frame Body | |
| 5540 | ||-------------------------------------------------------------------| |
| 5541 | | Capability Information | Listen Interval | SSID | Supported Rates | |
| 5542 | ||------------------------|-----------------|------|-----------------| |
| 5543 | | 2 | 2 | 2-34 | 3-10 | |
| 5544 | | --------------------------------------------------------------------- |
| 5545 | * @return Error code indicating success/failure |
| 5546 | * @note |
| 5547 | * @author zsalah |
| 5548 | * @date 8 March 2012 |
| 5549 | * @version 1.0 |
| 5550 | */ |
| 5551 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5552 | s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5553 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5554 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5555 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5556 | tstrWID strWID; |
| 5557 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5558 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5559 | strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5560 | strWID.enuWIDtype = WID_STR; |
| 5561 | strWID.ps8WidVal = pu8AssocReqInfo; |
| 5562 | strWID.s32ValueSize = u32AssocReqInfoLen; |
| 5563 | |
| 5564 | |
| 5565 | return s32Error; |
| 5566 | } |
| 5567 | |
| 5568 | /** |
| 5569 | * @brief gets a Association Response info |
| 5570 | * @details |
| 5571 | * @param[in,out] handle to the wifi driver, |
| 5572 | * Message containg assoc. resp info |
| 5573 | * @return Error code indicating success/failure |
| 5574 | * @note |
| 5575 | * @author zsalah |
| 5576 | * @date 8 March 2012 |
| 5577 | * @version 1.0 |
| 5578 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5579 | s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5580 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5581 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5582 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5583 | tstrWID strWID; |
| 5584 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5585 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5586 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5587 | PRINT_ER("Driver is null\n"); |
| 5588 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5589 | } |
| 5590 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5591 | strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5592 | strWID.enuWIDtype = WID_STR; |
| 5593 | strWID.ps8WidVal = pu8AssocRespInfo; |
| 5594 | strWID.s32ValueSize = u32MaxAssocRespInfoLen; |
| 5595 | |
| 5596 | |
| 5597 | /* Sending Configuration packet */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5598 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 5599 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5600 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5601 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5602 | PRINT_ER("Failed to send association response config packet\n"); |
| 5603 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5604 | } else { |
| 5605 | *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize; |
| 5606 | } |
| 5607 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5608 | return s32Error; |
| 5609 | } |
| 5610 | |
| 5611 | /** |
| 5612 | * @brief gets a Association Response info |
| 5613 | * @details Valid only in STA mode. This function gives the RSSI |
| 5614 | * values observed in all the channels at the time of scanning. |
| 5615 | * The length of the field is 1 greater that the total number of |
| 5616 | * channels supported. Byte 0 contains the number of channels while |
| 5617 | * each of Byte N contains the observed RSSI value for the channel index N. |
| 5618 | * @param[in,out] handle to the wifi driver, |
| 5619 | * array of scanned channels' RSSI |
| 5620 | * @return Error code indicating success/failure |
| 5621 | * @note |
| 5622 | * @author zsalah |
| 5623 | * @date 8 March 2012 |
| 5624 | * @version 1.0 |
| 5625 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5626 | s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5627 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5628 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5629 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5630 | tstrWID strWID; |
| 5631 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5632 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5633 | strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5634 | strWID.enuWIDtype = WID_STR; |
| 5635 | strWID.ps8WidVal = pu8RxPowerLevel; |
| 5636 | strWID.s32ValueSize = u32RxPowerLevelLen; |
| 5637 | |
| 5638 | |
| 5639 | return s32Error; |
| 5640 | } |
| 5641 | |
| 5642 | /** |
| 5643 | * @brief sets a channel |
| 5644 | * @details |
| 5645 | * @param[in,out] handle to the wifi driver, |
| 5646 | * @param[in] Index of the channel to be set |
| 5647 | *|-------------------------------------------------------------------| |
| 5648 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5649 | | Input: 1 2 14 | |
| 5650 | ||-------------------------------------------------------------------| |
| 5651 | * @return Error code indicating success/failure |
| 5652 | * @note |
| 5653 | * @author zsalah |
| 5654 | * @date 8 March 2012 |
| 5655 | * @version 1.0 |
| 5656 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5657 | s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5658 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5659 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5660 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5661 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5662 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5663 | if (pstrWFIDrv == NULL) { |
| 5664 | PRINT_ER("driver is null\n"); |
| 5665 | return -EFAULT; |
| 5666 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5667 | |
| 5668 | /* prepare the set channel message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5669 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5670 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5671 | msg.body.strHostIFSetChan.u8SetChan = u8ChNum; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5672 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5673 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5674 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5675 | if (s32Error) { |
| 5676 | PRINT_ER("wilc mq send fail\n"); |
| 5677 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5678 | } |
| 5679 | |
| 5680 | return s32Error; |
| 5681 | } |
| 5682 | |
| 5683 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5684 | s32 host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5685 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5686 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5687 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5688 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5689 | |
| 5690 | /* prepare the set driver handler message */ |
| 5691 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5692 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5693 | msg.id = HOST_IF_MSG_Q_IDLE; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5694 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5695 | if (s32Error) { |
| 5696 | PRINT_ER("wilc mq send fail\n"); |
| 5697 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5698 | } |
| 5699 | |
| 5700 | /* wait untill MSG Q is empty */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5701 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5702 | |
| 5703 | return s32Error; |
| 5704 | |
| 5705 | } |
| 5706 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5707 | s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5708 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5709 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5710 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5711 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5712 | |
| 5713 | |
| 5714 | /* prepare the set driver handler message */ |
| 5715 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5716 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5717 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5718 | msg.body.strHostIfSetDrvHandler.u32Address = get_id_from_handler(u32address); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5719 | msg.drvHandler = u32address; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5720 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5721 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5722 | if (s32Error) { |
| 5723 | PRINT_ER("wilc mq send fail\n"); |
| 5724 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5725 | } |
| 5726 | |
| 5727 | return s32Error; |
| 5728 | } |
| 5729 | |
| 5730 | |
| 5731 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5732 | s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5733 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5734 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5735 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5736 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5737 | |
| 5738 | |
| 5739 | /* prepare the set driver handler message */ |
| 5740 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5741 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5742 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5743 | msg.body.strHostIfSetOperationMode.u32Mode = u32mode; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5744 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5745 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5746 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5747 | if (s32Error) { |
| 5748 | PRINT_ER("wilc mq send fail\n"); |
| 5749 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5750 | } |
| 5751 | |
| 5752 | return s32Error; |
| 5753 | } |
| 5754 | |
| 5755 | /** |
| 5756 | * @brief gets the current channel index |
| 5757 | * @details |
| 5758 | * @param[in,out] handle to the wifi driver, |
| 5759 | * current channel index |
| 5760 | *|-----------------------------------------------------------------------| |
| 5761 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5762 | | Input: 1 2 14 | |
| 5763 | ||-----------------------------------------------------------------------| |
| 5764 | * @return Error code indicating success/failure |
| 5765 | * @note |
| 5766 | * @author zsalah |
| 5767 | * @date 8 March 2012 |
| 5768 | * @version 1.0 |
| 5769 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5770 | s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5771 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5772 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5773 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5774 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5775 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5776 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5777 | PRINT_ER("driver is null\n"); |
| 5778 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5779 | } |
| 5780 | |
| 5781 | /* prepare the Get Channel Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5782 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5783 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5784 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5785 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5786 | |
| 5787 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5788 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5789 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5790 | PRINT_ER("wilc mq send fail\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5791 | down(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5792 | /* gu8Chnl = 11; */ |
| 5793 | |
| 5794 | *pu8ChNo = gu8Chnl; |
| 5795 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5796 | return s32Error; |
| 5797 | |
| 5798 | |
| 5799 | } |
| 5800 | |
| 5801 | |
| 5802 | /** |
| 5803 | * @brief host_int_test_set_int_wid |
| 5804 | * @details Test function for setting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5805 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5806 | * @return Error code indicating success/failure |
| 5807 | * @note |
| 5808 | * @author zsalah |
| 5809 | * @date 8 March 2012 |
| 5810 | * @version 1.0 |
| 5811 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5812 | s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5813 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5814 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5815 | tstrWID strWID; |
| 5816 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5817 | |
| 5818 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5819 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5820 | PRINT_ER("driver is null\n"); |
| 5821 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5822 | } |
| 5823 | |
| 5824 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5825 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5826 | strWID.enuWIDtype = WID_INT; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5827 | strWID.ps8WidVal = (char *)&u32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5828 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5829 | |
| 5830 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5831 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 5832 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5833 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5834 | PRINT_ER("Failed to set wid value\n"); |
| 5835 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5836 | } else { |
| 5837 | PRINT_D(HOSTINF_DBG, "Successfully set wid value\n"); |
| 5838 | |
| 5839 | } |
| 5840 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5841 | return s32Error; |
| 5842 | } |
| 5843 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5844 | /** |
| 5845 | * @brief host_int_get_inactive_time |
| 5846 | * @details |
| 5847 | * @param[in,out] handle to the wifi driver, |
| 5848 | * current sta macaddress, inactive_time |
| 5849 | * @return |
| 5850 | * @note |
| 5851 | * @author |
| 5852 | * @date |
| 5853 | * @version 1.0 |
| 5854 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5855 | 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] | 5856 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5857 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5858 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5859 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5860 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5861 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5862 | PRINT_ER("driver is null\n"); |
| 5863 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5864 | } |
| 5865 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5866 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5867 | |
| 5868 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5869 | memcpy(msg.body.strHostIfStaInactiveT.mac, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5870 | mac, ETH_ALEN); |
| 5871 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5872 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5873 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5874 | |
| 5875 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5876 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5877 | if (s32Error) |
| 5878 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5879 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5880 | down(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5881 | |
| 5882 | *pu32InactiveTime = gu32InactiveTime; |
| 5883 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5884 | return s32Error; |
| 5885 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 5886 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5887 | /** |
| 5888 | * @brief host_int_test_get_int_wid |
| 5889 | * @details Test function for getting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5890 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5891 | * @return Error code indicating success/failure |
| 5892 | * @note |
| 5893 | * @author zsalah |
| 5894 | * @date 8 March 2012 |
| 5895 | * @version 1.0 |
| 5896 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5897 | s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5898 | { |
| 5899 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5900 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5901 | tstrWID strWID; |
| 5902 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5903 | |
| 5904 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5905 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5906 | PRINT_ER("driver is null\n"); |
| 5907 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5908 | } |
| 5909 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5910 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5911 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5912 | strWID.ps8WidVal = (s8 *)pu32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5913 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5914 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5915 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 5916 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5917 | /*get the value by searching the local copy*/ |
| 5918 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5919 | PRINT_ER("Failed to get wid value\n"); |
| 5920 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5921 | } else { |
| 5922 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
| 5923 | |
| 5924 | } |
| 5925 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5926 | return s32Error; |
| 5927 | } |
| 5928 | |
| 5929 | |
| 5930 | /** |
| 5931 | * @brief host_int_get_rssi |
| 5932 | * @details gets the currently maintained RSSI value for the station. |
| 5933 | * The received signal strength value in dB. |
| 5934 | * The range of valid values is -128 to 0. |
| 5935 | * @param[in,out] handle to the wifi driver, |
| 5936 | * rssi value in dB |
| 5937 | * @return Error code indicating success/failure |
| 5938 | * @note |
| 5939 | * @author zsalah |
| 5940 | * @date 8 March 2012 |
| 5941 | * @version 1.0 |
| 5942 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5943 | s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5944 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5945 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5946 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5947 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5948 | |
| 5949 | |
| 5950 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5951 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5952 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5953 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5954 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5955 | |
| 5956 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5957 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5958 | if (s32Error) { |
| 5959 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5960 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5961 | } |
| 5962 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5963 | down(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5964 | |
| 5965 | |
| 5966 | if (ps8Rssi == NULL) { |
| 5967 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5968 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5969 | } |
| 5970 | |
| 5971 | |
| 5972 | *ps8Rssi = gs8Rssi; |
| 5973 | |
| 5974 | |
| 5975 | return s32Error; |
| 5976 | } |
| 5977 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5978 | s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5979 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5980 | struct host_if_msg msg; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5981 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5982 | |
| 5983 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5984 | |
| 5985 | |
| 5986 | |
| 5987 | /* prepare the Get LINKSPEED Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5988 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5989 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5990 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5991 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5992 | |
| 5993 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5994 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5995 | if (s32Error) { |
| 5996 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5997 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5998 | } |
| 5999 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6000 | down(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6001 | |
| 6002 | |
| 6003 | if (ps8lnkspd == NULL) { |
| 6004 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6005 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6006 | } |
| 6007 | |
| 6008 | |
| 6009 | *ps8lnkspd = gs8lnkspd; |
| 6010 | |
| 6011 | |
| 6012 | return s32Error; |
| 6013 | } |
| 6014 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6015 | s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6016 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6017 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6018 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6019 | |
| 6020 | |
| 6021 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6022 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6023 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6024 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6025 | msg.body.pUserData = (char *)pstrStatistics; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6026 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6027 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6028 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6029 | if (s32Error) { |
| 6030 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6031 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6032 | } |
| 6033 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6034 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6035 | return s32Error; |
| 6036 | } |
| 6037 | |
| 6038 | |
| 6039 | /** |
| 6040 | * @brief host_int_scan |
| 6041 | * @details scans a set of channels |
| 6042 | * @param[in,out] handle to the wifi driver, |
| 6043 | * @param[in] Scan source |
| 6044 | * Scan Type PASSIVE_SCAN = 0, |
| 6045 | * ACTIVE_SCAN = 1 |
| 6046 | * Channels Array |
| 6047 | * Channels Array length |
| 6048 | * Scan Callback function |
| 6049 | * @return Error code indicating success/failure |
| 6050 | * @note |
| 6051 | * @author zsalah |
| 6052 | * @date 8 March 2012 |
| 6053 | * @version 1.0 |
| 6054 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6055 | s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6056 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 6057 | u8 u8ChnlListLen, const u8 *pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6058 | size_t IEsLen, tWILCpfScanResult ScanResult, |
| 6059 | void *pvUserArg, tstrHiddenNetwork *pstrHiddenNetwork) |
| 6060 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6061 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6062 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6063 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6064 | tenuScanConnTimer enuScanConnTimer; |
| 6065 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6066 | if (pstrWFIDrv == NULL || ScanResult == NULL) { |
| 6067 | PRINT_ER("pstrWFIDrv or ScanResult = NULL\n"); |
| 6068 | return -EFAULT; |
| 6069 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6070 | |
| 6071 | /* prepare the Scan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6072 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6073 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6074 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6075 | |
| 6076 | if (pstrHiddenNetwork != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6077 | msg.body.strHostIFscanAttr.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 6078 | msg.body.strHostIFscanAttr.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6079 | |
| 6080 | } else |
| 6081 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 6082 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6083 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6084 | msg.body.strHostIFscanAttr.u8ScanSource = u8ScanSource; |
| 6085 | msg.body.strHostIFscanAttr.u8ScanType = u8ScanType; |
| 6086 | msg.body.strHostIFscanAttr.pfScanResult = ScanResult; |
| 6087 | msg.body.strHostIFscanAttr.pvUserArg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6088 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6089 | msg.body.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; |
| 6090 | msg.body.strHostIFscanAttr.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6091 | memcpy(msg.body.strHostIFscanAttr.pu8ChnlFreqList, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6092 | pu8ChnlFreqList, u8ChnlListLen); |
| 6093 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6094 | msg.body.strHostIFscanAttr.IEsLen = IEsLen; |
| 6095 | msg.body.strHostIFscanAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6096 | memcpy(msg.body.strHostIFscanAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6097 | pu8IEs, IEsLen); |
| 6098 | |
| 6099 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6100 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6101 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6102 | PRINT_ER("Error in sending message queue\n"); |
| 6103 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6104 | } |
| 6105 | |
| 6106 | enuScanConnTimer = SCAN_TIMER; |
| 6107 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6108 | pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; |
| 6109 | mod_timer(&pstrWFIDrv->hScanTimer, |
| 6110 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6111 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6112 | return s32Error; |
| 6113 | |
| 6114 | } |
| 6115 | /** |
| 6116 | * @brief hif_set_cfg |
| 6117 | * @details sets configuration wids values |
| 6118 | * @param[in,out] handle to the wifi driver, |
| 6119 | * @param[in] WID, WID value |
| 6120 | * @return Error code indicating success/failure |
| 6121 | * @note |
| 6122 | * @author zsalah |
| 6123 | * @date 8 March 2012 |
| 6124 | * @version 1.0 |
| 6125 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6126 | s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6127 | { |
| 6128 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6129 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6130 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6131 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6132 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6133 | |
| 6134 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6135 | if (pstrWFIDrv == NULL) { |
| 6136 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 6137 | return -EFAULT; |
| 6138 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6139 | /* prepare the WiphyParams Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6140 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6141 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6142 | msg.body.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6143 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6144 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6145 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6146 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6147 | return s32Error; |
| 6148 | |
| 6149 | } |
| 6150 | |
| 6151 | |
| 6152 | /** |
| 6153 | * @brief hif_get_cfg |
| 6154 | * @details gets configuration wids values |
| 6155 | * @param[in,out] handle to the wifi driver, |
| 6156 | * WID value |
| 6157 | * @param[in] WID, |
| 6158 | * @return Error code indicating success/failure |
| 6159 | * @note |
| 6160 | * @author zsalah |
| 6161 | * |
| 6162 | * @date 8 March 2012 |
| 6163 | * @version 1.0 |
| 6164 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6165 | s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6166 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6167 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6168 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6169 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6170 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6171 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6172 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6173 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 6174 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6175 | } |
| 6176 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 6177 | switch (u16WID) { |
| 6178 | |
| 6179 | case WID_BSS_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6180 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6181 | break; |
| 6182 | |
| 6183 | case WID_AUTH_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6184 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6185 | break; |
| 6186 | |
| 6187 | case WID_AUTH_TIMEOUT: |
| 6188 | *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout; |
| 6189 | break; |
| 6190 | |
| 6191 | case WID_POWER_MANAGEMENT: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6192 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6193 | break; |
| 6194 | |
| 6195 | case WID_SHORT_RETRY_LIMIT: |
| 6196 | *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit; |
| 6197 | break; |
| 6198 | |
| 6199 | case WID_LONG_RETRY_LIMIT: |
| 6200 | *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit; |
| 6201 | break; |
| 6202 | |
| 6203 | case WID_FRAG_THRESHOLD: |
| 6204 | *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold; |
| 6205 | break; |
| 6206 | |
| 6207 | case WID_RTS_THRESHOLD: |
| 6208 | *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold; |
| 6209 | break; |
| 6210 | |
| 6211 | case WID_PREAMBLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6212 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6213 | break; |
| 6214 | |
| 6215 | case WID_SHORT_SLOT_ALLOWED: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6216 | *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6217 | break; |
| 6218 | |
| 6219 | case WID_11N_TXOP_PROT_DISABLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6220 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6221 | break; |
| 6222 | |
| 6223 | case WID_BEACON_INTERVAL: |
| 6224 | *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval; |
| 6225 | break; |
| 6226 | |
| 6227 | case WID_DTIM_PERIOD: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6228 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6229 | break; |
| 6230 | |
| 6231 | case WID_SITE_SURVEY: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6232 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6233 | break; |
| 6234 | |
| 6235 | case WID_SITE_SURVEY_SCAN_TIME: |
| 6236 | *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time; |
| 6237 | break; |
| 6238 | |
| 6239 | case WID_ACTIVE_SCAN_TIME: |
| 6240 | *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time; |
| 6241 | break; |
| 6242 | |
| 6243 | case WID_PASSIVE_SCAN_TIME: |
| 6244 | *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time; |
| 6245 | break; |
| 6246 | |
| 6247 | case WID_CURRENT_TX_RATE: |
| 6248 | *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate; |
| 6249 | break; |
| 6250 | |
| 6251 | default: |
| 6252 | break; |
| 6253 | } |
| 6254 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6255 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6256 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6257 | return s32Error; |
| 6258 | |
| 6259 | } |
| 6260 | |
| 6261 | /*****************************************************************************/ |
| 6262 | /* Notification Functions */ |
| 6263 | /*****************************************************************************/ |
| 6264 | /** |
| 6265 | * @brief notifies host with join and leave requests |
| 6266 | * @details This function prepares an Information frame having the |
| 6267 | * information about a joining/leaving station. |
| 6268 | * @param[in,out] handle to the wifi driver, |
| 6269 | * @param[in] 6 byte Sta Adress |
| 6270 | * Join or leave flag: |
| 6271 | * Join = 1, |
| 6272 | * Leave =0 |
| 6273 | * @return Error code indicating success/failure |
| 6274 | * @note |
| 6275 | * @author zsalah |
| 6276 | * @date 8 March 2012 |
| 6277 | * @version 1.0 |
| 6278 | */ |
| 6279 | void host_int_send_join_leave_info_to_host |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6280 | (u16 assocId, u8 *stationAddr, bool joining) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6281 | { |
| 6282 | } |
| 6283 | /** |
| 6284 | * @brief notifies host with stations found in scan |
| 6285 | * @details sends the beacon/probe response from scan |
| 6286 | * @param[in,out] handle to the wifi driver, |
| 6287 | * @param[in] Sta Address, |
| 6288 | * Frame length, |
| 6289 | * Rssi of the Station found |
| 6290 | * @return Error code indicating success/failure |
| 6291 | * @note |
| 6292 | * @author zsalah |
| 6293 | * @date 8 March 2012 |
| 6294 | * @version 1.0 |
| 6295 | */ |
| 6296 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6297 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6298 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6299 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6300 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6301 | if (pstrWFIDrv == NULL) { |
| 6302 | PRINT_ER("Driver handler is NULL\n"); |
| 6303 | return; |
| 6304 | } |
| 6305 | |
| 6306 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6307 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6308 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6309 | |
| 6310 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6311 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6312 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6313 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6314 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6315 | |
| 6316 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6317 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6318 | if (s32Error) { |
| 6319 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6320 | return; |
| 6321 | } |
| 6322 | } |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6323 | g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; |
| 6324 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6325 | } |
| 6326 | |
| 6327 | |
| 6328 | void host_int_send_network_info_to_host |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 6329 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6330 | { |
| 6331 | } |
| 6332 | /** |
| 6333 | * @brief host_int_init |
| 6334 | * @details host interface initialization function |
| 6335 | * @param[in,out] handle to the wifi driver, |
| 6336 | * @note |
| 6337 | * @author zsalah |
| 6338 | * @date 8 March 2012 |
| 6339 | * @version 1.0 |
| 6340 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6341 | static u32 u32Intialized; |
| 6342 | static u32 msgQ_created; |
| 6343 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6344 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6345 | s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6346 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6347 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6348 | tstrWILC_WFIDrv *pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6349 | int err; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6350 | |
| 6351 | /*if(u32Intialized == 1) |
| 6352 | * { |
| 6353 | * PRINT_D(HOSTINF_DBG,"Host interface is previously initialized\n"); |
| 6354 | * *phWFIDrv = (WILC_WFIDrvHandle)gWFiDrvHandle; //Will be adjusted later for P2P |
| 6355 | * return 0; |
| 6356 | * } */ |
| 6357 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 6358 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6359 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6360 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6361 | sema_init(&hWaitResponse, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6362 | |
| 6363 | |
| 6364 | |
| 6365 | /*Allocate host interface private structure*/ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6366 | pstrWFIDrv = kmalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6367 | if (pstrWFIDrv == NULL) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6368 | s32Error = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6369 | PRINT_ER("Failed to allocate memory\n"); |
| 6370 | goto _fail_timer_2; |
| 6371 | } |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6372 | memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6373 | /*return driver handle to user*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6374 | *phWFIDrv = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6375 | /*save into globl handle*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6376 | err = add_handler_in_list(pstrWFIDrv); |
| 6377 | if (err) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6378 | s32Error = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6379 | goto _fail_timer_2; |
| 6380 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6381 | |
| 6382 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 6383 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6384 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6385 | #endif |
| 6386 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6387 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6388 | /* /////////////////////////////////////// */ |
| 6389 | if (clients_count == 0) { |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6390 | sema_init(&hSemHostIFthrdEnd, 0); |
| 6391 | sema_init(&hSemDeinitDrvHandle, 0); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6392 | sema_init(&hSemHostIntDeinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6393 | } |
| 6394 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6395 | sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0); |
| 6396 | sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0); |
| 6397 | sema_init(&(pstrWFIDrv->hSemGetRSSI), 0); |
| 6398 | sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0); |
| 6399 | sema_init(&(pstrWFIDrv->hSemGetCHNL), 0); |
| 6400 | sema_init(&(pstrWFIDrv->hSemInactiveTime), 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6401 | |
| 6402 | /* /////////////////////////////////////// */ |
| 6403 | |
| 6404 | |
| 6405 | |
| 6406 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 6407 | |
| 6408 | if (clients_count == 0) { |
Chaehyun Lim | cd08fc7 | 2015-08-19 15:59:05 +0900 | [diff] [blame] | 6409 | s32Error = wilc_mq_create(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6410 | |
| 6411 | if (s32Error < 0) { |
| 6412 | PRINT_ER("Failed to creat MQ\n"); |
| 6413 | goto _fail_; |
| 6414 | } |
| 6415 | msgQ_created = 1; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6416 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
| 6417 | if (IS_ERR(HostIFthreadHandler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6418 | PRINT_ER("Failed to creat Thread\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6419 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6420 | goto _fail_mq_; |
| 6421 | } |
Greg Kroah-Hartman | 507d7fc | 2015-08-17 12:59:42 -0700 | [diff] [blame] | 6422 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
| 6423 | (unsigned long)pstrWFIDrv); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6424 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6425 | } |
| 6426 | |
| 6427 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6428 | setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6429 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6430 | setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6431 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6432 | /*Remain on channel timer*/ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6433 | setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6434 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6435 | sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); |
| 6436 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6437 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6438 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6439 | /* gWFiDrvHandle->bPendingConnRequest = false; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6440 | |
| 6441 | /*Initialize CFG WIDS Defualt Values*/ |
| 6442 | |
| 6443 | pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 6444 | pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 6445 | pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 6446 | pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 6447 | pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE; |
| 6448 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6449 | pstrWFIDrv->u64P2p_MgmtTimeout = 0; |
| 6450 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6451 | 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", |
| 6452 | |
| 6453 | pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source, |
| 6454 | pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time, |
| 6455 | pstrWFIDrv->strCfgValues.curr_tx_rate); |
| 6456 | |
| 6457 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6458 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6459 | |
| 6460 | /*TODO Code to setup simulation to be removed later*/ |
| 6461 | /*Intialize configurator module*/ |
| 6462 | s32Error = CoreConfiguratorInit(); |
| 6463 | if (s32Error < 0) { |
| 6464 | PRINT_ER("Failed to initialize core configurator\n"); |
| 6465 | goto _fail_mem_; |
| 6466 | } |
| 6467 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6468 | u32Intialized = 1; |
| 6469 | clients_count++; /* increase number of created entities */ |
| 6470 | |
| 6471 | return s32Error; |
| 6472 | |
| 6473 | |
| 6474 | _fail_mem_: |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6475 | if (pstrWFIDrv != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6476 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6477 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6478 | _fail_timer_2: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6479 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6480 | del_timer_sync(&pstrWFIDrv->hConnectTimer); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6481 | del_timer_sync(&pstrWFIDrv->hScanTimer); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6482 | kthread_stop(HostIFthreadHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6483 | _fail_mq_: |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6484 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6485 | _fail_: |
| 6486 | return s32Error; |
| 6487 | |
| 6488 | |
| 6489 | } |
| 6490 | /** |
| 6491 | * @brief host_int_deinit |
| 6492 | * @details host interface initialization function |
| 6493 | * @param[in,out] handle to the wifi driver, |
| 6494 | * @note |
| 6495 | * @author zsalah |
| 6496 | * @date 8 March 2012 |
| 6497 | * @version 1.0 |
| 6498 | */ |
| 6499 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6500 | s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6501 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6502 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6503 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6504 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6505 | |
| 6506 | /*obtain driver handle*/ |
| 6507 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6508 | /*if(u32Intialized == 0) |
| 6509 | * { |
| 6510 | * PRINT_ER("Host Interface is not initialized\n"); |
| 6511 | * return 0; |
| 6512 | * }*/ |
| 6513 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6514 | |
| 6515 | if (pstrWFIDrv == NULL) { |
| 6516 | PRINT_ER("pstrWFIDrv = NULL\n"); |
| 6517 | return 0; |
| 6518 | } |
| 6519 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6520 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6521 | |
| 6522 | terminated_handle = pstrWFIDrv; |
| 6523 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 6524 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6525 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ |
| 6526 | /*to guarantee handling all messages befor proceeding*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6527 | if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6528 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6529 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
| 6530 | } |
| 6531 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6532 | if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6533 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6534 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6535 | } |
| 6536 | |
| 6537 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6538 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6539 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6540 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6541 | } |
| 6542 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6543 | /*Destroy Remain-onchannel Timer*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6544 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6545 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6546 | host_int_set_wfi_drv_handler(NULL); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6547 | down(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6548 | |
| 6549 | |
| 6550 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ |
| 6551 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6552 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6553 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 6554 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6555 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6556 | } |
| 6557 | /*deinit configurator and simulator*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6558 | CoreConfiguratorDeInit(); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6559 | |
| 6560 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 6561 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6562 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6563 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6564 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6565 | |
| 6566 | if (clients_count == 1) { |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6567 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6568 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6569 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6570 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6571 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6572 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6573 | |
| 6574 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6575 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6576 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6577 | 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] | 6578 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6579 | down(&hSemHostIFthrdEnd); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6580 | |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6581 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6582 | msgQ_created = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6583 | } |
| 6584 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6585 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6586 | |
| 6587 | /*Setting the gloabl driver handler with NULL*/ |
| 6588 | u32Intialized = 0; |
| 6589 | /* gWFiDrvHandle = NULL; */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6590 | ret = remove_handler_in_list(pstrWFIDrv); |
| 6591 | if (ret) |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6592 | s32Error = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6593 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6594 | if (pstrWFIDrv != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6595 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6596 | /* pstrWFIDrv=NULL; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6597 | |
| 6598 | } |
| 6599 | |
| 6600 | clients_count--; /* Decrease number of created entities */ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6601 | terminated_handle = NULL; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6602 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6603 | return s32Error; |
| 6604 | } |
| 6605 | |
| 6606 | |
| 6607 | /** |
| 6608 | * @brief NetworkInfoReceived |
| 6609 | * @details function to to be called when network info packet is received |
| 6610 | * @param[in] pu8Buffer the received packet |
| 6611 | * @param[in] u32Length length of the received packet |
| 6612 | * @return none |
| 6613 | * @note |
| 6614 | * @author |
| 6615 | * @date 1 Mar 2012 |
| 6616 | * @version 1.0 |
| 6617 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6618 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6619 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6620 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6621 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6622 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6623 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6624 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6625 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6626 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6627 | |
| 6628 | |
| 6629 | |
| 6630 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6631 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6632 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6633 | return; |
| 6634 | } |
| 6635 | |
| 6636 | /* prepare the Asynchronous Network Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6637 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6638 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6639 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6640 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6641 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6642 | msg.body.strRcvdNetworkInfo.u32Length = u32Length; |
| 6643 | msg.body.strRcvdNetworkInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6644 | memcpy(msg.body.strRcvdNetworkInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6645 | pu8Buffer, u32Length); |
| 6646 | |
| 6647 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6648 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6649 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6650 | 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] | 6651 | } |
| 6652 | |
| 6653 | /** |
| 6654 | * @brief GnrlAsyncInfoReceived |
| 6655 | * @details function to be called when general Asynchronous info packet is received |
| 6656 | * @param[in] pu8Buffer the received packet |
| 6657 | * @param[in] u32Length length of the received packet |
| 6658 | * @return none |
| 6659 | * @note |
| 6660 | * @author |
| 6661 | * @date 15 Mar 2012 |
| 6662 | * @version 1.0 |
| 6663 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6664 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6665 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6666 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6667 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6668 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6669 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6670 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6671 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6672 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6673 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6674 | pstrWFIDrv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6675 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6676 | |
| 6677 | |
| 6678 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
| 6679 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6680 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6681 | return; |
| 6682 | } |
| 6683 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6684 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6685 | /* received mac status is not needed when there is no current Connect Request */ |
| 6686 | PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6687 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6688 | return; |
| 6689 | } |
| 6690 | |
| 6691 | /* prepare the General Asynchronous Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6692 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6693 | |
| 6694 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6695 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6696 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6697 | |
| 6698 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6699 | msg.body.strRcvdGnrlAsyncInfo.u32Length = u32Length; |
| 6700 | msg.body.strRcvdGnrlAsyncInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6701 | memcpy(msg.body.strRcvdGnrlAsyncInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6702 | pu8Buffer, u32Length); |
| 6703 | |
| 6704 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6705 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6706 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6707 | 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] | 6708 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6709 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6710 | } |
| 6711 | |
| 6712 | /** |
| 6713 | * @brief host_int_ScanCompleteReceived |
| 6714 | * @details Setting scan complete received notifcation in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6715 | * @param[in] u8* pu8Buffer, u32 u32Length |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6716 | * @return Error code. |
| 6717 | * @author |
| 6718 | * @date |
| 6719 | * @version 1.0 |
| 6720 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6721 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6722 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6723 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6724 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6725 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6726 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6727 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6728 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6729 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6730 | |
| 6731 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6732 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6733 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6734 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6735 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6736 | |
| 6737 | /*if there is an ongoing scan request*/ |
| 6738 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 6739 | /* prepare theScan Done message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6740 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6741 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6742 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6743 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6744 | |
| 6745 | |
| 6746 | /* will be deallocated by the receiving thread */ |
| 6747 | /*no need to send message body*/ |
| 6748 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6749 | /*msg.body.strScanComplete.u32Length = u32Length; |
| 6750 | * msg.body.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
| 6751 | * memcpy(msg.body.strScanComplete.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6752 | * pu8Buffer, u32Length); */ |
| 6753 | |
| 6754 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6755 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6756 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6757 | 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] | 6758 | } |
| 6759 | |
| 6760 | |
| 6761 | return; |
| 6762 | |
| 6763 | } |
| 6764 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6765 | /** |
| 6766 | * @brief host_int_remain_on_channel |
| 6767 | * @details |
| 6768 | * @param[in] Handle to wifi driver |
| 6769 | * Duration to remain on channel |
| 6770 | * Channel to remain on |
| 6771 | * Pointer to fn to be called on receive frames in listen state |
| 6772 | * Pointer to remain-on-channel expired fn |
| 6773 | * Priv |
| 6774 | * @return Error code. |
| 6775 | * @author |
| 6776 | * @date |
| 6777 | * @version 1.0 |
| 6778 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6779 | 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] | 6780 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6781 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6782 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6783 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6784 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6785 | if (pstrWFIDrv == NULL) { |
| 6786 | PRINT_ER("driver is null\n"); |
| 6787 | return -EFAULT; |
| 6788 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6789 | |
| 6790 | /* prepare the remainonchan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6791 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6792 | |
| 6793 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6794 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6795 | msg.body.strHostIfRemainOnChan.u16Channel = chan; |
| 6796 | msg.body.strHostIfRemainOnChan.pRemainOnChanExpired = RemainOnChanExpired; |
| 6797 | msg.body.strHostIfRemainOnChan.pRemainOnChanReady = RemainOnChanReady; |
| 6798 | msg.body.strHostIfRemainOnChan.pVoid = pvUserArg; |
| 6799 | msg.body.strHostIfRemainOnChan.u32duration = u32duration; |
| 6800 | msg.body.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6801 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6802 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6803 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6804 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6805 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6806 | |
| 6807 | return s32Error; |
| 6808 | } |
| 6809 | |
| 6810 | /** |
| 6811 | * @brief host_int_ListenStateExpired |
| 6812 | * @details |
| 6813 | * @param[in] Handle to wifi driver |
| 6814 | * Duration to remain on channel |
| 6815 | * Channel to remain on |
| 6816 | * Pointer to fn to be called on receive frames in listen state |
| 6817 | * Pointer to remain-on-channel expired fn |
| 6818 | * Priv |
| 6819 | * @return Error code. |
| 6820 | * @author |
| 6821 | * @date |
| 6822 | * @version 1.0 |
| 6823 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6824 | s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6825 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6826 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6827 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6828 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6829 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6830 | if (pstrWFIDrv == NULL) { |
| 6831 | PRINT_ER("driver is null\n"); |
| 6832 | return -EFAULT; |
| 6833 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6834 | |
| 6835 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 6836 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6837 | |
| 6838 | /* prepare the timer fire Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6839 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6840 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6841 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6842 | msg.body.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6843 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6844 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6845 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6846 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6847 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6848 | return s32Error; |
| 6849 | } |
| 6850 | |
| 6851 | /** |
| 6852 | * @brief host_int_frame_register |
| 6853 | * @details |
| 6854 | * @param[in] Handle to wifi driver |
| 6855 | * @return Error code. |
| 6856 | * @author |
| 6857 | * @date |
| 6858 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6859 | s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6860 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6861 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6862 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6863 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6864 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6865 | if (pstrWFIDrv == NULL) { |
| 6866 | PRINT_ER("driver is null\n"); |
| 6867 | return -EFAULT; |
| 6868 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6869 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6870 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6871 | |
| 6872 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6873 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6874 | switch (u16FrameType) { |
| 6875 | case ACTION: |
| 6876 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6877 | msg.body.strHostIfRegisterFrame.u8Regid = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6878 | break; |
| 6879 | |
| 6880 | case PROBE_REQ: |
| 6881 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6882 | msg.body.strHostIfRegisterFrame.u8Regid = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6883 | break; |
| 6884 | |
| 6885 | default: |
| 6886 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 6887 | break; |
| 6888 | } |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6889 | msg.body.strHostIfRegisterFrame.u16FrameType = u16FrameType; |
| 6890 | msg.body.strHostIfRegisterFrame.bReg = bReg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6891 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6892 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6893 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6894 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6895 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6896 | |
| 6897 | return s32Error; |
| 6898 | |
| 6899 | |
| 6900 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6901 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6902 | /** |
| 6903 | * @brief host_int_add_beacon |
| 6904 | * @details Setting add beacon params in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6905 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
| 6906 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, |
| 6907 | * u32 u32TailLen, u8* pu8Tail |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6908 | * @return Error code. |
| 6909 | * @author |
| 6910 | * @date |
| 6911 | * @version 1.0 |
| 6912 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6913 | s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6914 | u32 u32DTIMPeriod, |
| 6915 | u32 u32HeadLen, u8 *pu8Head, |
| 6916 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6917 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6918 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6919 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6920 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6921 | tstrHostIFSetBeacon *pstrSetBeaconParam = &msg.body.strHostIFSetBeacon; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6922 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6923 | if (pstrWFIDrv == NULL) { |
| 6924 | PRINT_ER("driver is null\n"); |
| 6925 | return -EFAULT; |
| 6926 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6927 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6928 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6929 | |
| 6930 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 6931 | |
| 6932 | |
| 6933 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6934 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6935 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6936 | pstrSetBeaconParam->u32Interval = u32Interval; |
| 6937 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; |
| 6938 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6939 | pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6940 | if (pstrSetBeaconParam->pu8Head == NULL) { |
| 6941 | s32Error = -ENOMEM; |
| 6942 | goto ERRORHANDLER; |
| 6943 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6944 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6945 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
| 6946 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6947 | if (u32TailLen > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6948 | pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6949 | if (pstrSetBeaconParam->pu8Tail == NULL) { |
| 6950 | s32Error = -ENOMEM; |
| 6951 | goto ERRORHANDLER; |
| 6952 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6953 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6954 | } else { |
| 6955 | pstrSetBeaconParam->pu8Tail = NULL; |
| 6956 | } |
| 6957 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6958 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6959 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6960 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6961 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6962 | ERRORHANDLER: |
| 6963 | if (s32Error) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6964 | if (pstrSetBeaconParam->pu8Head != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6965 | kfree(pstrSetBeaconParam->pu8Head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6966 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6967 | if (pstrSetBeaconParam->pu8Tail != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6968 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6969 | } |
| 6970 | |
| 6971 | return s32Error; |
| 6972 | |
| 6973 | } |
| 6974 | |
| 6975 | |
| 6976 | /** |
| 6977 | * @brief host_int_del_beacon |
| 6978 | * @details Setting add beacon params in message queue |
| 6979 | * @param[in] WILC_WFIDrvHandle hWFIDrv |
| 6980 | * @return Error code. |
| 6981 | * @author |
| 6982 | * @date |
| 6983 | * @version 1.0 |
| 6984 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6985 | s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6986 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6987 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6988 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6989 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6990 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6991 | if (pstrWFIDrv == NULL) { |
| 6992 | PRINT_ER("driver is null\n"); |
| 6993 | return -EFAULT; |
| 6994 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6995 | |
| 6996 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6997 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6998 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6999 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 7000 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7001 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 7002 | if (s32Error) |
| 7003 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7004 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7005 | return s32Error; |
| 7006 | } |
| 7007 | |
| 7008 | |
| 7009 | /** |
| 7010 | * @brief host_int_add_station |
| 7011 | * @details Setting add station params in message queue |
| 7012 | * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams |
| 7013 | * @return Error code. |
| 7014 | * @author |
| 7015 | * @date |
| 7016 | * @version 1.0 |
| 7017 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7018 | s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7019 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7020 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7021 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7022 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7023 | tstrWILC_AddStaParam *pstrAddStationMsg = &msg.body.strAddStaParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7024 | |
| 7025 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7026 | if (pstrWFIDrv == NULL) { |
| 7027 | PRINT_ER("driver is null\n"); |
| 7028 | return -EFAULT; |
| 7029 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7030 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7031 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7032 | |
| 7033 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 7034 | |
| 7035 | |
| 7036 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7037 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7038 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7039 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7040 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7041 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7042 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7043 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 7044 | if (!rates) |
| 7045 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7046 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7047 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7048 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7049 | } |
| 7050 | |
| 7051 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7052 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7053 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7054 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7055 | return s32Error; |
| 7056 | } |
| 7057 | |
| 7058 | /** |
| 7059 | * @brief host_int_del_station |
| 7060 | * @details Setting delete station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7061 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7062 | * @return Error code. |
| 7063 | * @author |
| 7064 | * @date |
| 7065 | * @version 1.0 |
| 7066 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7067 | s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7068 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7069 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7070 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7071 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7072 | tstrHostIFDelSta *pstrDelStationMsg = &msg.body.strDelStaParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7073 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7074 | if (pstrWFIDrv == NULL) { |
| 7075 | PRINT_ER("driver is null\n"); |
| 7076 | return -EFAULT; |
| 7077 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7078 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7079 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7080 | |
| 7081 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 7082 | |
| 7083 | |
| 7084 | |
| 7085 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7086 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7087 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7088 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 7089 | if (pu8MacAddr == NULL) |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7090 | memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7091 | else |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7092 | memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7093 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7094 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7095 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7096 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7097 | return s32Error; |
| 7098 | } |
| 7099 | /** |
| 7100 | * @brief host_int_del_allstation |
| 7101 | * @details Setting del station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7102 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7103 | * @return Error code. |
| 7104 | * @author |
| 7105 | * @date |
| 7106 | * @version 1.0 |
| 7107 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7108 | s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7109 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7110 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7111 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7112 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7113 | tstrHostIFDelAllSta *pstrDelAllStationMsg = &msg.body.strHostIFDelAllSta; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7114 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 7115 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7116 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7117 | |
| 7118 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7119 | if (pstrWFIDrv == NULL) { |
| 7120 | PRINT_ER("driver is null\n"); |
| 7121 | return -EFAULT; |
| 7122 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7123 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7124 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7125 | |
| 7126 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 7127 | |
| 7128 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7129 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7130 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7131 | |
| 7132 | /* Handling situation of deauthenticing all associated stations*/ |
| 7133 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 7134 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7135 | memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7136 | 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], |
| 7137 | pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); |
| 7138 | u8AssocNumb++; |
| 7139 | } |
| 7140 | } |
| 7141 | if (!u8AssocNumb) { |
| 7142 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
| 7143 | return s32Error; |
| 7144 | } |
| 7145 | |
| 7146 | pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7147 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7148 | |
| 7149 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7150 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7151 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7152 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7153 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7154 | |
| 7155 | return s32Error; |
| 7156 | |
| 7157 | } |
| 7158 | |
| 7159 | /** |
| 7160 | * @brief host_int_edit_station |
| 7161 | * @details Setting edit station params in message queue |
| 7162 | * @param[in] WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam* pstrStaParams |
| 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_edit_station(tstrWILC_WFIDrv *hWFIDrv, tstrWILC_AddStaParam *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7169 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7170 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7171 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7172 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7173 | tstrWILC_AddStaParam *pstrAddStationMsg = &msg.body.strAddStaParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7174 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7175 | if (pstrWFIDrv == NULL) { |
| 7176 | PRINT_ER("driver is null\n"); |
| 7177 | return -EFAULT; |
| 7178 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7179 | |
| 7180 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 7181 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7182 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7183 | |
| 7184 | |
| 7185 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7186 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7187 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7188 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7189 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7190 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7191 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7192 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 7193 | if (!rates) |
| 7194 | return -ENOMEM; |
| 7195 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7196 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7197 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7198 | } |
| 7199 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7200 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7201 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7202 | PRINT_ER("wilc_mq_send fail\n"); |
| 7203 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7204 | return s32Error; |
| 7205 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 7206 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7207 | 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] | 7208 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7209 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7210 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7211 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7212 | tstrHostIfPowerMgmtParam *pstrPowerMgmtParam = &msg.body.strPowerMgmtparam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7213 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7214 | 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] | 7215 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7216 | if (pstrWFIDrv == NULL) { |
| 7217 | PRINT_ER("driver is null\n"); |
| 7218 | return -EFAULT; |
| 7219 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7220 | |
| 7221 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 7222 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7223 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7224 | |
| 7225 | |
| 7226 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7227 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7228 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7229 | |
| 7230 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; |
| 7231 | pstrPowerMgmtParam->u32Timeout = u32Timeout; |
| 7232 | |
| 7233 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7234 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7235 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7236 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7237 | return s32Error; |
| 7238 | } |
| 7239 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7240 | 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] | 7241 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7242 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7243 | |
| 7244 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7245 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7246 | tstrHostIFSetMulti *pstrMulticastFilterParam = &msg.body.strHostIfSetMulti; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7247 | |
| 7248 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7249 | if (pstrWFIDrv == NULL) { |
| 7250 | PRINT_ER("driver is null\n"); |
| 7251 | return -EFAULT; |
| 7252 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7253 | |
| 7254 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 7255 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7256 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7257 | |
| 7258 | |
| 7259 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7260 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7261 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7262 | |
| 7263 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; |
| 7264 | pstrMulticastFilterParam->u32count = u32count; |
| 7265 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7266 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7267 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7268 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7269 | return s32Error; |
| 7270 | } |
| 7271 | |
| 7272 | |
| 7273 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7274 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 7275 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7276 | /** |
| 7277 | * @brief host_int_ParseJoinBssParam |
| 7278 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry |
| 7279 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7280 | * @return |
| 7281 | * @author zsalah |
| 7282 | * @date |
| 7283 | * @version 1.0**/ |
| 7284 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 7285 | { |
| 7286 | tstrJoinBssParam *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7287 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7288 | u16 u16IEsLen; |
| 7289 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7290 | u8 suppRatesNo = 0; |
| 7291 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7292 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7293 | u8 pcipherCount; |
| 7294 | u8 authCount; |
| 7295 | u8 pcipherTotalCount = 0; |
| 7296 | u8 authTotalCount = 0; |
| 7297 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7298 | |
| 7299 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 7300 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 7301 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7302 | pNewJoinBssParam = kmalloc(sizeof(tstrJoinBssParam), GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7303 | if (pNewJoinBssParam != NULL) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7304 | memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7305 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 7306 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 7307 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7308 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7309 | /*for(i=0; i<6;i++) |
| 7310 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7311 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7312 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7313 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 7314 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7315 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
| 7316 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ |
| 7317 | |
| 7318 | /* parse supported rates: */ |
| 7319 | while (index < u16IEsLen) { |
| 7320 | /* supportedRates IE */ |
| 7321 | if (pu8IEs[index] == SUPP_RATES_IE) { |
| 7322 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ |
| 7323 | suppRatesNo = pu8IEs[index + 1]; |
| 7324 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
| 7325 | index += 2; /* skipping ID and length bytes; */ |
| 7326 | |
| 7327 | for (i = 0; i < suppRatesNo; i++) { |
| 7328 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
| 7329 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ |
| 7330 | } |
| 7331 | index += suppRatesNo; |
| 7332 | continue; |
| 7333 | } |
| 7334 | /* Ext SupportedRates IE */ |
| 7335 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
| 7336 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ |
| 7337 | /* checking if no of ext. supp and supp rates < max limit */ |
| 7338 | extSuppRatesNo = pu8IEs[index + 1]; |
| 7339 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 7340 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 7341 | else |
| 7342 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 7343 | index += 2; |
| 7344 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ |
| 7345 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { |
| 7346 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
| 7347 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ |
| 7348 | } |
| 7349 | index += extSuppRatesNo; |
| 7350 | continue; |
| 7351 | } |
| 7352 | /* HT Cap. IE */ |
| 7353 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
| 7354 | /* if IE found set the flag */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7355 | pNewJoinBssParam->ht_capable = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7356 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7357 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ |
| 7358 | continue; |
| 7359 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ |
| 7360 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
| 7361 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ |
| 7362 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ |
| 7363 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ |
| 7364 | (pu8IEs[index + 7] == 0x01)) { |
| 7365 | /* Presence of WMM Info/Param element indicates WMM capability */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7366 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7367 | |
| 7368 | /* Check if Bit 7 is set indicating U-APSD capability */ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7369 | if (pu8IEs[index + 8] & (1 << 7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7370 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7371 | index += pu8IEs[index + 1] + 2; |
| 7372 | continue; |
| 7373 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7374 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ |
| 7375 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
| 7376 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ |
| 7377 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7378 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7379 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7380 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
| 7381 | pNewJoinBssParam->u8NoaEnbaled = 1; |
| 7382 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; |
| 7383 | |
| 7384 | /* Check if Bit 7 is set indicating Opss capability */ |
| 7385 | if (pu8IEs[index + 10] & (1 << 7)) { |
| 7386 | pNewJoinBssParam->u8OppEnable = 1; |
| 7387 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; |
| 7388 | } else |
| 7389 | pNewJoinBssParam->u8OppEnable = 0; |
| 7390 | /* HOSTINF_DBG */ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7391 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7392 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7393 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7394 | |
| 7395 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; |
| 7396 | u16P2P_count = index + 12; |
| 7397 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7398 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7399 | u16P2P_count += 4; |
| 7400 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7401 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7402 | u16P2P_count += 4; |
| 7403 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7404 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7405 | |
| 7406 | index += pu8IEs[index + 1] + 2; |
| 7407 | continue; |
| 7408 | |
| 7409 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7410 | else if ((pu8IEs[index] == RSN_IE) || |
| 7411 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 7412 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 7413 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7414 | u16 rsnIndex = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7415 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
| 7416 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) |
| 7417 | * { |
| 7418 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); |
| 7419 | * }*/ |
| 7420 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 7421 | pNewJoinBssParam->mode_802_11i = 2; |
| 7422 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ |
| 7423 | } else { /* check if rsn was previously parsed */ |
| 7424 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 7425 | pNewJoinBssParam->mode_802_11i = 1; |
| 7426 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ |
| 7427 | rsnIndex += 4; |
| 7428 | } |
| 7429 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ |
| 7430 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 7431 | rsnIndex++; |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7432 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7433 | /* initialize policies with invalid values */ |
| 7434 | |
| 7435 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ |
| 7436 | |
| 7437 | /*parsing pairwise cipher*/ |
| 7438 | |
| 7439 | /* saving 3 pcipher max. */ |
| 7440 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7441 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7442 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7443 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7444 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
| 7445 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7446 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7447 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ |
| 7448 | } |
| 7449 | pcipherTotalCount += pcipherCount; |
| 7450 | rsnIndex += jumpOffset; |
| 7451 | |
| 7452 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 7453 | |
| 7454 | /*parsing AKM suite (auth_policy)*/ |
| 7455 | /* saving 3 auth policies max. */ |
| 7456 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7457 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7458 | |
| 7459 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { |
| 7460 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7461 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7462 | } |
| 7463 | authTotalCount += authCount; |
| 7464 | rsnIndex += jumpOffset; |
| 7465 | /*pasring rsn cap. only if rsn IE*/ |
| 7466 | if (pu8IEs[index] == RSN_IE) { |
| 7467 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 7468 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 7469 | rsnIndex += 2; |
| 7470 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 7471 | pNewJoinBssParam->rsn_found = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7472 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7473 | continue; |
| 7474 | } else |
| 7475 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7476 | |
| 7477 | } |
| 7478 | |
| 7479 | |
| 7480 | } |
| 7481 | |
| 7482 | return (void *)pNewJoinBssParam; |
| 7483 | |
| 7484 | } |
| 7485 | |
| 7486 | void host_int_freeJoinParams(void *pJoinParams) |
| 7487 | { |
| 7488 | if ((tstrJoinBssParam *)pJoinParams != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7489 | kfree((tstrJoinBssParam *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7490 | else |
| 7491 | PRINT_ER("Unable to FREE null pointer\n"); |
| 7492 | } |
| 7493 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 7494 | |
| 7495 | |
| 7496 | /** |
| 7497 | * @brief host_int_addBASession |
| 7498 | * @details Open a block Ack session with the given parameters |
| 7499 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7500 | * @return |
| 7501 | * @author anoureldin |
| 7502 | * @date |
| 7503 | * @version 1.0**/ |
| 7504 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 7505 | 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] | 7506 | short int SessionTimeout, void *drvHandler) |
| 7507 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7508 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7509 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7510 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7511 | tstrHostIfBASessionInfo *pBASessionInfo = &msg.body.strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7512 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7513 | if (pstrWFIDrv == NULL) { |
| 7514 | PRINT_ER("driver is null\n"); |
| 7515 | return -EFAULT; |
| 7516 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7517 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7518 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7519 | |
| 7520 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7521 | msg.id = HOST_IF_MSG_ADD_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7522 | |
| 7523 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7524 | pBASessionInfo->u8Ted = TID; |
| 7525 | pBASessionInfo->u16BufferSize = BufferSize; |
| 7526 | pBASessionInfo->u16SessionTimeout = SessionTimeout; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7527 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7528 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7529 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7530 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7531 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7532 | |
| 7533 | return s32Error; |
| 7534 | } |
| 7535 | |
| 7536 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7537 | s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7538 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7539 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7540 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7541 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7542 | tstrHostIfBASessionInfo *pBASessionInfo = &msg.body.strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7543 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7544 | if (pstrWFIDrv == NULL) { |
| 7545 | PRINT_ER("driver is null\n"); |
| 7546 | return -EFAULT; |
| 7547 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7548 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7549 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7550 | |
| 7551 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7552 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7553 | |
| 7554 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7555 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7556 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7557 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7558 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7559 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7560 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7561 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7562 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7563 | |
| 7564 | return s32Error; |
| 7565 | } |
| 7566 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7567 | 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] | 7568 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7569 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7570 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7571 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7572 | tstrHostIfBASessionInfo *pBASessionInfo = &msg.body.strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7573 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7574 | if (pstrWFIDrv == NULL) { |
| 7575 | PRINT_ER("driver is null\n"); |
| 7576 | return -EFAULT; |
| 7577 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7578 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7579 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7580 | |
| 7581 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7582 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7583 | |
| 7584 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7585 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7586 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7587 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7588 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7589 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7590 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7591 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7592 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7593 | |
| 7594 | return s32Error; |
| 7595 | } |
| 7596 | |
| 7597 | /** |
| 7598 | * @brief host_int_setup_ipaddress |
| 7599 | * @details setup IP in firmware |
| 7600 | * @param[in] Handle to wifi driver |
| 7601 | * @return Error code. |
| 7602 | * @author Abdelrahman Sobhy |
| 7603 | * @date |
| 7604 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7605 | s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7606 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7607 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7608 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7609 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7610 | |
| 7611 | /* TODO: Enable This feature on softap firmware */ |
| 7612 | return 0; |
| 7613 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7614 | if (pstrWFIDrv == NULL) { |
| 7615 | PRINT_ER("driver is null\n"); |
| 7616 | return -EFAULT; |
| 7617 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7618 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7619 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7620 | |
| 7621 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7622 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7623 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7624 | msg.body.strHostIfSetIP.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7625 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7626 | msg.body.strHostIfSetIP.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7627 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7628 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7629 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7630 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7631 | |
| 7632 | return s32Error; |
| 7633 | |
| 7634 | |
| 7635 | } |
| 7636 | |
| 7637 | /** |
| 7638 | * @brief host_int_get_ipaddress |
| 7639 | * @details Get IP from firmware |
| 7640 | * @param[in] Handle to wifi driver |
| 7641 | * @return Error code. |
| 7642 | * @author Abdelrahman Sobhy |
| 7643 | * @date |
| 7644 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7645 | s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7646 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7647 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7648 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7649 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7650 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7651 | if (pstrWFIDrv == NULL) { |
| 7652 | PRINT_ER("driver is null\n"); |
| 7653 | return -EFAULT; |
| 7654 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7655 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7656 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7657 | |
| 7658 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7659 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7660 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7661 | msg.body.strHostIfSetIP.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7662 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7663 | msg.body.strHostIfSetIP.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7664 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7665 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7666 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7667 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7668 | |
| 7669 | return s32Error; |
| 7670 | |
| 7671 | |
| 7672 | } |