Chaehyun Lim | e215a87 | 2015-09-30 08:15:41 +0900 | [diff] [blame] | 1 | #include <linux/slab.h> |
| 2 | #include <linux/time.h> |
| 3 | #include <linux/kthread.h> |
| 4 | #include <linux/delay.h> |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5 | #include "host_interface.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6 | #include "coreconfigurator.h" |
Chaehyun Lim | 5366012 | 2015-09-17 16:48:49 +0900 | [diff] [blame] | 7 | #include "wilc_wlan_if.h" |
Chaehyun Lim | f23eb98 | 2015-09-23 18:03:47 +0900 | [diff] [blame] | 8 | #include "wilc_msgqueue.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 9 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 10 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 11 | |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 12 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 13 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 14 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 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 | /*! |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 65 | * @struct cfg_param_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 66 | * @brief Structure to hold Host IF CFG Params Attributes |
| 67 | * @details |
| 68 | * @todo |
| 69 | * @sa |
| 70 | * @author Mai Daftedar |
| 71 | * @date 02 April 2012 |
| 72 | * @version 1.0 |
| 73 | */ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 74 | struct cfg_param_attr { |
Leo Kim | 9529650 | 2015-10-05 15:25:46 +0900 | [diff] [blame] | 75 | struct cfg_param_val pstrCfgParamVal; |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 76 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 77 | |
| 78 | /*! |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 79 | * @struct host_if_wpa_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 80 | * @brief Structure to hold Host IF Scan Attributes |
| 81 | * @details |
| 82 | * @todo |
| 83 | * @sa |
| 84 | * @author Mai Daftedar |
| 85 | * @date 25 March 2012 |
| 86 | * @version 1.0 |
| 87 | */ |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 88 | struct host_if_wpa_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 89 | u8 *pu8key; |
| 90 | const u8 *pu8macaddr; |
| 91 | u8 *pu8seq; |
| 92 | u8 u8seqlen; |
| 93 | u8 u8keyidx; |
| 94 | u8 u8Keylen; |
| 95 | u8 u8Ciphermode; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 96 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 97 | |
| 98 | |
| 99 | /*! |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 100 | * @struct host_if_wep_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 101 | * @brief Structure to hold Host IF Scan Attributes |
| 102 | * @details |
| 103 | * @todo |
| 104 | * @sa |
| 105 | * @author Mai Daftedar |
| 106 | * @date 25 March 2012 |
| 107 | * @version 1.0 |
| 108 | */ |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 109 | struct host_if_wep_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 110 | u8 *pu8WepKey; |
| 111 | u8 u8WepKeylen; |
| 112 | u8 u8Wepidx; |
| 113 | u8 u8mode; |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 114 | enum AUTHTYPE tenuAuth_type; |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 115 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 116 | |
| 117 | /*! |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 118 | * @struct host_if_key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 119 | * @brief Structure to hold Host IF Scan Attributes |
| 120 | * @details |
| 121 | * @todo |
| 122 | * @sa |
| 123 | * @author Mai Daftedar |
| 124 | * @date 25 March 2012 |
| 125 | * @version 1.0 |
| 126 | */ |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 127 | union host_if_key_attr { |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 128 | struct host_if_wep_attr strHostIFwepAttr; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 129 | struct host_if_wpa_attr strHostIFwpaAttr; |
Leo Kim | a949f90 | 2015-10-05 15:25:44 +0900 | [diff] [blame] | 130 | struct host_if_pmkid_attr strHostIFpmkidAttr; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 131 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 132 | |
| 133 | /*! |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 134 | * @struct key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 135 | * @brief Structure to hold Host IF Scan Attributes |
| 136 | * @details |
| 137 | * @todo |
| 138 | * @sa |
| 139 | * @author Mai Daftedar |
| 140 | * @date 25 March 2012 |
| 141 | * @version 1.0 |
| 142 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 143 | struct key_attr { |
Leo Kim | b9d9633 | 2015-10-05 15:25:40 +0900 | [diff] [blame] | 144 | enum KEY_TYPE enuKeyType; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 145 | u8 u8KeyAction; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 146 | union host_if_key_attr uniHostIFkeyAttr; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 147 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | /*! |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 153 | * @struct scan_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 154 | * @brief Structure to hold Host IF Scan Attributes |
| 155 | * @details |
| 156 | * @todo |
| 157 | * @sa |
| 158 | * @author Mostafa Abu Bakr |
| 159 | * @date 25 March 2012 |
| 160 | * @version 1.0 |
| 161 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 162 | struct scan_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 163 | u8 u8ScanSource; |
| 164 | u8 u8ScanType; |
| 165 | u8 *pu8ChnlFreqList; |
| 166 | u8 u8ChnlListLen; |
| 167 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 168 | size_t IEsLen; |
Leo Kim | ba1d1a6 | 2015-10-05 15:25:36 +0900 | [diff] [blame] | 169 | wilc_scan_result pfScanResult; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 170 | void *pvUserArg; |
Leo Kim | 607db44 | 2015-10-05 15:25:37 +0900 | [diff] [blame] | 171 | struct hidden_network strHiddenNetwork; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 172 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 173 | |
| 174 | /*! |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 175 | * @struct connect_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 176 | * @brief Structure to hold Host IF Connect Attributes |
| 177 | * @details |
| 178 | * @todo |
| 179 | * @sa |
| 180 | * @author Mostafa Abu Bakr |
| 181 | * @date 25 March 2012 |
| 182 | * @version 1.0 |
| 183 | */ |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 184 | struct connect_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 185 | u8 *pu8bssid; |
| 186 | u8 *pu8ssid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 187 | size_t ssidLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 188 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 189 | size_t IEsLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 190 | u8 u8security; |
Leo Kim | b6ab85f | 2015-10-05 15:25:38 +0900 | [diff] [blame] | 191 | wilc_connect_result pfConnectResult; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 192 | void *pvUserArg; |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 193 | enum AUTHTYPE tenuAuth_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 194 | u8 u8channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 195 | void *pJoinParams; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 196 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 197 | |
| 198 | /*! |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 199 | * @struct rcvd_async_info |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 200 | * @brief Structure to hold Received General Asynchronous info |
| 201 | * @details |
| 202 | * @todo |
| 203 | * @sa |
| 204 | * @author Mostafa Abu Bakr |
| 205 | * @date 25 March 2012 |
| 206 | * @version 1.0 |
| 207 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 208 | struct rcvd_async_info { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 209 | u8 *pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 210 | u32 u32Length; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 211 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 212 | |
| 213 | /*! |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 214 | * @struct channel_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 215 | * @brief Set Channel message body |
| 216 | * @details |
| 217 | * @todo |
| 218 | * @sa |
| 219 | * @author Mai Daftedar |
| 220 | * @date 25 March 2012 |
| 221 | * @version 1.0 |
| 222 | */ |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 223 | struct channel_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 224 | u8 u8SetChan; |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 225 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 226 | |
| 227 | /*! |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 228 | * @struct tstrScanComplete |
| 229 | * @brief hold received Async. Scan Complete message body |
| 230 | * @details |
| 231 | * @todo |
| 232 | * @sa |
| 233 | * @author zsalah |
| 234 | * @date 25 March 2012 |
| 235 | * @version 1.0 |
| 236 | */ |
| 237 | /*typedef struct _tstrScanComplete |
| 238 | * { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 239 | * u8* pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 240 | * u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 241 | * } tstrScanComplete;*/ |
| 242 | |
| 243 | /*! |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 244 | * @struct beacon_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 245 | * @brief Set Beacon message body |
| 246 | * @details |
| 247 | * @todo |
| 248 | * @sa |
| 249 | * @author Adham Abozaeid |
| 250 | * @date 10 July 2012 |
| 251 | * @version 1.0 |
| 252 | */ |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 253 | struct beacon_attr { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 254 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
| 255 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 256 | * (including the current frame) appear before the next DTIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 257 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 258 | 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] | 259 | * 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] | 260 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 261 | 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] | 262 | * after the TIM inormation element */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 263 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 264 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 265 | /*! |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 266 | * @struct set_multicast |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 267 | * @brief set Multicast filter Address |
| 268 | * @details |
| 269 | * @todo |
| 270 | * @sa |
| 271 | * @author Abdelrahman Sobhy |
| 272 | * @date 30 August 2013 |
| 273 | * @version 1.0 Description |
| 274 | */ |
| 275 | |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 276 | struct set_multicast { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 277 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 278 | u32 u32count; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 279 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 280 | |
| 281 | /*! |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 282 | * @struct del_all_sta |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 283 | * @brief Deauth station message body |
| 284 | * @details |
| 285 | * @todo |
| 286 | * @sa |
| 287 | * @author Mai Daftedar |
| 288 | * @date 09 April 2014 |
| 289 | * @version 1.0 Description |
| 290 | */ |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 291 | struct del_all_sta { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 292 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
| 293 | u8 u8Num_AssocSta; |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 294 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 295 | |
| 296 | /*! |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 297 | * @struct del_sta |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 298 | * @brief Delete station message body |
| 299 | * @details |
| 300 | * @todo |
| 301 | * @sa |
| 302 | * @author Adham Abozaeid |
| 303 | * @date 15 July 2012 |
| 304 | * @version 1.0 Description |
| 305 | */ |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 306 | struct del_sta { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 307 | u8 au8MacAddr[ETH_ALEN]; |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 308 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 309 | |
| 310 | /*! |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 311 | * @struct power_mgmt_param |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 312 | * @brief Power management message body |
| 313 | * @details |
| 314 | * @todo |
| 315 | * @sa |
| 316 | * @author Adham Abozaeid |
| 317 | * @date 24 November 2012 |
| 318 | * @version 1.0 |
| 319 | */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 320 | struct power_mgmt_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 321 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 322 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 323 | u32 u32Timeout; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 324 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 325 | |
| 326 | /*! |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 327 | * @struct set_ip_addr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 328 | * @brief set IP Address message body |
| 329 | * @details |
| 330 | * @todo |
| 331 | * @sa |
| 332 | * @author Abdelrahman Sobhy |
| 333 | * @date 30 August 2013 |
| 334 | * @version 1.0 Description |
| 335 | */ |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 336 | struct set_ip_addr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 337 | u8 *au8IPAddr; |
| 338 | u8 idx; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 339 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 340 | |
| 341 | /*! |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 342 | * @struct sta_inactive_t |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 343 | * @brief Get station message body |
| 344 | * @details |
| 345 | * @todo |
| 346 | * @sa |
| 347 | * @author Mai Daftedar |
| 348 | * @date 16 April 2013 |
| 349 | * @version 1.0 |
| 350 | */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 351 | struct sta_inactive_t { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 352 | u8 mac[6]; |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 353 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 354 | /**/ |
| 355 | /*! |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 356 | * @union message_body |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 357 | * @brief Message body for the Host Interface message_q |
| 358 | * @details |
| 359 | * @todo |
| 360 | * @sa |
| 361 | * @author Mostafa Abu Bakr |
| 362 | * @date 25 March 2012 |
| 363 | * @version 1.0 |
| 364 | */ |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 365 | union message_body { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 366 | struct scan_attr scan_info; |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 367 | struct connect_attr con_info; |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 368 | struct rcvd_net_info net_info; |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 369 | struct rcvd_async_info async_info; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 370 | struct key_attr key_info; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 371 | struct cfg_param_attr cfg_info; |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 372 | struct channel_attr channel_info; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 373 | struct beacon_attr beacon_info; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 374 | struct add_sta_param add_sta_info; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 375 | struct del_sta del_sta_info; |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 376 | struct add_sta_param edit_sta_info; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 377 | struct power_mgmt_param pwr_mgmt_info; |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 378 | struct sta_inactive_t mac_info; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 379 | struct set_ip_addr ip_info; |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 380 | struct drv_handler drv; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 381 | struct set_multicast multicast_info; |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 382 | struct op_mode mode; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 383 | struct set_mac_addr set_mac_info; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 384 | struct get_mac_addr get_mac_info; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 385 | struct ba_session_info session_info; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 386 | struct remain_ch remain_on_ch; |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 387 | struct reg_frame reg_frame; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 388 | char *data; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 389 | struct del_all_sta del_all_sta_info; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 390 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 391 | |
| 392 | /*! |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 393 | * @struct struct host_if_msg |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 394 | * @brief Host Interface message |
| 395 | * @details |
| 396 | * @todo |
| 397 | * @sa |
| 398 | * @author Mostafa Abu Bakr |
| 399 | * @date 25 March 2012 |
| 400 | * @version 1.0 |
| 401 | */ |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 402 | struct host_if_msg { |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 403 | u16 id; /*!< Message ID */ |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 404 | union message_body body; /*!< Message body */ |
Johnny Kim | 11f58c8 | 2015-08-13 13:41:20 +0900 | [diff] [blame] | 405 | tstrWILC_WFIDrv *drvHandler; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 406 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 407 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 408 | typedef struct _tstrWidJoinReqExt { |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 409 | char SSID[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 410 | u8 u8channel; |
| 411 | u8 BSSID[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 412 | } tstrWidJoinReqExt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 413 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 414 | /*Struct containg joinParam of each AP*/ |
| 415 | typedef struct _tstrJoinBssParam { |
| 416 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 417 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 418 | u16 beacon_period; |
| 419 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 420 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 421 | char ssid[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 422 | u8 ssidLen; |
| 423 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 424 | u8 ht_capable; |
| 425 | u8 wmm_cap; |
| 426 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 427 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 428 | u8 rsn_grp_policy; |
| 429 | u8 mode_802_11i; |
| 430 | u8 rsn_pcip_policy[3]; |
| 431 | u8 rsn_auth_policy[3]; |
| 432 | u8 rsn_cap[2]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 433 | struct _tstrJoinParam *nextJoinBss; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 434 | u32 tsf; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 435 | u8 u8NoaEnbaled; |
| 436 | u8 u8OppEnable; |
| 437 | u8 u8CtWindow; |
| 438 | u8 u8Count; |
| 439 | u8 u8Index; |
| 440 | u8 au8Duration[4]; |
| 441 | u8 au8Interval[4]; |
| 442 | u8 au8StartTime[4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 443 | } tstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 444 | /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/ |
| 445 | typedef struct _tstrBssTable { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 446 | u8 u8noBssEntries; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 447 | tstrJoinBssParam *head; |
| 448 | tstrJoinBssParam *tail; |
| 449 | } tstrBssTable; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 450 | |
| 451 | typedef enum { |
| 452 | SCAN_TIMER = 0, |
| 453 | CONNECT_TIMER = 1, |
| 454 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF |
| 455 | } tenuScanConnTimer; |
| 456 | |
| 457 | /*****************************************************************************/ |
| 458 | /* */ |
| 459 | /* Global Variabls */ |
| 460 | /* */ |
| 461 | /*****************************************************************************/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 462 | /* Zero is not used, because a zero ID means termination */ |
| 463 | static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
Daniel Machon | 6fdb302 | 2015-07-06 19:48:04 +0200 | [diff] [blame] | 464 | tstrWILC_WFIDrv *terminated_handle; |
| 465 | tstrWILC_WFIDrv *gWFiDrvHandle; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 466 | bool g_obtainingIP = false; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 467 | u8 P2P_LISTEN_STATE; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 468 | static struct task_struct *HostIFthreadHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 469 | static WILC_MsgQueueHandle gMsgQHostIF; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 470 | static struct semaphore hSemHostIFthrdEnd; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 471 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 472 | struct semaphore hSemDeinitDrvHandle; |
| 473 | static struct semaphore hWaitResponse; |
| 474 | struct semaphore hSemHostIntDeinit; |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 475 | struct timer_list g_hPeriodicRSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 476 | |
| 477 | |
| 478 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 479 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 480 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 481 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 482 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 483 | bool gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 484 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 485 | static s8 gs8Rssi; |
| 486 | static s8 gs8lnkspd; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 487 | static u8 gu8Chnl; |
| 488 | static u8 gs8SetIP[2][4]; |
| 489 | static u8 gs8GetIP[2][4]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 490 | static u32 gu32InactiveTime; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 491 | static u8 gu8DelBcn; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 492 | static u32 gu32WidConnRstHack; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 493 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 494 | u8 *gu8FlushedJoinReq; |
| 495 | u8 *gu8FlushedInfoElemAsoc; |
| 496 | u8 gu8Flushed11iMode; |
| 497 | u8 gu8FlushedAuthType; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 498 | u32 gu32FlushedJoinReqSize; |
| 499 | u32 gu32FlushedInfoElemAsocSize; |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 500 | tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 501 | #define REAL_JOIN_REQ 0 |
| 502 | #define FLUSHED_JOIN_REQ 1 |
| 503 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ |
| 504 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 505 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 506 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 507 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 508 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 509 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 510 | static int add_handler_in_list(tstrWILC_WFIDrv *handler) |
| 511 | { |
| 512 | int i; |
| 513 | |
| 514 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 515 | if (!wfidrv_list[i]) { |
| 516 | wfidrv_list[i] = handler; |
| 517 | return 0; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | return -ENOBUFS; |
| 522 | } |
| 523 | |
| 524 | static int remove_handler_in_list(tstrWILC_WFIDrv *handler) |
| 525 | { |
| 526 | int i; |
| 527 | |
| 528 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 529 | if (wfidrv_list[i] == handler) { |
| 530 | wfidrv_list[i] = NULL; |
| 531 | return 0; |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | return -EINVAL; |
| 536 | } |
| 537 | |
| 538 | static int get_id_from_handler(tstrWILC_WFIDrv *handler) |
| 539 | { |
| 540 | int i; |
| 541 | |
| 542 | if (!handler) |
| 543 | return 0; |
| 544 | |
| 545 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 546 | if (wfidrv_list[i] == handler) |
| 547 | return i; |
| 548 | } |
| 549 | |
| 550 | return 0; |
| 551 | } |
| 552 | |
| 553 | static tstrWILC_WFIDrv *get_handler_from_id(int id) |
| 554 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 555 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 556 | return NULL; |
| 557 | return wfidrv_list[id]; |
| 558 | } |
| 559 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 560 | /** |
| 561 | * @brief Handle_SetChannel |
| 562 | * @details Sending config packet to firmware to set channel |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 563 | * @param[in] struct channel_attr *pstrHostIFSetChan |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 564 | * @return Error code. |
| 565 | * @author |
| 566 | * @date |
| 567 | * @version 1.0 |
| 568 | */ |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 569 | static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 570 | struct channel_attr *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 571 | { |
| 572 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 573 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 574 | tstrWID strWID; |
| 575 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 576 | |
| 577 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 578 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 579 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 580 | strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan); |
| 581 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 582 | |
| 583 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
| 584 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 585 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 586 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 587 | if (s32Error) { |
| 588 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 589 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 590 | } |
| 591 | |
| 592 | return s32Error; |
| 593 | } |
| 594 | /** |
| 595 | * @brief Handle_SetWfiDrvHandler |
| 596 | * @details Sending config packet to firmware to set driver handler |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 597 | * @param[in] void * drvHandler, |
| 598 | * struct drv_handler *pstrHostIfSetDrvHandler |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 599 | * @return Error code. |
| 600 | * @author |
| 601 | * @date |
| 602 | * @version 1.0 |
| 603 | */ |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 604 | static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 605 | struct drv_handler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 606 | { |
| 607 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 608 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 609 | tstrWID strWID; |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 610 | tstrWILC_WFIDrv *pstrWFIDrv = drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 611 | |
| 612 | |
| 613 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 614 | strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 615 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 616 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 617 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 618 | |
| 619 | /*Sending Cfg*/ |
| 620 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 621 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 622 | pstrHostIfSetDrvHandler->u32Address); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 623 | |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 624 | if (pstrWFIDrv == NULL) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 625 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 626 | |
| 627 | |
| 628 | if (s32Error) { |
| 629 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 630 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | return s32Error; |
| 634 | } |
| 635 | |
| 636 | /** |
| 637 | * @brief Handle_SetWfiAPDrvHandler |
| 638 | * @details Sending config packet to firmware to set driver handler |
| 639 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 640 | * @return Error code. |
| 641 | * @author |
| 642 | * @date |
| 643 | * @version 1.0 |
| 644 | */ |
Tony Cho | 801bee5 | 2015-09-21 12:16:53 +0900 | [diff] [blame] | 645 | static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, |
| 646 | struct op_mode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 647 | { |
| 648 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 649 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 650 | tstrWID strWID; |
| 651 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 652 | |
| 653 | |
| 654 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 655 | strWID.u16WIDid = (u16)WID_SET_OPERATION_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 656 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 657 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetOperationMode->u32Mode); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 658 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 659 | |
| 660 | /*Sending Cfg*/ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 661 | PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 662 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 663 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 664 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 665 | |
| 666 | |
Johnny Kim | c590b9a | 2015-09-08 17:07:59 +0900 | [diff] [blame] | 667 | if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 668 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 669 | |
| 670 | |
| 671 | if (s32Error) { |
| 672 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 673 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 674 | } |
| 675 | |
| 676 | return s32Error; |
| 677 | } |
| 678 | |
| 679 | /** |
| 680 | * @brief host_int_set_IPAddress |
| 681 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 682 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 683 | * @return Error code. |
| 684 | * @author |
| 685 | * @date |
| 686 | * @version 1.0 |
| 687 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 688 | s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 689 | { |
| 690 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 691 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 692 | tstrWID strWID; |
| 693 | char firmwareIPAddress[4] = {0}; |
| 694 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 695 | |
| 696 | if (pu8IPAddr[0] < 192) |
| 697 | pu8IPAddr[0] = 0; |
| 698 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 699 | 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] | 700 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 701 | memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 702 | |
| 703 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 704 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 705 | strWID.enuWIDtype = WID_STR; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 706 | strWID.ps8WidVal = (u8 *)pu8IPAddr; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 707 | strWID.s32ValueSize = IP_ALEN; |
| 708 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 709 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 710 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 711 | |
| 712 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 713 | host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 714 | |
| 715 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 716 | PRINT_ER("Failed to set IP address\n"); |
| 717 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 718 | } |
| 719 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 720 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 721 | |
| 722 | return s32Error; |
| 723 | } |
| 724 | |
| 725 | |
| 726 | /** |
| 727 | * @brief Handle_get_IPAddress |
| 728 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 729 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 730 | * @return Error code. |
| 731 | * @author |
| 732 | * @date |
| 733 | * @version 1.0 |
| 734 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 735 | s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 736 | { |
| 737 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 738 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 739 | tstrWID strWID; |
| 740 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 741 | |
| 742 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 743 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 744 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 745 | strWID.ps8WidVal = kmalloc(IP_ALEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 746 | strWID.s32ValueSize = IP_ALEN; |
| 747 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 748 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 749 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 750 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 751 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 752 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 753 | memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 754 | |
| 755 | /*get the value by searching the local copy*/ |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 756 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 757 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 758 | if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 759 | host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 760 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 761 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 762 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 763 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 764 | } |
| 765 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 766 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
| 767 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); |
| 768 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 769 | |
| 770 | return s32Error; |
| 771 | } |
| 772 | |
| 773 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 774 | /** |
| 775 | * @brief Handle_SetMacAddress |
| 776 | * @details Setting mac address |
| 777 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 778 | * @return Error code. |
| 779 | * @author Amr Abdel-Moghny |
| 780 | * @date November 2013 |
| 781 | * @version 7.0 |
| 782 | */ |
Tony Cho | b7611a8 | 2015-09-21 12:16:54 +0900 | [diff] [blame] | 783 | static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, |
| 784 | struct set_mac_addr *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 785 | { |
| 786 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 787 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 788 | tstrWID strWID; |
| 789 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 790 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 791 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 792 | if (mac_buf == NULL) { |
| 793 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 794 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 795 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 796 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 797 | |
| 798 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 799 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 800 | strWID.enuWIDtype = WID_STR; |
| 801 | strWID.ps8WidVal = mac_buf; |
| 802 | strWID.s32ValueSize = ETH_ALEN; |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 803 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 804 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 805 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 806 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 807 | if (s32Error) { |
| 808 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 809 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 810 | } |
| 811 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 812 | kfree(mac_buf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 813 | return s32Error; |
| 814 | } |
| 815 | |
| 816 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 817 | /** |
| 818 | * @brief Handle_GetMacAddress |
| 819 | * @details Getting mac address |
| 820 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 821 | * @return Error code. |
| 822 | * @author Amr Abdel-Moghny |
| 823 | * @date JAN 2013 |
| 824 | * @version 8.0 |
| 825 | */ |
Tony Cho | fcd27c5 | 2015-09-21 12:16:55 +0900 | [diff] [blame] | 826 | static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, |
| 827 | struct get_mac_addr *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 828 | { |
| 829 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 830 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 831 | tstrWID strWID; |
| 832 | |
| 833 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 834 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 835 | strWID.enuWIDtype = WID_STR; |
| 836 | strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress; |
| 837 | strWID.s32ValueSize = ETH_ALEN; |
| 838 | |
| 839 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 840 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, false, |
| 841 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 842 | if (s32Error) { |
| 843 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 844 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 845 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 846 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 847 | |
| 848 | return s32Error; |
| 849 | } |
| 850 | |
| 851 | |
| 852 | /** |
| 853 | * @brief Handle_CfgParam |
| 854 | * @details Sending config packet to firmware to set CFG params |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 855 | * @param[in] struct cfg_param_attr *strHostIFCfgParamAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 856 | * @return Error code. |
| 857 | * @author |
| 858 | * @date |
| 859 | * @version 1.0 |
| 860 | */ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 861 | static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, |
| 862 | struct cfg_param_attr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 863 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 864 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 865 | tstrWID strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 866 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 867 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 868 | |
| 869 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 870 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 871 | |
| 872 | |
| 873 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 874 | |
| 875 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) { |
| 876 | /*----------------------------------------------------------*/ |
| 877 | /*Input Value: INFRASTRUCTURE = 1, */ |
| 878 | /* INDEPENDENT= 2, */ |
| 879 | /* ANY_BSS= 3 */ |
| 880 | /*----------------------------------------------------------*/ |
| 881 | /* validate input then copy>> need to check value 4 and 5 */ |
| 882 | if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) { |
| 883 | strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 884 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 885 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 886 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 887 | pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 888 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 889 | PRINT_ER("check value 6 over\n"); |
| 890 | s32Error = -EINVAL; |
| 891 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 892 | } |
| 893 | u8WidCnt++; |
| 894 | } |
| 895 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) { |
| 896 | /*------------------------------------------------------*/ |
| 897 | /*Input Values: OPEN_SYSTEM = 0, */ |
| 898 | /* SHARED_KEY = 1, */ |
| 899 | /* ANY = 2 */ |
| 900 | /*------------------------------------------------------*/ |
| 901 | /*validate Possible values*/ |
| 902 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) { |
| 903 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 904 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 905 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 906 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 907 | pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 908 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 909 | PRINT_ER("Impossible value \n"); |
| 910 | s32Error = -EINVAL; |
| 911 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 912 | } |
| 913 | u8WidCnt++; |
| 914 | } |
| 915 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) { |
| 916 | /* range is 1 to 65535. */ |
| 917 | if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) { |
| 918 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 919 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 920 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 921 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 922 | pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
| 923 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 924 | PRINT_ER("Range(1 ~ 65535) over\n"); |
| 925 | s32Error = -EINVAL; |
| 926 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 927 | } |
| 928 | u8WidCnt++; |
| 929 | } |
| 930 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) { |
| 931 | /*-----------------------------------------------------------*/ |
| 932 | /*Input Values: NO_POWERSAVE = 0, */ |
| 933 | /* MIN_FAST_PS = 1, */ |
| 934 | /* MAX_FAST_PS = 2, */ |
| 935 | /* MIN_PSPOLL_PS = 3, */ |
| 936 | /* MAX_PSPOLL_PS = 4 */ |
| 937 | /*----------------------------------------------------------*/ |
| 938 | if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) { |
| 939 | strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 940 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 941 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 942 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 943 | pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 944 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 945 | PRINT_ER("Invalide power mode\n"); |
| 946 | s32Error = -EINVAL; |
| 947 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 948 | } |
| 949 | u8WidCnt++; |
| 950 | } |
| 951 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) { |
| 952 | /* range from 1 to 256 */ |
| 953 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) { |
| 954 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 955 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 956 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 957 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 958 | pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
| 959 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 960 | PRINT_ER("Range(1~256) over\n"); |
| 961 | s32Error = -EINVAL; |
| 962 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 963 | } |
| 964 | u8WidCnt++; |
| 965 | } |
| 966 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) { |
| 967 | /* range from 1 to 256 */ |
| 968 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) { |
| 969 | strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 970 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 971 | |
| 972 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 973 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 974 | pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
| 975 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 976 | PRINT_ER("Range(1~256) over\n"); |
| 977 | s32Error = -EINVAL; |
| 978 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 979 | } |
| 980 | u8WidCnt++; |
| 981 | } |
| 982 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) { |
| 983 | |
| 984 | if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) { |
| 985 | strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 986 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 987 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 988 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 989 | pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
| 990 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 991 | PRINT_ER("Threshold Range fail\n"); |
| 992 | s32Error = -EINVAL; |
| 993 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 994 | } |
| 995 | u8WidCnt++; |
| 996 | } |
| 997 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) { |
| 998 | /* range 256 to 65535 */ |
| 999 | if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) { |
| 1000 | strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1001 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1002 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1003 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1004 | pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
| 1005 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1006 | PRINT_ER("Threshold Range fail\n"); |
| 1007 | s32Error = -EINVAL; |
| 1008 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1009 | } |
| 1010 | u8WidCnt++; |
| 1011 | } |
| 1012 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) { |
| 1013 | /*-----------------------------------------------------*/ |
| 1014 | /*Input Values: Short= 0, */ |
| 1015 | /* Long= 1, */ |
| 1016 | /* Auto= 2 */ |
| 1017 | /*------------------------------------------------------*/ |
| 1018 | if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) { |
| 1019 | strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1020 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1021 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1022 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1023 | pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
| 1024 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1025 | PRINT_ER("Preamle Range(0~2) 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 & SHORT_SLOT_ALLOWED) { |
| 1032 | if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) { |
| 1033 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1034 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1035 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1036 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1037 | pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1038 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1039 | PRINT_ER("Short slot(2) over\n"); |
| 1040 | s32Error = -EINVAL; |
| 1041 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1042 | } |
| 1043 | u8WidCnt++; |
| 1044 | } |
| 1045 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) { |
| 1046 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ |
| 1047 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ |
| 1048 | /* this information is useful for external supplicant */ |
| 1049 | /*Input Values: 1 for enable and 0 for disable. */ |
| 1050 | if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) { |
| 1051 | strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1052 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1053 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1054 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1055 | pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1056 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1057 | PRINT_ER("TXOP prot disable\n"); |
| 1058 | s32Error = -EINVAL; |
| 1059 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1060 | } |
| 1061 | u8WidCnt++; |
| 1062 | } |
| 1063 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) { |
| 1064 | /* range is 1 to 65535. */ |
| 1065 | if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) { |
| 1066 | strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1067 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1068 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1069 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1070 | pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
| 1071 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1072 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
| 1073 | s32Error = -EINVAL; |
| 1074 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1075 | } |
| 1076 | u8WidCnt++; |
| 1077 | } |
| 1078 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) { |
| 1079 | /* range is 1 to 255. */ |
| 1080 | if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) { |
| 1081 | strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1082 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1083 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1084 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1085 | pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
| 1086 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1087 | PRINT_ER("DTIM range(1~255) fail\n"); |
| 1088 | s32Error = -EINVAL; |
| 1089 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1090 | } |
| 1091 | u8WidCnt++; |
| 1092 | } |
| 1093 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) { |
| 1094 | /*----------------------------------------------------------------------*/ |
| 1095 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ |
| 1096 | /* SITE_SURVEY_ALL_CH = 1, */ |
| 1097 | /* SITE_SURVEY_OFF = 2 */ |
| 1098 | /*----------------------------------------------------------------------*/ |
| 1099 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) { |
| 1100 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1101 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1102 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1103 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1104 | pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1105 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1106 | PRINT_ER("Site survey disable\n"); |
| 1107 | s32Error = -EINVAL; |
| 1108 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1109 | } |
| 1110 | u8WidCnt++; |
| 1111 | } |
| 1112 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) { |
| 1113 | /* range is 1 to 65535. */ |
| 1114 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) { |
| 1115 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1116 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1117 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1118 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1119 | pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
| 1120 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1121 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
| 1122 | s32Error = -EINVAL; |
| 1123 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1124 | } |
| 1125 | u8WidCnt++; |
| 1126 | } |
| 1127 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) { |
| 1128 | /* range is 1 to 65535. */ |
| 1129 | if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) { |
| 1130 | strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1131 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1132 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1133 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1134 | pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
| 1135 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1136 | PRINT_ER("Active scan time(1~65535) over\n"); |
| 1137 | s32Error = -EINVAL; |
| 1138 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1139 | } |
| 1140 | u8WidCnt++; |
| 1141 | } |
| 1142 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) { |
| 1143 | /* range is 1 to 65535. */ |
| 1144 | if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) { |
| 1145 | strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1146 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1147 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1148 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1149 | pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
| 1150 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1151 | PRINT_ER("Passive scan time(1~65535) over\n"); |
| 1152 | s32Error = -EINVAL; |
| 1153 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1154 | } |
| 1155 | u8WidCnt++; |
| 1156 | } |
| 1157 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) { |
Leo Kim | 430a78c | 2015-10-05 15:25:48 +0900 | [diff] [blame] | 1158 | enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1159 | /*----------------------------------------------------------------------*/ |
| 1160 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ |
| 1161 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ |
| 1162 | /*----------------------------------------------------------------------*/ |
| 1163 | /* validate rate */ |
| 1164 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 1165 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 1166 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 1167 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 1168 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 1169 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
| 1170 | strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1171 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1172 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1173 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1174 | pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1175 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1176 | PRINT_ER("out of TX rate\n"); |
| 1177 | s32Error = -EINVAL; |
| 1178 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1179 | } |
| 1180 | u8WidCnt++; |
| 1181 | } |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1182 | s32Error = send_config_pkt(SET_CFG, strWIDList, u8WidCnt, false, |
| 1183 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1184 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1185 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1186 | PRINT_ER("Error in setting CFG params\n"); |
| 1187 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1188 | ERRORHANDLER: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1189 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1190 | return s32Error; |
| 1191 | } |
| 1192 | |
| 1193 | |
| 1194 | /** |
| 1195 | * @brief Handle_wait_msg_q_empty |
| 1196 | * @details this should be the last msg and then the msg Q becomes idle |
| 1197 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1198 | * @return Error code. |
| 1199 | * @author |
| 1200 | * @date |
| 1201 | * @version 1.0 |
| 1202 | */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1203 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1204 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1205 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1206 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1207 | g_wilc_initialized = 0; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1208 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1209 | return s32Error; |
| 1210 | } |
| 1211 | |
| 1212 | /** |
| 1213 | * @brief Handle_Scan |
| 1214 | * @details Sending config packet to firmware to set the scan params |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1215 | * @param[in] struct scan_attr *pstrHostIFscanAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1216 | * @return Error code. |
| 1217 | * @author |
| 1218 | * @date |
| 1219 | * @version 1.0 |
| 1220 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1221 | static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, |
| 1222 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1223 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1224 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1225 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1226 | u32 u32WidsCount = 0; |
| 1227 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1228 | u8 *pu8Buffer; |
| 1229 | u8 valuesize = 0; |
| 1230 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1231 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1232 | |
| 1233 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1234 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1235 | |
| 1236 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; |
| 1237 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; |
| 1238 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1239 | if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) { |
| 1240 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ |
| 1241 | 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] | 1242 | PRINT_ER("Already scan\n"); |
| 1243 | s32Error = -EBUSY; |
| 1244 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1245 | } |
| 1246 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1247 | if (g_obtainingIP || connecting) { |
| 1248 | 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] | 1249 | PRINT_ER("Don't do obss scan\n"); |
| 1250 | s32Error = -EBUSY; |
| 1251 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1252 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1253 | |
| 1254 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 1255 | |
| 1256 | |
| 1257 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
| 1258 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1259 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1260 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1261 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1262 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1263 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1264 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1265 | strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1266 | if (strWIDList[u32WidsCount].ps8WidVal != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1267 | pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; |
| 1268 | |
| 1269 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; |
| 1270 | |
| 1271 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); |
| 1272 | |
| 1273 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { |
| 1274 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1275 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1276 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 1277 | } |
| 1278 | |
| 1279 | |
| 1280 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1281 | strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1282 | u32WidsCount++; |
| 1283 | } |
| 1284 | |
| 1285 | /*filling cfg param array*/ |
| 1286 | |
| 1287 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ |
| 1288 | { |
| 1289 | /* IEs to be inserted in Probe Request */ |
| 1290 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE; |
| 1291 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1292 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs; |
| 1293 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen; |
| 1294 | u32WidsCount++; |
| 1295 | } |
| 1296 | |
| 1297 | /*Scan Type*/ |
| 1298 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE; |
| 1299 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1300 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1301 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1302 | u32WidsCount++; |
| 1303 | |
| 1304 | /*list of channels to be scanned*/ |
| 1305 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST; |
| 1306 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1307 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1308 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { |
| 1309 | int i; |
| 1310 | |
| 1311 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1312 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1313 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList; |
| 1318 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen; |
| 1319 | u32WidsCount++; |
| 1320 | |
| 1321 | /*Scan Request*/ |
| 1322 | strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ; |
| 1323 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1324 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1325 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1326 | u32WidsCount++; |
| 1327 | |
| 1328 | /*keep the state as is , no need to change it*/ |
| 1329 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ |
| 1330 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1331 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1332 | gbScanWhileConnected = true; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1333 | else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1334 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1335 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1336 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1337 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1338 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1339 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1340 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1341 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1342 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1343 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1344 | ERRORHANDLER: |
| 1345 | if (s32Error) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1346 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1347 | /*if there is an ongoing scan request*/ |
| 1348 | Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); |
| 1349 | } |
| 1350 | |
| 1351 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1352 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1353 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1354 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1355 | } |
| 1356 | |
| 1357 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ |
| 1358 | if (pstrHostIFscanAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1359 | kfree(pstrHostIFscanAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1360 | pstrHostIFscanAttr->pu8IEs = NULL; |
| 1361 | } |
| 1362 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1363 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1364 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
| 1365 | } |
| 1366 | |
| 1367 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1368 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1369 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1370 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1371 | } |
| 1372 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1373 | if (pu8HdnNtwrksWidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1374 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1375 | |
| 1376 | return s32Error; |
| 1377 | } |
| 1378 | |
| 1379 | /** |
| 1380 | * @brief Handle_ScanDone |
| 1381 | * @details Call scan notification callback function |
| 1382 | * @param[in] NONE |
| 1383 | * @return Error code. |
| 1384 | * @author |
| 1385 | * @date |
| 1386 | * @version 1.0 |
| 1387 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1388 | static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1389 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1390 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1391 | |
| 1392 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1393 | |
| 1394 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1395 | u8 u8abort_running_scan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1396 | tstrWID strWID; |
| 1397 | |
| 1398 | |
| 1399 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 1400 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1401 | /*Ask FW to abort the running scan, if any*/ |
| 1402 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 1403 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 1404 | u8abort_running_scan = 1; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1405 | strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1406 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1407 | strWID.ps8WidVal = (s8 *)&u8abort_running_scan; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1408 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1409 | |
| 1410 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1411 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 1412 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1413 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1414 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1415 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | if (pstrWFIDrv == NULL) { |
| 1420 | PRINT_ER("Driver handler is NULL\n"); |
| 1421 | return s32Error; |
| 1422 | } |
| 1423 | |
| 1424 | /*if there is an ongoing scan request*/ |
| 1425 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1426 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1427 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 1428 | /*delete current scan request*/ |
| 1429 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
| 1430 | } |
| 1431 | |
| 1432 | return s32Error; |
| 1433 | } |
| 1434 | |
| 1435 | /** |
| 1436 | * @brief Handle_Connect |
| 1437 | * @details Sending config packet to firmware to starting connection |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1438 | * @param[in] struct connect_attr *pstrHostIFconnectAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1439 | * @return Error code. |
| 1440 | * @author |
| 1441 | * @date |
| 1442 | * @version 1.0 |
| 1443 | */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1444 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1445 | static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, |
| 1446 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1447 | { |
| 1448 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1449 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1450 | tstrWID strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1451 | u32 u32WidsCount = 0, dummyval = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1452 | /* char passphrase[] = "12345678"; */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1453 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1454 | tstrJoinBssParam *ptstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1455 | |
| 1456 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1457 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1458 | /* if we try to connect to an already connected AP then discard the request */ |
| 1459 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1460 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1461 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1462 | s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1463 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
| 1464 | return s32Error; |
| 1465 | } |
| 1466 | |
| 1467 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1468 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1469 | ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams; |
| 1470 | if (ptstrJoinBssParam == NULL) { |
| 1471 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1472 | s32Error = -ENOENT; |
| 1473 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1474 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1475 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1476 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1477 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1478 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1479 | } |
| 1480 | |
| 1481 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1482 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1483 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1484 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1485 | pstrHostIFconnectAttr->ssidLen); |
| 1486 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1487 | } |
| 1488 | |
| 1489 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1490 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1491 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1492 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1493 | pstrHostIFconnectAttr->IEsLen); |
| 1494 | } |
| 1495 | |
| 1496 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1497 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1498 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1499 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1500 | |
| 1501 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 1502 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1503 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1504 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1505 | u32WidsCount++; |
| 1506 | |
| 1507 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 1508 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1509 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1510 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1511 | u32WidsCount++; |
| 1512 | |
| 1513 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 1514 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1515 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1516 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1517 | u32WidsCount++; |
| 1518 | |
| 1519 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1520 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1521 | { |
| 1522 | /* IEs to be inserted in Association Request */ |
| 1523 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1524 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1525 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1526 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1527 | u32WidsCount++; |
| 1528 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1529 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1530 | |
| 1531 | gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1532 | gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1533 | memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1534 | gu32FlushedInfoElemAsocSize); |
| 1535 | } |
| 1536 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1537 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1538 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1539 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1540 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1541 | u32WidsCount++; |
| 1542 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1543 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1544 | gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; |
| 1545 | |
| 1546 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1547 | |
| 1548 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1549 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1550 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1551 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1552 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1553 | u32WidsCount++; |
| 1554 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1555 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1556 | gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1557 | |
| 1558 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1559 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1560 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1561 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1562 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1563 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1564 | * u32WidsCount++; |
| 1565 | */ |
| 1566 | |
| 1567 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
| 1568 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); |
| 1569 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1570 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1571 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1572 | |
| 1573 | /*Sending NoA attributes during connection*/ |
| 1574 | strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1575 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1576 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1577 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1578 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1579 | gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1580 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1581 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
| 1582 | s32Error = -EFAULT; |
| 1583 | goto ERRORHANDLER; |
| 1584 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1585 | |
| 1586 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1587 | |
| 1588 | |
| 1589 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1590 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1591 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1592 | } |
| 1593 | pu8CurrByte += MAX_SSID_LEN; |
| 1594 | |
| 1595 | /* BSS type*/ |
| 1596 | *(pu8CurrByte++) = INFRASTRUCTURE; |
| 1597 | /* Channel*/ |
| 1598 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1599 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1600 | } else { |
| 1601 | PRINT_ER("Channel out of range\n"); |
| 1602 | *(pu8CurrByte++) = 0xFF; |
| 1603 | } |
| 1604 | /* Cap Info*/ |
| 1605 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1606 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1607 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1608 | |
| 1609 | /* sa*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1610 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1611 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1612 | pu8CurrByte += 6; |
| 1613 | |
| 1614 | /* bssid*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1615 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1616 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1617 | pu8CurrByte += 6; |
| 1618 | |
| 1619 | /* Beacon Period*/ |
| 1620 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1621 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1622 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1623 | /* DTIM Period*/ |
| 1624 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1625 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
| 1626 | /* Supported rates*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1627 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1628 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1629 | |
| 1630 | /* wmm cap*/ |
| 1631 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1632 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
| 1633 | /* uapsd cap*/ |
| 1634 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1635 | |
| 1636 | /* ht cap*/ |
| 1637 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
| 1638 | /* copy this information to the user request */ |
| 1639 | pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
| 1640 | |
| 1641 | /* rsn found*/ |
| 1642 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1643 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
| 1644 | /* rsn group policy*/ |
| 1645 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1646 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
| 1647 | /* mode_802_11i*/ |
| 1648 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1649 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
| 1650 | /* rsn pcip policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1651 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1652 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1653 | |
| 1654 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1655 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1656 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1657 | |
| 1658 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1659 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1660 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1661 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1662 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
| 1663 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1664 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; |
| 1665 | if (ptstrJoinBssParam->u8NoaEnbaled) { |
| 1666 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1667 | |
| 1668 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1669 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1670 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1671 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1672 | |
| 1673 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; |
| 1674 | |
| 1675 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; |
| 1676 | |
| 1677 | if (ptstrJoinBssParam->u8OppEnable) |
| 1678 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; |
| 1679 | |
| 1680 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; |
| 1681 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1682 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1683 | |
| 1684 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); |
| 1685 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1686 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1687 | |
| 1688 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); |
| 1689 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1690 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1691 | |
| 1692 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); |
| 1693 | |
| 1694 | } else |
| 1695 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1696 | |
| 1697 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1698 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1699 | u32WidsCount++; |
| 1700 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1701 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1702 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1703 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1704 | /* ////////////////////// */ |
| 1705 | gu32WidConnRstHack = 0; |
| 1706 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1707 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1708 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1709 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1710 | gu8FlushedJoinReqDrvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1711 | } |
| 1712 | |
| 1713 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1714 | |
| 1715 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1716 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1717 | |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1718 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
| 1719 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1720 | } |
| 1721 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1722 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1723 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1724 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1725 | PRINT_ER("failed to send config packet\n"); |
| 1726 | s32Error = -EFAULT; |
| 1727 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1728 | } else { |
| 1729 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
| 1730 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 1731 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1732 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1733 | ERRORHANDLER: |
| 1734 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1735 | tstrConnectInfo strConnectInfo; |
| 1736 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1737 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1738 | |
| 1739 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 1740 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1741 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1742 | |
| 1743 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1744 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1745 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1746 | |
| 1747 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
| 1748 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1749 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1750 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1751 | pstrHostIFconnectAttr->pu8IEs, |
| 1752 | pstrHostIFconnectAttr->IEsLen); |
| 1753 | } |
| 1754 | |
| 1755 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 1756 | &strConnectInfo, |
| 1757 | MAC_DISCONNECTED, |
| 1758 | NULL, |
| 1759 | pstrHostIFconnectAttr->pvUserArg); |
| 1760 | /*Change state to idle*/ |
| 1761 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 1762 | /* Deallocation */ |
| 1763 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1764 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1765 | strConnectInfo.pu8ReqIEs = NULL; |
| 1766 | } |
| 1767 | |
| 1768 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1769 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1770 | } |
| 1771 | } |
| 1772 | |
| 1773 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
| 1774 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ |
| 1775 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1776 | kfree(pstrHostIFconnectAttr->pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1777 | pstrHostIFconnectAttr->pu8bssid = NULL; |
| 1778 | } |
| 1779 | |
| 1780 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ |
| 1781 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1782 | kfree(pstrHostIFconnectAttr->pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1783 | pstrHostIFconnectAttr->pu8ssid = NULL; |
| 1784 | } |
| 1785 | |
| 1786 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ |
| 1787 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1788 | kfree(pstrHostIFconnectAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1789 | pstrHostIFconnectAttr->pu8IEs = NULL; |
| 1790 | } |
| 1791 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1792 | if (pu8CurrByte != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1793 | kfree(pu8CurrByte); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1794 | return s32Error; |
| 1795 | } |
| 1796 | |
| 1797 | /** |
| 1798 | * @brief Handle_FlushConnect |
| 1799 | * @details Sending config packet to firmware to flush an old connection |
| 1800 | * after switching FW from station one to hybrid one |
| 1801 | * @param[in] void * drvHandler |
| 1802 | * @return Error code. |
| 1803 | * @author Amr Abdel-Moghny |
| 1804 | * @date 19 DEC 2013 |
| 1805 | * @version 8.0 |
| 1806 | */ |
| 1807 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1808 | static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1809 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1810 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1811 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1812 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1813 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1814 | |
| 1815 | |
| 1816 | /* IEs to be inserted in Association Request */ |
| 1817 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1818 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1819 | strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc; |
| 1820 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize; |
| 1821 | u32WidsCount++; |
| 1822 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1823 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1824 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1825 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1826 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1827 | u32WidsCount++; |
| 1828 | |
| 1829 | |
| 1830 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1831 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1832 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1833 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1834 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1835 | u32WidsCount++; |
| 1836 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1837 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1838 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1839 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1840 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1841 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1842 | |
| 1843 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 1844 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 1845 | |
| 1846 | u32WidsCount++; |
| 1847 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1848 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1849 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1850 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1851 | PRINT_ER("failed to send config packet\n"); |
| 1852 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1853 | } |
| 1854 | |
| 1855 | return s32Error; |
| 1856 | } |
| 1857 | |
| 1858 | /** |
| 1859 | * @brief Handle_ConnectTimeout |
| 1860 | * @details Call connect notification callback function indicating connection failure |
| 1861 | * @param[in] NONE |
| 1862 | * @return Error code. |
| 1863 | * @author |
| 1864 | * @date |
| 1865 | * @version 1.0 |
| 1866 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1867 | static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1868 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1869 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1870 | tstrConnectInfo strConnectInfo; |
| 1871 | tstrWID strWID; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1872 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1873 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1874 | |
| 1875 | if (pstrWFIDrv == NULL) { |
| 1876 | PRINT_ER("Driver handler is NULL\n"); |
| 1877 | return s32Error; |
| 1878 | } |
| 1879 | |
| 1880 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 1881 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1882 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1883 | |
| 1884 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1885 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1886 | |
| 1887 | |
| 1888 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, |
| 1889 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 1890 | * WID_DISCONNECT} */ |
| 1891 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 1892 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1893 | memcpy(strConnectInfo.au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1894 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
| 1895 | } |
| 1896 | |
| 1897 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 1898 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1899 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1900 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1901 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1902 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 1903 | } |
| 1904 | |
| 1905 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 1906 | &strConnectInfo, |
| 1907 | MAC_DISCONNECTED, |
| 1908 | NULL, |
| 1909 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 1910 | |
| 1911 | /* Deallocation of strConnectInfo.pu8ReqIEs */ |
| 1912 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1913 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1914 | strConnectInfo.pu8ReqIEs = NULL; |
| 1915 | } |
| 1916 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1917 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1918 | } |
| 1919 | |
| 1920 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 1921 | * WID_DISCONNECT} */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1922 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1923 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1924 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1925 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1926 | |
| 1927 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1928 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1929 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 1930 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1931 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1932 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1933 | |
| 1934 | /* Deallocation of the Saved Connect Request in the global Handle */ |
| 1935 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 1936 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1937 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1938 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 1939 | } |
| 1940 | |
| 1941 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1942 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1943 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 1944 | } |
| 1945 | |
| 1946 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 1947 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1948 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1949 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 1950 | } |
| 1951 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1952 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1953 | /*Freeing flushed join request params on connect timeout*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1954 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1955 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1956 | gu8FlushedJoinReq = NULL; |
| 1957 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1958 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1959 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1960 | gu8FlushedInfoElemAsoc = NULL; |
| 1961 | } |
| 1962 | |
| 1963 | return s32Error; |
| 1964 | } |
| 1965 | |
| 1966 | /** |
| 1967 | * @brief Handle_RcvdNtwrkInfo |
| 1968 | * @details Handling received network information |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1969 | * @param[in] struct rcvd_net_info *pstrRcvdNetworkInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1970 | * @return Error code. |
| 1971 | * @author |
| 1972 | * @date |
| 1973 | * @version 1.0 |
| 1974 | */ |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1975 | static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, |
| 1976 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1977 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1978 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1979 | bool bNewNtwrkFound; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1980 | |
| 1981 | |
| 1982 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1983 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1984 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 1985 | void *pJoinParams = NULL; |
| 1986 | |
| 1987 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1988 | |
| 1989 | |
| 1990 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1991 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1992 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 1993 | |
| 1994 | /*if there is a an ongoing scan request*/ |
| 1995 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 1996 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
Chaehyun Lim | a1f7f64 | 2015-09-22 22:47:44 +0900 | [diff] [blame] | 1997 | parse_network_info(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1998 | if ((pstrNetworkInfo == NULL) |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1999 | || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2000 | PRINT_ER("driver is null\n"); |
| 2001 | s32Error = -EINVAL; |
| 2002 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2003 | } |
| 2004 | |
| 2005 | /* check whether this network is discovered before */ |
| 2006 | for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
| 2007 | |
| 2008 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && |
| 2009 | (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 2010 | if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2011 | pstrNetworkInfo->au8bssid, 6) == 0) { |
| 2012 | if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
| 2013 | /*we have already found this network with better rssi, so keep the old cached one and don't |
| 2014 | * send anything to the upper layer */ |
| 2015 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 2016 | goto done; |
| 2017 | } else { |
| 2018 | /* here the same already found network is found again but with a better rssi, so just update |
| 2019 | * the rssi for this cached network and send this updated network to the upper layer but |
| 2020 | * don't add a new record for it */ |
| 2021 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2022 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2023 | break; |
| 2024 | } |
| 2025 | } |
| 2026 | } |
| 2027 | } |
| 2028 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2029 | if (bNewNtwrkFound == true) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2030 | /* here it is confirmed that it is a new discovered network, |
| 2031 | * so add its record then call the User CallBack function */ |
| 2032 | |
| 2033 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 2034 | |
| 2035 | if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 2036 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
| 2037 | |
| 2038 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) |
| 2039 | && (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2040 | memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2041 | pstrNetworkInfo->au8bssid, 6); |
| 2042 | |
| 2043 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; |
| 2044 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2045 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2046 | /* add new BSS to JoinBssTable */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2047 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2048 | |
| 2049 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2050 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, |
| 2051 | pJoinParams); |
| 2052 | |
| 2053 | |
| 2054 | } |
| 2055 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2056 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2057 | } |
| 2058 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2059 | pstrNetworkInfo->bNewNetwork = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2060 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
| 2061 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2062 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2063 | } |
| 2064 | } |
| 2065 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2066 | done: |
| 2067 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2068 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2069 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2070 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
| 2071 | } |
| 2072 | |
| 2073 | /*free structure allocated*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2074 | if (pstrNetworkInfo != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2075 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2076 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2077 | } |
| 2078 | |
| 2079 | return s32Error; |
| 2080 | } |
| 2081 | |
| 2082 | /** |
| 2083 | * @brief Handle_RcvdGnrlAsyncInfo |
| 2084 | * @details Handling received asynchrous general network information |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2085 | * @param[in] struct rcvd_async_info *pstrRcvdGnrlAsyncInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2086 | * @return Error code. |
| 2087 | * @author |
| 2088 | * @date |
| 2089 | * @version 1.0 |
| 2090 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2091 | static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, |
| 2092 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2093 | { |
| 2094 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ |
| 2095 | /* which carries only 1 WID which have WID ID = WID_STATUS */ |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2096 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2097 | u8 u8MsgType = 0; |
| 2098 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2099 | u16 u16MsgLen = 0; |
| 2100 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2101 | u8 u8WidLen = 0; |
| 2102 | u8 u8MacStatus; |
| 2103 | u8 u8MacStatusReasonCode; |
| 2104 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2105 | tstrConnectInfo strConnectInfo; |
| 2106 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2107 | s32 s32Err = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2108 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2109 | |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 2110 | if (!pstrWFIDrv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2111 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 2112 | return -ENODEV; |
| 2113 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2114 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, |
| 2115 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); |
| 2116 | |
| 2117 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 2118 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 2119 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2120 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2121 | (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2122 | PRINT_ER("driver is null\n"); |
| 2123 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2124 | } |
| 2125 | |
| 2126 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; |
| 2127 | |
| 2128 | /* Check whether the received message type is 'I' */ |
| 2129 | if ('I' != u8MsgType) { |
| 2130 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2131 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2132 | } |
| 2133 | |
| 2134 | /* Extract message ID */ |
| 2135 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; |
| 2136 | |
| 2137 | /* Extract message Length */ |
| 2138 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); |
| 2139 | |
| 2140 | /* Extract WID ID [expected to be = WID_STATUS] */ |
| 2141 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); |
| 2142 | |
| 2143 | /* Extract WID Length [expected to be = 1] */ |
| 2144 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; |
| 2145 | |
| 2146 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ |
| 2147 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; |
| 2148 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; |
| 2149 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; |
| 2150 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2151 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2152 | /* 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] | 2153 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2154 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 2155 | |
| 2156 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2157 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2158 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2159 | |
| 2160 | if (u8MacStatus == MAC_CONNECTED) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2161 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2162 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2163 | host_int_get_assoc_res_info(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2164 | gapu8RcvdAssocResp, |
| 2165 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 2166 | &u32RcvdAssocRespInfoLen); |
| 2167 | |
| 2168 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 2169 | |
| 2170 | if (u32RcvdAssocRespInfoLen != 0) { |
| 2171 | |
| 2172 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
| 2173 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, |
| 2174 | &pstrConnectRespInfo); |
| 2175 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2176 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2177 | } else { |
| 2178 | /* use the necessary parsed Info from the Received Association Response */ |
| 2179 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 2180 | |
| 2181 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 2182 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
| 2183 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { |
| 2184 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
| 2185 | |
| 2186 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2187 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2188 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2189 | pstrConnectRespInfo->u16RespIEsLen); |
| 2190 | } |
| 2191 | } |
| 2192 | |
| 2193 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ |
| 2194 | if (pstrConnectRespInfo != NULL) { |
| 2195 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 2196 | pstrConnectRespInfo = NULL; |
| 2197 | } |
| 2198 | } |
| 2199 | } |
| 2200 | } |
| 2201 | |
| 2202 | /* The station has just received mac status and it also received assoc. response which |
| 2203 | * it was waiting for. |
| 2204 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ |
| 2205 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2206 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2207 | 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] | 2208 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2209 | |
| 2210 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 2211 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2212 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2213 | } |
| 2214 | |
| 2215 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ |
| 2216 | /* through a structure of type tstrConnectRespInfo */ |
| 2217 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
| 2218 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2219 | memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2220 | |
| 2221 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2222 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2223 | memcpy(pstrWFIDrv->au8AssociatedBSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2224 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
| 2225 | } |
| 2226 | } |
| 2227 | |
| 2228 | |
| 2229 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2230 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2231 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2232 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2233 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2234 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2235 | } |
| 2236 | |
| 2237 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2238 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2239 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2240 | &strConnectInfo, |
| 2241 | u8MacStatus, |
| 2242 | NULL, |
| 2243 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2244 | |
| 2245 | |
| 2246 | /* if received mac status is MAC_CONNECTED and |
| 2247 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED |
| 2248 | * else change state to IDLE */ |
| 2249 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2250 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2251 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2252 | |
| 2253 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
| 2254 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED; |
| 2255 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2256 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2257 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2258 | mod_timer(&hDuringIpTimer, |
| 2259 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2260 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2261 | /* open a BA session if possible */ |
| 2262 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2263 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ |
| 2264 | } else { |
| 2265 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
| 2266 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2267 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2268 | } |
| 2269 | |
| 2270 | /* Deallocation */ |
| 2271 | if (strConnectInfo.pu8RespIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2272 | kfree(strConnectInfo.pu8RespIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2273 | strConnectInfo.pu8RespIEs = NULL; |
| 2274 | } |
| 2275 | |
| 2276 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2277 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2278 | strConnectInfo.pu8ReqIEs = NULL; |
| 2279 | } |
| 2280 | |
| 2281 | |
| 2282 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2283 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2284 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2285 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2286 | } |
| 2287 | |
| 2288 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2289 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2290 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2291 | } |
| 2292 | |
| 2293 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2294 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2295 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2296 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2297 | } |
| 2298 | |
| 2299 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2300 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) { |
| 2301 | /* Disassociation or Deauthentication frame has been received */ |
| 2302 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 2303 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2304 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2305 | |
| 2306 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2307 | 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] | 2308 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2309 | Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); |
| 2310 | } |
| 2311 | |
| 2312 | strDisconnectNotifInfo.u16reason = 0; |
| 2313 | strDisconnectNotifInfo.ie = NULL; |
| 2314 | strDisconnectNotifInfo.ie_len = 0; |
| 2315 | |
| 2316 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2317 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2318 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2319 | |
| 2320 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2321 | NULL, |
| 2322 | 0, |
| 2323 | &strDisconnectNotifInfo, |
| 2324 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2325 | |
| 2326 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2327 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2328 | } |
| 2329 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2330 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2331 | |
| 2332 | |
| 2333 | /* Deallocation */ |
| 2334 | |
| 2335 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they |
| 2336 | * should be deallocated here */ |
| 2337 | /* |
| 2338 | * if(strDisconnectNotifInfo.ie != NULL) |
| 2339 | * { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2340 | * kfree(strDisconnectNotifInfo.ie); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2341 | * strDisconnectNotifInfo.ie = NULL; |
| 2342 | * } |
| 2343 | */ |
| 2344 | |
| 2345 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2346 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2347 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2348 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2349 | } |
| 2350 | |
| 2351 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2352 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2353 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2354 | } |
| 2355 | |
| 2356 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2357 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2358 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2359 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2360 | } |
| 2361 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2362 | /*Freeing flushed join request params on receiving*/ |
| 2363 | /*MAC_DISCONNECTED while connected*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2364 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2365 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2366 | gu8FlushedJoinReq = NULL; |
| 2367 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2368 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2369 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2370 | gu8FlushedInfoElemAsoc = NULL; |
| 2371 | } |
| 2372 | |
| 2373 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2374 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2375 | |
| 2376 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2377 | (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { |
| 2378 | 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] | 2379 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2380 | /*Abort the running scan*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2381 | del_timer(&pstrWFIDrv->hScanTimer); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2382 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2383 | Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2384 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2385 | } |
| 2386 | |
| 2387 | } |
| 2388 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2389 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2390 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2391 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2392 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
| 2393 | } |
| 2394 | |
| 2395 | return s32Error; |
| 2396 | } |
| 2397 | |
| 2398 | /** |
| 2399 | * @brief Handle_Key |
| 2400 | * @details Sending config packet to firmware to set key |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2401 | * @param[in] struct key_attr *pstrHostIFkeyAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2402 | * @return Error code. |
| 2403 | * @author |
| 2404 | * @date |
| 2405 | * @version 1.0 |
| 2406 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2407 | static int Handle_Key(tstrWILC_WFIDrv *drvHandler, |
| 2408 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2409 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2410 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2411 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2412 | tstrWID strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2413 | u8 i; |
| 2414 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2415 | s8 s8idxarray[1]; |
| 2416 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2417 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2418 | |
| 2419 | |
| 2420 | switch (pstrHostIFkeyAttr->enuKeyType) { |
| 2421 | |
| 2422 | |
| 2423 | case WEP: |
| 2424 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2425 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2426 | |
| 2427 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
| 2428 | 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] | 2429 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2430 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2431 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2432 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2433 | |
| 2434 | strWIDList[1].u16WIDid = WID_AUTH_TYPE; |
| 2435 | strWIDList[1].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2436 | strWIDList[1].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2437 | strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2438 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2439 | strWIDList[2].u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2440 | strWIDList[2].enuWIDtype = WID_CHAR; |
| 2441 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2442 | strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2443 | strWIDList[2].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2444 | |
| 2445 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2446 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2447 | |
| 2448 | |
| 2449 | if (pu8keybuf == NULL) { |
| 2450 | PRINT_ER("No buffer to send Key\n"); |
| 2451 | return -1; |
| 2452 | } |
| 2453 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2454 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2455 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2456 | |
| 2457 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2458 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2459 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2460 | strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2461 | strWIDList[3].enuWIDtype = WID_STR; |
| 2462 | strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2463 | strWIDList[3].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2464 | |
| 2465 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2466 | s32Error = send_config_pkt(SET_CFG, strWIDList, 4, true, |
| 2467 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2468 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2469 | |
| 2470 | |
| 2471 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2472 | |
| 2473 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2474 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2475 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2476 | if (pu8keybuf == NULL) { |
| 2477 | PRINT_ER("No buffer to send Key\n"); |
| 2478 | return -1; |
| 2479 | } |
| 2480 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
| 2481 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2482 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2483 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2484 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2485 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2486 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2487 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2488 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2489 | strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2490 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2491 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2492 | strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; |
| 2493 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2494 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2495 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2496 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2497 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
| 2498 | |
| 2499 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2500 | strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2501 | strWID.enuWIDtype = WID_STR; |
| 2502 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2503 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2504 | strWID.ps8WidVal = s8idxarray; |
| 2505 | strWID.s32ValueSize = 1; |
| 2506 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2507 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2508 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2509 | } else { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2510 | strWID.u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2511 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2512 | strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2513 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2514 | |
| 2515 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 2516 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2517 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2518 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2519 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2520 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2521 | break; |
| 2522 | |
| 2523 | case WPARxGtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2524 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2525 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2526 | if (pu8keybuf == NULL) { |
| 2527 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2528 | ret = -1; |
| 2529 | goto _WPARxGtk_end_case_; |
| 2530 | } |
| 2531 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2532 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2533 | |
| 2534 | |
| 2535 | /*|----------------------------------------------------------------------------| |
| 2536 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2537 | * |------------|---------|-------|------------|---------------|----------------| |
| 2538 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2539 | |
| 2540 | |
| 2541 | |
| 2542 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2543 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2544 | |
| 2545 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2546 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2547 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2548 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2549 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2550 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2551 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2552 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2553 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2554 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2555 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2556 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2557 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2558 | strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2559 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2560 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2561 | strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2562 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2563 | s32Error = send_config_pkt(SET_CFG, strWIDList, 2, true, |
| 2564 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2565 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2566 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2567 | |
| 2568 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2569 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2570 | /* ///////////////////////// */ |
| 2571 | } |
| 2572 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2573 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2574 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 2575 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2576 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2577 | if (pu8keybuf == NULL) { |
| 2578 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2579 | ret = -1; |
| 2580 | goto _WPARxGtk_end_case_; |
| 2581 | } |
| 2582 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2583 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2584 | |
| 2585 | |
| 2586 | /*|----------------------------------------------------------------------------| |
| 2587 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2588 | * |------------|---------|-------|------------|---------------|----------------| |
| 2589 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2590 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2591 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2592 | memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2593 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2594 | 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] | 2595 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2596 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2597 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2598 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2599 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2600 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
| 2601 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2602 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2603 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2604 | strWID.u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2605 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2606 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2607 | strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2608 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2609 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2610 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2611 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2612 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2613 | |
| 2614 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2615 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2616 | /* ///////////////////////// */ |
| 2617 | } |
| 2618 | _WPARxGtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2619 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
| 2620 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2621 | if (ret == -1) |
| 2622 | return ret; |
| 2623 | |
| 2624 | break; |
| 2625 | |
| 2626 | case WPAPtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2627 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2628 | |
| 2629 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2630 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2631 | |
| 2632 | |
| 2633 | |
| 2634 | if (pu8keybuf == NULL) { |
| 2635 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2636 | ret = -1; |
| 2637 | goto _WPAPtk_end_case_; |
| 2638 | |
| 2639 | } |
| 2640 | |
| 2641 | /*|-----------------------------------------------------------------------------| |
| 2642 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2643 | * |----------------|------------ |--------------|----------------|---------------| |
| 2644 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2645 | |-----------------------------------------------------------------------------|*/ |
| 2646 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2647 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2648 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2649 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
| 2650 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2651 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2652 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2653 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2654 | |
| 2655 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2656 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2657 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2658 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2659 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2660 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2661 | strWIDList[1].u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2662 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2663 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2664 | strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; |
| 2665 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2666 | s32Error = send_config_pkt(SET_CFG, strWIDList, 2, true, |
| 2667 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2668 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2669 | |
| 2670 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2671 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2672 | /* ///////////////////////// */ |
| 2673 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2674 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2675 | |
| 2676 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2677 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2678 | |
| 2679 | |
| 2680 | |
| 2681 | if (pu8keybuf == NULL) { |
| 2682 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2683 | ret = -1; |
| 2684 | goto _WPAPtk_end_case_; |
| 2685 | |
| 2686 | } |
| 2687 | |
| 2688 | /*|-----------------------------------------------------------------------------| |
| 2689 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2690 | * |----------------|------------|--------------|----------------|---------------| |
| 2691 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2692 | |-----------------------------------------------------------------------------|*/ |
| 2693 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2694 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2695 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2696 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2697 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2698 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2699 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2700 | |
| 2701 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2702 | strWID.u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2703 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2704 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2705 | strWID.s32ValueSize = PTK_KEY_MSG_LEN; |
| 2706 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2707 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2708 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2709 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2710 | |
| 2711 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2712 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2713 | /* ///////////////////////// */ |
| 2714 | } |
| 2715 | |
| 2716 | _WPAPtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2717 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2718 | if (ret == -1) |
| 2719 | return ret; |
| 2720 | |
| 2721 | break; |
| 2722 | |
| 2723 | |
| 2724 | case PMKSA: |
| 2725 | |
| 2726 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 2727 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2728 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2729 | if (pu8keybuf == NULL) { |
| 2730 | PRINT_ER("No buffer to send PMKSA Key\n"); |
| 2731 | return -1; |
| 2732 | } |
| 2733 | |
| 2734 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; |
| 2735 | |
| 2736 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { |
| 2737 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2738 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); |
| 2739 | 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] | 2740 | } |
| 2741 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2742 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2743 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2744 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2745 | strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1; |
| 2746 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2747 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2748 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2749 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2750 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2751 | break; |
| 2752 | } |
| 2753 | |
| 2754 | if (s32Error) |
| 2755 | PRINT_ER("Failed to send key config packet\n"); |
| 2756 | |
| 2757 | |
| 2758 | return s32Error; |
| 2759 | } |
| 2760 | |
| 2761 | |
| 2762 | /** |
| 2763 | * @brief Handle_Disconnect |
| 2764 | * @details Sending config packet to firmware to disconnect |
| 2765 | * @param[in] NONE |
| 2766 | * @return NONE |
| 2767 | * @author |
| 2768 | * @date |
| 2769 | * @version 1.0 |
| 2770 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2771 | static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2772 | { |
| 2773 | tstrWID strWID; |
| 2774 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2775 | s32 s32Error = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2776 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2777 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2778 | |
| 2779 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2780 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2781 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2782 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2783 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2784 | |
| 2785 | |
| 2786 | |
| 2787 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 2788 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2789 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2790 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2791 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2792 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2793 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2794 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 2795 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2796 | |
| 2797 | if (s32Error) { |
| 2798 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2799 | } else { |
| 2800 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 2801 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2802 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2803 | |
| 2804 | strDisconnectNotifInfo.u16reason = 0; |
| 2805 | strDisconnectNotifInfo.ie = NULL; |
| 2806 | strDisconnectNotifInfo.ie_len = 0; |
| 2807 | |
| 2808 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2809 | del_timer(&pstrWFIDrv->hScanTimer); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2810 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2811 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2812 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2813 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2814 | } |
| 2815 | |
| 2816 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2817 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2818 | /*Stop connect timer, if connection in progress*/ |
| 2819 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2820 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2821 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2822 | } |
| 2823 | |
| 2824 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 2825 | 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2826 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2827 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2828 | } |
| 2829 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2830 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2831 | |
| 2832 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2833 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2834 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2835 | |
| 2836 | |
| 2837 | /* Deallocation */ |
| 2838 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2839 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2840 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2841 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2842 | } |
| 2843 | |
| 2844 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2845 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2846 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2847 | } |
| 2848 | |
| 2849 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2850 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2851 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2852 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2853 | } |
| 2854 | |
| 2855 | |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2856 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2857 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2858 | gu8FlushedJoinReq = NULL; |
| 2859 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2860 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2861 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2862 | gu8FlushedInfoElemAsoc = NULL; |
| 2863 | } |
| 2864 | |
| 2865 | } |
| 2866 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2867 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2868 | up(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2869 | /* ///////////////////////// */ |
| 2870 | |
| 2871 | } |
| 2872 | |
| 2873 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2874 | void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2875 | { |
| 2876 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 2877 | |
| 2878 | pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2879 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2880 | return; |
| 2881 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { |
| 2882 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2883 | host_int_disconnect(pstrWFIDrv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2884 | } |
| 2885 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2886 | |
| 2887 | /** |
| 2888 | * @brief Handle_GetChnl |
| 2889 | * @details Sending config packet to get channel |
| 2890 | * @param[in] NONE |
| 2891 | * @return NONE |
| 2892 | * |
| 2893 | * @author |
| 2894 | * @date |
| 2895 | * @version 1.0 |
| 2896 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2897 | static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2898 | { |
| 2899 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2900 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2901 | tstrWID strWID; |
| 2902 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 2903 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2904 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2905 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2906 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2907 | strWID.ps8WidVal = (s8 *)&gu8Chnl; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2908 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2909 | |
| 2910 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 2911 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2912 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 2913 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2914 | /*get the value by searching the local copy*/ |
| 2915 | if (s32Error) { |
| 2916 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2917 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2918 | } |
| 2919 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2920 | up(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2921 | |
| 2922 | return s32Error; |
| 2923 | |
| 2924 | |
| 2925 | |
| 2926 | } |
| 2927 | |
| 2928 | |
| 2929 | /** |
| 2930 | * @brief Handle_GetRssi |
| 2931 | * @details Sending config packet to get RSSI |
| 2932 | * @param[in] NONE |
| 2933 | * @return NONE |
| 2934 | * @author |
| 2935 | * @date |
| 2936 | * @version 1.0 |
| 2937 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2938 | static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2939 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2940 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2941 | tstrWID strWID; |
| 2942 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2943 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2944 | strWID.u16WIDid = (u16)WID_RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2945 | strWID.enuWIDtype = WID_CHAR; |
| 2946 | strWID.ps8WidVal = &gs8Rssi; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2947 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2948 | |
| 2949 | /*Sending Cfg*/ |
| 2950 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 2951 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2952 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 2953 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2954 | if (s32Error) { |
| 2955 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2956 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2957 | } |
| 2958 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2959 | up(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2960 | |
| 2961 | |
| 2962 | } |
| 2963 | |
| 2964 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2965 | static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2966 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2967 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2968 | tstrWID strWID; |
| 2969 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2970 | |
| 2971 | gs8lnkspd = 0; |
| 2972 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2973 | strWID.u16WIDid = (u16)WID_LINKSPEED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2974 | strWID.enuWIDtype = WID_CHAR; |
| 2975 | strWID.ps8WidVal = &gs8lnkspd; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2976 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2977 | /*Sending Cfg*/ |
| 2978 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 2979 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2980 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 2981 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2982 | if (s32Error) { |
| 2983 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2984 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2985 | } |
| 2986 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2987 | up(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2988 | |
| 2989 | |
| 2990 | } |
| 2991 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2992 | s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2993 | { |
| 2994 | tstrWID strWIDList[5]; |
Chaehyun Lim | fbc2fe1 | 2015-09-15 14:06:16 +0900 | [diff] [blame] | 2995 | u32 u32WidsCount = 0, s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2996 | |
| 2997 | strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED; |
| 2998 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2999 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3000 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3001 | u32WidsCount++; |
| 3002 | |
| 3003 | strWIDList[u32WidsCount].u16WIDid = WID_RSSI; |
| 3004 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3005 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3006 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3007 | u32WidsCount++; |
| 3008 | |
| 3009 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 3010 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3011 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3012 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3013 | u32WidsCount++; |
| 3014 | |
| 3015 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 3016 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3017 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3018 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3019 | u32WidsCount++; |
| 3020 | |
| 3021 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 3022 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3023 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3024 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3025 | u32WidsCount++; |
| 3026 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3027 | s32Error = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, false, |
| 3028 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3029 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3030 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3031 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3032 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3033 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3034 | return 0; |
| 3035 | |
| 3036 | } |
| 3037 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3038 | /** |
| 3039 | * @brief Handle_Get_InActiveTime |
| 3040 | * @details Sending config packet to set mac adddress for station and |
| 3041 | * get inactive time |
| 3042 | * @param[in] NONE |
| 3043 | * @return NONE |
| 3044 | * |
| 3045 | * @author |
| 3046 | * @date |
| 3047 | * @version 1.0 |
| 3048 | */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 3049 | static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, |
| 3050 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3051 | { |
| 3052 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3053 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3054 | u8 *stamac; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3055 | tstrWID strWID; |
| 3056 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3057 | |
| 3058 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3059 | strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3060 | strWID.enuWIDtype = WID_STR; |
| 3061 | strWID.s32ValueSize = ETH_ALEN; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3062 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3063 | |
| 3064 | |
| 3065 | stamac = strWID.ps8WidVal; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3066 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3067 | |
| 3068 | |
| 3069 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 3070 | |
| 3071 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3072 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3073 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3074 | /*get the value by searching the local copy*/ |
| 3075 | if (s32Error) { |
| 3076 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3077 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3078 | } |
| 3079 | |
| 3080 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3081 | strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3082 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3083 | strWID.ps8WidVal = (s8 *)&gu32InactiveTime; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3084 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3085 | |
| 3086 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3087 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 3088 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3089 | /*get the value by searching the local copy*/ |
| 3090 | if (s32Error) { |
| 3091 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3092 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3093 | } |
| 3094 | |
| 3095 | |
| 3096 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); |
| 3097 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3098 | up(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3099 | |
| 3100 | return s32Error; |
| 3101 | |
| 3102 | |
| 3103 | |
| 3104 | } |
| 3105 | |
| 3106 | |
| 3107 | /** |
| 3108 | * @brief Handle_AddBeacon |
| 3109 | * @details Sending config packet to add beacon |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 3110 | * @param[in] struct beacon_attr *pstrSetBeaconParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3111 | * @return NONE |
| 3112 | * @author |
| 3113 | * @date |
| 3114 | * @version 1.0 |
| 3115 | */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 3116 | static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 3117 | struct beacon_attr *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3118 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3119 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3120 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3121 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3122 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3123 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3124 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 3125 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3126 | strWID.u16WIDid = (u16)WID_ADD_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3127 | strWID.enuWIDtype = WID_BIN; |
| 3128 | strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3129 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3130 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3131 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3132 | |
| 3133 | pu8CurrByte = strWID.ps8WidVal; |
| 3134 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); |
| 3135 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); |
| 3136 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); |
| 3137 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); |
| 3138 | |
| 3139 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); |
| 3140 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); |
| 3141 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); |
| 3142 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); |
| 3143 | |
| 3144 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); |
| 3145 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); |
| 3146 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); |
| 3147 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); |
| 3148 | |
| 3149 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); |
| 3150 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; |
| 3151 | |
| 3152 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); |
| 3153 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); |
| 3154 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); |
| 3155 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); |
| 3156 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3157 | if (pstrSetBeaconParam->pu8Tail > 0) |
| 3158 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); |
| 3159 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; |
| 3160 | |
| 3161 | |
| 3162 | |
| 3163 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3164 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3165 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3166 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3167 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3168 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3169 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3170 | kfree(strWID.ps8WidVal); |
| 3171 | kfree(pstrSetBeaconParam->pu8Head); |
| 3172 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3173 | } |
| 3174 | |
| 3175 | |
| 3176 | /** |
| 3177 | * @brief Handle_AddBeacon |
| 3178 | * @details Sending config packet to delete beacon |
Tony Cho | 80bf8836 | 2015-09-30 18:44:29 +0900 | [diff] [blame] | 3179 | * @param[in] tstrWILC_WFIDrv *drvHandler |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3180 | * @return NONE |
| 3181 | * @author |
| 3182 | * @date |
| 3183 | * @version 1.0 |
| 3184 | */ |
Tony Cho | 80bf8836 | 2015-09-30 18:44:29 +0900 | [diff] [blame] | 3185 | static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3186 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3187 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3188 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3189 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3190 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3191 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3192 | strWID.u16WIDid = (u16)WID_DEL_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3193 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3194 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3195 | strWID.ps8WidVal = &gu8DelBcn; |
| 3196 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3197 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3198 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3199 | |
| 3200 | pu8CurrByte = strWID.ps8WidVal; |
| 3201 | |
| 3202 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
| 3203 | /* TODO: build del beacon message*/ |
| 3204 | |
| 3205 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3206 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3207 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3208 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3209 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3210 | } |
| 3211 | |
| 3212 | |
| 3213 | /** |
| 3214 | * @brief WILC_HostIf_PackStaParam |
| 3215 | * @details Handling packing of the station params in a buffer |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3216 | * @param[in] u8* pu8Buffer, struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3217 | * @return NONE |
| 3218 | * @author |
| 3219 | * @date |
| 3220 | * @version 1.0 |
| 3221 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3222 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 3223 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3224 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3225 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3226 | |
| 3227 | pu8CurrByte = pu8Buffer; |
| 3228 | |
| 3229 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3230 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3231 | pu8CurrByte += ETH_ALEN; |
| 3232 | |
| 3233 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 3234 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 3235 | |
| 3236 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3237 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3238 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3239 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 3240 | |
| 3241 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 3242 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 3243 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 3244 | |
| 3245 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3246 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3247 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 3248 | |
| 3249 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 3250 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 3251 | |
| 3252 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 3253 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 3254 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 3255 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 3256 | |
| 3257 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 3258 | |
| 3259 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 3260 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 3261 | |
| 3262 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 3263 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 3264 | |
| 3265 | return pu8CurrByte - pu8Buffer; |
| 3266 | } |
| 3267 | |
| 3268 | /** |
| 3269 | * @brief Handle_AddStation |
| 3270 | * @details Sending config packet to add station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3271 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3272 | * @return NONE |
| 3273 | * @author |
| 3274 | * @date |
| 3275 | * @version 1.0 |
| 3276 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3277 | static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, |
| 3278 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3279 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3280 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3281 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3282 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3283 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3284 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3285 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3286 | strWID.u16WIDid = (u16)WID_ADD_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3287 | strWID.enuWIDtype = WID_BIN; |
| 3288 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3289 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3290 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3291 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3292 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3293 | |
| 3294 | pu8CurrByte = strWID.ps8WidVal; |
| 3295 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3296 | |
| 3297 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3298 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3299 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3300 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3301 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3302 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3303 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3304 | kfree(pstrStationParam->pu8Rates); |
| 3305 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3306 | } |
| 3307 | |
| 3308 | /** |
| 3309 | * @brief Handle_DelAllSta |
| 3310 | * @details Sending config packet to delete station |
| 3311 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3312 | * @return NONE |
| 3313 | * @author |
| 3314 | * @date |
| 3315 | * @version 1.0 |
| 3316 | */ |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 3317 | static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, |
| 3318 | struct del_all_sta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3319 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3320 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3321 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3322 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3323 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3324 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3325 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 3326 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3327 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3328 | strWID.u16WIDid = (u16)WID_DEL_ALL_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3329 | strWID.enuWIDtype = WID_STR; |
| 3330 | strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; |
| 3331 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3332 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3333 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3334 | strWID.ps8WidVal = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3335 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3336 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3337 | |
| 3338 | pu8CurrByte = strWID.ps8WidVal; |
| 3339 | |
| 3340 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; |
| 3341 | |
| 3342 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 3343 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3344 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3345 | else |
| 3346 | continue; |
| 3347 | |
| 3348 | pu8CurrByte += ETH_ALEN; |
| 3349 | } |
| 3350 | |
| 3351 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3352 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3353 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3354 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3355 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3356 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3357 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3358 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3359 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3360 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3361 | } |
| 3362 | |
| 3363 | |
| 3364 | /** |
| 3365 | * @brief Handle_DelStation |
| 3366 | * @details Sending config packet to delete station |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 3367 | * @param[in] struct del_sta *pstrDelStaParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3368 | * @return NONE |
| 3369 | * @author |
| 3370 | * @date |
| 3371 | * @version 1.0 |
| 3372 | */ |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 3373 | static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, |
| 3374 | struct del_sta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3375 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3376 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3377 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3378 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3379 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3380 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3381 | strWID.u16WIDid = (u16)WID_REMOVE_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3382 | strWID.enuWIDtype = WID_BIN; |
| 3383 | strWID.s32ValueSize = ETH_ALEN; |
| 3384 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3385 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3386 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3387 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3388 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3389 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3390 | |
| 3391 | pu8CurrByte = strWID.ps8WidVal; |
| 3392 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3393 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3394 | |
| 3395 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3396 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3397 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3398 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3399 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3400 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3401 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3402 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3403 | } |
| 3404 | |
| 3405 | |
| 3406 | /** |
| 3407 | * @brief Handle_EditStation |
| 3408 | * @details Sending config packet to edit station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3409 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3410 | * @return NONE |
| 3411 | * @author |
| 3412 | * @date |
| 3413 | * @version 1.0 |
| 3414 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3415 | static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, |
| 3416 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3417 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3418 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3419 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3420 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3421 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3422 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3423 | strWID.u16WIDid = (u16)WID_EDIT_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3424 | strWID.enuWIDtype = WID_BIN; |
| 3425 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3426 | |
| 3427 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3428 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3429 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3430 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3431 | |
| 3432 | pu8CurrByte = strWID.ps8WidVal; |
| 3433 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3434 | |
| 3435 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3436 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3437 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3438 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3439 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3440 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3441 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3442 | kfree(pstrStationParam->pu8Rates); |
| 3443 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3444 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3445 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3446 | /** |
| 3447 | * @brief Handle_RemainOnChan |
| 3448 | * @details Sending config packet to edit station |
| 3449 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3450 | * @return NONE |
| 3451 | * @author |
| 3452 | * @date |
| 3453 | * @version 1.0 |
| 3454 | */ |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 3455 | static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, |
| 3456 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3457 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3458 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3459 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3460 | tstrWID strWID; |
| 3461 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3462 | |
| 3463 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ |
| 3464 | if (!pstrWFIDrv->u8RemainOnChan_pendingreq) { |
| 3465 | pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 3466 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 3467 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 3468 | pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 3469 | pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
| 3470 | } else { |
| 3471 | /*Set the channel to use it as a wid val*/ |
| 3472 | pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel; |
| 3473 | } |
| 3474 | |
| 3475 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 3476 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
| 3477 | pstrWFIDrv->u8RemainOnChan_pendingreq = 1; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3478 | s32Error = -EBUSY; |
| 3479 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3480 | } |
| 3481 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3482 | 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] | 3483 | s32Error = -EBUSY; |
| 3484 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3485 | } |
| 3486 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3487 | if (g_obtainingIP || connecting) { |
| 3488 | 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] | 3489 | s32Error = -EBUSY; |
| 3490 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3491 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3492 | |
| 3493 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 3494 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3495 | u8remain_on_chan_flag = true; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3496 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3497 | strWID.enuWIDtype = WID_STR; |
| 3498 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3499 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3500 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3501 | if (strWID.ps8WidVal == NULL) { |
| 3502 | s32Error = -ENOMEM; |
| 3503 | goto ERRORHANDLER; |
| 3504 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3505 | |
| 3506 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3507 | strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3508 | |
| 3509 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3510 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3511 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3512 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3513 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3514 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3515 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3516 | { |
| 3517 | P2P_LISTEN_STATE = 1; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3518 | pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; |
| 3519 | mod_timer(&pstrWFIDrv->hRemainOnChannel, |
| 3520 | jiffies + |
| 3521 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3522 | |
| 3523 | /*Calling CFG ready_on_channel*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3524 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3525 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3526 | |
| 3527 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 3528 | pstrWFIDrv->u8RemainOnChan_pendingreq = 0; |
| 3529 | } |
| 3530 | return s32Error; |
| 3531 | } |
| 3532 | |
| 3533 | /** |
| 3534 | * @brief Handle_RegisterFrame |
| 3535 | * @details |
| 3536 | * @param[in] |
| 3537 | * @return NONE |
| 3538 | * @author |
| 3539 | * @date |
| 3540 | * @version 1.0 |
| 3541 | */ |
Tony Cho | bc37c5d | 2015-09-21 12:16:59 +0900 | [diff] [blame] | 3542 | static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, |
| 3543 | struct reg_frame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3544 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3545 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3546 | tstrWID strWID; |
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 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3549 | |
| 3550 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 3551 | |
| 3552 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3553 | strWID.u16WIDid = (u16)WID_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3554 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3555 | strWID.ps8WidVal = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3556 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3557 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3558 | |
| 3559 | pu8CurrByte = strWID.ps8WidVal; |
| 3560 | |
| 3561 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 3562 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3563 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3564 | |
| 3565 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3566 | strWID.s32ValueSize = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3567 | |
| 3568 | |
| 3569 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3570 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3571 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3572 | if (s32Error) { |
| 3573 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3574 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3575 | } |
| 3576 | |
| 3577 | return s32Error; |
| 3578 | |
| 3579 | } |
| 3580 | |
| 3581 | /** |
| 3582 | * @brief Handle_ListenStateExpired |
| 3583 | * @details Handle of listen state expiration |
| 3584 | * @param[in] NONE |
| 3585 | * @return Error code. |
| 3586 | * @author |
| 3587 | * @date |
| 3588 | * @version 1.0 |
| 3589 | */ |
| 3590 | #define FALSE_FRMWR_CHANNEL 100 |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 3591 | static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, |
| 3592 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3593 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3594 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3595 | tstrWID strWID; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3596 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3597 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3598 | |
| 3599 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 3600 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3601 | /*Make sure we are already in listen state*/ |
| 3602 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ |
| 3603 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3604 | u8remain_on_chan_flag = false; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3605 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3606 | strWID.enuWIDtype = WID_STR; |
| 3607 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3608 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3609 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3610 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3611 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3612 | |
| 3613 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
| 3614 | strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; |
| 3615 | |
| 3616 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3617 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3618 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3619 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3620 | PRINT_ER("Failed to set remain on channel\n"); |
| 3621 | goto _done_; |
| 3622 | } |
| 3623 | |
| 3624 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 3625 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid |
| 3626 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 3627 | } |
| 3628 | P2P_LISTEN_STATE = 0; |
| 3629 | } else { |
| 3630 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3631 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3632 | } |
| 3633 | |
| 3634 | _done_: |
| 3635 | return s32Error; |
| 3636 | } |
| 3637 | |
| 3638 | |
| 3639 | /** |
| 3640 | * @brief ListenTimerCB |
| 3641 | * @details Callback function of remain-on-channel timer |
| 3642 | * @param[in] NONE |
| 3643 | * @return Error code. |
| 3644 | * @author |
| 3645 | * @date |
| 3646 | * @version 1.0 |
| 3647 | */ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3648 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3649 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3650 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3651 | struct host_if_msg msg; |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3652 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3653 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3654 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3655 | |
| 3656 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3657 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3658 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3659 | msg.drvHandler = pstrWFIDrv; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 3660 | msg.body.remain_on_ch.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3661 | |
| 3662 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3663 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3664 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3665 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3666 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3667 | |
| 3668 | /** |
| 3669 | * @brief Handle_EditStation |
| 3670 | * @details Sending config packet to edit station |
| 3671 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3672 | * @return NONE |
| 3673 | * @author |
| 3674 | * @date |
| 3675 | * @version 1.0 |
| 3676 | */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 3677 | static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, |
| 3678 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3679 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3680 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3681 | tstrWID strWID; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3682 | s8 s8PowerMode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3683 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3684 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3685 | strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3686 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3687 | if (strPowerMgmtParam->bIsEnabled == true) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3688 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3689 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3690 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3691 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
| 3692 | strWID.ps8WidVal = &s8PowerMode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3693 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3694 | |
| 3695 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 3696 | |
| 3697 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3698 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3699 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3700 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3701 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3702 | } |
| 3703 | |
| 3704 | /** |
| 3705 | * @brief Handle_SetMulticastFilter |
| 3706 | * @details Set Multicast filter in firmware |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3707 | * @param[in] struct set_multicast *strHostIfSetMulti |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3708 | * @return NONE |
| 3709 | * @author asobhy |
| 3710 | * @date |
| 3711 | * @version 1.0 |
| 3712 | */ |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3713 | static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, |
| 3714 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3715 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3716 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3717 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3718 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3719 | |
| 3720 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 3721 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3722 | strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3723 | strWID.enuWIDtype = WID_BIN; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3724 | strWID.s32ValueSize = sizeof(struct set_multicast) + ((strHostIfSetMulti->u32count) * ETH_ALEN); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3725 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3726 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3727 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3728 | |
| 3729 | pu8CurrByte = strWID.ps8WidVal; |
| 3730 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); |
| 3731 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); |
| 3732 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); |
| 3733 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); |
| 3734 | |
| 3735 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); |
| 3736 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); |
| 3737 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); |
| 3738 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); |
| 3739 | |
| 3740 | if ((strHostIfSetMulti->u32count) > 0) |
| 3741 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); |
| 3742 | |
| 3743 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3744 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3745 | get_id_from_handler(drvHandler)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3746 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3747 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3748 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3749 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3750 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3751 | |
| 3752 | } |
| 3753 | |
| 3754 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3755 | /** |
| 3756 | * @brief Handle_AddBASession |
| 3757 | * @details Add block ack session |
| 3758 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 3759 | * @return NONE |
| 3760 | * @author Amr Abdel-Moghny |
| 3761 | * @date Feb. 2014 |
| 3762 | * @version 9.0 |
| 3763 | */ |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 3764 | static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, |
| 3765 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3766 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3767 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3768 | tstrWID strWID; |
| 3769 | int AddbaTimeout = 100; |
| 3770 | char *ptr = NULL; |
| 3771 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3772 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3773 | 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] | 3774 | strHostIfBASessionInfo->au8Bssid[0], |
| 3775 | strHostIfBASessionInfo->au8Bssid[1], |
| 3776 | strHostIfBASessionInfo->au8Bssid[2], |
| 3777 | strHostIfBASessionInfo->u16BufferSize, |
| 3778 | strHostIfBASessionInfo->u16SessionTimeout, |
| 3779 | strHostIfBASessionInfo->u8Ted); |
| 3780 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3781 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3782 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3783 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3784 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 3785 | ptr = strWID.ps8WidVal; |
| 3786 | /* *ptr++ = 0x14; */ |
| 3787 | *ptr++ = 0x14; |
| 3788 | *ptr++ = 0x3; |
| 3789 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3790 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3791 | ptr += ETH_ALEN; |
| 3792 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3793 | /* BA Policy*/ |
| 3794 | *ptr++ = 1; |
| 3795 | /* Buffer size*/ |
| 3796 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 3797 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
| 3798 | /* BA timeout*/ |
| 3799 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 3800 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 3801 | /* ADDBA timeout*/ |
| 3802 | *ptr++ = (AddbaTimeout & 0xFF); |
| 3803 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
| 3804 | /* Group Buffer Max Frames*/ |
| 3805 | *ptr++ = 8; |
| 3806 | /* Group Buffer Timeout */ |
| 3807 | *ptr++ = 0; |
| 3808 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3809 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3810 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3811 | if (s32Error) |
| 3812 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 3813 | |
| 3814 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3815 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3816 | strWID.enuWIDtype = WID_STR; |
| 3817 | strWID.s32ValueSize = 15; |
| 3818 | ptr = strWID.ps8WidVal; |
| 3819 | /* *ptr++ = 0x14; */ |
| 3820 | *ptr++ = 15; |
| 3821 | *ptr++ = 7; |
| 3822 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3823 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3824 | ptr += ETH_ALEN; |
| 3825 | /* TID*/ |
| 3826 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3827 | /* Max Num MSDU */ |
| 3828 | *ptr++ = 8; |
| 3829 | /* BA timeout*/ |
| 3830 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 3831 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 3832 | /*Ack-Policy */ |
| 3833 | *ptr++ = 3; |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3834 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3835 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3836 | |
| 3837 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3838 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3839 | |
| 3840 | return s32Error; |
| 3841 | |
| 3842 | } |
| 3843 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3844 | /** |
| 3845 | * @brief Handle_DelAllRxBASessions |
| 3846 | * @details Delete all Rx BA sessions |
| 3847 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 3848 | * @return NONE |
| 3849 | * @author Abdelrahman Sobhy |
| 3850 | * @date Feb. 2013 |
| 3851 | * @version 9.0 |
| 3852 | */ |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 3853 | static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, |
| 3854 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3855 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3856 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3857 | tstrWID strWID; |
| 3858 | char *ptr = NULL; |
| 3859 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3860 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3861 | 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] | 3862 | strHostIfBASessionInfo->au8Bssid[0], |
| 3863 | strHostIfBASessionInfo->au8Bssid[1], |
| 3864 | strHostIfBASessionInfo->au8Bssid[2], |
| 3865 | strHostIfBASessionInfo->u8Ted); |
| 3866 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3867 | strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3868 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3869 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3870 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 3871 | ptr = strWID.ps8WidVal; |
| 3872 | *ptr++ = 0x14; |
| 3873 | *ptr++ = 0x3; |
| 3874 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3875 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3876 | ptr += ETH_ALEN; |
| 3877 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3878 | /* BA direction = recipent*/ |
| 3879 | *ptr++ = 0; |
| 3880 | /* Delba Reason */ |
| 3881 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 3882 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3883 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3884 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3885 | if (s32Error) |
| 3886 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 3887 | |
| 3888 | |
| 3889 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3890 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3891 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3892 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3893 | |
| 3894 | return s32Error; |
| 3895 | |
| 3896 | } |
| 3897 | |
| 3898 | /** |
| 3899 | * @brief hostIFthread |
| 3900 | * @details Main thread to handle message queue requests |
| 3901 | * @param[in] void* pvArg |
| 3902 | * @return NONE |
| 3903 | * @author |
| 3904 | * @date |
| 3905 | * @version 1.0 |
| 3906 | */ |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 3907 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3908 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3909 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3910 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3911 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 3912 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3913 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3914 | |
| 3915 | while (1) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3916 | wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), &u32Ret); |
| 3917 | pstrWFIDrv = (tstrWILC_WFIDrv *)msg.drvHandler; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3918 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3919 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 3920 | break; |
| 3921 | } |
| 3922 | |
| 3923 | |
| 3924 | /*Re-Queue HIF message*/ |
| 3925 | if ((!g_wilc_initialized)) { |
| 3926 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 3927 | usleep_range(200 * 1000, 200 * 1000); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3928 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3929 | continue; |
| 3930 | } |
| 3931 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3932 | if (msg.id == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3933 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3934 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 3935 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3936 | continue; |
| 3937 | } |
| 3938 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3939 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3940 | case HOST_IF_MSG_Q_IDLE: |
| 3941 | Handle_wait_msg_q_empty(); |
| 3942 | break; |
| 3943 | |
| 3944 | case HOST_IF_MSG_SCAN: |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 3945 | Handle_Scan(msg.drvHandler, &msg.body.scan_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3946 | break; |
| 3947 | |
| 3948 | case HOST_IF_MSG_CONNECT: |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 3949 | Handle_Connect(msg.drvHandler, &msg.body.con_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3950 | break; |
| 3951 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3952 | case HOST_IF_MSG_FLUSH_CONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3953 | Handle_FlushConnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3954 | break; |
| 3955 | |
| 3956 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 3957 | Handle_RcvdNtwrkInfo(msg.drvHandler, &msg.body.net_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3958 | break; |
| 3959 | |
| 3960 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 3961 | Handle_RcvdGnrlAsyncInfo(msg.drvHandler, &msg.body.async_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3962 | break; |
| 3963 | |
| 3964 | case HOST_IF_MSG_KEY: |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 3965 | Handle_Key(msg.drvHandler, &msg.body.key_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3966 | break; |
| 3967 | |
| 3968 | case HOST_IF_MSG_CFG_PARAMS: |
| 3969 | |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 3970 | Handle_CfgParam(msg.drvHandler, &msg.body.cfg_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3971 | break; |
| 3972 | |
| 3973 | case HOST_IF_MSG_SET_CHANNEL: |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 3974 | Handle_SetChannel(msg.drvHandler, &msg.body.channel_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3975 | break; |
| 3976 | |
| 3977 | case HOST_IF_MSG_DISCONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3978 | Handle_Disconnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3979 | break; |
| 3980 | |
| 3981 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3982 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3983 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 3984 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3985 | /*Allow chip sleep, only if both interfaces are not connected*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3986 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3987 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3988 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3989 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3990 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3991 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 3992 | Handle_RemainOnChan(msg.drvHandler, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3993 | |
| 3994 | break; |
| 3995 | |
| 3996 | case HOST_IF_MSG_GET_RSSI: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3997 | Handle_GetRssi(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3998 | break; |
| 3999 | |
| 4000 | case HOST_IF_MSG_GET_LINKSPEED: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4001 | Handle_GetLinkspeed(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4002 | break; |
| 4003 | |
| 4004 | case HOST_IF_MSG_GET_STATISTICS: |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 4005 | Handle_GetStatistics(msg.drvHandler, (tstrStatistics *)msg.body.data); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4006 | break; |
| 4007 | |
| 4008 | case HOST_IF_MSG_GET_CHNL: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4009 | Handle_GetChnl(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4010 | break; |
| 4011 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4012 | case HOST_IF_MSG_ADD_BEACON: |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 4013 | Handle_AddBeacon(msg.drvHandler, &msg.body.beacon_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4014 | break; |
| 4015 | |
| 4016 | case HOST_IF_MSG_DEL_BEACON: |
Tony Cho | 80bf8836 | 2015-09-30 18:44:29 +0900 | [diff] [blame] | 4017 | Handle_DelBeacon(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4018 | break; |
| 4019 | |
| 4020 | case HOST_IF_MSG_ADD_STATION: |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4021 | Handle_AddStation(msg.drvHandler, &msg.body.add_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4022 | break; |
| 4023 | |
| 4024 | case HOST_IF_MSG_DEL_STATION: |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 4025 | Handle_DelStation(msg.drvHandler, &msg.body.del_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4026 | break; |
| 4027 | |
| 4028 | case HOST_IF_MSG_EDIT_STATION: |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 4029 | Handle_EditStation(msg.drvHandler, &msg.body.edit_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4030 | break; |
| 4031 | |
| 4032 | case HOST_IF_MSG_GET_INACTIVETIME: |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 4033 | Handle_Get_InActiveTime(msg.drvHandler, &msg.body.mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4034 | break; |
| 4035 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4036 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 4037 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 4038 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4039 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4040 | break; |
| 4041 | |
| 4042 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4043 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4044 | Handle_ConnectTimeout(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4045 | break; |
| 4046 | |
| 4047 | case HOST_IF_MSG_POWER_MGMT: |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 4048 | Handle_PowerManagement(msg.drvHandler, &msg.body.pwr_mgmt_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4049 | break; |
| 4050 | |
| 4051 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4052 | Handle_SetWfiDrvHandler(msg.drvHandler, |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 4053 | &msg.body.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4054 | break; |
| 4055 | |
| 4056 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 4057 | Handle_SetOperationMode(msg.drvHandler, &msg.body.mode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4058 | break; |
| 4059 | |
| 4060 | case HOST_IF_MSG_SET_IPADDRESS: |
| 4061 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4062 | Handle_set_IPAddress(msg.drvHandler, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4063 | break; |
| 4064 | |
| 4065 | case HOST_IF_MSG_GET_IPADDRESS: |
| 4066 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4067 | Handle_get_IPAddress(msg.drvHandler, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4068 | break; |
| 4069 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4070 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 4071 | Handle_SetMacAddress(msg.drvHandler, &msg.body.set_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4072 | break; |
| 4073 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4074 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 4075 | Handle_GetMacAddress(msg.drvHandler, &msg.body.get_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4076 | break; |
| 4077 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4078 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 4079 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4080 | Handle_RemainOnChan(msg.drvHandler, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4081 | break; |
| 4082 | |
| 4083 | case HOST_IF_MSG_REGISTER_FRAME: |
| 4084 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4085 | Handle_RegisterFrame(msg.drvHandler, &msg.body.reg_frame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4086 | break; |
| 4087 | |
| 4088 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4089 | Handle_ListenStateExpired(msg.drvHandler, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4090 | break; |
| 4091 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4092 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 4093 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 4094 | Handle_SetMulticastFilter(msg.drvHandler, &msg.body.multicast_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4095 | break; |
| 4096 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4097 | case HOST_IF_MSG_ADD_BA_SESSION: |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4098 | Handle_AddBASession(msg.drvHandler, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4099 | break; |
| 4100 | |
| 4101 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4102 | Handle_DelAllRxBASessions(msg.drvHandler, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4103 | break; |
| 4104 | |
| 4105 | case HOST_IF_MSG_DEL_ALL_STA: |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 4106 | Handle_DelAllSta(msg.drvHandler, &msg.body.del_all_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4107 | break; |
| 4108 | |
| 4109 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4110 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4111 | break; |
| 4112 | } |
| 4113 | } |
| 4114 | |
| 4115 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4116 | up(&hSemHostIFthrdEnd); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4117 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4118 | } |
| 4119 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4120 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4121 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4122 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4123 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4124 | |
| 4125 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4126 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4127 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4128 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4129 | |
| 4130 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4131 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4132 | } |
| 4133 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4134 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4135 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4136 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4137 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4138 | |
| 4139 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4140 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4141 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4142 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4143 | |
| 4144 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4145 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4146 | } |
| 4147 | |
| 4148 | |
| 4149 | /** |
| 4150 | * @brief removes wpa/wpa2 keys |
| 4151 | * @details only in BSS STA mode if External Supplicant support is enabled. |
| 4152 | * removes all WPA/WPA2 station key entries from MAC hardware. |
| 4153 | * @param[in,out] handle to the wifi driver |
| 4154 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4155 | * @return Error code indicating success/failure |
| 4156 | * @note |
| 4157 | * @author zsalah |
| 4158 | * @date 8 March 2012 |
| 4159 | * @version 1.0 |
| 4160 | */ |
| 4161 | /* Check implementation in core adding 9 bytes to the input! */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4162 | s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4163 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4164 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4165 | tstrWID strWID; |
| 4166 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4167 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4168 | strWID.u16WIDid = (u16)WID_REMOVE_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4169 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4170 | strWID.ps8WidVal = (s8 *)pu8StaAddress; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4171 | strWID.s32ValueSize = 6; |
| 4172 | |
| 4173 | return s32Error; |
| 4174 | |
| 4175 | } |
| 4176 | |
| 4177 | /** |
| 4178 | * @brief removes WEP key |
| 4179 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4180 | * remove a WEP key entry from MAC HW. |
| 4181 | * The BSS Station automatically finds the index of the entry using its |
| 4182 | * BSS ID and removes that entry from the MAC hardware. |
| 4183 | * @param[in,out] handle to the wifi driver |
| 4184 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4185 | * @return Error code indicating success/failure |
| 4186 | * @note NO need for the STA add since it is not used for processing |
| 4187 | * @author zsalah |
| 4188 | * @date 8 March 2012 |
| 4189 | * @version 1.0 |
| 4190 | */ |
Chaehyun Lim | 517af2f | 2015-10-05 19:34:59 +0900 | [diff] [blame^] | 4191 | int host_int_remove_wep_key(tstrWILC_WFIDrv *wfi_drv, u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4192 | { |
Chaehyun Lim | 33e8ce2 | 2015-10-05 19:34:57 +0900 | [diff] [blame] | 4193 | int s32Error = 0; |
Chaehyun Lim | c54a9fb | 2015-10-05 19:34:58 +0900 | [diff] [blame] | 4194 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)wfi_drv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4195 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4196 | |
| 4197 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4198 | if (pstrWFIDrv == NULL) { |
| 4199 | s32Error = -EFAULT; |
| 4200 | PRINT_ER("Failed to send setup multicast config packet\n"); |
| 4201 | return s32Error; |
| 4202 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4203 | |
| 4204 | /* prepare the Remove Wep Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4205 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4206 | |
| 4207 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4208 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4209 | msg.body.key_info.enuKeyType = WEP; |
| 4210 | msg.body.key_info.u8KeyAction = REMOVEKEY; |
Chaehyun Lim | c54a9fb | 2015-10-05 19:34:58 +0900 | [diff] [blame] | 4211 | msg.drvHandler = wfi_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4212 | |
| 4213 | |
| 4214 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4215 | msg.body.key_info. |
Chaehyun Lim | 517af2f | 2015-10-05 19:34:59 +0900 | [diff] [blame^] | 4216 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4217 | |
| 4218 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4219 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4220 | if (s32Error) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4221 | 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] | 4222 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4223 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4224 | return s32Error; |
| 4225 | } |
| 4226 | |
| 4227 | /** |
| 4228 | * @brief sets WEP default key |
| 4229 | * @details Sets the index of the WEP encryption key in use, |
| 4230 | * in the key table |
| 4231 | * @param[in,out] handle to the wifi driver |
| 4232 | * @param[in] key index ( 0, 1, 2, 3) |
| 4233 | * @return Error code indicating success/failure |
| 4234 | * @note |
| 4235 | * @author zsalah |
| 4236 | * @date 8 March 2012 |
| 4237 | * @version 1.0 |
| 4238 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4239 | s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4240 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4241 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4242 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4243 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4244 | |
| 4245 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4246 | if (pstrWFIDrv == NULL) { |
| 4247 | s32Error = -EFAULT; |
| 4248 | PRINT_ER("driver is null\n"); |
| 4249 | return s32Error; |
| 4250 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4251 | |
| 4252 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4253 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4254 | |
| 4255 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4256 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4257 | msg.body.key_info.enuKeyType = WEP; |
| 4258 | msg.body.key_info.u8KeyAction = DEFAULTKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4259 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4260 | |
| 4261 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4262 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4263 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; |
| 4264 | |
| 4265 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4266 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4267 | if (s32Error) |
| 4268 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4269 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4270 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4271 | return s32Error; |
| 4272 | } |
| 4273 | |
| 4274 | /** |
| 4275 | * @brief sets WEP deafault key |
| 4276 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4277 | * sets WEP key entry into MAC hardware when it receives the |
| 4278 | * corresponding request from NDIS. |
| 4279 | * @param[in,out] handle to the wifi driver |
| 4280 | * @param[in] message containing WEP Key in the following format |
| 4281 | *|---------------------------------------| |
| 4282 | *|Key ID Value | Key Length | Key | |
| 4283 | *|-------------|------------|------------| |
| 4284 | | 1byte | 1byte | Key Length | |
| 4285 | ||---------------------------------------| |
| 4286 | | |
| 4287 | * @return Error code indicating success/failure |
| 4288 | * @note |
| 4289 | * @author zsalah |
| 4290 | * @date 8 March 2012 |
| 4291 | * @version 1.0 |
| 4292 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4293 | 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] | 4294 | { |
| 4295 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4296 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4297 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4298 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4299 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4300 | if (pstrWFIDrv == NULL) { |
| 4301 | s32Error = -EFAULT; |
| 4302 | PRINT_ER("driver is null\n"); |
| 4303 | return s32Error; |
| 4304 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4305 | |
| 4306 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4307 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4308 | |
| 4309 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4310 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4311 | msg.body.key_info.enuKeyType = WEP; |
| 4312 | msg.body.key_info.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4313 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4314 | |
| 4315 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4316 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4317 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4318 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4319 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4320 | pu8WepKey, u8WepKeylen); |
| 4321 | |
| 4322 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4323 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4324 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4325 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4326 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4327 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4328 | |
| 4329 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4330 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4331 | if (s32Error) |
| 4332 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4333 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4334 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4335 | return s32Error; |
| 4336 | |
| 4337 | } |
| 4338 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4339 | /** |
| 4340 | * |
| 4341 | * @brief host_int_add_wep_key_bss_ap |
| 4342 | * @details valid only in BSS AP mode if External Supplicant support is enabled. |
| 4343 | * sets WEP key entry into MAC hardware when it receives the |
| 4344 | * |
| 4345 | * corresponding request from NDIS. |
| 4346 | * @param[in,out] handle to the wifi driver |
| 4347 | * |
| 4348 | * |
| 4349 | * @return Error code indicating success/failure |
| 4350 | * @note |
| 4351 | * @author mdaftedar |
| 4352 | * @date 28 FEB 2013 |
| 4353 | * @version 1.0 |
| 4354 | */ |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 4355 | s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4356 | { |
| 4357 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4358 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4359 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4360 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4361 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4362 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4363 | if (pstrWFIDrv == NULL) { |
| 4364 | s32Error = -EFAULT; |
| 4365 | PRINT_ER("driver is null\n"); |
| 4366 | return s32Error; |
| 4367 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4368 | |
| 4369 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4370 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4371 | |
| 4372 | if (INFO) { |
| 4373 | for (i = 0; i < u8WepKeylen; i++) |
| 4374 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 4375 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4376 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4377 | msg.body.key_info.enuKeyType = WEP; |
| 4378 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4379 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4380 | |
| 4381 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4382 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4383 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4384 | |
| 4385 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4386 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4387 | pu8WepKey, (u8WepKeylen)); |
| 4388 | |
| 4389 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4390 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4391 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4392 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4393 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4394 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4395 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4396 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4397 | uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode; |
| 4398 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4399 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4400 | uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; |
| 4401 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4402 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4403 | |
| 4404 | if (s32Error) |
| 4405 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4406 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4407 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4408 | return s32Error; |
| 4409 | |
| 4410 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4411 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4412 | /** |
| 4413 | * @brief adds ptk Key |
| 4414 | * @details |
| 4415 | * @param[in,out] handle to the wifi driver |
| 4416 | * @param[in] message containing PTK Key in the following format |
| 4417 | *|-----------------------------------------------------------------------------| |
| 4418 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 4419 | *|----------------|------------|--------------|----------------|---------------| |
| 4420 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 4421 | ||-----------------------------------------------------------------------------| |
| 4422 | * @return Error code indicating success/failure |
| 4423 | * @note |
| 4424 | * @author zsalah |
| 4425 | * @date 8 March 2012 |
| 4426 | * @version 1.0 |
| 4427 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4428 | 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] | 4429 | 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] | 4430 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4431 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4432 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4433 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4434 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4435 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4436 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4437 | if (pstrWFIDrv == NULL) { |
| 4438 | s32Error = -EFAULT; |
| 4439 | PRINT_ER("driver is null\n"); |
| 4440 | return s32Error; |
| 4441 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4442 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4443 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4444 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4445 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4446 | |
| 4447 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4448 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4449 | |
| 4450 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4451 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4452 | msg.body.key_info.enuKeyType = WPAPtk; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4453 | if (mode == AP_MODE) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4454 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
| 4455 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4456 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx; |
| 4457 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4458 | if (mode == STATION_MODE) |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4459 | msg.body.key_info.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4460 | |
| 4461 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4462 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4463 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4464 | |
| 4465 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4466 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4467 | pu8Ptk, u8PtkKeylen); |
| 4468 | |
| 4469 | if (pu8RxMic != NULL) { |
| 4470 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4471 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4472 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4473 | if (INFO) { |
| 4474 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 4475 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 4476 | } |
| 4477 | } |
| 4478 | if (pu8TxMic != NULL) { |
| 4479 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4480 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4481 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4482 | if (INFO) { |
| 4483 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 4484 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 4485 | } |
| 4486 | } |
| 4487 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4488 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4489 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4490 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4491 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4492 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4493 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4494 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4495 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4496 | |
| 4497 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4498 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4499 | |
| 4500 | if (s32Error) |
| 4501 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 4502 | |
| 4503 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4504 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4505 | /* /////// */ |
| 4506 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4507 | return s32Error; |
| 4508 | } |
| 4509 | |
| 4510 | /** |
| 4511 | * @brief adds Rx GTk Key |
| 4512 | * @details |
| 4513 | * @param[in,out] handle to the wifi driver |
| 4514 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic |
| 4515 | * u8GtkKeylen :The total key length |
| 4516 | * |
| 4517 | * @return Error code indicating success/failure |
| 4518 | * @note |
| 4519 | * @author zsalah |
| 4520 | * @date 8 March 2012 |
| 4521 | * @version 1.0 |
| 4522 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4523 | 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] | 4524 | u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4525 | const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4526 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4527 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4528 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4529 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4530 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4531 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4532 | if (pstrWFIDrv == NULL) { |
| 4533 | s32Error = -EFAULT; |
| 4534 | PRINT_ER("driver is null\n"); |
| 4535 | return s32Error; |
| 4536 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4537 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4538 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4539 | |
| 4540 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4541 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4542 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4543 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4544 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4545 | if (KeyRSC != NULL) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4546 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4547 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4548 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4549 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4550 | KeyRSC, u32KeyRSClen); |
| 4551 | } |
| 4552 | |
| 4553 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4554 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4555 | msg.body.key_info.enuKeyType = WPARxGtk; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4556 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4557 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4558 | if (mode == AP_MODE) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4559 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
| 4560 | msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4561 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4562 | if (mode == STATION_MODE) |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4563 | msg.body.key_info.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4564 | |
| 4565 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4566 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4567 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8KeyLen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4568 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4569 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4570 | pu8RxGtk, u8GtkKeylen); |
| 4571 | |
| 4572 | if (pu8RxMic != NULL) { |
| 4573 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4574 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4575 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4576 | |
| 4577 | } |
| 4578 | if (pu8TxMic != NULL) { |
| 4579 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4580 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4581 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4582 | |
| 4583 | } |
| 4584 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4585 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4586 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4587 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4588 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4589 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4590 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4591 | uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen; |
| 4592 | |
| 4593 | |
| 4594 | |
| 4595 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4596 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4597 | if (s32Error) |
| 4598 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
| 4599 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4600 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4601 | /* /////// */ |
| 4602 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4603 | return s32Error; |
| 4604 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4605 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4606 | /** |
| 4607 | * @brief host_int_set_pmkid_info |
| 4608 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant |
| 4609 | * support is enabled. This Function sets the PMKID in firmware |
| 4610 | * when host drivr receives the corresponding request from NDIS. |
| 4611 | * The firmware then includes theset PMKID in the appropriate |
| 4612 | * management frames |
| 4613 | * @param[in,out] handle to the wifi driver |
| 4614 | * @param[in] message containing PMKID Info in the following format |
| 4615 | *|-----------------------------------------------------------------| |
| 4616 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 4617 | *|-----------|------------|----------|-------|----------|----------| |
| 4618 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 4619 | ||-----------------------------------------------------------------| |
| 4620 | * @return Error code indicating success/failure |
| 4621 | * @note |
| 4622 | * @author zsalah |
| 4623 | * @date 8 March 2012 |
| 4624 | * @version 1.0 |
| 4625 | */ |
Leo Kim | a949f90 | 2015-10-05 15:25:44 +0900 | [diff] [blame] | 4626 | s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4627 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4628 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4629 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4630 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4631 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4632 | |
| 4633 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4634 | if (pstrWFIDrv == NULL) { |
| 4635 | s32Error = -EFAULT; |
| 4636 | PRINT_ER("driver is null\n"); |
| 4637 | return s32Error; |
| 4638 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4639 | |
| 4640 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4641 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4642 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4643 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4644 | msg.body.key_info.enuKeyType = PMKSA; |
| 4645 | msg.body.key_info.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4646 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4647 | |
| 4648 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
| 4649 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4650 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4651 | ETH_ALEN); |
| 4652 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4653 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4654 | PMKID_LEN); |
| 4655 | } |
| 4656 | |
| 4657 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4658 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4659 | if (s32Error) |
| 4660 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 4661 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4662 | return s32Error; |
| 4663 | } |
| 4664 | |
| 4665 | /** |
| 4666 | * @brief gets the cached the pmkid info |
| 4667 | * @details valid only in BSS STA mode if External Supplicant |
| 4668 | * support is enabled. This Function sets the PMKID in firmware |
| 4669 | * when host drivr receives the corresponding request from NDIS. |
| 4670 | * The firmware then includes theset PMKID in the appropriate |
| 4671 | * management frames |
| 4672 | * @param[in,out] handle to the wifi driver, |
| 4673 | * message containing PMKID Info in the following format |
| 4674 | *|-----------------------------------------------------------------| |
| 4675 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 4676 | *|-----------|------------|----------|-------|----------|----------| |
| 4677 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 4678 | ||-----------------------------------------------------------------| |
| 4679 | * @param[in] |
| 4680 | * @return Error code indicating success/failure |
| 4681 | * @note |
| 4682 | * @author zsalah |
| 4683 | * @date 8 March 2012 |
| 4684 | * @version 1.0 |
| 4685 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4686 | s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4687 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4688 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4689 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4690 | tstrWID strWID; |
| 4691 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4692 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4693 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4694 | strWID.enuWIDtype = WID_STR; |
| 4695 | strWID.s32ValueSize = u32PmkidInfoLen; |
| 4696 | strWID.ps8WidVal = pu8PmkidInfoArray; |
| 4697 | |
| 4698 | return s32Error; |
| 4699 | } |
| 4700 | |
| 4701 | /** |
| 4702 | * @brief sets the pass phrase |
| 4703 | * @details AP/STA mode. This function gives the pass phrase used to |
| 4704 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 4705 | * The length of the field can vary from 8 to 64 bytes, |
| 4706 | * the lower layer should get the |
| 4707 | * @param[in,out] handle to the wifi driver, |
| 4708 | * @param[in] String containing PSK |
| 4709 | * @return Error code indicating success/failure |
| 4710 | * @note |
| 4711 | * @author zsalah |
| 4712 | * @date 8 March 2012 |
| 4713 | * @version 1.0 |
| 4714 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4715 | s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4716 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4717 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4718 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4719 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4720 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4721 | /*validating psk length*/ |
| 4722 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4723 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4724 | strWID.enuWIDtype = WID_STR; |
| 4725 | strWID.ps8WidVal = pu8PassPhrase; |
| 4726 | strWID.s32ValueSize = u8Psklength; |
| 4727 | } |
| 4728 | |
| 4729 | return s32Error; |
| 4730 | } |
| 4731 | /** |
| 4732 | * @brief host_int_get_MacAddress |
| 4733 | * @details gets mac address |
| 4734 | * @param[in,out] handle to the wifi driver, |
| 4735 | * |
| 4736 | * @return Error code indicating success/failure |
| 4737 | * @note |
| 4738 | * @author mdaftedar |
| 4739 | * @date 19 April 2012 |
| 4740 | * @version 1.0 |
| 4741 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4742 | s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4743 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4744 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4745 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4746 | |
| 4747 | |
| 4748 | /* prepare the Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4749 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4750 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4751 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 4752 | msg.body.get_mac_info.u8MacAddress = pu8MacAddress; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4753 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4754 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4755 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4756 | if (s32Error) { |
| 4757 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4758 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4759 | } |
| 4760 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4761 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4762 | return s32Error; |
| 4763 | } |
| 4764 | |
| 4765 | /** |
| 4766 | * @brief host_int_set_MacAddress |
| 4767 | * @details sets mac address |
| 4768 | * @param[in,out] handle to the wifi driver, |
| 4769 | * |
| 4770 | * @return Error code indicating success/failure |
| 4771 | * @note |
| 4772 | * @author mabubakr |
| 4773 | * @date 16 July 2012 |
| 4774 | * @version 1.0 |
| 4775 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4776 | s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4777 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4778 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4779 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4780 | |
| 4781 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 4782 | |
| 4783 | /* prepare setting mac address message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4784 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4785 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 4786 | memcpy(msg.body.set_mac_info.u8MacAddress, pu8MacAddress, ETH_ALEN); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4787 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4788 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4789 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4790 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4791 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4792 | |
| 4793 | return s32Error; |
| 4794 | |
| 4795 | } |
| 4796 | |
| 4797 | /** |
| 4798 | * @brief host_int_get_RSNAConfigPSKPassPhrase |
| 4799 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to |
| 4800 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 4801 | * The length of the field can vary from 8 to 64 bytes, |
| 4802 | * the lower layer should get the |
| 4803 | * @param[in,out] handle to the wifi driver, |
| 4804 | * String containing PSK |
| 4805 | * @return Error code indicating success/failure |
| 4806 | * @note |
| 4807 | * @author zsalah |
| 4808 | * @date 8 March 2012 |
| 4809 | * @version 1.0 |
| 4810 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4811 | s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4812 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4813 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4814 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4815 | tstrWID strWID; |
| 4816 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4817 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4818 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4819 | strWID.enuWIDtype = WID_STR; |
| 4820 | strWID.s32ValueSize = u8Psklength; |
| 4821 | strWID.ps8WidVal = pu8PassPhrase; |
| 4822 | |
| 4823 | return s32Error; |
| 4824 | } |
| 4825 | |
| 4826 | /** |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4827 | * @brief sets a start scan request |
| 4828 | * @details |
| 4829 | * @param[in,out] handle to the wifi driver, |
| 4830 | * @param[in] Scan Source one of the following values |
| 4831 | * DEFAULT_SCAN 0 |
| 4832 | * USER_SCAN BIT0 |
| 4833 | * OBSS_PERIODIC_SCAN BIT1 |
| 4834 | * OBSS_ONETIME_SCAN BIT2 |
| 4835 | * @return Error code indicating success/failure |
| 4836 | * @note |
| 4837 | * @author zsalah |
| 4838 | * @date 8 March 2012 |
| 4839 | * @version 1.0 |
| 4840 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4841 | s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4842 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4843 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4844 | tstrWID strWID; |
| 4845 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4846 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4847 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4848 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4849 | strWID.ps8WidVal = (s8 *)&scanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4850 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4851 | |
| 4852 | return s32Error; |
| 4853 | } |
| 4854 | |
| 4855 | /** |
| 4856 | * @brief host_int_get_start_scan_req |
| 4857 | * @details gets a start scan request |
| 4858 | * @param[in,out] handle to the wifi driver, |
| 4859 | * @param[in] Scan Source one of the following values |
| 4860 | * DEFAULT_SCAN 0 |
| 4861 | * USER_SCAN BIT0 |
| 4862 | * OBSS_PERIODIC_SCAN BIT1 |
| 4863 | * OBSS_ONETIME_SCAN BIT2 |
| 4864 | * @return Error code indicating success/failure |
| 4865 | * @note |
| 4866 | * @author zsalah |
| 4867 | * @date 8 March 2012 |
| 4868 | * @version 1.0 |
| 4869 | */ |
| 4870 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4871 | s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4872 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4873 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4874 | tstrWID strWID; |
| 4875 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4876 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4877 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4878 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4879 | strWID.ps8WidVal = (s8 *)pu8ScanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4880 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4881 | |
| 4882 | return s32Error; |
| 4883 | } |
| 4884 | |
| 4885 | /** |
| 4886 | * @brief host_int_set_join_req |
| 4887 | * @details sets a join request |
| 4888 | * @param[in,out] handle to the wifi driver, |
| 4889 | * @param[in] Index of the bss descriptor |
| 4890 | * @return Error code indicating success/failure |
| 4891 | * @note |
| 4892 | * @author zsalah |
| 4893 | * @date 8 March 2012 |
| 4894 | * @version 1.0 |
| 4895 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4896 | s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 4897 | const u8 *pu8ssid, size_t ssidLen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4898 | const u8 *pu8IEs, size_t IEsLen, |
Leo Kim | b6ab85f | 2015-10-05 15:25:38 +0900 | [diff] [blame] | 4899 | wilc_connect_result pfConnectResult, void *pvUserArg, |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 4900 | u8 u8security, enum AUTHTYPE tenuAuth_type, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4901 | u8 u8channel, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4902 | void *pJoinParams) |
| 4903 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4904 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4905 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4906 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4907 | tenuScanConnTimer enuScanConnTimer; |
| 4908 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4909 | if (pstrWFIDrv == NULL || pfConnectResult == NULL) { |
| 4910 | s32Error = -EFAULT; |
| 4911 | PRINT_ER("Driver is null\n"); |
| 4912 | return s32Error; |
| 4913 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4914 | |
| 4915 | if (hWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4916 | PRINT_ER("Driver is null\n"); |
| 4917 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4918 | } |
| 4919 | |
| 4920 | if (pJoinParams == NULL) { |
| 4921 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4922 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4923 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4924 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4925 | /* prepare the Connect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4926 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4927 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4928 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4929 | |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4930 | msg.body.con_info.u8security = u8security; |
| 4931 | msg.body.con_info.tenuAuth_type = tenuAuth_type; |
| 4932 | msg.body.con_info.u8channel = u8channel; |
| 4933 | msg.body.con_info.pfConnectResult = pfConnectResult; |
| 4934 | msg.body.con_info.pvUserArg = pvUserArg; |
| 4935 | msg.body.con_info.pJoinParams = pJoinParams; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4936 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4937 | |
| 4938 | if (pu8bssid != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4939 | msg.body.con_info.pu8bssid = kmalloc(6, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 4940 | memcpy(msg.body.con_info.pu8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4941 | pu8bssid, 6); |
| 4942 | } |
| 4943 | |
| 4944 | if (pu8ssid != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4945 | msg.body.con_info.ssidLen = ssidLen; |
| 4946 | msg.body.con_info.pu8ssid = kmalloc(ssidLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 4947 | memcpy(msg.body.con_info.pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4948 | |
| 4949 | pu8ssid, ssidLen); |
| 4950 | } |
| 4951 | |
| 4952 | if (pu8IEs != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4953 | msg.body.con_info.IEsLen = IEsLen; |
| 4954 | msg.body.con_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 4955 | memcpy(msg.body.con_info.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4956 | pu8IEs, IEsLen); |
| 4957 | } |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4958 | if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4959 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4960 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4961 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); |
| 4962 | |
| 4963 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4964 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4965 | if (s32Error) { |
| 4966 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4967 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4968 | } |
| 4969 | |
| 4970 | enuScanConnTimer = CONNECT_TIMER; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 4971 | pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; |
| 4972 | mod_timer(&pstrWFIDrv->hConnectTimer, |
| 4973 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4974 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4975 | return s32Error; |
| 4976 | } |
| 4977 | |
| 4978 | /** |
| 4979 | * @brief Flush a join request parameters to FW, but actual connection |
| 4980 | * @details The function is called in situation where WILC is connected to AP and |
| 4981 | * required to switch to hybrid FW for P2P connection |
| 4982 | * @param[in] handle to the wifi driver, |
| 4983 | * @return Error code indicating success/failure |
| 4984 | * @note |
| 4985 | * @author Amr Abdel-Moghny |
| 4986 | * @date 19 DEC 2013 |
| 4987 | * @version 8.0 |
| 4988 | */ |
| 4989 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4990 | s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4991 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4992 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4993 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4994 | |
| 4995 | if (!gu8FlushedJoinReq) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4996 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4997 | return s32Error; |
| 4998 | } |
| 4999 | |
| 5000 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5001 | if (hWFIDrv == NULL) { |
| 5002 | s32Error = -EFAULT; |
| 5003 | PRINT_ER("Driver is null\n"); |
| 5004 | return s32Error; |
| 5005 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5006 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5007 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5008 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5009 | |
| 5010 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5011 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5012 | if (s32Error) { |
| 5013 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5014 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5015 | } |
| 5016 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5017 | return s32Error; |
| 5018 | } |
| 5019 | |
| 5020 | /** |
| 5021 | * @brief host_int_disconnect |
| 5022 | * @details disconnects from the currently associated network |
| 5023 | * @param[in,out] handle to the wifi driver, |
| 5024 | * @param[in] Reason Code of the Disconnection |
| 5025 | * @return Error code indicating success/failure |
| 5026 | * @note |
| 5027 | * @author zsalah |
| 5028 | * @date 8 March 2012 |
| 5029 | * @version 1.0 |
| 5030 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5031 | s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5032 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5033 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5034 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5035 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5036 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5037 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5038 | PRINT_ER("Driver is null\n"); |
| 5039 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5040 | } |
| 5041 | |
| 5042 | /* prepare the Disconnect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5043 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5044 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5045 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5046 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5047 | |
| 5048 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5049 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5050 | if (s32Error) |
| 5051 | PRINT_ER("Failed to send message queue: disconnect\n"); |
| 5052 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5053 | down(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5054 | /* /////// */ |
| 5055 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5056 | return s32Error; |
| 5057 | } |
| 5058 | |
| 5059 | /** |
| 5060 | * @brief host_int_disconnect_station |
| 5061 | * @details disconnects a sta |
| 5062 | * @param[in,out] handle to the wifi driver, |
| 5063 | * @param[in] Association Id of the station to be disconnected |
| 5064 | * @return Error code indicating success/failure |
| 5065 | * @note |
| 5066 | * @author zsalah |
| 5067 | * @date 8 March 2012 |
| 5068 | * @version 1.0 |
| 5069 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5070 | s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5071 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5072 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5073 | tstrWID strWID; |
| 5074 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5075 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5076 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5077 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5078 | strWID.ps8WidVal = (s8 *)&assoc_id; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5079 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5080 | |
| 5081 | return s32Error; |
| 5082 | } |
| 5083 | |
| 5084 | /** |
| 5085 | * @brief host_int_get_assoc_req_info |
| 5086 | * @details gets a Association request info |
| 5087 | * @param[in,out] handle to the wifi driver, |
| 5088 | * Message containg assoc. req info in the following format |
| 5089 | * ------------------------------------------------------------------------ |
| 5090 | | Management Frame Format | |
| 5091 | ||-------------------------------------------------------------------| |
| 5092 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | |
| 5093 | ||-------------|--------|--|--|-----|----------------|----------|----| |
| 5094 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | |
| 5095 | ||-------------------------------------------------------------------| |
| 5096 | | | |
| 5097 | | Association Request Frame - Frame Body | |
| 5098 | ||-------------------------------------------------------------------| |
| 5099 | | Capability Information | Listen Interval | SSID | Supported Rates | |
| 5100 | ||------------------------|-----------------|------|-----------------| |
| 5101 | | 2 | 2 | 2-34 | 3-10 | |
| 5102 | | --------------------------------------------------------------------- |
| 5103 | * @return Error code indicating success/failure |
| 5104 | * @note |
| 5105 | * @author zsalah |
| 5106 | * @date 8 March 2012 |
| 5107 | * @version 1.0 |
| 5108 | */ |
| 5109 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5110 | s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5111 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5112 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5113 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5114 | tstrWID strWID; |
| 5115 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5116 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5117 | strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5118 | strWID.enuWIDtype = WID_STR; |
| 5119 | strWID.ps8WidVal = pu8AssocReqInfo; |
| 5120 | strWID.s32ValueSize = u32AssocReqInfoLen; |
| 5121 | |
| 5122 | |
| 5123 | return s32Error; |
| 5124 | } |
| 5125 | |
| 5126 | /** |
| 5127 | * @brief gets a Association Response info |
| 5128 | * @details |
| 5129 | * @param[in,out] handle to the wifi driver, |
| 5130 | * Message containg assoc. resp info |
| 5131 | * @return Error code indicating success/failure |
| 5132 | * @note |
| 5133 | * @author zsalah |
| 5134 | * @date 8 March 2012 |
| 5135 | * @version 1.0 |
| 5136 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5137 | s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5138 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5139 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5140 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5141 | tstrWID strWID; |
| 5142 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5143 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5144 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5145 | PRINT_ER("Driver is null\n"); |
| 5146 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5147 | } |
| 5148 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5149 | strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5150 | strWID.enuWIDtype = WID_STR; |
| 5151 | strWID.ps8WidVal = pu8AssocRespInfo; |
| 5152 | strWID.s32ValueSize = u32MaxAssocRespInfoLen; |
| 5153 | |
| 5154 | |
| 5155 | /* Sending Configuration packet */ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 5156 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 5157 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5158 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5159 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5160 | PRINT_ER("Failed to send association response config packet\n"); |
| 5161 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5162 | } else { |
| 5163 | *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize; |
| 5164 | } |
| 5165 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5166 | return s32Error; |
| 5167 | } |
| 5168 | |
| 5169 | /** |
| 5170 | * @brief gets a Association Response info |
| 5171 | * @details Valid only in STA mode. This function gives the RSSI |
| 5172 | * values observed in all the channels at the time of scanning. |
| 5173 | * The length of the field is 1 greater that the total number of |
| 5174 | * channels supported. Byte 0 contains the number of channels while |
| 5175 | * each of Byte N contains the observed RSSI value for the channel index N. |
| 5176 | * @param[in,out] handle to the wifi driver, |
| 5177 | * array of scanned channels' RSSI |
| 5178 | * @return Error code indicating success/failure |
| 5179 | * @note |
| 5180 | * @author zsalah |
| 5181 | * @date 8 March 2012 |
| 5182 | * @version 1.0 |
| 5183 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5184 | s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5185 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5186 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5187 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5188 | tstrWID strWID; |
| 5189 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5190 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5191 | strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5192 | strWID.enuWIDtype = WID_STR; |
| 5193 | strWID.ps8WidVal = pu8RxPowerLevel; |
| 5194 | strWID.s32ValueSize = u32RxPowerLevelLen; |
| 5195 | |
| 5196 | |
| 5197 | return s32Error; |
| 5198 | } |
| 5199 | |
| 5200 | /** |
| 5201 | * @brief sets a channel |
| 5202 | * @details |
| 5203 | * @param[in,out] handle to the wifi driver, |
| 5204 | * @param[in] Index of the channel to be set |
| 5205 | *|-------------------------------------------------------------------| |
| 5206 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5207 | | Input: 1 2 14 | |
| 5208 | ||-------------------------------------------------------------------| |
| 5209 | * @return Error code indicating success/failure |
| 5210 | * @note |
| 5211 | * @author zsalah |
| 5212 | * @date 8 March 2012 |
| 5213 | * @version 1.0 |
| 5214 | */ |
Chaehyun Lim | 5ba48ec | 2015-10-02 21:44:52 +0900 | [diff] [blame] | 5215 | int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5216 | { |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5217 | int result; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5218 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5219 | |
Chaehyun Lim | 157da21 | 2015-10-05 11:07:21 +0900 | [diff] [blame] | 5220 | if (!wfi_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5221 | PRINT_ER("driver is null\n"); |
| 5222 | return -EFAULT; |
| 5223 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5224 | |
| 5225 | /* prepare the set channel message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5226 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5227 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Chaehyun Lim | 1c5833c | 2015-10-02 21:44:51 +0900 | [diff] [blame] | 5228 | msg.body.channel_info.u8SetChan = channel; |
Chaehyun Lim | 5ba48ec | 2015-10-02 21:44:52 +0900 | [diff] [blame] | 5229 | msg.drvHandler = wfi_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5230 | |
Chaehyun Lim | 1ef58e4 | 2015-10-02 21:44:49 +0900 | [diff] [blame] | 5231 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5232 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5233 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5234 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5235 | } |
| 5236 | |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5237 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5238 | } |
| 5239 | |
Chaehyun Lim | 244efb1 | 2015-10-02 21:44:53 +0900 | [diff] [blame] | 5240 | int host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5241 | { |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5242 | int result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5243 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5244 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5245 | |
| 5246 | /* prepare the set driver handler message */ |
| 5247 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5248 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5249 | msg.id = HOST_IF_MSG_Q_IDLE; |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5250 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5251 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5252 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5253 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5254 | } |
| 5255 | |
| 5256 | /* wait untill MSG Q is empty */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5257 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5258 | |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5259 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5260 | } |
| 5261 | |
Chaehyun Lim | 3c5f3e5 | 2015-10-05 19:34:48 +0900 | [diff] [blame] | 5262 | int host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *address) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5263 | { |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5264 | int result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5265 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5266 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5267 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5268 | /* prepare the set driver handler message */ |
| 5269 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5270 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5271 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Chaehyun Lim | 3c5f3e5 | 2015-10-05 19:34:48 +0900 | [diff] [blame] | 5272 | msg.body.drv.u32Address = get_id_from_handler(address); |
| 5273 | msg.drvHandler = address; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5274 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5275 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5276 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5277 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5278 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5279 | } |
| 5280 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5281 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5282 | } |
| 5283 | |
Chaehyun Lim | 49fb6f7 | 2015-10-05 19:34:52 +0900 | [diff] [blame] | 5284 | int host_int_set_operation_mode(tstrWILC_WFIDrv *wfi_drv, u32 mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5285 | { |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5286 | int result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5287 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5288 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5289 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5290 | /* prepare the set driver handler message */ |
| 5291 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5292 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5293 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Chaehyun Lim | 49fb6f7 | 2015-10-05 19:34:52 +0900 | [diff] [blame] | 5294 | msg.body.mode.u32Mode = mode; |
Chaehyun Lim | 2308192 | 2015-10-05 19:34:51 +0900 | [diff] [blame] | 5295 | msg.drvHandler = wfi_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5296 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5297 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5298 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5299 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5300 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5301 | } |
| 5302 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5303 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5304 | } |
| 5305 | |
| 5306 | /** |
| 5307 | * @brief gets the current channel index |
| 5308 | * @details |
| 5309 | * @param[in,out] handle to the wifi driver, |
| 5310 | * current channel index |
| 5311 | *|-----------------------------------------------------------------------| |
| 5312 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5313 | | Input: 1 2 14 | |
| 5314 | ||-----------------------------------------------------------------------| |
| 5315 | * @return Error code indicating success/failure |
| 5316 | * @note |
| 5317 | * @author zsalah |
| 5318 | * @date 8 March 2012 |
| 5319 | * @version 1.0 |
| 5320 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5321 | s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5322 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5323 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5324 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5325 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5326 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5327 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5328 | PRINT_ER("driver is null\n"); |
| 5329 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5330 | } |
| 5331 | |
| 5332 | /* prepare the Get Channel Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5333 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5334 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5335 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5336 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5337 | |
| 5338 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5339 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5340 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5341 | PRINT_ER("wilc mq send fail\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5342 | down(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5343 | /* gu8Chnl = 11; */ |
| 5344 | |
| 5345 | *pu8ChNo = gu8Chnl; |
| 5346 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5347 | return s32Error; |
| 5348 | |
| 5349 | |
| 5350 | } |
| 5351 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5352 | /** |
| 5353 | * @brief host_int_get_inactive_time |
| 5354 | * @details |
| 5355 | * @param[in,out] handle to the wifi driver, |
| 5356 | * current sta macaddress, inactive_time |
| 5357 | * @return |
| 5358 | * @note |
| 5359 | * @author |
| 5360 | * @date |
| 5361 | * @version 1.0 |
| 5362 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5363 | 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] | 5364 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5365 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5366 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5367 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5368 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5369 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5370 | PRINT_ER("driver is null\n"); |
| 5371 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5372 | } |
| 5373 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5374 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5375 | |
| 5376 | |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 5377 | memcpy(msg.body.mac_info.mac, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5378 | mac, ETH_ALEN); |
| 5379 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5380 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5381 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5382 | |
| 5383 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5384 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5385 | if (s32Error) |
| 5386 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5387 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5388 | down(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5389 | |
| 5390 | *pu32InactiveTime = gu32InactiveTime; |
| 5391 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5392 | return s32Error; |
| 5393 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 5394 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5395 | /** |
| 5396 | * @brief host_int_test_get_int_wid |
| 5397 | * @details Test function for getting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5398 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5399 | * @return Error code indicating success/failure |
| 5400 | * @note |
| 5401 | * @author zsalah |
| 5402 | * @date 8 March 2012 |
| 5403 | * @version 1.0 |
| 5404 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5405 | s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5406 | { |
| 5407 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5408 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5409 | tstrWID strWID; |
| 5410 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5411 | |
| 5412 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5413 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5414 | PRINT_ER("driver is null\n"); |
| 5415 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5416 | } |
| 5417 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5418 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5419 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5420 | strWID.ps8WidVal = (s8 *)pu32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5421 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5422 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 5423 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 5424 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5425 | /*get the value by searching the local copy*/ |
| 5426 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5427 | PRINT_ER("Failed to get wid value\n"); |
| 5428 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5429 | } else { |
| 5430 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
| 5431 | |
| 5432 | } |
| 5433 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5434 | return s32Error; |
| 5435 | } |
| 5436 | |
| 5437 | |
| 5438 | /** |
| 5439 | * @brief host_int_get_rssi |
| 5440 | * @details gets the currently maintained RSSI value for the station. |
| 5441 | * The received signal strength value in dB. |
| 5442 | * The range of valid values is -128 to 0. |
| 5443 | * @param[in,out] handle to the wifi driver, |
| 5444 | * rssi value in dB |
| 5445 | * @return Error code indicating success/failure |
| 5446 | * @note |
| 5447 | * @author zsalah |
| 5448 | * @date 8 March 2012 |
| 5449 | * @version 1.0 |
| 5450 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5451 | s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5452 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5453 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5454 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5455 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5456 | |
| 5457 | |
| 5458 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5459 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5460 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5461 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5462 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5463 | |
| 5464 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5465 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5466 | if (s32Error) { |
| 5467 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5468 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5469 | } |
| 5470 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5471 | down(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5472 | |
| 5473 | |
| 5474 | if (ps8Rssi == NULL) { |
| 5475 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5476 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5477 | } |
| 5478 | |
| 5479 | |
| 5480 | *ps8Rssi = gs8Rssi; |
| 5481 | |
| 5482 | |
| 5483 | return s32Error; |
| 5484 | } |
| 5485 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5486 | s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5487 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5488 | struct host_if_msg msg; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5489 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5490 | |
| 5491 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5492 | |
| 5493 | |
| 5494 | |
| 5495 | /* prepare the Get LINKSPEED Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5496 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5497 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5498 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5499 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5500 | |
| 5501 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5502 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5503 | if (s32Error) { |
| 5504 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5505 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5506 | } |
| 5507 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5508 | down(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5509 | |
| 5510 | |
| 5511 | if (ps8lnkspd == NULL) { |
| 5512 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5513 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5514 | } |
| 5515 | |
| 5516 | |
| 5517 | *ps8lnkspd = gs8lnkspd; |
| 5518 | |
| 5519 | |
| 5520 | return s32Error; |
| 5521 | } |
| 5522 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5523 | s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5524 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5525 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5526 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5527 | |
| 5528 | |
| 5529 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5530 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5531 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5532 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 5533 | msg.body.data = (char *)pstrStatistics; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5534 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5535 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5536 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5537 | if (s32Error) { |
| 5538 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5539 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5540 | } |
| 5541 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5542 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5543 | return s32Error; |
| 5544 | } |
| 5545 | |
| 5546 | |
| 5547 | /** |
| 5548 | * @brief host_int_scan |
| 5549 | * @details scans a set of channels |
| 5550 | * @param[in,out] handle to the wifi driver, |
| 5551 | * @param[in] Scan source |
| 5552 | * Scan Type PASSIVE_SCAN = 0, |
| 5553 | * ACTIVE_SCAN = 1 |
| 5554 | * Channels Array |
| 5555 | * Channels Array length |
| 5556 | * Scan Callback function |
| 5557 | * @return Error code indicating success/failure |
| 5558 | * @note |
| 5559 | * @author zsalah |
| 5560 | * @date 8 March 2012 |
| 5561 | * @version 1.0 |
| 5562 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5563 | s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5564 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 5565 | u8 u8ChnlListLen, const u8 *pu8IEs, |
Leo Kim | ba1d1a6 | 2015-10-05 15:25:36 +0900 | [diff] [blame] | 5566 | size_t IEsLen, wilc_scan_result ScanResult, |
Leo Kim | 607db44 | 2015-10-05 15:25:37 +0900 | [diff] [blame] | 5567 | void *pvUserArg, |
| 5568 | struct hidden_network *pstrHiddenNetwork) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5569 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5570 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5571 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5572 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5573 | tenuScanConnTimer enuScanConnTimer; |
| 5574 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5575 | if (pstrWFIDrv == NULL || ScanResult == NULL) { |
| 5576 | PRINT_ER("pstrWFIDrv or ScanResult = NULL\n"); |
| 5577 | return -EFAULT; |
| 5578 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5579 | |
| 5580 | /* prepare the Scan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5581 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5582 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5583 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5584 | |
| 5585 | if (pstrHiddenNetwork != NULL) { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5586 | msg.body.scan_info.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 5587 | msg.body.scan_info.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5588 | |
| 5589 | } else |
| 5590 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 5591 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5592 | msg.drvHandler = hWFIDrv; |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5593 | msg.body.scan_info.u8ScanSource = u8ScanSource; |
| 5594 | msg.body.scan_info.u8ScanType = u8ScanType; |
| 5595 | msg.body.scan_info.pfScanResult = ScanResult; |
| 5596 | msg.body.scan_info.pvUserArg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5597 | |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5598 | msg.body.scan_info.u8ChnlListLen = u8ChnlListLen; |
| 5599 | msg.body.scan_info.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5600 | memcpy(msg.body.scan_info.pu8ChnlFreqList, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5601 | pu8ChnlFreqList, u8ChnlListLen); |
| 5602 | |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5603 | msg.body.scan_info.IEsLen = IEsLen; |
| 5604 | msg.body.scan_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5605 | memcpy(msg.body.scan_info.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5606 | pu8IEs, IEsLen); |
| 5607 | |
| 5608 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5609 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5610 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5611 | PRINT_ER("Error in sending message queue\n"); |
| 5612 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5613 | } |
| 5614 | |
| 5615 | enuScanConnTimer = SCAN_TIMER; |
| 5616 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5617 | pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; |
| 5618 | mod_timer(&pstrWFIDrv->hScanTimer, |
| 5619 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5620 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5621 | return s32Error; |
| 5622 | |
| 5623 | } |
| 5624 | /** |
| 5625 | * @brief hif_set_cfg |
| 5626 | * @details sets configuration wids values |
| 5627 | * @param[in,out] handle to the wifi driver, |
| 5628 | * @param[in] WID, WID value |
| 5629 | * @return Error code indicating success/failure |
| 5630 | * @note |
| 5631 | * @author zsalah |
| 5632 | * @date 8 March 2012 |
| 5633 | * @version 1.0 |
| 5634 | */ |
Leo Kim | 9529650 | 2015-10-05 15:25:46 +0900 | [diff] [blame] | 5635 | s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5636 | { |
| 5637 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5638 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5639 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5640 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5641 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5642 | |
| 5643 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5644 | if (pstrWFIDrv == NULL) { |
| 5645 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 5646 | return -EFAULT; |
| 5647 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5648 | /* prepare the WiphyParams Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5649 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5650 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 5651 | msg.body.cfg_info.pstrCfgParamVal = *pstrCfgParamVal; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5652 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5653 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5654 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5655 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5656 | return s32Error; |
| 5657 | |
| 5658 | } |
| 5659 | |
| 5660 | |
| 5661 | /** |
| 5662 | * @brief hif_get_cfg |
| 5663 | * @details gets configuration wids values |
| 5664 | * @param[in,out] handle to the wifi driver, |
| 5665 | * WID value |
| 5666 | * @param[in] WID, |
| 5667 | * @return Error code indicating success/failure |
| 5668 | * @note |
| 5669 | * @author zsalah |
| 5670 | * |
| 5671 | * @date 8 March 2012 |
| 5672 | * @version 1.0 |
| 5673 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5674 | s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5675 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5676 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5677 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5678 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5679 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5680 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5681 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5682 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 5683 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5684 | } |
| 5685 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 5686 | switch (u16WID) { |
| 5687 | |
| 5688 | case WID_BSS_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5689 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5690 | break; |
| 5691 | |
| 5692 | case WID_AUTH_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5693 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5694 | break; |
| 5695 | |
| 5696 | case WID_AUTH_TIMEOUT: |
| 5697 | *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout; |
| 5698 | break; |
| 5699 | |
| 5700 | case WID_POWER_MANAGEMENT: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5701 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5702 | break; |
| 5703 | |
| 5704 | case WID_SHORT_RETRY_LIMIT: |
| 5705 | *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit; |
| 5706 | break; |
| 5707 | |
| 5708 | case WID_LONG_RETRY_LIMIT: |
| 5709 | *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit; |
| 5710 | break; |
| 5711 | |
| 5712 | case WID_FRAG_THRESHOLD: |
| 5713 | *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold; |
| 5714 | break; |
| 5715 | |
| 5716 | case WID_RTS_THRESHOLD: |
| 5717 | *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold; |
| 5718 | break; |
| 5719 | |
| 5720 | case WID_PREAMBLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5721 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5722 | break; |
| 5723 | |
| 5724 | case WID_SHORT_SLOT_ALLOWED: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5725 | *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5726 | break; |
| 5727 | |
| 5728 | case WID_11N_TXOP_PROT_DISABLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5729 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5730 | break; |
| 5731 | |
| 5732 | case WID_BEACON_INTERVAL: |
| 5733 | *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval; |
| 5734 | break; |
| 5735 | |
| 5736 | case WID_DTIM_PERIOD: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5737 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5738 | break; |
| 5739 | |
| 5740 | case WID_SITE_SURVEY: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5741 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5742 | break; |
| 5743 | |
| 5744 | case WID_SITE_SURVEY_SCAN_TIME: |
| 5745 | *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time; |
| 5746 | break; |
| 5747 | |
| 5748 | case WID_ACTIVE_SCAN_TIME: |
| 5749 | *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time; |
| 5750 | break; |
| 5751 | |
| 5752 | case WID_PASSIVE_SCAN_TIME: |
| 5753 | *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time; |
| 5754 | break; |
| 5755 | |
| 5756 | case WID_CURRENT_TX_RATE: |
| 5757 | *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate; |
| 5758 | break; |
| 5759 | |
| 5760 | default: |
| 5761 | break; |
| 5762 | } |
| 5763 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5764 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5765 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5766 | return s32Error; |
| 5767 | |
| 5768 | } |
| 5769 | |
| 5770 | /*****************************************************************************/ |
| 5771 | /* Notification Functions */ |
| 5772 | /*****************************************************************************/ |
| 5773 | /** |
| 5774 | * @brief notifies host with join and leave requests |
| 5775 | * @details This function prepares an Information frame having the |
| 5776 | * information about a joining/leaving station. |
| 5777 | * @param[in,out] handle to the wifi driver, |
| 5778 | * @param[in] 6 byte Sta Adress |
| 5779 | * Join or leave flag: |
| 5780 | * Join = 1, |
| 5781 | * Leave =0 |
| 5782 | * @return Error code indicating success/failure |
| 5783 | * @note |
| 5784 | * @author zsalah |
| 5785 | * @date 8 March 2012 |
| 5786 | * @version 1.0 |
| 5787 | */ |
| 5788 | void host_int_send_join_leave_info_to_host |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5789 | (u16 assocId, u8 *stationAddr, bool joining) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5790 | { |
| 5791 | } |
| 5792 | /** |
| 5793 | * @brief notifies host with stations found in scan |
| 5794 | * @details sends the beacon/probe response from scan |
| 5795 | * @param[in,out] handle to the wifi driver, |
| 5796 | * @param[in] Sta Address, |
| 5797 | * Frame length, |
| 5798 | * Rssi of the Station found |
| 5799 | * @return Error code indicating success/failure |
| 5800 | * @note |
| 5801 | * @author zsalah |
| 5802 | * @date 8 March 2012 |
| 5803 | * @version 1.0 |
| 5804 | */ |
| 5805 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5806 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5807 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5808 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 5809 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5810 | if (pstrWFIDrv == NULL) { |
| 5811 | PRINT_ER("Driver handler is NULL\n"); |
| 5812 | return; |
| 5813 | } |
| 5814 | |
| 5815 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5816 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5817 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5818 | |
| 5819 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5820 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5821 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5822 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5823 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5824 | |
| 5825 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5826 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5827 | if (s32Error) { |
| 5828 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5829 | return; |
| 5830 | } |
| 5831 | } |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5832 | g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; |
| 5833 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5834 | } |
| 5835 | |
| 5836 | |
| 5837 | void host_int_send_network_info_to_host |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5838 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5839 | { |
| 5840 | } |
| 5841 | /** |
| 5842 | * @brief host_int_init |
| 5843 | * @details host interface initialization function |
| 5844 | * @param[in,out] handle to the wifi driver, |
| 5845 | * @note |
| 5846 | * @author zsalah |
| 5847 | * @date 8 March 2012 |
| 5848 | * @version 1.0 |
| 5849 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5850 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5851 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5852 | s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5853 | { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5854 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5855 | tstrWILC_WFIDrv *pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5856 | int err; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5857 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5858 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 5859 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5860 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5861 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5862 | sema_init(&hWaitResponse, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5863 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5864 | /*Allocate host interface private structure*/ |
Chaehyun Lim | 27a82eb | 2015-09-22 18:34:55 +0900 | [diff] [blame] | 5865 | pstrWFIDrv = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL); |
Chaehyun Lim | 1604296 | 2015-09-22 18:34:56 +0900 | [diff] [blame] | 5866 | if (!pstrWFIDrv) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5867 | result = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5868 | goto _fail_timer_2; |
| 5869 | } |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5870 | *phWFIDrv = pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5871 | err = add_handler_in_list(pstrWFIDrv); |
| 5872 | if (err) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5873 | result = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5874 | goto _fail_timer_2; |
| 5875 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5876 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5877 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5878 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 5879 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5880 | if (clients_count == 0) { |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5881 | sema_init(&hSemHostIFthrdEnd, 0); |
| 5882 | sema_init(&hSemDeinitDrvHandle, 0); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5883 | sema_init(&hSemHostIntDeinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5884 | } |
| 5885 | |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 5886 | sema_init(&pstrWFIDrv->hSemTestKeyBlock, 0); |
| 5887 | sema_init(&pstrWFIDrv->hSemTestDisconnectBlock, 0); |
| 5888 | sema_init(&pstrWFIDrv->hSemGetRSSI, 0); |
| 5889 | sema_init(&pstrWFIDrv->hSemGetLINKSPEED, 0); |
| 5890 | sema_init(&pstrWFIDrv->hSemGetCHNL, 0); |
| 5891 | sema_init(&pstrWFIDrv->hSemInactiveTime, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5892 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5893 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 5894 | |
| 5895 | if (clients_count == 0) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5896 | result = wilc_mq_create(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5897 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5898 | if (result < 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5899 | PRINT_ER("Failed to creat MQ\n"); |
| 5900 | goto _fail_; |
| 5901 | } |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 5902 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
| 5903 | if (IS_ERR(HostIFthreadHandler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5904 | PRINT_ER("Failed to creat Thread\n"); |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5905 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5906 | goto _fail_mq_; |
| 5907 | } |
Greg Kroah-Hartman | 507d7fc | 2015-08-17 12:59:42 -0700 | [diff] [blame] | 5908 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
| 5909 | (unsigned long)pstrWFIDrv); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5910 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5911 | } |
| 5912 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5913 | setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5914 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5915 | setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5916 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5917 | /*Remain on channel timer*/ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5918 | setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5919 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5920 | sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 5921 | down(&pstrWFIDrv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5922 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5923 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5924 | |
| 5925 | /*Initialize CFG WIDS Defualt Values*/ |
| 5926 | |
| 5927 | pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 5928 | pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 5929 | pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 5930 | pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 5931 | pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE; |
| 5932 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5933 | pstrWFIDrv->u64P2p_MgmtTimeout = 0; |
| 5934 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5935 | 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", |
| 5936 | |
| 5937 | pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source, |
| 5938 | pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time, |
| 5939 | pstrWFIDrv->strCfgValues.curr_tx_rate); |
| 5940 | |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 5941 | up(&pstrWFIDrv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5942 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5943 | clients_count++; /* increase number of created entities */ |
| 5944 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5945 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5946 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5947 | _fail_timer_2: |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 5948 | up(&pstrWFIDrv->gtOsCfgValuesSem); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 5949 | del_timer_sync(&pstrWFIDrv->hConnectTimer); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 5950 | del_timer_sync(&pstrWFIDrv->hScanTimer); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 5951 | kthread_stop(HostIFthreadHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5952 | _fail_mq_: |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 5953 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5954 | _fail_: |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5955 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5956 | } |
| 5957 | /** |
| 5958 | * @brief host_int_deinit |
| 5959 | * @details host interface initialization function |
| 5960 | * @param[in,out] handle to the wifi driver, |
| 5961 | * @note |
| 5962 | * @author zsalah |
| 5963 | * @date 8 March 2012 |
| 5964 | * @version 1.0 |
| 5965 | */ |
| 5966 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5967 | s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5968 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5969 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5970 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5971 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5972 | |
| 5973 | /*obtain driver handle*/ |
| 5974 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5975 | |
| 5976 | if (pstrWFIDrv == NULL) { |
| 5977 | PRINT_ER("pstrWFIDrv = NULL\n"); |
| 5978 | return 0; |
| 5979 | } |
| 5980 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5981 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5982 | |
| 5983 | terminated_handle = pstrWFIDrv; |
| 5984 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 5985 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5986 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ |
| 5987 | /*to guarantee handling all messages befor proceeding*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 5988 | if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5989 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5990 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
| 5991 | } |
| 5992 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 5993 | if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5994 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5995 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 5996 | } |
| 5997 | |
| 5998 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 5999 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6000 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6001 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6002 | } |
| 6003 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6004 | /*Destroy Remain-onchannel Timer*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6005 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6006 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6007 | host_int_set_wfi_drv_handler(NULL); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6008 | down(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6009 | |
| 6010 | |
| 6011 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ |
| 6012 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6013 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6014 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 6015 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6016 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6017 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6018 | |
| 6019 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 6020 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6021 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6022 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6023 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6024 | |
| 6025 | if (clients_count == 1) { |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6026 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6027 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6028 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6029 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6030 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6031 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6032 | |
| 6033 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6034 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6035 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6036 | 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] | 6037 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6038 | down(&hSemHostIFthrdEnd); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6039 | |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6040 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6041 | } |
| 6042 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6043 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6044 | |
| 6045 | /*Setting the gloabl driver handler with NULL*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6046 | /* gWFiDrvHandle = NULL; */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6047 | ret = remove_handler_in_list(pstrWFIDrv); |
| 6048 | if (ret) |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6049 | s32Error = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6050 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6051 | if (pstrWFIDrv != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6052 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6053 | /* pstrWFIDrv=NULL; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6054 | |
| 6055 | } |
| 6056 | |
| 6057 | clients_count--; /* Decrease number of created entities */ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6058 | terminated_handle = NULL; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6059 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6060 | return s32Error; |
| 6061 | } |
| 6062 | |
| 6063 | |
| 6064 | /** |
| 6065 | * @brief NetworkInfoReceived |
| 6066 | * @details function to to be called when network info packet is received |
| 6067 | * @param[in] pu8Buffer the received packet |
| 6068 | * @param[in] u32Length length of the received packet |
| 6069 | * @return none |
| 6070 | * @note |
| 6071 | * @author |
| 6072 | * @date 1 Mar 2012 |
| 6073 | * @version 1.0 |
| 6074 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6075 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6076 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6077 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6078 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6079 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6080 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6081 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6082 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6083 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6084 | |
| 6085 | |
| 6086 | |
| 6087 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6088 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6089 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6090 | return; |
| 6091 | } |
| 6092 | |
| 6093 | /* prepare the Asynchronous Network Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6094 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6095 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6096 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6097 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6098 | |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 6099 | msg.body.net_info.u32Length = u32Length; |
| 6100 | msg.body.net_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6101 | memcpy(msg.body.net_info.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6102 | pu8Buffer, u32Length); |
| 6103 | |
| 6104 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6105 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6106 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6107 | 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] | 6108 | } |
| 6109 | |
| 6110 | /** |
| 6111 | * @brief GnrlAsyncInfoReceived |
| 6112 | * @details function to be called when general Asynchronous info packet is received |
| 6113 | * @param[in] pu8Buffer the received packet |
| 6114 | * @param[in] u32Length length of the received packet |
| 6115 | * @return none |
| 6116 | * @note |
| 6117 | * @author |
| 6118 | * @date 15 Mar 2012 |
| 6119 | * @version 1.0 |
| 6120 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6121 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6122 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6123 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6124 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6125 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6126 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6127 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6128 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6129 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6130 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6131 | pstrWFIDrv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6132 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6133 | |
| 6134 | |
| 6135 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
| 6136 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6137 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6138 | return; |
| 6139 | } |
| 6140 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6141 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6142 | /* received mac status is not needed when there is no current Connect Request */ |
| 6143 | 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] | 6144 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6145 | return; |
| 6146 | } |
| 6147 | |
| 6148 | /* prepare the General Asynchronous Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6149 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6150 | |
| 6151 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6152 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6153 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6154 | |
| 6155 | |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 6156 | msg.body.async_info.u32Length = u32Length; |
| 6157 | msg.body.async_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6158 | memcpy(msg.body.async_info.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6159 | pu8Buffer, u32Length); |
| 6160 | |
| 6161 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6162 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6163 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6164 | 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] | 6165 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6166 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6167 | } |
| 6168 | |
| 6169 | /** |
| 6170 | * @brief host_int_ScanCompleteReceived |
| 6171 | * @details Setting scan complete received notifcation in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6172 | * @param[in] u8* pu8Buffer, u32 u32Length |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6173 | * @return Error code. |
| 6174 | * @author |
| 6175 | * @date |
| 6176 | * @version 1.0 |
| 6177 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6178 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6179 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6180 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6181 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6182 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6183 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6184 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6185 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6186 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6187 | |
| 6188 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6189 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6190 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6191 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6192 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6193 | |
| 6194 | /*if there is an ongoing scan request*/ |
| 6195 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 6196 | /* prepare theScan Done message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6197 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6198 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6199 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6200 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6201 | |
| 6202 | |
| 6203 | /* will be deallocated by the receiving thread */ |
| 6204 | /*no need to send message body*/ |
| 6205 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6206 | /*msg.body.strScanComplete.u32Length = u32Length; |
| 6207 | * msg.body.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
| 6208 | * memcpy(msg.body.strScanComplete.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6209 | * pu8Buffer, u32Length); */ |
| 6210 | |
| 6211 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6212 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6213 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6214 | 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] | 6215 | } |
| 6216 | |
| 6217 | |
| 6218 | return; |
| 6219 | |
| 6220 | } |
| 6221 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6222 | /** |
| 6223 | * @brief host_int_remain_on_channel |
| 6224 | * @details |
| 6225 | * @param[in] Handle to wifi driver |
| 6226 | * Duration to remain on channel |
| 6227 | * Channel to remain on |
| 6228 | * Pointer to fn to be called on receive frames in listen state |
| 6229 | * Pointer to remain-on-channel expired fn |
| 6230 | * Priv |
| 6231 | * @return Error code. |
| 6232 | * @author |
| 6233 | * @date |
| 6234 | * @version 1.0 |
| 6235 | */ |
Leo Kim | fc1848a | 2015-10-05 15:25:50 +0900 | [diff] [blame] | 6236 | s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, wilc_remain_on_chan_ready RemainOnChanReady, void *pvUserArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6237 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6238 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6239 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6240 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6241 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6242 | if (pstrWFIDrv == NULL) { |
| 6243 | PRINT_ER("driver is null\n"); |
| 6244 | return -EFAULT; |
| 6245 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6246 | |
| 6247 | /* prepare the remainonchan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6248 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6249 | |
| 6250 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6251 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 6252 | msg.body.remain_on_ch.u16Channel = chan; |
| 6253 | msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired; |
| 6254 | msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; |
| 6255 | msg.body.remain_on_ch.pVoid = pvUserArg; |
| 6256 | msg.body.remain_on_ch.u32duration = u32duration; |
| 6257 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6258 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6259 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6260 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6261 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6262 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6263 | |
| 6264 | return s32Error; |
| 6265 | } |
| 6266 | |
| 6267 | /** |
| 6268 | * @brief host_int_ListenStateExpired |
| 6269 | * @details |
| 6270 | * @param[in] Handle to wifi driver |
| 6271 | * Duration to remain on channel |
| 6272 | * Channel to remain on |
| 6273 | * Pointer to fn to be called on receive frames in listen state |
| 6274 | * Pointer to remain-on-channel expired fn |
| 6275 | * Priv |
| 6276 | * @return Error code. |
| 6277 | * @author |
| 6278 | * @date |
| 6279 | * @version 1.0 |
| 6280 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6281 | s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6282 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6283 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6284 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6285 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6286 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6287 | if (pstrWFIDrv == NULL) { |
| 6288 | PRINT_ER("driver is null\n"); |
| 6289 | return -EFAULT; |
| 6290 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6291 | |
| 6292 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 6293 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6294 | |
| 6295 | /* prepare the timer fire Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6296 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6297 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6298 | msg.drvHandler = hWFIDrv; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 6299 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6300 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6301 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6302 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6303 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6304 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6305 | return s32Error; |
| 6306 | } |
| 6307 | |
| 6308 | /** |
| 6309 | * @brief host_int_frame_register |
| 6310 | * @details |
| 6311 | * @param[in] Handle to wifi driver |
| 6312 | * @return Error code. |
| 6313 | * @author |
| 6314 | * @date |
| 6315 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6316 | s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6317 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6318 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6319 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6320 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6321 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6322 | if (pstrWFIDrv == NULL) { |
| 6323 | PRINT_ER("driver is null\n"); |
| 6324 | return -EFAULT; |
| 6325 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6326 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6327 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6328 | |
| 6329 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6330 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6331 | switch (u16FrameType) { |
| 6332 | case ACTION: |
| 6333 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6334 | msg.body.reg_frame.u8Regid = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6335 | break; |
| 6336 | |
| 6337 | case PROBE_REQ: |
| 6338 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6339 | msg.body.reg_frame.u8Regid = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6340 | break; |
| 6341 | |
| 6342 | default: |
| 6343 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 6344 | break; |
| 6345 | } |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6346 | msg.body.reg_frame.u16FrameType = u16FrameType; |
| 6347 | msg.body.reg_frame.bReg = bReg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6348 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6349 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6350 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6351 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6352 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6353 | |
| 6354 | return s32Error; |
| 6355 | |
| 6356 | |
| 6357 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6358 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6359 | /** |
| 6360 | * @brief host_int_add_beacon |
| 6361 | * @details Setting add beacon params in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6362 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
| 6363 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, |
| 6364 | * u32 u32TailLen, u8* pu8Tail |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6365 | * @return Error code. |
| 6366 | * @author |
| 6367 | * @date |
| 6368 | * @version 1.0 |
| 6369 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6370 | s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6371 | u32 u32DTIMPeriod, |
| 6372 | u32 u32HeadLen, u8 *pu8Head, |
| 6373 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6374 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6375 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6376 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6377 | struct host_if_msg msg; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 6378 | struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6379 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6380 | if (pstrWFIDrv == NULL) { |
| 6381 | PRINT_ER("driver is null\n"); |
| 6382 | return -EFAULT; |
| 6383 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6384 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6385 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6386 | |
| 6387 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 6388 | |
| 6389 | |
| 6390 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6391 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6392 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6393 | pstrSetBeaconParam->u32Interval = u32Interval; |
| 6394 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; |
| 6395 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6396 | pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6397 | if (pstrSetBeaconParam->pu8Head == NULL) { |
| 6398 | s32Error = -ENOMEM; |
| 6399 | goto ERRORHANDLER; |
| 6400 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6401 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6402 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
| 6403 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6404 | if (u32TailLen > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6405 | pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6406 | if (pstrSetBeaconParam->pu8Tail == NULL) { |
| 6407 | s32Error = -ENOMEM; |
| 6408 | goto ERRORHANDLER; |
| 6409 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6410 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6411 | } else { |
| 6412 | pstrSetBeaconParam->pu8Tail = NULL; |
| 6413 | } |
| 6414 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6415 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6416 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6417 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6418 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6419 | ERRORHANDLER: |
| 6420 | if (s32Error) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6421 | if (pstrSetBeaconParam->pu8Head != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6422 | kfree(pstrSetBeaconParam->pu8Head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6423 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6424 | if (pstrSetBeaconParam->pu8Tail != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6425 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6426 | } |
| 6427 | |
| 6428 | return s32Error; |
| 6429 | |
| 6430 | } |
| 6431 | |
| 6432 | |
| 6433 | /** |
| 6434 | * @brief host_int_del_beacon |
| 6435 | * @details Setting add beacon params in message queue |
| 6436 | * @param[in] WILC_WFIDrvHandle hWFIDrv |
| 6437 | * @return Error code. |
| 6438 | * @author |
| 6439 | * @date |
| 6440 | * @version 1.0 |
| 6441 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6442 | s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6443 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6444 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6445 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6446 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6447 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6448 | if (pstrWFIDrv == NULL) { |
| 6449 | PRINT_ER("driver is null\n"); |
| 6450 | return -EFAULT; |
| 6451 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6452 | |
| 6453 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6454 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6455 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6456 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 6457 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6458 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 6459 | if (s32Error) |
| 6460 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6461 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6462 | return s32Error; |
| 6463 | } |
| 6464 | |
| 6465 | |
| 6466 | /** |
| 6467 | * @brief host_int_add_station |
| 6468 | * @details Setting add station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6469 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6470 | * @return Error code. |
| 6471 | * @author |
| 6472 | * @date |
| 6473 | * @version 1.0 |
| 6474 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6475 | s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, |
| 6476 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6477 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6478 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6479 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6480 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 6481 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6482 | |
| 6483 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6484 | if (pstrWFIDrv == NULL) { |
| 6485 | PRINT_ER("driver is null\n"); |
| 6486 | return -EFAULT; |
| 6487 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6488 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6489 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6490 | |
| 6491 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 6492 | |
| 6493 | |
| 6494 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6495 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6496 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6497 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6498 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6499 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6500 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6501 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 6502 | if (!rates) |
| 6503 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6504 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6505 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 6506 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6507 | } |
| 6508 | |
| 6509 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6510 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6511 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6512 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6513 | return s32Error; |
| 6514 | } |
| 6515 | |
| 6516 | /** |
| 6517 | * @brief host_int_del_station |
| 6518 | * @details Setting delete station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6519 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6520 | * @return Error code. |
| 6521 | * @author |
| 6522 | * @date |
| 6523 | * @version 1.0 |
| 6524 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6525 | s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6526 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6527 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6528 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6529 | struct host_if_msg msg; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 6530 | struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6531 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6532 | if (pstrWFIDrv == NULL) { |
| 6533 | PRINT_ER("driver is null\n"); |
| 6534 | return -EFAULT; |
| 6535 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6536 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6537 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6538 | |
| 6539 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 6540 | |
| 6541 | |
| 6542 | |
| 6543 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6544 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6545 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6546 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6547 | if (pu8MacAddr == NULL) |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6548 | memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6549 | else |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6550 | memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6551 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6552 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6553 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6554 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6555 | return s32Error; |
| 6556 | } |
| 6557 | /** |
| 6558 | * @brief host_int_del_allstation |
| 6559 | * @details Setting del station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6560 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6561 | * @return Error code. |
| 6562 | * @author |
| 6563 | * @date |
| 6564 | * @version 1.0 |
| 6565 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6566 | s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6567 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6568 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6569 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6570 | struct host_if_msg msg; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 6571 | struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6572 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6573 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6574 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6575 | |
| 6576 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6577 | if (pstrWFIDrv == NULL) { |
| 6578 | PRINT_ER("driver is null\n"); |
| 6579 | return -EFAULT; |
| 6580 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6581 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6582 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6583 | |
| 6584 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 6585 | |
| 6586 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6587 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6588 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6589 | |
| 6590 | /* Handling situation of deauthenticing all associated stations*/ |
| 6591 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 6592 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6593 | memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6594 | 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], |
| 6595 | pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); |
| 6596 | u8AssocNumb++; |
| 6597 | } |
| 6598 | } |
| 6599 | if (!u8AssocNumb) { |
| 6600 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
| 6601 | return s32Error; |
| 6602 | } |
| 6603 | |
| 6604 | pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6605 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6606 | |
| 6607 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6608 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6609 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6610 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6611 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6612 | |
| 6613 | return s32Error; |
| 6614 | |
| 6615 | } |
| 6616 | |
| 6617 | /** |
| 6618 | * @brief host_int_edit_station |
| 6619 | * @details Setting edit station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6620 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6621 | * @return Error code. |
| 6622 | * @author |
| 6623 | * @date |
| 6624 | * @version 1.0 |
| 6625 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6626 | s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, |
| 6627 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6628 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6629 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6630 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6631 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 6632 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6633 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6634 | if (pstrWFIDrv == NULL) { |
| 6635 | PRINT_ER("driver is null\n"); |
| 6636 | return -EFAULT; |
| 6637 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6638 | |
| 6639 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 6640 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6641 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6642 | |
| 6643 | |
| 6644 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6645 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6646 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6647 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6648 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6649 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6650 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6651 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 6652 | if (!rates) |
| 6653 | return -ENOMEM; |
| 6654 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6655 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 6656 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6657 | } |
| 6658 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6659 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6660 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6661 | PRINT_ER("wilc_mq_send fail\n"); |
| 6662 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6663 | return s32Error; |
| 6664 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 6665 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6666 | 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] | 6667 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6668 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6669 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6670 | struct host_if_msg msg; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 6671 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6672 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6673 | 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] | 6674 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6675 | if (pstrWFIDrv == NULL) { |
| 6676 | PRINT_ER("driver is null\n"); |
| 6677 | return -EFAULT; |
| 6678 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6679 | |
| 6680 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 6681 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6682 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6683 | |
| 6684 | |
| 6685 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6686 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6687 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6688 | |
| 6689 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; |
| 6690 | pstrPowerMgmtParam->u32Timeout = u32Timeout; |
| 6691 | |
| 6692 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6693 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6694 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6695 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6696 | return s32Error; |
| 6697 | } |
| 6698 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6699 | 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] | 6700 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6701 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6702 | |
| 6703 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6704 | struct host_if_msg msg; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 6705 | struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6706 | |
| 6707 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6708 | if (pstrWFIDrv == NULL) { |
| 6709 | PRINT_ER("driver is null\n"); |
| 6710 | return -EFAULT; |
| 6711 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6712 | |
| 6713 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 6714 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6715 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6716 | |
| 6717 | |
| 6718 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6719 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6720 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6721 | |
| 6722 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; |
| 6723 | pstrMulticastFilterParam->u32count = u32count; |
| 6724 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6725 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6726 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6727 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6728 | return s32Error; |
| 6729 | } |
| 6730 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6731 | /** |
| 6732 | * @brief host_int_ParseJoinBssParam |
| 6733 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry |
| 6734 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 6735 | * @return |
| 6736 | * @author zsalah |
| 6737 | * @date |
| 6738 | * @version 1.0**/ |
| 6739 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 6740 | { |
| 6741 | tstrJoinBssParam *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6742 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6743 | u16 u16IEsLen; |
| 6744 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6745 | u8 suppRatesNo = 0; |
| 6746 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6747 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6748 | u8 pcipherCount; |
| 6749 | u8 authCount; |
| 6750 | u8 pcipherTotalCount = 0; |
| 6751 | u8 authTotalCount = 0; |
| 6752 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6753 | |
| 6754 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 6755 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 6756 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6757 | pNewJoinBssParam = kmalloc(sizeof(tstrJoinBssParam), GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6758 | if (pNewJoinBssParam != NULL) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6759 | memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6760 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 6761 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 6762 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6763 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6764 | /*for(i=0; i<6;i++) |
| 6765 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6766 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6767 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6768 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 6769 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6770 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
| 6771 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ |
| 6772 | |
| 6773 | /* parse supported rates: */ |
| 6774 | while (index < u16IEsLen) { |
| 6775 | /* supportedRates IE */ |
| 6776 | if (pu8IEs[index] == SUPP_RATES_IE) { |
| 6777 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ |
| 6778 | suppRatesNo = pu8IEs[index + 1]; |
| 6779 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
| 6780 | index += 2; /* skipping ID and length bytes; */ |
| 6781 | |
| 6782 | for (i = 0; i < suppRatesNo; i++) { |
| 6783 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
| 6784 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ |
| 6785 | } |
| 6786 | index += suppRatesNo; |
| 6787 | continue; |
| 6788 | } |
| 6789 | /* Ext SupportedRates IE */ |
| 6790 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
| 6791 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ |
| 6792 | /* checking if no of ext. supp and supp rates < max limit */ |
| 6793 | extSuppRatesNo = pu8IEs[index + 1]; |
| 6794 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 6795 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 6796 | else |
| 6797 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 6798 | index += 2; |
| 6799 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ |
| 6800 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { |
| 6801 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
| 6802 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ |
| 6803 | } |
| 6804 | index += extSuppRatesNo; |
| 6805 | continue; |
| 6806 | } |
| 6807 | /* HT Cap. IE */ |
| 6808 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
| 6809 | /* if IE found set the flag */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6810 | pNewJoinBssParam->ht_capable = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6811 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 6812 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ |
| 6813 | continue; |
| 6814 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ |
| 6815 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
| 6816 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ |
| 6817 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ |
| 6818 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ |
| 6819 | (pu8IEs[index + 7] == 0x01)) { |
| 6820 | /* Presence of WMM Info/Param element indicates WMM capability */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6821 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6822 | |
| 6823 | /* Check if Bit 7 is set indicating U-APSD capability */ |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 6824 | if (pu8IEs[index + 8] & BIT(7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6825 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6826 | index += pu8IEs[index + 1] + 2; |
| 6827 | continue; |
| 6828 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6829 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ |
| 6830 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
| 6831 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ |
| 6832 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6833 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6834 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6835 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
| 6836 | pNewJoinBssParam->u8NoaEnbaled = 1; |
| 6837 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; |
| 6838 | |
| 6839 | /* Check if Bit 7 is set indicating Opss capability */ |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 6840 | if (pu8IEs[index + 10] & BIT(7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6841 | pNewJoinBssParam->u8OppEnable = 1; |
| 6842 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; |
| 6843 | } else |
| 6844 | pNewJoinBssParam->u8OppEnable = 0; |
| 6845 | /* HOSTINF_DBG */ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6846 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6847 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6848 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6849 | |
| 6850 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; |
| 6851 | u16P2P_count = index + 12; |
| 6852 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6853 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6854 | u16P2P_count += 4; |
| 6855 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6856 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6857 | u16P2P_count += 4; |
| 6858 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6859 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6860 | |
| 6861 | index += pu8IEs[index + 1] + 2; |
| 6862 | continue; |
| 6863 | |
| 6864 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6865 | else if ((pu8IEs[index] == RSN_IE) || |
| 6866 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 6867 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 6868 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6869 | u16 rsnIndex = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6870 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
| 6871 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) |
| 6872 | * { |
| 6873 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); |
| 6874 | * }*/ |
| 6875 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 6876 | pNewJoinBssParam->mode_802_11i = 2; |
| 6877 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ |
| 6878 | } else { /* check if rsn was previously parsed */ |
| 6879 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 6880 | pNewJoinBssParam->mode_802_11i = 1; |
| 6881 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ |
| 6882 | rsnIndex += 4; |
| 6883 | } |
| 6884 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ |
| 6885 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 6886 | rsnIndex++; |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6887 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6888 | /* initialize policies with invalid values */ |
| 6889 | |
| 6890 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ |
| 6891 | |
| 6892 | /*parsing pairwise cipher*/ |
| 6893 | |
| 6894 | /* saving 3 pcipher max. */ |
| 6895 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 6896 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 6897 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6898 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6899 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
| 6900 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 6901 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 6902 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ |
| 6903 | } |
| 6904 | pcipherTotalCount += pcipherCount; |
| 6905 | rsnIndex += jumpOffset; |
| 6906 | |
| 6907 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 6908 | |
| 6909 | /*parsing AKM suite (auth_policy)*/ |
| 6910 | /* saving 3 auth policies max. */ |
| 6911 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 6912 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 6913 | |
| 6914 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { |
| 6915 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 6916 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 6917 | } |
| 6918 | authTotalCount += authCount; |
| 6919 | rsnIndex += jumpOffset; |
| 6920 | /*pasring rsn cap. only if rsn IE*/ |
| 6921 | if (pu8IEs[index] == RSN_IE) { |
| 6922 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 6923 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 6924 | rsnIndex += 2; |
| 6925 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 6926 | pNewJoinBssParam->rsn_found = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6927 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 6928 | continue; |
| 6929 | } else |
| 6930 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 6931 | |
| 6932 | } |
| 6933 | |
| 6934 | |
| 6935 | } |
| 6936 | |
| 6937 | return (void *)pNewJoinBssParam; |
| 6938 | |
| 6939 | } |
| 6940 | |
| 6941 | void host_int_freeJoinParams(void *pJoinParams) |
| 6942 | { |
| 6943 | if ((tstrJoinBssParam *)pJoinParams != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6944 | kfree((tstrJoinBssParam *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6945 | else |
| 6946 | PRINT_ER("Unable to FREE null pointer\n"); |
| 6947 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6948 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6949 | s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6950 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6951 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6952 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6953 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 6954 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6955 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6956 | if (pstrWFIDrv == NULL) { |
| 6957 | PRINT_ER("driver is null\n"); |
| 6958 | return -EFAULT; |
| 6959 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6960 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6961 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6962 | |
| 6963 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6964 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6965 | |
| 6966 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 6967 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6968 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6969 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6970 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6971 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6972 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6973 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6974 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6975 | |
| 6976 | return s32Error; |
| 6977 | } |
| 6978 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6979 | 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] | 6980 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6981 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6982 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6983 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 6984 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6985 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6986 | if (pstrWFIDrv == NULL) { |
| 6987 | PRINT_ER("driver is null\n"); |
| 6988 | return -EFAULT; |
| 6989 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6990 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6991 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6992 | |
| 6993 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6994 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6995 | |
| 6996 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 6997 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6998 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6999 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7000 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7001 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7002 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7003 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7004 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7005 | |
| 7006 | return s32Error; |
| 7007 | } |
| 7008 | |
| 7009 | /** |
| 7010 | * @brief host_int_setup_ipaddress |
| 7011 | * @details setup IP in firmware |
| 7012 | * @param[in] Handle to wifi driver |
| 7013 | * @return Error code. |
| 7014 | * @author Abdelrahman Sobhy |
| 7015 | * @date |
| 7016 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7017 | s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7018 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7019 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7020 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7021 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7022 | |
| 7023 | /* TODO: Enable This feature on softap firmware */ |
| 7024 | return 0; |
| 7025 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7026 | if (pstrWFIDrv == NULL) { |
| 7027 | PRINT_ER("driver is null\n"); |
| 7028 | return -EFAULT; |
| 7029 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7030 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7031 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7032 | |
| 7033 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7034 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7035 | |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7036 | msg.body.ip_info.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7037 | msg.drvHandler = hWFIDrv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7038 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7039 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7040 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7041 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7042 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7043 | |
| 7044 | return s32Error; |
| 7045 | |
| 7046 | |
| 7047 | } |
| 7048 | |
| 7049 | /** |
| 7050 | * @brief host_int_get_ipaddress |
| 7051 | * @details Get IP from firmware |
| 7052 | * @param[in] Handle to wifi driver |
| 7053 | * @return Error code. |
| 7054 | * @author Abdelrahman Sobhy |
| 7055 | * @date |
| 7056 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7057 | s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7058 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7059 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7060 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7061 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7062 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7063 | if (pstrWFIDrv == NULL) { |
| 7064 | PRINT_ER("driver is null\n"); |
| 7065 | return -EFAULT; |
| 7066 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7067 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7068 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7069 | |
| 7070 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7071 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7072 | |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7073 | msg.body.ip_info.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7074 | msg.drvHandler = hWFIDrv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7075 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7076 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7077 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7078 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7079 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7080 | |
| 7081 | return s32Error; |
| 7082 | |
| 7083 | |
| 7084 | } |