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" |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 9 | #include <linux/etherdevice.h> |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 10 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 11 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 12 | |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 13 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 14 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 15 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 16 | |
| 17 | /* Message types of the Host IF Message Queue*/ |
Chaehyun Lim | 9eac3a1 | 2015-06-18 22:08:51 +0900 | [diff] [blame] | 18 | #define HOST_IF_MSG_SCAN 0 |
| 19 | #define HOST_IF_MSG_CONNECT 1 |
| 20 | #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 |
| 21 | #define HOST_IF_MSG_KEY 3 |
| 22 | #define HOST_IF_MSG_RCVD_NTWRK_INFO 4 |
| 23 | #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5 |
| 24 | #define HOST_IF_MSG_CFG_PARAMS 6 |
| 25 | #define HOST_IF_MSG_SET_CHANNEL 7 |
| 26 | #define HOST_IF_MSG_DISCONNECT 8 |
| 27 | #define HOST_IF_MSG_GET_RSSI 9 |
| 28 | #define HOST_IF_MSG_GET_CHNL 10 |
| 29 | #define HOST_IF_MSG_ADD_BEACON 11 |
| 30 | #define HOST_IF_MSG_DEL_BEACON 12 |
| 31 | #define HOST_IF_MSG_ADD_STATION 13 |
| 32 | #define HOST_IF_MSG_DEL_STATION 14 |
| 33 | #define HOST_IF_MSG_EDIT_STATION 15 |
| 34 | #define HOST_IF_MSG_SCAN_TIMER_FIRED 16 |
| 35 | #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17 |
| 36 | #define HOST_IF_MSG_POWER_MGMT 18 |
| 37 | #define HOST_IF_MSG_GET_INACTIVETIME 19 |
| 38 | #define HOST_IF_MSG_REMAIN_ON_CHAN 20 |
| 39 | #define HOST_IF_MSG_REGISTER_FRAME 21 |
| 40 | #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22 |
| 41 | #define HOST_IF_MSG_GET_LINKSPEED 23 |
| 42 | #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24 |
| 43 | #define HOST_IF_MSG_SET_MAC_ADDRESS 25 |
| 44 | #define HOST_IF_MSG_GET_MAC_ADDRESS 26 |
| 45 | #define HOST_IF_MSG_SET_OPERATION_MODE 27 |
| 46 | #define HOST_IF_MSG_SET_IPADDRESS 28 |
| 47 | #define HOST_IF_MSG_GET_IPADDRESS 29 |
| 48 | #define HOST_IF_MSG_FLUSH_CONNECT 30 |
| 49 | #define HOST_IF_MSG_GET_STATISTICS 31 |
| 50 | #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 |
| 51 | #define HOST_IF_MSG_ADD_BA_SESSION 33 |
| 52 | #define HOST_IF_MSG_DEL_BA_SESSION 34 |
| 53 | #define HOST_IF_MSG_Q_IDLE 35 |
| 54 | #define HOST_IF_MSG_DEL_ALL_STA 36 |
| 55 | #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34 |
| 56 | #define HOST_IF_MSG_EXIT 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 57 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 58 | #define HOST_IF_SCAN_TIMEOUT 4000 |
| 59 | #define HOST_IF_CONNECT_TIMEOUT 9500 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 60 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 61 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
| 62 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 |
| 63 | #define BLOCK_ACK_REQ_SIZE 0x14 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 64 | |
| 65 | /*! |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 66 | * @struct cfg_param_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 67 | * @brief Structure to hold Host IF CFG Params Attributes |
| 68 | * @details |
| 69 | * @todo |
| 70 | * @sa |
| 71 | * @author Mai Daftedar |
| 72 | * @date 02 April 2012 |
| 73 | * @version 1.0 |
| 74 | */ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 75 | struct cfg_param_attr { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 76 | struct cfg_param_val cfg_attr_info; |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 77 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 78 | |
| 79 | /*! |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 80 | * @struct host_if_wpa_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 81 | * @brief Structure to hold Host IF Scan Attributes |
| 82 | * @details |
| 83 | * @todo |
| 84 | * @sa |
| 85 | * @author Mai Daftedar |
| 86 | * @date 25 March 2012 |
| 87 | * @version 1.0 |
| 88 | */ |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 89 | struct host_if_wpa_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 90 | u8 *pu8key; |
| 91 | const u8 *pu8macaddr; |
| 92 | u8 *pu8seq; |
| 93 | u8 u8seqlen; |
| 94 | u8 u8keyidx; |
| 95 | u8 u8Keylen; |
| 96 | u8 u8Ciphermode; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 97 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 98 | |
| 99 | |
| 100 | /*! |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 101 | * @struct host_if_wep_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 102 | * @brief Structure to hold Host IF Scan Attributes |
| 103 | * @details |
| 104 | * @todo |
| 105 | * @sa |
| 106 | * @author Mai Daftedar |
| 107 | * @date 25 March 2012 |
| 108 | * @version 1.0 |
| 109 | */ |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 110 | struct host_if_wep_attr { |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 111 | u8 *key; |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 112 | u8 key_len; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 113 | u8 u8Wepidx; |
| 114 | u8 u8mode; |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 115 | enum AUTHTYPE tenuAuth_type; |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 116 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 117 | |
| 118 | /*! |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 119 | * @struct host_if_key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 120 | * @brief Structure to hold Host IF Scan Attributes |
| 121 | * @details |
| 122 | * @todo |
| 123 | * @sa |
| 124 | * @author Mai Daftedar |
| 125 | * @date 25 March 2012 |
| 126 | * @version 1.0 |
| 127 | */ |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 128 | union host_if_key_attr { |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 129 | struct host_if_wep_attr wep; |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 130 | struct host_if_wpa_attr wpa; |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 131 | struct host_if_pmkid_attr pmkid; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 132 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 133 | |
| 134 | /*! |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 135 | * @struct key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 136 | * @brief Structure to hold Host IF Scan Attributes |
| 137 | * @details |
| 138 | * @todo |
| 139 | * @sa |
| 140 | * @author Mai Daftedar |
| 141 | * @date 25 March 2012 |
| 142 | * @version 1.0 |
| 143 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 144 | struct key_attr { |
Leo Kim | b9d9633 | 2015-10-05 15:25:40 +0900 | [diff] [blame] | 145 | enum KEY_TYPE enuKeyType; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 146 | u8 u8KeyAction; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 147 | union host_if_key_attr uniHostIFkeyAttr; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 148 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | /*! |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 154 | * @struct scan_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 155 | * @brief Structure to hold Host IF Scan Attributes |
| 156 | * @details |
| 157 | * @todo |
| 158 | * @sa |
| 159 | * @author Mostafa Abu Bakr |
| 160 | * @date 25 March 2012 |
| 161 | * @version 1.0 |
| 162 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 163 | struct scan_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 164 | u8 u8ScanSource; |
| 165 | u8 u8ScanType; |
| 166 | u8 *pu8ChnlFreqList; |
| 167 | u8 u8ChnlListLen; |
| 168 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 169 | size_t IEsLen; |
Leo Kim | ba1d1a6 | 2015-10-05 15:25:36 +0900 | [diff] [blame] | 170 | wilc_scan_result pfScanResult; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 171 | void *pvUserArg; |
Leo Kim | 607db44 | 2015-10-05 15:25:37 +0900 | [diff] [blame] | 172 | struct hidden_network strHiddenNetwork; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 173 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 174 | |
| 175 | /*! |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 176 | * @struct connect_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 177 | * @brief Structure to hold Host IF Connect Attributes |
| 178 | * @details |
| 179 | * @todo |
| 180 | * @sa |
| 181 | * @author Mostafa Abu Bakr |
| 182 | * @date 25 March 2012 |
| 183 | * @version 1.0 |
| 184 | */ |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 185 | struct connect_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 186 | u8 *pu8bssid; |
| 187 | u8 *pu8ssid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 188 | size_t ssidLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 189 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 190 | size_t IEsLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 191 | u8 u8security; |
Leo Kim | b6ab85f | 2015-10-05 15:25:38 +0900 | [diff] [blame] | 192 | wilc_connect_result pfConnectResult; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 193 | void *pvUserArg; |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 194 | enum AUTHTYPE tenuAuth_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 195 | u8 u8channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 196 | void *pJoinParams; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 197 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 198 | |
| 199 | /*! |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 200 | * @struct rcvd_async_info |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 201 | * @brief Structure to hold Received General Asynchronous info |
| 202 | * @details |
| 203 | * @todo |
| 204 | * @sa |
| 205 | * @author Mostafa Abu Bakr |
| 206 | * @date 25 March 2012 |
| 207 | * @version 1.0 |
| 208 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 209 | struct rcvd_async_info { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 210 | u8 *pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 211 | u32 u32Length; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 212 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 213 | |
| 214 | /*! |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 215 | * @struct channel_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 216 | * @brief Set Channel message body |
| 217 | * @details |
| 218 | * @todo |
| 219 | * @sa |
| 220 | * @author Mai Daftedar |
| 221 | * @date 25 March 2012 |
| 222 | * @version 1.0 |
| 223 | */ |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 224 | struct channel_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 225 | u8 u8SetChan; |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 226 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 227 | |
| 228 | /*! |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 229 | * @struct tstrScanComplete |
| 230 | * @brief hold received Async. Scan Complete message body |
| 231 | * @details |
| 232 | * @todo |
| 233 | * @sa |
| 234 | * @author zsalah |
| 235 | * @date 25 March 2012 |
| 236 | * @version 1.0 |
| 237 | */ |
| 238 | /*typedef struct _tstrScanComplete |
| 239 | * { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 240 | * u8* pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 241 | * u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 242 | * } tstrScanComplete;*/ |
| 243 | |
| 244 | /*! |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 245 | * @struct beacon_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 246 | * @brief Set Beacon message body |
| 247 | * @details |
| 248 | * @todo |
| 249 | * @sa |
| 250 | * @author Adham Abozaeid |
| 251 | * @date 10 July 2012 |
| 252 | * @version 1.0 |
| 253 | */ |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 254 | struct beacon_attr { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 255 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
| 256 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 257 | * (including the current frame) appear before the next DTIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 258 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 259 | 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] | 260 | * 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] | 261 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 262 | 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] | 263 | * after the TIM inormation element */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 264 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 265 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 266 | /*! |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 267 | * @struct set_multicast |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 268 | * @brief set Multicast filter Address |
| 269 | * @details |
| 270 | * @todo |
| 271 | * @sa |
| 272 | * @author Abdelrahman Sobhy |
| 273 | * @date 30 August 2013 |
| 274 | * @version 1.0 Description |
| 275 | */ |
| 276 | |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 277 | struct set_multicast { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 278 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 279 | u32 u32count; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 280 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 281 | |
| 282 | /*! |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 283 | * @struct del_all_sta |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 284 | * @brief Deauth station message body |
| 285 | * @details |
| 286 | * @todo |
| 287 | * @sa |
| 288 | * @author Mai Daftedar |
| 289 | * @date 09 April 2014 |
| 290 | * @version 1.0 Description |
| 291 | */ |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 292 | struct del_all_sta { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 293 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
| 294 | u8 u8Num_AssocSta; |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 295 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 296 | |
| 297 | /*! |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 298 | * @struct del_sta |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 299 | * @brief Delete station message body |
| 300 | * @details |
| 301 | * @todo |
| 302 | * @sa |
| 303 | * @author Adham Abozaeid |
| 304 | * @date 15 July 2012 |
| 305 | * @version 1.0 Description |
| 306 | */ |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 307 | struct del_sta { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 308 | u8 au8MacAddr[ETH_ALEN]; |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 309 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 310 | |
| 311 | /*! |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 312 | * @struct power_mgmt_param |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 313 | * @brief Power management message body |
| 314 | * @details |
| 315 | * @todo |
| 316 | * @sa |
| 317 | * @author Adham Abozaeid |
| 318 | * @date 24 November 2012 |
| 319 | * @version 1.0 |
| 320 | */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 321 | struct power_mgmt_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 322 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 323 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 324 | u32 u32Timeout; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 325 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 326 | |
| 327 | /*! |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 328 | * @struct set_ip_addr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 329 | * @brief set IP Address message body |
| 330 | * @details |
| 331 | * @todo |
| 332 | * @sa |
| 333 | * @author Abdelrahman Sobhy |
| 334 | * @date 30 August 2013 |
| 335 | * @version 1.0 Description |
| 336 | */ |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 337 | struct set_ip_addr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 338 | u8 *au8IPAddr; |
| 339 | u8 idx; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 340 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 341 | |
| 342 | /*! |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 343 | * @struct sta_inactive_t |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 344 | * @brief Get station message body |
| 345 | * @details |
| 346 | * @todo |
| 347 | * @sa |
| 348 | * @author Mai Daftedar |
| 349 | * @date 16 April 2013 |
| 350 | * @version 1.0 |
| 351 | */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 352 | struct sta_inactive_t { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 353 | u8 mac[6]; |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 354 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 355 | /**/ |
| 356 | /*! |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 357 | * @union message_body |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 358 | * @brief Message body for the Host Interface message_q |
| 359 | * @details |
| 360 | * @todo |
| 361 | * @sa |
| 362 | * @author Mostafa Abu Bakr |
| 363 | * @date 25 March 2012 |
| 364 | * @version 1.0 |
| 365 | */ |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 366 | union message_body { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 367 | struct scan_attr scan_info; |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 368 | struct connect_attr con_info; |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 369 | struct rcvd_net_info net_info; |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 370 | struct rcvd_async_info async_info; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 371 | struct key_attr key_info; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 372 | struct cfg_param_attr cfg_info; |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 373 | struct channel_attr channel_info; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 374 | struct beacon_attr beacon_info; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 375 | struct add_sta_param add_sta_info; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 376 | struct del_sta del_sta_info; |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 377 | struct add_sta_param edit_sta_info; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 378 | struct power_mgmt_param pwr_mgmt_info; |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 379 | struct sta_inactive_t mac_info; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 380 | struct set_ip_addr ip_info; |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 381 | struct drv_handler drv; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 382 | struct set_multicast multicast_info; |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 383 | struct op_mode mode; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 384 | struct set_mac_addr set_mac_info; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 385 | struct get_mac_addr get_mac_info; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 386 | struct ba_session_info session_info; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 387 | struct remain_ch remain_on_ch; |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 388 | struct reg_frame reg_frame; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 389 | char *data; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 390 | struct del_all_sta del_all_sta_info; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 391 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 392 | |
| 393 | /*! |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 394 | * @struct struct host_if_msg |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 395 | * @brief Host Interface message |
| 396 | * @details |
| 397 | * @todo |
| 398 | * @sa |
| 399 | * @author Mostafa Abu Bakr |
| 400 | * @date 25 March 2012 |
| 401 | * @version 1.0 |
| 402 | */ |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 403 | struct host_if_msg { |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 404 | u16 id; /*!< Message ID */ |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 405 | union message_body body; /*!< Message body */ |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 406 | struct host_if_drv *drv; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 407 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 408 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 409 | /*Struct containg joinParam of each AP*/ |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 410 | struct join_bss_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 411 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 412 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 413 | u16 beacon_period; |
| 414 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 415 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 416 | char ssid[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 417 | u8 ssidLen; |
| 418 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 419 | u8 ht_capable; |
| 420 | u8 wmm_cap; |
| 421 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 422 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 423 | u8 rsn_grp_policy; |
| 424 | u8 mode_802_11i; |
| 425 | u8 rsn_pcip_policy[3]; |
| 426 | u8 rsn_auth_policy[3]; |
| 427 | u8 rsn_cap[2]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 428 | u32 tsf; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 429 | u8 u8NoaEnbaled; |
| 430 | u8 u8OppEnable; |
| 431 | u8 u8CtWindow; |
| 432 | u8 u8Count; |
| 433 | u8 u8Index; |
| 434 | u8 au8Duration[4]; |
| 435 | u8 au8Interval[4]; |
| 436 | u8 au8StartTime[4]; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 437 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 438 | |
Leo Kim | 7696edf | 2015-10-12 16:56:02 +0900 | [diff] [blame] | 439 | enum scan_conn_timer { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 440 | SCAN_TIMER = 0, |
| 441 | CONNECT_TIMER = 1, |
| 442 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF |
Leo Kim | 7696edf | 2015-10-12 16:56:02 +0900 | [diff] [blame] | 443 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 444 | |
| 445 | /*****************************************************************************/ |
| 446 | /* */ |
| 447 | /* Global Variabls */ |
| 448 | /* */ |
| 449 | /*****************************************************************************/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 450 | /* Zero is not used, because a zero ID means termination */ |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 451 | static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
| 452 | struct host_if_drv *terminated_handle; |
| 453 | struct host_if_drv *gWFiDrvHandle; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 454 | bool g_obtainingIP = false; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 455 | u8 P2P_LISTEN_STATE; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 456 | static struct task_struct *HostIFthreadHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 457 | static WILC_MsgQueueHandle gMsgQHostIF; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 458 | static struct semaphore hSemHostIFthrdEnd; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 459 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 460 | struct semaphore hSemDeinitDrvHandle; |
| 461 | static struct semaphore hWaitResponse; |
| 462 | struct semaphore hSemHostIntDeinit; |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 463 | struct timer_list g_hPeriodicRSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 464 | |
| 465 | |
| 466 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 467 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 468 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 469 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 470 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 471 | bool gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 472 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 473 | static s8 gs8Rssi; |
| 474 | static s8 gs8lnkspd; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 475 | static u8 gu8Chnl; |
| 476 | static u8 gs8SetIP[2][4]; |
| 477 | static u8 gs8GetIP[2][4]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 478 | static u32 gu32InactiveTime; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 479 | static u8 gu8DelBcn; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 480 | static u32 gu32WidConnRstHack; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 481 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 482 | u8 *gu8FlushedJoinReq; |
| 483 | u8 *gu8FlushedInfoElemAsoc; |
| 484 | u8 gu8Flushed11iMode; |
| 485 | u8 gu8FlushedAuthType; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 486 | u32 gu32FlushedJoinReqSize; |
| 487 | u32 gu32FlushedInfoElemAsocSize; |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 488 | struct host_if_drv *gu8FlushedJoinReqDrvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 489 | #define REAL_JOIN_REQ 0 |
| 490 | #define FLUSHED_JOIN_REQ 1 |
| 491 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ |
| 492 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 493 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 494 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 495 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 496 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 497 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 498 | static int add_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 499 | { |
| 500 | int i; |
| 501 | |
| 502 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 503 | if (!wfidrv_list[i]) { |
| 504 | wfidrv_list[i] = handler; |
| 505 | return 0; |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | return -ENOBUFS; |
| 510 | } |
| 511 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 512 | static int remove_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 513 | { |
| 514 | int i; |
| 515 | |
| 516 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 517 | if (wfidrv_list[i] == handler) { |
| 518 | wfidrv_list[i] = NULL; |
| 519 | return 0; |
| 520 | } |
| 521 | } |
| 522 | |
| 523 | return -EINVAL; |
| 524 | } |
| 525 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 526 | static int get_id_from_handler(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 527 | { |
| 528 | int i; |
| 529 | |
| 530 | if (!handler) |
| 531 | return 0; |
| 532 | |
| 533 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 534 | if (wfidrv_list[i] == handler) |
| 535 | return i; |
| 536 | } |
| 537 | |
| 538 | return 0; |
| 539 | } |
| 540 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 541 | static struct host_if_drv *get_handler_from_id(int id) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 542 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 543 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 544 | return NULL; |
| 545 | return wfidrv_list[id]; |
| 546 | } |
| 547 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 548 | /** |
| 549 | * @brief Handle_SetChannel |
| 550 | * @details Sending config packet to firmware to set channel |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 551 | * @param[in] struct channel_attr *pstrHostIFSetChan |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 552 | * @return Error code. |
| 553 | * @author |
| 554 | * @date |
| 555 | * @version 1.0 |
| 556 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 557 | static s32 Handle_SetChannel(struct host_if_drv *hif_drv, |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 558 | struct channel_attr *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 559 | { |
| 560 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 561 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 562 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 563 | |
| 564 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 565 | strWID.id = (u16)WID_CURRENT_CHANNEL; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 566 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 567 | strWID.val = (char *)&(pstrHostIFSetChan->u8SetChan); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 568 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 569 | |
| 570 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
| 571 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 572 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 573 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 574 | if (s32Error) { |
| 575 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 576 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 577 | } |
| 578 | |
| 579 | return s32Error; |
| 580 | } |
| 581 | /** |
| 582 | * @brief Handle_SetWfiDrvHandler |
| 583 | * @details Sending config packet to firmware to set driver handler |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 584 | * @param[in] void * drvHandler, |
| 585 | * struct drv_handler *pstrHostIfSetDrvHandler |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 586 | * @return Error code. |
| 587 | * @author |
| 588 | * @date |
| 589 | * @version 1.0 |
| 590 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 591 | static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv, |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 592 | struct drv_handler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 593 | { |
| 594 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 595 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 596 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 597 | |
| 598 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 599 | strWID.id = (u16)WID_SET_DRV_HANDLER; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 600 | strWID.type = WID_INT; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 601 | strWID.val = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 602 | strWID.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 603 | |
| 604 | /*Sending Cfg*/ |
| 605 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 606 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 607 | pstrHostIfSetDrvHandler->u32Address); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 608 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 609 | if (!hif_drv) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 610 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 611 | |
| 612 | |
| 613 | if (s32Error) { |
| 614 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 615 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 616 | } |
| 617 | |
| 618 | return s32Error; |
| 619 | } |
| 620 | |
| 621 | /** |
| 622 | * @brief Handle_SetWfiAPDrvHandler |
| 623 | * @details Sending config packet to firmware to set driver handler |
| 624 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 625 | * @return Error code. |
| 626 | * @author |
| 627 | * @date |
| 628 | * @version 1.0 |
| 629 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 630 | static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv, |
Tony Cho | 801bee5 | 2015-09-21 12:16:53 +0900 | [diff] [blame] | 631 | struct op_mode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 632 | { |
| 633 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 634 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 635 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 636 | |
| 637 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 638 | strWID.id = (u16)WID_SET_OPERATION_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 639 | strWID.type = WID_INT; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 640 | strWID.val = (s8 *)&(pstrHostIfSetOperationMode->u32Mode); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 641 | strWID.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 642 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 643 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 644 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 645 | |
| 646 | |
Johnny Kim | c590b9a | 2015-09-08 17:07:59 +0900 | [diff] [blame] | 647 | if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 648 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 649 | |
| 650 | |
| 651 | if (s32Error) { |
| 652 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 653 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 654 | } |
| 655 | |
| 656 | return s32Error; |
| 657 | } |
| 658 | |
| 659 | /** |
| 660 | * @brief host_int_set_IPAddress |
| 661 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 662 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 663 | * @return Error code. |
| 664 | * @author |
| 665 | * @date |
| 666 | * @version 1.0 |
| 667 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 668 | s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 669 | { |
| 670 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 671 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 672 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 673 | char firmwareIPAddress[4] = {0}; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 674 | |
| 675 | if (pu8IPAddr[0] < 192) |
| 676 | pu8IPAddr[0] = 0; |
| 677 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 678 | 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] | 679 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 680 | memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 681 | |
| 682 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 683 | strWID.id = (u16)WID_IP_ADDRESS; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 684 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 685 | strWID.val = (u8 *)pu8IPAddr; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 686 | strWID.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 687 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 688 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 689 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 690 | |
| 691 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 692 | host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 693 | |
| 694 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 695 | PRINT_ER("Failed to set IP address\n"); |
| 696 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 697 | } |
| 698 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 699 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 700 | |
| 701 | return s32Error; |
| 702 | } |
| 703 | |
| 704 | |
| 705 | /** |
| 706 | * @brief Handle_get_IPAddress |
| 707 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 708 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 709 | * @return Error code. |
| 710 | * @author |
| 711 | * @date |
| 712 | * @version 1.0 |
| 713 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 714 | s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 715 | { |
| 716 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 717 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 718 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 719 | |
| 720 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 721 | strWID.id = (u16)WID_IP_ADDRESS; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 722 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 723 | strWID.val = kmalloc(IP_ALEN, GFP_KERNEL); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 724 | strWID.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 725 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 726 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 727 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 728 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 729 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 730 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 731 | memcpy(gs8GetIP[idx], strWID.val, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 732 | |
| 733 | /*get the value by searching the local copy*/ |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 734 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 735 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 736 | if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 737 | host_int_setup_ipaddress(hif_drv, gs8SetIP[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 738 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 739 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 740 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 741 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 742 | } |
| 743 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 744 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
| 745 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); |
| 746 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 747 | |
| 748 | return s32Error; |
| 749 | } |
| 750 | |
| 751 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 752 | /** |
| 753 | * @brief Handle_SetMacAddress |
| 754 | * @details Setting mac address |
| 755 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 756 | * @return Error code. |
| 757 | * @author Amr Abdel-Moghny |
| 758 | * @date November 2013 |
| 759 | * @version 7.0 |
| 760 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 761 | static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv, |
Tony Cho | b7611a8 | 2015-09-21 12:16:54 +0900 | [diff] [blame] | 762 | struct set_mac_addr *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 763 | { |
| 764 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 765 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 766 | struct wid strWID; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 767 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 768 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 769 | if (mac_buf == NULL) { |
| 770 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 771 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 772 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 773 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 774 | |
| 775 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 776 | strWID.id = (u16)WID_MAC_ADDR; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 777 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 778 | strWID.val = mac_buf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 779 | strWID.size = ETH_ALEN; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 780 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 781 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 782 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 783 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 784 | if (s32Error) { |
| 785 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 786 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 787 | } |
| 788 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 789 | kfree(mac_buf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 790 | return s32Error; |
| 791 | } |
| 792 | |
| 793 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 794 | /** |
| 795 | * @brief Handle_GetMacAddress |
| 796 | * @details Getting mac address |
| 797 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 798 | * @return Error code. |
| 799 | * @author Amr Abdel-Moghny |
| 800 | * @date JAN 2013 |
| 801 | * @version 8.0 |
| 802 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 803 | static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv, |
Tony Cho | fcd27c5 | 2015-09-21 12:16:55 +0900 | [diff] [blame] | 804 | struct get_mac_addr *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 805 | { |
| 806 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 807 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 808 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 809 | |
| 810 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 811 | strWID.id = (u16)WID_MAC_ADDR; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 812 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 813 | strWID.val = pstrHostIfGetMacAddress->u8MacAddress; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 814 | strWID.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 815 | |
| 816 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 817 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 818 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 819 | if (s32Error) { |
| 820 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 821 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 822 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 823 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 824 | |
| 825 | return s32Error; |
| 826 | } |
| 827 | |
| 828 | |
| 829 | /** |
| 830 | * @brief Handle_CfgParam |
| 831 | * @details Sending config packet to firmware to set CFG params |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 832 | * @param[in] struct cfg_param_attr *strHostIFCfgParamAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 833 | * @return Error code. |
| 834 | * @author |
| 835 | * @date |
| 836 | * @version 1.0 |
| 837 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 838 | static s32 Handle_CfgParam(struct host_if_drv *hif_drv, |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 839 | struct cfg_param_attr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 840 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 841 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 842 | struct wid strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 843 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 844 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 845 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 846 | |
| 847 | |
| 848 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 849 | |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 850 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & BSS_TYPE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 851 | /*----------------------------------------------------------*/ |
| 852 | /*Input Value: INFRASTRUCTURE = 1, */ |
| 853 | /* INDEPENDENT= 2, */ |
| 854 | /* ANY_BSS= 3 */ |
| 855 | /*----------------------------------------------------------*/ |
| 856 | /* validate input then copy>> need to check value 4 and 5 */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 857 | if (strHostIFCfgParamAttr->cfg_attr_info.bss_type < 6) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 858 | strWIDList[u8WidCnt].id = WID_BSS_TYPE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 859 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.bss_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 860 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 861 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 862 | hif_drv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 863 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 864 | PRINT_ER("check value 6 over\n"); |
| 865 | s32Error = -EINVAL; |
| 866 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 867 | } |
| 868 | u8WidCnt++; |
| 869 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 870 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTH_TYPE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 871 | /*------------------------------------------------------*/ |
| 872 | /*Input Values: OPEN_SYSTEM = 0, */ |
| 873 | /* SHARED_KEY = 1, */ |
| 874 | /* ANY = 2 */ |
| 875 | /*------------------------------------------------------*/ |
| 876 | /*validate Possible values*/ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 877 | if ((strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 1 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 2 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 878 | strWIDList[u8WidCnt].id = WID_AUTH_TYPE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 879 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 880 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 881 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 882 | hif_drv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 883 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 884 | PRINT_ER("Impossible value \n"); |
| 885 | s32Error = -EINVAL; |
| 886 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 887 | } |
| 888 | u8WidCnt++; |
| 889 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 890 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 891 | /* range is 1 to 65535. */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 892 | if (strHostIFCfgParamAttr->cfg_attr_info.auth_timeout > 0 && strHostIFCfgParamAttr->cfg_attr_info.auth_timeout < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 893 | strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 894 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 895 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 896 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 897 | hif_drv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 898 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 899 | PRINT_ER("Range(1 ~ 65535) over\n"); |
| 900 | s32Error = -EINVAL; |
| 901 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 902 | } |
| 903 | u8WidCnt++; |
| 904 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 905 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & POWER_MANAGEMENT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 906 | /*-----------------------------------------------------------*/ |
| 907 | /*Input Values: NO_POWERSAVE = 0, */ |
| 908 | /* MIN_FAST_PS = 1, */ |
| 909 | /* MAX_FAST_PS = 2, */ |
| 910 | /* MIN_PSPOLL_PS = 3, */ |
| 911 | /* MAX_PSPOLL_PS = 4 */ |
| 912 | /*----------------------------------------------------------*/ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 913 | if (strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode < 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 914 | strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 915 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 916 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 917 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 918 | hif_drv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 919 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 920 | PRINT_ER("Invalide power mode\n"); |
| 921 | s32Error = -EINVAL; |
| 922 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 923 | } |
| 924 | u8WidCnt++; |
| 925 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 926 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_SHORT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 927 | /* range from 1 to 256 */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 928 | if ((strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit < 256)) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 929 | strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 930 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 931 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 932 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 933 | hif_drv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 934 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 935 | PRINT_ER("Range(1~256) over\n"); |
| 936 | s32Error = -EINVAL; |
| 937 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 938 | } |
| 939 | u8WidCnt++; |
| 940 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 941 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_LONG) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 942 | /* range from 1 to 256 */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 943 | if ((strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit < 256)) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 944 | strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 945 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 946 | |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 947 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 948 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 949 | hif_drv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 950 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 951 | PRINT_ER("Range(1~256) over\n"); |
| 952 | s32Error = -EINVAL; |
| 953 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 954 | } |
| 955 | u8WidCnt++; |
| 956 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 957 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & FRAG_THRESHOLD) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 958 | |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 959 | if (strHostIFCfgParamAttr->cfg_attr_info.frag_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.frag_threshold < 7937) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 960 | strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 961 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 962 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 963 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 964 | hif_drv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 965 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 966 | PRINT_ER("Threshold Range fail\n"); |
| 967 | s32Error = -EINVAL; |
| 968 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 969 | } |
| 970 | u8WidCnt++; |
| 971 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 972 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RTS_THRESHOLD) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 973 | /* range 256 to 65535 */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 974 | if (strHostIFCfgParamAttr->cfg_attr_info.rts_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.rts_threshold < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 975 | strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 976 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 977 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 978 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 979 | hif_drv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 980 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 981 | PRINT_ER("Threshold Range fail\n"); |
| 982 | s32Error = -EINVAL; |
| 983 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 984 | } |
| 985 | u8WidCnt++; |
| 986 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 987 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & PREAMBLE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 988 | /*-----------------------------------------------------*/ |
| 989 | /*Input Values: Short= 0, */ |
| 990 | /* Long= 1, */ |
| 991 | /* Auto= 2 */ |
| 992 | /*------------------------------------------------------*/ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 993 | if (strHostIFCfgParamAttr->cfg_attr_info.preamble_type < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 994 | strWIDList[u8WidCnt].id = WID_PREAMBLE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 995 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.preamble_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 996 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 997 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 998 | hif_drv->strCfgValues.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 999 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1000 | PRINT_ER("Preamle Range(0~2) over\n"); |
| 1001 | s32Error = -EINVAL; |
| 1002 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1003 | } |
| 1004 | u8WidCnt++; |
| 1005 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1006 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1007 | if (strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1008 | strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1009 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1010 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1011 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1012 | hif_drv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1013 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1014 | PRINT_ER("Short slot(2) over\n"); |
| 1015 | s32Error = -EINVAL; |
| 1016 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1017 | } |
| 1018 | u8WidCnt++; |
| 1019 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1020 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1021 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ |
| 1022 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ |
| 1023 | /* this information is useful for external supplicant */ |
| 1024 | /*Input Values: 1 for enable and 0 for disable. */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1025 | if (strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1026 | strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1027 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1028 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1029 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1030 | hif_drv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1031 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1032 | PRINT_ER("TXOP prot disable\n"); |
| 1033 | s32Error = -EINVAL; |
| 1034 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1035 | } |
| 1036 | u8WidCnt++; |
| 1037 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1038 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & BEACON_INTERVAL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1039 | /* range is 1 to 65535. */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1040 | if (strHostIFCfgParamAttr->cfg_attr_info.beacon_interval > 0 && strHostIFCfgParamAttr->cfg_attr_info.beacon_interval < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1041 | strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1042 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1043 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1044 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1045 | hif_drv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1046 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1047 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
| 1048 | s32Error = -EINVAL; |
| 1049 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1050 | } |
| 1051 | u8WidCnt++; |
| 1052 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1053 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & DTIM_PERIOD) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1054 | /* range is 1 to 255. */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1055 | if (strHostIFCfgParamAttr->cfg_attr_info.dtim_period > 0 && strHostIFCfgParamAttr->cfg_attr_info.dtim_period < 256) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1056 | strWIDList[u8WidCnt].id = WID_DTIM_PERIOD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1057 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.dtim_period; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1058 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1059 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1060 | hif_drv->strCfgValues.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1061 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1062 | PRINT_ER("DTIM range(1~255) fail\n"); |
| 1063 | s32Error = -EINVAL; |
| 1064 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1065 | } |
| 1066 | u8WidCnt++; |
| 1067 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1068 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1069 | /*----------------------------------------------------------------------*/ |
| 1070 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ |
| 1071 | /* SITE_SURVEY_ALL_CH = 1, */ |
| 1072 | /* SITE_SURVEY_OFF = 2 */ |
| 1073 | /*----------------------------------------------------------------------*/ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1074 | if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1075 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1076 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1077 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1078 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1079 | hif_drv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1080 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1081 | PRINT_ER("Site survey disable\n"); |
| 1082 | s32Error = -EINVAL; |
| 1083 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1084 | } |
| 1085 | u8WidCnt++; |
| 1086 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1087 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1088 | /* range is 1 to 65535. */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1089 | if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1090 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1091 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1092 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1093 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1094 | hif_drv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1095 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1096 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
| 1097 | s32Error = -EINVAL; |
| 1098 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1099 | } |
| 1100 | u8WidCnt++; |
| 1101 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1102 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & ACTIVE_SCANTIME) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1103 | /* range is 1 to 65535. */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1104 | if (strHostIFCfgParamAttr->cfg_attr_info.active_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.active_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1105 | strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1106 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1107 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1108 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1109 | hif_drv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1110 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1111 | PRINT_ER("Active scan time(1~65535) over\n"); |
| 1112 | s32Error = -EINVAL; |
| 1113 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1114 | } |
| 1115 | u8WidCnt++; |
| 1116 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1117 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & PASSIVE_SCANTIME) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1118 | /* range is 1 to 65535. */ |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1119 | if (strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1120 | strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1121 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1122 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1123 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1124 | hif_drv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1125 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1126 | PRINT_ER("Passive scan time(1~65535) over\n"); |
| 1127 | s32Error = -EINVAL; |
| 1128 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1129 | } |
| 1130 | u8WidCnt++; |
| 1131 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 1132 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & CURRENT_TX_RATE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 1133 | enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->cfg_attr_info.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1134 | /*----------------------------------------------------------------------*/ |
| 1135 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ |
| 1136 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ |
| 1137 | /*----------------------------------------------------------------------*/ |
| 1138 | /* validate rate */ |
| 1139 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 1140 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 1141 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 1142 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 1143 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 1144 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1145 | strWIDList[u8WidCnt].id = WID_CURRENT_TX_RATE; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1146 | strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1147 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1148 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1149 | hif_drv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1150 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1151 | PRINT_ER("out of TX rate\n"); |
| 1152 | s32Error = -EINVAL; |
| 1153 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1154 | } |
| 1155 | u8WidCnt++; |
| 1156 | } |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 1157 | s32Error = send_config_pkt(SET_CFG, strWIDList, u8WidCnt, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1158 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1159 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1160 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1161 | PRINT_ER("Error in setting CFG params\n"); |
| 1162 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1163 | ERRORHANDLER: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1164 | up(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1165 | return s32Error; |
| 1166 | } |
| 1167 | |
| 1168 | |
| 1169 | /** |
| 1170 | * @brief Handle_wait_msg_q_empty |
| 1171 | * @details this should be the last msg and then the msg Q becomes idle |
| 1172 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1173 | * @return Error code. |
| 1174 | * @author |
| 1175 | * @date |
| 1176 | * @version 1.0 |
| 1177 | */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1178 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1179 | { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1180 | g_wilc_initialized = 0; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1181 | up(&hWaitResponse); |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 1182 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1183 | } |
| 1184 | |
| 1185 | /** |
| 1186 | * @brief Handle_Scan |
| 1187 | * @details Sending config packet to firmware to set the scan params |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1188 | * @param[in] struct scan_attr *pstrHostIFscanAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1189 | * @return Error code. |
| 1190 | * @author |
| 1191 | * @date |
| 1192 | * @version 1.0 |
| 1193 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1194 | static s32 Handle_Scan(struct host_if_drv *hif_drv, |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1195 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1196 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1197 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1198 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1199 | u32 u32WidsCount = 0; |
| 1200 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1201 | u8 *pu8Buffer; |
| 1202 | u8 valuesize = 0; |
| 1203 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1204 | |
| 1205 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1206 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1207 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1208 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; |
| 1209 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1210 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1211 | if ((hif_drv->enuHostIFstate >= HOST_IF_SCANNING) && (hif_drv->enuHostIFstate < HOST_IF_CONNECTED)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1212 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1213 | PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", hif_drv->enuHostIFstate); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1214 | PRINT_ER("Already scan\n"); |
| 1215 | s32Error = -EBUSY; |
| 1216 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1217 | } |
| 1218 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1219 | if (g_obtainingIP || connecting) { |
| 1220 | 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] | 1221 | PRINT_ER("Don't do obss scan\n"); |
| 1222 | s32Error = -EBUSY; |
| 1223 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1224 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1225 | |
| 1226 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 1227 | |
| 1228 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1229 | hif_drv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1230 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1231 | strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1232 | strWIDList[u32WidsCount].type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1233 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1234 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1235 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1236 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1237 | strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal; |
| 1238 | if (strWIDList[u32WidsCount].val != NULL) { |
| 1239 | pu8Buffer = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1240 | |
| 1241 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; |
| 1242 | |
| 1243 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); |
| 1244 | |
| 1245 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { |
| 1246 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1247 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1248 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 1249 | } |
| 1250 | |
| 1251 | |
| 1252 | |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1253 | strWIDList[u32WidsCount].size = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1254 | u32WidsCount++; |
| 1255 | } |
| 1256 | |
| 1257 | /*filling cfg param array*/ |
| 1258 | |
| 1259 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ |
| 1260 | { |
| 1261 | /* IEs to be inserted in Probe Request */ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1262 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_PROBE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1263 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1264 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->pu8IEs; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1265 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->IEsLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1266 | u32WidsCount++; |
| 1267 | } |
| 1268 | |
| 1269 | /*Scan Type*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1270 | strWIDList[u32WidsCount].id = WID_SCAN_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1271 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1272 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1273 | strWIDList[u32WidsCount].val = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1274 | u32WidsCount++; |
| 1275 | |
| 1276 | /*list of channels to be scanned*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1277 | strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1278 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1279 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1280 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { |
| 1281 | int i; |
| 1282 | |
| 1283 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1284 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1285 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1286 | } |
| 1287 | } |
| 1288 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1289 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->pu8ChnlFreqList; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1290 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->u8ChnlListLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1291 | u32WidsCount++; |
| 1292 | |
| 1293 | /*Scan Request*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1294 | strWIDList[u32WidsCount].id = WID_START_SCAN_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1295 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1296 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1297 | strWIDList[u32WidsCount].val = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1298 | u32WidsCount++; |
| 1299 | |
| 1300 | /*keep the state as is , no need to change it*/ |
| 1301 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ |
| 1302 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1303 | if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1304 | gbScanWhileConnected = true; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1305 | else if (hif_drv->enuHostIFstate == HOST_IF_IDLE) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1306 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1307 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 1308 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1309 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1310 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1311 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1312 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1313 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1314 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1315 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1316 | ERRORHANDLER: |
| 1317 | if (s32Error) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1318 | del_timer(&hif_drv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1319 | /*if there is an ongoing scan request*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1320 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1321 | } |
| 1322 | |
| 1323 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1324 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1325 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1326 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1327 | } |
| 1328 | |
| 1329 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ |
| 1330 | if (pstrHostIFscanAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1331 | kfree(pstrHostIFscanAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1332 | pstrHostIFscanAttr->pu8IEs = NULL; |
| 1333 | } |
| 1334 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1335 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1336 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
| 1337 | } |
| 1338 | |
| 1339 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1340 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1341 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1342 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1343 | } |
| 1344 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1345 | if (pu8HdnNtwrksWidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1346 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1347 | |
| 1348 | return s32Error; |
| 1349 | } |
| 1350 | |
| 1351 | /** |
| 1352 | * @brief Handle_ScanDone |
| 1353 | * @details Call scan notification callback function |
| 1354 | * @param[in] NONE |
| 1355 | * @return Error code. |
| 1356 | * @author |
| 1357 | * @date |
| 1358 | * @version 1.0 |
| 1359 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1360 | static s32 Handle_ScanDone(struct host_if_drv *hif_drv, |
| 1361 | enum scan_event enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1362 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1363 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1364 | u8 u8abort_running_scan; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1365 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1366 | |
| 1367 | |
| 1368 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 1369 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1370 | /*Ask FW to abort the running scan, if any*/ |
| 1371 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 1372 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 1373 | u8abort_running_scan = 1; |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1374 | strWID.id = (u16)WID_ABORT_RUNNING_SCAN; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1375 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1376 | strWID.val = (s8 *)&u8abort_running_scan; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1377 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1378 | |
| 1379 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 1380 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1381 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1382 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1383 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1384 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1385 | } |
| 1386 | } |
| 1387 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1388 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1389 | PRINT_ER("Driver handler is NULL\n"); |
| 1390 | return s32Error; |
| 1391 | } |
| 1392 | |
| 1393 | /*if there is an ongoing scan request*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1394 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
| 1395 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
| 1396 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1397 | /*delete current scan request*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1398 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1399 | } |
| 1400 | |
| 1401 | return s32Error; |
| 1402 | } |
| 1403 | |
| 1404 | /** |
| 1405 | * @brief Handle_Connect |
| 1406 | * @details Sending config packet to firmware to starting connection |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1407 | * @param[in] struct connect_attr *pstrHostIFconnectAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1408 | * @return Error code. |
| 1409 | * @author |
| 1410 | * @date |
| 1411 | * @version 1.0 |
| 1412 | */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1413 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1414 | static s32 Handle_Connect(struct host_if_drv *hif_drv, |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1415 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1416 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1417 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1418 | struct wid strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1419 | u32 u32WidsCount = 0, dummyval = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1420 | /* char passphrase[] = "12345678"; */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1421 | u8 *pu8CurrByte = NULL; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 1422 | struct join_bss_param *ptstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1423 | |
| 1424 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1425 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1426 | /* if we try to connect to an already connected AP then discard the request */ |
| 1427 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1428 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1429 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1430 | s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1431 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
| 1432 | return s32Error; |
| 1433 | } |
| 1434 | |
| 1435 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1436 | |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 1437 | ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->pJoinParams; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1438 | if (ptstrJoinBssParam == NULL) { |
| 1439 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1440 | s32Error = -ENOENT; |
| 1441 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1442 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1443 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1444 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1445 | hif_drv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
| 1446 | memcpy(hif_drv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1447 | } |
| 1448 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1449 | hif_drv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1450 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1451 | hif_drv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
| 1452 | memcpy(hif_drv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1453 | pstrHostIFconnectAttr->ssidLen); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1454 | hif_drv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1455 | } |
| 1456 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1457 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1458 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1459 | hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
| 1460 | memcpy(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1461 | pstrHostIFconnectAttr->IEsLen); |
| 1462 | } |
| 1463 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1464 | hif_drv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1465 | hif_drv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1466 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1467 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1468 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1469 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1470 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1471 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1472 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1473 | u32WidsCount++; |
| 1474 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1475 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1476 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1477 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1478 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1479 | u32WidsCount++; |
| 1480 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1481 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1482 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1483 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1484 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1485 | u32WidsCount++; |
| 1486 | |
| 1487 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1488 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1489 | { |
| 1490 | /* IEs to be inserted in Association Request */ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1491 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1492 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1493 | strWIDList[u32WidsCount].val = hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1494 | strWIDList[u32WidsCount].size = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1495 | u32WidsCount++; |
| 1496 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1497 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1498 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1499 | gu32FlushedInfoElemAsocSize = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1500 | gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1501 | memcpy(gu8FlushedInfoElemAsoc, hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1502 | gu32FlushedInfoElemAsocSize); |
| 1503 | } |
| 1504 | } |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1505 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1506 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1507 | strWIDList[u32WidsCount].size = sizeof(char); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1508 | strWIDList[u32WidsCount].val = (s8 *)(&(hif_drv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1509 | u32WidsCount++; |
| 1510 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1511 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1512 | gu8Flushed11iMode = hif_drv->strWILC_UsrConnReq.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1513 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1514 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", hif_drv->strWILC_UsrConnReq.u8security); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1515 | |
| 1516 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1517 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1518 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1519 | strWIDList[u32WidsCount].size = sizeof(char); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1520 | strWIDList[u32WidsCount].val = (s8 *)(&hif_drv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1521 | u32WidsCount++; |
| 1522 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1523 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1524 | gu8FlushedAuthType = (u8)hif_drv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1525 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1526 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", hif_drv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1527 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1528 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1529 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1530 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1531 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1532 | * u32WidsCount++; |
| 1533 | */ |
| 1534 | |
| 1535 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1536 | hif_drv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1537 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1538 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1539 | strWIDList[u32WidsCount].type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1540 | |
| 1541 | /*Sending NoA attributes during connection*/ |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1542 | strWIDList[u32WidsCount].size = 112; /* 79; */ |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1543 | strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1544 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1545 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1546 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].size; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1547 | gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1548 | } |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1549 | if (strWIDList[u32WidsCount].val == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1550 | s32Error = -EFAULT; |
| 1551 | goto ERRORHANDLER; |
| 1552 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1553 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1554 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1555 | |
| 1556 | |
| 1557 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1558 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1559 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1560 | } |
| 1561 | pu8CurrByte += MAX_SSID_LEN; |
| 1562 | |
| 1563 | /* BSS type*/ |
| 1564 | *(pu8CurrByte++) = INFRASTRUCTURE; |
| 1565 | /* Channel*/ |
| 1566 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1567 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1568 | } else { |
| 1569 | PRINT_ER("Channel out of range\n"); |
| 1570 | *(pu8CurrByte++) = 0xFF; |
| 1571 | } |
| 1572 | /* Cap Info*/ |
| 1573 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1574 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1575 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1576 | |
| 1577 | /* sa*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1578 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1579 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1580 | pu8CurrByte += 6; |
| 1581 | |
| 1582 | /* bssid*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1583 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1584 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1585 | pu8CurrByte += 6; |
| 1586 | |
| 1587 | /* Beacon Period*/ |
| 1588 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1589 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1590 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1591 | /* DTIM Period*/ |
| 1592 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1593 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
| 1594 | /* Supported rates*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1595 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1596 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1597 | |
| 1598 | /* wmm cap*/ |
| 1599 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1600 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
| 1601 | /* uapsd cap*/ |
| 1602 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1603 | |
| 1604 | /* ht cap*/ |
| 1605 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
| 1606 | /* copy this information to the user request */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1607 | hif_drv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1608 | |
| 1609 | /* rsn found*/ |
| 1610 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1611 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
| 1612 | /* rsn group policy*/ |
| 1613 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1614 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
| 1615 | /* mode_802_11i*/ |
| 1616 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1617 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
| 1618 | /* rsn pcip policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1619 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1620 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1621 | |
| 1622 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1623 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1624 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1625 | |
| 1626 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1627 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1628 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1629 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1630 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
| 1631 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1632 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; |
| 1633 | if (ptstrJoinBssParam->u8NoaEnbaled) { |
| 1634 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1635 | |
| 1636 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1637 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1638 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1639 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1640 | |
| 1641 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; |
| 1642 | |
| 1643 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; |
| 1644 | |
| 1645 | if (ptstrJoinBssParam->u8OppEnable) |
| 1646 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; |
| 1647 | |
| 1648 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; |
| 1649 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1650 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1651 | |
| 1652 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); |
| 1653 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1654 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1655 | |
| 1656 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); |
| 1657 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1658 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1659 | |
| 1660 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); |
| 1661 | |
| 1662 | } else |
| 1663 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1664 | |
| 1665 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1666 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1667 | u32WidsCount++; |
| 1668 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1669 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1670 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1671 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1672 | /* ////////////////////// */ |
| 1673 | gu32WidConnRstHack = 0; |
| 1674 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1675 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1676 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1677 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1678 | gu8FlushedJoinReqDrvHandler = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1679 | } |
| 1680 | |
| 1681 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1682 | |
| 1683 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1684 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1685 | |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1686 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
| 1687 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1688 | } |
| 1689 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 1690 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1691 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1692 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1693 | PRINT_ER("failed to send config packet\n"); |
| 1694 | s32Error = -EFAULT; |
| 1695 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1696 | } else { |
| 1697 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1698 | hif_drv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1699 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1700 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1701 | ERRORHANDLER: |
| 1702 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1703 | tstrConnectInfo strConnectInfo; |
| 1704 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1705 | del_timer(&hif_drv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1706 | |
| 1707 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 1708 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1709 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1710 | |
| 1711 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1712 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1713 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1714 | |
| 1715 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
| 1716 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1717 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1718 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1719 | pstrHostIFconnectAttr->pu8IEs, |
| 1720 | pstrHostIFconnectAttr->IEsLen); |
| 1721 | } |
| 1722 | |
| 1723 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 1724 | &strConnectInfo, |
| 1725 | MAC_DISCONNECTED, |
| 1726 | NULL, |
| 1727 | pstrHostIFconnectAttr->pvUserArg); |
| 1728 | /*Change state to idle*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1729 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1730 | /* Deallocation */ |
| 1731 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1732 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1733 | strConnectInfo.pu8ReqIEs = NULL; |
| 1734 | } |
| 1735 | |
| 1736 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1737 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1738 | } |
| 1739 | } |
| 1740 | |
| 1741 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
| 1742 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ |
| 1743 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1744 | kfree(pstrHostIFconnectAttr->pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1745 | pstrHostIFconnectAttr->pu8bssid = NULL; |
| 1746 | } |
| 1747 | |
| 1748 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ |
| 1749 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1750 | kfree(pstrHostIFconnectAttr->pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1751 | pstrHostIFconnectAttr->pu8ssid = NULL; |
| 1752 | } |
| 1753 | |
| 1754 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ |
| 1755 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1756 | kfree(pstrHostIFconnectAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1757 | pstrHostIFconnectAttr->pu8IEs = NULL; |
| 1758 | } |
| 1759 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1760 | if (pu8CurrByte != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1761 | kfree(pu8CurrByte); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1762 | return s32Error; |
| 1763 | } |
| 1764 | |
| 1765 | /** |
| 1766 | * @brief Handle_FlushConnect |
| 1767 | * @details Sending config packet to firmware to flush an old connection |
| 1768 | * after switching FW from station one to hybrid one |
| 1769 | * @param[in] void * drvHandler |
| 1770 | * @return Error code. |
| 1771 | * @author Amr Abdel-Moghny |
| 1772 | * @date 19 DEC 2013 |
| 1773 | * @version 8.0 |
| 1774 | */ |
| 1775 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1776 | static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1777 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1778 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1779 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1780 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1781 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1782 | |
| 1783 | |
| 1784 | /* IEs to be inserted in Association Request */ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1785 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1786 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1787 | strWIDList[u32WidsCount].val = gu8FlushedInfoElemAsoc; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1788 | strWIDList[u32WidsCount].size = gu32FlushedInfoElemAsocSize; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1789 | u32WidsCount++; |
| 1790 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1791 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1792 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1793 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1794 | strWIDList[u32WidsCount].val = (s8 *)(&(gu8Flushed11iMode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1795 | u32WidsCount++; |
| 1796 | |
| 1797 | |
| 1798 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1799 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1800 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1801 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1802 | strWIDList[u32WidsCount].val = (s8 *)(&gu8FlushedAuthType); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1803 | u32WidsCount++; |
| 1804 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1805 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1806 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1807 | strWIDList[u32WidsCount].size = gu32FlushedJoinReqSize; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1808 | strWIDList[u32WidsCount].val = (s8 *)gu8FlushedJoinReq; |
| 1809 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1810 | |
| 1811 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 1812 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 1813 | |
| 1814 | u32WidsCount++; |
| 1815 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 1816 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1817 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1818 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1819 | PRINT_ER("failed to send config packet\n"); |
| 1820 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1821 | } |
| 1822 | |
| 1823 | return s32Error; |
| 1824 | } |
| 1825 | |
| 1826 | /** |
| 1827 | * @brief Handle_ConnectTimeout |
| 1828 | * @details Call connect notification callback function indicating connection failure |
| 1829 | * @param[in] NONE |
| 1830 | * @return Error code. |
| 1831 | * @author |
| 1832 | * @date |
| 1833 | * @version 1.0 |
| 1834 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1835 | static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1836 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1837 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1838 | tstrConnectInfo strConnectInfo; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1839 | struct wid strWID; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1840 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1841 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1842 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1843 | PRINT_ER("Driver handler is NULL\n"); |
| 1844 | return s32Error; |
| 1845 | } |
| 1846 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1847 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1848 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1849 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1850 | |
| 1851 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1852 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1853 | |
| 1854 | |
| 1855 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, |
| 1856 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 1857 | * WID_DISCONNECT} */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1858 | if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 1859 | if (hif_drv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1860 | memcpy(strConnectInfo.au8bssid, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1861 | hif_drv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1862 | } |
| 1863 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1864 | if (hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 1865 | strConnectInfo.ReqIEsLen = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1866 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1867 | memcpy(strConnectInfo.pu8ReqIEs, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1868 | hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1869 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1870 | } |
| 1871 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1872 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1873 | &strConnectInfo, |
| 1874 | MAC_DISCONNECTED, |
| 1875 | NULL, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1876 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1877 | |
| 1878 | /* Deallocation of strConnectInfo.pu8ReqIEs */ |
| 1879 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1880 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1881 | strConnectInfo.pu8ReqIEs = NULL; |
| 1882 | } |
| 1883 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1884 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1885 | } |
| 1886 | |
| 1887 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 1888 | * WID_DISCONNECT} */ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1889 | strWID.id = (u16)WID_DISCONNECT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1890 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1891 | strWID.val = (s8 *)&u16DummyReasonCode; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1892 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1893 | |
| 1894 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1895 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 1896 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1897 | get_id_from_handler(hif_drv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1898 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1899 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1900 | |
| 1901 | /* Deallocation of the Saved Connect Request in the global Handle */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1902 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 1903 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 1904 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 1905 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 1906 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1907 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1908 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1909 | /*Freeing flushed join request params on connect timeout*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1910 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1911 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1912 | gu8FlushedJoinReq = NULL; |
| 1913 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1914 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1915 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1916 | gu8FlushedInfoElemAsoc = NULL; |
| 1917 | } |
| 1918 | |
| 1919 | return s32Error; |
| 1920 | } |
| 1921 | |
| 1922 | /** |
| 1923 | * @brief Handle_RcvdNtwrkInfo |
| 1924 | * @details Handling received network information |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1925 | * @param[in] struct rcvd_net_info *pstrRcvdNetworkInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1926 | * @return Error code. |
| 1927 | * @author |
| 1928 | * @date |
| 1929 | * @version 1.0 |
| 1930 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1931 | static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1932 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1933 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1934 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1935 | bool bNewNtwrkFound; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1936 | |
| 1937 | |
| 1938 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1939 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1940 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 1941 | void *pJoinParams = NULL; |
| 1942 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1943 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1944 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 1945 | |
| 1946 | /*if there is a an ongoing scan request*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1947 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1948 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
Chaehyun Lim | a1f7f64 | 2015-09-22 22:47:44 +0900 | [diff] [blame] | 1949 | parse_network_info(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1950 | if ((pstrNetworkInfo == NULL) |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1951 | || (hif_drv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1952 | PRINT_ER("driver is null\n"); |
| 1953 | s32Error = -EINVAL; |
| 1954 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1955 | } |
| 1956 | |
| 1957 | /* check whether this network is discovered before */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1958 | for (i = 0; i < hif_drv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1959 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1960 | if ((hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1961 | (pstrNetworkInfo->au8bssid != NULL)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1962 | if (memcmp(hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1963 | pstrNetworkInfo->au8bssid, 6) == 0) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1964 | if (pstrNetworkInfo->s8rssi <= hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1965 | /*we have already found this network with better rssi, so keep the old cached one and don't |
| 1966 | * send anything to the upper layer */ |
| 1967 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 1968 | goto done; |
| 1969 | } else { |
| 1970 | /* here the same already found network is found again but with a better rssi, so just update |
| 1971 | * the rssi for this cached network and send this updated network to the upper layer but |
| 1972 | * don't add a new record for it */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1973 | hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1974 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1975 | break; |
| 1976 | } |
| 1977 | } |
| 1978 | } |
| 1979 | } |
| 1980 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1981 | if (bNewNtwrkFound == true) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1982 | /* here it is confirmed that it is a new discovered network, |
| 1983 | * so add its record then call the User CallBack function */ |
| 1984 | |
| 1985 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 1986 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1987 | if (hif_drv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 1988 | hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1989 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1990 | if ((hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1991 | && (pstrNetworkInfo->au8bssid != NULL)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1992 | memcpy(hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1993 | pstrNetworkInfo->au8bssid, 6); |
| 1994 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1995 | hif_drv->strWILC_UsrScanReq.u32RcvdChCount++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1996 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1997 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1998 | /* add new BSS to JoinBssTable */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1999 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2000 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2001 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2002 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2003 | pJoinParams); |
| 2004 | |
| 2005 | |
| 2006 | } |
| 2007 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2008 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2009 | } |
| 2010 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2011 | pstrNetworkInfo->bNewNetwork = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2012 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2013 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2014 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2015 | } |
| 2016 | } |
| 2017 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2018 | done: |
| 2019 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2020 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2021 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2022 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
| 2023 | } |
| 2024 | |
| 2025 | /*free structure allocated*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2026 | if (pstrNetworkInfo != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2027 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2028 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2029 | } |
| 2030 | |
| 2031 | return s32Error; |
| 2032 | } |
| 2033 | |
| 2034 | /** |
| 2035 | * @brief Handle_RcvdGnrlAsyncInfo |
| 2036 | * @details Handling received asynchrous general network information |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2037 | * @param[in] struct rcvd_async_info *pstrRcvdGnrlAsyncInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2038 | * @return Error code. |
| 2039 | * @author |
| 2040 | * @date |
| 2041 | * @version 1.0 |
| 2042 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2043 | static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2044 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2045 | { |
| 2046 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ |
| 2047 | /* which carries only 1 WID which have WID ID = WID_STATUS */ |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2048 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2049 | u8 u8MsgType = 0; |
| 2050 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2051 | u16 u16MsgLen = 0; |
| 2052 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2053 | u8 u8WidLen = 0; |
| 2054 | u8 u8MacStatus; |
| 2055 | u8 u8MacStatusReasonCode; |
| 2056 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2057 | tstrConnectInfo strConnectInfo; |
| 2058 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2059 | s32 s32Err = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2060 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2061 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2062 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 2063 | return -ENODEV; |
| 2064 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2065 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", hif_drv->enuHostIFstate, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2066 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); |
| 2067 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2068 | if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 2069 | (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 2070 | hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2071 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2072 | (hif_drv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2073 | PRINT_ER("driver is null\n"); |
| 2074 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2075 | } |
| 2076 | |
| 2077 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; |
| 2078 | |
| 2079 | /* Check whether the received message type is 'I' */ |
| 2080 | if ('I' != u8MsgType) { |
| 2081 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2082 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2083 | } |
| 2084 | |
| 2085 | /* Extract message ID */ |
| 2086 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; |
| 2087 | |
| 2088 | /* Extract message Length */ |
| 2089 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); |
| 2090 | |
| 2091 | /* Extract WID ID [expected to be = WID_STATUS] */ |
| 2092 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); |
| 2093 | |
| 2094 | /* Extract WID Length [expected to be = 1] */ |
| 2095 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; |
| 2096 | |
| 2097 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ |
| 2098 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; |
| 2099 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; |
| 2100 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; |
| 2101 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2102 | if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2103 | /* 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] | 2104 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2105 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 2106 | |
| 2107 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2108 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2109 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2110 | |
| 2111 | if (u8MacStatus == MAC_CONNECTED) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2112 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2113 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2114 | host_int_get_assoc_res_info(hif_drv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2115 | gapu8RcvdAssocResp, |
| 2116 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 2117 | &u32RcvdAssocRespInfoLen); |
| 2118 | |
| 2119 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 2120 | |
| 2121 | if (u32RcvdAssocRespInfoLen != 0) { |
| 2122 | |
| 2123 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
| 2124 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, |
| 2125 | &pstrConnectRespInfo); |
| 2126 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2127 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2128 | } else { |
| 2129 | /* use the necessary parsed Info from the Received Association Response */ |
| 2130 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 2131 | |
| 2132 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 2133 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
| 2134 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { |
| 2135 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
| 2136 | |
| 2137 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2138 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2139 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2140 | pstrConnectRespInfo->u16RespIEsLen); |
| 2141 | } |
| 2142 | } |
| 2143 | |
| 2144 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ |
| 2145 | if (pstrConnectRespInfo != NULL) { |
| 2146 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 2147 | pstrConnectRespInfo = NULL; |
| 2148 | } |
| 2149 | } |
| 2150 | } |
| 2151 | } |
| 2152 | |
| 2153 | /* The station has just received mac status and it also received assoc. response which |
| 2154 | * it was waiting for. |
| 2155 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ |
| 2156 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2157 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2158 | PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 2159 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2160 | |
| 2161 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 2162 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 2163 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2164 | } |
| 2165 | |
| 2166 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ |
| 2167 | /* through a structure of type tstrConnectRespInfo */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2168 | if (hif_drv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2169 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2170 | memcpy(strConnectInfo.au8bssid, hif_drv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2171 | |
| 2172 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2173 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2174 | memcpy(hif_drv->au8AssociatedBSSID, |
| 2175 | hif_drv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2176 | } |
| 2177 | } |
| 2178 | |
| 2179 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2180 | if (hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2181 | strConnectInfo.ReqIEsLen = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 2182 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2183 | memcpy(strConnectInfo.pu8ReqIEs, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2184 | hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2185 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2186 | } |
| 2187 | |
| 2188 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2189 | del_timer(&hif_drv->hConnectTimer); |
| 2190 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2191 | &strConnectInfo, |
| 2192 | u8MacStatus, |
| 2193 | NULL, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2194 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2195 | |
| 2196 | |
| 2197 | /* if received mac status is MAC_CONNECTED and |
| 2198 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED |
| 2199 | * else change state to IDLE */ |
| 2200 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2201 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2202 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2203 | |
| 2204 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2205 | hif_drv->enuHostIFstate = HOST_IF_CONNECTED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2206 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2207 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2208 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2209 | mod_timer(&hDuringIpTimer, |
| 2210 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2211 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2212 | /* open a BA session if possible */ |
| 2213 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2214 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ |
| 2215 | } else { |
| 2216 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2217 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2218 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2219 | } |
| 2220 | |
| 2221 | /* Deallocation */ |
| 2222 | if (strConnectInfo.pu8RespIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2223 | kfree(strConnectInfo.pu8RespIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2224 | strConnectInfo.pu8RespIEs = NULL; |
| 2225 | } |
| 2226 | |
| 2227 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2228 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2229 | strConnectInfo.pu8ReqIEs = NULL; |
| 2230 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2231 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 2232 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 2233 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 2234 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2235 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2236 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2237 | (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2238 | /* Disassociation or Deauthentication frame has been received */ |
| 2239 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 2240 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2241 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2242 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2243 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2244 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2245 | del_timer(&hif_drv->hScanTimer); |
| 2246 | Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2247 | } |
| 2248 | |
| 2249 | strDisconnectNotifInfo.u16reason = 0; |
| 2250 | strDisconnectNotifInfo.ie = NULL; |
| 2251 | strDisconnectNotifInfo.ie_len = 0; |
| 2252 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2253 | if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2254 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2255 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2256 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2257 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2258 | NULL, |
| 2259 | 0, |
| 2260 | &strDisconnectNotifInfo, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2261 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2262 | |
| 2263 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2264 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2265 | } |
| 2266 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2267 | eth_zero_addr(hif_drv->au8AssociatedBSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2268 | |
| 2269 | |
| 2270 | /* Deallocation */ |
| 2271 | |
| 2272 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they |
| 2273 | * should be deallocated here */ |
| 2274 | /* |
| 2275 | * if(strDisconnectNotifInfo.ie != NULL) |
| 2276 | * { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2277 | * kfree(strDisconnectNotifInfo.ie); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2278 | * strDisconnectNotifInfo.ie = NULL; |
| 2279 | * } |
| 2280 | */ |
| 2281 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2282 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 2283 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 2284 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 2285 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2286 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2287 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2288 | /*Freeing flushed join request params on receiving*/ |
| 2289 | /*MAC_DISCONNECTED while connected*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2290 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2291 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2292 | gu8FlushedJoinReq = NULL; |
| 2293 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2294 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2295 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2296 | gu8FlushedInfoElemAsoc = NULL; |
| 2297 | } |
| 2298 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2299 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2300 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2301 | |
| 2302 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2303 | (hif_drv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2304 | 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] | 2305 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2306 | /*Abort the running scan*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2307 | del_timer(&hif_drv->hScanTimer); |
| 2308 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) |
| 2309 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2310 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2311 | } |
| 2312 | |
| 2313 | } |
| 2314 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2315 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2316 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2317 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2318 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
| 2319 | } |
| 2320 | |
| 2321 | return s32Error; |
| 2322 | } |
| 2323 | |
| 2324 | /** |
| 2325 | * @brief Handle_Key |
| 2326 | * @details Sending config packet to firmware to set key |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2327 | * @param[in] struct key_attr *pstrHostIFkeyAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2328 | * @return Error code. |
| 2329 | * @author |
| 2330 | * @date |
| 2331 | * @version 1.0 |
| 2332 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2333 | static int Handle_Key(struct host_if_drv *hif_drv, |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2334 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2335 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2336 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2337 | struct wid strWID; |
| 2338 | struct wid strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2339 | u8 i; |
| 2340 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2341 | s8 s8idxarray[1]; |
| 2342 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2343 | |
| 2344 | switch (pstrHostIFkeyAttr->enuKeyType) { |
| 2345 | |
| 2346 | |
| 2347 | case WEP: |
| 2348 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2349 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2350 | |
| 2351 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 2352 | PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", (pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.u8Wepidx)); |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2353 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2354 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2355 | strWIDList[0].size = sizeof(char); |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 2356 | strWIDList[0].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.u8mode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2357 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2358 | strWIDList[1].id = WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2359 | strWIDList[1].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2360 | strWIDList[1].size = sizeof(char); |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 2361 | strWIDList[1].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.tenuAuth_type)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2362 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2363 | strWIDList[2].id = (u16)WID_KEY_ID; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2364 | strWIDList[2].type = WID_CHAR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2365 | |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 2366 | strWIDList[2].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.u8Wepidx)); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2367 | strWIDList[2].size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2368 | |
| 2369 | |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 2370 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2371 | |
| 2372 | |
| 2373 | if (pu8keybuf == NULL) { |
| 2374 | PRINT_ER("No buffer to send Key\n"); |
| 2375 | return -1; |
| 2376 | } |
| 2377 | |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 2378 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key, |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 2379 | pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2380 | |
| 2381 | |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 2382 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2383 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2384 | strWIDList[3].id = (u16)WID_WEP_KEY_VALUE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2385 | strWIDList[3].type = WID_STR; |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 2386 | strWIDList[3].size = pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2387 | strWIDList[3].val = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2388 | |
| 2389 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2390 | s32Error = send_config_pkt(SET_CFG, strWIDList, 4, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2391 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2392 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2393 | |
| 2394 | |
| 2395 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2396 | |
| 2397 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2398 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 2399 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len + 2, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2400 | if (pu8keybuf == NULL) { |
| 2401 | PRINT_ER("No buffer to send Key\n"); |
| 2402 | return -1; |
| 2403 | } |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 2404 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.u8Wepidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2405 | |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 2406 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2407 | |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 2408 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key, |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 2409 | pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2410 | |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 2411 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2412 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2413 | strWID.id = (u16)WID_ADD_WEP_KEY; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2414 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2415 | strWID.val = (s8 *)pu8keybuf; |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 2416 | strWID.size = pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.key_len + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2417 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2418 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2419 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2420 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2421 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
| 2422 | |
| 2423 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2424 | strWID.id = (u16)WID_REMOVE_WEP_KEY; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2425 | strWID.type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2426 | |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 2427 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.u8Wepidx; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2428 | strWID.val = s8idxarray; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2429 | strWID.size = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2430 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2431 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2432 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2433 | } else { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2434 | strWID.id = (u16)WID_KEY_ID; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2435 | strWID.type = WID_CHAR; |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 2436 | strWID.val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wep.u8Wepidx)); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2437 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2438 | |
| 2439 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 2440 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2441 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2442 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2443 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2444 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2445 | break; |
| 2446 | |
| 2447 | case WPARxGtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2448 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2449 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2450 | if (pu8keybuf == NULL) { |
| 2451 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2452 | ret = -1; |
| 2453 | goto _WPARxGtk_end_case_; |
| 2454 | } |
| 2455 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2456 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2457 | |
| 2458 | |
| 2459 | /*|----------------------------------------------------------------------------| |
| 2460 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2461 | * |------------|---------|-------|------------|---------------|----------------| |
| 2462 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2463 | |
| 2464 | |
| 2465 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2466 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq != NULL) |
| 2467 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2468 | |
| 2469 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2470 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2471 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2472 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2473 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2474 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key, |
| 2475 | pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2476 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2477 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2478 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2479 | strWIDList[0].size = sizeof(char); |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2480 | strWIDList[0].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2481 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2482 | strWIDList[1].id = (u16)WID_ADD_RX_GTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2483 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2484 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2485 | strWIDList[1].size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2486 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2487 | s32Error = send_config_pkt(SET_CFG, strWIDList, 2, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2488 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2489 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2490 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2491 | |
| 2492 | /* ////////////////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2493 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2494 | /* ///////////////////////// */ |
| 2495 | } |
| 2496 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2497 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2498 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 2499 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2500 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2501 | if (pu8keybuf == NULL) { |
| 2502 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2503 | ret = -1; |
| 2504 | goto _WPARxGtk_end_case_; |
| 2505 | } |
| 2506 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2507 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2508 | |
| 2509 | |
| 2510 | /*|----------------------------------------------------------------------------| |
| 2511 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2512 | * |------------|---------|-------|------------|---------------|----------------| |
| 2513 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2514 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2515 | if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) |
| 2516 | memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2517 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2518 | 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] | 2519 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2520 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2521 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2522 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2523 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2524 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1); |
| 2525 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key, |
| 2526 | pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2527 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2528 | strWID.id = (u16)WID_ADD_RX_GTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2529 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2530 | strWID.val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2531 | strWID.size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2532 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2533 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2534 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2535 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2536 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2537 | |
| 2538 | /* ////////////////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2539 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2540 | /* ///////////////////////// */ |
| 2541 | } |
| 2542 | _WPARxGtk_end_case_: |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2543 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key); |
| 2544 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8seq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2545 | if (ret == -1) |
| 2546 | return ret; |
| 2547 | |
| 2548 | break; |
| 2549 | |
| 2550 | case WPAPtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2551 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2552 | |
| 2553 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2554 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2555 | |
| 2556 | |
| 2557 | |
| 2558 | if (pu8keybuf == NULL) { |
| 2559 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2560 | ret = -1; |
| 2561 | goto _WPAPtk_end_case_; |
| 2562 | |
| 2563 | } |
| 2564 | |
| 2565 | /*|-----------------------------------------------------------------------------| |
| 2566 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2567 | * |----------------|------------ |--------------|----------------|---------------| |
| 2568 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2569 | |-----------------------------------------------------------------------------|*/ |
| 2570 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2571 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2572 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2573 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8keyidx, 1); |
| 2574 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2575 | /*16 byte TK*/ |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2576 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key, |
| 2577 | pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2578 | |
| 2579 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2580 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2581 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2582 | strWIDList[0].size = sizeof(char); |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2583 | strWIDList[0].val = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2584 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2585 | strWIDList[1].id = (u16)WID_ADD_PTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2586 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2587 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2588 | strWIDList[1].size = PTK_KEY_MSG_LEN + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2589 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2590 | s32Error = send_config_pkt(SET_CFG, strWIDList, 2, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2591 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2592 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2593 | |
| 2594 | /* ////////////////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2595 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2596 | /* ///////////////////////// */ |
| 2597 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2598 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2599 | |
| 2600 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2601 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2602 | |
| 2603 | |
| 2604 | |
| 2605 | if (pu8keybuf == NULL) { |
| 2606 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2607 | ret = -1; |
| 2608 | goto _WPAPtk_end_case_; |
| 2609 | |
| 2610 | } |
| 2611 | |
| 2612 | /*|-----------------------------------------------------------------------------| |
| 2613 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2614 | * |----------------|------------|--------------|----------------|---------------| |
| 2615 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2616 | |-----------------------------------------------------------------------------|*/ |
| 2617 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2618 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2619 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2620 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2621 | /*16 byte TK*/ |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2622 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key, |
| 2623 | pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.u8Keylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2624 | |
| 2625 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2626 | strWID.id = (u16)WID_ADD_PTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2627 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2628 | strWID.val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2629 | strWID.size = PTK_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2630 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2631 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2632 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2633 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2634 | |
| 2635 | /* ////////////////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2636 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2637 | /* ///////////////////////// */ |
| 2638 | } |
| 2639 | |
| 2640 | _WPAPtk_end_case_: |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 2641 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.wpa.pu8key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2642 | if (ret == -1) |
| 2643 | return ret; |
| 2644 | |
| 2645 | break; |
| 2646 | |
| 2647 | |
| 2648 | case PMKSA: |
| 2649 | |
| 2650 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 2651 | |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 2652 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2653 | if (pu8keybuf == NULL) { |
| 2654 | PRINT_ER("No buffer to send PMKSA Key\n"); |
| 2655 | return -1; |
| 2656 | } |
| 2657 | |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 2658 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2659 | |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 2660 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid; i++) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2661 | |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 2662 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.pmkidlist[i].bssid, ETH_ALEN); |
| 2663 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2664 | } |
| 2665 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2666 | strWID.id = (u16)WID_PMKID_INFO; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2667 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2668 | strWID.val = (s8 *)pu8keybuf; |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 2669 | strWID.size = (pstrHostIFkeyAttr->uniHostIFkeyAttr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2670 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2671 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2672 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2673 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2674 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2675 | break; |
| 2676 | } |
| 2677 | |
| 2678 | if (s32Error) |
| 2679 | PRINT_ER("Failed to send key config packet\n"); |
| 2680 | |
| 2681 | |
| 2682 | return s32Error; |
| 2683 | } |
| 2684 | |
| 2685 | |
| 2686 | /** |
| 2687 | * @brief Handle_Disconnect |
| 2688 | * @details Sending config packet to firmware to disconnect |
| 2689 | * @param[in] NONE |
| 2690 | * @return NONE |
| 2691 | * @author |
| 2692 | * @date |
| 2693 | * @version 1.0 |
| 2694 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2695 | static void Handle_Disconnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2696 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2697 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2698 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2699 | s32 s32Error = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2700 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2701 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2702 | strWID.id = (u16)WID_DISCONNECT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2703 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2704 | strWID.val = (s8 *)&u16DummyReasonCode; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2705 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2706 | |
| 2707 | |
| 2708 | |
| 2709 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 2710 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2711 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2712 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2713 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 2714 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2715 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2716 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2717 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2718 | |
| 2719 | if (s32Error) { |
| 2720 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2721 | } else { |
| 2722 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 2723 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2724 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2725 | |
| 2726 | strDisconnectNotifInfo.u16reason = 0; |
| 2727 | strDisconnectNotifInfo.ie = NULL; |
| 2728 | strDisconnectNotifInfo.ie_len = 0; |
| 2729 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2730 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2731 | del_timer(&hif_drv->hScanTimer); |
| 2732 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
| 2733 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2734 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2735 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2736 | } |
| 2737 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2738 | if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2739 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2740 | /*Stop connect timer, if connection in progress*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2741 | if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2742 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2743 | del_timer(&hif_drv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2744 | } |
| 2745 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2746 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 2747 | 0, &strDisconnectNotifInfo, hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2748 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2749 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2750 | } |
| 2751 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2752 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2753 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2754 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2755 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2756 | eth_zero_addr(hif_drv->au8AssociatedBSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2757 | |
| 2758 | |
| 2759 | /* Deallocation */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2760 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 2761 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 2762 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 2763 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2764 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2765 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2766 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2767 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2768 | gu8FlushedJoinReq = NULL; |
| 2769 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2770 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == hif_drv) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2771 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2772 | gu8FlushedInfoElemAsoc = NULL; |
| 2773 | } |
| 2774 | |
| 2775 | } |
| 2776 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2777 | /* ////////////////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2778 | up(&hif_drv->hSemTestDisconnectBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2779 | /* ///////////////////////// */ |
| 2780 | |
| 2781 | } |
| 2782 | |
| 2783 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2784 | void resolve_disconnect_aberration(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2785 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2786 | if (!hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2787 | return; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2788 | if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (hif_drv->enuHostIFstate == HOST_IF_CONNECTING)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2789 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2790 | host_int_disconnect(hif_drv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2791 | } |
| 2792 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2793 | |
| 2794 | /** |
| 2795 | * @brief Handle_GetChnl |
| 2796 | * @details Sending config packet to get channel |
| 2797 | * @param[in] NONE |
| 2798 | * @return NONE |
| 2799 | * |
| 2800 | * @author |
| 2801 | * @date |
| 2802 | * @version 1.0 |
| 2803 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2804 | static s32 Handle_GetChnl(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2805 | { |
| 2806 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2807 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2808 | struct wid strWID; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2809 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2810 | strWID.id = (u16)WID_CURRENT_CHANNEL; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2811 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2812 | strWID.val = (s8 *)&gu8Chnl; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2813 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2814 | |
| 2815 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 2816 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2817 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2818 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2819 | /*get the value by searching the local copy*/ |
| 2820 | if (s32Error) { |
| 2821 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2822 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2823 | } |
| 2824 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2825 | up(&hif_drv->hSemGetCHNL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2826 | |
| 2827 | return s32Error; |
| 2828 | |
| 2829 | |
| 2830 | |
| 2831 | } |
| 2832 | |
| 2833 | |
| 2834 | /** |
| 2835 | * @brief Handle_GetRssi |
| 2836 | * @details Sending config packet to get RSSI |
| 2837 | * @param[in] NONE |
| 2838 | * @return NONE |
| 2839 | * @author |
| 2840 | * @date |
| 2841 | * @version 1.0 |
| 2842 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2843 | static void Handle_GetRssi(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2844 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2845 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2846 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2847 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2848 | strWID.id = (u16)WID_RSSI; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2849 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2850 | strWID.val = &gs8Rssi; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2851 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2852 | |
| 2853 | /*Sending Cfg*/ |
| 2854 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 2855 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2856 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2857 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2858 | if (s32Error) { |
| 2859 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2860 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2861 | } |
| 2862 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2863 | up(&hif_drv->hSemGetRSSI); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2864 | |
| 2865 | |
| 2866 | } |
| 2867 | |
| 2868 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2869 | static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2870 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2871 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2872 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2873 | |
| 2874 | gs8lnkspd = 0; |
| 2875 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2876 | strWID.id = (u16)WID_LINKSPEED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2877 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2878 | strWID.val = &gs8lnkspd; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2879 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2880 | /*Sending Cfg*/ |
| 2881 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 2882 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2883 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2884 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2885 | if (s32Error) { |
| 2886 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2887 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2888 | } |
| 2889 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2890 | up(&(hif_drv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2891 | |
| 2892 | |
| 2893 | } |
| 2894 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2895 | s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2896 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2897 | struct wid strWIDList[5]; |
Chaehyun Lim | fbc2fe1 | 2015-09-15 14:06:16 +0900 | [diff] [blame] | 2898 | u32 u32WidsCount = 0, s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2899 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2900 | strWIDList[u32WidsCount].id = WID_LINKSPEED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2901 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2902 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2903 | strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2904 | u32WidsCount++; |
| 2905 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2906 | strWIDList[u32WidsCount].id = WID_RSSI; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2907 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2908 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2909 | strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->s8RSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2910 | u32WidsCount++; |
| 2911 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2912 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2913 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2914 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2915 | strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u32TxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2916 | u32WidsCount++; |
| 2917 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2918 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2919 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2920 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2921 | strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u32RxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2922 | u32WidsCount++; |
| 2923 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2924 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2925 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2926 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2927 | strWIDList[u32WidsCount].val = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2928 | u32WidsCount++; |
| 2929 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2930 | s32Error = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2931 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2932 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2933 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2934 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2935 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2936 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2937 | return 0; |
| 2938 | |
| 2939 | } |
| 2940 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2941 | /** |
| 2942 | * @brief Handle_Get_InActiveTime |
| 2943 | * @details Sending config packet to set mac adddress for station and |
| 2944 | * get inactive time |
| 2945 | * @param[in] NONE |
| 2946 | * @return NONE |
| 2947 | * |
| 2948 | * @author |
| 2949 | * @date |
| 2950 | * @version 1.0 |
| 2951 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2952 | static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 2953 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2954 | { |
| 2955 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2956 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2957 | u8 *stamac; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2958 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2959 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2960 | strWID.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2961 | strWID.type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2962 | strWID.size = ETH_ALEN; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2963 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2964 | |
| 2965 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2966 | stamac = strWID.val; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2967 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2968 | |
| 2969 | |
| 2970 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 2971 | |
| 2972 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2973 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2974 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2975 | /*get the value by searching the local copy*/ |
| 2976 | if (s32Error) { |
| 2977 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2978 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2979 | } |
| 2980 | |
| 2981 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2982 | strWID.id = (u16)WID_GET_INACTIVE_TIME; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2983 | strWID.type = WID_INT; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 2984 | strWID.val = (s8 *)&gu32InactiveTime; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2985 | strWID.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2986 | |
| 2987 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 2988 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2989 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2990 | /*get the value by searching the local copy*/ |
| 2991 | if (s32Error) { |
| 2992 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2993 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2994 | } |
| 2995 | |
| 2996 | |
| 2997 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); |
| 2998 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2999 | up(&hif_drv->hSemInactiveTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3000 | |
| 3001 | return s32Error; |
| 3002 | |
| 3003 | |
| 3004 | |
| 3005 | } |
| 3006 | |
| 3007 | |
| 3008 | /** |
| 3009 | * @brief Handle_AddBeacon |
| 3010 | * @details Sending config packet to add beacon |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 3011 | * @param[in] struct beacon_attr *pstrSetBeaconParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3012 | * @return NONE |
| 3013 | * @author |
| 3014 | * @date |
| 3015 | * @version 1.0 |
| 3016 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3017 | static void Handle_AddBeacon(struct host_if_drv *hif_drv, |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 3018 | struct beacon_attr *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3019 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3020 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3021 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3022 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3023 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3024 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 3025 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3026 | strWID.id = (u16)WID_ADD_BEACON; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3027 | strWID.type = WID_BIN; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3028 | strWID.size = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3029 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
| 3030 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3031 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3032 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3033 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3034 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); |
| 3035 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); |
| 3036 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); |
| 3037 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); |
| 3038 | |
| 3039 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); |
| 3040 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); |
| 3041 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); |
| 3042 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); |
| 3043 | |
| 3044 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); |
| 3045 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); |
| 3046 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); |
| 3047 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); |
| 3048 | |
| 3049 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); |
| 3050 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; |
| 3051 | |
| 3052 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); |
| 3053 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); |
| 3054 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); |
| 3055 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); |
| 3056 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3057 | if (pstrSetBeaconParam->pu8Tail > 0) |
| 3058 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); |
| 3059 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; |
| 3060 | |
| 3061 | |
| 3062 | |
| 3063 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3064 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3065 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3066 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3067 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3068 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3069 | ERRORHANDLER: |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3070 | kfree(strWID.val); |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3071 | kfree(pstrSetBeaconParam->pu8Head); |
| 3072 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3073 | } |
| 3074 | |
| 3075 | |
| 3076 | /** |
| 3077 | * @brief Handle_AddBeacon |
| 3078 | * @details Sending config packet to delete beacon |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 3079 | * @param[in] struct host_if_drv *drvHandler |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3080 | * @return NONE |
| 3081 | * @author |
| 3082 | * @date |
| 3083 | * @version 1.0 |
| 3084 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3085 | static void Handle_DelBeacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3086 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3087 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3088 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3089 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3090 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3091 | strWID.id = (u16)WID_DEL_BEACON; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3092 | strWID.type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3093 | strWID.size = sizeof(char); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3094 | strWID.val = &gu8DelBcn; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3095 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3096 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3097 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3098 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3099 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3100 | |
| 3101 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
| 3102 | /* TODO: build del beacon message*/ |
| 3103 | |
| 3104 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3105 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3106 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3107 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3108 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3109 | } |
| 3110 | |
| 3111 | |
| 3112 | /** |
| 3113 | * @brief WILC_HostIf_PackStaParam |
| 3114 | * @details Handling packing of the station params in a buffer |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3115 | * @param[in] u8* pu8Buffer, struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3116 | * @return NONE |
| 3117 | * @author |
| 3118 | * @date |
| 3119 | * @version 1.0 |
| 3120 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3121 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 3122 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3123 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3124 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3125 | |
| 3126 | pu8CurrByte = pu8Buffer; |
| 3127 | |
| 3128 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3129 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3130 | pu8CurrByte += ETH_ALEN; |
| 3131 | |
| 3132 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 3133 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 3134 | |
| 3135 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3136 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3137 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3138 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 3139 | |
| 3140 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 3141 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 3142 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 3143 | |
| 3144 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3145 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3146 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 3147 | |
| 3148 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 3149 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 3150 | |
| 3151 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 3152 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 3153 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 3154 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 3155 | |
| 3156 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 3157 | |
| 3158 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 3159 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 3160 | |
| 3161 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 3162 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 3163 | |
| 3164 | return pu8CurrByte - pu8Buffer; |
| 3165 | } |
| 3166 | |
| 3167 | /** |
| 3168 | * @brief Handle_AddStation |
| 3169 | * @details Sending config packet to add station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3170 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3171 | * @return NONE |
| 3172 | * @author |
| 3173 | * @date |
| 3174 | * @version 1.0 |
| 3175 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3176 | static void Handle_AddStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3177 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3178 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3179 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3180 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3181 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3182 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3183 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3184 | strWID.id = (u16)WID_ADD_STA; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3185 | strWID.type = WID_BIN; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3186 | strWID.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3187 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3188 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
| 3189 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3190 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3191 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3192 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3193 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3194 | |
| 3195 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3196 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3197 | get_id_from_handler(hif_drv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3198 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3199 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3200 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3201 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3202 | kfree(pstrStationParam->pu8Rates); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3203 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3204 | } |
| 3205 | |
| 3206 | /** |
| 3207 | * @brief Handle_DelAllSta |
| 3208 | * @details Sending config packet to delete station |
| 3209 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3210 | * @return NONE |
| 3211 | * @author |
| 3212 | * @date |
| 3213 | * @version 1.0 |
| 3214 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3215 | static void Handle_DelAllSta(struct host_if_drv *hif_drv, |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 3216 | struct del_all_sta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3217 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3218 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3219 | |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3220 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3221 | u8 *pu8CurrByte; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3222 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 3223 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3224 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3225 | strWID.id = (u16)WID_DEL_ALL_STA; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3226 | strWID.type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3227 | strWID.size = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3228 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3229 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3230 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3231 | strWID.val = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL); |
| 3232 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3233 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3234 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3235 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3236 | |
| 3237 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; |
| 3238 | |
| 3239 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 3240 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3241 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3242 | else |
| 3243 | continue; |
| 3244 | |
| 3245 | pu8CurrByte += ETH_ALEN; |
| 3246 | } |
| 3247 | |
| 3248 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3249 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3250 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3251 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3252 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3253 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3254 | ERRORHANDLER: |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3255 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3256 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3257 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3258 | } |
| 3259 | |
| 3260 | |
| 3261 | /** |
| 3262 | * @brief Handle_DelStation |
| 3263 | * @details Sending config packet to delete station |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 3264 | * @param[in] struct del_sta *pstrDelStaParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3265 | * @return NONE |
| 3266 | * @author |
| 3267 | * @date |
| 3268 | * @version 1.0 |
| 3269 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3270 | static void Handle_DelStation(struct host_if_drv *hif_drv, |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 3271 | struct del_sta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3272 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3273 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3274 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3275 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3276 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3277 | strWID.id = (u16)WID_REMOVE_STA; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3278 | strWID.type = WID_BIN; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3279 | strWID.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3280 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3281 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3282 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3283 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
| 3284 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3285 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3286 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3287 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3288 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3289 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3290 | |
| 3291 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3292 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3293 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3294 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3295 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3296 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3297 | ERRORHANDLER: |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3298 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3299 | } |
| 3300 | |
| 3301 | |
| 3302 | /** |
| 3303 | * @brief Handle_EditStation |
| 3304 | * @details Sending config packet to edit station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3305 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3306 | * @return NONE |
| 3307 | * @author |
| 3308 | * @date |
| 3309 | * @version 1.0 |
| 3310 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3311 | static void Handle_EditStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3312 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3313 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3314 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3315 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3316 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3317 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3318 | strWID.id = (u16)WID_EDIT_STA; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3319 | strWID.type = WID_BIN; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3320 | strWID.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3321 | |
| 3322 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3323 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
| 3324 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3325 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3326 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3327 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3328 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3329 | |
| 3330 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3331 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3332 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3333 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3334 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3335 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3336 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3337 | kfree(pstrStationParam->pu8Rates); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3338 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3339 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3340 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3341 | /** |
| 3342 | * @brief Handle_RemainOnChan |
| 3343 | * @details Sending config packet to edit station |
| 3344 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3345 | * @return NONE |
| 3346 | * @author |
| 3347 | * @date |
| 3348 | * @version 1.0 |
| 3349 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3350 | static int Handle_RemainOnChan(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 3351 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3352 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3353 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3354 | u8 u8remain_on_chan_flag; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3355 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3356 | |
| 3357 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3358 | if (!hif_drv->u8RemainOnChan_pendingreq) { |
| 3359 | hif_drv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 3360 | hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 3361 | hif_drv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 3362 | hif_drv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 3363 | hif_drv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3364 | } else { |
| 3365 | /*Set the channel to use it as a wid val*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3366 | pstrHostIfRemainOnChan->u16Channel = hif_drv->strHostIfRemainOnChan.u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3367 | } |
| 3368 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3369 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3370 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3371 | hif_drv->u8RemainOnChan_pendingreq = 1; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3372 | s32Error = -EBUSY; |
| 3373 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3374 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3375 | if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3376 | 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] | 3377 | s32Error = -EBUSY; |
| 3378 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3379 | } |
| 3380 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3381 | if (g_obtainingIP || connecting) { |
| 3382 | 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] | 3383 | s32Error = -EBUSY; |
| 3384 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3385 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3386 | |
| 3387 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 3388 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3389 | u8remain_on_chan_flag = true; |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3390 | strWID.id = (u16)WID_REMAIN_ON_CHAN; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3391 | strWID.type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3392 | strWID.size = 2; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3393 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3394 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3395 | if (strWID.val == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3396 | s32Error = -ENOMEM; |
| 3397 | goto ERRORHANDLER; |
| 3398 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3399 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3400 | strWID.val[0] = u8remain_on_chan_flag; |
| 3401 | strWID.val[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3402 | |
| 3403 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3404 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3405 | get_id_from_handler(hif_drv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3406 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3407 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3408 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3409 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3410 | { |
| 3411 | P2P_LISTEN_STATE = 1; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3412 | hif_drv->hRemainOnChannel.data = (unsigned long)hif_drv; |
| 3413 | mod_timer(&hif_drv->hRemainOnChannel, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3414 | jiffies + |
| 3415 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3416 | |
| 3417 | /*Calling CFG ready_on_channel*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3418 | if (hif_drv->strHostIfRemainOnChan.pRemainOnChanReady) |
| 3419 | hif_drv->strHostIfRemainOnChan.pRemainOnChanReady(hif_drv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3420 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3421 | if (hif_drv->u8RemainOnChan_pendingreq) |
| 3422 | hif_drv->u8RemainOnChan_pendingreq = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3423 | } |
| 3424 | return s32Error; |
| 3425 | } |
| 3426 | |
| 3427 | /** |
| 3428 | * @brief Handle_RegisterFrame |
| 3429 | * @details |
| 3430 | * @param[in] |
| 3431 | * @return NONE |
| 3432 | * @author |
| 3433 | * @date |
| 3434 | * @version 1.0 |
| 3435 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3436 | static int Handle_RegisterFrame(struct host_if_drv *hif_drv, |
Tony Cho | bc37c5d | 2015-09-21 12:16:59 +0900 | [diff] [blame] | 3437 | struct reg_frame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3438 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3439 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3440 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3441 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3442 | |
| 3443 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 3444 | |
| 3445 | /*prepare configuration packet*/ |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3446 | strWID.id = (u16)WID_REGISTER_FRAME; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3447 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3448 | strWID.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
| 3449 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3450 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3451 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3452 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3453 | |
| 3454 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 3455 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3456 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3457 | |
| 3458 | |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3459 | strWID.size = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3460 | |
| 3461 | |
| 3462 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3463 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3464 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3465 | if (s32Error) { |
| 3466 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3467 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3468 | } |
| 3469 | |
| 3470 | return s32Error; |
| 3471 | |
| 3472 | } |
| 3473 | |
| 3474 | /** |
| 3475 | * @brief Handle_ListenStateExpired |
| 3476 | * @details Handle of listen state expiration |
| 3477 | * @param[in] NONE |
| 3478 | * @return Error code. |
| 3479 | * @author |
| 3480 | * @date |
| 3481 | * @version 1.0 |
| 3482 | */ |
| 3483 | #define FALSE_FRMWR_CHANNEL 100 |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3484 | static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 3485 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3486 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3487 | u8 u8remain_on_chan_flag; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3488 | struct wid strWID; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3489 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3490 | |
| 3491 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 3492 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3493 | /*Make sure we are already in listen state*/ |
| 3494 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ |
| 3495 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3496 | u8remain_on_chan_flag = false; |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3497 | strWID.id = (u16)WID_REMAIN_ON_CHAN; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3498 | strWID.type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3499 | strWID.size = 2; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3500 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3501 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3502 | if (strWID.val == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3503 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3504 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3505 | strWID.val[0] = u8remain_on_chan_flag; |
| 3506 | strWID.val[1] = FALSE_FRMWR_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3507 | |
| 3508 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3509 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3510 | get_id_from_handler(hif_drv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3511 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3512 | PRINT_ER("Failed to set remain on channel\n"); |
| 3513 | goto _done_; |
| 3514 | } |
| 3515 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3516 | if (hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 3517 | hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired(hif_drv->strHostIfRemainOnChan.pVoid |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3518 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 3519 | } |
| 3520 | P2P_LISTEN_STATE = 0; |
| 3521 | } else { |
| 3522 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3523 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3524 | } |
| 3525 | |
| 3526 | _done_: |
| 3527 | return s32Error; |
| 3528 | } |
| 3529 | |
| 3530 | |
| 3531 | /** |
| 3532 | * @brief ListenTimerCB |
| 3533 | * @details Callback function of remain-on-channel timer |
| 3534 | * @param[in] NONE |
| 3535 | * @return Error code. |
| 3536 | * @author |
| 3537 | * @date |
| 3538 | * @version 1.0 |
| 3539 | */ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3540 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3541 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3542 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3543 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3544 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3545 | /*Stopping remain-on-channel timer*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3546 | del_timer(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3547 | |
| 3548 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3549 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3550 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3551 | msg.drv = hif_drv; |
| 3552 | msg.body.remain_on_ch.u32ListenSessionID = hif_drv->strHostIfRemainOnChan.u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3553 | |
| 3554 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3555 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3556 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3557 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3558 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3559 | |
| 3560 | /** |
| 3561 | * @brief Handle_EditStation |
| 3562 | * @details Sending config packet to edit station |
| 3563 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3564 | * @return NONE |
| 3565 | * @author |
| 3566 | * @date |
| 3567 | * @version 1.0 |
| 3568 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3569 | static void Handle_PowerManagement(struct host_if_drv *hif_drv, |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 3570 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3571 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3572 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3573 | struct wid strWID; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3574 | s8 s8PowerMode; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3575 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3576 | strWID.id = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3577 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3578 | if (strPowerMgmtParam->bIsEnabled == true) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3579 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3580 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3581 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3582 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3583 | strWID.val = &s8PowerMode; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3584 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3585 | |
| 3586 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 3587 | |
| 3588 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3589 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3590 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3591 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3592 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3593 | } |
| 3594 | |
| 3595 | /** |
| 3596 | * @brief Handle_SetMulticastFilter |
| 3597 | * @details Set Multicast filter in firmware |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3598 | * @param[in] struct set_multicast *strHostIfSetMulti |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3599 | * @return NONE |
| 3600 | * @author asobhy |
| 3601 | * @date |
| 3602 | * @version 1.0 |
| 3603 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3604 | static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3605 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3606 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3607 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3608 | struct wid strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3609 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3610 | |
| 3611 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 3612 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3613 | strWID.id = (u16)WID_SETUP_MULTICAST_FILTER; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3614 | strWID.type = WID_BIN; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3615 | strWID.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->u32count) * ETH_ALEN); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3616 | strWID.val = kmalloc(strWID.size, GFP_KERNEL); |
| 3617 | if (strWID.val == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3618 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3619 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3620 | pu8CurrByte = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3621 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); |
| 3622 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); |
| 3623 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); |
| 3624 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); |
| 3625 | |
| 3626 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); |
| 3627 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); |
| 3628 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); |
| 3629 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); |
| 3630 | |
| 3631 | if ((strHostIfSetMulti->u32count) > 0) |
| 3632 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); |
| 3633 | |
| 3634 | /*Sending Cfg*/ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3635 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3636 | get_id_from_handler(hif_drv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3637 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3638 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3639 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3640 | ERRORHANDLER: |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3641 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3642 | |
| 3643 | } |
| 3644 | |
| 3645 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3646 | /** |
| 3647 | * @brief Handle_AddBASession |
| 3648 | * @details Add block ack session |
| 3649 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 3650 | * @return NONE |
| 3651 | * @author Amr Abdel-Moghny |
| 3652 | * @date Feb. 2014 |
| 3653 | * @version 9.0 |
| 3654 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3655 | static s32 Handle_AddBASession(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 3656 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3657 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3658 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3659 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3660 | int AddbaTimeout = 100; |
| 3661 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3662 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3663 | 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] | 3664 | strHostIfBASessionInfo->au8Bssid[0], |
| 3665 | strHostIfBASessionInfo->au8Bssid[1], |
| 3666 | strHostIfBASessionInfo->au8Bssid[2], |
| 3667 | strHostIfBASessionInfo->u16BufferSize, |
| 3668 | strHostIfBASessionInfo->u16SessionTimeout, |
| 3669 | strHostIfBASessionInfo->u8Ted); |
| 3670 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3671 | strWID.id = (u16)WID_11E_P_ACTION_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3672 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3673 | strWID.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3674 | strWID.size = BLOCK_ACK_REQ_SIZE; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3675 | ptr = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3676 | /* *ptr++ = 0x14; */ |
| 3677 | *ptr++ = 0x14; |
| 3678 | *ptr++ = 0x3; |
| 3679 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3680 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3681 | ptr += ETH_ALEN; |
| 3682 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3683 | /* BA Policy*/ |
| 3684 | *ptr++ = 1; |
| 3685 | /* Buffer size*/ |
| 3686 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 3687 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
| 3688 | /* BA timeout*/ |
| 3689 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 3690 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 3691 | /* ADDBA timeout*/ |
| 3692 | *ptr++ = (AddbaTimeout & 0xFF); |
| 3693 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
| 3694 | /* Group Buffer Max Frames*/ |
| 3695 | *ptr++ = 8; |
| 3696 | /* Group Buffer Timeout */ |
| 3697 | *ptr++ = 0; |
| 3698 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3699 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3700 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3701 | if (s32Error) |
| 3702 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 3703 | |
| 3704 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3705 | strWID.id = (u16)WID_11E_P_ACTION_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3706 | strWID.type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3707 | strWID.size = 15; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3708 | ptr = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3709 | /* *ptr++ = 0x14; */ |
| 3710 | *ptr++ = 15; |
| 3711 | *ptr++ = 7; |
| 3712 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3713 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3714 | ptr += ETH_ALEN; |
| 3715 | /* TID*/ |
| 3716 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3717 | /* Max Num MSDU */ |
| 3718 | *ptr++ = 8; |
| 3719 | /* BA timeout*/ |
| 3720 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 3721 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 3722 | /*Ack-Policy */ |
| 3723 | *ptr++ = 3; |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3724 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3725 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3726 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3727 | if (strWID.val != NULL) |
| 3728 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3729 | |
| 3730 | return s32Error; |
| 3731 | |
| 3732 | } |
| 3733 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3734 | /** |
| 3735 | * @brief Handle_DelAllRxBASessions |
| 3736 | * @details Delete all Rx BA sessions |
| 3737 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 3738 | * @return NONE |
| 3739 | * @author Abdelrahman Sobhy |
| 3740 | * @date Feb. 2013 |
| 3741 | * @version 9.0 |
| 3742 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3743 | static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 3744 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3745 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3746 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 3747 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3748 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3749 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3750 | 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] | 3751 | strHostIfBASessionInfo->au8Bssid[0], |
| 3752 | strHostIfBASessionInfo->au8Bssid[1], |
| 3753 | strHostIfBASessionInfo->au8Bssid[2], |
| 3754 | strHostIfBASessionInfo->u8Ted); |
| 3755 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 3756 | strWID.id = (u16)WID_DEL_ALL_RX_BA; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 3757 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3758 | strWID.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 3759 | strWID.size = BLOCK_ACK_REQ_SIZE; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3760 | ptr = strWID.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3761 | *ptr++ = 0x14; |
| 3762 | *ptr++ = 0x3; |
| 3763 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3764 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3765 | ptr += ETH_ALEN; |
| 3766 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3767 | /* BA direction = recipent*/ |
| 3768 | *ptr++ = 0; |
| 3769 | /* Delba Reason */ |
| 3770 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 3771 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 3772 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3773 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3774 | if (s32Error) |
| 3775 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 3776 | |
| 3777 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 3778 | if (strWID.val != NULL) |
| 3779 | kfree(strWID.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3780 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3781 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3782 | |
| 3783 | return s32Error; |
| 3784 | |
| 3785 | } |
| 3786 | |
| 3787 | /** |
| 3788 | * @brief hostIFthread |
| 3789 | * @details Main thread to handle message queue requests |
| 3790 | * @param[in] void* pvArg |
| 3791 | * @return NONE |
| 3792 | * @author |
| 3793 | * @date |
| 3794 | * @version 1.0 |
| 3795 | */ |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 3796 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3797 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3798 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3799 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3800 | struct host_if_drv *hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3801 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3802 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3803 | |
| 3804 | while (1) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3805 | wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), &u32Ret); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3806 | hif_drv = (struct host_if_drv *)msg.drv; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3807 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3808 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 3809 | break; |
| 3810 | } |
| 3811 | |
| 3812 | |
| 3813 | /*Re-Queue HIF message*/ |
| 3814 | if ((!g_wilc_initialized)) { |
| 3815 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 3816 | usleep_range(200 * 1000, 200 * 1000); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3817 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3818 | continue; |
| 3819 | } |
| 3820 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3821 | if (msg.id == HOST_IF_MSG_CONNECT && hif_drv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3822 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3823 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 3824 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3825 | continue; |
| 3826 | } |
| 3827 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3828 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3829 | case HOST_IF_MSG_Q_IDLE: |
| 3830 | Handle_wait_msg_q_empty(); |
| 3831 | break; |
| 3832 | |
| 3833 | case HOST_IF_MSG_SCAN: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3834 | Handle_Scan(msg.drv, &msg.body.scan_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3835 | break; |
| 3836 | |
| 3837 | case HOST_IF_MSG_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3838 | Handle_Connect(msg.drv, &msg.body.con_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3839 | break; |
| 3840 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3841 | case HOST_IF_MSG_FLUSH_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3842 | Handle_FlushConnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3843 | break; |
| 3844 | |
| 3845 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3846 | Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3847 | break; |
| 3848 | |
| 3849 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3850 | Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3851 | break; |
| 3852 | |
| 3853 | case HOST_IF_MSG_KEY: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3854 | Handle_Key(msg.drv, &msg.body.key_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3855 | break; |
| 3856 | |
| 3857 | case HOST_IF_MSG_CFG_PARAMS: |
| 3858 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3859 | Handle_CfgParam(msg.drv, &msg.body.cfg_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3860 | break; |
| 3861 | |
| 3862 | case HOST_IF_MSG_SET_CHANNEL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3863 | Handle_SetChannel(msg.drv, &msg.body.channel_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3864 | break; |
| 3865 | |
| 3866 | case HOST_IF_MSG_DISCONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3867 | Handle_Disconnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3868 | break; |
| 3869 | |
| 3870 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3871 | del_timer(&hif_drv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3872 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 3873 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3874 | /*Allow chip sleep, only if both interfaces are not connected*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3875 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3876 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3877 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3878 | Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3879 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3880 | if (hif_drv->u8RemainOnChan_pendingreq) |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3881 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3882 | |
| 3883 | break; |
| 3884 | |
| 3885 | case HOST_IF_MSG_GET_RSSI: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3886 | Handle_GetRssi(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3887 | break; |
| 3888 | |
| 3889 | case HOST_IF_MSG_GET_LINKSPEED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3890 | Handle_GetLinkspeed(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3891 | break; |
| 3892 | |
| 3893 | case HOST_IF_MSG_GET_STATISTICS: |
Leo Kim | 03e7b9c | 2015-10-12 16:55:58 +0900 | [diff] [blame] | 3894 | Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3895 | break; |
| 3896 | |
| 3897 | case HOST_IF_MSG_GET_CHNL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3898 | Handle_GetChnl(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3899 | break; |
| 3900 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3901 | case HOST_IF_MSG_ADD_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3902 | Handle_AddBeacon(msg.drv, &msg.body.beacon_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3903 | break; |
| 3904 | |
| 3905 | case HOST_IF_MSG_DEL_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3906 | Handle_DelBeacon(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3907 | break; |
| 3908 | |
| 3909 | case HOST_IF_MSG_ADD_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3910 | Handle_AddStation(msg.drv, &msg.body.add_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3911 | break; |
| 3912 | |
| 3913 | case HOST_IF_MSG_DEL_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3914 | Handle_DelStation(msg.drv, &msg.body.del_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3915 | break; |
| 3916 | |
| 3917 | case HOST_IF_MSG_EDIT_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3918 | Handle_EditStation(msg.drv, &msg.body.edit_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3919 | break; |
| 3920 | |
| 3921 | case HOST_IF_MSG_GET_INACTIVETIME: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3922 | Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3923 | break; |
| 3924 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3925 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 3926 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 3927 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3928 | Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3929 | break; |
| 3930 | |
| 3931 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3932 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3933 | Handle_ConnectTimeout(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3934 | break; |
| 3935 | |
| 3936 | case HOST_IF_MSG_POWER_MGMT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3937 | Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3938 | break; |
| 3939 | |
| 3940 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3941 | Handle_SetWfiDrvHandler(msg.drv, |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 3942 | &msg.body.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3943 | break; |
| 3944 | |
| 3945 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3946 | Handle_SetOperationMode(msg.drv, &msg.body.mode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3947 | break; |
| 3948 | |
| 3949 | case HOST_IF_MSG_SET_IPADDRESS: |
| 3950 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3951 | Handle_set_IPAddress(msg.drv, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3952 | break; |
| 3953 | |
| 3954 | case HOST_IF_MSG_GET_IPADDRESS: |
| 3955 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3956 | Handle_get_IPAddress(msg.drv, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3957 | break; |
| 3958 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3959 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3960 | Handle_SetMacAddress(msg.drv, &msg.body.set_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3961 | break; |
| 3962 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3963 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3964 | Handle_GetMacAddress(msg.drv, &msg.body.get_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3965 | break; |
| 3966 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3967 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 3968 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3969 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3970 | break; |
| 3971 | |
| 3972 | case HOST_IF_MSG_REGISTER_FRAME: |
| 3973 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3974 | Handle_RegisterFrame(msg.drv, &msg.body.reg_frame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3975 | break; |
| 3976 | |
| 3977 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3978 | Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3979 | break; |
| 3980 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3981 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 3982 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3983 | Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3984 | break; |
| 3985 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3986 | case HOST_IF_MSG_ADD_BA_SESSION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3987 | Handle_AddBASession(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3988 | break; |
| 3989 | |
| 3990 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3991 | Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3992 | break; |
| 3993 | |
| 3994 | case HOST_IF_MSG_DEL_ALL_STA: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3995 | Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3996 | break; |
| 3997 | |
| 3998 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3999 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4000 | break; |
| 4001 | } |
| 4002 | } |
| 4003 | |
| 4004 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4005 | up(&hSemHostIFthrdEnd); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4006 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4007 | } |
| 4008 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4009 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4010 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4011 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4012 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4013 | |
| 4014 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4015 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 4016 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4017 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4018 | |
| 4019 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4020 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4021 | } |
| 4022 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4023 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4024 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4025 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4026 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4027 | |
| 4028 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4029 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 4030 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4031 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4032 | |
| 4033 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4034 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4035 | } |
| 4036 | |
| 4037 | |
| 4038 | /** |
| 4039 | * @brief removes wpa/wpa2 keys |
| 4040 | * @details only in BSS STA mode if External Supplicant support is enabled. |
| 4041 | * removes all WPA/WPA2 station key entries from MAC hardware. |
| 4042 | * @param[in,out] handle to the wifi driver |
| 4043 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4044 | * @return Error code indicating success/failure |
| 4045 | * @note |
| 4046 | * @author zsalah |
| 4047 | * @date 8 March 2012 |
| 4048 | * @version 1.0 |
| 4049 | */ |
| 4050 | /* Check implementation in core adding 9 bytes to the input! */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4051 | s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4052 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4053 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4054 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4055 | strWID.id = (u16)WID_REMOVE_KEY; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4056 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4057 | strWID.val = (s8 *)pu8StaAddress; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4058 | strWID.size = 6; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4059 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4060 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4061 | } |
| 4062 | |
| 4063 | /** |
| 4064 | * @brief removes WEP key |
| 4065 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4066 | * remove a WEP key entry from MAC HW. |
| 4067 | * The BSS Station automatically finds the index of the entry using its |
| 4068 | * BSS ID and removes that entry from the MAC hardware. |
| 4069 | * @param[in,out] handle to the wifi driver |
| 4070 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4071 | * @return Error code indicating success/failure |
| 4072 | * @note NO need for the STA add since it is not used for processing |
| 4073 | * @author zsalah |
| 4074 | * @date 8 March 2012 |
| 4075 | * @version 1.0 |
| 4076 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4077 | int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4078 | { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 4079 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4080 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4081 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4082 | if (!hif_drv) { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 4083 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4084 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 4085 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4086 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4087 | |
| 4088 | /* prepare the Remove Wep Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4089 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4090 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4091 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4092 | msg.body.key_info.enuKeyType = WEP; |
| 4093 | msg.body.key_info.u8KeyAction = REMOVEKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4094 | msg.drv = hif_drv; |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 4095 | msg.body.key_info.uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4096 | |
| 4097 | /* send the message */ |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 4098 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 4099 | if (result) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4100 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4101 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4102 | |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 4103 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4104 | } |
| 4105 | |
| 4106 | /** |
| 4107 | * @brief sets WEP default key |
| 4108 | * @details Sets the index of the WEP encryption key in use, |
| 4109 | * in the key table |
| 4110 | * @param[in,out] handle to the wifi driver |
| 4111 | * @param[in] key index ( 0, 1, 2, 3) |
| 4112 | * @return Error code indicating success/failure |
| 4113 | * @note |
| 4114 | * @author zsalah |
| 4115 | * @date 8 March 2012 |
| 4116 | * @version 1.0 |
| 4117 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4118 | s32 host_int_set_WEPDefaultKeyID(struct host_if_drv *hif_drv, u8 u8Index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4119 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4120 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4121 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4122 | |
| 4123 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4124 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4125 | s32Error = -EFAULT; |
| 4126 | PRINT_ER("driver is null\n"); |
| 4127 | return s32Error; |
| 4128 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4129 | |
| 4130 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4131 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4132 | |
| 4133 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4134 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4135 | msg.body.key_info.enuKeyType = WEP; |
| 4136 | msg.body.key_info.u8KeyAction = DEFAULTKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4137 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4138 | |
| 4139 | |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 4140 | msg.body.key_info.uniHostIFkeyAttr.wep.u8Wepidx = u8Index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4141 | |
| 4142 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4143 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4144 | if (s32Error) |
| 4145 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4146 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4147 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4148 | return s32Error; |
| 4149 | } |
| 4150 | |
| 4151 | /** |
| 4152 | * @brief sets WEP deafault key |
| 4153 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4154 | * sets WEP key entry into MAC hardware when it receives the |
| 4155 | * corresponding request from NDIS. |
| 4156 | * @param[in,out] handle to the wifi driver |
| 4157 | * @param[in] message containing WEP Key in the following format |
| 4158 | *|---------------------------------------| |
| 4159 | *|Key ID Value | Key Length | Key | |
| 4160 | *|-------------|------------|------------| |
| 4161 | | 1byte | 1byte | Key Length | |
| 4162 | ||---------------------------------------| |
| 4163 | | |
| 4164 | * @return Error code indicating success/failure |
| 4165 | * @note |
| 4166 | * @author zsalah |
| 4167 | * @date 8 March 2012 |
| 4168 | * @version 1.0 |
| 4169 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4170 | s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, |
| 4171 | const u8 *pu8WepKey, |
| 4172 | u8 u8WepKeylen, |
| 4173 | u8 u8Keyidx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4174 | { |
| 4175 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4176 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4177 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4178 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4179 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4180 | s32Error = -EFAULT; |
| 4181 | PRINT_ER("driver is null\n"); |
| 4182 | return s32Error; |
| 4183 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4184 | |
| 4185 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4186 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4187 | |
| 4188 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4189 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4190 | msg.body.key_info.enuKeyType = WEP; |
| 4191 | msg.body.key_info.u8KeyAction = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4192 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4193 | |
| 4194 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4195 | msg.body.key_info. |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 4196 | uniHostIFkeyAttr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4197 | |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 4198 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wep.key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4199 | pu8WepKey, u8WepKeylen); |
| 4200 | |
| 4201 | |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 4202 | msg.body.key_info.uniHostIFkeyAttr.wep.key_len = (u8WepKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4203 | |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 4204 | msg.body.key_info.uniHostIFkeyAttr.wep.u8Wepidx = u8Keyidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4205 | |
| 4206 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4207 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4208 | if (s32Error) |
| 4209 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4210 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4211 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4212 | return s32Error; |
| 4213 | |
| 4214 | } |
| 4215 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4216 | /** |
| 4217 | * |
| 4218 | * @brief host_int_add_wep_key_bss_ap |
| 4219 | * @details valid only in BSS AP mode if External Supplicant support is enabled. |
| 4220 | * sets WEP key entry into MAC hardware when it receives the |
| 4221 | * |
| 4222 | * corresponding request from NDIS. |
| 4223 | * @param[in,out] handle to the wifi driver |
| 4224 | * |
| 4225 | * |
| 4226 | * @return Error code indicating success/failure |
| 4227 | * @note |
| 4228 | * @author mdaftedar |
| 4229 | * @date 28 FEB 2013 |
| 4230 | * @version 1.0 |
| 4231 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4232 | s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, |
| 4233 | const u8 *pu8WepKey, |
| 4234 | u8 u8WepKeylen, |
| 4235 | u8 u8Keyidx, |
| 4236 | u8 u8mode, |
| 4237 | enum AUTHTYPE tenuAuth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4238 | { |
| 4239 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4240 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4241 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4242 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4243 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4244 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4245 | s32Error = -EFAULT; |
| 4246 | PRINT_ER("driver is null\n"); |
| 4247 | return s32Error; |
| 4248 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4249 | |
| 4250 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4251 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4252 | |
| 4253 | if (INFO) { |
| 4254 | for (i = 0; i < u8WepKeylen; i++) |
| 4255 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 4256 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4257 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4258 | msg.body.key_info.enuKeyType = WEP; |
| 4259 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4260 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4261 | |
| 4262 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4263 | msg.body.key_info. |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 4264 | uniHostIFkeyAttr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4265 | |
| 4266 | |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 4267 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wep.key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4268 | pu8WepKey, (u8WepKeylen)); |
| 4269 | |
| 4270 | |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame^] | 4271 | msg.body.key_info.uniHostIFkeyAttr.wep.key_len = (u8WepKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4272 | |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 4273 | msg.body.key_info.uniHostIFkeyAttr.wep.u8Wepidx = u8Keyidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4274 | |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 4275 | msg.body.key_info.uniHostIFkeyAttr.wep.u8mode = u8mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4276 | |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 4277 | msg.body.key_info.uniHostIFkeyAttr.wep.tenuAuth_type = tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4278 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4279 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4280 | |
| 4281 | if (s32Error) |
| 4282 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4283 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4284 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4285 | return s32Error; |
| 4286 | |
| 4287 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4288 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4289 | /** |
| 4290 | * @brief adds ptk Key |
| 4291 | * @details |
| 4292 | * @param[in,out] handle to the wifi driver |
| 4293 | * @param[in] message containing PTK Key in the following format |
| 4294 | *|-----------------------------------------------------------------------------| |
| 4295 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 4296 | *|----------------|------------|--------------|----------------|---------------| |
| 4297 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 4298 | ||-----------------------------------------------------------------------------| |
| 4299 | * @return Error code indicating success/failure |
| 4300 | * @note |
| 4301 | * @author zsalah |
| 4302 | * @date 8 March 2012 |
| 4303 | * @version 1.0 |
| 4304 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4305 | s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, |
| 4306 | u8 u8PtkKeylen, const u8 *mac_addr, |
| 4307 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 4308 | u8 mode, u8 u8Ciphermode, u8 u8Idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4309 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4310 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4311 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4312 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4313 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4314 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4315 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4316 | s32Error = -EFAULT; |
| 4317 | PRINT_ER("driver is null\n"); |
| 4318 | return s32Error; |
| 4319 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4320 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4321 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4322 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4323 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4324 | |
| 4325 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4326 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4327 | |
| 4328 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4329 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4330 | msg.body.key_info.enuKeyType = WPAPtk; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4331 | if (mode == AP_MODE) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4332 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4333 | msg.body.key_info.uniHostIFkeyAttr.wpa.u8keyidx = u8Idx; |
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 | if (mode == STATION_MODE) |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4336 | msg.body.key_info.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4337 | |
| 4338 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4339 | msg.body.key_info. |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4340 | uniHostIFkeyAttr.wpa.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4341 | |
| 4342 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4343 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4344 | pu8Ptk, u8PtkKeylen); |
| 4345 | |
| 4346 | if (pu8RxMic != NULL) { |
| 4347 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4348 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4349 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4350 | if (INFO) { |
| 4351 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 4352 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 4353 | } |
| 4354 | } |
| 4355 | if (pu8TxMic != NULL) { |
| 4356 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4357 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4358 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4359 | if (INFO) { |
| 4360 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 4361 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 4362 | } |
| 4363 | } |
| 4364 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4365 | msg.body.key_info.uniHostIFkeyAttr.wpa.u8Keylen = u8KeyLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4366 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4367 | msg.body.key_info.uniHostIFkeyAttr.wpa.u8Ciphermode = u8Ciphermode; |
| 4368 | msg.body.key_info.uniHostIFkeyAttr.wpa.pu8macaddr = mac_addr; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4369 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4370 | |
| 4371 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4372 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4373 | |
| 4374 | if (s32Error) |
| 4375 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 4376 | |
| 4377 | /* ////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4378 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4379 | /* /////// */ |
| 4380 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4381 | return s32Error; |
| 4382 | } |
| 4383 | |
| 4384 | /** |
| 4385 | * @brief adds Rx GTk Key |
| 4386 | * @details |
| 4387 | * @param[in,out] handle to the wifi driver |
| 4388 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic |
| 4389 | * u8GtkKeylen :The total key length |
| 4390 | * |
| 4391 | * @return Error code indicating success/failure |
| 4392 | * @note |
| 4393 | * @author zsalah |
| 4394 | * @date 8 March 2012 |
| 4395 | * @version 1.0 |
| 4396 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4397 | s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, |
| 4398 | u8 u8GtkKeylen, u8 u8KeyIdx, |
| 4399 | u32 u32KeyRSClen, const u8 *KeyRSC, |
| 4400 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 4401 | u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4402 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4403 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4404 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4405 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4406 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4407 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4408 | s32Error = -EFAULT; |
| 4409 | PRINT_ER("driver is null\n"); |
| 4410 | return s32Error; |
| 4411 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4412 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4413 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4414 | |
| 4415 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4416 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4417 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4418 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4419 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4420 | if (KeyRSC != NULL) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4421 | msg.body.key_info. |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4422 | uniHostIFkeyAttr.wpa.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4423 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4424 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8seq, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4425 | KeyRSC, u32KeyRSClen); |
| 4426 | } |
| 4427 | |
| 4428 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4429 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4430 | msg.body.key_info.enuKeyType = WPARxGtk; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4431 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4432 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4433 | if (mode == AP_MODE) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4434 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4435 | msg.body.key_info.uniHostIFkeyAttr.wpa.u8Ciphermode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4436 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4437 | if (mode == STATION_MODE) |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4438 | msg.body.key_info.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4439 | |
| 4440 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4441 | msg.body.key_info. |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4442 | uniHostIFkeyAttr.wpa.pu8key = kmalloc(u8KeyLen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4443 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4444 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4445 | pu8RxGtk, u8GtkKeylen); |
| 4446 | |
| 4447 | if (pu8RxMic != NULL) { |
| 4448 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4449 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4450 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4451 | |
| 4452 | } |
| 4453 | if (pu8TxMic != NULL) { |
| 4454 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4455 | memcpy(msg.body.key_info.uniHostIFkeyAttr.wpa.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4456 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4457 | |
| 4458 | } |
| 4459 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4460 | msg.body.key_info.uniHostIFkeyAttr.wpa.u8keyidx = u8KeyIdx; |
| 4461 | msg.body.key_info.uniHostIFkeyAttr.wpa.u8Keylen = u8KeyLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4462 | |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 4463 | msg.body.key_info.uniHostIFkeyAttr.wpa.u8seqlen = u32KeyRSClen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4464 | |
| 4465 | |
| 4466 | |
| 4467 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4468 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4469 | if (s32Error) |
| 4470 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
| 4471 | /* ////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4472 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4473 | /* /////// */ |
| 4474 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4475 | return s32Error; |
| 4476 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4477 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4478 | /** |
| 4479 | * @brief host_int_set_pmkid_info |
| 4480 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant |
| 4481 | * support is enabled. This Function sets the PMKID in firmware |
| 4482 | * when host drivr receives the corresponding request from NDIS. |
| 4483 | * The firmware then includes theset PMKID in the appropriate |
| 4484 | * management frames |
| 4485 | * @param[in,out] handle to the wifi driver |
| 4486 | * @param[in] message containing PMKID Info in the following format |
| 4487 | *|-----------------------------------------------------------------| |
| 4488 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 4489 | *|-----------|------------|----------|-------|----------|----------| |
| 4490 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 4491 | ||-----------------------------------------------------------------| |
| 4492 | * @return Error code indicating success/failure |
| 4493 | * @note |
| 4494 | * @author zsalah |
| 4495 | * @date 8 March 2012 |
| 4496 | * @version 1.0 |
| 4497 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4498 | s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4499 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4500 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4501 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4502 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4503 | |
| 4504 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4505 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4506 | s32Error = -EFAULT; |
| 4507 | PRINT_ER("driver is null\n"); |
| 4508 | return s32Error; |
| 4509 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4510 | |
| 4511 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4512 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4513 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4514 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4515 | msg.body.key_info.enuKeyType = PMKSA; |
| 4516 | msg.body.key_info.u8KeyAction = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4517 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4518 | |
| 4519 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
| 4520 | |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 4521 | memcpy(msg.body.key_info.uniHostIFkeyAttr.pmkid.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4522 | ETH_ALEN); |
| 4523 | |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 4524 | memcpy(msg.body.key_info.uniHostIFkeyAttr.pmkid.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4525 | PMKID_LEN); |
| 4526 | } |
| 4527 | |
| 4528 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4529 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4530 | if (s32Error) |
| 4531 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 4532 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4533 | return s32Error; |
| 4534 | } |
| 4535 | |
| 4536 | /** |
| 4537 | * @brief gets the cached the pmkid info |
| 4538 | * @details valid only in BSS STA mode if External Supplicant |
| 4539 | * support is enabled. This Function sets the PMKID in firmware |
| 4540 | * when host drivr receives the corresponding request from NDIS. |
| 4541 | * The firmware then includes theset PMKID in the appropriate |
| 4542 | * management frames |
| 4543 | * @param[in,out] handle to the wifi driver, |
| 4544 | * message containing PMKID Info in the following format |
| 4545 | *|-----------------------------------------------------------------| |
| 4546 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 4547 | *|-----------|------------|----------|-------|----------|----------| |
| 4548 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 4549 | ||-----------------------------------------------------------------| |
| 4550 | * @param[in] |
| 4551 | * @return Error code indicating success/failure |
| 4552 | * @note |
| 4553 | * @author zsalah |
| 4554 | * @date 8 March 2012 |
| 4555 | * @version 1.0 |
| 4556 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4557 | s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv, |
| 4558 | u8 *pu8PmkidInfoArray, |
| 4559 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4560 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4561 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4562 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4563 | strWID.id = (u16)WID_PMKID_INFO; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4564 | strWID.type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4565 | strWID.size = u32PmkidInfoLen; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4566 | strWID.val = pu8PmkidInfoArray; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4567 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4568 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4569 | } |
| 4570 | |
| 4571 | /** |
| 4572 | * @brief sets the pass phrase |
| 4573 | * @details AP/STA mode. This function gives the pass phrase used to |
| 4574 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 4575 | * The length of the field can vary from 8 to 64 bytes, |
| 4576 | * the lower layer should get the |
| 4577 | * @param[in,out] handle to the wifi driver, |
| 4578 | * @param[in] String containing PSK |
| 4579 | * @return Error code indicating success/failure |
| 4580 | * @note |
| 4581 | * @author zsalah |
| 4582 | * @date 8 March 2012 |
| 4583 | * @version 1.0 |
| 4584 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4585 | s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 4586 | u8 *pu8PassPhrase, |
| 4587 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4588 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4589 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4590 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4591 | /*validating psk length*/ |
| 4592 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4593 | strWID.id = (u16)WID_11I_PSK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4594 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4595 | strWID.val = pu8PassPhrase; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4596 | strWID.size = u8Psklength; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4597 | } |
| 4598 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4599 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4600 | } |
| 4601 | /** |
| 4602 | * @brief host_int_get_MacAddress |
| 4603 | * @details gets mac address |
| 4604 | * @param[in,out] handle to the wifi driver, |
| 4605 | * |
| 4606 | * @return Error code indicating success/failure |
| 4607 | * @note |
| 4608 | * @author mdaftedar |
| 4609 | * @date 19 April 2012 |
| 4610 | * @version 1.0 |
| 4611 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4612 | s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4613 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4614 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4615 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4616 | |
| 4617 | |
| 4618 | /* prepare the Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4619 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4620 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4621 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 4622 | msg.body.get_mac_info.u8MacAddress = pu8MacAddress; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4623 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4624 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4625 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4626 | if (s32Error) { |
| 4627 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4628 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4629 | } |
| 4630 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4631 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4632 | return s32Error; |
| 4633 | } |
| 4634 | |
| 4635 | /** |
| 4636 | * @brief host_int_set_MacAddress |
| 4637 | * @details sets mac address |
| 4638 | * @param[in,out] handle to the wifi driver, |
| 4639 | * |
| 4640 | * @return Error code indicating success/failure |
| 4641 | * @note |
| 4642 | * @author mabubakr |
| 4643 | * @date 16 July 2012 |
| 4644 | * @version 1.0 |
| 4645 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4646 | s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4647 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4648 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4649 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4650 | |
| 4651 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 4652 | |
| 4653 | /* prepare setting mac address message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4654 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4655 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 4656 | memcpy(msg.body.set_mac_info.u8MacAddress, pu8MacAddress, ETH_ALEN); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4657 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4658 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4659 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4660 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4661 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4662 | |
| 4663 | return s32Error; |
| 4664 | |
| 4665 | } |
| 4666 | |
| 4667 | /** |
| 4668 | * @brief host_int_get_RSNAConfigPSKPassPhrase |
| 4669 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to |
| 4670 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 4671 | * The length of the field can vary from 8 to 64 bytes, |
| 4672 | * the lower layer should get the |
| 4673 | * @param[in,out] handle to the wifi driver, |
| 4674 | * String containing PSK |
| 4675 | * @return Error code indicating success/failure |
| 4676 | * @note |
| 4677 | * @author zsalah |
| 4678 | * @date 8 March 2012 |
| 4679 | * @version 1.0 |
| 4680 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4681 | s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 4682 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4683 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4684 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4685 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4686 | strWID.id = (u16)WID_11I_PSK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4687 | strWID.type = WID_STR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4688 | strWID.size = u8Psklength; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4689 | strWID.val = pu8PassPhrase; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4690 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4691 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4692 | } |
| 4693 | |
| 4694 | /** |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4695 | * @brief sets a start scan request |
| 4696 | * @details |
| 4697 | * @param[in,out] handle to the wifi driver, |
| 4698 | * @param[in] Scan Source one of the following values |
| 4699 | * DEFAULT_SCAN 0 |
| 4700 | * USER_SCAN BIT0 |
| 4701 | * OBSS_PERIODIC_SCAN BIT1 |
| 4702 | * OBSS_ONETIME_SCAN BIT2 |
| 4703 | * @return Error code indicating success/failure |
| 4704 | * @note |
| 4705 | * @author zsalah |
| 4706 | * @date 8 March 2012 |
| 4707 | * @version 1.0 |
| 4708 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4709 | s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4710 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4711 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4712 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4713 | strWID.id = (u16)WID_START_SCAN_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4714 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4715 | strWID.val = (s8 *)&scanSource; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4716 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4717 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4718 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4719 | } |
| 4720 | |
| 4721 | /** |
| 4722 | * @brief host_int_get_start_scan_req |
| 4723 | * @details gets a start scan request |
| 4724 | * @param[in,out] handle to the wifi driver, |
| 4725 | * @param[in] Scan Source one of the following values |
| 4726 | * DEFAULT_SCAN 0 |
| 4727 | * USER_SCAN BIT0 |
| 4728 | * OBSS_PERIODIC_SCAN BIT1 |
| 4729 | * OBSS_ONETIME_SCAN BIT2 |
| 4730 | * @return Error code indicating success/failure |
| 4731 | * @note |
| 4732 | * @author zsalah |
| 4733 | * @date 8 March 2012 |
| 4734 | * @version 1.0 |
| 4735 | */ |
| 4736 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4737 | s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4738 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4739 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4740 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4741 | strWID.id = (u16)WID_START_SCAN_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4742 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4743 | strWID.val = (s8 *)pu8ScanSource; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4744 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4745 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4746 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4747 | } |
| 4748 | |
| 4749 | /** |
| 4750 | * @brief host_int_set_join_req |
| 4751 | * @details sets a join request |
| 4752 | * @param[in,out] handle to the wifi driver, |
| 4753 | * @param[in] Index of the bss descriptor |
| 4754 | * @return Error code indicating success/failure |
| 4755 | * @note |
| 4756 | * @author zsalah |
| 4757 | * @date 8 March 2012 |
| 4758 | * @version 1.0 |
| 4759 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4760 | s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, |
| 4761 | const u8 *pu8ssid, size_t ssidLen, |
| 4762 | const u8 *pu8IEs, size_t IEsLen, |
| 4763 | wilc_connect_result pfConnectResult, void *pvUserArg, |
| 4764 | u8 u8security, enum AUTHTYPE tenuAuth_type, |
| 4765 | u8 u8channel, void *pJoinParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4766 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4767 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4768 | struct host_if_msg msg; |
Leo Kim | 7696edf | 2015-10-12 16:56:02 +0900 | [diff] [blame] | 4769 | enum scan_conn_timer enuScanConnTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4770 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4771 | if (!hif_drv || pfConnectResult == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4772 | s32Error = -EFAULT; |
| 4773 | PRINT_ER("Driver is null\n"); |
| 4774 | return s32Error; |
| 4775 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4776 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4777 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4778 | PRINT_ER("Driver is null\n"); |
| 4779 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4780 | } |
| 4781 | |
| 4782 | if (pJoinParams == NULL) { |
| 4783 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4784 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4785 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4786 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4787 | /* prepare the Connect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4788 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4789 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4790 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4791 | |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4792 | msg.body.con_info.u8security = u8security; |
| 4793 | msg.body.con_info.tenuAuth_type = tenuAuth_type; |
| 4794 | msg.body.con_info.u8channel = u8channel; |
| 4795 | msg.body.con_info.pfConnectResult = pfConnectResult; |
| 4796 | msg.body.con_info.pvUserArg = pvUserArg; |
| 4797 | msg.body.con_info.pJoinParams = pJoinParams; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4798 | msg.drv = hif_drv ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4799 | |
| 4800 | if (pu8bssid != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4801 | msg.body.con_info.pu8bssid = kmalloc(6, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 4802 | memcpy(msg.body.con_info.pu8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4803 | pu8bssid, 6); |
| 4804 | } |
| 4805 | |
| 4806 | if (pu8ssid != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4807 | msg.body.con_info.ssidLen = ssidLen; |
| 4808 | msg.body.con_info.pu8ssid = kmalloc(ssidLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 4809 | memcpy(msg.body.con_info.pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4810 | |
| 4811 | pu8ssid, ssidLen); |
| 4812 | } |
| 4813 | |
| 4814 | if (pu8IEs != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4815 | msg.body.con_info.IEsLen = IEsLen; |
| 4816 | msg.body.con_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 4817 | memcpy(msg.body.con_info.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4818 | pu8IEs, IEsLen); |
| 4819 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4820 | if (hif_drv->enuHostIFstate < HOST_IF_CONNECTING) |
| 4821 | hif_drv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 4822 | else |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4823 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", hif_drv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4824 | |
| 4825 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4826 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4827 | if (s32Error) { |
| 4828 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4829 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4830 | } |
| 4831 | |
| 4832 | enuScanConnTimer = CONNECT_TIMER; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4833 | hif_drv->hConnectTimer.data = (unsigned long)hif_drv; |
| 4834 | mod_timer(&hif_drv->hConnectTimer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 4835 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4836 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4837 | return s32Error; |
| 4838 | } |
| 4839 | |
| 4840 | /** |
| 4841 | * @brief Flush a join request parameters to FW, but actual connection |
| 4842 | * @details The function is called in situation where WILC is connected to AP and |
| 4843 | * required to switch to hybrid FW for P2P connection |
| 4844 | * @param[in] handle to the wifi driver, |
| 4845 | * @return Error code indicating success/failure |
| 4846 | * @note |
| 4847 | * @author Amr Abdel-Moghny |
| 4848 | * @date 19 DEC 2013 |
| 4849 | * @version 8.0 |
| 4850 | */ |
| 4851 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4852 | s32 host_int_flush_join_req(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4853 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4854 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4855 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4856 | |
| 4857 | if (!gu8FlushedJoinReq) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4858 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4859 | return s32Error; |
| 4860 | } |
| 4861 | |
| 4862 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4863 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4864 | s32Error = -EFAULT; |
| 4865 | PRINT_ER("Driver is null\n"); |
| 4866 | return s32Error; |
| 4867 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4868 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4869 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4870 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4871 | |
| 4872 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4873 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4874 | if (s32Error) { |
| 4875 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4876 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4877 | } |
| 4878 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4879 | return s32Error; |
| 4880 | } |
| 4881 | |
| 4882 | /** |
| 4883 | * @brief host_int_disconnect |
| 4884 | * @details disconnects from the currently associated network |
| 4885 | * @param[in,out] handle to the wifi driver, |
| 4886 | * @param[in] Reason Code of the Disconnection |
| 4887 | * @return Error code indicating success/failure |
| 4888 | * @note |
| 4889 | * @author zsalah |
| 4890 | * @date 8 March 2012 |
| 4891 | * @version 1.0 |
| 4892 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4893 | s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4894 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4895 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4896 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4897 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4898 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4899 | PRINT_ER("Driver is null\n"); |
| 4900 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4901 | } |
| 4902 | |
| 4903 | /* prepare the Disconnect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4904 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4905 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4906 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4907 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4908 | |
| 4909 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4910 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4911 | if (s32Error) |
| 4912 | PRINT_ER("Failed to send message queue: disconnect\n"); |
| 4913 | /* ////////////// */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4914 | down(&hif_drv->hSemTestDisconnectBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4915 | /* /////// */ |
| 4916 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4917 | return s32Error; |
| 4918 | } |
| 4919 | |
| 4920 | /** |
| 4921 | * @brief host_int_disconnect_station |
| 4922 | * @details disconnects a sta |
| 4923 | * @param[in,out] handle to the wifi driver, |
| 4924 | * @param[in] Association Id of the station to be disconnected |
| 4925 | * @return Error code indicating success/failure |
| 4926 | * @note |
| 4927 | * @author zsalah |
| 4928 | * @date 8 March 2012 |
| 4929 | * @version 1.0 |
| 4930 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4931 | s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4932 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4933 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4934 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4935 | strWID.id = (u16)WID_DISCONNECT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4936 | strWID.type = WID_CHAR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4937 | strWID.val = (s8 *)&assoc_id; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4938 | strWID.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4939 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4940 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4941 | } |
| 4942 | |
| 4943 | /** |
| 4944 | * @brief host_int_get_assoc_req_info |
| 4945 | * @details gets a Association request info |
| 4946 | * @param[in,out] handle to the wifi driver, |
| 4947 | * Message containg assoc. req info in the following format |
| 4948 | * ------------------------------------------------------------------------ |
| 4949 | | Management Frame Format | |
| 4950 | ||-------------------------------------------------------------------| |
| 4951 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | |
| 4952 | ||-------------|--------|--|--|-----|----------------|----------|----| |
| 4953 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | |
| 4954 | ||-------------------------------------------------------------------| |
| 4955 | | | |
| 4956 | | Association Request Frame - Frame Body | |
| 4957 | ||-------------------------------------------------------------------| |
| 4958 | | Capability Information | Listen Interval | SSID | Supported Rates | |
| 4959 | ||------------------------|-----------------|------|-----------------| |
| 4960 | | 2 | 2 | 2-34 | 3-10 | |
| 4961 | | --------------------------------------------------------------------- |
| 4962 | * @return Error code indicating success/failure |
| 4963 | * @note |
| 4964 | * @author zsalah |
| 4965 | * @date 8 March 2012 |
| 4966 | * @version 1.0 |
| 4967 | */ |
| 4968 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4969 | s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, u8 *pu8AssocReqInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4970 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4971 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4972 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4973 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 4974 | strWID.id = (u16)WID_ASSOC_REQ_INFO; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 4975 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 4976 | strWID.val = pu8AssocReqInfo; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 4977 | strWID.size = u32AssocReqInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4978 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 4979 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4980 | } |
| 4981 | |
| 4982 | /** |
| 4983 | * @brief gets a Association Response info |
| 4984 | * @details |
| 4985 | * @param[in,out] handle to the wifi driver, |
| 4986 | * Message containg assoc. resp info |
| 4987 | * @return Error code indicating success/failure |
| 4988 | * @note |
| 4989 | * @author zsalah |
| 4990 | * @date 8 March 2012 |
| 4991 | * @version 1.0 |
| 4992 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4993 | s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 *pu8AssocRespInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4994 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4995 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4996 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 4997 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4998 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4999 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5000 | PRINT_ER("Driver is null\n"); |
| 5001 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5002 | } |
| 5003 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 5004 | strWID.id = (u16)WID_ASSOC_RES_INFO; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 5005 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 5006 | strWID.val = pu8AssocRespInfo; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 5007 | strWID.size = u32MaxAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5008 | |
| 5009 | |
| 5010 | /* Sending Configuration packet */ |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 5011 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5012 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5013 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5014 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5015 | PRINT_ER("Failed to send association response config packet\n"); |
| 5016 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5017 | } else { |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 5018 | *pu32RcvdAssocRespInfoLen = strWID.size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5019 | } |
| 5020 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5021 | return s32Error; |
| 5022 | } |
| 5023 | |
| 5024 | /** |
| 5025 | * @brief gets a Association Response info |
| 5026 | * @details Valid only in STA mode. This function gives the RSSI |
| 5027 | * values observed in all the channels at the time of scanning. |
| 5028 | * The length of the field is 1 greater that the total number of |
| 5029 | * channels supported. Byte 0 contains the number of channels while |
| 5030 | * each of Byte N contains the observed RSSI value for the channel index N. |
| 5031 | * @param[in,out] handle to the wifi driver, |
| 5032 | * array of scanned channels' RSSI |
| 5033 | * @return Error code indicating success/failure |
| 5034 | * @note |
| 5035 | * @author zsalah |
| 5036 | * @date 8 March 2012 |
| 5037 | * @version 1.0 |
| 5038 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5039 | s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, u8 *pu8RxPowerLevel, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5040 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5041 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 5042 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5043 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 5044 | strWID.id = (u16)WID_RX_POWER_LEVEL; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 5045 | strWID.type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 5046 | strWID.val = pu8RxPowerLevel; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 5047 | strWID.size = u32RxPowerLevelLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5048 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 5049 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5050 | } |
| 5051 | |
| 5052 | /** |
| 5053 | * @brief sets a channel |
| 5054 | * @details |
| 5055 | * @param[in,out] handle to the wifi driver, |
| 5056 | * @param[in] Index of the channel to be set |
| 5057 | *|-------------------------------------------------------------------| |
| 5058 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5059 | | Input: 1 2 14 | |
| 5060 | ||-------------------------------------------------------------------| |
| 5061 | * @return Error code indicating success/failure |
| 5062 | * @note |
| 5063 | * @author zsalah |
| 5064 | * @date 8 March 2012 |
| 5065 | * @version 1.0 |
| 5066 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5067 | int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5068 | { |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5069 | int result; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5070 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5071 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5072 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5073 | PRINT_ER("driver is null\n"); |
| 5074 | return -EFAULT; |
| 5075 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5076 | |
| 5077 | /* prepare the set channel message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5078 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5079 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Chaehyun Lim | 1c5833c | 2015-10-02 21:44:51 +0900 | [diff] [blame] | 5080 | msg.body.channel_info.u8SetChan = channel; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5081 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5082 | |
Chaehyun Lim | 1ef58e4 | 2015-10-02 21:44:49 +0900 | [diff] [blame] | 5083 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5084 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5085 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5086 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5087 | } |
| 5088 | |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5089 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5090 | } |
| 5091 | |
Chaehyun Lim | 244efb1 | 2015-10-02 21:44:53 +0900 | [diff] [blame] | 5092 | int host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5093 | { |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5094 | int result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5095 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5096 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5097 | |
| 5098 | /* prepare the set driver handler message */ |
| 5099 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5100 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5101 | msg.id = HOST_IF_MSG_Q_IDLE; |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5102 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5103 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5104 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5105 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5106 | } |
| 5107 | |
| 5108 | /* wait untill MSG Q is empty */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5109 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5110 | |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5111 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5112 | } |
| 5113 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5114 | int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5115 | { |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5116 | int result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5117 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5118 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5119 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5120 | /* prepare the set driver handler message */ |
| 5121 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5122 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5123 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5124 | msg.body.drv.u32Address = get_id_from_handler(hif_drv); |
| 5125 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5126 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5127 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5128 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5129 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5130 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5131 | } |
| 5132 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 5133 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5134 | } |
| 5135 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5136 | int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5137 | { |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5138 | int result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5139 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5140 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5141 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5142 | /* prepare the set driver handler message */ |
| 5143 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5144 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5145 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Chaehyun Lim | 49fb6f7 | 2015-10-05 19:34:52 +0900 | [diff] [blame] | 5146 | msg.body.mode.u32Mode = mode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5147 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5148 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5149 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5150 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5151 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5152 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5153 | } |
| 5154 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 5155 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5156 | } |
| 5157 | |
| 5158 | /** |
| 5159 | * @brief gets the current channel index |
| 5160 | * @details |
| 5161 | * @param[in,out] handle to the wifi driver, |
| 5162 | * current channel index |
| 5163 | *|-----------------------------------------------------------------------| |
| 5164 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5165 | | Input: 1 2 14 | |
| 5166 | ||-----------------------------------------------------------------------| |
| 5167 | * @return Error code indicating success/failure |
| 5168 | * @note |
| 5169 | * @author zsalah |
| 5170 | * @date 8 March 2012 |
| 5171 | * @version 1.0 |
| 5172 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5173 | s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5174 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5175 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5176 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5177 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5178 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5179 | PRINT_ER("driver is null\n"); |
| 5180 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5181 | } |
| 5182 | |
| 5183 | /* prepare the Get Channel Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5184 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5185 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5186 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5187 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5188 | |
| 5189 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5190 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5191 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5192 | PRINT_ER("wilc mq send fail\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5193 | down(&hif_drv->hSemGetCHNL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5194 | /* gu8Chnl = 11; */ |
| 5195 | |
| 5196 | *pu8ChNo = gu8Chnl; |
| 5197 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5198 | return s32Error; |
| 5199 | |
| 5200 | |
| 5201 | } |
| 5202 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5203 | /** |
| 5204 | * @brief host_int_get_inactive_time |
| 5205 | * @details |
| 5206 | * @param[in,out] handle to the wifi driver, |
| 5207 | * current sta macaddress, inactive_time |
| 5208 | * @return |
| 5209 | * @note |
| 5210 | * @author |
| 5211 | * @date |
| 5212 | * @version 1.0 |
| 5213 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5214 | s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, |
| 5215 | const u8 *mac, u32 *pu32InactiveTime) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5216 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5217 | s32 s32Error = 0; |
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 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5220 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5221 | PRINT_ER("driver is null\n"); |
| 5222 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5223 | } |
| 5224 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5225 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5226 | |
| 5227 | |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 5228 | memcpy(msg.body.mac_info.mac, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5229 | mac, ETH_ALEN); |
| 5230 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5231 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5232 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5233 | |
| 5234 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5235 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5236 | if (s32Error) |
| 5237 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5238 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5239 | down(&hif_drv->hSemInactiveTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5240 | |
| 5241 | *pu32InactiveTime = gu32InactiveTime; |
| 5242 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5243 | return s32Error; |
| 5244 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 5245 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5246 | /** |
| 5247 | * @brief host_int_test_get_int_wid |
| 5248 | * @details Test function for getting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5249 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5250 | * @return Error code indicating success/failure |
| 5251 | * @note |
| 5252 | * @author zsalah |
| 5253 | * @date 8 March 2012 |
| 5254 | * @version 1.0 |
| 5255 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5256 | s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5257 | { |
| 5258 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5259 | s32 s32Error = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 5260 | struct wid strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5261 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5262 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5263 | PRINT_ER("driver is null\n"); |
| 5264 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5265 | } |
| 5266 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 5267 | strWID.id = (u16)WID_MEMORY_ADDRESS; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 5268 | strWID.type = WID_INT; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 5269 | strWID.val = (s8 *)pu32TestMemAddr; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 5270 | strWID.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5271 | |
Tony Cho | 0336228 | 2015-10-12 16:55:39 +0900 | [diff] [blame] | 5272 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5273 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5274 | /*get the value by searching the local copy*/ |
| 5275 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5276 | PRINT_ER("Failed to get wid value\n"); |
| 5277 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5278 | } else { |
| 5279 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
| 5280 | |
| 5281 | } |
| 5282 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5283 | return s32Error; |
| 5284 | } |
| 5285 | |
| 5286 | |
| 5287 | /** |
| 5288 | * @brief host_int_get_rssi |
| 5289 | * @details gets the currently maintained RSSI value for the station. |
| 5290 | * The received signal strength value in dB. |
| 5291 | * The range of valid values is -128 to 0. |
| 5292 | * @param[in,out] handle to the wifi driver, |
| 5293 | * rssi value in dB |
| 5294 | * @return Error code indicating success/failure |
| 5295 | * @note |
| 5296 | * @author zsalah |
| 5297 | * @date 8 March 2012 |
| 5298 | * @version 1.0 |
| 5299 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5300 | s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5301 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5302 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5303 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5304 | |
| 5305 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5306 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5307 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5308 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5309 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5310 | |
| 5311 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5312 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5313 | if (s32Error) { |
| 5314 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5315 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5316 | } |
| 5317 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5318 | down(&hif_drv->hSemGetRSSI); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5319 | |
| 5320 | |
| 5321 | if (ps8Rssi == NULL) { |
| 5322 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5323 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5324 | } |
| 5325 | |
| 5326 | |
| 5327 | *ps8Rssi = gs8Rssi; |
| 5328 | |
| 5329 | |
| 5330 | return s32Error; |
| 5331 | } |
| 5332 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5333 | s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5334 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5335 | struct host_if_msg msg; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5336 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5337 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5338 | /* prepare the Get LINKSPEED Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5339 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5340 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5341 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5342 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5343 | |
| 5344 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5345 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5346 | if (s32Error) { |
| 5347 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5348 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5349 | } |
| 5350 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5351 | down(&hif_drv->hSemGetLINKSPEED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5352 | |
| 5353 | |
| 5354 | if (ps8lnkspd == NULL) { |
| 5355 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5356 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5357 | } |
| 5358 | |
| 5359 | |
| 5360 | *ps8lnkspd = gs8lnkspd; |
| 5361 | |
| 5362 | |
| 5363 | return s32Error; |
| 5364 | } |
| 5365 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5366 | s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5367 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5368 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5369 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5370 | |
| 5371 | |
| 5372 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5373 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5374 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5375 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 5376 | msg.body.data = (char *)pstrStatistics; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5377 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5378 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5379 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5380 | if (s32Error) { |
| 5381 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5382 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5383 | } |
| 5384 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5385 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5386 | return s32Error; |
| 5387 | } |
| 5388 | |
| 5389 | |
| 5390 | /** |
| 5391 | * @brief host_int_scan |
| 5392 | * @details scans a set of channels |
| 5393 | * @param[in,out] handle to the wifi driver, |
| 5394 | * @param[in] Scan source |
| 5395 | * Scan Type PASSIVE_SCAN = 0, |
| 5396 | * ACTIVE_SCAN = 1 |
| 5397 | * Channels Array |
| 5398 | * Channels Array length |
| 5399 | * Scan Callback function |
| 5400 | * @return Error code indicating success/failure |
| 5401 | * @note |
| 5402 | * @author zsalah |
| 5403 | * @date 8 March 2012 |
| 5404 | * @version 1.0 |
| 5405 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5406 | s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, |
| 5407 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 5408 | u8 u8ChnlListLen, const u8 *pu8IEs, |
| 5409 | size_t IEsLen, wilc_scan_result ScanResult, |
| 5410 | void *pvUserArg, struct hidden_network *pstrHiddenNetwork) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5411 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5412 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5413 | struct host_if_msg msg; |
Leo Kim | 7696edf | 2015-10-12 16:56:02 +0900 | [diff] [blame] | 5414 | enum scan_conn_timer enuScanConnTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5415 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5416 | if (!hif_drv || ScanResult == NULL) { |
| 5417 | PRINT_ER("hif_drv or ScanResult = NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5418 | return -EFAULT; |
| 5419 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5420 | |
| 5421 | /* prepare the Scan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5422 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5423 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5424 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5425 | |
| 5426 | if (pstrHiddenNetwork != NULL) { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5427 | msg.body.scan_info.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 5428 | msg.body.scan_info.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5429 | |
| 5430 | } else |
| 5431 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 5432 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5433 | msg.drv = hif_drv; |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5434 | msg.body.scan_info.u8ScanSource = u8ScanSource; |
| 5435 | msg.body.scan_info.u8ScanType = u8ScanType; |
| 5436 | msg.body.scan_info.pfScanResult = ScanResult; |
| 5437 | msg.body.scan_info.pvUserArg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5438 | |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5439 | msg.body.scan_info.u8ChnlListLen = u8ChnlListLen; |
| 5440 | msg.body.scan_info.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5441 | memcpy(msg.body.scan_info.pu8ChnlFreqList, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5442 | pu8ChnlFreqList, u8ChnlListLen); |
| 5443 | |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5444 | msg.body.scan_info.IEsLen = IEsLen; |
| 5445 | msg.body.scan_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5446 | memcpy(msg.body.scan_info.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5447 | pu8IEs, IEsLen); |
| 5448 | |
| 5449 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5450 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5451 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5452 | PRINT_ER("Error in sending message queue\n"); |
| 5453 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5454 | } |
| 5455 | |
| 5456 | enuScanConnTimer = SCAN_TIMER; |
| 5457 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5458 | hif_drv->hScanTimer.data = (unsigned long)hif_drv; |
| 5459 | mod_timer(&hif_drv->hScanTimer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5460 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5461 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5462 | return s32Error; |
| 5463 | |
| 5464 | } |
| 5465 | /** |
| 5466 | * @brief hif_set_cfg |
| 5467 | * @details sets configuration wids values |
| 5468 | * @param[in,out] handle to the wifi driver, |
| 5469 | * @param[in] WID, WID value |
| 5470 | * @return Error code indicating success/failure |
| 5471 | * @note |
| 5472 | * @author zsalah |
| 5473 | * @date 8 March 2012 |
| 5474 | * @version 1.0 |
| 5475 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5476 | s32 hif_set_cfg(struct host_if_drv *hif_drv, |
| 5477 | struct cfg_param_val *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5478 | { |
| 5479 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5480 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5481 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5482 | |
| 5483 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5484 | if (!hif_drv) { |
| 5485 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5486 | return -EFAULT; |
| 5487 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5488 | /* prepare the WiphyParams Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5489 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5490 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 5491 | msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5492 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5493 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5494 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5495 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5496 | return s32Error; |
| 5497 | |
| 5498 | } |
| 5499 | |
| 5500 | |
| 5501 | /** |
| 5502 | * @brief hif_get_cfg |
| 5503 | * @details gets configuration wids values |
| 5504 | * @param[in,out] handle to the wifi driver, |
| 5505 | * WID value |
| 5506 | * @param[in] WID, |
| 5507 | * @return Error code indicating success/failure |
| 5508 | * @note |
| 5509 | * @author zsalah |
| 5510 | * |
| 5511 | * @date 8 March 2012 |
| 5512 | * @version 1.0 |
| 5513 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5514 | s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5515 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5516 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5517 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5518 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5519 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5520 | if (!hif_drv) { |
| 5521 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5522 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5523 | } |
| 5524 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 5525 | switch (u16WID) { |
| 5526 | |
| 5527 | case WID_BSS_TYPE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5528 | *pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5529 | break; |
| 5530 | |
| 5531 | case WID_AUTH_TYPE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5532 | *pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5533 | break; |
| 5534 | |
| 5535 | case WID_AUTH_TIMEOUT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5536 | *pu16WID_Value = hif_drv->strCfgValues.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5537 | break; |
| 5538 | |
| 5539 | case WID_POWER_MANAGEMENT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5540 | *pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5541 | break; |
| 5542 | |
| 5543 | case WID_SHORT_RETRY_LIMIT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5544 | *pu16WID_Value = hif_drv->strCfgValues.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5545 | break; |
| 5546 | |
| 5547 | case WID_LONG_RETRY_LIMIT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5548 | *pu16WID_Value = hif_drv->strCfgValues.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5549 | break; |
| 5550 | |
| 5551 | case WID_FRAG_THRESHOLD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5552 | *pu16WID_Value = hif_drv->strCfgValues.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5553 | break; |
| 5554 | |
| 5555 | case WID_RTS_THRESHOLD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5556 | *pu16WID_Value = hif_drv->strCfgValues.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5557 | break; |
| 5558 | |
| 5559 | case WID_PREAMBLE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5560 | *pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5561 | break; |
| 5562 | |
| 5563 | case WID_SHORT_SLOT_ALLOWED: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5564 | *pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5565 | break; |
| 5566 | |
| 5567 | case WID_11N_TXOP_PROT_DISABLE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5568 | *pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5569 | break; |
| 5570 | |
| 5571 | case WID_BEACON_INTERVAL: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5572 | *pu16WID_Value = hif_drv->strCfgValues.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5573 | break; |
| 5574 | |
| 5575 | case WID_DTIM_PERIOD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5576 | *pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5577 | break; |
| 5578 | |
| 5579 | case WID_SITE_SURVEY: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5580 | *pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5581 | break; |
| 5582 | |
| 5583 | case WID_SITE_SURVEY_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5584 | *pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5585 | break; |
| 5586 | |
| 5587 | case WID_ACTIVE_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5588 | *pu16WID_Value = hif_drv->strCfgValues.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5589 | break; |
| 5590 | |
| 5591 | case WID_PASSIVE_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5592 | *pu16WID_Value = hif_drv->strCfgValues.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5593 | break; |
| 5594 | |
| 5595 | case WID_CURRENT_TX_RATE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5596 | *pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5597 | break; |
| 5598 | |
| 5599 | default: |
| 5600 | break; |
| 5601 | } |
| 5602 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5603 | up(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5604 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5605 | return s32Error; |
| 5606 | |
| 5607 | } |
| 5608 | |
| 5609 | /*****************************************************************************/ |
| 5610 | /* Notification Functions */ |
| 5611 | /*****************************************************************************/ |
| 5612 | /** |
| 5613 | * @brief notifies host with join and leave requests |
| 5614 | * @details This function prepares an Information frame having the |
| 5615 | * information about a joining/leaving station. |
| 5616 | * @param[in,out] handle to the wifi driver, |
| 5617 | * @param[in] 6 byte Sta Adress |
| 5618 | * Join or leave flag: |
| 5619 | * Join = 1, |
| 5620 | * Leave =0 |
| 5621 | * @return Error code indicating success/failure |
| 5622 | * @note |
| 5623 | * @author zsalah |
| 5624 | * @date 8 March 2012 |
| 5625 | * @version 1.0 |
| 5626 | */ |
| 5627 | void host_int_send_join_leave_info_to_host |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5628 | (u16 assocId, u8 *stationAddr, bool joining) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5629 | { |
| 5630 | } |
| 5631 | /** |
| 5632 | * @brief notifies host with stations found in scan |
| 5633 | * @details sends the beacon/probe response from scan |
| 5634 | * @param[in,out] handle to the wifi driver, |
| 5635 | * @param[in] Sta Address, |
| 5636 | * Frame length, |
| 5637 | * Rssi of the Station found |
| 5638 | * @return Error code indicating success/failure |
| 5639 | * @note |
| 5640 | * @author zsalah |
| 5641 | * @date 8 March 2012 |
| 5642 | * @version 1.0 |
| 5643 | */ |
| 5644 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5645 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5646 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5647 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 5648 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5649 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5650 | PRINT_ER("Driver handler is NULL\n"); |
| 5651 | return; |
| 5652 | } |
| 5653 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5654 | if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5655 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5656 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5657 | |
| 5658 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5659 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5660 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5661 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5662 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5663 | |
| 5664 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5665 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5666 | if (s32Error) { |
| 5667 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5668 | return; |
| 5669 | } |
| 5670 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5671 | g_hPeriodicRSSI.data = (unsigned long)hif_drv; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5672 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5673 | } |
| 5674 | |
| 5675 | |
| 5676 | void host_int_send_network_info_to_host |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5677 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5678 | { |
| 5679 | } |
| 5680 | /** |
| 5681 | * @brief host_int_init |
| 5682 | * @details host interface initialization function |
| 5683 | * @param[in,out] handle to the wifi driver, |
| 5684 | * @note |
| 5685 | * @author zsalah |
| 5686 | * @date 8 March 2012 |
| 5687 | * @version 1.0 |
| 5688 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5689 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5690 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5691 | s32 host_int_init(struct host_if_drv **hif_drv_handler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5692 | { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5693 | s32 result = 0; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5694 | struct host_if_drv *hif_drv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5695 | int err; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5696 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5697 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 5698 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5699 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5700 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5701 | sema_init(&hWaitResponse, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5702 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5703 | /*Allocate host interface private structure*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5704 | hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL); |
| 5705 | if (!hif_drv) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5706 | result = -ENOMEM; |
Vincent Stehlé | 17db84e | 2015-10-07 07:08:25 +0200 | [diff] [blame] | 5707 | goto _fail_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5708 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5709 | *hif_drv_handler = hif_drv; |
| 5710 | err = add_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5711 | if (err) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5712 | result = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5713 | goto _fail_timer_2; |
| 5714 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5715 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5716 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5717 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5718 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5719 | if (clients_count == 0) { |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5720 | sema_init(&hSemHostIFthrdEnd, 0); |
| 5721 | sema_init(&hSemDeinitDrvHandle, 0); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5722 | sema_init(&hSemHostIntDeinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5723 | } |
| 5724 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5725 | sema_init(&hif_drv->hSemTestKeyBlock, 0); |
| 5726 | sema_init(&hif_drv->hSemTestDisconnectBlock, 0); |
| 5727 | sema_init(&hif_drv->hSemGetRSSI, 0); |
| 5728 | sema_init(&hif_drv->hSemGetLINKSPEED, 0); |
| 5729 | sema_init(&hif_drv->hSemGetCHNL, 0); |
| 5730 | sema_init(&hif_drv->hSemInactiveTime, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5731 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5732 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 5733 | |
| 5734 | if (clients_count == 0) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5735 | result = wilc_mq_create(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5736 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5737 | if (result < 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5738 | PRINT_ER("Failed to creat MQ\n"); |
| 5739 | goto _fail_; |
| 5740 | } |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 5741 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
| 5742 | if (IS_ERR(HostIFthreadHandler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5743 | PRINT_ER("Failed to creat Thread\n"); |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5744 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5745 | goto _fail_mq_; |
| 5746 | } |
Greg Kroah-Hartman | 507d7fc | 2015-08-17 12:59:42 -0700 | [diff] [blame] | 5747 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5748 | (unsigned long)hif_drv); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5749 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5750 | } |
| 5751 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5752 | setup_timer(&hif_drv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5753 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5754 | setup_timer(&hif_drv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5755 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5756 | /*Remain on channel timer*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5757 | setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5758 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5759 | sema_init(&(hif_drv->gtOsCfgValuesSem), 1); |
| 5760 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5761 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5762 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5763 | |
| 5764 | /*Initialize CFG WIDS Defualt Values*/ |
| 5765 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5766 | hif_drv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 5767 | hif_drv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 5768 | hif_drv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 5769 | hif_drv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 5770 | hif_drv->strCfgValues.curr_tx_rate = AUTORATE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5771 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5772 | hif_drv->u64P2p_MgmtTimeout = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5773 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5774 | 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", |
| 5775 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5776 | hif_drv->strCfgValues.site_survey_enabled, hif_drv->strCfgValues.scan_source, |
| 5777 | hif_drv->strCfgValues.active_scan_time, hif_drv->strCfgValues.passive_scan_time, |
| 5778 | hif_drv->strCfgValues.curr_tx_rate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5779 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5780 | up(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5781 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5782 | clients_count++; /* increase number of created entities */ |
| 5783 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5784 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5785 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5786 | _fail_timer_2: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5787 | up(&hif_drv->gtOsCfgValuesSem); |
| 5788 | del_timer_sync(&hif_drv->hConnectTimer); |
| 5789 | del_timer_sync(&hif_drv->hScanTimer); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 5790 | kthread_stop(HostIFthreadHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5791 | _fail_mq_: |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 5792 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5793 | _fail_: |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 5794 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5795 | } |
| 5796 | /** |
| 5797 | * @brief host_int_deinit |
| 5798 | * @details host interface initialization function |
| 5799 | * @param[in,out] handle to the wifi driver, |
| 5800 | * @note |
| 5801 | * @author zsalah |
| 5802 | * @date 8 March 2012 |
| 5803 | * @version 1.0 |
| 5804 | */ |
| 5805 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5806 | s32 host_int_deinit(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5807 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5808 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5809 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5810 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5811 | |
| 5812 | /*obtain driver handle*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5813 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5814 | if (!hif_drv) { |
| 5815 | PRINT_ER("hif_drv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5816 | return 0; |
| 5817 | } |
| 5818 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5819 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5820 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5821 | terminated_handle = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5822 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 5823 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5824 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ |
| 5825 | /*to guarantee handling all messages befor proceeding*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5826 | if (del_timer_sync(&hif_drv->hScanTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5827 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5828 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
| 5829 | } |
| 5830 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5831 | if (del_timer_sync(&hif_drv->hConnectTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5832 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5833 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 5834 | } |
| 5835 | |
| 5836 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 5837 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5838 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5839 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 5840 | } |
| 5841 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5842 | /*Destroy Remain-onchannel Timer*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5843 | del_timer_sync(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5844 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5845 | host_int_set_wfi_drv_handler(NULL); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5846 | down(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5847 | |
| 5848 | |
| 5849 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5850 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
| 5851 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
| 5852 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5853 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5854 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5855 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5856 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5857 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5858 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5859 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5860 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5861 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5862 | |
| 5863 | if (clients_count == 1) { |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 5864 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5865 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5866 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 5867 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5868 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5869 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5870 | |
| 5871 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5872 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5873 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5874 | 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] | 5875 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5876 | down(&hSemHostIFthrdEnd); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5877 | |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 5878 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5879 | } |
| 5880 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5881 | down(&(hif_drv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5882 | |
| 5883 | /*Setting the gloabl driver handler with NULL*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5884 | /* gWFiDrvHandle = NULL; */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5885 | ret = remove_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5886 | if (ret) |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5887 | s32Error = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5888 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5889 | kfree(hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5890 | |
| 5891 | clients_count--; /* Decrease number of created entities */ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5892 | terminated_handle = NULL; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5893 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5894 | return s32Error; |
| 5895 | } |
| 5896 | |
| 5897 | |
| 5898 | /** |
| 5899 | * @brief NetworkInfoReceived |
| 5900 | * @details function to to be called when network info packet is received |
| 5901 | * @param[in] pu8Buffer the received packet |
| 5902 | * @param[in] u32Length length of the received packet |
| 5903 | * @return none |
| 5904 | * @note |
| 5905 | * @author |
| 5906 | * @date 1 Mar 2012 |
| 5907 | * @version 1.0 |
| 5908 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5909 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5910 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5911 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5912 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5913 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5914 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5915 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5916 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5917 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5918 | |
| 5919 | |
| 5920 | |
| 5921 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5922 | if (!hif_drv || hif_drv == terminated_handle) { |
| 5923 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5924 | return; |
| 5925 | } |
| 5926 | |
| 5927 | /* prepare the Asynchronous Network Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5928 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5929 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5930 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5931 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5932 | |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 5933 | msg.body.net_info.u32Length = u32Length; |
| 5934 | msg.body.net_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5935 | memcpy(msg.body.net_info.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5936 | pu8Buffer, u32Length); |
| 5937 | |
| 5938 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5939 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5940 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5941 | 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] | 5942 | } |
| 5943 | |
| 5944 | /** |
| 5945 | * @brief GnrlAsyncInfoReceived |
| 5946 | * @details function to be called when general Asynchronous info packet is received |
| 5947 | * @param[in] pu8Buffer the received packet |
| 5948 | * @param[in] u32Length length of the received packet |
| 5949 | * @return none |
| 5950 | * @note |
| 5951 | * @author |
| 5952 | * @date 15 Mar 2012 |
| 5953 | * @version 1.0 |
| 5954 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5955 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5956 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5957 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5958 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5959 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5960 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5961 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5962 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5963 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 5964 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5965 | hif_drv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 5966 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5967 | |
| 5968 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5969 | if (!hif_drv || hif_drv == terminated_handle) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5970 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5971 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5972 | return; |
| 5973 | } |
| 5974 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5975 | if (!hif_drv->strWILC_UsrConnReq.pfUserConnectResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5976 | /* received mac status is not needed when there is no current Connect Request */ |
| 5977 | 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] | 5978 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5979 | return; |
| 5980 | } |
| 5981 | |
| 5982 | /* prepare the General Asynchronous Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5983 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5984 | |
| 5985 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5986 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5987 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5988 | |
| 5989 | |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 5990 | msg.body.async_info.u32Length = u32Length; |
| 5991 | msg.body.async_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5992 | memcpy(msg.body.async_info.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5993 | pu8Buffer, u32Length); |
| 5994 | |
| 5995 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5996 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 5997 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5998 | 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] | 5999 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6000 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6001 | } |
| 6002 | |
| 6003 | /** |
| 6004 | * @brief host_int_ScanCompleteReceived |
| 6005 | * @details Setting scan complete received notifcation in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6006 | * @param[in] u8* pu8Buffer, u32 u32Length |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6007 | * @return Error code. |
| 6008 | * @author |
| 6009 | * @date |
| 6010 | * @version 1.0 |
| 6011 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6012 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6013 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6014 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6015 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6016 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6017 | struct host_if_drv *hif_drv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6018 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6019 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6020 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6021 | |
| 6022 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6023 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6024 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6025 | if (!hif_drv || hif_drv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6026 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6027 | |
| 6028 | /*if there is an ongoing scan request*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6029 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6030 | /* prepare theScan Done message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6031 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6032 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6033 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6034 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6035 | |
| 6036 | |
| 6037 | /* will be deallocated by the receiving thread */ |
| 6038 | /*no need to send message body*/ |
| 6039 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6040 | /*msg.body.strScanComplete.u32Length = u32Length; |
| 6041 | * msg.body.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
| 6042 | * memcpy(msg.body.strScanComplete.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6043 | * pu8Buffer, u32Length); */ |
| 6044 | |
| 6045 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6046 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6047 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6048 | 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] | 6049 | } |
| 6050 | |
| 6051 | |
| 6052 | return; |
| 6053 | |
| 6054 | } |
| 6055 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6056 | /** |
| 6057 | * @brief host_int_remain_on_channel |
| 6058 | * @details |
| 6059 | * @param[in] Handle to wifi driver |
| 6060 | * Duration to remain on channel |
| 6061 | * Channel to remain on |
| 6062 | * Pointer to fn to be called on receive frames in listen state |
| 6063 | * Pointer to remain-on-channel expired fn |
| 6064 | * Priv |
| 6065 | * @return Error code. |
| 6066 | * @author |
| 6067 | * @date |
| 6068 | * @version 1.0 |
| 6069 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6070 | s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, |
| 6071 | u32 u32duration, u16 chan, |
| 6072 | wilc_remain_on_chan_expired RemainOnChanExpired, |
| 6073 | wilc_remain_on_chan_ready RemainOnChanReady, |
| 6074 | void *pvUserArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6075 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6076 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6077 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6078 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6079 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6080 | PRINT_ER("driver is null\n"); |
| 6081 | return -EFAULT; |
| 6082 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6083 | |
| 6084 | /* prepare the remainonchan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6085 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6086 | |
| 6087 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6088 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 6089 | msg.body.remain_on_ch.u16Channel = chan; |
| 6090 | msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired; |
| 6091 | msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; |
| 6092 | msg.body.remain_on_ch.pVoid = pvUserArg; |
| 6093 | msg.body.remain_on_ch.u32duration = u32duration; |
| 6094 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6095 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6096 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6097 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6098 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6099 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6100 | |
| 6101 | return s32Error; |
| 6102 | } |
| 6103 | |
| 6104 | /** |
| 6105 | * @brief host_int_ListenStateExpired |
| 6106 | * @details |
| 6107 | * @param[in] Handle to wifi driver |
| 6108 | * Duration to remain on channel |
| 6109 | * Channel to remain on |
| 6110 | * Pointer to fn to be called on receive frames in listen state |
| 6111 | * Pointer to remain-on-channel expired fn |
| 6112 | * Priv |
| 6113 | * @return Error code. |
| 6114 | * @author |
| 6115 | * @date |
| 6116 | * @version 1.0 |
| 6117 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6118 | s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6119 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6120 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6121 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6122 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6123 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6124 | PRINT_ER("driver is null\n"); |
| 6125 | return -EFAULT; |
| 6126 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6127 | |
| 6128 | /*Stopping remain-on-channel timer*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6129 | del_timer(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6130 | |
| 6131 | /* prepare the timer fire Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6132 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6133 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6134 | msg.drv = hif_drv; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 6135 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6136 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6137 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6138 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6139 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6140 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6141 | return s32Error; |
| 6142 | } |
| 6143 | |
| 6144 | /** |
| 6145 | * @brief host_int_frame_register |
| 6146 | * @details |
| 6147 | * @param[in] Handle to wifi driver |
| 6148 | * @return Error code. |
| 6149 | * @author |
| 6150 | * @date |
| 6151 | * @version 1.0*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6152 | s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6153 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6154 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6155 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6156 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6157 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6158 | PRINT_ER("driver is null\n"); |
| 6159 | return -EFAULT; |
| 6160 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6161 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6162 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6163 | |
| 6164 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6165 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6166 | switch (u16FrameType) { |
| 6167 | case ACTION: |
| 6168 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6169 | msg.body.reg_frame.u8Regid = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6170 | break; |
| 6171 | |
| 6172 | case PROBE_REQ: |
| 6173 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6174 | msg.body.reg_frame.u8Regid = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6175 | break; |
| 6176 | |
| 6177 | default: |
| 6178 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 6179 | break; |
| 6180 | } |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6181 | msg.body.reg_frame.u16FrameType = u16FrameType; |
| 6182 | msg.body.reg_frame.bReg = bReg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6183 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6184 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6185 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6186 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6187 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6188 | |
| 6189 | return s32Error; |
| 6190 | |
| 6191 | |
| 6192 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6193 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6194 | /** |
| 6195 | * @brief host_int_add_beacon |
| 6196 | * @details Setting add beacon params in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6197 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
| 6198 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, |
| 6199 | * u32 u32TailLen, u8* pu8Tail |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6200 | * @return Error code. |
| 6201 | * @author |
| 6202 | * @date |
| 6203 | * @version 1.0 |
| 6204 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6205 | s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, |
| 6206 | u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, |
| 6207 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6208 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6209 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6210 | struct host_if_msg msg; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 6211 | struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6212 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6213 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6214 | PRINT_ER("driver is null\n"); |
| 6215 | return -EFAULT; |
| 6216 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6217 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6218 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6219 | |
| 6220 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 6221 | |
| 6222 | |
| 6223 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6224 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6225 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6226 | pstrSetBeaconParam->u32Interval = u32Interval; |
| 6227 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; |
| 6228 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6229 | pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6230 | if (pstrSetBeaconParam->pu8Head == NULL) { |
| 6231 | s32Error = -ENOMEM; |
| 6232 | goto ERRORHANDLER; |
| 6233 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6234 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6235 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
| 6236 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6237 | if (u32TailLen > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6238 | pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6239 | if (pstrSetBeaconParam->pu8Tail == NULL) { |
| 6240 | s32Error = -ENOMEM; |
| 6241 | goto ERRORHANDLER; |
| 6242 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6243 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6244 | } else { |
| 6245 | pstrSetBeaconParam->pu8Tail = NULL; |
| 6246 | } |
| 6247 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6248 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6249 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6250 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6251 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6252 | ERRORHANDLER: |
| 6253 | if (s32Error) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6254 | if (pstrSetBeaconParam->pu8Head != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6255 | kfree(pstrSetBeaconParam->pu8Head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6256 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6257 | if (pstrSetBeaconParam->pu8Tail != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6258 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6259 | } |
| 6260 | |
| 6261 | return s32Error; |
| 6262 | |
| 6263 | } |
| 6264 | |
| 6265 | |
| 6266 | /** |
| 6267 | * @brief host_int_del_beacon |
| 6268 | * @details Setting add beacon params in message queue |
| 6269 | * @param[in] WILC_WFIDrvHandle hWFIDrv |
| 6270 | * @return Error code. |
| 6271 | * @author |
| 6272 | * @date |
| 6273 | * @version 1.0 |
| 6274 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6275 | s32 host_int_del_beacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6276 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6277 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6278 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6279 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6280 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6281 | PRINT_ER("driver is null\n"); |
| 6282 | return -EFAULT; |
| 6283 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6284 | |
| 6285 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6286 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6287 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6288 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 6289 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6290 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 6291 | if (s32Error) |
| 6292 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6293 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6294 | return s32Error; |
| 6295 | } |
| 6296 | |
| 6297 | |
| 6298 | /** |
| 6299 | * @brief host_int_add_station |
| 6300 | * @details Setting add station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6301 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6302 | * @return Error code. |
| 6303 | * @author |
| 6304 | * @date |
| 6305 | * @version 1.0 |
| 6306 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6307 | s32 host_int_add_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6308 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6309 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6310 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6311 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 6312 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6313 | |
| 6314 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6315 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6316 | PRINT_ER("driver is null\n"); |
| 6317 | return -EFAULT; |
| 6318 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6319 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6320 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6321 | |
| 6322 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 6323 | |
| 6324 | |
| 6325 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6326 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6327 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6328 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6329 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6330 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6331 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6332 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 6333 | if (!rates) |
| 6334 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6335 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6336 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 6337 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6338 | } |
| 6339 | |
| 6340 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6341 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6342 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6343 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6344 | return s32Error; |
| 6345 | } |
| 6346 | |
| 6347 | /** |
| 6348 | * @brief host_int_del_station |
| 6349 | * @details Setting delete station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6350 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6351 | * @return Error code. |
| 6352 | * @author |
| 6353 | * @date |
| 6354 | * @version 1.0 |
| 6355 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6356 | s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6357 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6358 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6359 | struct host_if_msg msg; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 6360 | struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6361 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6362 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6363 | PRINT_ER("driver is null\n"); |
| 6364 | return -EFAULT; |
| 6365 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6366 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6367 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6368 | |
| 6369 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 6370 | |
| 6371 | |
| 6372 | |
| 6373 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6374 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6375 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6376 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6377 | if (pu8MacAddr == NULL) |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6378 | memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6379 | else |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6380 | memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6381 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6382 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6383 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6384 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6385 | return s32Error; |
| 6386 | } |
| 6387 | /** |
| 6388 | * @brief host_int_del_allstation |
| 6389 | * @details Setting del station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6390 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6391 | * @return Error code. |
| 6392 | * @author |
| 6393 | * @date |
| 6394 | * @version 1.0 |
| 6395 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6396 | s32 host_int_del_allstation(struct host_if_drv *hif_drv, |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 6397 | u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6398 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6399 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6400 | struct host_if_msg msg; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 6401 | struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6402 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6403 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6404 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6405 | |
| 6406 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6407 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6408 | PRINT_ER("driver is null\n"); |
| 6409 | return -EFAULT; |
| 6410 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6411 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6412 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6413 | |
| 6414 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 6415 | |
| 6416 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6417 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6418 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6419 | |
| 6420 | /* Handling situation of deauthenticing all associated stations*/ |
| 6421 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 6422 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6423 | memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6424 | 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], |
| 6425 | pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); |
| 6426 | u8AssocNumb++; |
| 6427 | } |
| 6428 | } |
| 6429 | if (!u8AssocNumb) { |
| 6430 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
| 6431 | return s32Error; |
| 6432 | } |
| 6433 | |
| 6434 | pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6435 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6436 | |
| 6437 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6438 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6439 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6440 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6441 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6442 | |
| 6443 | return s32Error; |
| 6444 | |
| 6445 | } |
| 6446 | |
| 6447 | /** |
| 6448 | * @brief host_int_edit_station |
| 6449 | * @details Setting edit station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6450 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6451 | * @return Error code. |
| 6452 | * @author |
| 6453 | * @date |
| 6454 | * @version 1.0 |
| 6455 | */ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6456 | s32 host_int_edit_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6457 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6458 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6459 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6460 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 6461 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6462 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6463 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6464 | PRINT_ER("driver is null\n"); |
| 6465 | return -EFAULT; |
| 6466 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6467 | |
| 6468 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 6469 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6470 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6471 | |
| 6472 | |
| 6473 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6474 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6475 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6476 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6477 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6478 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6479 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6480 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 6481 | if (!rates) |
| 6482 | return -ENOMEM; |
| 6483 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6484 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 6485 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6486 | } |
| 6487 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6488 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6489 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6490 | PRINT_ER("wilc_mq_send fail\n"); |
| 6491 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6492 | return s32Error; |
| 6493 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 6494 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6495 | s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv, |
| 6496 | bool bIsEnabled, |
| 6497 | u32 u32Timeout) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6498 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6499 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6500 | struct host_if_msg msg; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 6501 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6502 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6503 | 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] | 6504 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6505 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6506 | PRINT_ER("driver is null\n"); |
| 6507 | return -EFAULT; |
| 6508 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6509 | |
| 6510 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 6511 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6512 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6513 | |
| 6514 | |
| 6515 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6516 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6517 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6518 | |
| 6519 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; |
| 6520 | pstrPowerMgmtParam->u32Timeout = u32Timeout; |
| 6521 | |
| 6522 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6523 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6524 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6525 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6526 | return s32Error; |
| 6527 | } |
| 6528 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6529 | s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv, |
| 6530 | bool bIsEnabled, |
| 6531 | u32 u32count) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6532 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6533 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6534 | struct host_if_msg msg; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 6535 | struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6536 | |
| 6537 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6538 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6539 | PRINT_ER("driver is null\n"); |
| 6540 | return -EFAULT; |
| 6541 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6542 | |
| 6543 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 6544 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6545 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6546 | |
| 6547 | |
| 6548 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6549 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6550 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6551 | |
| 6552 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; |
| 6553 | pstrMulticastFilterParam->u32count = u32count; |
| 6554 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6555 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6556 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6557 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6558 | return s32Error; |
| 6559 | } |
| 6560 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6561 | /** |
| 6562 | * @brief host_int_ParseJoinBssParam |
| 6563 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry |
| 6564 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 6565 | * @return |
| 6566 | * @author zsalah |
| 6567 | * @date |
| 6568 | * @version 1.0**/ |
| 6569 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 6570 | { |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 6571 | struct join_bss_param *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6572 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6573 | u16 u16IEsLen; |
| 6574 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6575 | u8 suppRatesNo = 0; |
| 6576 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6577 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6578 | u8 pcipherCount; |
| 6579 | u8 authCount; |
| 6580 | u8 pcipherTotalCount = 0; |
| 6581 | u8 authTotalCount = 0; |
| 6582 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6583 | |
| 6584 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 6585 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 6586 | |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 6587 | pNewJoinBssParam = kmalloc(sizeof(struct join_bss_param), GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6588 | if (pNewJoinBssParam != NULL) { |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 6589 | memset(pNewJoinBssParam, 0, sizeof(struct join_bss_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6590 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 6591 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 6592 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6593 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6594 | /*for(i=0; i<6;i++) |
| 6595 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6596 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6597 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6598 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 6599 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6600 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
| 6601 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ |
| 6602 | |
| 6603 | /* parse supported rates: */ |
| 6604 | while (index < u16IEsLen) { |
| 6605 | /* supportedRates IE */ |
| 6606 | if (pu8IEs[index] == SUPP_RATES_IE) { |
| 6607 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ |
| 6608 | suppRatesNo = pu8IEs[index + 1]; |
| 6609 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
| 6610 | index += 2; /* skipping ID and length bytes; */ |
| 6611 | |
| 6612 | for (i = 0; i < suppRatesNo; i++) { |
| 6613 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
| 6614 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ |
| 6615 | } |
| 6616 | index += suppRatesNo; |
| 6617 | continue; |
| 6618 | } |
| 6619 | /* Ext SupportedRates IE */ |
| 6620 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
| 6621 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ |
| 6622 | /* checking if no of ext. supp and supp rates < max limit */ |
| 6623 | extSuppRatesNo = pu8IEs[index + 1]; |
| 6624 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 6625 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 6626 | else |
| 6627 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 6628 | index += 2; |
| 6629 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ |
| 6630 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { |
| 6631 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
| 6632 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ |
| 6633 | } |
| 6634 | index += extSuppRatesNo; |
| 6635 | continue; |
| 6636 | } |
| 6637 | /* HT Cap. IE */ |
| 6638 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
| 6639 | /* if IE found set the flag */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6640 | pNewJoinBssParam->ht_capable = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6641 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 6642 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ |
| 6643 | continue; |
| 6644 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ |
| 6645 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
| 6646 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ |
| 6647 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ |
| 6648 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ |
| 6649 | (pu8IEs[index + 7] == 0x01)) { |
| 6650 | /* Presence of WMM Info/Param element indicates WMM capability */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6651 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6652 | |
| 6653 | /* Check if Bit 7 is set indicating U-APSD capability */ |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 6654 | if (pu8IEs[index + 8] & BIT(7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6655 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6656 | index += pu8IEs[index + 1] + 2; |
| 6657 | continue; |
| 6658 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6659 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ |
| 6660 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
| 6661 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ |
| 6662 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6663 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6664 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6665 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
| 6666 | pNewJoinBssParam->u8NoaEnbaled = 1; |
| 6667 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; |
| 6668 | |
| 6669 | /* Check if Bit 7 is set indicating Opss capability */ |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 6670 | if (pu8IEs[index + 10] & BIT(7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6671 | pNewJoinBssParam->u8OppEnable = 1; |
| 6672 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; |
| 6673 | } else |
| 6674 | pNewJoinBssParam->u8OppEnable = 0; |
| 6675 | /* HOSTINF_DBG */ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6676 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6677 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6678 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6679 | |
| 6680 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; |
| 6681 | u16P2P_count = index + 12; |
| 6682 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6683 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6684 | u16P2P_count += 4; |
| 6685 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6686 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6687 | u16P2P_count += 4; |
| 6688 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6689 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6690 | |
| 6691 | index += pu8IEs[index + 1] + 2; |
| 6692 | continue; |
| 6693 | |
| 6694 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6695 | else if ((pu8IEs[index] == RSN_IE) || |
| 6696 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 6697 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 6698 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6699 | u16 rsnIndex = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6700 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
| 6701 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) |
| 6702 | * { |
| 6703 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); |
| 6704 | * }*/ |
| 6705 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 6706 | pNewJoinBssParam->mode_802_11i = 2; |
| 6707 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ |
| 6708 | } else { /* check if rsn was previously parsed */ |
| 6709 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 6710 | pNewJoinBssParam->mode_802_11i = 1; |
| 6711 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ |
| 6712 | rsnIndex += 4; |
| 6713 | } |
| 6714 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ |
| 6715 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 6716 | rsnIndex++; |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6717 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6718 | /* initialize policies with invalid values */ |
| 6719 | |
| 6720 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ |
| 6721 | |
| 6722 | /*parsing pairwise cipher*/ |
| 6723 | |
| 6724 | /* saving 3 pcipher max. */ |
| 6725 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 6726 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 6727 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6728 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6729 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
| 6730 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 6731 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 6732 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ |
| 6733 | } |
| 6734 | pcipherTotalCount += pcipherCount; |
| 6735 | rsnIndex += jumpOffset; |
| 6736 | |
| 6737 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 6738 | |
| 6739 | /*parsing AKM suite (auth_policy)*/ |
| 6740 | /* saving 3 auth policies max. */ |
| 6741 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 6742 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 6743 | |
| 6744 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { |
| 6745 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 6746 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 6747 | } |
| 6748 | authTotalCount += authCount; |
| 6749 | rsnIndex += jumpOffset; |
| 6750 | /*pasring rsn cap. only if rsn IE*/ |
| 6751 | if (pu8IEs[index] == RSN_IE) { |
| 6752 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 6753 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 6754 | rsnIndex += 2; |
| 6755 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 6756 | pNewJoinBssParam->rsn_found = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6757 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 6758 | continue; |
| 6759 | } else |
| 6760 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 6761 | |
| 6762 | } |
| 6763 | |
| 6764 | |
| 6765 | } |
| 6766 | |
| 6767 | return (void *)pNewJoinBssParam; |
| 6768 | |
| 6769 | } |
| 6770 | |
| 6771 | void host_int_freeJoinParams(void *pJoinParams) |
| 6772 | { |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 6773 | if ((struct bss_param *)pJoinParams != NULL) |
| 6774 | kfree((struct bss_param *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6775 | else |
| 6776 | PRINT_ER("Unable to FREE null pointer\n"); |
| 6777 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6778 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6779 | s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6780 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6781 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6782 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 6783 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6784 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6785 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6786 | PRINT_ER("driver is null\n"); |
| 6787 | return -EFAULT; |
| 6788 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6789 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6790 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6791 | |
| 6792 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6793 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6794 | |
| 6795 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 6796 | pBASessionInfo->u8Ted = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6797 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6798 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6799 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6800 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6801 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6802 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6803 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6804 | |
| 6805 | return s32Error; |
| 6806 | } |
| 6807 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6808 | s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, |
| 6809 | char *pBSSID, |
| 6810 | char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6811 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6812 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6813 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 6814 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6815 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6816 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6817 | PRINT_ER("driver is null\n"); |
| 6818 | return -EFAULT; |
| 6819 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6820 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6821 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6822 | |
| 6823 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6824 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6825 | |
| 6826 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 6827 | pBASessionInfo->u8Ted = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6828 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6829 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6830 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6831 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6832 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6833 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6834 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6835 | |
| 6836 | return s32Error; |
| 6837 | } |
| 6838 | |
| 6839 | /** |
| 6840 | * @brief host_int_setup_ipaddress |
| 6841 | * @details setup IP in firmware |
| 6842 | * @param[in] Handle to wifi driver |
| 6843 | * @return Error code. |
| 6844 | * @author Abdelrahman Sobhy |
| 6845 | * @date |
| 6846 | * @version 1.0*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6847 | s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6848 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6849 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6850 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6851 | |
| 6852 | /* TODO: Enable This feature on softap firmware */ |
| 6853 | return 0; |
| 6854 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6855 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6856 | PRINT_ER("driver is null\n"); |
| 6857 | return -EFAULT; |
| 6858 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6859 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6860 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6861 | |
| 6862 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6863 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6864 | |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 6865 | msg.body.ip_info.au8IPAddr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6866 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 6867 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6868 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6869 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6870 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6871 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6872 | |
| 6873 | return s32Error; |
| 6874 | |
| 6875 | |
| 6876 | } |
| 6877 | |
| 6878 | /** |
| 6879 | * @brief host_int_get_ipaddress |
| 6880 | * @details Get IP from firmware |
| 6881 | * @param[in] Handle to wifi driver |
| 6882 | * @return Error code. |
| 6883 | * @author Abdelrahman Sobhy |
| 6884 | * @date |
| 6885 | * @version 1.0*/ |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6886 | s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6887 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6888 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6889 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6890 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6891 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6892 | PRINT_ER("driver is null\n"); |
| 6893 | return -EFAULT; |
| 6894 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6895 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6896 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6897 | |
| 6898 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6899 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6900 | |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 6901 | msg.body.ip_info.au8IPAddr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 6902 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 6903 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6904 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6905 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6906 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6907 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6908 | |
| 6909 | return s32Error; |
| 6910 | |
| 6911 | |
| 6912 | } |