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 | /*! |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 68 | * @struct cfg_param_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 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 | */ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 77 | struct cfg_param_attr { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 78 | tstrCfgParamVal pstrCfgParamVal; |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 79 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 80 | |
| 81 | /*! |
| 82 | * @struct tstrHostIFwpaAttr |
| 83 | * @brief Structure to hold Host IF Scan Attributes |
| 84 | * @details |
| 85 | * @todo |
| 86 | * @sa |
| 87 | * @author Mai Daftedar |
| 88 | * @date 25 March 2012 |
| 89 | * @version 1.0 |
| 90 | */ |
| 91 | typedef struct _tstrHostIFwpaAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 92 | u8 *pu8key; |
| 93 | const u8 *pu8macaddr; |
| 94 | u8 *pu8seq; |
| 95 | u8 u8seqlen; |
| 96 | u8 u8keyidx; |
| 97 | u8 u8Keylen; |
| 98 | u8 u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 99 | } tstrHostIFwpaAttr; |
| 100 | |
| 101 | |
| 102 | /*! |
| 103 | * @struct tstrHostIFwepAttr |
| 104 | * @brief Structure to hold Host IF Scan Attributes |
| 105 | * @details |
| 106 | * @todo |
| 107 | * @sa |
| 108 | * @author Mai Daftedar |
| 109 | * @date 25 March 2012 |
| 110 | * @version 1.0 |
| 111 | */ |
| 112 | typedef struct _tstrHostIFwepAttr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 113 | u8 *pu8WepKey; |
| 114 | u8 u8WepKeylen; |
| 115 | u8 u8Wepidx; |
| 116 | u8 u8mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 117 | AUTHTYPE_T tenuAuth_type; |
| 118 | |
| 119 | } tstrHostIFwepAttr; |
| 120 | |
| 121 | /*! |
| 122 | * @struct tuniHostIFkeyAttr |
| 123 | * @brief Structure to hold Host IF Scan Attributes |
| 124 | * @details |
| 125 | * @todo |
| 126 | * @sa |
| 127 | * @author Mai Daftedar |
| 128 | * @date 25 March 2012 |
| 129 | * @version 1.0 |
| 130 | */ |
| 131 | typedef union _tuniHostIFkeyAttr { |
| 132 | tstrHostIFwepAttr strHostIFwepAttr; |
| 133 | tstrHostIFwpaAttr strHostIFwpaAttr; |
| 134 | tstrHostIFpmkidAttr strHostIFpmkidAttr; |
| 135 | } tuniHostIFkeyAttr; |
| 136 | |
| 137 | /*! |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 138 | * @struct key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 139 | * @brief Structure to hold Host IF Scan Attributes |
| 140 | * @details |
| 141 | * @todo |
| 142 | * @sa |
| 143 | * @author Mai Daftedar |
| 144 | * @date 25 March 2012 |
| 145 | * @version 1.0 |
| 146 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 147 | struct key_attr { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 148 | tenuKeyType enuKeyType; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 149 | u8 u8KeyAction; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 150 | tuniHostIFkeyAttr uniHostIFkeyAttr; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 151 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | /*! |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 157 | * @struct scan_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 158 | * @brief Structure to hold Host IF Scan Attributes |
| 159 | * @details |
| 160 | * @todo |
| 161 | * @sa |
| 162 | * @author Mostafa Abu Bakr |
| 163 | * @date 25 March 2012 |
| 164 | * @version 1.0 |
| 165 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 166 | struct scan_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 167 | u8 u8ScanSource; |
| 168 | u8 u8ScanType; |
| 169 | u8 *pu8ChnlFreqList; |
| 170 | u8 u8ChnlListLen; |
| 171 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 172 | size_t IEsLen; |
| 173 | tWILCpfScanResult pfScanResult; |
| 174 | void *pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 175 | tstrHiddenNetwork strHiddenNetwork; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 176 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 177 | |
| 178 | /*! |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 179 | * @struct connect_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 180 | * @brief Structure to hold Host IF Connect Attributes |
| 181 | * @details |
| 182 | * @todo |
| 183 | * @sa |
| 184 | * @author Mostafa Abu Bakr |
| 185 | * @date 25 March 2012 |
| 186 | * @version 1.0 |
| 187 | */ |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 188 | struct connect_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 189 | u8 *pu8bssid; |
| 190 | u8 *pu8ssid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 191 | size_t ssidLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 192 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 193 | size_t IEsLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 194 | u8 u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 195 | tWILCpfConnectResult pfConnectResult; |
| 196 | void *pvUserArg; |
| 197 | AUTHTYPE_T tenuAuth_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 198 | u8 u8channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 199 | void *pJoinParams; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 200 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 201 | |
| 202 | /*! |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 203 | * @struct rcvd_async_info |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 204 | * @brief Structure to hold Received General Asynchronous info |
| 205 | * @details |
| 206 | * @todo |
| 207 | * @sa |
| 208 | * @author Mostafa Abu Bakr |
| 209 | * @date 25 March 2012 |
| 210 | * @version 1.0 |
| 211 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 212 | struct rcvd_async_info { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 213 | u8 *pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 214 | u32 u32Length; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 215 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 216 | |
| 217 | /*! |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 218 | * @struct set_channel |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 219 | * @brief Set Channel message body |
| 220 | * @details |
| 221 | * @todo |
| 222 | * @sa |
| 223 | * @author Mai Daftedar |
| 224 | * @date 25 March 2012 |
| 225 | * @version 1.0 |
| 226 | */ |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 227 | struct set_channel { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 228 | u8 u8SetChan; |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 229 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 230 | |
| 231 | /*! |
Tony Cho | 29f8400 | 2015-09-21 12:16:43 +0900 | [diff] [blame] | 232 | * @struct get_channel |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 233 | * @brief Get Channel message body |
| 234 | * @details |
| 235 | * @todo |
| 236 | * @sa |
| 237 | * @author Mai Daftedar |
| 238 | * @date 01 Jule 2012 |
| 239 | * @version 1.0 |
| 240 | */ |
Tony Cho | 29f8400 | 2015-09-21 12:16:43 +0900 | [diff] [blame] | 241 | struct get_channel { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 242 | u8 u8GetChan; |
Tony Cho | 29f8400 | 2015-09-21 12:16:43 +0900 | [diff] [blame] | 243 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 244 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 245 | /*! |
| 246 | * @struct tstrScanComplete |
| 247 | * @brief hold received Async. Scan Complete message body |
| 248 | * @details |
| 249 | * @todo |
| 250 | * @sa |
| 251 | * @author zsalah |
| 252 | * @date 25 March 2012 |
| 253 | * @version 1.0 |
| 254 | */ |
| 255 | /*typedef struct _tstrScanComplete |
| 256 | * { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 257 | * u8* pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 258 | * u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 259 | * } tstrScanComplete;*/ |
| 260 | |
| 261 | /*! |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 262 | * @struct set_beacon |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 263 | * @brief Set Beacon message body |
| 264 | * @details |
| 265 | * @todo |
| 266 | * @sa |
| 267 | * @author Adham Abozaeid |
| 268 | * @date 10 July 2012 |
| 269 | * @version 1.0 |
| 270 | */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 271 | struct set_beacon { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 272 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
| 273 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 274 | * (including the current frame) appear before the next DTIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 275 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 276 | 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] | 277 | * 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] | 278 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 279 | 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] | 280 | * after the TIM inormation element */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 281 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 282 | |
| 283 | |
| 284 | |
| 285 | /*! |
Tony Cho | d0227fc | 2015-09-21 12:16:45 +0900 | [diff] [blame] | 286 | * @struct del_beacon |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 287 | * @brief Del Beacon message body |
| 288 | * @details |
| 289 | * @todo |
| 290 | * @sa |
| 291 | * @author Adham Abozaeid |
| 292 | * @date 15 July 2012 |
| 293 | * @version 1.0 |
| 294 | */ |
Tony Cho | d0227fc | 2015-09-21 12:16:45 +0900 | [diff] [blame] | 295 | struct del_beacon { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 296 | u8 u8dummy; |
Tony Cho | d0227fc | 2015-09-21 12:16:45 +0900 | [diff] [blame] | 297 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 298 | |
| 299 | /*! |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 300 | * @struct set_multicast |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 301 | * @brief set Multicast filter Address |
| 302 | * @details |
| 303 | * @todo |
| 304 | * @sa |
| 305 | * @author Abdelrahman Sobhy |
| 306 | * @date 30 August 2013 |
| 307 | * @version 1.0 Description |
| 308 | */ |
| 309 | |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 310 | struct set_multicast { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 311 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 312 | u32 u32count; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 313 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 314 | |
| 315 | /*! |
| 316 | * @struct tstrHostIFDelAllSta |
| 317 | * @brief Deauth station message body |
| 318 | * @details |
| 319 | * @todo |
| 320 | * @sa |
| 321 | * @author Mai Daftedar |
| 322 | * @date 09 April 2014 |
| 323 | * @version 1.0 Description |
| 324 | */ |
| 325 | |
| 326 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 327 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
| 328 | u8 u8Num_AssocSta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 329 | } tstrHostIFDelAllSta; |
| 330 | |
| 331 | /*! |
| 332 | * @struct tstrHostIFDelSta |
| 333 | * @brief Delete station message body |
| 334 | * @details |
| 335 | * @todo |
| 336 | * @sa |
| 337 | * @author Adham Abozaeid |
| 338 | * @date 15 July 2012 |
| 339 | * @version 1.0 Description |
| 340 | */ |
| 341 | |
| 342 | typedef struct { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 343 | u8 au8MacAddr[ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 344 | } tstrHostIFDelSta; |
| 345 | |
| 346 | /*! |
Tony Cho | 5258193 | 2015-09-21 12:16:47 +0900 | [diff] [blame] | 347 | * @struct timer_cb |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 348 | * @brief Timer callback message body |
| 349 | * @details |
| 350 | * @todo |
| 351 | * @sa |
| 352 | * @author Mostafa Abu Bakr |
| 353 | * @date 25 March 2012 |
| 354 | * @version 1.0 |
| 355 | */ |
Tony Cho | 5258193 | 2015-09-21 12:16:47 +0900 | [diff] [blame] | 356 | struct timer_cb { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 357 | void *pvUsrArg; /*!< Private data passed at timer start */ |
Tony Cho | 5258193 | 2015-09-21 12:16:47 +0900 | [diff] [blame] | 358 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 359 | |
| 360 | /*! |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 361 | * @struct power_mgmt_param |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 362 | * @brief Power management message body |
| 363 | * @details |
| 364 | * @todo |
| 365 | * @sa |
| 366 | * @author Adham Abozaeid |
| 367 | * @date 24 November 2012 |
| 368 | * @version 1.0 |
| 369 | */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 370 | struct power_mgmt_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 371 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 372 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 373 | u32 u32Timeout; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 374 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 375 | |
| 376 | /*! |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 377 | * @struct set_ip_addr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 378 | * @brief set IP Address message body |
| 379 | * @details |
| 380 | * @todo |
| 381 | * @sa |
| 382 | * @author Abdelrahman Sobhy |
| 383 | * @date 30 August 2013 |
| 384 | * @version 1.0 Description |
| 385 | */ |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 386 | struct set_ip_addr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 387 | u8 *au8IPAddr; |
| 388 | u8 idx; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 389 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 390 | |
| 391 | /*! |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 392 | * @struct sta_inactive_t |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 393 | * @brief Get station message body |
| 394 | * @details |
| 395 | * @todo |
| 396 | * @sa |
| 397 | * @author Mai Daftedar |
| 398 | * @date 16 April 2013 |
| 399 | * @version 1.0 |
| 400 | */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 401 | struct sta_inactive_t { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 402 | u8 mac[6]; |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 403 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 404 | /**/ |
| 405 | /*! |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 406 | * @union message_body |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 407 | * @brief Message body for the Host Interface message_q |
| 408 | * @details |
| 409 | * @todo |
| 410 | * @sa |
| 411 | * @author Mostafa Abu Bakr |
| 412 | * @date 25 March 2012 |
| 413 | * @version 1.0 |
| 414 | */ |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 415 | union message_body { |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 416 | struct scan_attr strHostIFscanAttr; /*!< Host IF Scan Request Attributes message body */ |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 417 | struct connect_attr strHostIFconnectAttr; /*!< Host IF Connect Request Attributes message body */ |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 418 | struct rcvd_net_info strRcvdNetworkInfo; /*!< Received Asynchronous Network Info message body */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 419 | struct rcvd_async_info strRcvdGnrlAsyncInfo; /*!< Received General Asynchronous Info message body */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 420 | struct key_attr strHostIFkeyAttr; /*!<>*/ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 421 | struct cfg_param_attr strHostIFCfgParamAttr; /*! <CFG Parameter message Body> */ |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 422 | struct set_channel strHostIFSetChan; |
Tony Cho | 29f8400 | 2015-09-21 12:16:43 +0900 | [diff] [blame] | 423 | struct get_channel strHostIFGetChan; |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 424 | struct set_beacon strHostIFSetBeacon; /*!< Set beacon message body */ |
Tony Cho | d0227fc | 2015-09-21 12:16:45 +0900 | [diff] [blame] | 425 | struct del_beacon strHostIFDelBeacon; /*!< Del beacon message body */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 426 | struct add_sta_param strAddStaParam; /*!< Add station message body */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 427 | tstrHostIFDelSta strDelStaParam; /*!< Del Station message body */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 428 | struct add_sta_param strEditStaParam; /*!< Edit station message body */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 429 | /* tstrScanComplete strScanComplete; / *Received Async. Scan Complete message body* / */ |
Tony Cho | 5258193 | 2015-09-21 12:16:47 +0900 | [diff] [blame] | 430 | struct timer_cb strTimerCb; /*!< Timer callback message body */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 431 | struct power_mgmt_param strPowerMgmtparam; /*!< Power Management message body */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 432 | struct sta_inactive_t strHostIfStaInactiveT; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 433 | struct set_ip_addr strHostIfSetIP; |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 434 | struct drv_handler strHostIfSetDrvHandler; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 435 | struct set_multicast strHostIfSetMulti; |
Tony Cho | 801bee5 | 2015-09-21 12:16:53 +0900 | [diff] [blame] | 436 | struct op_mode strHostIfSetOperationMode; |
Tony Cho | b7611a8 | 2015-09-21 12:16:54 +0900 | [diff] [blame^] | 437 | struct set_mac_addr strHostIfSetMacAddress; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 438 | tstrHostIfGetMacAddress strHostIfGetMacAddress; |
| 439 | tstrHostIfBASessionInfo strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 440 | tstrHostIfRemainOnChan strHostIfRemainOnChan; |
| 441 | tstrHostIfRegisterFrame strHostIfRegisterFrame; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 442 | char *pUserData; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 443 | tstrHostIFDelAllSta strHostIFDelAllSta; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 444 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 445 | |
| 446 | /*! |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 447 | * @struct struct host_if_msg |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 448 | * @brief Host Interface message |
| 449 | * @details |
| 450 | * @todo |
| 451 | * @sa |
| 452 | * @author Mostafa Abu Bakr |
| 453 | * @date 25 March 2012 |
| 454 | * @version 1.0 |
| 455 | */ |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 456 | struct host_if_msg { |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 457 | u16 id; /*!< Message ID */ |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 458 | union message_body body; /*!< Message body */ |
Johnny Kim | 11f58c8 | 2015-08-13 13:41:20 +0900 | [diff] [blame] | 459 | tstrWILC_WFIDrv *drvHandler; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 460 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 461 | |
| 462 | #ifdef CONNECT_DIRECT |
| 463 | typedef struct _tstrWidJoinReqExt { |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 464 | char SSID[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 465 | u8 u8channel; |
| 466 | u8 BSSID[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 467 | } tstrWidJoinReqExt; |
| 468 | #endif |
| 469 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 470 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 471 | /*Struct containg joinParam of each AP*/ |
| 472 | typedef struct _tstrJoinBssParam { |
| 473 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 474 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 475 | u16 beacon_period; |
| 476 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 477 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 478 | char ssid[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 479 | u8 ssidLen; |
| 480 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 481 | u8 ht_capable; |
| 482 | u8 wmm_cap; |
| 483 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 484 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 485 | u8 rsn_grp_policy; |
| 486 | u8 mode_802_11i; |
| 487 | u8 rsn_pcip_policy[3]; |
| 488 | u8 rsn_auth_policy[3]; |
| 489 | u8 rsn_cap[2]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 490 | struct _tstrJoinParam *nextJoinBss; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 491 | u32 tsf; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 492 | u8 u8NoaEnbaled; |
| 493 | u8 u8OppEnable; |
| 494 | u8 u8CtWindow; |
| 495 | u8 u8Count; |
| 496 | u8 u8Index; |
| 497 | u8 au8Duration[4]; |
| 498 | u8 au8Interval[4]; |
| 499 | u8 au8StartTime[4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 500 | } tstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 501 | /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/ |
| 502 | typedef struct _tstrBssTable { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 503 | u8 u8noBssEntries; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 504 | tstrJoinBssParam *head; |
| 505 | tstrJoinBssParam *tail; |
| 506 | } tstrBssTable; |
| 507 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 508 | |
| 509 | typedef enum { |
| 510 | SCAN_TIMER = 0, |
| 511 | CONNECT_TIMER = 1, |
| 512 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF |
| 513 | } tenuScanConnTimer; |
| 514 | |
| 515 | /*****************************************************************************/ |
| 516 | /* */ |
| 517 | /* Global Variabls */ |
| 518 | /* */ |
| 519 | /*****************************************************************************/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 520 | /* Zero is not used, because a zero ID means termination */ |
| 521 | static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
Daniel Machon | 6fdb302 | 2015-07-06 19:48:04 +0200 | [diff] [blame] | 522 | tstrWILC_WFIDrv *terminated_handle; |
| 523 | tstrWILC_WFIDrv *gWFiDrvHandle; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 524 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 525 | bool g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 526 | #endif |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 527 | u8 P2P_LISTEN_STATE; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 528 | static struct task_struct *HostIFthreadHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 529 | static WILC_MsgQueueHandle gMsgQHostIF; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 530 | static struct semaphore hSemHostIFthrdEnd; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 531 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 532 | struct semaphore hSemDeinitDrvHandle; |
| 533 | static struct semaphore hWaitResponse; |
| 534 | struct semaphore hSemHostIntDeinit; |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 535 | struct timer_list g_hPeriodicRSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 536 | |
| 537 | |
| 538 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 539 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 540 | |
| 541 | #ifndef CONNECT_DIRECT |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 542 | static u8 gapu8RcvdSurveyResults[2][MAX_SURVEY_RESULT_FRAG_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 543 | #endif |
| 544 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 545 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 546 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 547 | bool gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 548 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 549 | static s8 gs8Rssi; |
| 550 | static s8 gs8lnkspd; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 551 | static u8 gu8Chnl; |
| 552 | static u8 gs8SetIP[2][4]; |
| 553 | static u8 gs8GetIP[2][4]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 554 | static u32 gu32InactiveTime; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 555 | static u8 gu8DelBcn; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 556 | static u32 gu32WidConnRstHack; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 557 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 558 | u8 *gu8FlushedJoinReq; |
| 559 | u8 *gu8FlushedInfoElemAsoc; |
| 560 | u8 gu8Flushed11iMode; |
| 561 | u8 gu8FlushedAuthType; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 562 | u32 gu32FlushedJoinReqSize; |
| 563 | u32 gu32FlushedInfoElemAsocSize; |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 564 | tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 565 | #define REAL_JOIN_REQ 0 |
| 566 | #define FLUSHED_JOIN_REQ 1 |
| 567 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ |
| 568 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 569 | #ifdef WILC_PARSE_SCAN_IN_HOST |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 570 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
| 571 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 572 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 573 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 574 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 575 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 576 | static int add_handler_in_list(tstrWILC_WFIDrv *handler) |
| 577 | { |
| 578 | int i; |
| 579 | |
| 580 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 581 | if (!wfidrv_list[i]) { |
| 582 | wfidrv_list[i] = handler; |
| 583 | return 0; |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | return -ENOBUFS; |
| 588 | } |
| 589 | |
| 590 | static int remove_handler_in_list(tstrWILC_WFIDrv *handler) |
| 591 | { |
| 592 | int i; |
| 593 | |
| 594 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 595 | if (wfidrv_list[i] == handler) { |
| 596 | wfidrv_list[i] = NULL; |
| 597 | return 0; |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | return -EINVAL; |
| 602 | } |
| 603 | |
| 604 | static int get_id_from_handler(tstrWILC_WFIDrv *handler) |
| 605 | { |
| 606 | int i; |
| 607 | |
| 608 | if (!handler) |
| 609 | return 0; |
| 610 | |
| 611 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 612 | if (wfidrv_list[i] == handler) |
| 613 | return i; |
| 614 | } |
| 615 | |
| 616 | return 0; |
| 617 | } |
| 618 | |
| 619 | static tstrWILC_WFIDrv *get_handler_from_id(int id) |
| 620 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 621 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 622 | return NULL; |
| 623 | return wfidrv_list[id]; |
| 624 | } |
| 625 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 626 | /** |
| 627 | * @brief Handle_SetChannel |
| 628 | * @details Sending config packet to firmware to set channel |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 629 | * @param[in] struct set_channel *pstrHostIFSetChan |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 630 | * @return Error code. |
| 631 | * @author |
| 632 | * @date |
| 633 | * @version 1.0 |
| 634 | */ |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 635 | static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, |
| 636 | struct set_channel *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 637 | { |
| 638 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 639 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 640 | tstrWID strWID; |
| 641 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 642 | |
| 643 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 644 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 645 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 646 | strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan); |
| 647 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 648 | |
| 649 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
| 650 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 651 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 652 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 653 | if (s32Error) { |
| 654 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 655 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 656 | } |
| 657 | |
| 658 | return s32Error; |
| 659 | } |
| 660 | /** |
| 661 | * @brief Handle_SetWfiDrvHandler |
| 662 | * @details Sending config packet to firmware to set driver handler |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 663 | * @param[in] void * drvHandler, |
| 664 | * struct drv_handler *pstrHostIfSetDrvHandler |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 665 | * @return Error code. |
| 666 | * @author |
| 667 | * @date |
| 668 | * @version 1.0 |
| 669 | */ |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 670 | static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 671 | struct drv_handler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 672 | { |
| 673 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 674 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 675 | tstrWID strWID; |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 676 | tstrWILC_WFIDrv *pstrWFIDrv = drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 677 | |
| 678 | |
| 679 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 680 | strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 681 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 682 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 683 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 684 | |
| 685 | /*Sending Cfg*/ |
| 686 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 687 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 688 | pstrHostIfSetDrvHandler->u32Address); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 689 | |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 690 | if (pstrWFIDrv == NULL) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 691 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 692 | |
| 693 | |
| 694 | if (s32Error) { |
| 695 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 696 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | return s32Error; |
| 700 | } |
| 701 | |
| 702 | /** |
| 703 | * @brief Handle_SetWfiAPDrvHandler |
| 704 | * @details Sending config packet to firmware to set driver handler |
| 705 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 706 | * @return Error code. |
| 707 | * @author |
| 708 | * @date |
| 709 | * @version 1.0 |
| 710 | */ |
Tony Cho | 801bee5 | 2015-09-21 12:16:53 +0900 | [diff] [blame] | 711 | static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, |
| 712 | struct op_mode *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 | */ |
Tony Cho | b7611a8 | 2015-09-21 12:16:54 +0900 | [diff] [blame^] | 849 | static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, |
| 850 | struct set_mac_addr *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 851 | { |
| 852 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 853 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 854 | tstrWID strWID; |
| 855 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 856 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 857 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 858 | if (mac_buf == NULL) { |
| 859 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 860 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 861 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 862 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 863 | |
| 864 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 865 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 866 | strWID.enuWIDtype = WID_STR; |
| 867 | strWID.ps8WidVal = mac_buf; |
| 868 | strWID.s32ValueSize = ETH_ALEN; |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 869 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 870 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 871 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 872 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 873 | if (s32Error) { |
| 874 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 875 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 876 | } |
| 877 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 878 | kfree(mac_buf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 879 | return s32Error; |
| 880 | } |
| 881 | |
| 882 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 883 | /** |
| 884 | * @brief Handle_GetMacAddress |
| 885 | * @details Getting mac address |
| 886 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 887 | * @return Error code. |
| 888 | * @author Amr Abdel-Moghny |
| 889 | * @date JAN 2013 |
| 890 | * @version 8.0 |
| 891 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 892 | static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, tstrHostIfGetMacAddress *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 893 | { |
| 894 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 895 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 896 | tstrWID strWID; |
| 897 | |
| 898 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 899 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 900 | strWID.enuWIDtype = WID_STR; |
| 901 | strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress; |
| 902 | strWID.s32ValueSize = ETH_ALEN; |
| 903 | |
| 904 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 905 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, false, |
| 906 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 907 | if (s32Error) { |
| 908 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 909 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 910 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 911 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 912 | |
| 913 | return s32Error; |
| 914 | } |
| 915 | |
| 916 | |
| 917 | /** |
| 918 | * @brief Handle_CfgParam |
| 919 | * @details Sending config packet to firmware to set CFG params |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 920 | * @param[in] struct cfg_param_attr *strHostIFCfgParamAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 921 | * @return Error code. |
| 922 | * @author |
| 923 | * @date |
| 924 | * @version 1.0 |
| 925 | */ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 926 | static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, |
| 927 | struct cfg_param_attr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 928 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 929 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 930 | tstrWID strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 931 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 932 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 933 | |
| 934 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 935 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 936 | |
| 937 | |
| 938 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 939 | |
| 940 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) { |
| 941 | /*----------------------------------------------------------*/ |
| 942 | /*Input Value: INFRASTRUCTURE = 1, */ |
| 943 | /* INDEPENDENT= 2, */ |
| 944 | /* ANY_BSS= 3 */ |
| 945 | /*----------------------------------------------------------*/ |
| 946 | /* validate input then copy>> need to check value 4 and 5 */ |
| 947 | if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) { |
| 948 | strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 949 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 950 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 951 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 952 | pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 953 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 954 | PRINT_ER("check value 6 over\n"); |
| 955 | s32Error = -EINVAL; |
| 956 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 957 | } |
| 958 | u8WidCnt++; |
| 959 | } |
| 960 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) { |
| 961 | /*------------------------------------------------------*/ |
| 962 | /*Input Values: OPEN_SYSTEM = 0, */ |
| 963 | /* SHARED_KEY = 1, */ |
| 964 | /* ANY = 2 */ |
| 965 | /*------------------------------------------------------*/ |
| 966 | /*validate Possible values*/ |
| 967 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) { |
| 968 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 969 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 970 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 971 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 972 | pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 973 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 974 | PRINT_ER("Impossible value \n"); |
| 975 | s32Error = -EINVAL; |
| 976 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 977 | } |
| 978 | u8WidCnt++; |
| 979 | } |
| 980 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) { |
| 981 | /* range is 1 to 65535. */ |
| 982 | if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) { |
| 983 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 984 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 985 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 986 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 987 | pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
| 988 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 989 | PRINT_ER("Range(1 ~ 65535) over\n"); |
| 990 | s32Error = -EINVAL; |
| 991 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 992 | } |
| 993 | u8WidCnt++; |
| 994 | } |
| 995 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) { |
| 996 | /*-----------------------------------------------------------*/ |
| 997 | /*Input Values: NO_POWERSAVE = 0, */ |
| 998 | /* MIN_FAST_PS = 1, */ |
| 999 | /* MAX_FAST_PS = 2, */ |
| 1000 | /* MIN_PSPOLL_PS = 3, */ |
| 1001 | /* MAX_PSPOLL_PS = 4 */ |
| 1002 | /*----------------------------------------------------------*/ |
| 1003 | if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) { |
| 1004 | strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1005 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1006 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1007 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1008 | pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1009 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1010 | PRINT_ER("Invalide power mode\n"); |
| 1011 | s32Error = -EINVAL; |
| 1012 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1013 | } |
| 1014 | u8WidCnt++; |
| 1015 | } |
| 1016 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) { |
| 1017 | /* range from 1 to 256 */ |
| 1018 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) { |
| 1019 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1020 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1021 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1022 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1023 | pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
| 1024 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1025 | PRINT_ER("Range(1~256) over\n"); |
| 1026 | s32Error = -EINVAL; |
| 1027 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1028 | } |
| 1029 | u8WidCnt++; |
| 1030 | } |
| 1031 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) { |
| 1032 | /* range from 1 to 256 */ |
| 1033 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) { |
| 1034 | strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1035 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1036 | |
| 1037 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1038 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1039 | pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
| 1040 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1041 | PRINT_ER("Range(1~256) over\n"); |
| 1042 | s32Error = -EINVAL; |
| 1043 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1044 | } |
| 1045 | u8WidCnt++; |
| 1046 | } |
| 1047 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) { |
| 1048 | |
| 1049 | if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) { |
| 1050 | strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1051 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1052 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1053 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1054 | pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
| 1055 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1056 | PRINT_ER("Threshold Range fail\n"); |
| 1057 | s32Error = -EINVAL; |
| 1058 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1059 | } |
| 1060 | u8WidCnt++; |
| 1061 | } |
| 1062 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) { |
| 1063 | /* range 256 to 65535 */ |
| 1064 | if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) { |
| 1065 | strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1066 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1067 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1068 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1069 | pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
| 1070 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1071 | PRINT_ER("Threshold Range fail\n"); |
| 1072 | s32Error = -EINVAL; |
| 1073 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1074 | } |
| 1075 | u8WidCnt++; |
| 1076 | } |
| 1077 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) { |
| 1078 | /*-----------------------------------------------------*/ |
| 1079 | /*Input Values: Short= 0, */ |
| 1080 | /* Long= 1, */ |
| 1081 | /* Auto= 2 */ |
| 1082 | /*------------------------------------------------------*/ |
| 1083 | if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) { |
| 1084 | strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1085 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1086 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1087 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1088 | pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
| 1089 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1090 | PRINT_ER("Preamle Range(0~2) over\n"); |
| 1091 | s32Error = -EINVAL; |
| 1092 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1093 | } |
| 1094 | u8WidCnt++; |
| 1095 | } |
| 1096 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SHORT_SLOT_ALLOWED) { |
| 1097 | if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) { |
| 1098 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1099 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1100 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1101 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1102 | pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1103 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1104 | PRINT_ER("Short slot(2) over\n"); |
| 1105 | s32Error = -EINVAL; |
| 1106 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1107 | } |
| 1108 | u8WidCnt++; |
| 1109 | } |
| 1110 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) { |
| 1111 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ |
| 1112 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ |
| 1113 | /* this information is useful for external supplicant */ |
| 1114 | /*Input Values: 1 for enable and 0 for disable. */ |
| 1115 | if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) { |
| 1116 | strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1117 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1118 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1119 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1120 | pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1121 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1122 | PRINT_ER("TXOP prot disable\n"); |
| 1123 | s32Error = -EINVAL; |
| 1124 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1125 | } |
| 1126 | u8WidCnt++; |
| 1127 | } |
| 1128 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) { |
| 1129 | /* range is 1 to 65535. */ |
| 1130 | if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) { |
| 1131 | strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1132 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1133 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1134 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1135 | pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
| 1136 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1137 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
| 1138 | s32Error = -EINVAL; |
| 1139 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1140 | } |
| 1141 | u8WidCnt++; |
| 1142 | } |
| 1143 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) { |
| 1144 | /* range is 1 to 255. */ |
| 1145 | if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) { |
| 1146 | strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1147 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1148 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1149 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1150 | pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
| 1151 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1152 | PRINT_ER("DTIM range(1~255) fail\n"); |
| 1153 | s32Error = -EINVAL; |
| 1154 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1155 | } |
| 1156 | u8WidCnt++; |
| 1157 | } |
| 1158 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) { |
| 1159 | /*----------------------------------------------------------------------*/ |
| 1160 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ |
| 1161 | /* SITE_SURVEY_ALL_CH = 1, */ |
| 1162 | /* SITE_SURVEY_OFF = 2 */ |
| 1163 | /*----------------------------------------------------------------------*/ |
| 1164 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) { |
| 1165 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1166 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1167 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1168 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1169 | pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1170 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1171 | PRINT_ER("Site survey disable\n"); |
| 1172 | s32Error = -EINVAL; |
| 1173 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1174 | } |
| 1175 | u8WidCnt++; |
| 1176 | } |
| 1177 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) { |
| 1178 | /* range is 1 to 65535. */ |
| 1179 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) { |
| 1180 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1181 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1182 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1183 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1184 | pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
| 1185 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1186 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
| 1187 | s32Error = -EINVAL; |
| 1188 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1189 | } |
| 1190 | u8WidCnt++; |
| 1191 | } |
| 1192 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) { |
| 1193 | /* range is 1 to 65535. */ |
| 1194 | if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) { |
| 1195 | strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1196 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1197 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1198 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1199 | pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
| 1200 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1201 | PRINT_ER("Active scan time(1~65535) over\n"); |
| 1202 | s32Error = -EINVAL; |
| 1203 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1204 | } |
| 1205 | u8WidCnt++; |
| 1206 | } |
| 1207 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) { |
| 1208 | /* range is 1 to 65535. */ |
| 1209 | if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) { |
| 1210 | strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1211 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1212 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1213 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1214 | pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
| 1215 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1216 | PRINT_ER("Passive scan time(1~65535) over\n"); |
| 1217 | s32Error = -EINVAL; |
| 1218 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1219 | } |
| 1220 | u8WidCnt++; |
| 1221 | } |
| 1222 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) { |
| 1223 | CURRENT_TX_RATE_T curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate; |
| 1224 | /*----------------------------------------------------------------------*/ |
| 1225 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ |
| 1226 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ |
| 1227 | /*----------------------------------------------------------------------*/ |
| 1228 | /* validate rate */ |
| 1229 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 1230 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 1231 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 1232 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 1233 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 1234 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
| 1235 | strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1236 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1237 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1238 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1239 | pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1240 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1241 | PRINT_ER("out of TX rate\n"); |
| 1242 | s32Error = -EINVAL; |
| 1243 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1244 | } |
| 1245 | u8WidCnt++; |
| 1246 | } |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1247 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u8WidCnt, false, |
| 1248 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1249 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1250 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1251 | PRINT_ER("Error in setting CFG params\n"); |
| 1252 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1253 | ERRORHANDLER: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1254 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1255 | return s32Error; |
| 1256 | } |
| 1257 | |
| 1258 | |
| 1259 | /** |
| 1260 | * @brief Handle_wait_msg_q_empty |
| 1261 | * @details this should be the last msg and then the msg Q becomes idle |
| 1262 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1263 | * @return Error code. |
| 1264 | * @author |
| 1265 | * @date |
| 1266 | * @version 1.0 |
| 1267 | */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1268 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1269 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1270 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1271 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1272 | g_wilc_initialized = 0; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1273 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1274 | return s32Error; |
| 1275 | } |
| 1276 | |
| 1277 | /** |
| 1278 | * @brief Handle_Scan |
| 1279 | * @details Sending config packet to firmware to set the scan params |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1280 | * @param[in] struct scan_attr *pstrHostIFscanAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1281 | * @return Error code. |
| 1282 | * @author |
| 1283 | * @date |
| 1284 | * @version 1.0 |
| 1285 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1286 | static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, |
| 1287 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1288 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1289 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1290 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1291 | u32 u32WidsCount = 0; |
| 1292 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1293 | u8 *pu8Buffer; |
| 1294 | u8 valuesize = 0; |
| 1295 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1296 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1297 | |
| 1298 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1299 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1300 | |
| 1301 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; |
| 1302 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; |
| 1303 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1304 | if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) { |
| 1305 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ |
| 1306 | 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] | 1307 | PRINT_ER("Already scan\n"); |
| 1308 | s32Error = -EBUSY; |
| 1309 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1310 | } |
| 1311 | |
| 1312 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 1313 | if (g_obtainingIP || connecting) { |
| 1314 | 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] | 1315 | PRINT_ER("Don't do obss scan\n"); |
| 1316 | s32Error = -EBUSY; |
| 1317 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1318 | } |
| 1319 | #endif |
| 1320 | |
| 1321 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 1322 | |
| 1323 | |
| 1324 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
| 1325 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1326 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1327 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1328 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1329 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1330 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1331 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1332 | strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1333 | if (strWIDList[u32WidsCount].ps8WidVal != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1334 | pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; |
| 1335 | |
| 1336 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; |
| 1337 | |
| 1338 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); |
| 1339 | |
| 1340 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { |
| 1341 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1342 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1343 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 1344 | } |
| 1345 | |
| 1346 | |
| 1347 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1348 | strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1349 | u32WidsCount++; |
| 1350 | } |
| 1351 | |
| 1352 | /*filling cfg param array*/ |
| 1353 | |
| 1354 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ |
| 1355 | { |
| 1356 | /* IEs to be inserted in Probe Request */ |
| 1357 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE; |
| 1358 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1359 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs; |
| 1360 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen; |
| 1361 | u32WidsCount++; |
| 1362 | } |
| 1363 | |
| 1364 | /*Scan Type*/ |
| 1365 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE; |
| 1366 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1367 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1368 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1369 | u32WidsCount++; |
| 1370 | |
| 1371 | /*list of channels to be scanned*/ |
| 1372 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST; |
| 1373 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1374 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1375 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { |
| 1376 | int i; |
| 1377 | |
| 1378 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1379 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1380 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1381 | } |
| 1382 | } |
| 1383 | |
| 1384 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList; |
| 1385 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen; |
| 1386 | u32WidsCount++; |
| 1387 | |
| 1388 | /*Scan Request*/ |
| 1389 | strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ; |
| 1390 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1391 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1392 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1393 | u32WidsCount++; |
| 1394 | |
| 1395 | /*keep the state as is , no need to change it*/ |
| 1396 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ |
| 1397 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1398 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1399 | gbScanWhileConnected = true; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1400 | else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1401 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1402 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1403 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1404 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1405 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1406 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1407 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1408 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1409 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1410 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1411 | ERRORHANDLER: |
| 1412 | if (s32Error) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1413 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1414 | /*if there is an ongoing scan request*/ |
| 1415 | Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); |
| 1416 | } |
| 1417 | |
| 1418 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1419 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1420 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1421 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1422 | } |
| 1423 | |
| 1424 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ |
| 1425 | if (pstrHostIFscanAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1426 | kfree(pstrHostIFscanAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1427 | pstrHostIFscanAttr->pu8IEs = NULL; |
| 1428 | } |
| 1429 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1430 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1431 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
| 1432 | } |
| 1433 | |
| 1434 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1435 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1436 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1437 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1438 | } |
| 1439 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1440 | if (pu8HdnNtwrksWidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1441 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1442 | |
| 1443 | return s32Error; |
| 1444 | } |
| 1445 | |
| 1446 | /** |
| 1447 | * @brief Handle_ScanDone |
| 1448 | * @details Call scan notification callback function |
| 1449 | * @param[in] NONE |
| 1450 | * @return Error code. |
| 1451 | * @author |
| 1452 | * @date |
| 1453 | * @version 1.0 |
| 1454 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1455 | static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1456 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1457 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1458 | |
| 1459 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1460 | |
| 1461 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1462 | u8 u8abort_running_scan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1463 | tstrWID strWID; |
| 1464 | |
| 1465 | |
| 1466 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 1467 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1468 | /*Ask FW to abort the running scan, if any*/ |
| 1469 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 1470 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 1471 | u8abort_running_scan = 1; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1472 | strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1473 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1474 | strWID.ps8WidVal = (s8 *)&u8abort_running_scan; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1475 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1476 | |
| 1477 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1478 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 1479 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1480 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1481 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1482 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1483 | } |
| 1484 | } |
| 1485 | |
| 1486 | if (pstrWFIDrv == NULL) { |
| 1487 | PRINT_ER("Driver handler is NULL\n"); |
| 1488 | return s32Error; |
| 1489 | } |
| 1490 | |
| 1491 | /*if there is an ongoing scan request*/ |
| 1492 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1493 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1494 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 1495 | /*delete current scan request*/ |
| 1496 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
| 1497 | } |
| 1498 | |
| 1499 | return s32Error; |
| 1500 | } |
| 1501 | |
| 1502 | /** |
| 1503 | * @brief Handle_Connect |
| 1504 | * @details Sending config packet to firmware to starting connection |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1505 | * @param[in] struct connect_attr *pstrHostIFconnectAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1506 | * @return Error code. |
| 1507 | * @author |
| 1508 | * @date |
| 1509 | * @version 1.0 |
| 1510 | */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1511 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1512 | static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, |
| 1513 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1514 | { |
| 1515 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1516 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1517 | tstrWID strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1518 | u32 u32WidsCount = 0, dummyval = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1519 | /* char passphrase[] = "12345678"; */ |
| 1520 | #ifndef CONNECT_DIRECT |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1521 | s32 s32Err = 0; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1522 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1523 | u8 u8bssDscListIndex; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1524 | wid_site_survey_reslts_s *pstrSurveyResults = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1525 | #else |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1526 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1527 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1528 | tstrJoinBssParam *ptstrJoinBssParam; |
| 1529 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1530 | |
| 1531 | #endif |
| 1532 | |
| 1533 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1534 | |
| 1535 | #ifndef CONNECT_DIRECT |
Hari Prasath Gujulan Elango | 3a79a7f | 2015-08-20 09:59:44 +0000 | [diff] [blame] | 1536 | memset(gapu8RcvdSurveyResults, 0, sizeof(gapu8RcvdSurveyResults)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1537 | |
| 1538 | |
| 1539 | PRINT_D(HOSTINF_DBG, "Getting site survey results\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 1540 | s32Err = host_int_get_site_survey_results(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1541 | gapu8RcvdSurveyResults, |
| 1542 | MAX_SURVEY_RESULT_FRAG_SIZE); |
| 1543 | if (s32Err) { |
| 1544 | PRINT_ER("Failed to get site survey results\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1545 | s32Error = -EFAULT; |
| 1546 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1547 | } |
| 1548 | s32Err = ParseSurveyResults(gapu8RcvdSurveyResults, &pstrSurveyResults, |
| 1549 | &pstrWFIDrv->u32SurveyResultsCount); |
| 1550 | |
| 1551 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1552 | if (s32Err == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1553 | /* use the parsed info in pstrSurveyResults, then deallocate it */ |
| 1554 | PRINT_D(HOSTINF_DBG, "Copying site survey results in global structure, then deallocate\n"); |
| 1555 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1556 | memcpy(&pstrWFIDrv->astrSurveyResults[i], &pstrSurveyResults[i], |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1557 | sizeof(wid_site_survey_reslts_s)); |
| 1558 | } |
| 1559 | |
| 1560 | DeallocateSurveyResults(pstrSurveyResults); |
| 1561 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1562 | PRINT_ER("ParseSurveyResults() Error\n"); |
| 1563 | s32Error = -EFAULT; |
| 1564 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1565 | } |
| 1566 | |
| 1567 | |
| 1568 | for (i = 0; i < pstrWFIDrv->u32SurveyResultsCount; i++) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1569 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].SSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1570 | pstrHostIFconnectAttr->pu8ssid, |
| 1571 | pstrHostIFconnectAttr->ssidLen) == 0) { |
| 1572 | PRINT_INFO(HOSTINF_DBG, "Network with required SSID is found %s\n", pstrHostIFconnectAttr->pu8ssid); |
| 1573 | if (pstrHostIFconnectAttr->pu8bssid == NULL) { |
| 1574 | /* BSSID is not passed from the user, so decision of matching |
| 1575 | * is done by SSID only */ |
| 1576 | PRINT_INFO(HOSTINF_DBG, "BSSID is not passed from the user\n"); |
| 1577 | break; |
| 1578 | } else { |
| 1579 | /* BSSID is also passed from the user, so decision of matching |
| 1580 | * should consider also this passed BSSID */ |
| 1581 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1582 | if (memcmp(pstrWFIDrv->astrSurveyResults[i].BSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1583 | pstrHostIFconnectAttr->pu8bssid, |
| 1584 | 6) == 0) { |
| 1585 | PRINT_INFO(HOSTINF_DBG, "BSSID is passed from the user and matched\n"); |
| 1586 | break; |
| 1587 | } |
| 1588 | } |
| 1589 | } |
| 1590 | } |
| 1591 | |
| 1592 | if (i < pstrWFIDrv->u32SurveyResultsCount) { |
| 1593 | u8bssDscListIndex = i; |
| 1594 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1595 | 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] | 1596 | u8bssDscListIndex, pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].SSID, |
| 1597 | pstrWFIDrv->astrSurveyResults[u8bssDscListIndex].Channel); |
| 1598 | |
| 1599 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1600 | |
| 1601 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1602 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1603 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1604 | } |
| 1605 | |
| 1606 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1607 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1608 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1609 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1610 | pstrHostIFconnectAttr->ssidLen); |
| 1611 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1612 | } |
| 1613 | |
| 1614 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1615 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1616 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1617 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1618 | pstrHostIFconnectAttr->IEsLen); |
| 1619 | } |
| 1620 | |
| 1621 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1622 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1623 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1624 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1625 | |
| 1626 | |
| 1627 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1628 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1629 | { |
| 1630 | /* IEs to be inserted in Association Request */ |
| 1631 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1632 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1633 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1634 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1635 | u32WidsCount++; |
| 1636 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1637 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1638 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1639 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1640 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1641 | u32WidsCount++; |
| 1642 | |
| 1643 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1644 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1645 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1646 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1647 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1648 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1649 | u32WidsCount++; |
| 1650 | |
| 1651 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1652 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1653 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1654 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1655 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1656 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1657 | * u32WidsCount++; |
| 1658 | */ |
| 1659 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1660 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1661 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1662 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1663 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)&u8bssDscListIndex; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1664 | u32WidsCount++; |
| 1665 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1666 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1667 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1668 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1669 | /* ////////////////////// */ |
| 1670 | gu32WidConnRstHack = 0; |
| 1671 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1672 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1673 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1674 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1675 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1676 | PRINT_ER("failed to send config packet\n"); |
| 1677 | s32Error = -EINVAL; |
| 1678 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1679 | } else { |
| 1680 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 1681 | } |
| 1682 | |
| 1683 | } else { |
| 1684 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1685 | s32Error = -ENOENT; |
| 1686 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1687 | } |
| 1688 | |
| 1689 | #else |
| 1690 | |
| 1691 | /* if we try to connect to an already connected AP then discard the request */ |
| 1692 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1693 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1694 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1695 | s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1696 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
| 1697 | return s32Error; |
| 1698 | } |
| 1699 | |
| 1700 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1701 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1702 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 1703 | ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams; |
| 1704 | if (ptstrJoinBssParam == NULL) { |
| 1705 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1706 | s32Error = -ENOENT; |
| 1707 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1708 | } |
| 1709 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 1710 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1711 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1712 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1713 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1714 | } |
| 1715 | |
| 1716 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1717 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1718 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1719 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1720 | pstrHostIFconnectAttr->ssidLen); |
| 1721 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1722 | } |
| 1723 | |
| 1724 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1725 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1726 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1727 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1728 | pstrHostIFconnectAttr->IEsLen); |
| 1729 | } |
| 1730 | |
| 1731 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1732 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1733 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1734 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1735 | |
| 1736 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 1737 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1738 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1739 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1740 | u32WidsCount++; |
| 1741 | |
| 1742 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 1743 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1744 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1745 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1746 | u32WidsCount++; |
| 1747 | |
| 1748 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 1749 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1750 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1751 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1752 | u32WidsCount++; |
| 1753 | |
| 1754 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1755 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1756 | { |
| 1757 | /* IEs to be inserted in Association Request */ |
| 1758 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1759 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1760 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1761 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1762 | u32WidsCount++; |
| 1763 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1764 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1765 | |
| 1766 | gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1767 | gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1768 | memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1769 | gu32FlushedInfoElemAsocSize); |
| 1770 | } |
| 1771 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1772 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1773 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1774 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1775 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1776 | u32WidsCount++; |
| 1777 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1778 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1779 | gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; |
| 1780 | |
| 1781 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1782 | |
| 1783 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1784 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1785 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1786 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1787 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1788 | u32WidsCount++; |
| 1789 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1790 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1791 | gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1792 | |
| 1793 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1794 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1795 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1796 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1797 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1798 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1799 | * u32WidsCount++; |
| 1800 | */ |
| 1801 | |
| 1802 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
| 1803 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); |
| 1804 | |
| 1805 | |
| 1806 | #ifndef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1807 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1808 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1809 | strWIDList[u32WidsCount].s32ValueSize = MAX_SSID_LEN + 7; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1810 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1811 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1812 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
| 1813 | s32Error = -EFAULT; |
| 1814 | goto ERRORHANDLER; |
| 1815 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1816 | |
| 1817 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1818 | |
| 1819 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1820 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1821 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1822 | } |
| 1823 | pu8CurrByte += MAX_SSID_LEN; |
| 1824 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1825 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1826 | } else { |
| 1827 | PRINT_ER("Channel out of range\n"); |
| 1828 | *(pu8CurrByte++) = 0xFF; |
| 1829 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1830 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1831 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1832 | pu8CurrByte += 6; |
| 1833 | |
| 1834 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1835 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1836 | |
| 1837 | #else |
| 1838 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1839 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1840 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1841 | |
| 1842 | /*Sending NoA attributes during connection*/ |
| 1843 | strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1844 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1845 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1846 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1847 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1848 | gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1849 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1850 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
| 1851 | s32Error = -EFAULT; |
| 1852 | goto ERRORHANDLER; |
| 1853 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1854 | |
| 1855 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1856 | |
| 1857 | |
| 1858 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1859 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1860 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1861 | } |
| 1862 | pu8CurrByte += MAX_SSID_LEN; |
| 1863 | |
| 1864 | /* BSS type*/ |
| 1865 | *(pu8CurrByte++) = INFRASTRUCTURE; |
| 1866 | /* Channel*/ |
| 1867 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1868 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1869 | } else { |
| 1870 | PRINT_ER("Channel out of range\n"); |
| 1871 | *(pu8CurrByte++) = 0xFF; |
| 1872 | } |
| 1873 | /* Cap Info*/ |
| 1874 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1875 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1876 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1877 | |
| 1878 | /* sa*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1879 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1880 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1881 | pu8CurrByte += 6; |
| 1882 | |
| 1883 | /* bssid*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1884 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1885 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1886 | pu8CurrByte += 6; |
| 1887 | |
| 1888 | /* Beacon Period*/ |
| 1889 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1890 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1891 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1892 | /* DTIM Period*/ |
| 1893 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1894 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
| 1895 | /* Supported rates*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1896 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1897 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1898 | |
| 1899 | /* wmm cap*/ |
| 1900 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1901 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
| 1902 | /* uapsd cap*/ |
| 1903 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1904 | |
| 1905 | /* ht cap*/ |
| 1906 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
| 1907 | /* copy this information to the user request */ |
| 1908 | pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
| 1909 | |
| 1910 | /* rsn found*/ |
| 1911 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1912 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
| 1913 | /* rsn group policy*/ |
| 1914 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1915 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
| 1916 | /* mode_802_11i*/ |
| 1917 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1918 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
| 1919 | /* rsn pcip policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1920 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1921 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1922 | |
| 1923 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1924 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1925 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1926 | |
| 1927 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1928 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1929 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1930 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1931 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
| 1932 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1933 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; |
| 1934 | if (ptstrJoinBssParam->u8NoaEnbaled) { |
| 1935 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1936 | |
| 1937 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1938 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1939 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1940 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1941 | |
| 1942 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; |
| 1943 | |
| 1944 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; |
| 1945 | |
| 1946 | if (ptstrJoinBssParam->u8OppEnable) |
| 1947 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; |
| 1948 | |
| 1949 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; |
| 1950 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1951 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1952 | |
| 1953 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); |
| 1954 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1955 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1956 | |
| 1957 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); |
| 1958 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1959 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1960 | |
| 1961 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); |
| 1962 | |
| 1963 | } else |
| 1964 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1965 | |
| 1966 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1967 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1968 | |
| 1969 | |
| 1970 | #endif /* #ifdef WILC_PARSE_SCAN_IN_HOST*/ |
| 1971 | u32WidsCount++; |
| 1972 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1973 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1974 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1975 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1976 | /* ////////////////////// */ |
| 1977 | gu32WidConnRstHack = 0; |
| 1978 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1979 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1980 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1981 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1982 | gu8FlushedJoinReqDrvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1983 | } |
| 1984 | |
| 1985 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1986 | |
| 1987 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1988 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1989 | |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1990 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
| 1991 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1992 | } |
| 1993 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 1994 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1995 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1996 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1997 | PRINT_ER("failed to send config packet\n"); |
| 1998 | s32Error = -EFAULT; |
| 1999 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2000 | } else { |
| 2001 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
| 2002 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 2003 | } |
| 2004 | #endif |
| 2005 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2006 | ERRORHANDLER: |
| 2007 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2008 | tstrConnectInfo strConnectInfo; |
| 2009 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2010 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2011 | |
| 2012 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 2013 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2014 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2015 | |
| 2016 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2017 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2018 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2019 | |
| 2020 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
| 2021 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2022 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2023 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2024 | pstrHostIFconnectAttr->pu8IEs, |
| 2025 | pstrHostIFconnectAttr->IEsLen); |
| 2026 | } |
| 2027 | |
| 2028 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2029 | &strConnectInfo, |
| 2030 | MAC_DISCONNECTED, |
| 2031 | NULL, |
| 2032 | pstrHostIFconnectAttr->pvUserArg); |
| 2033 | /*Change state to idle*/ |
| 2034 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2035 | /* Deallocation */ |
| 2036 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2037 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2038 | strConnectInfo.pu8ReqIEs = NULL; |
| 2039 | } |
| 2040 | |
| 2041 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2042 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2043 | } |
| 2044 | } |
| 2045 | |
| 2046 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
| 2047 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ |
| 2048 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2049 | kfree(pstrHostIFconnectAttr->pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2050 | pstrHostIFconnectAttr->pu8bssid = NULL; |
| 2051 | } |
| 2052 | |
| 2053 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ |
| 2054 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2055 | kfree(pstrHostIFconnectAttr->pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2056 | pstrHostIFconnectAttr->pu8ssid = NULL; |
| 2057 | } |
| 2058 | |
| 2059 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ |
| 2060 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2061 | kfree(pstrHostIFconnectAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2062 | pstrHostIFconnectAttr->pu8IEs = NULL; |
| 2063 | } |
| 2064 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2065 | if (pu8CurrByte != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2066 | kfree(pu8CurrByte); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2067 | return s32Error; |
| 2068 | } |
| 2069 | |
| 2070 | /** |
| 2071 | * @brief Handle_FlushConnect |
| 2072 | * @details Sending config packet to firmware to flush an old connection |
| 2073 | * after switching FW from station one to hybrid one |
| 2074 | * @param[in] void * drvHandler |
| 2075 | * @return Error code. |
| 2076 | * @author Amr Abdel-Moghny |
| 2077 | * @date 19 DEC 2013 |
| 2078 | * @version 8.0 |
| 2079 | */ |
| 2080 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2081 | static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2082 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2083 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2084 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2085 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2086 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2087 | |
| 2088 | |
| 2089 | /* IEs to be inserted in Association Request */ |
| 2090 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 2091 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 2092 | strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc; |
| 2093 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize; |
| 2094 | u32WidsCount++; |
| 2095 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2096 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2097 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2098 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2099 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2100 | u32WidsCount++; |
| 2101 | |
| 2102 | |
| 2103 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2104 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2105 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2106 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2107 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2108 | u32WidsCount++; |
| 2109 | |
| 2110 | |
| 2111 | #ifdef WILC_PARSE_SCAN_IN_HOST |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2112 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2113 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 2114 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2115 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2116 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 2117 | |
| 2118 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 2119 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 2120 | |
| 2121 | u32WidsCount++; |
| 2122 | |
| 2123 | #endif |
| 2124 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2125 | s32Error = SendConfigPkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 2126 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2127 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2128 | PRINT_ER("failed to send config packet\n"); |
| 2129 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2130 | } |
| 2131 | |
| 2132 | return s32Error; |
| 2133 | } |
| 2134 | |
| 2135 | /** |
| 2136 | * @brief Handle_ConnectTimeout |
| 2137 | * @details Call connect notification callback function indicating connection failure |
| 2138 | * @param[in] NONE |
| 2139 | * @return Error code. |
| 2140 | * @author |
| 2141 | * @date |
| 2142 | * @version 1.0 |
| 2143 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2144 | static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2145 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2146 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2147 | tstrConnectInfo strConnectInfo; |
| 2148 | tstrWID strWID; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2149 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2150 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 2151 | |
| 2152 | if (pstrWFIDrv == NULL) { |
| 2153 | PRINT_ER("Driver handler is NULL\n"); |
| 2154 | return s32Error; |
| 2155 | } |
| 2156 | |
| 2157 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2158 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2159 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2160 | |
| 2161 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2162 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2163 | |
| 2164 | |
| 2165 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, |
| 2166 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2167 | * WID_DISCONNECT} */ |
| 2168 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2169 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2170 | memcpy(strConnectInfo.au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2171 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
| 2172 | } |
| 2173 | |
| 2174 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2175 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2176 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2177 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2178 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2179 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2180 | } |
| 2181 | |
| 2182 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2183 | &strConnectInfo, |
| 2184 | MAC_DISCONNECTED, |
| 2185 | NULL, |
| 2186 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2187 | |
| 2188 | /* Deallocation of strConnectInfo.pu8ReqIEs */ |
| 2189 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2190 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2191 | strConnectInfo.pu8ReqIEs = NULL; |
| 2192 | } |
| 2193 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2194 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2195 | } |
| 2196 | |
| 2197 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 2198 | * WID_DISCONNECT} */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2199 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2200 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2201 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2202 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2203 | |
| 2204 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 2205 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2206 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 2207 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2208 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2209 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2210 | |
| 2211 | /* Deallocation of the Saved Connect Request in the global Handle */ |
| 2212 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2213 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2214 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2215 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2216 | } |
| 2217 | |
| 2218 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2219 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2220 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2221 | } |
| 2222 | |
| 2223 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2224 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2225 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2226 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2227 | } |
| 2228 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2229 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2230 | /*Freeing flushed join request params on connect timeout*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2231 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2232 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2233 | gu8FlushedJoinReq = NULL; |
| 2234 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2235 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2236 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2237 | gu8FlushedInfoElemAsoc = NULL; |
| 2238 | } |
| 2239 | |
| 2240 | return s32Error; |
| 2241 | } |
| 2242 | |
| 2243 | /** |
| 2244 | * @brief Handle_RcvdNtwrkInfo |
| 2245 | * @details Handling received network information |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 2246 | * @param[in] struct rcvd_net_info *pstrRcvdNetworkInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2247 | * @return Error code. |
| 2248 | * @author |
| 2249 | * @date |
| 2250 | * @version 1.0 |
| 2251 | */ |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 2252 | static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, |
| 2253 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2254 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2255 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2256 | bool bNewNtwrkFound; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2257 | |
| 2258 | |
| 2259 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2260 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2261 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 2262 | void *pJoinParams = NULL; |
| 2263 | |
| 2264 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2265 | |
| 2266 | |
| 2267 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2268 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2269 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 2270 | |
| 2271 | /*if there is a an ongoing scan request*/ |
| 2272 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2273 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
| 2274 | ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); |
| 2275 | if ((pstrNetworkInfo == NULL) |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2276 | || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2277 | PRINT_ER("driver is null\n"); |
| 2278 | s32Error = -EINVAL; |
| 2279 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2280 | } |
| 2281 | |
| 2282 | /* check whether this network is discovered before */ |
| 2283 | for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
| 2284 | |
| 2285 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && |
| 2286 | (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 2287 | if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2288 | pstrNetworkInfo->au8bssid, 6) == 0) { |
| 2289 | if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
| 2290 | /*we have already found this network with better rssi, so keep the old cached one and don't |
| 2291 | * send anything to the upper layer */ |
| 2292 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 2293 | goto done; |
| 2294 | } else { |
| 2295 | /* here the same already found network is found again but with a better rssi, so just update |
| 2296 | * the rssi for this cached network and send this updated network to the upper layer but |
| 2297 | * don't add a new record for it */ |
| 2298 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2299 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2300 | break; |
| 2301 | } |
| 2302 | } |
| 2303 | } |
| 2304 | } |
| 2305 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2306 | if (bNewNtwrkFound == true) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2307 | /* here it is confirmed that it is a new discovered network, |
| 2308 | * so add its record then call the User CallBack function */ |
| 2309 | |
| 2310 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 2311 | |
| 2312 | if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 2313 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
| 2314 | |
| 2315 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) |
| 2316 | && (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2317 | memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2318 | pstrNetworkInfo->au8bssid, 6); |
| 2319 | |
| 2320 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; |
| 2321 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2322 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2323 | /* add new BSS to JoinBssTable */ |
| 2324 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2325 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
| 2326 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 2327 | |
| 2328 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2329 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, |
| 2330 | pJoinParams); |
| 2331 | |
| 2332 | |
| 2333 | } |
| 2334 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2335 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2336 | } |
| 2337 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2338 | pstrNetworkInfo->bNewNetwork = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2339 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
| 2340 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2341 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2342 | } |
| 2343 | } |
| 2344 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2345 | done: |
| 2346 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2347 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2348 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2349 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
| 2350 | } |
| 2351 | |
| 2352 | /*free structure allocated*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2353 | if (pstrNetworkInfo != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2354 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2355 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2356 | } |
| 2357 | |
| 2358 | return s32Error; |
| 2359 | } |
| 2360 | |
| 2361 | /** |
| 2362 | * @brief Handle_RcvdGnrlAsyncInfo |
| 2363 | * @details Handling received asynchrous general network information |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2364 | * @param[in] struct rcvd_async_info *pstrRcvdGnrlAsyncInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2365 | * @return Error code. |
| 2366 | * @author |
| 2367 | * @date |
| 2368 | * @version 1.0 |
| 2369 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2370 | static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, |
| 2371 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2372 | { |
| 2373 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ |
| 2374 | /* which carries only 1 WID which have WID ID = WID_STATUS */ |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2375 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2376 | u8 u8MsgType = 0; |
| 2377 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2378 | u16 u16MsgLen = 0; |
| 2379 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2380 | u8 u8WidLen = 0; |
| 2381 | u8 u8MacStatus; |
| 2382 | u8 u8MacStatusReasonCode; |
| 2383 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2384 | tstrConnectInfo strConnectInfo; |
| 2385 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2386 | s32 s32Err = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2387 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2388 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2389 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2390 | PRINT_ER("Driver handler is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2391 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, |
| 2392 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); |
| 2393 | |
| 2394 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 2395 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 2396 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2397 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2398 | (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2399 | PRINT_ER("driver is null\n"); |
| 2400 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2401 | } |
| 2402 | |
| 2403 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; |
| 2404 | |
| 2405 | /* Check whether the received message type is 'I' */ |
| 2406 | if ('I' != u8MsgType) { |
| 2407 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2408 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2409 | } |
| 2410 | |
| 2411 | /* Extract message ID */ |
| 2412 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; |
| 2413 | |
| 2414 | /* Extract message Length */ |
| 2415 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); |
| 2416 | |
| 2417 | /* Extract WID ID [expected to be = WID_STATUS] */ |
| 2418 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); |
| 2419 | |
| 2420 | /* Extract WID Length [expected to be = 1] */ |
| 2421 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; |
| 2422 | |
| 2423 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ |
| 2424 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; |
| 2425 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; |
| 2426 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; |
| 2427 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2428 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2429 | /* 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] | 2430 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2431 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 2432 | |
| 2433 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2434 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2435 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2436 | |
| 2437 | if (u8MacStatus == MAC_CONNECTED) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2438 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2439 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2440 | host_int_get_assoc_res_info(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2441 | gapu8RcvdAssocResp, |
| 2442 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 2443 | &u32RcvdAssocRespInfoLen); |
| 2444 | |
| 2445 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 2446 | |
| 2447 | if (u32RcvdAssocRespInfoLen != 0) { |
| 2448 | |
| 2449 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
| 2450 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, |
| 2451 | &pstrConnectRespInfo); |
| 2452 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2453 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2454 | } else { |
| 2455 | /* use the necessary parsed Info from the Received Association Response */ |
| 2456 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 2457 | |
| 2458 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 2459 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
| 2460 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { |
| 2461 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
| 2462 | |
| 2463 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2464 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2465 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2466 | pstrConnectRespInfo->u16RespIEsLen); |
| 2467 | } |
| 2468 | } |
| 2469 | |
| 2470 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ |
| 2471 | if (pstrConnectRespInfo != NULL) { |
| 2472 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 2473 | pstrConnectRespInfo = NULL; |
| 2474 | } |
| 2475 | } |
| 2476 | } |
| 2477 | } |
| 2478 | |
| 2479 | /* The station has just received mac status and it also received assoc. response which |
| 2480 | * it was waiting for. |
| 2481 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ |
| 2482 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2483 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2484 | 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] | 2485 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2486 | |
| 2487 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 2488 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2489 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2490 | } |
| 2491 | |
| 2492 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ |
| 2493 | /* through a structure of type tstrConnectRespInfo */ |
| 2494 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
| 2495 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2496 | memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2497 | |
| 2498 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2499 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2500 | memcpy(pstrWFIDrv->au8AssociatedBSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2501 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
| 2502 | } |
| 2503 | } |
| 2504 | |
| 2505 | |
| 2506 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2507 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2508 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2509 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2510 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2511 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2512 | } |
| 2513 | |
| 2514 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2515 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2516 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2517 | &strConnectInfo, |
| 2518 | u8MacStatus, |
| 2519 | NULL, |
| 2520 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2521 | |
| 2522 | |
| 2523 | /* if received mac status is MAC_CONNECTED and |
| 2524 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED |
| 2525 | * else change state to IDLE */ |
| 2526 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2527 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
| 2528 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2529 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2530 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2531 | #endif |
| 2532 | |
| 2533 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
| 2534 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED; |
| 2535 | |
| 2536 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2537 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2538 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2539 | mod_timer(&hDuringIpTimer, |
| 2540 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2541 | #endif |
| 2542 | |
| 2543 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 2544 | /* open a BA session if possible */ |
| 2545 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ |
| 2546 | |
| 2547 | #endif |
| 2548 | |
| 2549 | /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */ |
| 2550 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ |
| 2551 | } else { |
| 2552 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
| 2553 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2554 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2555 | } |
| 2556 | |
| 2557 | /* Deallocation */ |
| 2558 | if (strConnectInfo.pu8RespIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2559 | kfree(strConnectInfo.pu8RespIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2560 | strConnectInfo.pu8RespIEs = NULL; |
| 2561 | } |
| 2562 | |
| 2563 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2564 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2565 | strConnectInfo.pu8ReqIEs = NULL; |
| 2566 | } |
| 2567 | |
| 2568 | |
| 2569 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2570 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2571 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2572 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2573 | } |
| 2574 | |
| 2575 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2576 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2577 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2578 | } |
| 2579 | |
| 2580 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2581 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2582 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2583 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2584 | } |
| 2585 | |
| 2586 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2587 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) { |
| 2588 | /* Disassociation or Deauthentication frame has been received */ |
| 2589 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 2590 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2591 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2592 | |
| 2593 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2594 | 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] | 2595 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2596 | Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); |
| 2597 | } |
| 2598 | |
| 2599 | strDisconnectNotifInfo.u16reason = 0; |
| 2600 | strDisconnectNotifInfo.ie = NULL; |
| 2601 | strDisconnectNotifInfo.ie_len = 0; |
| 2602 | |
| 2603 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2604 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 2605 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2606 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2607 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2608 | #endif |
| 2609 | |
| 2610 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2611 | NULL, |
| 2612 | 0, |
| 2613 | &strDisconnectNotifInfo, |
| 2614 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2615 | |
| 2616 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2617 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2618 | } |
| 2619 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2620 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2621 | |
| 2622 | |
| 2623 | /* Deallocation */ |
| 2624 | |
| 2625 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they |
| 2626 | * should be deallocated here */ |
| 2627 | /* |
| 2628 | * if(strDisconnectNotifInfo.ie != NULL) |
| 2629 | * { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2630 | * kfree(strDisconnectNotifInfo.ie); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2631 | * strDisconnectNotifInfo.ie = NULL; |
| 2632 | * } |
| 2633 | */ |
| 2634 | |
| 2635 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2636 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2637 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2638 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2639 | } |
| 2640 | |
| 2641 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2642 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2643 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2644 | } |
| 2645 | |
| 2646 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2647 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2648 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2649 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2650 | } |
| 2651 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2652 | /*Freeing flushed join request params on receiving*/ |
| 2653 | /*MAC_DISCONNECTED while connected*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2654 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2655 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2656 | gu8FlushedJoinReq = NULL; |
| 2657 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2658 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2659 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2660 | gu8FlushedInfoElemAsoc = NULL; |
| 2661 | } |
| 2662 | |
| 2663 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2664 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2665 | |
| 2666 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2667 | (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { |
| 2668 | 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] | 2669 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2670 | /*Abort the running scan*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2671 | del_timer(&pstrWFIDrv->hScanTimer); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2672 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2673 | Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2674 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2675 | } |
| 2676 | |
| 2677 | } |
| 2678 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2679 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2680 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2681 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2682 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
| 2683 | } |
| 2684 | |
| 2685 | return s32Error; |
| 2686 | } |
| 2687 | |
| 2688 | /** |
| 2689 | * @brief Handle_Key |
| 2690 | * @details Sending config packet to firmware to set key |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2691 | * @param[in] struct key_attr *pstrHostIFkeyAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2692 | * @return Error code. |
| 2693 | * @author |
| 2694 | * @date |
| 2695 | * @version 1.0 |
| 2696 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2697 | static int Handle_Key(tstrWILC_WFIDrv *drvHandler, |
| 2698 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2699 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2700 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2701 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2702 | tstrWID strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2703 | u8 i; |
| 2704 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2705 | s8 s8idxarray[1]; |
| 2706 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2707 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2708 | |
| 2709 | |
| 2710 | switch (pstrHostIFkeyAttr->enuKeyType) { |
| 2711 | |
| 2712 | |
| 2713 | case WEP: |
| 2714 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2715 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2716 | |
| 2717 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
| 2718 | 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] | 2719 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2720 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2721 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2722 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2723 | |
| 2724 | strWIDList[1].u16WIDid = WID_AUTH_TYPE; |
| 2725 | strWIDList[1].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2726 | strWIDList[1].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2727 | strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2728 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2729 | strWIDList[2].u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2730 | strWIDList[2].enuWIDtype = WID_CHAR; |
| 2731 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2732 | strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2733 | strWIDList[2].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2734 | |
| 2735 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2736 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2737 | |
| 2738 | |
| 2739 | if (pu8keybuf == NULL) { |
| 2740 | PRINT_ER("No buffer to send Key\n"); |
| 2741 | return -1; |
| 2742 | } |
| 2743 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2744 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2745 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2746 | |
| 2747 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2748 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2749 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2750 | strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2751 | strWIDList[3].enuWIDtype = WID_STR; |
| 2752 | strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2753 | strWIDList[3].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2754 | |
| 2755 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2756 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 4, true, |
| 2757 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2758 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2759 | |
| 2760 | |
| 2761 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2762 | |
| 2763 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2764 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2765 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2766 | if (pu8keybuf == NULL) { |
| 2767 | PRINT_ER("No buffer to send Key\n"); |
| 2768 | return -1; |
| 2769 | } |
| 2770 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
| 2771 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2772 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2773 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2774 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2775 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2776 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2777 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2778 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2779 | strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2780 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2781 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2782 | strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; |
| 2783 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2784 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2785 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2786 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2787 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
| 2788 | |
| 2789 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2790 | strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2791 | strWID.enuWIDtype = WID_STR; |
| 2792 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2793 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2794 | strWID.ps8WidVal = s8idxarray; |
| 2795 | strWID.s32ValueSize = 1; |
| 2796 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2797 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2798 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2799 | } else { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2800 | strWID.u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2801 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2802 | strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2803 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2804 | |
| 2805 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 2806 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2807 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2808 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2809 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2810 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2811 | break; |
| 2812 | |
| 2813 | case WPARxGtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2814 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2815 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2816 | if (pu8keybuf == NULL) { |
| 2817 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2818 | ret = -1; |
| 2819 | goto _WPARxGtk_end_case_; |
| 2820 | } |
| 2821 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2822 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2823 | |
| 2824 | |
| 2825 | /*|----------------------------------------------------------------------------| |
| 2826 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2827 | * |------------|---------|-------|------------|---------------|----------------| |
| 2828 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2829 | |
| 2830 | |
| 2831 | |
| 2832 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2833 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2834 | |
| 2835 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2836 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 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 + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2839 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2840 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2841 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2842 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2843 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2844 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2845 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2846 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2847 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2848 | strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2849 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2850 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2851 | strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2852 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2853 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2854 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2855 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2856 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2857 | |
| 2858 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2859 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2860 | /* ///////////////////////// */ |
| 2861 | } |
| 2862 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2863 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2864 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 2865 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2866 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2867 | if (pu8keybuf == NULL) { |
| 2868 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2869 | ret = -1; |
| 2870 | goto _WPARxGtk_end_case_; |
| 2871 | } |
| 2872 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2873 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2874 | |
| 2875 | |
| 2876 | /*|----------------------------------------------------------------------------| |
| 2877 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2878 | * |------------|---------|-------|------------|---------------|----------------| |
| 2879 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2880 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2881 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2882 | memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2883 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2884 | 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] | 2885 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2886 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
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 + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2889 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2890 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
| 2891 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2892 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2893 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2894 | strWID.u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2895 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2896 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2897 | strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2898 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2899 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2900 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2901 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2902 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2903 | |
| 2904 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2905 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2906 | /* ///////////////////////// */ |
| 2907 | } |
| 2908 | _WPARxGtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2909 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
| 2910 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2911 | if (ret == -1) |
| 2912 | return ret; |
| 2913 | |
| 2914 | break; |
| 2915 | |
| 2916 | case WPAPtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2917 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2918 | |
| 2919 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2920 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2921 | |
| 2922 | |
| 2923 | |
| 2924 | if (pu8keybuf == NULL) { |
| 2925 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2926 | ret = -1; |
| 2927 | goto _WPAPtk_end_case_; |
| 2928 | |
| 2929 | } |
| 2930 | |
| 2931 | /*|-----------------------------------------------------------------------------| |
| 2932 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2933 | * |----------------|------------ |--------------|----------------|---------------| |
| 2934 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2935 | |-----------------------------------------------------------------------------|*/ |
| 2936 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2937 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2938 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2939 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
| 2940 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2941 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2942 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2943 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2944 | |
| 2945 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2946 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2947 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2948 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2949 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2950 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2951 | strWIDList[1].u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2952 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2953 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2954 | strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; |
| 2955 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2956 | s32Error = SendConfigPkt(SET_CFG, strWIDList, 2, true, |
| 2957 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2958 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2959 | |
| 2960 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2961 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2962 | /* ///////////////////////// */ |
| 2963 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2964 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2965 | |
| 2966 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2967 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2968 | |
| 2969 | |
| 2970 | |
| 2971 | if (pu8keybuf == NULL) { |
| 2972 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2973 | ret = -1; |
| 2974 | goto _WPAPtk_end_case_; |
| 2975 | |
| 2976 | } |
| 2977 | |
| 2978 | /*|-----------------------------------------------------------------------------| |
| 2979 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2980 | * |----------------|------------|--------------|----------------|---------------| |
| 2981 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2982 | |-----------------------------------------------------------------------------|*/ |
| 2983 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2984 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2985 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2986 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2987 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2988 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2989 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2990 | |
| 2991 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2992 | strWID.u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2993 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2994 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2995 | strWID.s32ValueSize = PTK_KEY_MSG_LEN; |
| 2996 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 2997 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 2998 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2999 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3000 | |
| 3001 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3002 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3003 | /* ///////////////////////// */ |
| 3004 | } |
| 3005 | |
| 3006 | _WPAPtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3007 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3008 | if (ret == -1) |
| 3009 | return ret; |
| 3010 | |
| 3011 | break; |
| 3012 | |
| 3013 | |
| 3014 | case PMKSA: |
| 3015 | |
| 3016 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 3017 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3018 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3019 | if (pu8keybuf == NULL) { |
| 3020 | PRINT_ER("No buffer to send PMKSA Key\n"); |
| 3021 | return -1; |
| 3022 | } |
| 3023 | |
| 3024 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; |
| 3025 | |
| 3026 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { |
| 3027 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3028 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); |
| 3029 | 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] | 3030 | } |
| 3031 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3032 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3033 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3034 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3035 | strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1; |
| 3036 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3037 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3038 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3039 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3040 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3041 | break; |
| 3042 | } |
| 3043 | |
| 3044 | if (s32Error) |
| 3045 | PRINT_ER("Failed to send key config packet\n"); |
| 3046 | |
| 3047 | |
| 3048 | return s32Error; |
| 3049 | } |
| 3050 | |
| 3051 | |
| 3052 | /** |
| 3053 | * @brief Handle_Disconnect |
| 3054 | * @details Sending config packet to firmware to disconnect |
| 3055 | * @param[in] NONE |
| 3056 | * @return NONE |
| 3057 | * @author |
| 3058 | * @date |
| 3059 | * @version 1.0 |
| 3060 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3061 | static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3062 | { |
| 3063 | tstrWID strWID; |
| 3064 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3065 | s32 s32Error = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3066 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3067 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3068 | |
| 3069 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3070 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3071 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3072 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3073 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3074 | |
| 3075 | |
| 3076 | |
| 3077 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 3078 | |
| 3079 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3080 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3081 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3082 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3083 | #endif |
| 3084 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3085 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3086 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3087 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3088 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3089 | |
| 3090 | if (s32Error) { |
| 3091 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3092 | } else { |
| 3093 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 3094 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3095 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3096 | |
| 3097 | strDisconnectNotifInfo.u16reason = 0; |
| 3098 | strDisconnectNotifInfo.ie = NULL; |
| 3099 | strDisconnectNotifInfo.ie_len = 0; |
| 3100 | |
| 3101 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3102 | del_timer(&pstrWFIDrv->hScanTimer); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3103 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3104 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 3105 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3106 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3107 | } |
| 3108 | |
| 3109 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 3110 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3111 | /*Stop connect timer, if connection in progress*/ |
| 3112 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3113 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3114 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3115 | } |
| 3116 | |
| 3117 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 3118 | 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 3119 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3120 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3121 | } |
| 3122 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3123 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3124 | |
| 3125 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 3126 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 3127 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3128 | |
| 3129 | |
| 3130 | /* Deallocation */ |
| 3131 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 3132 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3133 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3134 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 3135 | } |
| 3136 | |
| 3137 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3138 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3139 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 3140 | } |
| 3141 | |
| 3142 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 3143 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3144 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3145 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 3146 | } |
| 3147 | |
| 3148 | |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3149 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3150 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3151 | gu8FlushedJoinReq = NULL; |
| 3152 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 3153 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3154 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3155 | gu8FlushedInfoElemAsoc = NULL; |
| 3156 | } |
| 3157 | |
| 3158 | } |
| 3159 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3160 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3161 | up(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3162 | /* ///////////////////////// */ |
| 3163 | |
| 3164 | } |
| 3165 | |
| 3166 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3167 | void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3168 | { |
| 3169 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 3170 | |
| 3171 | pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 3172 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3173 | return; |
| 3174 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { |
| 3175 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 3176 | host_int_disconnect(pstrWFIDrv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3177 | } |
| 3178 | } |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3179 | static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3180 | { |
| 3181 | |
| 3182 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3183 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3184 | tstrWID strWID; |
| 3185 | static char dummy = 9; |
| 3186 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3187 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3188 | strWID.u16WIDid = (u16)WID_LOGTerminal_Switch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3189 | strWID.enuWIDtype = WID_CHAR; |
| 3190 | strWID.ps8WidVal = &dummy; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3191 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3192 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3193 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3194 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3195 | |
| 3196 | |
| 3197 | if (s32Error) { |
| 3198 | PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3199 | PRINT_ER("Failed to switch log terminal\n"); |
| 3200 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3201 | } |
| 3202 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3203 | PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3204 | |
| 3205 | return s32Error; |
| 3206 | } |
| 3207 | |
| 3208 | /** |
| 3209 | * @brief Handle_GetChnl |
| 3210 | * @details Sending config packet to get channel |
| 3211 | * @param[in] NONE |
| 3212 | * @return NONE |
| 3213 | * |
| 3214 | * @author |
| 3215 | * @date |
| 3216 | * @version 1.0 |
| 3217 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3218 | static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3219 | { |
| 3220 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3221 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3222 | tstrWID strWID; |
| 3223 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 3224 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3225 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3226 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3227 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3228 | strWID.ps8WidVal = (s8 *)&gu8Chnl; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3229 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3230 | |
| 3231 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 3232 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3233 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3234 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3235 | /*get the value by searching the local copy*/ |
| 3236 | if (s32Error) { |
| 3237 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3238 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3239 | } |
| 3240 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3241 | up(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3242 | |
| 3243 | return s32Error; |
| 3244 | |
| 3245 | |
| 3246 | |
| 3247 | } |
| 3248 | |
| 3249 | |
| 3250 | /** |
| 3251 | * @brief Handle_GetRssi |
| 3252 | * @details Sending config packet to get RSSI |
| 3253 | * @param[in] NONE |
| 3254 | * @return NONE |
| 3255 | * @author |
| 3256 | * @date |
| 3257 | * @version 1.0 |
| 3258 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3259 | static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3260 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3261 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3262 | tstrWID strWID; |
| 3263 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3264 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3265 | strWID.u16WIDid = (u16)WID_RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3266 | strWID.enuWIDtype = WID_CHAR; |
| 3267 | strWID.ps8WidVal = &gs8Rssi; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3268 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3269 | |
| 3270 | /*Sending Cfg*/ |
| 3271 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 3272 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3273 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3274 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3275 | if (s32Error) { |
| 3276 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3277 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3278 | } |
| 3279 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3280 | up(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3281 | |
| 3282 | |
| 3283 | } |
| 3284 | |
| 3285 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3286 | static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3287 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3288 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3289 | tstrWID strWID; |
| 3290 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3291 | |
| 3292 | gs8lnkspd = 0; |
| 3293 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3294 | strWID.u16WIDid = (u16)WID_LINKSPEED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3295 | strWID.enuWIDtype = WID_CHAR; |
| 3296 | strWID.ps8WidVal = &gs8lnkspd; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3297 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3298 | /*Sending Cfg*/ |
| 3299 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 3300 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3301 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3302 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3303 | if (s32Error) { |
| 3304 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3305 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3306 | } |
| 3307 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3308 | up(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3309 | |
| 3310 | |
| 3311 | } |
| 3312 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3313 | s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3314 | { |
| 3315 | tstrWID strWIDList[5]; |
Chaehyun Lim | fbc2fe1 | 2015-09-15 14:06:16 +0900 | [diff] [blame] | 3316 | u32 u32WidsCount = 0, s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3317 | |
| 3318 | strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED; |
| 3319 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3320 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3321 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3322 | u32WidsCount++; |
| 3323 | |
| 3324 | strWIDList[u32WidsCount].u16WIDid = WID_RSSI; |
| 3325 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3326 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3327 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3328 | u32WidsCount++; |
| 3329 | |
| 3330 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 3331 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3332 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3333 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3334 | u32WidsCount++; |
| 3335 | |
| 3336 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 3337 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3338 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3339 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3340 | u32WidsCount++; |
| 3341 | |
| 3342 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 3343 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3344 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3345 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3346 | u32WidsCount++; |
| 3347 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3348 | s32Error = SendConfigPkt(GET_CFG, strWIDList, u32WidsCount, false, |
| 3349 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3350 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3351 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3352 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3353 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3354 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3355 | return 0; |
| 3356 | |
| 3357 | } |
| 3358 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3359 | /** |
| 3360 | * @brief Handle_Get_InActiveTime |
| 3361 | * @details Sending config packet to set mac adddress for station and |
| 3362 | * get inactive time |
| 3363 | * @param[in] NONE |
| 3364 | * @return NONE |
| 3365 | * |
| 3366 | * @author |
| 3367 | * @date |
| 3368 | * @version 1.0 |
| 3369 | */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 3370 | static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, |
| 3371 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3372 | { |
| 3373 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3374 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3375 | u8 *stamac; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3376 | tstrWID strWID; |
| 3377 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3378 | |
| 3379 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3380 | strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3381 | strWID.enuWIDtype = WID_STR; |
| 3382 | strWID.s32ValueSize = ETH_ALEN; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3383 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3384 | |
| 3385 | |
| 3386 | stamac = strWID.ps8WidVal; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3387 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3388 | |
| 3389 | |
| 3390 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 3391 | |
| 3392 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3393 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3394 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3395 | /*get the value by searching the local copy*/ |
| 3396 | if (s32Error) { |
| 3397 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3398 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3399 | } |
| 3400 | |
| 3401 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3402 | strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3403 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3404 | strWID.ps8WidVal = (s8 *)&gu32InactiveTime; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3405 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3406 | |
| 3407 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3408 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 3409 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3410 | /*get the value by searching the local copy*/ |
| 3411 | if (s32Error) { |
| 3412 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3413 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3414 | } |
| 3415 | |
| 3416 | |
| 3417 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); |
| 3418 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3419 | up(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3420 | |
| 3421 | return s32Error; |
| 3422 | |
| 3423 | |
| 3424 | |
| 3425 | } |
| 3426 | |
| 3427 | |
| 3428 | /** |
| 3429 | * @brief Handle_AddBeacon |
| 3430 | * @details Sending config packet to add beacon |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 3431 | * @param[in] struct set_beacon *pstrSetBeaconParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3432 | * @return NONE |
| 3433 | * @author |
| 3434 | * @date |
| 3435 | * @version 1.0 |
| 3436 | */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 3437 | static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, |
| 3438 | struct set_beacon *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3439 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3440 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3441 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3442 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3443 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3444 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3445 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 3446 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3447 | strWID.u16WIDid = (u16)WID_ADD_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3448 | strWID.enuWIDtype = WID_BIN; |
| 3449 | strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3450 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3451 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3452 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3453 | |
| 3454 | pu8CurrByte = strWID.ps8WidVal; |
| 3455 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); |
| 3456 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); |
| 3457 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); |
| 3458 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); |
| 3459 | |
| 3460 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); |
| 3461 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); |
| 3462 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); |
| 3463 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); |
| 3464 | |
| 3465 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); |
| 3466 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); |
| 3467 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); |
| 3468 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); |
| 3469 | |
| 3470 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); |
| 3471 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; |
| 3472 | |
| 3473 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); |
| 3474 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); |
| 3475 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); |
| 3476 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); |
| 3477 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3478 | if (pstrSetBeaconParam->pu8Tail > 0) |
| 3479 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); |
| 3480 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; |
| 3481 | |
| 3482 | |
| 3483 | |
| 3484 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3485 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3486 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3487 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3488 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3489 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3490 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3491 | kfree(strWID.ps8WidVal); |
| 3492 | kfree(pstrSetBeaconParam->pu8Head); |
| 3493 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3494 | } |
| 3495 | |
| 3496 | |
| 3497 | /** |
| 3498 | * @brief Handle_AddBeacon |
| 3499 | * @details Sending config packet to delete beacon |
Tony Cho | d0227fc | 2015-09-21 12:16:45 +0900 | [diff] [blame] | 3500 | * @param[in] struct del_beacon *pstrDelBeacon |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3501 | * @return NONE |
| 3502 | * @author |
| 3503 | * @date |
| 3504 | * @version 1.0 |
| 3505 | */ |
Tony Cho | d0227fc | 2015-09-21 12:16:45 +0900 | [diff] [blame] | 3506 | static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler, |
| 3507 | struct del_beacon *pstrDelBeacon) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3508 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3509 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3510 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3511 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3512 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3513 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3514 | strWID.u16WIDid = (u16)WID_DEL_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3515 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3516 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3517 | strWID.ps8WidVal = &gu8DelBcn; |
| 3518 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3519 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3520 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3521 | |
| 3522 | pu8CurrByte = strWID.ps8WidVal; |
| 3523 | |
| 3524 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
| 3525 | /* TODO: build del beacon message*/ |
| 3526 | |
| 3527 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3528 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3529 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3530 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3531 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3532 | } |
| 3533 | |
| 3534 | |
| 3535 | /** |
| 3536 | * @brief WILC_HostIf_PackStaParam |
| 3537 | * @details Handling packing of the station params in a buffer |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3538 | * @param[in] u8* pu8Buffer, struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3539 | * @return NONE |
| 3540 | * @author |
| 3541 | * @date |
| 3542 | * @version 1.0 |
| 3543 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3544 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 3545 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3546 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3547 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3548 | |
| 3549 | pu8CurrByte = pu8Buffer; |
| 3550 | |
| 3551 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3552 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3553 | pu8CurrByte += ETH_ALEN; |
| 3554 | |
| 3555 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 3556 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 3557 | |
| 3558 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3559 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3560 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3561 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 3562 | |
| 3563 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 3564 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 3565 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 3566 | |
| 3567 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3568 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3569 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 3570 | |
| 3571 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 3572 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 3573 | |
| 3574 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 3575 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 3576 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 3577 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 3578 | |
| 3579 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 3580 | |
| 3581 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 3582 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 3583 | |
| 3584 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 3585 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 3586 | |
| 3587 | return pu8CurrByte - pu8Buffer; |
| 3588 | } |
| 3589 | |
| 3590 | /** |
| 3591 | * @brief Handle_AddStation |
| 3592 | * @details Sending config packet to add station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3593 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3594 | * @return NONE |
| 3595 | * @author |
| 3596 | * @date |
| 3597 | * @version 1.0 |
| 3598 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3599 | static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, |
| 3600 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3601 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3602 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3603 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3604 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3605 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3606 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3607 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3608 | strWID.u16WIDid = (u16)WID_ADD_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3609 | strWID.enuWIDtype = WID_BIN; |
| 3610 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3611 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3612 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3613 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3614 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3615 | |
| 3616 | pu8CurrByte = strWID.ps8WidVal; |
| 3617 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3618 | |
| 3619 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3620 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3621 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3622 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3623 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3624 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3625 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3626 | kfree(pstrStationParam->pu8Rates); |
| 3627 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3628 | } |
| 3629 | |
| 3630 | /** |
| 3631 | * @brief Handle_DelAllSta |
| 3632 | * @details Sending config packet to delete station |
| 3633 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3634 | * @return NONE |
| 3635 | * @author |
| 3636 | * @date |
| 3637 | * @version 1.0 |
| 3638 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3639 | static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelAllSta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3640 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3641 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3642 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3643 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3644 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3645 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3646 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 3647 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3648 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3649 | strWID.u16WIDid = (u16)WID_DEL_ALL_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3650 | strWID.enuWIDtype = WID_STR; |
| 3651 | strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; |
| 3652 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3653 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3654 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3655 | strWID.ps8WidVal = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3656 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3657 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3658 | |
| 3659 | pu8CurrByte = strWID.ps8WidVal; |
| 3660 | |
| 3661 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; |
| 3662 | |
| 3663 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 3664 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3665 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3666 | else |
| 3667 | continue; |
| 3668 | |
| 3669 | pu8CurrByte += ETH_ALEN; |
| 3670 | } |
| 3671 | |
| 3672 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3673 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3674 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3675 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3676 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3677 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3678 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3679 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3680 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3681 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3682 | } |
| 3683 | |
| 3684 | |
| 3685 | /** |
| 3686 | * @brief Handle_DelStation |
| 3687 | * @details Sending config packet to delete station |
| 3688 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3689 | * @return NONE |
| 3690 | * @author |
| 3691 | * @date |
| 3692 | * @version 1.0 |
| 3693 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3694 | static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, tstrHostIFDelSta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3695 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3696 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3697 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3698 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3699 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3700 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3701 | strWID.u16WIDid = (u16)WID_REMOVE_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3702 | strWID.enuWIDtype = WID_BIN; |
| 3703 | strWID.s32ValueSize = ETH_ALEN; |
| 3704 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3705 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3706 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3707 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3708 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3709 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3710 | |
| 3711 | pu8CurrByte = strWID.ps8WidVal; |
| 3712 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3713 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3714 | |
| 3715 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3716 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3717 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3718 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3719 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3720 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3721 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3722 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3723 | } |
| 3724 | |
| 3725 | |
| 3726 | /** |
| 3727 | * @brief Handle_EditStation |
| 3728 | * @details Sending config packet to edit station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3729 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3730 | * @return NONE |
| 3731 | * @author |
| 3732 | * @date |
| 3733 | * @version 1.0 |
| 3734 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3735 | static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, |
| 3736 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3737 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3738 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3739 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3740 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3741 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3742 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3743 | strWID.u16WIDid = (u16)WID_EDIT_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3744 | strWID.enuWIDtype = WID_BIN; |
| 3745 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3746 | |
| 3747 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3748 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3749 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3750 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3751 | |
| 3752 | pu8CurrByte = strWID.ps8WidVal; |
| 3753 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3754 | |
| 3755 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3756 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 3757 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3758 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3759 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3760 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3761 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3762 | kfree(pstrStationParam->pu8Rates); |
| 3763 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3764 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3765 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3766 | /** |
| 3767 | * @brief Handle_RemainOnChan |
| 3768 | * @details Sending config packet to edit station |
| 3769 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3770 | * @return NONE |
| 3771 | * @author |
| 3772 | * @date |
| 3773 | * @version 1.0 |
| 3774 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3775 | static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3776 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3777 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3778 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3779 | tstrWID strWID; |
| 3780 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3781 | |
| 3782 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ |
| 3783 | if (!pstrWFIDrv->u8RemainOnChan_pendingreq) { |
| 3784 | pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 3785 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 3786 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 3787 | pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 3788 | pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
| 3789 | } else { |
| 3790 | /*Set the channel to use it as a wid val*/ |
| 3791 | pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel; |
| 3792 | } |
| 3793 | |
| 3794 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 3795 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
| 3796 | pstrWFIDrv->u8RemainOnChan_pendingreq = 1; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3797 | s32Error = -EBUSY; |
| 3798 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3799 | } |
| 3800 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3801 | 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] | 3802 | s32Error = -EBUSY; |
| 3803 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3804 | } |
| 3805 | |
| 3806 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 3807 | if (g_obtainingIP || connecting) { |
| 3808 | 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] | 3809 | s32Error = -EBUSY; |
| 3810 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3811 | } |
| 3812 | #endif |
| 3813 | |
| 3814 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 3815 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3816 | u8remain_on_chan_flag = true; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3817 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3818 | strWID.enuWIDtype = WID_STR; |
| 3819 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3820 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3821 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3822 | if (strWID.ps8WidVal == NULL) { |
| 3823 | s32Error = -ENOMEM; |
| 3824 | goto ERRORHANDLER; |
| 3825 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3826 | |
| 3827 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3828 | strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3829 | |
| 3830 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3831 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3832 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3833 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3834 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3835 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3836 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3837 | { |
| 3838 | P2P_LISTEN_STATE = 1; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3839 | pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; |
| 3840 | mod_timer(&pstrWFIDrv->hRemainOnChannel, |
| 3841 | jiffies + |
| 3842 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3843 | |
| 3844 | /*Calling CFG ready_on_channel*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3845 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3846 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3847 | |
| 3848 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 3849 | pstrWFIDrv->u8RemainOnChan_pendingreq = 0; |
| 3850 | } |
| 3851 | return s32Error; |
| 3852 | } |
| 3853 | |
| 3854 | /** |
| 3855 | * @brief Handle_RegisterFrame |
| 3856 | * @details |
| 3857 | * @param[in] |
| 3858 | * @return NONE |
| 3859 | * @author |
| 3860 | * @date |
| 3861 | * @version 1.0 |
| 3862 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3863 | static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, tstrHostIfRegisterFrame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3864 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3865 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3866 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3867 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3868 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3869 | |
| 3870 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 3871 | |
| 3872 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3873 | strWID.u16WIDid = (u16)WID_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3874 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3875 | strWID.ps8WidVal = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3876 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3877 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3878 | |
| 3879 | pu8CurrByte = strWID.ps8WidVal; |
| 3880 | |
| 3881 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 3882 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3883 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3884 | |
| 3885 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3886 | strWID.s32ValueSize = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3887 | |
| 3888 | |
| 3889 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3890 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3891 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3892 | if (s32Error) { |
| 3893 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3894 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3895 | } |
| 3896 | |
| 3897 | return s32Error; |
| 3898 | |
| 3899 | } |
| 3900 | |
| 3901 | /** |
| 3902 | * @brief Handle_ListenStateExpired |
| 3903 | * @details Handle of listen state expiration |
| 3904 | * @param[in] NONE |
| 3905 | * @return Error code. |
| 3906 | * @author |
| 3907 | * @date |
| 3908 | * @version 1.0 |
| 3909 | */ |
| 3910 | #define FALSE_FRMWR_CHANNEL 100 |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3911 | static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, tstrHostIfRemainOnChan *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3912 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3913 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3914 | tstrWID strWID; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3915 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3916 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3917 | |
| 3918 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 3919 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3920 | /*Make sure we are already in listen state*/ |
| 3921 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ |
| 3922 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3923 | u8remain_on_chan_flag = false; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3924 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3925 | strWID.enuWIDtype = WID_STR; |
| 3926 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3927 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3928 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3929 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3930 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3931 | |
| 3932 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
| 3933 | strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; |
| 3934 | |
| 3935 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 3936 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 3937 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3938 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3939 | PRINT_ER("Failed to set remain on channel\n"); |
| 3940 | goto _done_; |
| 3941 | } |
| 3942 | |
| 3943 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 3944 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid |
| 3945 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 3946 | } |
| 3947 | P2P_LISTEN_STATE = 0; |
| 3948 | } else { |
| 3949 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3950 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3951 | } |
| 3952 | |
| 3953 | _done_: |
| 3954 | return s32Error; |
| 3955 | } |
| 3956 | |
| 3957 | |
| 3958 | /** |
| 3959 | * @brief ListenTimerCB |
| 3960 | * @details Callback function of remain-on-channel timer |
| 3961 | * @param[in] NONE |
| 3962 | * @return Error code. |
| 3963 | * @author |
| 3964 | * @date |
| 3965 | * @version 1.0 |
| 3966 | */ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3967 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3968 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3969 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3970 | struct host_if_msg msg; |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3971 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3972 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3973 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3974 | |
| 3975 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3976 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3977 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3978 | msg.drvHandler = pstrWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 3979 | msg.body.strHostIfRemainOnChan.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3980 | |
| 3981 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3982 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3983 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3984 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3985 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3986 | |
| 3987 | /** |
| 3988 | * @brief Handle_EditStation |
| 3989 | * @details Sending config packet to edit station |
| 3990 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3991 | * @return NONE |
| 3992 | * @author |
| 3993 | * @date |
| 3994 | * @version 1.0 |
| 3995 | */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 3996 | static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, |
| 3997 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3998 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3999 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4000 | tstrWID strWID; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4001 | s8 s8PowerMode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4002 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4003 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4004 | strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4005 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4006 | if (strPowerMgmtParam->bIsEnabled == true) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4007 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4008 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4009 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4010 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
| 4011 | strWID.ps8WidVal = &s8PowerMode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4012 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4013 | |
| 4014 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 4015 | |
| 4016 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4017 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4018 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4019 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4020 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4021 | } |
| 4022 | |
| 4023 | /** |
| 4024 | * @brief Handle_SetMulticastFilter |
| 4025 | * @details Set Multicast filter in firmware |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 4026 | * @param[in] struct set_multicast *strHostIfSetMulti |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4027 | * @return NONE |
| 4028 | * @author asobhy |
| 4029 | * @date |
| 4030 | * @version 1.0 |
| 4031 | */ |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 4032 | static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, |
| 4033 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4034 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4035 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4036 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4037 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4038 | |
| 4039 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 4040 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4041 | strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4042 | strWID.enuWIDtype = WID_BIN; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 4043 | strWID.s32ValueSize = sizeof(struct set_multicast) + ((strHostIfSetMulti->u32count) * ETH_ALEN); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4044 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4045 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4046 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4047 | |
| 4048 | pu8CurrByte = strWID.ps8WidVal; |
| 4049 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); |
| 4050 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); |
| 4051 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); |
| 4052 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); |
| 4053 | |
| 4054 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); |
| 4055 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); |
| 4056 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); |
| 4057 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); |
| 4058 | |
| 4059 | if ((strHostIfSetMulti->u32count) > 0) |
| 4060 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); |
| 4061 | |
| 4062 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4063 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, false, |
| 4064 | get_id_from_handler(drvHandler)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4065 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4066 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4067 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4068 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 4069 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4070 | |
| 4071 | } |
| 4072 | |
| 4073 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4074 | /** |
| 4075 | * @brief Handle_AddBASession |
| 4076 | * @details Add block ack session |
| 4077 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4078 | * @return NONE |
| 4079 | * @author Amr Abdel-Moghny |
| 4080 | * @date Feb. 2014 |
| 4081 | * @version 9.0 |
| 4082 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4083 | static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4084 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4085 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4086 | tstrWID strWID; |
| 4087 | int AddbaTimeout = 100; |
| 4088 | char *ptr = NULL; |
| 4089 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4090 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4091 | 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] | 4092 | strHostIfBASessionInfo->au8Bssid[0], |
| 4093 | strHostIfBASessionInfo->au8Bssid[1], |
| 4094 | strHostIfBASessionInfo->au8Bssid[2], |
| 4095 | strHostIfBASessionInfo->u16BufferSize, |
| 4096 | strHostIfBASessionInfo->u16SessionTimeout, |
| 4097 | strHostIfBASessionInfo->u8Ted); |
| 4098 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4099 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4100 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4101 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4102 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4103 | ptr = strWID.ps8WidVal; |
| 4104 | /* *ptr++ = 0x14; */ |
| 4105 | *ptr++ = 0x14; |
| 4106 | *ptr++ = 0x3; |
| 4107 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4108 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4109 | ptr += ETH_ALEN; |
| 4110 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4111 | /* BA Policy*/ |
| 4112 | *ptr++ = 1; |
| 4113 | /* Buffer size*/ |
| 4114 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4115 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
| 4116 | /* BA timeout*/ |
| 4117 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 4118 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4119 | /* ADDBA timeout*/ |
| 4120 | *ptr++ = (AddbaTimeout & 0xFF); |
| 4121 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
| 4122 | /* Group Buffer Max Frames*/ |
| 4123 | *ptr++ = 8; |
| 4124 | /* Group Buffer Timeout */ |
| 4125 | *ptr++ = 0; |
| 4126 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4127 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4128 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4129 | if (s32Error) |
| 4130 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 4131 | |
| 4132 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4133 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4134 | strWID.enuWIDtype = WID_STR; |
| 4135 | strWID.s32ValueSize = 15; |
| 4136 | ptr = strWID.ps8WidVal; |
| 4137 | /* *ptr++ = 0x14; */ |
| 4138 | *ptr++ = 15; |
| 4139 | *ptr++ = 7; |
| 4140 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4141 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4142 | ptr += ETH_ALEN; |
| 4143 | /* TID*/ |
| 4144 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4145 | /* Max Num MSDU */ |
| 4146 | *ptr++ = 8; |
| 4147 | /* BA timeout*/ |
| 4148 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 4149 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 4150 | /*Ack-Policy */ |
| 4151 | *ptr++ = 3; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4152 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4153 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4154 | |
| 4155 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4156 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4157 | |
| 4158 | return s32Error; |
| 4159 | |
| 4160 | } |
| 4161 | |
| 4162 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4163 | /** |
| 4164 | * @brief Handle_DelBASession |
| 4165 | * @details Delete block ack session |
| 4166 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4167 | * @return NONE |
| 4168 | * @author Amr Abdel-Moghny |
| 4169 | * @date Feb. 2013 |
| 4170 | * @version 9.0 |
| 4171 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4172 | static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4173 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4174 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4175 | tstrWID strWID; |
| 4176 | char *ptr = NULL; |
| 4177 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4178 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4179 | 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] | 4180 | strHostIfBASessionInfo->au8Bssid[0], |
| 4181 | strHostIfBASessionInfo->au8Bssid[1], |
| 4182 | strHostIfBASessionInfo->au8Bssid[2], |
| 4183 | strHostIfBASessionInfo->u8Ted); |
| 4184 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4185 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4186 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4187 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4188 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4189 | ptr = strWID.ps8WidVal; |
| 4190 | /* *ptr++ = 0x14; */ |
| 4191 | *ptr++ = 0x14; |
| 4192 | *ptr++ = 0x3; |
| 4193 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4194 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4195 | ptr += ETH_ALEN; |
| 4196 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4197 | /* BA direction = recipent*/ |
| 4198 | *ptr++ = 0; |
| 4199 | /* Delba Reason */ |
| 4200 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4201 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4202 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4203 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4204 | if (s32Error) |
| 4205 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4206 | |
| 4207 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4208 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4209 | strWID.enuWIDtype = WID_STR; |
| 4210 | strWID.s32ValueSize = 15; |
| 4211 | ptr = strWID.ps8WidVal; |
| 4212 | /* *ptr++ = 0x14; */ |
| 4213 | *ptr++ = 15; |
| 4214 | *ptr++ = 7; |
| 4215 | *ptr++ = 0x3; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4216 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4217 | ptr += ETH_ALEN; |
| 4218 | /* TID*/ |
| 4219 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4220 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4221 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4222 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4223 | |
| 4224 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4225 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4226 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4227 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4228 | |
| 4229 | return s32Error; |
| 4230 | |
| 4231 | } |
| 4232 | |
| 4233 | |
| 4234 | /** |
| 4235 | * @brief Handle_DelAllRxBASessions |
| 4236 | * @details Delete all Rx BA sessions |
| 4237 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 4238 | * @return NONE |
| 4239 | * @author Abdelrahman Sobhy |
| 4240 | * @date Feb. 2013 |
| 4241 | * @version 9.0 |
| 4242 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 4243 | static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, tstrHostIfBASessionInfo *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4244 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4245 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4246 | tstrWID strWID; |
| 4247 | char *ptr = NULL; |
| 4248 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 4249 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4250 | 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] | 4251 | strHostIfBASessionInfo->au8Bssid[0], |
| 4252 | strHostIfBASessionInfo->au8Bssid[1], |
| 4253 | strHostIfBASessionInfo->au8Bssid[2], |
| 4254 | strHostIfBASessionInfo->u8Ted); |
| 4255 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4256 | strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4257 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4258 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4259 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 4260 | ptr = strWID.ps8WidVal; |
| 4261 | *ptr++ = 0x14; |
| 4262 | *ptr++ = 0x3; |
| 4263 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4264 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4265 | ptr += ETH_ALEN; |
| 4266 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 4267 | /* BA direction = recipent*/ |
| 4268 | *ptr++ = 0; |
| 4269 | /* Delba Reason */ |
| 4270 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 4271 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4272 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 4273 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4274 | if (s32Error) |
| 4275 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 4276 | |
| 4277 | |
| 4278 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 4279 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4280 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4281 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4282 | |
| 4283 | return s32Error; |
| 4284 | |
| 4285 | } |
| 4286 | |
| 4287 | /** |
| 4288 | * @brief hostIFthread |
| 4289 | * @details Main thread to handle message queue requests |
| 4290 | * @param[in] void* pvArg |
| 4291 | * @return NONE |
| 4292 | * @author |
| 4293 | * @date |
| 4294 | * @version 1.0 |
| 4295 | */ |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4296 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4297 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4298 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4299 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4300 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 4301 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4302 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4303 | |
| 4304 | while (1) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4305 | wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), &u32Ret); |
| 4306 | pstrWFIDrv = (tstrWILC_WFIDrv *)msg.drvHandler; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4307 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4308 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 4309 | break; |
| 4310 | } |
| 4311 | |
| 4312 | |
| 4313 | /*Re-Queue HIF message*/ |
| 4314 | if ((!g_wilc_initialized)) { |
| 4315 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4316 | usleep_range(200 * 1000, 200 * 1000); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4317 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4318 | continue; |
| 4319 | } |
| 4320 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4321 | if (msg.id == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4322 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4323 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4324 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4325 | continue; |
| 4326 | } |
| 4327 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4328 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4329 | case HOST_IF_MSG_Q_IDLE: |
| 4330 | Handle_wait_msg_q_empty(); |
| 4331 | break; |
| 4332 | |
| 4333 | case HOST_IF_MSG_SCAN: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4334 | Handle_Scan(msg.drvHandler, &msg.body.strHostIFscanAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4335 | break; |
| 4336 | |
| 4337 | case HOST_IF_MSG_CONNECT: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4338 | Handle_Connect(msg.drvHandler, &msg.body.strHostIFconnectAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4339 | break; |
| 4340 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4341 | case HOST_IF_MSG_FLUSH_CONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4342 | Handle_FlushConnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4343 | break; |
| 4344 | |
| 4345 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4346 | Handle_RcvdNtwrkInfo(msg.drvHandler, &msg.body.strRcvdNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4347 | break; |
| 4348 | |
| 4349 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4350 | Handle_RcvdGnrlAsyncInfo(msg.drvHandler, &msg.body.strRcvdGnrlAsyncInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4351 | break; |
| 4352 | |
| 4353 | case HOST_IF_MSG_KEY: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4354 | Handle_Key(msg.drvHandler, &msg.body.strHostIFkeyAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4355 | break; |
| 4356 | |
| 4357 | case HOST_IF_MSG_CFG_PARAMS: |
| 4358 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4359 | Handle_CfgParam(msg.drvHandler, &msg.body.strHostIFCfgParamAttr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4360 | break; |
| 4361 | |
| 4362 | case HOST_IF_MSG_SET_CHANNEL: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4363 | Handle_SetChannel(msg.drvHandler, &msg.body.strHostIFSetChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4364 | break; |
| 4365 | |
| 4366 | case HOST_IF_MSG_DISCONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4367 | Handle_Disconnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4368 | break; |
| 4369 | |
| 4370 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 4371 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4372 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 4373 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4374 | /*Allow chip sleep, only if both interfaces are not connected*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4375 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4376 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4377 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4378 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4379 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4380 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4381 | Handle_RemainOnChan(msg.drvHandler, &msg.body.strHostIfRemainOnChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4382 | |
| 4383 | break; |
| 4384 | |
| 4385 | case HOST_IF_MSG_GET_RSSI: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4386 | Handle_GetRssi(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4387 | break; |
| 4388 | |
| 4389 | case HOST_IF_MSG_GET_LINKSPEED: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4390 | Handle_GetLinkspeed(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4391 | break; |
| 4392 | |
| 4393 | case HOST_IF_MSG_GET_STATISTICS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4394 | Handle_GetStatistics(msg.drvHandler, (tstrStatistics *)msg.body.pUserData); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4395 | break; |
| 4396 | |
| 4397 | case HOST_IF_MSG_GET_CHNL: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4398 | Handle_GetChnl(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4399 | break; |
| 4400 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4401 | case HOST_IF_MSG_ADD_BEACON: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4402 | Handle_AddBeacon(msg.drvHandler, &msg.body.strHostIFSetBeacon); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4403 | break; |
| 4404 | |
| 4405 | case HOST_IF_MSG_DEL_BEACON: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4406 | Handle_DelBeacon(msg.drvHandler, &msg.body.strHostIFDelBeacon); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4407 | break; |
| 4408 | |
| 4409 | case HOST_IF_MSG_ADD_STATION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4410 | Handle_AddStation(msg.drvHandler, &msg.body.strAddStaParam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4411 | break; |
| 4412 | |
| 4413 | case HOST_IF_MSG_DEL_STATION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4414 | Handle_DelStation(msg.drvHandler, &msg.body.strDelStaParam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4415 | break; |
| 4416 | |
| 4417 | case HOST_IF_MSG_EDIT_STATION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4418 | Handle_EditStation(msg.drvHandler, &msg.body.strEditStaParam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4419 | break; |
| 4420 | |
| 4421 | case HOST_IF_MSG_GET_INACTIVETIME: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4422 | Handle_Get_InActiveTime(msg.drvHandler, &msg.body.strHostIfStaInactiveT); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4423 | break; |
| 4424 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4425 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 4426 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 4427 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4428 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4429 | break; |
| 4430 | |
| 4431 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4432 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4433 | Handle_ConnectTimeout(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4434 | break; |
| 4435 | |
| 4436 | case HOST_IF_MSG_POWER_MGMT: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4437 | Handle_PowerManagement(msg.drvHandler, &msg.body.strPowerMgmtparam); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4438 | break; |
| 4439 | |
| 4440 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4441 | Handle_SetWfiDrvHandler(msg.drvHandler, |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4442 | &msg.body.strHostIfSetDrvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4443 | break; |
| 4444 | |
| 4445 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4446 | Handle_SetOperationMode(msg.drvHandler, &msg.body.strHostIfSetOperationMode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4447 | break; |
| 4448 | |
| 4449 | case HOST_IF_MSG_SET_IPADDRESS: |
| 4450 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4451 | 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] | 4452 | break; |
| 4453 | |
| 4454 | case HOST_IF_MSG_GET_IPADDRESS: |
| 4455 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4456 | 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] | 4457 | break; |
| 4458 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4459 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4460 | Handle_SetMacAddress(msg.drvHandler, &msg.body.strHostIfSetMacAddress); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4461 | break; |
| 4462 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4463 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4464 | Handle_GetMacAddress(msg.drvHandler, &msg.body.strHostIfGetMacAddress); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4465 | break; |
| 4466 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4467 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 4468 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4469 | Handle_RemainOnChan(msg.drvHandler, &msg.body.strHostIfRemainOnChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4470 | break; |
| 4471 | |
| 4472 | case HOST_IF_MSG_REGISTER_FRAME: |
| 4473 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4474 | Handle_RegisterFrame(msg.drvHandler, &msg.body.strHostIfRegisterFrame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4475 | break; |
| 4476 | |
| 4477 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4478 | Handle_ListenStateExpired(msg.drvHandler, &msg.body.strHostIfRemainOnChan); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4479 | break; |
| 4480 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4481 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 4482 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4483 | Handle_SetMulticastFilter(msg.drvHandler, &msg.body.strHostIfSetMulti); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4484 | break; |
| 4485 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4486 | case HOST_IF_MSG_ADD_BA_SESSION: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4487 | Handle_AddBASession(msg.drvHandler, &msg.body.strHostIfBASessionInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4488 | break; |
| 4489 | |
| 4490 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4491 | Handle_DelAllRxBASessions(msg.drvHandler, &msg.body.strHostIfBASessionInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4492 | break; |
| 4493 | |
| 4494 | case HOST_IF_MSG_DEL_ALL_STA: |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4495 | Handle_DelAllSta(msg.drvHandler, &msg.body.strHostIFDelAllSta); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4496 | break; |
| 4497 | |
| 4498 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4499 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4500 | break; |
| 4501 | } |
| 4502 | } |
| 4503 | |
| 4504 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4505 | up(&hSemHostIFthrdEnd); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4506 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4507 | } |
| 4508 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4509 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4510 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4511 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4512 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4513 | |
| 4514 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4515 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4516 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4517 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4518 | |
| 4519 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4520 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4521 | } |
| 4522 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4523 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4524 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4525 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4526 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4527 | |
| 4528 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4529 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4530 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4531 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4532 | |
| 4533 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4534 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4535 | } |
| 4536 | |
| 4537 | |
| 4538 | /** |
| 4539 | * @brief removes wpa/wpa2 keys |
| 4540 | * @details only in BSS STA mode if External Supplicant support is enabled. |
| 4541 | * removes all WPA/WPA2 station key entries from MAC hardware. |
| 4542 | * @param[in,out] handle to the wifi driver |
| 4543 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4544 | * @return Error code indicating success/failure |
| 4545 | * @note |
| 4546 | * @author zsalah |
| 4547 | * @date 8 March 2012 |
| 4548 | * @version 1.0 |
| 4549 | */ |
| 4550 | /* Check implementation in core adding 9 bytes to the input! */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4551 | s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4552 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4553 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4554 | tstrWID strWID; |
| 4555 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4556 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4557 | strWID.u16WIDid = (u16)WID_REMOVE_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4558 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4559 | strWID.ps8WidVal = (s8 *)pu8StaAddress; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4560 | strWID.s32ValueSize = 6; |
| 4561 | |
| 4562 | return s32Error; |
| 4563 | |
| 4564 | } |
| 4565 | |
| 4566 | /** |
| 4567 | * @brief removes WEP key |
| 4568 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4569 | * remove a WEP key entry from MAC HW. |
| 4570 | * The BSS Station automatically finds the index of the entry using its |
| 4571 | * BSS ID and removes that entry from the MAC hardware. |
| 4572 | * @param[in,out] handle to the wifi driver |
| 4573 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4574 | * @return Error code indicating success/failure |
| 4575 | * @note NO need for the STA add since it is not used for processing |
| 4576 | * @author zsalah |
| 4577 | * @date 8 March 2012 |
| 4578 | * @version 1.0 |
| 4579 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4580 | s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4581 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4582 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4583 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4584 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4585 | |
| 4586 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4587 | if (pstrWFIDrv == NULL) { |
| 4588 | s32Error = -EFAULT; |
| 4589 | PRINT_ER("Failed to send setup multicast config packet\n"); |
| 4590 | return s32Error; |
| 4591 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4592 | |
| 4593 | /* prepare the Remove Wep Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4594 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4595 | |
| 4596 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4597 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4598 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4599 | msg.body.strHostIFkeyAttr.u8KeyAction = REMOVEKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4600 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4601 | |
| 4602 | |
| 4603 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4604 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4605 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; |
| 4606 | |
| 4607 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4608 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4609 | if (s32Error) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4610 | 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] | 4611 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4612 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4613 | return s32Error; |
| 4614 | } |
| 4615 | |
| 4616 | /** |
| 4617 | * @brief sets WEP default key |
| 4618 | * @details Sets the index of the WEP encryption key in use, |
| 4619 | * in the key table |
| 4620 | * @param[in,out] handle to the wifi driver |
| 4621 | * @param[in] key index ( 0, 1, 2, 3) |
| 4622 | * @return Error code indicating success/failure |
| 4623 | * @note |
| 4624 | * @author zsalah |
| 4625 | * @date 8 March 2012 |
| 4626 | * @version 1.0 |
| 4627 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4628 | s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4629 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4630 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4631 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4632 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4633 | |
| 4634 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4635 | if (pstrWFIDrv == NULL) { |
| 4636 | s32Error = -EFAULT; |
| 4637 | PRINT_ER("driver is null\n"); |
| 4638 | return s32Error; |
| 4639 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4640 | |
| 4641 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4642 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4643 | |
| 4644 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4645 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4646 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4647 | msg.body.strHostIFkeyAttr.u8KeyAction = DEFAULTKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4648 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4649 | |
| 4650 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4651 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4652 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; |
| 4653 | |
| 4654 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4655 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4656 | if (s32Error) |
| 4657 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4658 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4659 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4660 | return s32Error; |
| 4661 | } |
| 4662 | |
| 4663 | /** |
| 4664 | * @brief sets WEP deafault key |
| 4665 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4666 | * sets WEP key entry into MAC hardware when it receives the |
| 4667 | * corresponding request from NDIS. |
| 4668 | * @param[in,out] handle to the wifi driver |
| 4669 | * @param[in] message containing WEP Key in the following format |
| 4670 | *|---------------------------------------| |
| 4671 | *|Key ID Value | Key Length | Key | |
| 4672 | *|-------------|------------|------------| |
| 4673 | | 1byte | 1byte | Key Length | |
| 4674 | ||---------------------------------------| |
| 4675 | | |
| 4676 | * @return Error code indicating success/failure |
| 4677 | * @note |
| 4678 | * @author zsalah |
| 4679 | * @date 8 March 2012 |
| 4680 | * @version 1.0 |
| 4681 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4682 | 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] | 4683 | { |
| 4684 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4685 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4686 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4687 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4688 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4689 | if (pstrWFIDrv == NULL) { |
| 4690 | s32Error = -EFAULT; |
| 4691 | PRINT_ER("driver is null\n"); |
| 4692 | return s32Error; |
| 4693 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4694 | |
| 4695 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4696 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4697 | |
| 4698 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4699 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4700 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4701 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4702 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4703 | |
| 4704 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4705 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4706 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4707 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4708 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4709 | pu8WepKey, u8WepKeylen); |
| 4710 | |
| 4711 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4712 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4713 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4714 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4715 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4716 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4717 | |
| 4718 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4719 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4720 | if (s32Error) |
| 4721 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4722 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4723 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4724 | return s32Error; |
| 4725 | |
| 4726 | } |
| 4727 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4728 | /** |
| 4729 | * |
| 4730 | * @brief host_int_add_wep_key_bss_ap |
| 4731 | * @details valid only in BSS AP mode if External Supplicant support is enabled. |
| 4732 | * sets WEP key entry into MAC hardware when it receives the |
| 4733 | * |
| 4734 | * corresponding request from NDIS. |
| 4735 | * @param[in,out] handle to the wifi driver |
| 4736 | * |
| 4737 | * |
| 4738 | * @return Error code indicating success/failure |
| 4739 | * @note |
| 4740 | * @author mdaftedar |
| 4741 | * @date 28 FEB 2013 |
| 4742 | * @version 1.0 |
| 4743 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4744 | 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] | 4745 | { |
| 4746 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4747 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4748 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4749 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4750 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4751 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4752 | if (pstrWFIDrv == NULL) { |
| 4753 | s32Error = -EFAULT; |
| 4754 | PRINT_ER("driver is null\n"); |
| 4755 | return s32Error; |
| 4756 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4757 | |
| 4758 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4759 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4760 | |
| 4761 | if (INFO) { |
| 4762 | for (i = 0; i < u8WepKeylen; i++) |
| 4763 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 4764 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4765 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4766 | msg.body.strHostIFkeyAttr.enuKeyType = WEP; |
| 4767 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4768 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4769 | |
| 4770 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4771 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4772 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4773 | |
| 4774 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4775 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4776 | pu8WepKey, (u8WepKeylen)); |
| 4777 | |
| 4778 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4779 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4780 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4781 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4782 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4783 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4784 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4785 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4786 | uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode; |
| 4787 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4788 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4789 | uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; |
| 4790 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4791 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4792 | |
| 4793 | if (s32Error) |
| 4794 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4795 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4796 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4797 | return s32Error; |
| 4798 | |
| 4799 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4800 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4801 | /** |
| 4802 | * @brief adds ptk Key |
| 4803 | * @details |
| 4804 | * @param[in,out] handle to the wifi driver |
| 4805 | * @param[in] message containing PTK Key in the following format |
| 4806 | *|-----------------------------------------------------------------------------| |
| 4807 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 4808 | *|----------------|------------|--------------|----------------|---------------| |
| 4809 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 4810 | ||-----------------------------------------------------------------------------| |
| 4811 | * @return Error code indicating success/failure |
| 4812 | * @note |
| 4813 | * @author zsalah |
| 4814 | * @date 8 March 2012 |
| 4815 | * @version 1.0 |
| 4816 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4817 | 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] | 4818 | 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] | 4819 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4820 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4821 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4822 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4823 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4824 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4825 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4826 | if (pstrWFIDrv == NULL) { |
| 4827 | s32Error = -EFAULT; |
| 4828 | PRINT_ER("driver is null\n"); |
| 4829 | return s32Error; |
| 4830 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4831 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4832 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4833 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4834 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4835 | |
| 4836 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4837 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4838 | |
| 4839 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4840 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4841 | msg.body.strHostIFkeyAttr.enuKeyType = WPAPtk; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4842 | if (mode == AP_MODE) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4843 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4844 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4845 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx; |
| 4846 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4847 | if (mode == STATION_MODE) |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4848 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4849 | |
| 4850 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4851 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4852 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4853 | |
| 4854 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4855 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4856 | pu8Ptk, u8PtkKeylen); |
| 4857 | |
| 4858 | if (pu8RxMic != NULL) { |
| 4859 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4860 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4861 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4862 | if (INFO) { |
| 4863 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 4864 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 4865 | } |
| 4866 | } |
| 4867 | if (pu8TxMic != NULL) { |
| 4868 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4869 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4870 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4871 | if (INFO) { |
| 4872 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 4873 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 4874 | } |
| 4875 | } |
| 4876 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4877 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4878 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4879 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4880 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4881 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4882 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4883 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4884 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4885 | |
| 4886 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4887 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4888 | |
| 4889 | if (s32Error) |
| 4890 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 4891 | |
| 4892 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4893 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4894 | /* /////// */ |
| 4895 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4896 | return s32Error; |
| 4897 | } |
| 4898 | |
| 4899 | /** |
| 4900 | * @brief adds Rx GTk Key |
| 4901 | * @details |
| 4902 | * @param[in,out] handle to the wifi driver |
| 4903 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic |
| 4904 | * u8GtkKeylen :The total key length |
| 4905 | * |
| 4906 | * @return Error code indicating success/failure |
| 4907 | * @note |
| 4908 | * @author zsalah |
| 4909 | * @date 8 March 2012 |
| 4910 | * @version 1.0 |
| 4911 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4912 | 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] | 4913 | u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4914 | const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4915 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4916 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4917 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4918 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4919 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4920 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4921 | if (pstrWFIDrv == NULL) { |
| 4922 | s32Error = -EFAULT; |
| 4923 | PRINT_ER("driver is null\n"); |
| 4924 | return s32Error; |
| 4925 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4926 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4927 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4928 | |
| 4929 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4930 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4931 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4932 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4933 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4934 | if (KeyRSC != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4935 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4936 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4937 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4938 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4939 | KeyRSC, u32KeyRSClen); |
| 4940 | } |
| 4941 | |
| 4942 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4943 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4944 | msg.body.strHostIFkeyAttr.enuKeyType = WPARxGtk; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4945 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4946 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4947 | if (mode == AP_MODE) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4948 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY_AP; |
| 4949 | msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4950 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4951 | if (mode == STATION_MODE) |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4952 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4953 | |
| 4954 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4955 | msg.body.strHostIFkeyAttr. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4956 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8KeyLen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4957 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4958 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4959 | pu8RxGtk, u8GtkKeylen); |
| 4960 | |
| 4961 | if (pu8RxMic != NULL) { |
| 4962 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4963 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4964 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4965 | |
| 4966 | } |
| 4967 | if (pu8TxMic != NULL) { |
| 4968 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4969 | memcpy(msg.body.strHostIFkeyAttr.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4970 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4971 | |
| 4972 | } |
| 4973 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4974 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4975 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4976 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4977 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4978 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 4979 | msg.body.strHostIFkeyAttr. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4980 | uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen; |
| 4981 | |
| 4982 | |
| 4983 | |
| 4984 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4985 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4986 | if (s32Error) |
| 4987 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
| 4988 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4989 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4990 | /* /////// */ |
| 4991 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4992 | return s32Error; |
| 4993 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4994 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4995 | /** |
| 4996 | * @brief host_int_set_pmkid_info |
| 4997 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant |
| 4998 | * support is enabled. This Function sets the PMKID in firmware |
| 4999 | * when host drivr receives the corresponding request from NDIS. |
| 5000 | * The firmware then includes theset PMKID in the appropriate |
| 5001 | * management frames |
| 5002 | * @param[in,out] handle to the wifi driver |
| 5003 | * @param[in] message containing PMKID Info in the following format |
| 5004 | *|-----------------------------------------------------------------| |
| 5005 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 5006 | *|-----------|------------|----------|-------|----------|----------| |
| 5007 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 5008 | ||-----------------------------------------------------------------| |
| 5009 | * @return Error code indicating success/failure |
| 5010 | * @note |
| 5011 | * @author zsalah |
| 5012 | * @date 8 March 2012 |
| 5013 | * @version 1.0 |
| 5014 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5015 | s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, tstrHostIFpmkidAttr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5016 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5017 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5018 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5019 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5020 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5021 | |
| 5022 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5023 | if (pstrWFIDrv == NULL) { |
| 5024 | s32Error = -EFAULT; |
| 5025 | PRINT_ER("driver is null\n"); |
| 5026 | return s32Error; |
| 5027 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5028 | |
| 5029 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5030 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5031 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5032 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5033 | msg.body.strHostIFkeyAttr.enuKeyType = PMKSA; |
| 5034 | msg.body.strHostIFkeyAttr.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5035 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5036 | |
| 5037 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
| 5038 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5039 | 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] | 5040 | ETH_ALEN); |
| 5041 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5042 | 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] | 5043 | PMKID_LEN); |
| 5044 | } |
| 5045 | |
| 5046 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5047 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5048 | if (s32Error) |
| 5049 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 5050 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5051 | return s32Error; |
| 5052 | } |
| 5053 | |
| 5054 | /** |
| 5055 | * @brief gets the cached the pmkid info |
| 5056 | * @details valid only in BSS STA mode if External Supplicant |
| 5057 | * support is enabled. This Function sets the PMKID in firmware |
| 5058 | * when host drivr receives the corresponding request from NDIS. |
| 5059 | * The firmware then includes theset PMKID in the appropriate |
| 5060 | * management frames |
| 5061 | * @param[in,out] handle to the wifi driver, |
| 5062 | * message containing PMKID Info in the following format |
| 5063 | *|-----------------------------------------------------------------| |
| 5064 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 5065 | *|-----------|------------|----------|-------|----------|----------| |
| 5066 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 5067 | ||-----------------------------------------------------------------| |
| 5068 | * @param[in] |
| 5069 | * @return Error code indicating success/failure |
| 5070 | * @note |
| 5071 | * @author zsalah |
| 5072 | * @date 8 March 2012 |
| 5073 | * @version 1.0 |
| 5074 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5075 | s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5076 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5077 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5078 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5079 | tstrWID strWID; |
| 5080 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5081 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5082 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5083 | strWID.enuWIDtype = WID_STR; |
| 5084 | strWID.s32ValueSize = u32PmkidInfoLen; |
| 5085 | strWID.ps8WidVal = pu8PmkidInfoArray; |
| 5086 | |
| 5087 | return s32Error; |
| 5088 | } |
| 5089 | |
| 5090 | /** |
| 5091 | * @brief sets the pass phrase |
| 5092 | * @details AP/STA mode. This function gives the pass phrase used to |
| 5093 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5094 | * The length of the field can vary from 8 to 64 bytes, |
| 5095 | * the lower layer should get the |
| 5096 | * @param[in,out] handle to the wifi driver, |
| 5097 | * @param[in] String containing PSK |
| 5098 | * @return Error code indicating success/failure |
| 5099 | * @note |
| 5100 | * @author zsalah |
| 5101 | * @date 8 March 2012 |
| 5102 | * @version 1.0 |
| 5103 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5104 | s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5105 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5106 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5107 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5108 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5109 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5110 | /*validating psk length*/ |
| 5111 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5112 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5113 | strWID.enuWIDtype = WID_STR; |
| 5114 | strWID.ps8WidVal = pu8PassPhrase; |
| 5115 | strWID.s32ValueSize = u8Psklength; |
| 5116 | } |
| 5117 | |
| 5118 | return s32Error; |
| 5119 | } |
| 5120 | /** |
| 5121 | * @brief host_int_get_MacAddress |
| 5122 | * @details gets mac address |
| 5123 | * @param[in,out] handle to the wifi driver, |
| 5124 | * |
| 5125 | * @return Error code indicating success/failure |
| 5126 | * @note |
| 5127 | * @author mdaftedar |
| 5128 | * @date 19 April 2012 |
| 5129 | * @version 1.0 |
| 5130 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5131 | s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5132 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5133 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5134 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5135 | |
| 5136 | |
| 5137 | /* prepare the Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5138 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5139 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5140 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5141 | msg.body.strHostIfGetMacAddress.u8MacAddress = pu8MacAddress; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5142 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5143 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5144 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5145 | if (s32Error) { |
| 5146 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5147 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5148 | } |
| 5149 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5150 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5151 | return s32Error; |
| 5152 | } |
| 5153 | |
| 5154 | /** |
| 5155 | * @brief host_int_set_MacAddress |
| 5156 | * @details sets mac address |
| 5157 | * @param[in,out] handle to the wifi driver, |
| 5158 | * |
| 5159 | * @return Error code indicating success/failure |
| 5160 | * @note |
| 5161 | * @author mabubakr |
| 5162 | * @date 16 July 2012 |
| 5163 | * @version 1.0 |
| 5164 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5165 | s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5166 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5167 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5168 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5169 | |
| 5170 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 5171 | |
| 5172 | /* prepare setting mac address message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5173 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5174 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5175 | memcpy(msg.body.strHostIfSetMacAddress.u8MacAddress, pu8MacAddress, ETH_ALEN); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5176 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5177 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5178 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5179 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5180 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5181 | |
| 5182 | return s32Error; |
| 5183 | |
| 5184 | } |
| 5185 | |
| 5186 | /** |
| 5187 | * @brief host_int_get_RSNAConfigPSKPassPhrase |
| 5188 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to |
| 5189 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 5190 | * The length of the field can vary from 8 to 64 bytes, |
| 5191 | * the lower layer should get the |
| 5192 | * @param[in,out] handle to the wifi driver, |
| 5193 | * String containing PSK |
| 5194 | * @return Error code indicating success/failure |
| 5195 | * @note |
| 5196 | * @author zsalah |
| 5197 | * @date 8 March 2012 |
| 5198 | * @version 1.0 |
| 5199 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5200 | s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5201 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5202 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5203 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5204 | tstrWID strWID; |
| 5205 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5206 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5207 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5208 | strWID.enuWIDtype = WID_STR; |
| 5209 | strWID.s32ValueSize = u8Psklength; |
| 5210 | strWID.ps8WidVal = pu8PassPhrase; |
| 5211 | |
| 5212 | return s32Error; |
| 5213 | } |
| 5214 | |
| 5215 | /** |
| 5216 | * @brief host_int_get_site_survey_results |
| 5217 | * @details gets the site survey results |
| 5218 | * @param[in,out] handle to the wifi driver, |
| 5219 | * Message containing site survey results in the |
| 5220 | * following format |
| 5221 | *|---------------------------------------------------| |
| 5222 | | MsgLength | fragNo. | MsgBodyLength | MsgBody | |
| 5223 | ||-----------|-----------|---------------|-----------| |
| 5224 | | 1 | 1 | 1 | 1 | |
| 5225 | | ----------------------------------------- | ---------------- |
| 5226 | | |
| 5227 | ||---------------------------------------| |
| 5228 | | Network1 | Netweork2 | ... | Network5 | |
| 5229 | ||---------------------------------------| |
| 5230 | | 44 | 44 | ... | 44 | |
| 5231 | | -------------------------- | --------------------------------------- |
| 5232 | | |
| 5233 | ||---------------------------------------------------------------------| |
| 5234 | | SSID | BSS Type | Channel | Security Status| BSSID | RSSI |Reserved | |
| 5235 | | |
| 5236 | | |
| 5237 | ||------|----------|---------|----------------|-------|------|---------| |
| 5238 | | 33 | 1 | 1 | 1 | 6 | 1 | 1 | |
| 5239 | ||---------------------------------------------------------------------| |
| 5240 | * @return Error code indicating success/failure |
| 5241 | * @note |
| 5242 | * @author zsalah |
| 5243 | * @date 8 March 2012 |
| 5244 | * @version 1.0 |
| 5245 | */ |
| 5246 | #ifndef CONNECT_DIRECT |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5247 | s32 host_int_get_site_survey_results(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5248 | u8 ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZE], |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5249 | u32 u32MaxSiteSrvyFragLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5250 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5251 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5252 | tstrWID astrWIDList[2]; |
| 5253 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5254 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5255 | astrWIDList[0].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5256 | astrWIDList[0].enuWIDtype = WID_STR; |
| 5257 | astrWIDList[0].ps8WidVal = ppu8RcvdSiteSurveyResults[0]; |
| 5258 | astrWIDList[0].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5259 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5260 | astrWIDList[1].u16WIDid = (u16)WID_SITE_SURVEY_RESULTS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5261 | astrWIDList[1].enuWIDtype = WID_STR; |
| 5262 | astrWIDList[1].ps8WidVal = ppu8RcvdSiteSurveyResults[1]; |
| 5263 | astrWIDList[1].s32ValueSize = u32MaxSiteSrvyFragLen; |
| 5264 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5265 | s32Error = SendConfigPkt(GET_CFG, astrWIDList, 2, true, |
| 5266 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5267 | |
| 5268 | /*get the value by searching the local copy*/ |
| 5269 | if (s32Error) { |
| 5270 | PRINT_ER("Failed to send config packet to get survey results\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5271 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5272 | } |
| 5273 | |
| 5274 | return s32Error; |
| 5275 | } |
| 5276 | #endif |
| 5277 | |
| 5278 | /** |
| 5279 | * @brief sets a start scan request |
| 5280 | * @details |
| 5281 | * @param[in,out] handle to the wifi driver, |
| 5282 | * @param[in] Scan Source one of the following values |
| 5283 | * DEFAULT_SCAN 0 |
| 5284 | * USER_SCAN BIT0 |
| 5285 | * OBSS_PERIODIC_SCAN BIT1 |
| 5286 | * OBSS_ONETIME_SCAN BIT2 |
| 5287 | * @return Error code indicating success/failure |
| 5288 | * @note |
| 5289 | * @author zsalah |
| 5290 | * @date 8 March 2012 |
| 5291 | * @version 1.0 |
| 5292 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5293 | s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5294 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5295 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5296 | tstrWID strWID; |
| 5297 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5298 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5299 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5300 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5301 | strWID.ps8WidVal = (s8 *)&scanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5302 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5303 | |
| 5304 | return s32Error; |
| 5305 | } |
| 5306 | |
| 5307 | /** |
| 5308 | * @brief host_int_get_start_scan_req |
| 5309 | * @details gets a start scan request |
| 5310 | * @param[in,out] handle to the wifi driver, |
| 5311 | * @param[in] Scan Source one of the following values |
| 5312 | * DEFAULT_SCAN 0 |
| 5313 | * USER_SCAN BIT0 |
| 5314 | * OBSS_PERIODIC_SCAN BIT1 |
| 5315 | * OBSS_ONETIME_SCAN BIT2 |
| 5316 | * @return Error code indicating success/failure |
| 5317 | * @note |
| 5318 | * @author zsalah |
| 5319 | * @date 8 March 2012 |
| 5320 | * @version 1.0 |
| 5321 | */ |
| 5322 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5323 | s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5324 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5325 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5326 | tstrWID strWID; |
| 5327 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5328 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5329 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5330 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5331 | strWID.ps8WidVal = (s8 *)pu8ScanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5332 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5333 | |
| 5334 | return s32Error; |
| 5335 | } |
| 5336 | |
| 5337 | /** |
| 5338 | * @brief host_int_set_join_req |
| 5339 | * @details sets a join request |
| 5340 | * @param[in,out] handle to the wifi driver, |
| 5341 | * @param[in] Index of the bss descriptor |
| 5342 | * @return Error code indicating success/failure |
| 5343 | * @note |
| 5344 | * @author zsalah |
| 5345 | * @date 8 March 2012 |
| 5346 | * @version 1.0 |
| 5347 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5348 | s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 5349 | const u8 *pu8ssid, size_t ssidLen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5350 | const u8 *pu8IEs, size_t IEsLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5351 | tWILCpfConnectResult pfConnectResult, void *pvUserArg, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5352 | u8 u8security, AUTHTYPE_T tenuAuth_type, |
| 5353 | u8 u8channel, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5354 | void *pJoinParams) |
| 5355 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5356 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5357 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5358 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5359 | tenuScanConnTimer enuScanConnTimer; |
| 5360 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5361 | if (pstrWFIDrv == NULL || pfConnectResult == NULL) { |
| 5362 | s32Error = -EFAULT; |
| 5363 | PRINT_ER("Driver is null\n"); |
| 5364 | return s32Error; |
| 5365 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5366 | |
| 5367 | if (hWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5368 | PRINT_ER("Driver is null\n"); |
| 5369 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5370 | } |
| 5371 | |
| 5372 | if (pJoinParams == NULL) { |
| 5373 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5374 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5375 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5376 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5377 | /* prepare the Connect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5378 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5379 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5380 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5381 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5382 | msg.body.strHostIFconnectAttr.u8security = u8security; |
| 5383 | msg.body.strHostIFconnectAttr.tenuAuth_type = tenuAuth_type; |
| 5384 | msg.body.strHostIFconnectAttr.u8channel = u8channel; |
| 5385 | msg.body.strHostIFconnectAttr.pfConnectResult = pfConnectResult; |
| 5386 | msg.body.strHostIFconnectAttr.pvUserArg = pvUserArg; |
| 5387 | msg.body.strHostIFconnectAttr.pJoinParams = pJoinParams; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5388 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5389 | |
| 5390 | if (pu8bssid != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5391 | msg.body.strHostIFconnectAttr.pu8bssid = kmalloc(6, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5392 | memcpy(msg.body.strHostIFconnectAttr.pu8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5393 | pu8bssid, 6); |
| 5394 | } |
| 5395 | |
| 5396 | if (pu8ssid != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5397 | msg.body.strHostIFconnectAttr.ssidLen = ssidLen; |
| 5398 | msg.body.strHostIFconnectAttr.pu8ssid = kmalloc(ssidLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5399 | memcpy(msg.body.strHostIFconnectAttr.pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5400 | |
| 5401 | pu8ssid, ssidLen); |
| 5402 | } |
| 5403 | |
| 5404 | if (pu8IEs != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5405 | msg.body.strHostIFconnectAttr.IEsLen = IEsLen; |
| 5406 | msg.body.strHostIFconnectAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5407 | memcpy(msg.body.strHostIFconnectAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5408 | pu8IEs, IEsLen); |
| 5409 | } |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5410 | if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5411 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5412 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5413 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); |
| 5414 | |
| 5415 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5416 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5417 | if (s32Error) { |
| 5418 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5419 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5420 | } |
| 5421 | |
| 5422 | enuScanConnTimer = CONNECT_TIMER; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5423 | pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; |
| 5424 | mod_timer(&pstrWFIDrv->hConnectTimer, |
| 5425 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5426 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5427 | return s32Error; |
| 5428 | } |
| 5429 | |
| 5430 | /** |
| 5431 | * @brief Flush a join request parameters to FW, but actual connection |
| 5432 | * @details The function is called in situation where WILC is connected to AP and |
| 5433 | * required to switch to hybrid FW for P2P connection |
| 5434 | * @param[in] handle to the wifi driver, |
| 5435 | * @return Error code indicating success/failure |
| 5436 | * @note |
| 5437 | * @author Amr Abdel-Moghny |
| 5438 | * @date 19 DEC 2013 |
| 5439 | * @version 8.0 |
| 5440 | */ |
| 5441 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5442 | s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5443 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5444 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5445 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5446 | |
| 5447 | if (!gu8FlushedJoinReq) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5448 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5449 | return s32Error; |
| 5450 | } |
| 5451 | |
| 5452 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5453 | if (hWFIDrv == NULL) { |
| 5454 | s32Error = -EFAULT; |
| 5455 | PRINT_ER("Driver is null\n"); |
| 5456 | return s32Error; |
| 5457 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5458 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5459 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5460 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5461 | |
| 5462 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5463 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5464 | if (s32Error) { |
| 5465 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5466 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5467 | } |
| 5468 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5469 | return s32Error; |
| 5470 | } |
| 5471 | |
| 5472 | /** |
| 5473 | * @brief host_int_disconnect |
| 5474 | * @details disconnects from the currently associated network |
| 5475 | * @param[in,out] handle to the wifi driver, |
| 5476 | * @param[in] Reason Code of the Disconnection |
| 5477 | * @return Error code indicating success/failure |
| 5478 | * @note |
| 5479 | * @author zsalah |
| 5480 | * @date 8 March 2012 |
| 5481 | * @version 1.0 |
| 5482 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5483 | s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5484 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5485 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5486 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5487 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5488 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5489 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5490 | PRINT_ER("Driver is null\n"); |
| 5491 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5492 | } |
| 5493 | |
| 5494 | /* prepare the Disconnect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5495 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5496 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5497 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5498 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5499 | |
| 5500 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5501 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5502 | if (s32Error) |
| 5503 | PRINT_ER("Failed to send message queue: disconnect\n"); |
| 5504 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5505 | down(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5506 | /* /////// */ |
| 5507 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5508 | return s32Error; |
| 5509 | } |
| 5510 | |
| 5511 | /** |
| 5512 | * @brief host_int_disconnect_station |
| 5513 | * @details disconnects a sta |
| 5514 | * @param[in,out] handle to the wifi driver, |
| 5515 | * @param[in] Association Id of the station to be disconnected |
| 5516 | * @return Error code indicating success/failure |
| 5517 | * @note |
| 5518 | * @author zsalah |
| 5519 | * @date 8 March 2012 |
| 5520 | * @version 1.0 |
| 5521 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5522 | s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5523 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5524 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5525 | tstrWID strWID; |
| 5526 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5527 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5528 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5529 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5530 | strWID.ps8WidVal = (s8 *)&assoc_id; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5531 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5532 | |
| 5533 | return s32Error; |
| 5534 | } |
| 5535 | |
| 5536 | /** |
| 5537 | * @brief host_int_get_assoc_req_info |
| 5538 | * @details gets a Association request info |
| 5539 | * @param[in,out] handle to the wifi driver, |
| 5540 | * Message containg assoc. req info in the following format |
| 5541 | * ------------------------------------------------------------------------ |
| 5542 | | Management Frame Format | |
| 5543 | ||-------------------------------------------------------------------| |
| 5544 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | |
| 5545 | ||-------------|--------|--|--|-----|----------------|----------|----| |
| 5546 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | |
| 5547 | ||-------------------------------------------------------------------| |
| 5548 | | | |
| 5549 | | Association Request Frame - Frame Body | |
| 5550 | ||-------------------------------------------------------------------| |
| 5551 | | Capability Information | Listen Interval | SSID | Supported Rates | |
| 5552 | ||------------------------|-----------------|------|-----------------| |
| 5553 | | 2 | 2 | 2-34 | 3-10 | |
| 5554 | | --------------------------------------------------------------------- |
| 5555 | * @return Error code indicating success/failure |
| 5556 | * @note |
| 5557 | * @author zsalah |
| 5558 | * @date 8 March 2012 |
| 5559 | * @version 1.0 |
| 5560 | */ |
| 5561 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5562 | s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5563 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5564 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5565 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5566 | tstrWID strWID; |
| 5567 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5568 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5569 | strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5570 | strWID.enuWIDtype = WID_STR; |
| 5571 | strWID.ps8WidVal = pu8AssocReqInfo; |
| 5572 | strWID.s32ValueSize = u32AssocReqInfoLen; |
| 5573 | |
| 5574 | |
| 5575 | return s32Error; |
| 5576 | } |
| 5577 | |
| 5578 | /** |
| 5579 | * @brief gets a Association Response info |
| 5580 | * @details |
| 5581 | * @param[in,out] handle to the wifi driver, |
| 5582 | * Message containg assoc. resp info |
| 5583 | * @return Error code indicating success/failure |
| 5584 | * @note |
| 5585 | * @author zsalah |
| 5586 | * @date 8 March 2012 |
| 5587 | * @version 1.0 |
| 5588 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5589 | s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5590 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5591 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5592 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5593 | tstrWID strWID; |
| 5594 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5595 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5596 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5597 | PRINT_ER("Driver is null\n"); |
| 5598 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5599 | } |
| 5600 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5601 | strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5602 | strWID.enuWIDtype = WID_STR; |
| 5603 | strWID.ps8WidVal = pu8AssocRespInfo; |
| 5604 | strWID.s32ValueSize = u32MaxAssocRespInfoLen; |
| 5605 | |
| 5606 | |
| 5607 | /* Sending Configuration packet */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5608 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 5609 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5610 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5611 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5612 | PRINT_ER("Failed to send association response config packet\n"); |
| 5613 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5614 | } else { |
| 5615 | *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize; |
| 5616 | } |
| 5617 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5618 | return s32Error; |
| 5619 | } |
| 5620 | |
| 5621 | /** |
| 5622 | * @brief gets a Association Response info |
| 5623 | * @details Valid only in STA mode. This function gives the RSSI |
| 5624 | * values observed in all the channels at the time of scanning. |
| 5625 | * The length of the field is 1 greater that the total number of |
| 5626 | * channels supported. Byte 0 contains the number of channels while |
| 5627 | * each of Byte N contains the observed RSSI value for the channel index N. |
| 5628 | * @param[in,out] handle to the wifi driver, |
| 5629 | * array of scanned channels' RSSI |
| 5630 | * @return Error code indicating success/failure |
| 5631 | * @note |
| 5632 | * @author zsalah |
| 5633 | * @date 8 March 2012 |
| 5634 | * @version 1.0 |
| 5635 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5636 | s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5637 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5638 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5639 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5640 | tstrWID strWID; |
| 5641 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5642 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5643 | strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5644 | strWID.enuWIDtype = WID_STR; |
| 5645 | strWID.ps8WidVal = pu8RxPowerLevel; |
| 5646 | strWID.s32ValueSize = u32RxPowerLevelLen; |
| 5647 | |
| 5648 | |
| 5649 | return s32Error; |
| 5650 | } |
| 5651 | |
| 5652 | /** |
| 5653 | * @brief sets a channel |
| 5654 | * @details |
| 5655 | * @param[in,out] handle to the wifi driver, |
| 5656 | * @param[in] Index of the channel to be set |
| 5657 | *|-------------------------------------------------------------------| |
| 5658 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5659 | | Input: 1 2 14 | |
| 5660 | ||-------------------------------------------------------------------| |
| 5661 | * @return Error code indicating success/failure |
| 5662 | * @note |
| 5663 | * @author zsalah |
| 5664 | * @date 8 March 2012 |
| 5665 | * @version 1.0 |
| 5666 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5667 | s32 host_int_set_mac_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 u8ChNum) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5668 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5669 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5670 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5671 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5672 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5673 | if (pstrWFIDrv == NULL) { |
| 5674 | PRINT_ER("driver is null\n"); |
| 5675 | return -EFAULT; |
| 5676 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5677 | |
| 5678 | /* prepare the set channel message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5679 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5680 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5681 | msg.body.strHostIFSetChan.u8SetChan = u8ChNum; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5682 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5683 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5684 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5685 | if (s32Error) { |
| 5686 | PRINT_ER("wilc mq send fail\n"); |
| 5687 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5688 | } |
| 5689 | |
| 5690 | return s32Error; |
| 5691 | } |
| 5692 | |
| 5693 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 5694 | s32 host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5695 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5696 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5697 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5698 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5699 | |
| 5700 | /* prepare the set driver handler message */ |
| 5701 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5702 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5703 | msg.id = HOST_IF_MSG_Q_IDLE; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5704 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5705 | if (s32Error) { |
| 5706 | PRINT_ER("wilc mq send fail\n"); |
| 5707 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5708 | } |
| 5709 | |
| 5710 | /* wait untill MSG Q is empty */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5711 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5712 | |
| 5713 | return s32Error; |
| 5714 | |
| 5715 | } |
| 5716 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5717 | s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5718 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5719 | s32 s32Error = 0; |
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 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5722 | |
| 5723 | |
| 5724 | /* prepare the set driver handler message */ |
| 5725 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5726 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5727 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5728 | msg.body.strHostIfSetDrvHandler.u32Address = get_id_from_handler(u32address); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5729 | msg.drvHandler = u32address; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5730 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5731 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5732 | if (s32Error) { |
| 5733 | PRINT_ER("wilc mq send fail\n"); |
| 5734 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5735 | } |
| 5736 | |
| 5737 | return s32Error; |
| 5738 | } |
| 5739 | |
| 5740 | |
| 5741 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5742 | s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5743 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5744 | s32 s32Error = 0; |
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 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5747 | |
| 5748 | |
| 5749 | /* prepare the set driver handler message */ |
| 5750 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5751 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5752 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5753 | msg.body.strHostIfSetOperationMode.u32Mode = u32mode; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5754 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5755 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5756 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5757 | if (s32Error) { |
| 5758 | PRINT_ER("wilc mq send fail\n"); |
| 5759 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5760 | } |
| 5761 | |
| 5762 | return s32Error; |
| 5763 | } |
| 5764 | |
| 5765 | /** |
| 5766 | * @brief gets the current channel index |
| 5767 | * @details |
| 5768 | * @param[in,out] handle to the wifi driver, |
| 5769 | * current channel index |
| 5770 | *|-----------------------------------------------------------------------| |
| 5771 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5772 | | Input: 1 2 14 | |
| 5773 | ||-----------------------------------------------------------------------| |
| 5774 | * @return Error code indicating success/failure |
| 5775 | * @note |
| 5776 | * @author zsalah |
| 5777 | * @date 8 March 2012 |
| 5778 | * @version 1.0 |
| 5779 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5780 | s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5781 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5782 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5783 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5784 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5785 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5786 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5787 | PRINT_ER("driver is null\n"); |
| 5788 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5789 | } |
| 5790 | |
| 5791 | /* prepare the Get Channel Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5792 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5793 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5794 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5795 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5796 | |
| 5797 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5798 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5799 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5800 | PRINT_ER("wilc mq send fail\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5801 | down(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5802 | /* gu8Chnl = 11; */ |
| 5803 | |
| 5804 | *pu8ChNo = gu8Chnl; |
| 5805 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5806 | return s32Error; |
| 5807 | |
| 5808 | |
| 5809 | } |
| 5810 | |
| 5811 | |
| 5812 | /** |
| 5813 | * @brief host_int_test_set_int_wid |
| 5814 | * @details Test function for setting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5815 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5816 | * @return Error code indicating success/failure |
| 5817 | * @note |
| 5818 | * @author zsalah |
| 5819 | * @date 8 March 2012 |
| 5820 | * @version 1.0 |
| 5821 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5822 | s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5823 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5824 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5825 | tstrWID strWID; |
| 5826 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5827 | |
| 5828 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5829 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5830 | PRINT_ER("driver is null\n"); |
| 5831 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5832 | } |
| 5833 | |
| 5834 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5835 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5836 | strWID.enuWIDtype = WID_INT; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5837 | strWID.ps8WidVal = (char *)&u32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5838 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5839 | |
| 5840 | /*Sending Cfg*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5841 | s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true, |
| 5842 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5843 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5844 | PRINT_ER("Failed to set wid value\n"); |
| 5845 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5846 | } else { |
| 5847 | PRINT_D(HOSTINF_DBG, "Successfully set wid value\n"); |
| 5848 | |
| 5849 | } |
| 5850 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5851 | return s32Error; |
| 5852 | } |
| 5853 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5854 | /** |
| 5855 | * @brief host_int_get_inactive_time |
| 5856 | * @details |
| 5857 | * @param[in,out] handle to the wifi driver, |
| 5858 | * current sta macaddress, inactive_time |
| 5859 | * @return |
| 5860 | * @note |
| 5861 | * @author |
| 5862 | * @date |
| 5863 | * @version 1.0 |
| 5864 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5865 | 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] | 5866 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5867 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5868 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5869 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5870 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5871 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5872 | PRINT_ER("driver is null\n"); |
| 5873 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5874 | } |
| 5875 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5876 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5877 | |
| 5878 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 5879 | memcpy(msg.body.strHostIfStaInactiveT.mac, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5880 | mac, ETH_ALEN); |
| 5881 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5882 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5883 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5884 | |
| 5885 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5886 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5887 | if (s32Error) |
| 5888 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5889 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5890 | down(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5891 | |
| 5892 | *pu32InactiveTime = gu32InactiveTime; |
| 5893 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5894 | return s32Error; |
| 5895 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 5896 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5897 | /** |
| 5898 | * @brief host_int_test_get_int_wid |
| 5899 | * @details Test function for getting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5900 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5901 | * @return Error code indicating success/failure |
| 5902 | * @note |
| 5903 | * @author zsalah |
| 5904 | * @date 8 March 2012 |
| 5905 | * @version 1.0 |
| 5906 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5907 | s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5908 | { |
| 5909 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5910 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5911 | tstrWID strWID; |
| 5912 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5913 | |
| 5914 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5915 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5916 | PRINT_ER("driver is null\n"); |
| 5917 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5918 | } |
| 5919 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5920 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5921 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5922 | strWID.ps8WidVal = (s8 *)pu32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5923 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5924 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5925 | s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true, |
| 5926 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5927 | /*get the value by searching the local copy*/ |
| 5928 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5929 | PRINT_ER("Failed to get wid value\n"); |
| 5930 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5931 | } else { |
| 5932 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
| 5933 | |
| 5934 | } |
| 5935 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5936 | return s32Error; |
| 5937 | } |
| 5938 | |
| 5939 | |
| 5940 | /** |
| 5941 | * @brief host_int_get_rssi |
| 5942 | * @details gets the currently maintained RSSI value for the station. |
| 5943 | * The received signal strength value in dB. |
| 5944 | * The range of valid values is -128 to 0. |
| 5945 | * @param[in,out] handle to the wifi driver, |
| 5946 | * rssi value in dB |
| 5947 | * @return Error code indicating success/failure |
| 5948 | * @note |
| 5949 | * @author zsalah |
| 5950 | * @date 8 March 2012 |
| 5951 | * @version 1.0 |
| 5952 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5953 | s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5954 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5955 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5956 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5957 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5958 | |
| 5959 | |
| 5960 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5961 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5962 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5963 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5964 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5965 | |
| 5966 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5967 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5968 | if (s32Error) { |
| 5969 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5970 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5971 | } |
| 5972 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5973 | down(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5974 | |
| 5975 | |
| 5976 | if (ps8Rssi == NULL) { |
| 5977 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5978 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5979 | } |
| 5980 | |
| 5981 | |
| 5982 | *ps8Rssi = gs8Rssi; |
| 5983 | |
| 5984 | |
| 5985 | return s32Error; |
| 5986 | } |
| 5987 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5988 | s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5989 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5990 | struct host_if_msg msg; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5991 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5992 | |
| 5993 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5994 | |
| 5995 | |
| 5996 | |
| 5997 | /* prepare the Get LINKSPEED Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5998 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5999 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6000 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6001 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6002 | |
| 6003 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6004 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6005 | if (s32Error) { |
| 6006 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6007 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6008 | } |
| 6009 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6010 | down(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6011 | |
| 6012 | |
| 6013 | if (ps8lnkspd == NULL) { |
| 6014 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6015 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6016 | } |
| 6017 | |
| 6018 | |
| 6019 | *ps8lnkspd = gs8lnkspd; |
| 6020 | |
| 6021 | |
| 6022 | return s32Error; |
| 6023 | } |
| 6024 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6025 | s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6026 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6027 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6028 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6029 | |
| 6030 | |
| 6031 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6032 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6033 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6034 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6035 | msg.body.pUserData = (char *)pstrStatistics; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6036 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6037 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6038 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6039 | if (s32Error) { |
| 6040 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6041 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6042 | } |
| 6043 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6044 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6045 | return s32Error; |
| 6046 | } |
| 6047 | |
| 6048 | |
| 6049 | /** |
| 6050 | * @brief host_int_scan |
| 6051 | * @details scans a set of channels |
| 6052 | * @param[in,out] handle to the wifi driver, |
| 6053 | * @param[in] Scan source |
| 6054 | * Scan Type PASSIVE_SCAN = 0, |
| 6055 | * ACTIVE_SCAN = 1 |
| 6056 | * Channels Array |
| 6057 | * Channels Array length |
| 6058 | * Scan Callback function |
| 6059 | * @return Error code indicating success/failure |
| 6060 | * @note |
| 6061 | * @author zsalah |
| 6062 | * @date 8 March 2012 |
| 6063 | * @version 1.0 |
| 6064 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6065 | s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6066 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 6067 | u8 u8ChnlListLen, const u8 *pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6068 | size_t IEsLen, tWILCpfScanResult ScanResult, |
| 6069 | void *pvUserArg, tstrHiddenNetwork *pstrHiddenNetwork) |
| 6070 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6071 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6072 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6073 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6074 | tenuScanConnTimer enuScanConnTimer; |
| 6075 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6076 | if (pstrWFIDrv == NULL || ScanResult == NULL) { |
| 6077 | PRINT_ER("pstrWFIDrv or ScanResult = NULL\n"); |
| 6078 | return -EFAULT; |
| 6079 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6080 | |
| 6081 | /* prepare the Scan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6082 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6083 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6084 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6085 | |
| 6086 | if (pstrHiddenNetwork != NULL) { |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6087 | msg.body.strHostIFscanAttr.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 6088 | msg.body.strHostIFscanAttr.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6089 | |
| 6090 | } else |
| 6091 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 6092 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6093 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6094 | msg.body.strHostIFscanAttr.u8ScanSource = u8ScanSource; |
| 6095 | msg.body.strHostIFscanAttr.u8ScanType = u8ScanType; |
| 6096 | msg.body.strHostIFscanAttr.pfScanResult = ScanResult; |
| 6097 | msg.body.strHostIFscanAttr.pvUserArg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6098 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6099 | msg.body.strHostIFscanAttr.u8ChnlListLen = u8ChnlListLen; |
| 6100 | msg.body.strHostIFscanAttr.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6101 | memcpy(msg.body.strHostIFscanAttr.pu8ChnlFreqList, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6102 | pu8ChnlFreqList, u8ChnlListLen); |
| 6103 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6104 | msg.body.strHostIFscanAttr.IEsLen = IEsLen; |
| 6105 | msg.body.strHostIFscanAttr.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6106 | memcpy(msg.body.strHostIFscanAttr.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6107 | pu8IEs, IEsLen); |
| 6108 | |
| 6109 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6110 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6111 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6112 | PRINT_ER("Error in sending message queue\n"); |
| 6113 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6114 | } |
| 6115 | |
| 6116 | enuScanConnTimer = SCAN_TIMER; |
| 6117 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6118 | pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; |
| 6119 | mod_timer(&pstrWFIDrv->hScanTimer, |
| 6120 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6121 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6122 | return s32Error; |
| 6123 | |
| 6124 | } |
| 6125 | /** |
| 6126 | * @brief hif_set_cfg |
| 6127 | * @details sets configuration wids values |
| 6128 | * @param[in,out] handle to the wifi driver, |
| 6129 | * @param[in] WID, WID value |
| 6130 | * @return Error code indicating success/failure |
| 6131 | * @note |
| 6132 | * @author zsalah |
| 6133 | * @date 8 March 2012 |
| 6134 | * @version 1.0 |
| 6135 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6136 | s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, tstrCfgParamVal *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6137 | { |
| 6138 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6139 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6140 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6141 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6142 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6143 | |
| 6144 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6145 | if (pstrWFIDrv == NULL) { |
| 6146 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 6147 | return -EFAULT; |
| 6148 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6149 | /* prepare the WiphyParams Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6150 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6151 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6152 | msg.body.strHostIFCfgParamAttr.pstrCfgParamVal = *pstrCfgParamVal; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6153 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6154 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6155 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6156 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6157 | return s32Error; |
| 6158 | |
| 6159 | } |
| 6160 | |
| 6161 | |
| 6162 | /** |
| 6163 | * @brief hif_get_cfg |
| 6164 | * @details gets configuration wids values |
| 6165 | * @param[in,out] handle to the wifi driver, |
| 6166 | * WID value |
| 6167 | * @param[in] WID, |
| 6168 | * @return Error code indicating success/failure |
| 6169 | * @note |
| 6170 | * @author zsalah |
| 6171 | * |
| 6172 | * @date 8 March 2012 |
| 6173 | * @version 1.0 |
| 6174 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6175 | s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6176 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6177 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6178 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6179 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6180 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6181 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6182 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6183 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 6184 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6185 | } |
| 6186 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 6187 | switch (u16WID) { |
| 6188 | |
| 6189 | case WID_BSS_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6190 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6191 | break; |
| 6192 | |
| 6193 | case WID_AUTH_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6194 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6195 | break; |
| 6196 | |
| 6197 | case WID_AUTH_TIMEOUT: |
| 6198 | *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout; |
| 6199 | break; |
| 6200 | |
| 6201 | case WID_POWER_MANAGEMENT: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6202 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6203 | break; |
| 6204 | |
| 6205 | case WID_SHORT_RETRY_LIMIT: |
| 6206 | *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit; |
| 6207 | break; |
| 6208 | |
| 6209 | case WID_LONG_RETRY_LIMIT: |
| 6210 | *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit; |
| 6211 | break; |
| 6212 | |
| 6213 | case WID_FRAG_THRESHOLD: |
| 6214 | *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold; |
| 6215 | break; |
| 6216 | |
| 6217 | case WID_RTS_THRESHOLD: |
| 6218 | *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold; |
| 6219 | break; |
| 6220 | |
| 6221 | case WID_PREAMBLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6222 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6223 | break; |
| 6224 | |
| 6225 | case WID_SHORT_SLOT_ALLOWED: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6226 | *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6227 | break; |
| 6228 | |
| 6229 | case WID_11N_TXOP_PROT_DISABLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6230 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6231 | break; |
| 6232 | |
| 6233 | case WID_BEACON_INTERVAL: |
| 6234 | *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval; |
| 6235 | break; |
| 6236 | |
| 6237 | case WID_DTIM_PERIOD: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6238 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6239 | break; |
| 6240 | |
| 6241 | case WID_SITE_SURVEY: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6242 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6243 | break; |
| 6244 | |
| 6245 | case WID_SITE_SURVEY_SCAN_TIME: |
| 6246 | *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time; |
| 6247 | break; |
| 6248 | |
| 6249 | case WID_ACTIVE_SCAN_TIME: |
| 6250 | *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time; |
| 6251 | break; |
| 6252 | |
| 6253 | case WID_PASSIVE_SCAN_TIME: |
| 6254 | *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time; |
| 6255 | break; |
| 6256 | |
| 6257 | case WID_CURRENT_TX_RATE: |
| 6258 | *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate; |
| 6259 | break; |
| 6260 | |
| 6261 | default: |
| 6262 | break; |
| 6263 | } |
| 6264 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6265 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6266 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6267 | return s32Error; |
| 6268 | |
| 6269 | } |
| 6270 | |
| 6271 | /*****************************************************************************/ |
| 6272 | /* Notification Functions */ |
| 6273 | /*****************************************************************************/ |
| 6274 | /** |
| 6275 | * @brief notifies host with join and leave requests |
| 6276 | * @details This function prepares an Information frame having the |
| 6277 | * information about a joining/leaving station. |
| 6278 | * @param[in,out] handle to the wifi driver, |
| 6279 | * @param[in] 6 byte Sta Adress |
| 6280 | * Join or leave flag: |
| 6281 | * Join = 1, |
| 6282 | * Leave =0 |
| 6283 | * @return Error code indicating success/failure |
| 6284 | * @note |
| 6285 | * @author zsalah |
| 6286 | * @date 8 March 2012 |
| 6287 | * @version 1.0 |
| 6288 | */ |
| 6289 | void host_int_send_join_leave_info_to_host |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6290 | (u16 assocId, u8 *stationAddr, bool joining) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6291 | { |
| 6292 | } |
| 6293 | /** |
| 6294 | * @brief notifies host with stations found in scan |
| 6295 | * @details sends the beacon/probe response from scan |
| 6296 | * @param[in,out] handle to the wifi driver, |
| 6297 | * @param[in] Sta Address, |
| 6298 | * Frame length, |
| 6299 | * Rssi of the Station found |
| 6300 | * @return Error code indicating success/failure |
| 6301 | * @note |
| 6302 | * @author zsalah |
| 6303 | * @date 8 March 2012 |
| 6304 | * @version 1.0 |
| 6305 | */ |
| 6306 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6307 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6308 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6309 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6310 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6311 | if (pstrWFIDrv == NULL) { |
| 6312 | PRINT_ER("Driver handler is NULL\n"); |
| 6313 | return; |
| 6314 | } |
| 6315 | |
| 6316 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6317 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6318 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6319 | |
| 6320 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6321 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6322 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6323 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6324 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6325 | |
| 6326 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6327 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6328 | if (s32Error) { |
| 6329 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 6330 | return; |
| 6331 | } |
| 6332 | } |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6333 | g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; |
| 6334 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6335 | } |
| 6336 | |
| 6337 | |
| 6338 | void host_int_send_network_info_to_host |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 6339 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6340 | { |
| 6341 | } |
| 6342 | /** |
| 6343 | * @brief host_int_init |
| 6344 | * @details host interface initialization function |
| 6345 | * @param[in,out] handle to the wifi driver, |
| 6346 | * @note |
| 6347 | * @author zsalah |
| 6348 | * @date 8 March 2012 |
| 6349 | * @version 1.0 |
| 6350 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6351 | static u32 u32Intialized; |
| 6352 | static u32 msgQ_created; |
| 6353 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6354 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6355 | s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6356 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6357 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6358 | tstrWILC_WFIDrv *pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6359 | int err; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6360 | |
| 6361 | /*if(u32Intialized == 1) |
| 6362 | * { |
| 6363 | * PRINT_D(HOSTINF_DBG,"Host interface is previously initialized\n"); |
| 6364 | * *phWFIDrv = (WILC_WFIDrvHandle)gWFiDrvHandle; //Will be adjusted later for P2P |
| 6365 | * return 0; |
| 6366 | * } */ |
| 6367 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 6368 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6369 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6370 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6371 | sema_init(&hWaitResponse, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6372 | |
| 6373 | |
| 6374 | |
| 6375 | /*Allocate host interface private structure*/ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6376 | pstrWFIDrv = kmalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6377 | if (pstrWFIDrv == NULL) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6378 | s32Error = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6379 | PRINT_ER("Failed to allocate memory\n"); |
| 6380 | goto _fail_timer_2; |
| 6381 | } |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6382 | memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6383 | /*return driver handle to user*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6384 | *phWFIDrv = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6385 | /*save into globl handle*/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6386 | err = add_handler_in_list(pstrWFIDrv); |
| 6387 | if (err) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6388 | s32Error = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6389 | goto _fail_timer_2; |
| 6390 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6391 | |
| 6392 | #ifdef DISABLE_PWRSAVE_AND_SCAN_DURING_IP |
| 6393 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6394 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6395 | #endif |
| 6396 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6397 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6398 | /* /////////////////////////////////////// */ |
| 6399 | if (clients_count == 0) { |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6400 | sema_init(&hSemHostIFthrdEnd, 0); |
| 6401 | sema_init(&hSemDeinitDrvHandle, 0); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6402 | sema_init(&hSemHostIntDeinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6403 | } |
| 6404 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6405 | sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0); |
| 6406 | sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0); |
| 6407 | sema_init(&(pstrWFIDrv->hSemGetRSSI), 0); |
| 6408 | sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0); |
| 6409 | sema_init(&(pstrWFIDrv->hSemGetCHNL), 0); |
| 6410 | sema_init(&(pstrWFIDrv->hSemInactiveTime), 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6411 | |
| 6412 | /* /////////////////////////////////////// */ |
| 6413 | |
| 6414 | |
| 6415 | |
| 6416 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 6417 | |
| 6418 | if (clients_count == 0) { |
Chaehyun Lim | cd08fc7 | 2015-08-19 15:59:05 +0900 | [diff] [blame] | 6419 | s32Error = wilc_mq_create(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6420 | |
| 6421 | if (s32Error < 0) { |
| 6422 | PRINT_ER("Failed to creat MQ\n"); |
| 6423 | goto _fail_; |
| 6424 | } |
| 6425 | msgQ_created = 1; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6426 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
| 6427 | if (IS_ERR(HostIFthreadHandler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6428 | PRINT_ER("Failed to creat Thread\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6429 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6430 | goto _fail_mq_; |
| 6431 | } |
Greg Kroah-Hartman | 507d7fc | 2015-08-17 12:59:42 -0700 | [diff] [blame] | 6432 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
| 6433 | (unsigned long)pstrWFIDrv); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6434 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6435 | } |
| 6436 | |
| 6437 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6438 | setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6439 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6440 | setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6441 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6442 | /*Remain on channel timer*/ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6443 | setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6444 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6445 | sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); |
| 6446 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6447 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6448 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6449 | /* gWFiDrvHandle->bPendingConnRequest = false; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6450 | |
| 6451 | /*Initialize CFG WIDS Defualt Values*/ |
| 6452 | |
| 6453 | pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 6454 | pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 6455 | pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 6456 | pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 6457 | pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE; |
| 6458 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6459 | pstrWFIDrv->u64P2p_MgmtTimeout = 0; |
| 6460 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6461 | 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", |
| 6462 | |
| 6463 | pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source, |
| 6464 | pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time, |
| 6465 | pstrWFIDrv->strCfgValues.curr_tx_rate); |
| 6466 | |
| 6467 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6468 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6469 | |
| 6470 | /*TODO Code to setup simulation to be removed later*/ |
| 6471 | /*Intialize configurator module*/ |
| 6472 | s32Error = CoreConfiguratorInit(); |
| 6473 | if (s32Error < 0) { |
| 6474 | PRINT_ER("Failed to initialize core configurator\n"); |
| 6475 | goto _fail_mem_; |
| 6476 | } |
| 6477 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6478 | u32Intialized = 1; |
| 6479 | clients_count++; /* increase number of created entities */ |
| 6480 | |
| 6481 | return s32Error; |
| 6482 | |
| 6483 | |
| 6484 | _fail_mem_: |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6485 | if (pstrWFIDrv != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6486 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6487 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6488 | _fail_timer_2: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6489 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6490 | del_timer_sync(&pstrWFIDrv->hConnectTimer); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6491 | del_timer_sync(&pstrWFIDrv->hScanTimer); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6492 | kthread_stop(HostIFthreadHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6493 | _fail_mq_: |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6494 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6495 | _fail_: |
| 6496 | return s32Error; |
| 6497 | |
| 6498 | |
| 6499 | } |
| 6500 | /** |
| 6501 | * @brief host_int_deinit |
| 6502 | * @details host interface initialization function |
| 6503 | * @param[in,out] handle to the wifi driver, |
| 6504 | * @note |
| 6505 | * @author zsalah |
| 6506 | * @date 8 March 2012 |
| 6507 | * @version 1.0 |
| 6508 | */ |
| 6509 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6510 | s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6511 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6512 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6513 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6514 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6515 | |
| 6516 | /*obtain driver handle*/ |
| 6517 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 6518 | /*if(u32Intialized == 0) |
| 6519 | * { |
| 6520 | * PRINT_ER("Host Interface is not initialized\n"); |
| 6521 | * return 0; |
| 6522 | * }*/ |
| 6523 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6524 | |
| 6525 | if (pstrWFIDrv == NULL) { |
| 6526 | PRINT_ER("pstrWFIDrv = NULL\n"); |
| 6527 | return 0; |
| 6528 | } |
| 6529 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6530 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6531 | |
| 6532 | terminated_handle = pstrWFIDrv; |
| 6533 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 6534 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6535 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ |
| 6536 | /*to guarantee handling all messages befor proceeding*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6537 | if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6538 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6539 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
| 6540 | } |
| 6541 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6542 | if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6543 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6544 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6545 | } |
| 6546 | |
| 6547 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6548 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6549 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6550 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6551 | } |
| 6552 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6553 | /*Destroy Remain-onchannel Timer*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6554 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6555 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6556 | host_int_set_wfi_drv_handler(NULL); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6557 | down(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6558 | |
| 6559 | |
| 6560 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ |
| 6561 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6562 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6563 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 6564 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6565 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6566 | } |
| 6567 | /*deinit configurator and simulator*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6568 | CoreConfiguratorDeInit(); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6569 | |
| 6570 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 6571 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6572 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6573 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6574 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6575 | |
| 6576 | if (clients_count == 1) { |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6577 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6578 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6579 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6580 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6581 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6582 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6583 | |
| 6584 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6585 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6586 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6587 | 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] | 6588 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6589 | down(&hSemHostIFthrdEnd); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6590 | |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6591 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6592 | msgQ_created = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6593 | } |
| 6594 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6595 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6596 | |
| 6597 | /*Setting the gloabl driver handler with NULL*/ |
| 6598 | u32Intialized = 0; |
| 6599 | /* gWFiDrvHandle = NULL; */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6600 | ret = remove_handler_in_list(pstrWFIDrv); |
| 6601 | if (ret) |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6602 | s32Error = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6603 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6604 | if (pstrWFIDrv != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6605 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6606 | /* pstrWFIDrv=NULL; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6607 | |
| 6608 | } |
| 6609 | |
| 6610 | clients_count--; /* Decrease number of created entities */ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6611 | terminated_handle = NULL; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6612 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6613 | return s32Error; |
| 6614 | } |
| 6615 | |
| 6616 | |
| 6617 | /** |
| 6618 | * @brief NetworkInfoReceived |
| 6619 | * @details function to to be called when network info packet is received |
| 6620 | * @param[in] pu8Buffer the received packet |
| 6621 | * @param[in] u32Length length of the received packet |
| 6622 | * @return none |
| 6623 | * @note |
| 6624 | * @author |
| 6625 | * @date 1 Mar 2012 |
| 6626 | * @version 1.0 |
| 6627 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6628 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6629 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6630 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6631 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6632 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6633 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6634 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6635 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6636 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6637 | |
| 6638 | |
| 6639 | |
| 6640 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6641 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6642 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6643 | return; |
| 6644 | } |
| 6645 | |
| 6646 | /* prepare the Asynchronous Network Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6647 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6648 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6649 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6650 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6651 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6652 | msg.body.strRcvdNetworkInfo.u32Length = u32Length; |
| 6653 | msg.body.strRcvdNetworkInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6654 | memcpy(msg.body.strRcvdNetworkInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6655 | pu8Buffer, u32Length); |
| 6656 | |
| 6657 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6658 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6659 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6660 | 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] | 6661 | } |
| 6662 | |
| 6663 | /** |
| 6664 | * @brief GnrlAsyncInfoReceived |
| 6665 | * @details function to be called when general Asynchronous info packet is received |
| 6666 | * @param[in] pu8Buffer the received packet |
| 6667 | * @param[in] u32Length length of the received packet |
| 6668 | * @return none |
| 6669 | * @note |
| 6670 | * @author |
| 6671 | * @date 15 Mar 2012 |
| 6672 | * @version 1.0 |
| 6673 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6674 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6675 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6676 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6677 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6678 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6679 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6680 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6681 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6682 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6683 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6684 | pstrWFIDrv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6685 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6686 | |
| 6687 | |
| 6688 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
| 6689 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6690 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6691 | return; |
| 6692 | } |
| 6693 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6694 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6695 | /* received mac status is not needed when there is no current Connect Request */ |
| 6696 | 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] | 6697 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6698 | return; |
| 6699 | } |
| 6700 | |
| 6701 | /* prepare the General Asynchronous Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6702 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6703 | |
| 6704 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6705 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6706 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6707 | |
| 6708 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6709 | msg.body.strRcvdGnrlAsyncInfo.u32Length = u32Length; |
| 6710 | msg.body.strRcvdGnrlAsyncInfo.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6711 | memcpy(msg.body.strRcvdGnrlAsyncInfo.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6712 | pu8Buffer, u32Length); |
| 6713 | |
| 6714 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6715 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6716 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6717 | 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] | 6718 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6719 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6720 | } |
| 6721 | |
| 6722 | /** |
| 6723 | * @brief host_int_ScanCompleteReceived |
| 6724 | * @details Setting scan complete received notifcation in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6725 | * @param[in] u8* pu8Buffer, u32 u32Length |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6726 | * @return Error code. |
| 6727 | * @author |
| 6728 | * @date |
| 6729 | * @version 1.0 |
| 6730 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6731 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6732 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6733 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6734 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6735 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6736 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6737 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6738 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6739 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6740 | |
| 6741 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6742 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6743 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6744 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6745 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6746 | |
| 6747 | /*if there is an ongoing scan request*/ |
| 6748 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 6749 | /* prepare theScan Done message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6750 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6751 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6752 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6753 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6754 | |
| 6755 | |
| 6756 | /* will be deallocated by the receiving thread */ |
| 6757 | /*no need to send message body*/ |
| 6758 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6759 | /*msg.body.strScanComplete.u32Length = u32Length; |
| 6760 | * msg.body.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
| 6761 | * memcpy(msg.body.strScanComplete.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6762 | * pu8Buffer, u32Length); */ |
| 6763 | |
| 6764 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6765 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6766 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6767 | 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] | 6768 | } |
| 6769 | |
| 6770 | |
| 6771 | return; |
| 6772 | |
| 6773 | } |
| 6774 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6775 | /** |
| 6776 | * @brief host_int_remain_on_channel |
| 6777 | * @details |
| 6778 | * @param[in] Handle to wifi driver |
| 6779 | * Duration to remain on channel |
| 6780 | * Channel to remain on |
| 6781 | * Pointer to fn to be called on receive frames in listen state |
| 6782 | * Pointer to remain-on-channel expired fn |
| 6783 | * Priv |
| 6784 | * @return Error code. |
| 6785 | * @author |
| 6786 | * @date |
| 6787 | * @version 1.0 |
| 6788 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6789 | 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] | 6790 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6791 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6792 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6793 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6794 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6795 | if (pstrWFIDrv == NULL) { |
| 6796 | PRINT_ER("driver is null\n"); |
| 6797 | return -EFAULT; |
| 6798 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6799 | |
| 6800 | /* prepare the remainonchan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6801 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6802 | |
| 6803 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6804 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6805 | msg.body.strHostIfRemainOnChan.u16Channel = chan; |
| 6806 | msg.body.strHostIfRemainOnChan.pRemainOnChanExpired = RemainOnChanExpired; |
| 6807 | msg.body.strHostIfRemainOnChan.pRemainOnChanReady = RemainOnChanReady; |
| 6808 | msg.body.strHostIfRemainOnChan.pVoid = pvUserArg; |
| 6809 | msg.body.strHostIfRemainOnChan.u32duration = u32duration; |
| 6810 | msg.body.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6811 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6812 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6813 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6814 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6815 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6816 | |
| 6817 | return s32Error; |
| 6818 | } |
| 6819 | |
| 6820 | /** |
| 6821 | * @brief host_int_ListenStateExpired |
| 6822 | * @details |
| 6823 | * @param[in] Handle to wifi driver |
| 6824 | * Duration to remain on channel |
| 6825 | * Channel to remain on |
| 6826 | * Pointer to fn to be called on receive frames in listen state |
| 6827 | * Pointer to remain-on-channel expired fn |
| 6828 | * Priv |
| 6829 | * @return Error code. |
| 6830 | * @author |
| 6831 | * @date |
| 6832 | * @version 1.0 |
| 6833 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6834 | s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6835 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6836 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6837 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6838 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6839 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6840 | if (pstrWFIDrv == NULL) { |
| 6841 | PRINT_ER("driver is null\n"); |
| 6842 | return -EFAULT; |
| 6843 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6844 | |
| 6845 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 6846 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6847 | |
| 6848 | /* prepare the timer fire Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6849 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6850 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6851 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6852 | msg.body.strHostIfRemainOnChan.u32ListenSessionID = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6853 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6854 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6855 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6856 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6857 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6858 | return s32Error; |
| 6859 | } |
| 6860 | |
| 6861 | /** |
| 6862 | * @brief host_int_frame_register |
| 6863 | * @details |
| 6864 | * @param[in] Handle to wifi driver |
| 6865 | * @return Error code. |
| 6866 | * @author |
| 6867 | * @date |
| 6868 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6869 | s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6870 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6871 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6872 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6873 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6874 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6875 | if (pstrWFIDrv == NULL) { |
| 6876 | PRINT_ER("driver is null\n"); |
| 6877 | return -EFAULT; |
| 6878 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6879 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6880 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6881 | |
| 6882 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6883 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6884 | switch (u16FrameType) { |
| 6885 | case ACTION: |
| 6886 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6887 | msg.body.strHostIfRegisterFrame.u8Regid = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6888 | break; |
| 6889 | |
| 6890 | case PROBE_REQ: |
| 6891 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6892 | msg.body.strHostIfRegisterFrame.u8Regid = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6893 | break; |
| 6894 | |
| 6895 | default: |
| 6896 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 6897 | break; |
| 6898 | } |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6899 | msg.body.strHostIfRegisterFrame.u16FrameType = u16FrameType; |
| 6900 | msg.body.strHostIfRegisterFrame.bReg = bReg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6901 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6902 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6903 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6904 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6905 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6906 | |
| 6907 | return s32Error; |
| 6908 | |
| 6909 | |
| 6910 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6911 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6912 | /** |
| 6913 | * @brief host_int_add_beacon |
| 6914 | * @details Setting add beacon params in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6915 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
| 6916 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, |
| 6917 | * u32 u32TailLen, u8* pu8Tail |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6918 | * @return Error code. |
| 6919 | * @author |
| 6920 | * @date |
| 6921 | * @version 1.0 |
| 6922 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6923 | s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6924 | u32 u32DTIMPeriod, |
| 6925 | u32 u32HeadLen, u8 *pu8Head, |
| 6926 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6927 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6928 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6929 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6930 | struct host_if_msg msg; |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 6931 | struct set_beacon *pstrSetBeaconParam = &msg.body.strHostIFSetBeacon; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6932 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6933 | if (pstrWFIDrv == NULL) { |
| 6934 | PRINT_ER("driver is null\n"); |
| 6935 | return -EFAULT; |
| 6936 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6937 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6938 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6939 | |
| 6940 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 6941 | |
| 6942 | |
| 6943 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6944 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6945 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6946 | pstrSetBeaconParam->u32Interval = u32Interval; |
| 6947 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; |
| 6948 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6949 | pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6950 | if (pstrSetBeaconParam->pu8Head == NULL) { |
| 6951 | s32Error = -ENOMEM; |
| 6952 | goto ERRORHANDLER; |
| 6953 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6954 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6955 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
| 6956 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6957 | if (u32TailLen > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6958 | pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6959 | if (pstrSetBeaconParam->pu8Tail == NULL) { |
| 6960 | s32Error = -ENOMEM; |
| 6961 | goto ERRORHANDLER; |
| 6962 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6963 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6964 | } else { |
| 6965 | pstrSetBeaconParam->pu8Tail = NULL; |
| 6966 | } |
| 6967 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6968 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6969 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6970 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6971 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6972 | ERRORHANDLER: |
| 6973 | if (s32Error) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6974 | if (pstrSetBeaconParam->pu8Head != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6975 | kfree(pstrSetBeaconParam->pu8Head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6976 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6977 | if (pstrSetBeaconParam->pu8Tail != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6978 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6979 | } |
| 6980 | |
| 6981 | return s32Error; |
| 6982 | |
| 6983 | } |
| 6984 | |
| 6985 | |
| 6986 | /** |
| 6987 | * @brief host_int_del_beacon |
| 6988 | * @details Setting add beacon params in message queue |
| 6989 | * @param[in] WILC_WFIDrvHandle hWFIDrv |
| 6990 | * @return Error code. |
| 6991 | * @author |
| 6992 | * @date |
| 6993 | * @version 1.0 |
| 6994 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6995 | s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6996 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6997 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6998 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6999 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7000 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7001 | if (pstrWFIDrv == NULL) { |
| 7002 | PRINT_ER("driver is null\n"); |
| 7003 | return -EFAULT; |
| 7004 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7005 | |
| 7006 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7007 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7008 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7009 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 7010 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7011 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 7012 | if (s32Error) |
| 7013 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7014 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7015 | return s32Error; |
| 7016 | } |
| 7017 | |
| 7018 | |
| 7019 | /** |
| 7020 | * @brief host_int_add_station |
| 7021 | * @details Setting add station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7022 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7023 | * @return Error code. |
| 7024 | * @author |
| 7025 | * @date |
| 7026 | * @version 1.0 |
| 7027 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7028 | s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, |
| 7029 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7030 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7031 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7032 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7033 | struct host_if_msg msg; |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7034 | struct add_sta_param *pstrAddStationMsg = &msg.body.strAddStaParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7035 | |
| 7036 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7037 | if (pstrWFIDrv == NULL) { |
| 7038 | PRINT_ER("driver is null\n"); |
| 7039 | return -EFAULT; |
| 7040 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7041 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7042 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7043 | |
| 7044 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 7045 | |
| 7046 | |
| 7047 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7048 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7049 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7050 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7051 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7052 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7053 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7054 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 7055 | if (!rates) |
| 7056 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7057 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7058 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7059 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7060 | } |
| 7061 | |
| 7062 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7063 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7064 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7065 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7066 | return s32Error; |
| 7067 | } |
| 7068 | |
| 7069 | /** |
| 7070 | * @brief host_int_del_station |
| 7071 | * @details Setting delete station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7072 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7073 | * @return Error code. |
| 7074 | * @author |
| 7075 | * @date |
| 7076 | * @version 1.0 |
| 7077 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7078 | s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7079 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7080 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7081 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7082 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7083 | tstrHostIFDelSta *pstrDelStationMsg = &msg.body.strDelStaParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7084 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7085 | if (pstrWFIDrv == NULL) { |
| 7086 | PRINT_ER("driver is null\n"); |
| 7087 | return -EFAULT; |
| 7088 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7089 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7090 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7091 | |
| 7092 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 7093 | |
| 7094 | |
| 7095 | |
| 7096 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7097 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7098 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7099 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 7100 | if (pu8MacAddr == NULL) |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7101 | memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7102 | else |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7103 | memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7104 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7105 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7106 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7107 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7108 | return s32Error; |
| 7109 | } |
| 7110 | /** |
| 7111 | * @brief host_int_del_allstation |
| 7112 | * @details Setting del station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7113 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7114 | * @return Error code. |
| 7115 | * @author |
| 7116 | * @date |
| 7117 | * @version 1.0 |
| 7118 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7119 | s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7120 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7121 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7122 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7123 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7124 | tstrHostIFDelAllSta *pstrDelAllStationMsg = &msg.body.strHostIFDelAllSta; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7125 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 7126 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7127 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7128 | |
| 7129 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7130 | if (pstrWFIDrv == NULL) { |
| 7131 | PRINT_ER("driver is null\n"); |
| 7132 | return -EFAULT; |
| 7133 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7134 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7135 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7136 | |
| 7137 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 7138 | |
| 7139 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7140 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7141 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7142 | |
| 7143 | /* Handling situation of deauthenticing all associated stations*/ |
| 7144 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 7145 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7146 | memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7147 | 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], |
| 7148 | pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); |
| 7149 | u8AssocNumb++; |
| 7150 | } |
| 7151 | } |
| 7152 | if (!u8AssocNumb) { |
| 7153 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
| 7154 | return s32Error; |
| 7155 | } |
| 7156 | |
| 7157 | pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7158 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7159 | |
| 7160 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7161 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7162 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7163 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7164 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7165 | |
| 7166 | return s32Error; |
| 7167 | |
| 7168 | } |
| 7169 | |
| 7170 | /** |
| 7171 | * @brief host_int_edit_station |
| 7172 | * @details Setting edit station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7173 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7174 | * @return Error code. |
| 7175 | * @author |
| 7176 | * @date |
| 7177 | * @version 1.0 |
| 7178 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7179 | s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, |
| 7180 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7181 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7182 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7183 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7184 | struct host_if_msg msg; |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7185 | struct add_sta_param *pstrAddStationMsg = &msg.body.strAddStaParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7186 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7187 | if (pstrWFIDrv == NULL) { |
| 7188 | PRINT_ER("driver is null\n"); |
| 7189 | return -EFAULT; |
| 7190 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7191 | |
| 7192 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 7193 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7194 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7195 | |
| 7196 | |
| 7197 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7198 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7199 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7200 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 7201 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7202 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7203 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7204 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 7205 | if (!rates) |
| 7206 | return -ENOMEM; |
| 7207 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7208 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 7209 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7210 | } |
| 7211 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7212 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7213 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7214 | PRINT_ER("wilc_mq_send fail\n"); |
| 7215 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7216 | return s32Error; |
| 7217 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 7218 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7219 | 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] | 7220 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7221 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7222 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7223 | struct host_if_msg msg; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 7224 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.strPowerMgmtparam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7225 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7226 | 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] | 7227 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7228 | if (pstrWFIDrv == NULL) { |
| 7229 | PRINT_ER("driver is null\n"); |
| 7230 | return -EFAULT; |
| 7231 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7232 | |
| 7233 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 7234 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7235 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7236 | |
| 7237 | |
| 7238 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7239 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7240 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7241 | |
| 7242 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; |
| 7243 | pstrPowerMgmtParam->u32Timeout = u32Timeout; |
| 7244 | |
| 7245 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7246 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7247 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7248 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7249 | return s32Error; |
| 7250 | } |
| 7251 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7252 | 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] | 7253 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7254 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7255 | |
| 7256 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7257 | struct host_if_msg msg; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 7258 | struct set_multicast *pstrMulticastFilterParam = &msg.body.strHostIfSetMulti; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7259 | |
| 7260 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7261 | if (pstrWFIDrv == NULL) { |
| 7262 | PRINT_ER("driver is null\n"); |
| 7263 | return -EFAULT; |
| 7264 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7265 | |
| 7266 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 7267 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7268 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7269 | |
| 7270 | |
| 7271 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7272 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7273 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7274 | |
| 7275 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; |
| 7276 | pstrMulticastFilterParam->u32count = u32count; |
| 7277 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7278 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7279 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7280 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7281 | return s32Error; |
| 7282 | } |
| 7283 | |
| 7284 | |
| 7285 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7286 | #ifdef WILC_PARSE_SCAN_IN_HOST |
| 7287 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7288 | /** |
| 7289 | * @brief host_int_ParseJoinBssParam |
| 7290 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry |
| 7291 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7292 | * @return |
| 7293 | * @author zsalah |
| 7294 | * @date |
| 7295 | * @version 1.0**/ |
| 7296 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 7297 | { |
| 7298 | tstrJoinBssParam *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7299 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7300 | u16 u16IEsLen; |
| 7301 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7302 | u8 suppRatesNo = 0; |
| 7303 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7304 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 7305 | u8 pcipherCount; |
| 7306 | u8 authCount; |
| 7307 | u8 pcipherTotalCount = 0; |
| 7308 | u8 authTotalCount = 0; |
| 7309 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7310 | |
| 7311 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 7312 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 7313 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 7314 | pNewJoinBssParam = kmalloc(sizeof(tstrJoinBssParam), GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7315 | if (pNewJoinBssParam != NULL) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7316 | memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7317 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 7318 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 7319 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7320 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7321 | /*for(i=0; i<6;i++) |
| 7322 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7323 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7324 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 7325 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 7326 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7327 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
| 7328 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ |
| 7329 | |
| 7330 | /* parse supported rates: */ |
| 7331 | while (index < u16IEsLen) { |
| 7332 | /* supportedRates IE */ |
| 7333 | if (pu8IEs[index] == SUPP_RATES_IE) { |
| 7334 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ |
| 7335 | suppRatesNo = pu8IEs[index + 1]; |
| 7336 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
| 7337 | index += 2; /* skipping ID and length bytes; */ |
| 7338 | |
| 7339 | for (i = 0; i < suppRatesNo; i++) { |
| 7340 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
| 7341 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ |
| 7342 | } |
| 7343 | index += suppRatesNo; |
| 7344 | continue; |
| 7345 | } |
| 7346 | /* Ext SupportedRates IE */ |
| 7347 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
| 7348 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ |
| 7349 | /* checking if no of ext. supp and supp rates < max limit */ |
| 7350 | extSuppRatesNo = pu8IEs[index + 1]; |
| 7351 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 7352 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 7353 | else |
| 7354 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 7355 | index += 2; |
| 7356 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ |
| 7357 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { |
| 7358 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
| 7359 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ |
| 7360 | } |
| 7361 | index += extSuppRatesNo; |
| 7362 | continue; |
| 7363 | } |
| 7364 | /* HT Cap. IE */ |
| 7365 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
| 7366 | /* if IE found set the flag */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7367 | pNewJoinBssParam->ht_capable = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7368 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7369 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ |
| 7370 | continue; |
| 7371 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ |
| 7372 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
| 7373 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ |
| 7374 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ |
| 7375 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ |
| 7376 | (pu8IEs[index + 7] == 0x01)) { |
| 7377 | /* Presence of WMM Info/Param element indicates WMM capability */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7378 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7379 | |
| 7380 | /* Check if Bit 7 is set indicating U-APSD capability */ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7381 | if (pu8IEs[index + 8] & (1 << 7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 7382 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7383 | index += pu8IEs[index + 1] + 2; |
| 7384 | continue; |
| 7385 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7386 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ |
| 7387 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
| 7388 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ |
| 7389 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7390 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 7391 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7392 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
| 7393 | pNewJoinBssParam->u8NoaEnbaled = 1; |
| 7394 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; |
| 7395 | |
| 7396 | /* Check if Bit 7 is set indicating Opss capability */ |
| 7397 | if (pu8IEs[index + 10] & (1 << 7)) { |
| 7398 | pNewJoinBssParam->u8OppEnable = 1; |
| 7399 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; |
| 7400 | } else |
| 7401 | pNewJoinBssParam->u8OppEnable = 0; |
| 7402 | /* HOSTINF_DBG */ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7403 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7404 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7405 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7406 | |
| 7407 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; |
| 7408 | u16P2P_count = index + 12; |
| 7409 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7410 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7411 | u16P2P_count += 4; |
| 7412 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7413 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7414 | u16P2P_count += 4; |
| 7415 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7416 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7417 | |
| 7418 | index += pu8IEs[index + 1] + 2; |
| 7419 | continue; |
| 7420 | |
| 7421 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7422 | else if ((pu8IEs[index] == RSN_IE) || |
| 7423 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 7424 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 7425 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7426 | u16 rsnIndex = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7427 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
| 7428 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) |
| 7429 | * { |
| 7430 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); |
| 7431 | * }*/ |
| 7432 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 7433 | pNewJoinBssParam->mode_802_11i = 2; |
| 7434 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ |
| 7435 | } else { /* check if rsn was previously parsed */ |
| 7436 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 7437 | pNewJoinBssParam->mode_802_11i = 1; |
| 7438 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ |
| 7439 | rsnIndex += 4; |
| 7440 | } |
| 7441 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ |
| 7442 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 7443 | rsnIndex++; |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7444 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7445 | /* initialize policies with invalid values */ |
| 7446 | |
| 7447 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ |
| 7448 | |
| 7449 | /*parsing pairwise cipher*/ |
| 7450 | |
| 7451 | /* saving 3 pcipher max. */ |
| 7452 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7453 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7454 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7455 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7456 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
| 7457 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7458 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7459 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ |
| 7460 | } |
| 7461 | pcipherTotalCount += pcipherCount; |
| 7462 | rsnIndex += jumpOffset; |
| 7463 | |
| 7464 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 7465 | |
| 7466 | /*parsing AKM suite (auth_policy)*/ |
| 7467 | /* saving 3 auth policies max. */ |
| 7468 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7469 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7470 | |
| 7471 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { |
| 7472 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7473 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7474 | } |
| 7475 | authTotalCount += authCount; |
| 7476 | rsnIndex += jumpOffset; |
| 7477 | /*pasring rsn cap. only if rsn IE*/ |
| 7478 | if (pu8IEs[index] == RSN_IE) { |
| 7479 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 7480 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 7481 | rsnIndex += 2; |
| 7482 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 7483 | pNewJoinBssParam->rsn_found = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7484 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7485 | continue; |
| 7486 | } else |
| 7487 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7488 | |
| 7489 | } |
| 7490 | |
| 7491 | |
| 7492 | } |
| 7493 | |
| 7494 | return (void *)pNewJoinBssParam; |
| 7495 | |
| 7496 | } |
| 7497 | |
| 7498 | void host_int_freeJoinParams(void *pJoinParams) |
| 7499 | { |
| 7500 | if ((tstrJoinBssParam *)pJoinParams != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7501 | kfree((tstrJoinBssParam *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7502 | else |
| 7503 | PRINT_ER("Unable to FREE null pointer\n"); |
| 7504 | } |
| 7505 | #endif /*WILC_PARSE_SCAN_IN_HOST*/ |
| 7506 | |
| 7507 | |
| 7508 | /** |
| 7509 | * @brief host_int_addBASession |
| 7510 | * @details Open a block Ack session with the given parameters |
| 7511 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7512 | * @return |
| 7513 | * @author anoureldin |
| 7514 | * @date |
| 7515 | * @version 1.0**/ |
| 7516 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 7517 | 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] | 7518 | short int SessionTimeout, void *drvHandler) |
| 7519 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7520 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7521 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7522 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7523 | tstrHostIfBASessionInfo *pBASessionInfo = &msg.body.strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7524 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7525 | if (pstrWFIDrv == NULL) { |
| 7526 | PRINT_ER("driver is null\n"); |
| 7527 | return -EFAULT; |
| 7528 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7529 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7530 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7531 | |
| 7532 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7533 | msg.id = HOST_IF_MSG_ADD_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7534 | |
| 7535 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7536 | pBASessionInfo->u8Ted = TID; |
| 7537 | pBASessionInfo->u16BufferSize = BufferSize; |
| 7538 | pBASessionInfo->u16SessionTimeout = SessionTimeout; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7539 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7540 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7541 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7542 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7543 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7544 | |
| 7545 | return s32Error; |
| 7546 | } |
| 7547 | |
| 7548 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7549 | s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7550 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7551 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7552 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7553 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7554 | tstrHostIfBASessionInfo *pBASessionInfo = &msg.body.strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7555 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7556 | if (pstrWFIDrv == NULL) { |
| 7557 | PRINT_ER("driver is null\n"); |
| 7558 | return -EFAULT; |
| 7559 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7560 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7561 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7562 | |
| 7563 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7564 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7565 | |
| 7566 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7567 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7568 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7569 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7570 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7571 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7572 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7573 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7574 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7575 | |
| 7576 | return s32Error; |
| 7577 | } |
| 7578 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7579 | 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] | 7580 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7581 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7582 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7583 | struct host_if_msg msg; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7584 | tstrHostIfBASessionInfo *pBASessionInfo = &msg.body.strHostIfBASessionInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7585 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7586 | if (pstrWFIDrv == NULL) { |
| 7587 | PRINT_ER("driver is null\n"); |
| 7588 | return -EFAULT; |
| 7589 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7590 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7591 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7592 | |
| 7593 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7594 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7595 | |
| 7596 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7597 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7598 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7599 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7600 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7601 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7602 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7603 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7604 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7605 | |
| 7606 | return s32Error; |
| 7607 | } |
| 7608 | |
| 7609 | /** |
| 7610 | * @brief host_int_setup_ipaddress |
| 7611 | * @details setup IP in firmware |
| 7612 | * @param[in] Handle to wifi driver |
| 7613 | * @return Error code. |
| 7614 | * @author Abdelrahman Sobhy |
| 7615 | * @date |
| 7616 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7617 | s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7618 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7619 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7620 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7621 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7622 | |
| 7623 | /* TODO: Enable This feature on softap firmware */ |
| 7624 | return 0; |
| 7625 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7626 | if (pstrWFIDrv == NULL) { |
| 7627 | PRINT_ER("driver is null\n"); |
| 7628 | return -EFAULT; |
| 7629 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7630 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7631 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7632 | |
| 7633 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7634 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7635 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7636 | msg.body.strHostIfSetIP.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7637 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7638 | msg.body.strHostIfSetIP.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7639 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7640 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7641 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7642 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7643 | |
| 7644 | return s32Error; |
| 7645 | |
| 7646 | |
| 7647 | } |
| 7648 | |
| 7649 | /** |
| 7650 | * @brief host_int_get_ipaddress |
| 7651 | * @details Get IP from firmware |
| 7652 | * @param[in] Handle to wifi driver |
| 7653 | * @return Error code. |
| 7654 | * @author Abdelrahman Sobhy |
| 7655 | * @date |
| 7656 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7657 | s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7658 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7659 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7660 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7661 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7662 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7663 | if (pstrWFIDrv == NULL) { |
| 7664 | PRINT_ER("driver is null\n"); |
| 7665 | return -EFAULT; |
| 7666 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7667 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7668 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7669 | |
| 7670 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7671 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7672 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7673 | msg.body.strHostIfSetIP.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7674 | msg.drvHandler = hWFIDrv; |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 7675 | msg.body.strHostIfSetIP.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7676 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7677 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7678 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7679 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7680 | |
| 7681 | return s32Error; |
| 7682 | |
| 7683 | |
| 7684 | } |