Chaehyun Lim | e215a87 | 2015-09-30 08:15:41 +0900 | [diff] [blame] | 1 | #include <linux/slab.h> |
| 2 | #include <linux/time.h> |
| 3 | #include <linux/kthread.h> |
| 4 | #include <linux/delay.h> |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5 | #include "host_interface.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6 | #include "coreconfigurator.h" |
Chaehyun Lim | 5366012 | 2015-09-17 16:48:49 +0900 | [diff] [blame] | 7 | #include "wilc_wlan_if.h" |
Chaehyun Lim | f23eb98 | 2015-09-23 18:03:47 +0900 | [diff] [blame] | 8 | #include "wilc_msgqueue.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 9 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 10 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 11 | |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 12 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 13 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 14 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 15 | |
| 16 | /* Message types of the Host IF Message Queue*/ |
Chaehyun Lim | 9eac3a1 | 2015-06-18 22:08:51 +0900 | [diff] [blame] | 17 | #define HOST_IF_MSG_SCAN 0 |
| 18 | #define HOST_IF_MSG_CONNECT 1 |
| 19 | #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 |
| 20 | #define HOST_IF_MSG_KEY 3 |
| 21 | #define HOST_IF_MSG_RCVD_NTWRK_INFO 4 |
| 22 | #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5 |
| 23 | #define HOST_IF_MSG_CFG_PARAMS 6 |
| 24 | #define HOST_IF_MSG_SET_CHANNEL 7 |
| 25 | #define HOST_IF_MSG_DISCONNECT 8 |
| 26 | #define HOST_IF_MSG_GET_RSSI 9 |
| 27 | #define HOST_IF_MSG_GET_CHNL 10 |
| 28 | #define HOST_IF_MSG_ADD_BEACON 11 |
| 29 | #define HOST_IF_MSG_DEL_BEACON 12 |
| 30 | #define HOST_IF_MSG_ADD_STATION 13 |
| 31 | #define HOST_IF_MSG_DEL_STATION 14 |
| 32 | #define HOST_IF_MSG_EDIT_STATION 15 |
| 33 | #define HOST_IF_MSG_SCAN_TIMER_FIRED 16 |
| 34 | #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17 |
| 35 | #define HOST_IF_MSG_POWER_MGMT 18 |
| 36 | #define HOST_IF_MSG_GET_INACTIVETIME 19 |
| 37 | #define HOST_IF_MSG_REMAIN_ON_CHAN 20 |
| 38 | #define HOST_IF_MSG_REGISTER_FRAME 21 |
| 39 | #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22 |
| 40 | #define HOST_IF_MSG_GET_LINKSPEED 23 |
| 41 | #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24 |
| 42 | #define HOST_IF_MSG_SET_MAC_ADDRESS 25 |
| 43 | #define HOST_IF_MSG_GET_MAC_ADDRESS 26 |
| 44 | #define HOST_IF_MSG_SET_OPERATION_MODE 27 |
| 45 | #define HOST_IF_MSG_SET_IPADDRESS 28 |
| 46 | #define HOST_IF_MSG_GET_IPADDRESS 29 |
| 47 | #define HOST_IF_MSG_FLUSH_CONNECT 30 |
| 48 | #define HOST_IF_MSG_GET_STATISTICS 31 |
| 49 | #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 |
| 50 | #define HOST_IF_MSG_ADD_BA_SESSION 33 |
| 51 | #define HOST_IF_MSG_DEL_BA_SESSION 34 |
| 52 | #define HOST_IF_MSG_Q_IDLE 35 |
| 53 | #define HOST_IF_MSG_DEL_ALL_STA 36 |
| 54 | #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34 |
| 55 | #define HOST_IF_MSG_EXIT 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 56 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 57 | #define HOST_IF_SCAN_TIMEOUT 4000 |
| 58 | #define HOST_IF_CONNECT_TIMEOUT 9500 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 59 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 60 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
| 61 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 |
| 62 | #define BLOCK_ACK_REQ_SIZE 0x14 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 63 | |
| 64 | /*! |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 65 | * @struct cfg_param_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 66 | * @brief Structure to hold Host IF CFG Params Attributes |
| 67 | * @details |
| 68 | * @todo |
| 69 | * @sa |
| 70 | * @author Mai Daftedar |
| 71 | * @date 02 April 2012 |
| 72 | * @version 1.0 |
| 73 | */ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 74 | struct cfg_param_attr { |
Leo Kim | 9529650 | 2015-10-05 15:25:46 +0900 | [diff] [blame] | 75 | struct cfg_param_val pstrCfgParamVal; |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 76 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 77 | |
| 78 | /*! |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 79 | * @struct host_if_wpa_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 80 | * @brief Structure to hold Host IF Scan Attributes |
| 81 | * @details |
| 82 | * @todo |
| 83 | * @sa |
| 84 | * @author Mai Daftedar |
| 85 | * @date 25 March 2012 |
| 86 | * @version 1.0 |
| 87 | */ |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 88 | struct host_if_wpa_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 89 | u8 *pu8key; |
| 90 | const u8 *pu8macaddr; |
| 91 | u8 *pu8seq; |
| 92 | u8 u8seqlen; |
| 93 | u8 u8keyidx; |
| 94 | u8 u8Keylen; |
| 95 | u8 u8Ciphermode; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 96 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 97 | |
| 98 | |
| 99 | /*! |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 100 | * @struct host_if_wep_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 101 | * @brief Structure to hold Host IF Scan Attributes |
| 102 | * @details |
| 103 | * @todo |
| 104 | * @sa |
| 105 | * @author Mai Daftedar |
| 106 | * @date 25 March 2012 |
| 107 | * @version 1.0 |
| 108 | */ |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 109 | struct host_if_wep_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 110 | u8 *pu8WepKey; |
| 111 | u8 u8WepKeylen; |
| 112 | u8 u8Wepidx; |
| 113 | u8 u8mode; |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 114 | enum AUTHTYPE tenuAuth_type; |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 115 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 116 | |
| 117 | /*! |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 118 | * @struct host_if_key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 119 | * @brief Structure to hold Host IF Scan Attributes |
| 120 | * @details |
| 121 | * @todo |
| 122 | * @sa |
| 123 | * @author Mai Daftedar |
| 124 | * @date 25 March 2012 |
| 125 | * @version 1.0 |
| 126 | */ |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 127 | union host_if_key_attr { |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 128 | struct host_if_wep_attr strHostIFwepAttr; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 129 | struct host_if_wpa_attr strHostIFwpaAttr; |
Leo Kim | a949f90 | 2015-10-05 15:25:44 +0900 | [diff] [blame] | 130 | struct host_if_pmkid_attr strHostIFpmkidAttr; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 131 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 132 | |
| 133 | /*! |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 134 | * @struct key_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 135 | * @brief Structure to hold Host IF Scan Attributes |
| 136 | * @details |
| 137 | * @todo |
| 138 | * @sa |
| 139 | * @author Mai Daftedar |
| 140 | * @date 25 March 2012 |
| 141 | * @version 1.0 |
| 142 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 143 | struct key_attr { |
Leo Kim | b9d9633 | 2015-10-05 15:25:40 +0900 | [diff] [blame] | 144 | enum KEY_TYPE enuKeyType; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 145 | u8 u8KeyAction; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 146 | union host_if_key_attr uniHostIFkeyAttr; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 147 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | /*! |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 153 | * @struct scan_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 154 | * @brief Structure to hold Host IF Scan Attributes |
| 155 | * @details |
| 156 | * @todo |
| 157 | * @sa |
| 158 | * @author Mostafa Abu Bakr |
| 159 | * @date 25 March 2012 |
| 160 | * @version 1.0 |
| 161 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 162 | struct scan_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 163 | u8 u8ScanSource; |
| 164 | u8 u8ScanType; |
| 165 | u8 *pu8ChnlFreqList; |
| 166 | u8 u8ChnlListLen; |
| 167 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 168 | size_t IEsLen; |
Leo Kim | ba1d1a6 | 2015-10-05 15:25:36 +0900 | [diff] [blame] | 169 | wilc_scan_result pfScanResult; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 170 | void *pvUserArg; |
Leo Kim | 607db44 | 2015-10-05 15:25:37 +0900 | [diff] [blame] | 171 | struct hidden_network strHiddenNetwork; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 172 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 173 | |
| 174 | /*! |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 175 | * @struct connect_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 176 | * @brief Structure to hold Host IF Connect Attributes |
| 177 | * @details |
| 178 | * @todo |
| 179 | * @sa |
| 180 | * @author Mostafa Abu Bakr |
| 181 | * @date 25 March 2012 |
| 182 | * @version 1.0 |
| 183 | */ |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 184 | struct connect_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 185 | u8 *pu8bssid; |
| 186 | u8 *pu8ssid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 187 | size_t ssidLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 188 | u8 *pu8IEs; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 189 | size_t IEsLen; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 190 | u8 u8security; |
Leo Kim | b6ab85f | 2015-10-05 15:25:38 +0900 | [diff] [blame] | 191 | wilc_connect_result pfConnectResult; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 192 | void *pvUserArg; |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 193 | enum AUTHTYPE tenuAuth_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 194 | u8 u8channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 195 | void *pJoinParams; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 196 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 197 | |
| 198 | /*! |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 199 | * @struct rcvd_async_info |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 200 | * @brief Structure to hold Received General Asynchronous info |
| 201 | * @details |
| 202 | * @todo |
| 203 | * @sa |
| 204 | * @author Mostafa Abu Bakr |
| 205 | * @date 25 March 2012 |
| 206 | * @version 1.0 |
| 207 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 208 | struct rcvd_async_info { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 209 | u8 *pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 210 | u32 u32Length; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 211 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 212 | |
| 213 | /*! |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 214 | * @struct channel_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 215 | * @brief Set Channel message body |
| 216 | * @details |
| 217 | * @todo |
| 218 | * @sa |
| 219 | * @author Mai Daftedar |
| 220 | * @date 25 March 2012 |
| 221 | * @version 1.0 |
| 222 | */ |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 223 | struct channel_attr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 224 | u8 u8SetChan; |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 225 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 226 | |
| 227 | /*! |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 228 | * @struct tstrScanComplete |
| 229 | * @brief hold received Async. Scan Complete message body |
| 230 | * @details |
| 231 | * @todo |
| 232 | * @sa |
| 233 | * @author zsalah |
| 234 | * @date 25 March 2012 |
| 235 | * @version 1.0 |
| 236 | */ |
| 237 | /*typedef struct _tstrScanComplete |
| 238 | * { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 239 | * u8* pu8Buffer; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 240 | * u32 u32Length; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 241 | * } tstrScanComplete;*/ |
| 242 | |
| 243 | /*! |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 244 | * @struct beacon_attr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 245 | * @brief Set Beacon message body |
| 246 | * @details |
| 247 | * @todo |
| 248 | * @sa |
| 249 | * @author Adham Abozaeid |
| 250 | * @date 10 July 2012 |
| 251 | * @version 1.0 |
| 252 | */ |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 253 | struct beacon_attr { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 254 | u32 u32Interval; /*!< Beacon Interval. Period between two successive beacons on air */ |
| 255 | u32 u32DTIMPeriod; /*!< DTIM Period. Indicates how many Beacon frames |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 256 | * (including the current frame) appear before the next DTIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 257 | u32 u32HeadLen; /*!< Length of the head buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 258 | u8 *pu8Head; /*!< Pointer to the beacon's head buffer. Beacon's head is the part |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 259 | * from the beacon's start till the TIM element, NOT including the TIM */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 260 | u32 u32TailLen; /*!< Length of the tail buffer in bytes */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 261 | u8 *pu8Tail; /*!< Pointer to the beacon's tail buffer. Beacon's tail starts just |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 262 | * after the TIM inormation element */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 263 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 264 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 265 | /*! |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 266 | * @struct set_multicast |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 267 | * @brief set Multicast filter Address |
| 268 | * @details |
| 269 | * @todo |
| 270 | * @sa |
| 271 | * @author Abdelrahman Sobhy |
| 272 | * @date 30 August 2013 |
| 273 | * @version 1.0 Description |
| 274 | */ |
| 275 | |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 276 | struct set_multicast { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 277 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 278 | u32 u32count; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 279 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 280 | |
| 281 | /*! |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 282 | * @struct del_all_sta |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 283 | * @brief Deauth station message body |
| 284 | * @details |
| 285 | * @todo |
| 286 | * @sa |
| 287 | * @author Mai Daftedar |
| 288 | * @date 09 April 2014 |
| 289 | * @version 1.0 Description |
| 290 | */ |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 291 | struct del_all_sta { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 292 | u8 au8Sta_DelAllSta[MAX_NUM_STA][ETH_ALEN]; |
| 293 | u8 u8Num_AssocSta; |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 294 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 295 | |
| 296 | /*! |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 297 | * @struct del_sta |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 298 | * @brief Delete station message body |
| 299 | * @details |
| 300 | * @todo |
| 301 | * @sa |
| 302 | * @author Adham Abozaeid |
| 303 | * @date 15 July 2012 |
| 304 | * @version 1.0 Description |
| 305 | */ |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 306 | struct del_sta { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 307 | u8 au8MacAddr[ETH_ALEN]; |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 308 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 309 | |
| 310 | /*! |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 311 | * @struct power_mgmt_param |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 312 | * @brief Power management message body |
| 313 | * @details |
| 314 | * @todo |
| 315 | * @sa |
| 316 | * @author Adham Abozaeid |
| 317 | * @date 24 November 2012 |
| 318 | * @version 1.0 |
| 319 | */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 320 | struct power_mgmt_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 321 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 322 | bool bIsEnabled; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 323 | u32 u32Timeout; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 324 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 325 | |
| 326 | /*! |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 327 | * @struct set_ip_addr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 328 | * @brief set IP Address message body |
| 329 | * @details |
| 330 | * @todo |
| 331 | * @sa |
| 332 | * @author Abdelrahman Sobhy |
| 333 | * @date 30 August 2013 |
| 334 | * @version 1.0 Description |
| 335 | */ |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 336 | struct set_ip_addr { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 337 | u8 *au8IPAddr; |
| 338 | u8 idx; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 339 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 340 | |
| 341 | /*! |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 342 | * @struct sta_inactive_t |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 343 | * @brief Get station message body |
| 344 | * @details |
| 345 | * @todo |
| 346 | * @sa |
| 347 | * @author Mai Daftedar |
| 348 | * @date 16 April 2013 |
| 349 | * @version 1.0 |
| 350 | */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 351 | struct sta_inactive_t { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 352 | u8 mac[6]; |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 353 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 354 | /**/ |
| 355 | /*! |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 356 | * @union message_body |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 357 | * @brief Message body for the Host Interface message_q |
| 358 | * @details |
| 359 | * @todo |
| 360 | * @sa |
| 361 | * @author Mostafa Abu Bakr |
| 362 | * @date 25 March 2012 |
| 363 | * @version 1.0 |
| 364 | */ |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 365 | union message_body { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 366 | struct scan_attr scan_info; |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 367 | struct connect_attr con_info; |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 368 | struct rcvd_net_info net_info; |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 369 | struct rcvd_async_info async_info; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 370 | struct key_attr key_info; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 371 | struct cfg_param_attr cfg_info; |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 372 | struct channel_attr channel_info; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 373 | struct beacon_attr beacon_info; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 374 | struct add_sta_param add_sta_info; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 375 | struct del_sta del_sta_info; |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 376 | struct add_sta_param edit_sta_info; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 377 | struct power_mgmt_param pwr_mgmt_info; |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 378 | struct sta_inactive_t mac_info; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 379 | struct set_ip_addr ip_info; |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 380 | struct drv_handler drv; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 381 | struct set_multicast multicast_info; |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 382 | struct op_mode mode; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 383 | struct set_mac_addr set_mac_info; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 384 | struct get_mac_addr get_mac_info; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 385 | struct ba_session_info session_info; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 386 | struct remain_ch remain_on_ch; |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 387 | struct reg_frame reg_frame; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 388 | char *data; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 389 | struct del_all_sta del_all_sta_info; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 390 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 391 | |
| 392 | /*! |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 393 | * @struct struct host_if_msg |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 394 | * @brief Host Interface message |
| 395 | * @details |
| 396 | * @todo |
| 397 | * @sa |
| 398 | * @author Mostafa Abu Bakr |
| 399 | * @date 25 March 2012 |
| 400 | * @version 1.0 |
| 401 | */ |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 402 | struct host_if_msg { |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 403 | u16 id; /*!< Message ID */ |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 404 | union message_body body; /*!< Message body */ |
Johnny Kim | 11f58c8 | 2015-08-13 13:41:20 +0900 | [diff] [blame] | 405 | tstrWILC_WFIDrv *drvHandler; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 406 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 407 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 408 | typedef struct _tstrWidJoinReqExt { |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 409 | char SSID[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 410 | u8 u8channel; |
| 411 | u8 BSSID[6]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 412 | } tstrWidJoinReqExt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 413 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 414 | /*Struct containg joinParam of each AP*/ |
| 415 | typedef struct _tstrJoinBssParam { |
| 416 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 417 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 418 | u16 beacon_period; |
| 419 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 420 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 421 | char ssid[MAX_SSID_LEN]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 422 | u8 ssidLen; |
| 423 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 424 | u8 ht_capable; |
| 425 | u8 wmm_cap; |
| 426 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 427 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 428 | u8 rsn_grp_policy; |
| 429 | u8 mode_802_11i; |
| 430 | u8 rsn_pcip_policy[3]; |
| 431 | u8 rsn_auth_policy[3]; |
| 432 | u8 rsn_cap[2]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 433 | struct _tstrJoinParam *nextJoinBss; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 434 | u32 tsf; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 435 | u8 u8NoaEnbaled; |
| 436 | u8 u8OppEnable; |
| 437 | u8 u8CtWindow; |
| 438 | u8 u8Count; |
| 439 | u8 u8Index; |
| 440 | u8 au8Duration[4]; |
| 441 | u8 au8Interval[4]; |
| 442 | u8 au8StartTime[4]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 443 | } tstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 444 | /*a linked list table containing needed join parameters entries for each AP found in most recent scan*/ |
| 445 | typedef struct _tstrBssTable { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 446 | u8 u8noBssEntries; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 447 | tstrJoinBssParam *head; |
| 448 | tstrJoinBssParam *tail; |
| 449 | } tstrBssTable; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 450 | |
| 451 | typedef enum { |
| 452 | SCAN_TIMER = 0, |
| 453 | CONNECT_TIMER = 1, |
| 454 | SCAN_CONNECT_TIMER_FORCE_32BIT = 0xFFFFFFFF |
| 455 | } tenuScanConnTimer; |
| 456 | |
| 457 | /*****************************************************************************/ |
| 458 | /* */ |
| 459 | /* Global Variabls */ |
| 460 | /* */ |
| 461 | /*****************************************************************************/ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 462 | /* Zero is not used, because a zero ID means termination */ |
| 463 | static tstrWILC_WFIDrv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
Daniel Machon | 6fdb302 | 2015-07-06 19:48:04 +0200 | [diff] [blame] | 464 | tstrWILC_WFIDrv *terminated_handle; |
| 465 | tstrWILC_WFIDrv *gWFiDrvHandle; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 466 | bool g_obtainingIP = false; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 467 | u8 P2P_LISTEN_STATE; |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 468 | static struct task_struct *HostIFthreadHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 469 | static WILC_MsgQueueHandle gMsgQHostIF; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 470 | static struct semaphore hSemHostIFthrdEnd; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 471 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 472 | struct semaphore hSemDeinitDrvHandle; |
| 473 | static struct semaphore hWaitResponse; |
| 474 | struct semaphore hSemHostIntDeinit; |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 475 | struct timer_list g_hPeriodicRSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 476 | |
| 477 | |
| 478 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 479 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 480 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 481 | static u8 gapu8RcvdAssocResp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 482 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 483 | bool gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 484 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 485 | static s8 gs8Rssi; |
| 486 | static s8 gs8lnkspd; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 487 | static u8 gu8Chnl; |
| 488 | static u8 gs8SetIP[2][4]; |
| 489 | static u8 gs8GetIP[2][4]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 490 | static u32 gu32InactiveTime; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 491 | static u8 gu8DelBcn; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 492 | static u32 gu32WidConnRstHack; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 493 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 494 | u8 *gu8FlushedJoinReq; |
| 495 | u8 *gu8FlushedInfoElemAsoc; |
| 496 | u8 gu8Flushed11iMode; |
| 497 | u8 gu8FlushedAuthType; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 498 | u32 gu32FlushedJoinReqSize; |
| 499 | u32 gu32FlushedInfoElemAsocSize; |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 500 | tstrWILC_WFIDrv *gu8FlushedJoinReqDrvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 501 | #define REAL_JOIN_REQ 0 |
| 502 | #define FLUSHED_JOIN_REQ 1 |
| 503 | #define FLUSHED_BYTE_POS 79 /* Position the byte indicating flushing in the flushed request */ |
| 504 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 505 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 506 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 507 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 508 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 509 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 510 | static int add_handler_in_list(tstrWILC_WFIDrv *handler) |
| 511 | { |
| 512 | int i; |
| 513 | |
| 514 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 515 | if (!wfidrv_list[i]) { |
| 516 | wfidrv_list[i] = handler; |
| 517 | return 0; |
| 518 | } |
| 519 | } |
| 520 | |
| 521 | return -ENOBUFS; |
| 522 | } |
| 523 | |
| 524 | static int remove_handler_in_list(tstrWILC_WFIDrv *handler) |
| 525 | { |
| 526 | int i; |
| 527 | |
| 528 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 529 | if (wfidrv_list[i] == handler) { |
| 530 | wfidrv_list[i] = NULL; |
| 531 | return 0; |
| 532 | } |
| 533 | } |
| 534 | |
| 535 | return -EINVAL; |
| 536 | } |
| 537 | |
| 538 | static int get_id_from_handler(tstrWILC_WFIDrv *handler) |
| 539 | { |
| 540 | int i; |
| 541 | |
| 542 | if (!handler) |
| 543 | return 0; |
| 544 | |
| 545 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 546 | if (wfidrv_list[i] == handler) |
| 547 | return i; |
| 548 | } |
| 549 | |
| 550 | return 0; |
| 551 | } |
| 552 | |
| 553 | static tstrWILC_WFIDrv *get_handler_from_id(int id) |
| 554 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 555 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 556 | return NULL; |
| 557 | return wfidrv_list[id]; |
| 558 | } |
| 559 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 560 | /** |
| 561 | * @brief Handle_SetChannel |
| 562 | * @details Sending config packet to firmware to set channel |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 563 | * @param[in] struct channel_attr *pstrHostIFSetChan |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 564 | * @return Error code. |
| 565 | * @author |
| 566 | * @date |
| 567 | * @version 1.0 |
| 568 | */ |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 569 | static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler, |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 570 | struct channel_attr *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 571 | { |
| 572 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 573 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 574 | tstrWID strWID; |
| 575 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 576 | |
| 577 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 578 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 579 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 580 | strWID.ps8WidVal = (char *)&(pstrHostIFSetChan->u8SetChan); |
| 581 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 582 | |
| 583 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
| 584 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 585 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 586 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 587 | if (s32Error) { |
| 588 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 589 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 590 | } |
| 591 | |
| 592 | return s32Error; |
| 593 | } |
| 594 | /** |
| 595 | * @brief Handle_SetWfiDrvHandler |
| 596 | * @details Sending config packet to firmware to set driver handler |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 597 | * @param[in] void * drvHandler, |
| 598 | * struct drv_handler *pstrHostIfSetDrvHandler |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 599 | * @return Error code. |
| 600 | * @author |
| 601 | * @date |
| 602 | * @version 1.0 |
| 603 | */ |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 604 | static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv *drvHandler, |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 605 | struct drv_handler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 606 | { |
| 607 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 608 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 609 | tstrWID strWID; |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 610 | tstrWILC_WFIDrv *pstrWFIDrv = drvHandler; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 611 | |
| 612 | |
| 613 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 614 | strWID.u16WIDid = (u16)WID_SET_DRV_HANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 615 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 616 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetDrvHandler->u32Address); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 617 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 618 | |
| 619 | /*Sending Cfg*/ |
| 620 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 621 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 622 | pstrHostIfSetDrvHandler->u32Address); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 623 | |
Johnny Kim | 53a8440 | 2015-08-20 16:32:51 +0900 | [diff] [blame] | 624 | if (pstrWFIDrv == NULL) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 625 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 626 | |
| 627 | |
| 628 | if (s32Error) { |
| 629 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 630 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | return s32Error; |
| 634 | } |
| 635 | |
| 636 | /** |
| 637 | * @brief Handle_SetWfiAPDrvHandler |
| 638 | * @details Sending config packet to firmware to set driver handler |
| 639 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 640 | * @return Error code. |
| 641 | * @author |
| 642 | * @date |
| 643 | * @version 1.0 |
| 644 | */ |
Tony Cho | 801bee5 | 2015-09-21 12:16:53 +0900 | [diff] [blame] | 645 | static s32 Handle_SetOperationMode(tstrWILC_WFIDrv *drvHandler, |
| 646 | struct op_mode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 647 | { |
| 648 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 649 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 650 | tstrWID strWID; |
| 651 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 652 | |
| 653 | |
| 654 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 655 | strWID.u16WIDid = (u16)WID_SET_OPERATION_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 656 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 657 | strWID.ps8WidVal = (s8 *)&(pstrHostIfSetOperationMode->u32Mode); |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 658 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 659 | |
| 660 | /*Sending Cfg*/ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 661 | PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 662 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 663 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 664 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 665 | |
| 666 | |
Johnny Kim | c590b9a | 2015-09-08 17:07:59 +0900 | [diff] [blame] | 667 | if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE) |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 668 | up(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 669 | |
| 670 | |
| 671 | if (s32Error) { |
| 672 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 673 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 674 | } |
| 675 | |
| 676 | return s32Error; |
| 677 | } |
| 678 | |
| 679 | /** |
| 680 | * @brief host_int_set_IPAddress |
| 681 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 682 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 683 | * @return Error code. |
| 684 | * @author |
| 685 | * @date |
| 686 | * @version 1.0 |
| 687 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 688 | s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 689 | { |
| 690 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 691 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 692 | tstrWID strWID; |
| 693 | char firmwareIPAddress[4] = {0}; |
| 694 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 695 | |
| 696 | if (pu8IPAddr[0] < 192) |
| 697 | pu8IPAddr[0] = 0; |
| 698 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 699 | PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 700 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 701 | memcpy(gs8SetIP[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 702 | |
| 703 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 704 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 705 | strWID.enuWIDtype = WID_STR; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 706 | strWID.ps8WidVal = (u8 *)pu8IPAddr; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 707 | strWID.s32ValueSize = IP_ALEN; |
| 708 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 709 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 710 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 711 | |
| 712 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 713 | host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 714 | |
| 715 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 716 | PRINT_ER("Failed to set IP address\n"); |
| 717 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 718 | } |
| 719 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 720 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 721 | |
| 722 | return s32Error; |
| 723 | } |
| 724 | |
| 725 | |
| 726 | /** |
| 727 | * @brief Handle_get_IPAddress |
| 728 | * @details Setting IP address params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 729 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8IPAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 730 | * @return Error code. |
| 731 | * @author |
| 732 | * @date |
| 733 | * @version 1.0 |
| 734 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 735 | s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 736 | { |
| 737 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 738 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 739 | tstrWID strWID; |
| 740 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 741 | |
| 742 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 743 | strWID.u16WIDid = (u16)WID_IP_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 744 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 745 | strWID.ps8WidVal = kmalloc(IP_ALEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 746 | strWID.s32ValueSize = IP_ALEN; |
| 747 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 748 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 749 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 750 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 751 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 752 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 753 | memcpy(gs8GetIP[idx], strWID.ps8WidVal, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 754 | |
| 755 | /*get the value by searching the local copy*/ |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 756 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 757 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 758 | if (memcmp(gs8GetIP[idx], gs8SetIP[idx], IP_ALEN) != 0) |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 759 | host_int_setup_ipaddress(pstrWFIDrv, gs8SetIP[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 760 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 761 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 762 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 763 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 764 | } |
| 765 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 766 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
| 767 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", gs8GetIP[idx]); |
| 768 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 769 | |
| 770 | return s32Error; |
| 771 | } |
| 772 | |
| 773 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 774 | /** |
| 775 | * @brief Handle_SetMacAddress |
| 776 | * @details Setting mac address |
| 777 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 778 | * @return Error code. |
| 779 | * @author Amr Abdel-Moghny |
| 780 | * @date November 2013 |
| 781 | * @version 7.0 |
| 782 | */ |
Tony Cho | b7611a8 | 2015-09-21 12:16:54 +0900 | [diff] [blame] | 783 | static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler, |
| 784 | struct set_mac_addr *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 785 | { |
| 786 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 787 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 788 | tstrWID strWID; |
| 789 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 790 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 791 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 792 | if (mac_buf == NULL) { |
| 793 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 794 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 795 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 796 | memcpy(mac_buf, pstrHostIfSetMacAddress->u8MacAddress, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 797 | |
| 798 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 799 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 800 | strWID.enuWIDtype = WID_STR; |
| 801 | strWID.ps8WidVal = mac_buf; |
| 802 | strWID.s32ValueSize = ETH_ALEN; |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 803 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 804 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 805 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 806 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 807 | if (s32Error) { |
| 808 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 809 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 810 | } |
| 811 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 812 | kfree(mac_buf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 813 | return s32Error; |
| 814 | } |
| 815 | |
| 816 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 817 | /** |
| 818 | * @brief Handle_GetMacAddress |
| 819 | * @details Getting mac address |
| 820 | * @param[in] void * drvHandler,tstrHostIfSetDrvHandler* pstrHostIfSetDrvHandler |
| 821 | * @return Error code. |
| 822 | * @author Amr Abdel-Moghny |
| 823 | * @date JAN 2013 |
| 824 | * @version 8.0 |
| 825 | */ |
Tony Cho | fcd27c5 | 2015-09-21 12:16:55 +0900 | [diff] [blame] | 826 | static s32 Handle_GetMacAddress(tstrWILC_WFIDrv *drvHandler, |
| 827 | struct get_mac_addr *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 828 | { |
| 829 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 830 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 831 | tstrWID strWID; |
| 832 | |
| 833 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 834 | strWID.u16WIDid = (u16)WID_MAC_ADDR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 835 | strWID.enuWIDtype = WID_STR; |
| 836 | strWID.ps8WidVal = pstrHostIfGetMacAddress->u8MacAddress; |
| 837 | strWID.s32ValueSize = ETH_ALEN; |
| 838 | |
| 839 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 840 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, false, |
| 841 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 842 | if (s32Error) { |
| 843 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 844 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 845 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 846 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 847 | |
| 848 | return s32Error; |
| 849 | } |
| 850 | |
| 851 | |
| 852 | /** |
| 853 | * @brief Handle_CfgParam |
| 854 | * @details Sending config packet to firmware to set CFG params |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 855 | * @param[in] struct cfg_param_attr *strHostIFCfgParamAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 856 | * @return Error code. |
| 857 | * @author |
| 858 | * @date |
| 859 | * @version 1.0 |
| 860 | */ |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 861 | static s32 Handle_CfgParam(tstrWILC_WFIDrv *drvHandler, |
| 862 | struct cfg_param_attr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 863 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 864 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 865 | tstrWID strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 866 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 867 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 868 | |
| 869 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 870 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 871 | |
| 872 | |
| 873 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 874 | |
| 875 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BSS_TYPE) { |
| 876 | /*----------------------------------------------------------*/ |
| 877 | /*Input Value: INFRASTRUCTURE = 1, */ |
| 878 | /* INDEPENDENT= 2, */ |
| 879 | /* ANY_BSS= 3 */ |
| 880 | /*----------------------------------------------------------*/ |
| 881 | /* validate input then copy>> need to check value 4 and 5 */ |
| 882 | if (strHostIFCfgParamAttr->pstrCfgParamVal.bss_type < 6) { |
| 883 | strWIDList[u8WidCnt].u16WIDid = WID_BSS_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 884 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 885 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 886 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 887 | pstrWFIDrv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 888 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 889 | PRINT_ER("check value 6 over\n"); |
| 890 | s32Error = -EINVAL; |
| 891 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 892 | } |
| 893 | u8WidCnt++; |
| 894 | } |
| 895 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTH_TYPE) { |
| 896 | /*------------------------------------------------------*/ |
| 897 | /*Input Values: OPEN_SYSTEM = 0, */ |
| 898 | /* SHARED_KEY = 1, */ |
| 899 | /* ANY = 2 */ |
| 900 | /*------------------------------------------------------*/ |
| 901 | /*validate Possible values*/ |
| 902 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 1 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 2 || (strHostIFCfgParamAttr->pstrCfgParamVal.auth_type) == 5) { |
| 903 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TYPE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 904 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 905 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 906 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 907 | pstrWFIDrv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 908 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 909 | PRINT_ER("Impossible value \n"); |
| 910 | s32Error = -EINVAL; |
| 911 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 912 | } |
| 913 | u8WidCnt++; |
| 914 | } |
| 915 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & AUTHEN_TIMEOUT) { |
| 916 | /* range is 1 to 65535. */ |
| 917 | if (strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout < 65536) { |
| 918 | strWIDList[u8WidCnt].u16WIDid = WID_AUTH_TIMEOUT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 919 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 920 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 921 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 922 | pstrWFIDrv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->pstrCfgParamVal.auth_timeout; |
| 923 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 924 | PRINT_ER("Range(1 ~ 65535) over\n"); |
| 925 | s32Error = -EINVAL; |
| 926 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 927 | } |
| 928 | u8WidCnt++; |
| 929 | } |
| 930 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & POWER_MANAGEMENT) { |
| 931 | /*-----------------------------------------------------------*/ |
| 932 | /*Input Values: NO_POWERSAVE = 0, */ |
| 933 | /* MIN_FAST_PS = 1, */ |
| 934 | /* MAX_FAST_PS = 2, */ |
| 935 | /* MIN_PSPOLL_PS = 3, */ |
| 936 | /* MAX_PSPOLL_PS = 4 */ |
| 937 | /*----------------------------------------------------------*/ |
| 938 | if (strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode < 5) { |
| 939 | strWIDList[u8WidCnt].u16WIDid = WID_POWER_MANAGEMENT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 940 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 941 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 942 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 943 | pstrWFIDrv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 944 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 945 | PRINT_ER("Invalide power mode\n"); |
| 946 | s32Error = -EINVAL; |
| 947 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 948 | } |
| 949 | u8WidCnt++; |
| 950 | } |
| 951 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_SHORT) { |
| 952 | /* range from 1 to 256 */ |
| 953 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit < 256)) { |
| 954 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 955 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 956 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 957 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 958 | pstrWFIDrv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.short_retry_limit; |
| 959 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 960 | PRINT_ER("Range(1~256) over\n"); |
| 961 | s32Error = -EINVAL; |
| 962 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 963 | } |
| 964 | u8WidCnt++; |
| 965 | } |
| 966 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RETRY_LONG) { |
| 967 | /* range from 1 to 256 */ |
| 968 | if ((strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit > 0) && (strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit < 256)) { |
| 969 | strWIDList[u8WidCnt].u16WIDid = WID_LONG_RETRY_LIMIT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 970 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 971 | |
| 972 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 973 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 974 | pstrWFIDrv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->pstrCfgParamVal.long_retry_limit; |
| 975 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 976 | PRINT_ER("Range(1~256) over\n"); |
| 977 | s32Error = -EINVAL; |
| 978 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 979 | } |
| 980 | u8WidCnt++; |
| 981 | } |
| 982 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & FRAG_THRESHOLD) { |
| 983 | |
| 984 | if (strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold < 7937) { |
| 985 | strWIDList[u8WidCnt].u16WIDid = WID_FRAG_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 986 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 987 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 988 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 989 | pstrWFIDrv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.frag_threshold; |
| 990 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 991 | PRINT_ER("Threshold Range fail\n"); |
| 992 | s32Error = -EINVAL; |
| 993 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 994 | } |
| 995 | u8WidCnt++; |
| 996 | } |
| 997 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & RTS_THRESHOLD) { |
| 998 | /* range 256 to 65535 */ |
| 999 | if (strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold > 255 && strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold < 65536) { |
| 1000 | strWIDList[u8WidCnt].u16WIDid = WID_RTS_THRESHOLD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1001 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1002 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1003 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1004 | pstrWFIDrv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->pstrCfgParamVal.rts_threshold; |
| 1005 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1006 | PRINT_ER("Threshold Range fail\n"); |
| 1007 | s32Error = -EINVAL; |
| 1008 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1009 | } |
| 1010 | u8WidCnt++; |
| 1011 | } |
| 1012 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PREAMBLE) { |
| 1013 | /*-----------------------------------------------------*/ |
| 1014 | /*Input Values: Short= 0, */ |
| 1015 | /* Long= 1, */ |
| 1016 | /* Auto= 2 */ |
| 1017 | /*------------------------------------------------------*/ |
| 1018 | if (strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type < 3) { |
| 1019 | strWIDList[u8WidCnt].u16WIDid = WID_PREAMBLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1020 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1021 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1022 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1023 | pstrWFIDrv->strCfgValues.preamble_type = strHostIFCfgParamAttr->pstrCfgParamVal.preamble_type; |
| 1024 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1025 | PRINT_ER("Preamle Range(0~2) over\n"); |
| 1026 | s32Error = -EINVAL; |
| 1027 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1028 | } |
| 1029 | u8WidCnt++; |
| 1030 | } |
| 1031 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SHORT_SLOT_ALLOWED) { |
| 1032 | if (strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed < 2) { |
| 1033 | strWIDList[u8WidCnt].u16WIDid = WID_SHORT_SLOT_ALLOWED; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1034 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1035 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1036 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1037 | pstrWFIDrv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1038 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1039 | PRINT_ER("Short slot(2) over\n"); |
| 1040 | s32Error = -EINVAL; |
| 1041 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1042 | } |
| 1043 | u8WidCnt++; |
| 1044 | } |
| 1045 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & TXOP_PROT_DISABLE) { |
| 1046 | /*Description: used to Disable RTS-CTS protection for TXOP burst*/ |
| 1047 | /*transmission when the acknowledgement policy is No-Ack or Block-Ack */ |
| 1048 | /* this information is useful for external supplicant */ |
| 1049 | /*Input Values: 1 for enable and 0 for disable. */ |
| 1050 | if (strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled < 2) { |
| 1051 | strWIDList[u8WidCnt].u16WIDid = WID_11N_TXOP_PROT_DISABLE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1052 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1053 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1054 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1055 | pstrWFIDrv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1056 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1057 | PRINT_ER("TXOP prot disable\n"); |
| 1058 | s32Error = -EINVAL; |
| 1059 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1060 | } |
| 1061 | u8WidCnt++; |
| 1062 | } |
| 1063 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & BEACON_INTERVAL) { |
| 1064 | /* range is 1 to 65535. */ |
| 1065 | if (strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval < 65536) { |
| 1066 | strWIDList[u8WidCnt].u16WIDid = WID_BEACON_INTERVAL; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1067 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1068 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1069 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1070 | pstrWFIDrv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->pstrCfgParamVal.beacon_interval; |
| 1071 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1072 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
| 1073 | s32Error = -EINVAL; |
| 1074 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1075 | } |
| 1076 | u8WidCnt++; |
| 1077 | } |
| 1078 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & DTIM_PERIOD) { |
| 1079 | /* range is 1 to 255. */ |
| 1080 | if (strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period < 256) { |
| 1081 | strWIDList[u8WidCnt].u16WIDid = WID_DTIM_PERIOD; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1082 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1083 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1084 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1085 | pstrWFIDrv->strCfgValues.dtim_period = strHostIFCfgParamAttr->pstrCfgParamVal.dtim_period; |
| 1086 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1087 | PRINT_ER("DTIM range(1~255) fail\n"); |
| 1088 | s32Error = -EINVAL; |
| 1089 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1090 | } |
| 1091 | u8WidCnt++; |
| 1092 | } |
| 1093 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY) { |
| 1094 | /*----------------------------------------------------------------------*/ |
| 1095 | /*Input Values: SITE_SURVEY_1CH = 0, i.e.: currently set channel */ |
| 1096 | /* SITE_SURVEY_ALL_CH = 1, */ |
| 1097 | /* SITE_SURVEY_OFF = 2 */ |
| 1098 | /*----------------------------------------------------------------------*/ |
| 1099 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled < 3) { |
| 1100 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1101 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1102 | strWIDList[u8WidCnt].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1103 | strWIDList[u8WidCnt].s32ValueSize = sizeof(char); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1104 | pstrWFIDrv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1105 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1106 | PRINT_ER("Site survey disable\n"); |
| 1107 | s32Error = -EINVAL; |
| 1108 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1109 | } |
| 1110 | u8WidCnt++; |
| 1111 | } |
| 1112 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & SITE_SURVEY_SCAN_TIME) { |
| 1113 | /* range is 1 to 65535. */ |
| 1114 | if (strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time < 65536) { |
| 1115 | strWIDList[u8WidCnt].u16WIDid = WID_SITE_SURVEY_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1116 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1117 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1118 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1119 | pstrWFIDrv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.site_survey_scan_time; |
| 1120 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1121 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
| 1122 | s32Error = -EINVAL; |
| 1123 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1124 | } |
| 1125 | u8WidCnt++; |
| 1126 | } |
| 1127 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & ACTIVE_SCANTIME) { |
| 1128 | /* range is 1 to 65535. */ |
| 1129 | if (strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time < 65536) { |
| 1130 | strWIDList[u8WidCnt].u16WIDid = WID_ACTIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1131 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1132 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1133 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1134 | pstrWFIDrv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.active_scan_time; |
| 1135 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1136 | PRINT_ER("Active scan time(1~65535) over\n"); |
| 1137 | s32Error = -EINVAL; |
| 1138 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1139 | } |
| 1140 | u8WidCnt++; |
| 1141 | } |
| 1142 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & PASSIVE_SCANTIME) { |
| 1143 | /* range is 1 to 65535. */ |
| 1144 | if (strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time > 0 && strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time < 65536) { |
| 1145 | strWIDList[u8WidCnt].u16WIDid = WID_PASSIVE_SCAN_TIME; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1146 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1147 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1148 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1149 | pstrWFIDrv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->pstrCfgParamVal.passive_scan_time; |
| 1150 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1151 | PRINT_ER("Passive scan time(1~65535) over\n"); |
| 1152 | s32Error = -EINVAL; |
| 1153 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1154 | } |
| 1155 | u8WidCnt++; |
| 1156 | } |
| 1157 | if (strHostIFCfgParamAttr->pstrCfgParamVal.u32SetCfgFlag & CURRENT_TX_RATE) { |
Leo Kim | 430a78c | 2015-10-05 15:25:48 +0900 | [diff] [blame] | 1158 | enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->pstrCfgParamVal.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1159 | /*----------------------------------------------------------------------*/ |
| 1160 | /*Rates: 1 2 5.5 11 6 9 12 18 24 36 48 54 Auto */ |
| 1161 | /*InputValues: 1 2 3 4 5 6 7 8 9 10 11 12 0 */ |
| 1162 | /*----------------------------------------------------------------------*/ |
| 1163 | /* validate rate */ |
| 1164 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 1165 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 1166 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 1167 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 1168 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 1169 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
| 1170 | strWIDList[u8WidCnt].u16WIDid = WID_CURRENT_TX_RATE; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1171 | strWIDList[u8WidCnt].ps8WidVal = (s8 *)&curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1172 | strWIDList[u8WidCnt].enuWIDtype = WID_SHORT; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1173 | strWIDList[u8WidCnt].s32ValueSize = sizeof(u16); |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1174 | pstrWFIDrv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1175 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1176 | PRINT_ER("out of TX rate\n"); |
| 1177 | s32Error = -EINVAL; |
| 1178 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1179 | } |
| 1180 | u8WidCnt++; |
| 1181 | } |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1182 | s32Error = send_config_pkt(SET_CFG, strWIDList, u8WidCnt, false, |
| 1183 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1184 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1185 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1186 | PRINT_ER("Error in setting CFG params\n"); |
| 1187 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1188 | ERRORHANDLER: |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1189 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1190 | return s32Error; |
| 1191 | } |
| 1192 | |
| 1193 | |
| 1194 | /** |
| 1195 | * @brief Handle_wait_msg_q_empty |
| 1196 | * @details this should be the last msg and then the msg Q becomes idle |
| 1197 | * @param[in] tstrHostIFscanAttr* pstrHostIFscanAttr |
| 1198 | * @return Error code. |
| 1199 | * @author |
| 1200 | * @date |
| 1201 | * @version 1.0 |
| 1202 | */ |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1203 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1204 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1205 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1206 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1207 | g_wilc_initialized = 0; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 1208 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1209 | return s32Error; |
| 1210 | } |
| 1211 | |
| 1212 | /** |
| 1213 | * @brief Handle_Scan |
| 1214 | * @details Sending config packet to firmware to set the scan params |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1215 | * @param[in] struct scan_attr *pstrHostIFscanAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1216 | * @return Error code. |
| 1217 | * @author |
| 1218 | * @date |
| 1219 | * @version 1.0 |
| 1220 | */ |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 1221 | static s32 Handle_Scan(tstrWILC_WFIDrv *drvHandler, |
| 1222 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1223 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1224 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1225 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1226 | u32 u32WidsCount = 0; |
| 1227 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1228 | u8 *pu8Buffer; |
| 1229 | u8 valuesize = 0; |
| 1230 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1231 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1232 | |
| 1233 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1234 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1235 | |
| 1236 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->pfScanResult; |
| 1237 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->pvUserArg; |
| 1238 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1239 | if ((pstrWFIDrv->enuHostIFstate >= HOST_IF_SCANNING) && (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTED)) { |
| 1240 | /* here we either in HOST_IF_SCANNING, HOST_IF_WAITING_CONN_REQ or HOST_IF_WAITING_CONN_RESP */ |
| 1241 | PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", pstrWFIDrv->enuHostIFstate); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1242 | PRINT_ER("Already scan\n"); |
| 1243 | s32Error = -EBUSY; |
| 1244 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1245 | } |
| 1246 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1247 | if (g_obtainingIP || connecting) { |
| 1248 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1249 | PRINT_ER("Don't do obss scan\n"); |
| 1250 | s32Error = -EBUSY; |
| 1251 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1252 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1253 | |
| 1254 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 1255 | |
| 1256 | |
| 1257 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
| 1258 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1259 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_SSID_PROBE_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1260 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1261 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1262 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1263 | valuesize += ((pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1264 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1265 | strWIDList[u32WidsCount].ps8WidVal = pu8HdnNtwrksWidVal; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1266 | if (strWIDList[u32WidsCount].ps8WidVal != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1267 | pu8Buffer = strWIDList[u32WidsCount].ps8WidVal; |
| 1268 | |
| 1269 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; |
| 1270 | |
| 1271 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum); |
| 1272 | |
| 1273 | for (i = 0; i < pstrHostIFscanAttr->strHiddenNetwork.u8ssidnum; i++) { |
| 1274 | *pu8Buffer++ = pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1275 | memcpy(pu8Buffer, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1276 | pu8Buffer += pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 1277 | } |
| 1278 | |
| 1279 | |
| 1280 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 1281 | strWIDList[u32WidsCount].s32ValueSize = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1282 | u32WidsCount++; |
| 1283 | } |
| 1284 | |
| 1285 | /*filling cfg param array*/ |
| 1286 | |
| 1287 | /* if((pstrHostIFscanAttr->pu8IEs != NULL) && (pstrHostIFscanAttr->IEsLen != 0)) */ |
| 1288 | { |
| 1289 | /* IEs to be inserted in Probe Request */ |
| 1290 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_PROBE; |
| 1291 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1292 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8IEs; |
| 1293 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->IEsLen; |
| 1294 | u32WidsCount++; |
| 1295 | } |
| 1296 | |
| 1297 | /*Scan Type*/ |
| 1298 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_TYPE; |
| 1299 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1300 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1301 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanType)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1302 | u32WidsCount++; |
| 1303 | |
| 1304 | /*list of channels to be scanned*/ |
| 1305 | strWIDList[u32WidsCount].u16WIDid = WID_SCAN_CHANNEL_LIST; |
| 1306 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1307 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1308 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL && pstrHostIFscanAttr->u8ChnlListLen > 0) { |
| 1309 | int i; |
| 1310 | |
| 1311 | for (i = 0; i < pstrHostIFscanAttr->u8ChnlListLen; i++) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1312 | if (pstrHostIFscanAttr->pu8ChnlFreqList[i] > 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1313 | pstrHostIFscanAttr->pu8ChnlFreqList[i] = pstrHostIFscanAttr->pu8ChnlFreqList[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | strWIDList[u32WidsCount].ps8WidVal = pstrHostIFscanAttr->pu8ChnlFreqList; |
| 1318 | strWIDList[u32WidsCount].s32ValueSize = pstrHostIFscanAttr->u8ChnlListLen; |
| 1319 | u32WidsCount++; |
| 1320 | |
| 1321 | /*Scan Request*/ |
| 1322 | strWIDList[u32WidsCount].u16WIDid = WID_START_SCAN_REQ; |
| 1323 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1324 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1325 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrHostIFscanAttr->u8ScanSource)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1326 | u32WidsCount++; |
| 1327 | |
| 1328 | /*keep the state as is , no need to change it*/ |
| 1329 | /* gWFiDrvHandle->enuHostIFstate = HOST_IF_SCANNING; */ |
| 1330 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1331 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1332 | gbScanWhileConnected = true; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1333 | else if (pstrWFIDrv->enuHostIFstate == HOST_IF_IDLE) |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1334 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1335 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1336 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1337 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1338 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1339 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1340 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1341 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1342 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1343 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1344 | ERRORHANDLER: |
| 1345 | if (s32Error) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1346 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1347 | /*if there is an ongoing scan request*/ |
| 1348 | Handle_ScanDone(drvHandler, SCAN_EVENT_ABORTED); |
| 1349 | } |
| 1350 | |
| 1351 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1352 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1353 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1354 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1355 | } |
| 1356 | |
| 1357 | /* Deallocate pstrHostIFscanAttr->pu8IEs which was previously allocated by the sending thread */ |
| 1358 | if (pstrHostIFscanAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1359 | kfree(pstrHostIFscanAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1360 | pstrHostIFscanAttr->pu8IEs = NULL; |
| 1361 | } |
| 1362 | if (pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1363 | kfree(pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1364 | pstrHostIFscanAttr->strHiddenNetwork.pstrHiddenNetworkInfo = NULL; |
| 1365 | } |
| 1366 | |
| 1367 | /* Deallocate pstrHostIFscanAttr->u8ChnlListLen which was prevoisuly allocated by the sending thread */ |
| 1368 | if (pstrHostIFscanAttr->pu8ChnlFreqList != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1369 | kfree(pstrHostIFscanAttr->pu8ChnlFreqList); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1370 | pstrHostIFscanAttr->pu8ChnlFreqList = NULL; |
| 1371 | } |
| 1372 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1373 | if (pu8HdnNtwrksWidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1374 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1375 | |
| 1376 | return s32Error; |
| 1377 | } |
| 1378 | |
| 1379 | /** |
| 1380 | * @brief Handle_ScanDone |
| 1381 | * @details Call scan notification callback function |
| 1382 | * @param[in] NONE |
| 1383 | * @return Error code. |
| 1384 | * @author |
| 1385 | * @date |
| 1386 | * @version 1.0 |
| 1387 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1388 | static s32 Handle_ScanDone(tstrWILC_WFIDrv *drvHandler, tenuScanEvent enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1389 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1390 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1391 | |
| 1392 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1393 | |
| 1394 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1395 | u8 u8abort_running_scan; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1396 | tstrWID strWID; |
| 1397 | |
| 1398 | |
| 1399 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 1400 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1401 | /*Ask FW to abort the running scan, if any*/ |
| 1402 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 1403 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 1404 | u8abort_running_scan = 1; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1405 | strWID.u16WIDid = (u16)WID_ABORT_RUNNING_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1406 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1407 | strWID.ps8WidVal = (s8 *)&u8abort_running_scan; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1408 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1409 | |
| 1410 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1411 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 1412 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1413 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1414 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1415 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1416 | } |
| 1417 | } |
| 1418 | |
| 1419 | if (pstrWFIDrv == NULL) { |
| 1420 | PRINT_ER("Driver handler is NULL\n"); |
| 1421 | return s32Error; |
| 1422 | } |
| 1423 | |
| 1424 | /*if there is an ongoing scan request*/ |
| 1425 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1426 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1427 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 1428 | /*delete current scan request*/ |
| 1429 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
| 1430 | } |
| 1431 | |
| 1432 | return s32Error; |
| 1433 | } |
| 1434 | |
| 1435 | /** |
| 1436 | * @brief Handle_Connect |
| 1437 | * @details Sending config packet to firmware to starting connection |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1438 | * @param[in] struct connect_attr *pstrHostIFconnectAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1439 | * @return Error code. |
| 1440 | * @author |
| 1441 | * @date |
| 1442 | * @version 1.0 |
| 1443 | */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1444 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 1445 | static s32 Handle_Connect(tstrWILC_WFIDrv *drvHandler, |
| 1446 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1447 | { |
| 1448 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1449 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1450 | tstrWID strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1451 | u32 u32WidsCount = 0, dummyval = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1452 | /* char passphrase[] = "12345678"; */ |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1453 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1454 | tstrJoinBssParam *ptstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1455 | |
| 1456 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1457 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1458 | /* if we try to connect to an already connected AP then discard the request */ |
| 1459 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1460 | if (memcmp(pstrHostIFconnectAttr->pu8bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1461 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1462 | s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1463 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
| 1464 | return s32Error; |
| 1465 | } |
| 1466 | |
| 1467 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1468 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1469 | ptstrJoinBssParam = (tstrJoinBssParam *)pstrHostIFconnectAttr->pJoinParams; |
| 1470 | if (ptstrJoinBssParam == NULL) { |
| 1471 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1472 | s32Error = -ENOENT; |
| 1473 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1474 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1475 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1476 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1477 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1478 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1479 | } |
| 1480 | |
| 1481 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssidLen; |
| 1482 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1483 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssidLen + 1, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1484 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1485 | pstrHostIFconnectAttr->ssidLen); |
| 1486 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1487 | } |
| 1488 | |
| 1489 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
| 1490 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1491 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1492 | memcpy(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, pstrHostIFconnectAttr->pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1493 | pstrHostIFconnectAttr->IEsLen); |
| 1494 | } |
| 1495 | |
| 1496 | pstrWFIDrv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->u8security; |
| 1497 | pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->tenuAuth_type; |
| 1498 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->pfConnectResult; |
| 1499 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->pvUserArg; |
| 1500 | |
| 1501 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 1502 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1503 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1504 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1505 | u32WidsCount++; |
| 1506 | |
| 1507 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 1508 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1509 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1510 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1511 | u32WidsCount++; |
| 1512 | |
| 1513 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 1514 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1515 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1516 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1517 | u32WidsCount++; |
| 1518 | |
| 1519 | /* if((gWFiDrvHandle->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) && */ |
| 1520 | /* (gWFiDrvHandle->strWILC_UsrConnReq.ConnReqIEsLen != 0)) */ |
| 1521 | { |
| 1522 | /* IEs to be inserted in Association Request */ |
| 1523 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1524 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1525 | strWIDList[u32WidsCount].ps8WidVal = pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1526 | strWIDList[u32WidsCount].s32ValueSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1527 | u32WidsCount++; |
| 1528 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1529 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1530 | |
| 1531 | gu32FlushedInfoElemAsocSize = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1532 | gu8FlushedInfoElemAsoc = kmalloc(gu32FlushedInfoElemAsocSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1533 | memcpy(gu8FlushedInfoElemAsoc, pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1534 | gu32FlushedInfoElemAsocSize); |
| 1535 | } |
| 1536 | } |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1537 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1538 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1539 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1540 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrWFIDrv->strWILC_UsrConnReq.u8security)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1541 | u32WidsCount++; |
| 1542 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1543 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1544 | gu8Flushed11iMode = pstrWFIDrv->strWILC_UsrConnReq.u8security; |
| 1545 | |
| 1546 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", pstrWFIDrv->strWILC_UsrConnReq.u8security); |
| 1547 | |
| 1548 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1549 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1550 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1551 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1552 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1553 | u32WidsCount++; |
| 1554 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1555 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1556 | gu8FlushedAuthType = (u8)pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1557 | |
| 1558 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", pstrWFIDrv->strWILC_UsrConnReq.tenuAuth_type); |
| 1559 | /* |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1560 | * strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1561 | * strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1562 | * strWIDList[u32WidsCount].s32ValueSize = sizeof(passphrase); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1563 | * strWIDList[u32WidsCount].ps8WidVal = (s8*)(passphrase); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1564 | * u32WidsCount++; |
| 1565 | */ |
| 1566 | |
| 1567 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
| 1568 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->u8channel); |
| 1569 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1570 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1571 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1572 | |
| 1573 | /*Sending NoA attributes during connection*/ |
| 1574 | strWIDList[u32WidsCount].s32ValueSize = 112; /* 79; */ |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1575 | strWIDList[u32WidsCount].ps8WidVal = kmalloc(strWIDList[u32WidsCount].s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1576 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1577 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1578 | gu32FlushedJoinReqSize = strWIDList[u32WidsCount].s32ValueSize; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1579 | gu8FlushedJoinReq = kmalloc(gu32FlushedJoinReqSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1580 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1581 | if (strWIDList[u32WidsCount].ps8WidVal == NULL) { |
| 1582 | s32Error = -EFAULT; |
| 1583 | goto ERRORHANDLER; |
| 1584 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1585 | |
| 1586 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1587 | |
| 1588 | |
| 1589 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1590 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8ssid, pstrHostIFconnectAttr->ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1591 | pu8CurrByte[pstrHostIFconnectAttr->ssidLen] = '\0'; |
| 1592 | } |
| 1593 | pu8CurrByte += MAX_SSID_LEN; |
| 1594 | |
| 1595 | /* BSS type*/ |
| 1596 | *(pu8CurrByte++) = INFRASTRUCTURE; |
| 1597 | /* Channel*/ |
| 1598 | if ((pstrHostIFconnectAttr->u8channel >= 1) && (pstrHostIFconnectAttr->u8channel <= 14)) { |
| 1599 | *(pu8CurrByte++) = pstrHostIFconnectAttr->u8channel; |
| 1600 | } else { |
| 1601 | PRINT_ER("Channel out of range\n"); |
| 1602 | *(pu8CurrByte++) = 0xFF; |
| 1603 | } |
| 1604 | /* Cap Info*/ |
| 1605 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1606 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1607 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1608 | |
| 1609 | /* sa*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1610 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1611 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1612 | pu8CurrByte += 6; |
| 1613 | |
| 1614 | /* bssid*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1615 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1616 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1617 | pu8CurrByte += 6; |
| 1618 | |
| 1619 | /* Beacon Period*/ |
| 1620 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1621 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1622 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1623 | /* DTIM Period*/ |
| 1624 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1625 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
| 1626 | /* Supported rates*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1627 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1628 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1629 | |
| 1630 | /* wmm cap*/ |
| 1631 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1632 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
| 1633 | /* uapsd cap*/ |
| 1634 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1635 | |
| 1636 | /* ht cap*/ |
| 1637 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
| 1638 | /* copy this information to the user request */ |
| 1639 | pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
| 1640 | |
| 1641 | /* rsn found*/ |
| 1642 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1643 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
| 1644 | /* rsn group policy*/ |
| 1645 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1646 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
| 1647 | /* mode_802_11i*/ |
| 1648 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1649 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
| 1650 | /* rsn pcip policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1651 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1652 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1653 | |
| 1654 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1655 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1656 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1657 | |
| 1658 | /* rsn auth policy*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1659 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1660 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1661 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1662 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
| 1663 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1664 | *(pu8CurrByte++) = ptstrJoinBssParam->u8NoaEnbaled; |
| 1665 | if (ptstrJoinBssParam->u8NoaEnbaled) { |
| 1666 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1667 | |
| 1668 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1669 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1670 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1671 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1672 | |
| 1673 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Index; |
| 1674 | |
| 1675 | *(pu8CurrByte++) = ptstrJoinBssParam->u8OppEnable; |
| 1676 | |
| 1677 | if (ptstrJoinBssParam->u8OppEnable) |
| 1678 | *(pu8CurrByte++) = ptstrJoinBssParam->u8CtWindow; |
| 1679 | |
| 1680 | *(pu8CurrByte++) = ptstrJoinBssParam->u8Count; |
| 1681 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1682 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Duration, sizeof(ptstrJoinBssParam->au8Duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1683 | |
| 1684 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Duration); |
| 1685 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1686 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8Interval, sizeof(ptstrJoinBssParam->au8Interval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1687 | |
| 1688 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8Interval); |
| 1689 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1690 | memcpy(pu8CurrByte, ptstrJoinBssParam->au8StartTime, sizeof(ptstrJoinBssParam->au8StartTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1691 | |
| 1692 | pu8CurrByte += sizeof(ptstrJoinBssParam->au8StartTime); |
| 1693 | |
| 1694 | } else |
| 1695 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1696 | |
| 1697 | /* keep the buffer at the start of the allocated pointer to use it with the free*/ |
| 1698 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1699 | u32WidsCount++; |
| 1700 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1701 | /* A temporary workaround to avoid handling the misleading MAC_DISCONNECTED raised from the |
| 1702 | * firmware at chip reset when processing the WIDs of the Connect Request. |
| 1703 | * (This workaround should be removed in the future when the Chip reset of the Connect WIDs is disabled) */ |
| 1704 | /* ////////////////////// */ |
| 1705 | gu32WidConnRstHack = 0; |
| 1706 | /* ////////////////////// */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1707 | |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 1708 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->pu8ssid, 7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1709 | memcpy(gu8FlushedJoinReq, pu8CurrByte, gu32FlushedJoinReqSize); |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1710 | gu8FlushedJoinReqDrvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1711 | } |
| 1712 | |
| 1713 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1714 | |
| 1715 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1716 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1717 | |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1718 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->pu8bssid); |
| 1719 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1720 | } |
| 1721 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1722 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1723 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1724 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1725 | PRINT_ER("failed to send config packet\n"); |
| 1726 | s32Error = -EFAULT; |
| 1727 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1728 | } else { |
| 1729 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
| 1730 | pstrWFIDrv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
| 1731 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1732 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1733 | ERRORHANDLER: |
| 1734 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1735 | tstrConnectInfo strConnectInfo; |
| 1736 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 1737 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1738 | |
| 1739 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 1740 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1741 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1742 | |
| 1743 | if (pstrHostIFconnectAttr->pfConnectResult != NULL) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1744 | if (pstrHostIFconnectAttr->pu8bssid != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1745 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1746 | |
| 1747 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
| 1748 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->IEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1749 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->IEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1750 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1751 | pstrHostIFconnectAttr->pu8IEs, |
| 1752 | pstrHostIFconnectAttr->IEsLen); |
| 1753 | } |
| 1754 | |
| 1755 | pstrHostIFconnectAttr->pfConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 1756 | &strConnectInfo, |
| 1757 | MAC_DISCONNECTED, |
| 1758 | NULL, |
| 1759 | pstrHostIFconnectAttr->pvUserArg); |
| 1760 | /*Change state to idle*/ |
| 1761 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 1762 | /* Deallocation */ |
| 1763 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1764 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1765 | strConnectInfo.pu8ReqIEs = NULL; |
| 1766 | } |
| 1767 | |
| 1768 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1769 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1770 | } |
| 1771 | } |
| 1772 | |
| 1773 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
| 1774 | /* Deallocate pstrHostIFconnectAttr->pu8bssid which was prevoisuly allocated by the sending thread */ |
| 1775 | if (pstrHostIFconnectAttr->pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1776 | kfree(pstrHostIFconnectAttr->pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1777 | pstrHostIFconnectAttr->pu8bssid = NULL; |
| 1778 | } |
| 1779 | |
| 1780 | /* Deallocate pstrHostIFconnectAttr->pu8ssid which was prevoisuly allocated by the sending thread */ |
| 1781 | if (pstrHostIFconnectAttr->pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1782 | kfree(pstrHostIFconnectAttr->pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1783 | pstrHostIFconnectAttr->pu8ssid = NULL; |
| 1784 | } |
| 1785 | |
| 1786 | /* Deallocate pstrHostIFconnectAttr->pu8IEs which was prevoisuly allocated by the sending thread */ |
| 1787 | if (pstrHostIFconnectAttr->pu8IEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1788 | kfree(pstrHostIFconnectAttr->pu8IEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1789 | pstrHostIFconnectAttr->pu8IEs = NULL; |
| 1790 | } |
| 1791 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1792 | if (pu8CurrByte != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1793 | kfree(pu8CurrByte); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1794 | return s32Error; |
| 1795 | } |
| 1796 | |
| 1797 | /** |
| 1798 | * @brief Handle_FlushConnect |
| 1799 | * @details Sending config packet to firmware to flush an old connection |
| 1800 | * after switching FW from station one to hybrid one |
| 1801 | * @param[in] void * drvHandler |
| 1802 | * @return Error code. |
| 1803 | * @author Amr Abdel-Moghny |
| 1804 | * @date 19 DEC 2013 |
| 1805 | * @version 8.0 |
| 1806 | */ |
| 1807 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1808 | static s32 Handle_FlushConnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1809 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1810 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1811 | tstrWID strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1812 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1813 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1814 | |
| 1815 | |
| 1816 | /* IEs to be inserted in Association Request */ |
| 1817 | strWIDList[u32WidsCount].u16WIDid = WID_INFO_ELEMENT_ASSOCIATE; |
| 1818 | strWIDList[u32WidsCount].enuWIDtype = WID_BIN_DATA; |
| 1819 | strWIDList[u32WidsCount].ps8WidVal = gu8FlushedInfoElemAsoc; |
| 1820 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedInfoElemAsocSize; |
| 1821 | u32WidsCount++; |
| 1822 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1823 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1824 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1825 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1826 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(gu8Flushed11iMode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1827 | u32WidsCount++; |
| 1828 | |
| 1829 | |
| 1830 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1831 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_AUTH_TYPE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1832 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1833 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1834 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&gu8FlushedAuthType); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1835 | u32WidsCount++; |
| 1836 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1837 | strWIDList[u32WidsCount].u16WIDid = (u16)WID_JOIN_REQ_EXTENDED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1838 | strWIDList[u32WidsCount].enuWIDtype = WID_STR; |
| 1839 | strWIDList[u32WidsCount].s32ValueSize = gu32FlushedJoinReqSize; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1840 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)gu8FlushedJoinReq; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1841 | pu8CurrByte = strWIDList[u32WidsCount].ps8WidVal; |
| 1842 | |
| 1843 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 1844 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 1845 | |
| 1846 | u32WidsCount++; |
| 1847 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1848 | s32Error = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, false, |
| 1849 | get_id_from_handler(gu8FlushedJoinReqDrvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1850 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1851 | PRINT_ER("failed to send config packet\n"); |
| 1852 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1853 | } |
| 1854 | |
| 1855 | return s32Error; |
| 1856 | } |
| 1857 | |
| 1858 | /** |
| 1859 | * @brief Handle_ConnectTimeout |
| 1860 | * @details Call connect notification callback function indicating connection failure |
| 1861 | * @param[in] NONE |
| 1862 | * @return Error code. |
| 1863 | * @author |
| 1864 | * @date |
| 1865 | * @version 1.0 |
| 1866 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 1867 | static s32 Handle_ConnectTimeout(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1868 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1869 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1870 | tstrConnectInfo strConnectInfo; |
| 1871 | tstrWID strWID; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1872 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1873 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 1874 | |
| 1875 | if (pstrWFIDrv == NULL) { |
| 1876 | PRINT_ER("Driver handler is NULL\n"); |
| 1877 | return s32Error; |
| 1878 | } |
| 1879 | |
| 1880 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 1881 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1882 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1883 | |
| 1884 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1885 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1886 | |
| 1887 | |
| 1888 | /* First, we will notify the upper layer with the Connection failure {through the Connect Callback function}, |
| 1889 | * then we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 1890 | * WID_DISCONNECT} */ |
| 1891 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 1892 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1893 | memcpy(strConnectInfo.au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1894 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
| 1895 | } |
| 1896 | |
| 1897 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 1898 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1899 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1900 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1901 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1902 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 1903 | } |
| 1904 | |
| 1905 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 1906 | &strConnectInfo, |
| 1907 | MAC_DISCONNECTED, |
| 1908 | NULL, |
| 1909 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 1910 | |
| 1911 | /* Deallocation of strConnectInfo.pu8ReqIEs */ |
| 1912 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1913 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1914 | strConnectInfo.pu8ReqIEs = NULL; |
| 1915 | } |
| 1916 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1917 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1918 | } |
| 1919 | |
| 1920 | /* Here we will notify our firmware also with the Connection failure {through sending to it Cfg packet carrying |
| 1921 | * WID_DISCONNECT} */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1922 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1923 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1924 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 1925 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1926 | |
| 1927 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1928 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 1929 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 1930 | get_id_from_handler(pstrWFIDrv)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 1931 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1932 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1933 | |
| 1934 | /* Deallocation of the Saved Connect Request in the global Handle */ |
| 1935 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 1936 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1937 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1938 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 1939 | } |
| 1940 | |
| 1941 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1942 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1943 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 1944 | } |
| 1945 | |
| 1946 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 1947 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1948 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1949 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 1950 | } |
| 1951 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1952 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1953 | /*Freeing flushed join request params on connect timeout*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1954 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1955 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1956 | gu8FlushedJoinReq = NULL; |
| 1957 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 1958 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1959 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1960 | gu8FlushedInfoElemAsoc = NULL; |
| 1961 | } |
| 1962 | |
| 1963 | return s32Error; |
| 1964 | } |
| 1965 | |
| 1966 | /** |
| 1967 | * @brief Handle_RcvdNtwrkInfo |
| 1968 | * @details Handling received network information |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1969 | * @param[in] struct rcvd_net_info *pstrRcvdNetworkInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1970 | * @return Error code. |
| 1971 | * @author |
| 1972 | * @date |
| 1973 | * @version 1.0 |
| 1974 | */ |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1975 | static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv *drvHandler, |
| 1976 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1977 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1978 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1979 | bool bNewNtwrkFound; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1980 | |
| 1981 | |
| 1982 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1983 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1984 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 1985 | void *pJoinParams = NULL; |
| 1986 | |
| 1987 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 1988 | |
| 1989 | |
| 1990 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1991 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1992 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 1993 | |
| 1994 | /*if there is a an ongoing scan request*/ |
| 1995 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 1996 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
Chaehyun Lim | a1f7f64 | 2015-09-22 22:47:44 +0900 | [diff] [blame] | 1997 | parse_network_info(pstrRcvdNetworkInfo->pu8Buffer, &pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1998 | if ((pstrNetworkInfo == NULL) |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1999 | || (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2000 | PRINT_ER("driver is null\n"); |
| 2001 | s32Error = -EINVAL; |
| 2002 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2003 | } |
| 2004 | |
| 2005 | /* check whether this network is discovered before */ |
| 2006 | for (i = 0; i < pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
| 2007 | |
| 2008 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid != NULL) && |
| 2009 | (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | 1a646e7 | 2015-08-07 09:02:03 +0900 | [diff] [blame] | 2010 | if (memcmp(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2011 | pstrNetworkInfo->au8bssid, 6) == 0) { |
| 2012 | if (pstrNetworkInfo->s8rssi <= pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
| 2013 | /*we have already found this network with better rssi, so keep the old cached one and don't |
| 2014 | * send anything to the upper layer */ |
| 2015 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 2016 | goto done; |
| 2017 | } else { |
| 2018 | /* here the same already found network is found again but with a better rssi, so just update |
| 2019 | * the rssi for this cached network and send this updated network to the upper layer but |
| 2020 | * don't add a new record for it */ |
| 2021 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2022 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2023 | break; |
| 2024 | } |
| 2025 | } |
| 2026 | } |
| 2027 | } |
| 2028 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2029 | if (bNewNtwrkFound == true) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2030 | /* here it is confirmed that it is a new discovered network, |
| 2031 | * so add its record then call the User CallBack function */ |
| 2032 | |
| 2033 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 2034 | |
| 2035 | if (pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 2036 | pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
| 2037 | |
| 2038 | if ((pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid != NULL) |
| 2039 | && (pstrNetworkInfo->au8bssid != NULL)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2040 | memcpy(pstrWFIDrv->strWILC_UsrScanReq.astrFoundNetworkInfo[pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2041 | pstrNetworkInfo->au8bssid, 6); |
| 2042 | |
| 2043 | pstrWFIDrv->strWILC_UsrScanReq.u32RcvdChCount++; |
| 2044 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2045 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2046 | /* add new BSS to JoinBssTable */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2047 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2048 | |
| 2049 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2050 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, |
| 2051 | pJoinParams); |
| 2052 | |
| 2053 | |
| 2054 | } |
| 2055 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2056 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2057 | } |
| 2058 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2059 | pstrNetworkInfo->bNewNetwork = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2060 | /* just call the User CallBack function to send the same discovered network with its updated RSSI */ |
| 2061 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 2062 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2063 | } |
| 2064 | } |
| 2065 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2066 | done: |
| 2067 | /* Deallocate pstrRcvdNetworkInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2068 | if (pstrRcvdNetworkInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2069 | kfree(pstrRcvdNetworkInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2070 | pstrRcvdNetworkInfo->pu8Buffer = NULL; |
| 2071 | } |
| 2072 | |
| 2073 | /*free structure allocated*/ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2074 | if (pstrNetworkInfo != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2075 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2076 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2077 | } |
| 2078 | |
| 2079 | return s32Error; |
| 2080 | } |
| 2081 | |
| 2082 | /** |
| 2083 | * @brief Handle_RcvdGnrlAsyncInfo |
| 2084 | * @details Handling received asynchrous general network information |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2085 | * @param[in] struct rcvd_async_info *pstrRcvdGnrlAsyncInfo |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2086 | * @return Error code. |
| 2087 | * @author |
| 2088 | * @date |
| 2089 | * @version 1.0 |
| 2090 | */ |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 2091 | static s32 Handle_RcvdGnrlAsyncInfo(tstrWILC_WFIDrv *drvHandler, |
| 2092 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2093 | { |
| 2094 | /* TODO: mostafa: till now, this function just handles only the received mac status msg, */ |
| 2095 | /* which carries only 1 WID which have WID ID = WID_STATUS */ |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2096 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2097 | u8 u8MsgType = 0; |
| 2098 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2099 | u16 u16MsgLen = 0; |
| 2100 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2101 | u8 u8WidLen = 0; |
| 2102 | u8 u8MacStatus; |
| 2103 | u8 u8MacStatusReasonCode; |
| 2104 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2105 | tstrConnectInfo strConnectInfo; |
| 2106 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2107 | s32 s32Err = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2108 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2109 | |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 2110 | if (!pstrWFIDrv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2111 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 2112 | return -ENODEV; |
| 2113 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2114 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", pstrWFIDrv->enuHostIFstate, |
| 2115 | pstrRcvdGnrlAsyncInfo->pu8Buffer[7]); |
| 2116 | |
| 2117 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 2118 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 2119 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2120 | if ((pstrRcvdGnrlAsyncInfo->pu8Buffer == NULL) || |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2121 | (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2122 | PRINT_ER("driver is null\n"); |
| 2123 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2124 | } |
| 2125 | |
| 2126 | u8MsgType = pstrRcvdGnrlAsyncInfo->pu8Buffer[0]; |
| 2127 | |
| 2128 | /* Check whether the received message type is 'I' */ |
| 2129 | if ('I' != u8MsgType) { |
| 2130 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2131 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2132 | } |
| 2133 | |
| 2134 | /* Extract message ID */ |
| 2135 | u8MsgID = pstrRcvdGnrlAsyncInfo->pu8Buffer[1]; |
| 2136 | |
| 2137 | /* Extract message Length */ |
| 2138 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[2], pstrRcvdGnrlAsyncInfo->pu8Buffer[3]); |
| 2139 | |
| 2140 | /* Extract WID ID [expected to be = WID_STATUS] */ |
| 2141 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->pu8Buffer[4], pstrRcvdGnrlAsyncInfo->pu8Buffer[5]); |
| 2142 | |
| 2143 | /* Extract WID Length [expected to be = 1] */ |
| 2144 | u8WidLen = pstrRcvdGnrlAsyncInfo->pu8Buffer[6]; |
| 2145 | |
| 2146 | /* get the WID value [expected to be one of two values: either MAC_CONNECTED = (1) or MAC_DISCONNECTED = (0)] */ |
| 2147 | u8MacStatus = pstrRcvdGnrlAsyncInfo->pu8Buffer[7]; |
| 2148 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->pu8Buffer[8]; |
| 2149 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->pu8Buffer[9]; |
| 2150 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2151 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2152 | /* our station had sent Association Request frame, so here it will get the Association Response frame then parse it */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2153 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2154 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 2155 | |
| 2156 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 2157 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2158 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2159 | |
| 2160 | if (u8MacStatus == MAC_CONNECTED) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2161 | memset(gapu8RcvdAssocResp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2162 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2163 | host_int_get_assoc_res_info(pstrWFIDrv, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2164 | gapu8RcvdAssocResp, |
| 2165 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 2166 | &u32RcvdAssocRespInfoLen); |
| 2167 | |
| 2168 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 2169 | |
| 2170 | if (u32RcvdAssocRespInfoLen != 0) { |
| 2171 | |
| 2172 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
| 2173 | s32Err = ParseAssocRespInfo(gapu8RcvdAssocResp, u32RcvdAssocRespInfoLen, |
| 2174 | &pstrConnectRespInfo); |
| 2175 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2176 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2177 | } else { |
| 2178 | /* use the necessary parsed Info from the Received Association Response */ |
| 2179 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 2180 | |
| 2181 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 2182 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
| 2183 | if (pstrConnectRespInfo->pu8RespIEs != NULL) { |
| 2184 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
| 2185 | |
| 2186 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2187 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2188 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2189 | pstrConnectRespInfo->u16RespIEsLen); |
| 2190 | } |
| 2191 | } |
| 2192 | |
| 2193 | /* deallocate the Assoc. Resp. parsed structure as it is not needed anymore */ |
| 2194 | if (pstrConnectRespInfo != NULL) { |
| 2195 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 2196 | pstrConnectRespInfo = NULL; |
| 2197 | } |
| 2198 | } |
| 2199 | } |
| 2200 | } |
| 2201 | |
| 2202 | /* The station has just received mac status and it also received assoc. response which |
| 2203 | * it was waiting for. |
| 2204 | * So check first the matching between the received mac status and the received status code in Asoc Resp */ |
| 2205 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2206 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2207 | PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2208 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2209 | |
| 2210 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 2211 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2212 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2213 | } |
| 2214 | |
| 2215 | /* TODO: mostafa: correct BSSID should be retrieved from actual BSSID received from AP */ |
| 2216 | /* through a structure of type tstrConnectRespInfo */ |
| 2217 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
| 2218 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2219 | memcpy(strConnectInfo.au8bssid, pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2220 | |
| 2221 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2222 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2223 | memcpy(pstrWFIDrv->au8AssociatedBSSID, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2224 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
| 2225 | } |
| 2226 | } |
| 2227 | |
| 2228 | |
| 2229 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
| 2230 | strConnectInfo.ReqIEsLen = pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2231 | strConnectInfo.pu8ReqIEs = kmalloc(pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2232 | memcpy(strConnectInfo.pu8ReqIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2233 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 2234 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen); |
| 2235 | } |
| 2236 | |
| 2237 | |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2238 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2239 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 2240 | &strConnectInfo, |
| 2241 | u8MacStatus, |
| 2242 | NULL, |
| 2243 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2244 | |
| 2245 | |
| 2246 | /* if received mac status is MAC_CONNECTED and |
| 2247 | * received status code in Asoc Resp is SUCCESSFUL_STATUSCODE, change state to CONNECTED |
| 2248 | * else change state to IDLE */ |
| 2249 | if ((u8MacStatus == MAC_CONNECTED) && |
| 2250 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2251 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2252 | |
| 2253 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
| 2254 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTED; |
| 2255 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2256 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2257 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2258 | mod_timer(&hDuringIpTimer, |
| 2259 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2260 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2261 | /* open a BA session if possible */ |
| 2262 | /* if(pstrWFIDrv->strWILC_UsrConnReq.IsHTCapable) */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2263 | /* host_int_addBASession(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid,0, */ |
| 2264 | /* BA_SESSION_DEFAULT_BUFFER_SIZE,BA_SESSION_DEFAULT_TIMEOUT); */ |
| 2265 | } else { |
| 2266 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
| 2267 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2268 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2269 | } |
| 2270 | |
| 2271 | /* Deallocation */ |
| 2272 | if (strConnectInfo.pu8RespIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2273 | kfree(strConnectInfo.pu8RespIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2274 | strConnectInfo.pu8RespIEs = NULL; |
| 2275 | } |
| 2276 | |
| 2277 | if (strConnectInfo.pu8ReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2278 | kfree(strConnectInfo.pu8ReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2279 | strConnectInfo.pu8ReqIEs = NULL; |
| 2280 | } |
| 2281 | |
| 2282 | |
| 2283 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2284 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2285 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2286 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2287 | } |
| 2288 | |
| 2289 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2290 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2291 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2292 | } |
| 2293 | |
| 2294 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2295 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2296 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2297 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2298 | } |
| 2299 | |
| 2300 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2301 | (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED)) { |
| 2302 | /* Disassociation or Deauthentication frame has been received */ |
| 2303 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 2304 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2305 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2306 | |
| 2307 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2308 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2309 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2310 | Handle_ScanDone((void *)pstrWFIDrv, SCAN_EVENT_ABORTED); |
| 2311 | } |
| 2312 | |
| 2313 | strDisconnectNotifInfo.u16reason = 0; |
| 2314 | strDisconnectNotifInfo.ie = NULL; |
| 2315 | strDisconnectNotifInfo.ie_len = 0; |
| 2316 | |
| 2317 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2318 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2319 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2320 | |
| 2321 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2322 | NULL, |
| 2323 | 0, |
| 2324 | &strDisconnectNotifInfo, |
| 2325 | pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2326 | |
| 2327 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2328 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2329 | } |
| 2330 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2331 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2332 | |
| 2333 | |
| 2334 | /* Deallocation */ |
| 2335 | |
| 2336 | /* if Information Elements were retrieved from the Received deauth/disassoc frame, then they |
| 2337 | * should be deallocated here */ |
| 2338 | /* |
| 2339 | * if(strDisconnectNotifInfo.ie != NULL) |
| 2340 | * { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2341 | * kfree(strDisconnectNotifInfo.ie); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2342 | * strDisconnectNotifInfo.ie = NULL; |
| 2343 | * } |
| 2344 | */ |
| 2345 | |
| 2346 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2347 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2348 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2349 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2350 | } |
| 2351 | |
| 2352 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2353 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2354 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2355 | } |
| 2356 | |
| 2357 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2358 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2359 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2360 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2361 | } |
| 2362 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2363 | /*Freeing flushed join request params on receiving*/ |
| 2364 | /*MAC_DISCONNECTED while connected*/ |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2365 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2366 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2367 | gu8FlushedJoinReq = NULL; |
| 2368 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2369 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2370 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2371 | gu8FlushedInfoElemAsoc = NULL; |
| 2372 | } |
| 2373 | |
| 2374 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2375 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2376 | |
| 2377 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
| 2378 | (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL)) { |
| 2379 | 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] | 2380 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2381 | /*Abort the running scan*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2382 | del_timer(&pstrWFIDrv->hScanTimer); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2383 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2384 | Handle_ScanDone(pstrWFIDrv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2385 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2386 | } |
| 2387 | |
| 2388 | } |
| 2389 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2390 | /* Deallocate pstrRcvdGnrlAsyncInfo->pu8Buffer which was prevoisuly allocated by the sending thread */ |
| 2391 | if (pstrRcvdGnrlAsyncInfo->pu8Buffer != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2392 | kfree(pstrRcvdGnrlAsyncInfo->pu8Buffer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2393 | pstrRcvdGnrlAsyncInfo->pu8Buffer = NULL; |
| 2394 | } |
| 2395 | |
| 2396 | return s32Error; |
| 2397 | } |
| 2398 | |
| 2399 | /** |
| 2400 | * @brief Handle_Key |
| 2401 | * @details Sending config packet to firmware to set key |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2402 | * @param[in] struct key_attr *pstrHostIFkeyAttr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2403 | * @return Error code. |
| 2404 | * @author |
| 2405 | * @date |
| 2406 | * @version 1.0 |
| 2407 | */ |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 2408 | static int Handle_Key(tstrWILC_WFIDrv *drvHandler, |
| 2409 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2410 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2411 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2412 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2413 | tstrWID strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2414 | u8 i; |
| 2415 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2416 | s8 s8idxarray[1]; |
| 2417 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2418 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2419 | |
| 2420 | |
| 2421 | switch (pstrHostIFkeyAttr->enuKeyType) { |
| 2422 | |
| 2423 | |
| 2424 | case WEP: |
| 2425 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2426 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2427 | |
| 2428 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
| 2429 | PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2430 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2431 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2432 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2433 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8mode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2434 | |
| 2435 | strWIDList[1].u16WIDid = WID_AUTH_TYPE; |
| 2436 | strWIDList[1].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2437 | strWIDList[1].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2438 | strWIDList[1].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2439 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2440 | strWIDList[2].u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2441 | strWIDList[2].enuWIDtype = WID_CHAR; |
| 2442 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2443 | strWIDList[2].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2444 | strWIDList[2].s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2445 | |
| 2446 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2447 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2448 | |
| 2449 | |
| 2450 | if (pu8keybuf == NULL) { |
| 2451 | PRINT_ER("No buffer to send Key\n"); |
| 2452 | return -1; |
| 2453 | } |
| 2454 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2455 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2456 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2457 | |
| 2458 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2459 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2460 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2461 | strWIDList[3].u16WIDid = (u16)WID_WEP_KEY_VALUE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2462 | strWIDList[3].enuWIDtype = WID_STR; |
| 2463 | strWIDList[3].s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2464 | strWIDList[3].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2465 | |
| 2466 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2467 | s32Error = send_config_pkt(SET_CFG, strWIDList, 4, true, |
| 2468 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2469 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2470 | |
| 2471 | |
| 2472 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2473 | |
| 2474 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2475 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2476 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2477 | if (pu8keybuf == NULL) { |
| 2478 | PRINT_ER("No buffer to send Key\n"); |
| 2479 | return -1; |
| 2480 | } |
| 2481 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
| 2482 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2483 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2484 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2485 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2486 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen); |
| 2487 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2488 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2489 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2490 | strWID.u16WIDid = (u16)WID_ADD_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2491 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2492 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2493 | strWID.s32ValueSize = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen + 2; |
| 2494 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2495 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2496 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2497 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2498 | } else if (pstrHostIFkeyAttr->u8KeyAction & REMOVEKEY) { |
| 2499 | |
| 2500 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2501 | strWID.u16WIDid = (u16)WID_REMOVE_WEP_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2502 | strWID.enuWIDtype = WID_STR; |
| 2503 | |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2504 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2505 | strWID.ps8WidVal = s8idxarray; |
| 2506 | strWID.s32ValueSize = 1; |
| 2507 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2508 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2509 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2510 | } else { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2511 | strWID.u16WIDid = (u16)WID_KEY_ID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2512 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2513 | strWID.ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx)); |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2514 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2515 | |
| 2516 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 2517 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2518 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2519 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2520 | } |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2521 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2522 | break; |
| 2523 | |
| 2524 | case WPARxGtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2525 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2526 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2527 | if (pu8keybuf == NULL) { |
| 2528 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2529 | ret = -1; |
| 2530 | goto _WPARxGtk_end_case_; |
| 2531 | } |
| 2532 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2533 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2534 | |
| 2535 | |
| 2536 | /*|----------------------------------------------------------------------------| |
| 2537 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2538 | * |------------|---------|-------|------------|---------------|----------------| |
| 2539 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2540 | |
| 2541 | |
| 2542 | |
| 2543 | if (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq != NULL) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2544 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2545 | |
| 2546 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2547 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2548 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2549 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2550 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2551 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2552 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2553 | /* pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = 0X51; */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2554 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2555 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2556 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2557 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2558 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2559 | strWIDList[1].u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2560 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2561 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2562 | strWIDList[1].s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2563 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2564 | s32Error = send_config_pkt(SET_CFG, strWIDList, 2, true, |
| 2565 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2566 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2567 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2568 | |
| 2569 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2570 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2571 | /* ///////////////////////// */ |
| 2572 | } |
| 2573 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2574 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2575 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 2576 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2577 | pu8keybuf = kmalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2578 | if (pu8keybuf == NULL) { |
| 2579 | PRINT_ER("No buffer to send RxGTK Key\n"); |
| 2580 | ret = -1; |
| 2581 | goto _WPARxGtk_end_case_; |
| 2582 | } |
| 2583 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2584 | memset(pu8keybuf, 0, RX_MIC_KEY_MSG_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2585 | |
| 2586 | |
| 2587 | /*|----------------------------------------------------------------------------| |
| 2588 | * |Sta Address | Key RSC | KeyID | Key Length | Temporal Key | Rx Michael Key | |
| 2589 | * |------------|---------|-------|------------|---------------|----------------| |
| 2590 | | 6 bytes | 8 byte |1 byte | 1 byte | 16 bytes | 8 bytes |*/ |
| 2591 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2592 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2593 | memcpy(pu8keybuf, pstrWFIDrv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2594 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2595 | 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] | 2596 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2597 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2598 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2599 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2600 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2601 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
| 2602 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2603 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2604 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2605 | strWID.u16WIDid = (u16)WID_ADD_RX_GTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2606 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2607 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2608 | strWID.s32ValueSize = RX_MIC_KEY_MSG_LEN; |
| 2609 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2610 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2611 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2612 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2613 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2614 | |
| 2615 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2616 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2617 | /* ///////////////////////// */ |
| 2618 | } |
| 2619 | _WPARxGtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2620 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
| 2621 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2622 | if (ret == -1) |
| 2623 | return ret; |
| 2624 | |
| 2625 | break; |
| 2626 | |
| 2627 | case WPAPtk: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2628 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY_AP) { |
| 2629 | |
| 2630 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2631 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2632 | |
| 2633 | |
| 2634 | |
| 2635 | if (pu8keybuf == NULL) { |
| 2636 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2637 | ret = -1; |
| 2638 | goto _WPAPtk_end_case_; |
| 2639 | |
| 2640 | } |
| 2641 | |
| 2642 | /*|-----------------------------------------------------------------------------| |
| 2643 | * |Station address | keyidx |Key Length |Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2644 | * |----------------|------------ |--------------|----------------|---------------| |
| 2645 | | 6 bytes | 1 byte | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2646 | |-----------------------------------------------------------------------------|*/ |
| 2647 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2648 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2649 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2650 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx, 1); |
| 2651 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2652 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2653 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2654 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2655 | |
| 2656 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2657 | strWIDList[0].u16WIDid = (u16)WID_11I_MODE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2658 | strWIDList[0].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2659 | strWIDList[0].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2660 | strWIDList[0].ps8WidVal = (s8 *)(&(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2661 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2662 | strWIDList[1].u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2663 | strWIDList[1].enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2664 | strWIDList[1].ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2665 | strWIDList[1].s32ValueSize = PTK_KEY_MSG_LEN + 1; |
| 2666 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2667 | s32Error = send_config_pkt(SET_CFG, strWIDList, 2, true, |
| 2668 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2669 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2670 | |
| 2671 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2672 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2673 | /* ///////////////////////// */ |
| 2674 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2675 | if (pstrHostIFkeyAttr->u8KeyAction & ADDKEY) { |
| 2676 | |
| 2677 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2678 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2679 | |
| 2680 | |
| 2681 | |
| 2682 | if (pu8keybuf == NULL) { |
| 2683 | PRINT_ER("No buffer to send PTK Key\n"); |
| 2684 | ret = -1; |
| 2685 | goto _WPAPtk_end_case_; |
| 2686 | |
| 2687 | } |
| 2688 | |
| 2689 | /*|-----------------------------------------------------------------------------| |
| 2690 | * |Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 2691 | * |----------------|------------|--------------|----------------|---------------| |
| 2692 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 2693 | |-----------------------------------------------------------------------------|*/ |
| 2694 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2695 | memcpy(pu8keybuf, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr, 6); /*1 bytes Key Length */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2696 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2697 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2698 | /*16 byte TK*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2699 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2700 | pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen); |
| 2701 | |
| 2702 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2703 | strWID.u16WIDid = (u16)WID_ADD_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2704 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2705 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2706 | strWID.s32ValueSize = PTK_KEY_MSG_LEN; |
| 2707 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2708 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2709 | get_id_from_handler(pstrWFIDrv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2710 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2711 | |
| 2712 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2713 | up(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2714 | /* ///////////////////////// */ |
| 2715 | } |
| 2716 | |
| 2717 | _WPAPtk_end_case_: |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2718 | kfree(pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFwpaAttr.pu8key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2719 | if (ret == -1) |
| 2720 | return ret; |
| 2721 | |
| 2722 | break; |
| 2723 | |
| 2724 | |
| 2725 | case PMKSA: |
| 2726 | |
| 2727 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 2728 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 2729 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2730 | if (pu8keybuf == NULL) { |
| 2731 | PRINT_ER("No buffer to send PMKSA Key\n"); |
| 2732 | return -1; |
| 2733 | } |
| 2734 | |
| 2735 | pu8keybuf[0] = pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; |
| 2736 | |
| 2737 | for (i = 0; i < pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid; i++) { |
| 2738 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2739 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, ETH_ALEN); |
| 2740 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2741 | } |
| 2742 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2743 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2744 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2745 | strWID.ps8WidVal = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2746 | strWID.s32ValueSize = (pstrHostIFkeyAttr->uniHostIFkeyAttr.strHostIFpmkidAttr.numpmkid * PMKSA_KEY_LEN) + 1; |
| 2747 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2748 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2749 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2750 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2751 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2752 | break; |
| 2753 | } |
| 2754 | |
| 2755 | if (s32Error) |
| 2756 | PRINT_ER("Failed to send key config packet\n"); |
| 2757 | |
| 2758 | |
| 2759 | return s32Error; |
| 2760 | } |
| 2761 | |
| 2762 | |
| 2763 | /** |
| 2764 | * @brief Handle_Disconnect |
| 2765 | * @details Sending config packet to firmware to disconnect |
| 2766 | * @param[in] NONE |
| 2767 | * @return NONE |
| 2768 | * @author |
| 2769 | * @date |
| 2770 | * @version 1.0 |
| 2771 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2772 | static void Handle_Disconnect(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2773 | { |
| 2774 | tstrWID strWID; |
| 2775 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2776 | s32 s32Error = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2777 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2778 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2779 | |
| 2780 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2781 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2782 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2783 | strWID.ps8WidVal = (s8 *)&u16DummyReasonCode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2784 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2785 | |
| 2786 | |
| 2787 | |
| 2788 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 2789 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2790 | g_obtainingIP = false; |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2791 | host_int_set_power_mgmt(pstrWFIDrv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2792 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2793 | memset(u8ConnectedSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2794 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2795 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 2796 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2797 | |
| 2798 | if (s32Error) { |
| 2799 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2800 | } else { |
| 2801 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 2802 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2803 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2804 | |
| 2805 | strDisconnectNotifInfo.u16reason = 0; |
| 2806 | strDisconnectNotifInfo.ie = NULL; |
| 2807 | strDisconnectNotifInfo.ie_len = 0; |
| 2808 | |
| 2809 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2810 | del_timer(&pstrWFIDrv->hScanTimer); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2811 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2812 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 2813 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2814 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2815 | } |
| 2816 | |
| 2817 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult != NULL) { |
| 2818 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2819 | /*Stop connect timer, if connection in progress*/ |
| 2820 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 2821 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 2822 | del_timer(&pstrWFIDrv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2823 | } |
| 2824 | |
| 2825 | pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 2826 | 0, &strDisconnectNotifInfo, pstrWFIDrv->strWILC_UsrConnReq.u32UserConnectPvoid); |
| 2827 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2828 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2829 | } |
| 2830 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2831 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2832 | |
| 2833 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 2834 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2835 | memset(pstrWFIDrv->au8AssociatedBSSID, 0, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2836 | |
| 2837 | |
| 2838 | /* Deallocation */ |
| 2839 | pstrWFIDrv->strWILC_UsrConnReq.ssidLen = 0; |
| 2840 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2841 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2842 | pstrWFIDrv->strWILC_UsrConnReq.pu8ssid = NULL; |
| 2843 | } |
| 2844 | |
| 2845 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8bssid != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2846 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2847 | pstrWFIDrv->strWILC_UsrConnReq.pu8bssid = NULL; |
| 2848 | } |
| 2849 | |
| 2850 | pstrWFIDrv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2851 | if (pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2852 | kfree(pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2853 | pstrWFIDrv->strWILC_UsrConnReq.pu8ConnReqIEs = NULL; |
| 2854 | } |
| 2855 | |
| 2856 | |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2857 | if (gu8FlushedJoinReq != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2858 | kfree(gu8FlushedJoinReq); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2859 | gu8FlushedJoinReq = NULL; |
| 2860 | } |
Johnny Kim | 8a625ca | 2015-08-20 16:32:50 +0900 | [diff] [blame] | 2861 | if (gu8FlushedInfoElemAsoc != NULL && gu8FlushedJoinReqDrvHandler == drvHandler) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 2862 | kfree(gu8FlushedInfoElemAsoc); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2863 | gu8FlushedInfoElemAsoc = NULL; |
| 2864 | } |
| 2865 | |
| 2866 | } |
| 2867 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2868 | /* ////////////////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2869 | up(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2870 | /* ///////////////////////// */ |
| 2871 | |
| 2872 | } |
| 2873 | |
| 2874 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2875 | void resolve_disconnect_aberration(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2876 | { |
| 2877 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 2878 | |
| 2879 | pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 2880 | if (pstrWFIDrv == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2881 | return; |
| 2882 | if ((pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTING)) { |
| 2883 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 2884 | host_int_disconnect(pstrWFIDrv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2885 | } |
| 2886 | } |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2887 | static s32 Switch_Log_Terminal(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2888 | { |
| 2889 | |
| 2890 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2891 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2892 | tstrWID strWID; |
| 2893 | static char dummy = 9; |
| 2894 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2895 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2896 | strWID.u16WIDid = (u16)WID_LOGTerminal_Switch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2897 | strWID.enuWIDtype = WID_CHAR; |
| 2898 | strWID.ps8WidVal = &dummy; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2899 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2900 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2901 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 2902 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2903 | |
| 2904 | |
| 2905 | if (s32Error) { |
| 2906 | PRINT_D(HOSTINF_DBG, "Failed to switch log terminal\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2907 | PRINT_ER("Failed to switch log terminal\n"); |
| 2908 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2909 | } |
| 2910 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2911 | PRINT_INFO(HOSTINF_DBG, "MAC address set ::\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2912 | |
| 2913 | return s32Error; |
| 2914 | } |
| 2915 | |
| 2916 | /** |
| 2917 | * @brief Handle_GetChnl |
| 2918 | * @details Sending config packet to get channel |
| 2919 | * @param[in] NONE |
| 2920 | * @return NONE |
| 2921 | * |
| 2922 | * @author |
| 2923 | * @date |
| 2924 | * @version 1.0 |
| 2925 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2926 | static s32 Handle_GetChnl(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2927 | { |
| 2928 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2929 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2930 | tstrWID strWID; |
| 2931 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 2932 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2933 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2934 | strWID.u16WIDid = (u16)WID_CURRENT_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2935 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2936 | strWID.ps8WidVal = (s8 *)&gu8Chnl; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2937 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2938 | |
| 2939 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 2940 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2941 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 2942 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2943 | /*get the value by searching the local copy*/ |
| 2944 | if (s32Error) { |
| 2945 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2946 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2947 | } |
| 2948 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2949 | up(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2950 | |
| 2951 | return s32Error; |
| 2952 | |
| 2953 | |
| 2954 | |
| 2955 | } |
| 2956 | |
| 2957 | |
| 2958 | /** |
| 2959 | * @brief Handle_GetRssi |
| 2960 | * @details Sending config packet to get RSSI |
| 2961 | * @param[in] NONE |
| 2962 | * @return NONE |
| 2963 | * @author |
| 2964 | * @date |
| 2965 | * @version 1.0 |
| 2966 | */ |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2967 | static void Handle_GetRssi(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2968 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2969 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2970 | tstrWID strWID; |
| 2971 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2972 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 2973 | strWID.u16WIDid = (u16)WID_RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2974 | strWID.enuWIDtype = WID_CHAR; |
| 2975 | strWID.ps8WidVal = &gs8Rssi; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 2976 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2977 | |
| 2978 | /*Sending Cfg*/ |
| 2979 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 2980 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 2981 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 2982 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2983 | if (s32Error) { |
| 2984 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2985 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2986 | } |
| 2987 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 2988 | up(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2989 | |
| 2990 | |
| 2991 | } |
| 2992 | |
| 2993 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 2994 | static void Handle_GetLinkspeed(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2995 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 2996 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2997 | tstrWID strWID; |
| 2998 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 2999 | |
| 3000 | gs8lnkspd = 0; |
| 3001 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3002 | strWID.u16WIDid = (u16)WID_LINKSPEED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3003 | strWID.enuWIDtype = WID_CHAR; |
| 3004 | strWID.ps8WidVal = &gs8lnkspd; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3005 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3006 | /*Sending Cfg*/ |
| 3007 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 3008 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3009 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 3010 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3011 | if (s32Error) { |
| 3012 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3013 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3014 | } |
| 3015 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3016 | up(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3017 | |
| 3018 | |
| 3019 | } |
| 3020 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 3021 | s32 Handle_GetStatistics(tstrWILC_WFIDrv *drvHandler, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3022 | { |
| 3023 | tstrWID strWIDList[5]; |
Chaehyun Lim | fbc2fe1 | 2015-09-15 14:06:16 +0900 | [diff] [blame] | 3024 | u32 u32WidsCount = 0, s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3025 | |
| 3026 | strWIDList[u32WidsCount].u16WIDid = WID_LINKSPEED; |
| 3027 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3028 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3029 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u8LinkSpeed)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3030 | u32WidsCount++; |
| 3031 | |
| 3032 | strWIDList[u32WidsCount].u16WIDid = WID_RSSI; |
| 3033 | strWIDList[u32WidsCount].enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3034 | strWIDList[u32WidsCount].s32ValueSize = sizeof(char); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3035 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->s8RSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3036 | u32WidsCount++; |
| 3037 | |
| 3038 | strWIDList[u32WidsCount].u16WIDid = WID_SUCCESS_FRAME_COUNT; |
| 3039 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3040 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3041 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3042 | u32WidsCount++; |
| 3043 | |
| 3044 | strWIDList[u32WidsCount].u16WIDid = WID_RECEIVED_FRAGMENT_COUNT; |
| 3045 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3046 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3047 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32RxCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3048 | u32WidsCount++; |
| 3049 | |
| 3050 | strWIDList[u32WidsCount].u16WIDid = WID_FAILED_COUNT; |
| 3051 | strWIDList[u32WidsCount].enuWIDtype = WID_INT; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3052 | strWIDList[u32WidsCount].s32ValueSize = sizeof(u32); |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3053 | strWIDList[u32WidsCount].ps8WidVal = (s8 *)(&(pstrStatistics->u32TxFailureCount)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3054 | u32WidsCount++; |
| 3055 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3056 | s32Error = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, false, |
| 3057 | get_id_from_handler(drvHandler)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3058 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3059 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3060 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3061 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3062 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3063 | return 0; |
| 3064 | |
| 3065 | } |
| 3066 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3067 | /** |
| 3068 | * @brief Handle_Get_InActiveTime |
| 3069 | * @details Sending config packet to set mac adddress for station and |
| 3070 | * get inactive time |
| 3071 | * @param[in] NONE |
| 3072 | * @return NONE |
| 3073 | * |
| 3074 | * @author |
| 3075 | * @date |
| 3076 | * @version 1.0 |
| 3077 | */ |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 3078 | static s32 Handle_Get_InActiveTime(tstrWILC_WFIDrv *drvHandler, |
| 3079 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3080 | { |
| 3081 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3082 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3083 | u8 *stamac; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3084 | tstrWID strWID; |
| 3085 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3086 | |
| 3087 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3088 | strWID.u16WIDid = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3089 | strWID.enuWIDtype = WID_STR; |
| 3090 | strWID.s32ValueSize = ETH_ALEN; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3091 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3092 | |
| 3093 | |
| 3094 | stamac = strWID.ps8WidVal; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3095 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3096 | |
| 3097 | |
| 3098 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 3099 | |
| 3100 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3101 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3102 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3103 | /*get the value by searching the local copy*/ |
| 3104 | if (s32Error) { |
| 3105 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3106 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3107 | } |
| 3108 | |
| 3109 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3110 | strWID.u16WIDid = (u16)WID_GET_INACTIVE_TIME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3111 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3112 | strWID.ps8WidVal = (s8 *)&gu32InactiveTime; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3113 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3114 | |
| 3115 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3116 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 3117 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3118 | /*get the value by searching the local copy*/ |
| 3119 | if (s32Error) { |
| 3120 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3121 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3122 | } |
| 3123 | |
| 3124 | |
| 3125 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", gu32InactiveTime); |
| 3126 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3127 | up(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3128 | |
| 3129 | return s32Error; |
| 3130 | |
| 3131 | |
| 3132 | |
| 3133 | } |
| 3134 | |
| 3135 | |
| 3136 | /** |
| 3137 | * @brief Handle_AddBeacon |
| 3138 | * @details Sending config packet to add beacon |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 3139 | * @param[in] struct beacon_attr *pstrSetBeaconParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3140 | * @return NONE |
| 3141 | * @author |
| 3142 | * @date |
| 3143 | * @version 1.0 |
| 3144 | */ |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 3145 | static void Handle_AddBeacon(tstrWILC_WFIDrv *drvHandler, |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 3146 | struct beacon_attr *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3147 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3148 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3149 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3150 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3151 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3152 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3153 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 3154 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3155 | strWID.u16WIDid = (u16)WID_ADD_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3156 | strWID.enuWIDtype = WID_BIN; |
| 3157 | strWID.s32ValueSize = pstrSetBeaconParam->u32HeadLen + pstrSetBeaconParam->u32TailLen + 16; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3158 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3159 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3160 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3161 | |
| 3162 | pu8CurrByte = strWID.ps8WidVal; |
| 3163 | *pu8CurrByte++ = (pstrSetBeaconParam->u32Interval & 0xFF); |
| 3164 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 8) & 0xFF); |
| 3165 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 16) & 0xFF); |
| 3166 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32Interval >> 24) & 0xFF); |
| 3167 | |
| 3168 | *pu8CurrByte++ = (pstrSetBeaconParam->u32DTIMPeriod & 0xFF); |
| 3169 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 8) & 0xFF); |
| 3170 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 16) & 0xFF); |
| 3171 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32DTIMPeriod >> 24) & 0xFF); |
| 3172 | |
| 3173 | *pu8CurrByte++ = (pstrSetBeaconParam->u32HeadLen & 0xFF); |
| 3174 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 8) & 0xFF); |
| 3175 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 16) & 0xFF); |
| 3176 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32HeadLen >> 24) & 0xFF); |
| 3177 | |
| 3178 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Head, pstrSetBeaconParam->u32HeadLen); |
| 3179 | pu8CurrByte += pstrSetBeaconParam->u32HeadLen; |
| 3180 | |
| 3181 | *pu8CurrByte++ = (pstrSetBeaconParam->u32TailLen & 0xFF); |
| 3182 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 8) & 0xFF); |
| 3183 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 16) & 0xFF); |
| 3184 | *pu8CurrByte++ = ((pstrSetBeaconParam->u32TailLen >> 24) & 0xFF); |
| 3185 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3186 | if (pstrSetBeaconParam->pu8Tail > 0) |
| 3187 | memcpy(pu8CurrByte, pstrSetBeaconParam->pu8Tail, pstrSetBeaconParam->u32TailLen); |
| 3188 | pu8CurrByte += pstrSetBeaconParam->u32TailLen; |
| 3189 | |
| 3190 | |
| 3191 | |
| 3192 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3193 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3194 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3195 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3196 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3197 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3198 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3199 | kfree(strWID.ps8WidVal); |
| 3200 | kfree(pstrSetBeaconParam->pu8Head); |
| 3201 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3202 | } |
| 3203 | |
| 3204 | |
| 3205 | /** |
| 3206 | * @brief Handle_AddBeacon |
| 3207 | * @details Sending config packet to delete beacon |
Tony Cho | 80bf8836 | 2015-09-30 18:44:29 +0900 | [diff] [blame] | 3208 | * @param[in] tstrWILC_WFIDrv *drvHandler |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3209 | * @return NONE |
| 3210 | * @author |
| 3211 | * @date |
| 3212 | * @version 1.0 |
| 3213 | */ |
Tony Cho | 80bf8836 | 2015-09-30 18:44:29 +0900 | [diff] [blame] | 3214 | static void Handle_DelBeacon(tstrWILC_WFIDrv *drvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3215 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3216 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3217 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3218 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3219 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3220 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3221 | strWID.u16WIDid = (u16)WID_DEL_BEACON; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3222 | strWID.enuWIDtype = WID_CHAR; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3223 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3224 | strWID.ps8WidVal = &gu8DelBcn; |
| 3225 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3226 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3227 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3228 | |
| 3229 | pu8CurrByte = strWID.ps8WidVal; |
| 3230 | |
| 3231 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
| 3232 | /* TODO: build del beacon message*/ |
| 3233 | |
| 3234 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3235 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3236 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3237 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3238 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3239 | } |
| 3240 | |
| 3241 | |
| 3242 | /** |
| 3243 | * @brief WILC_HostIf_PackStaParam |
| 3244 | * @details Handling packing of the station params in a buffer |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3245 | * @param[in] u8* pu8Buffer, struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3246 | * @return NONE |
| 3247 | * @author |
| 3248 | * @date |
| 3249 | * @version 1.0 |
| 3250 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3251 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 3252 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3253 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3254 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3255 | |
| 3256 | pu8CurrByte = pu8Buffer; |
| 3257 | |
| 3258 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3259 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3260 | pu8CurrByte += ETH_ALEN; |
| 3261 | |
| 3262 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 3263 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 3264 | |
| 3265 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3266 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3267 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3268 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 3269 | |
| 3270 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 3271 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 3272 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 3273 | |
| 3274 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3275 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3276 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 3277 | |
| 3278 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 3279 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 3280 | |
| 3281 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 3282 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 3283 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 3284 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 3285 | |
| 3286 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 3287 | |
| 3288 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 3289 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 3290 | |
| 3291 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 3292 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 3293 | |
| 3294 | return pu8CurrByte - pu8Buffer; |
| 3295 | } |
| 3296 | |
| 3297 | /** |
| 3298 | * @brief Handle_AddStation |
| 3299 | * @details Sending config packet to add station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3300 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3301 | * @return NONE |
| 3302 | * @author |
| 3303 | * @date |
| 3304 | * @version 1.0 |
| 3305 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3306 | static void Handle_AddStation(tstrWILC_WFIDrv *drvHandler, |
| 3307 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3308 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3309 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3310 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3311 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3312 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3313 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3314 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3315 | strWID.u16WIDid = (u16)WID_ADD_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3316 | strWID.enuWIDtype = WID_BIN; |
| 3317 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3318 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3319 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3320 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3321 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3322 | |
| 3323 | pu8CurrByte = strWID.ps8WidVal; |
| 3324 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3325 | |
| 3326 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3327 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3328 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3329 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3330 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3331 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3332 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3333 | kfree(pstrStationParam->pu8Rates); |
| 3334 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3335 | } |
| 3336 | |
| 3337 | /** |
| 3338 | * @brief Handle_DelAllSta |
| 3339 | * @details Sending config packet to delete station |
| 3340 | * @param[in] tstrHostIFDelSta* pstrDelStaParam |
| 3341 | * @return NONE |
| 3342 | * @author |
| 3343 | * @date |
| 3344 | * @version 1.0 |
| 3345 | */ |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 3346 | static void Handle_DelAllSta(tstrWILC_WFIDrv *drvHandler, |
| 3347 | struct del_all_sta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3348 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3349 | s32 s32Error = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3350 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3351 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3352 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3353 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3354 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 3355 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3356 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3357 | strWID.u16WIDid = (u16)WID_DEL_ALL_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3358 | strWID.enuWIDtype = WID_STR; |
| 3359 | strWID.s32ValueSize = (pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1; |
| 3360 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3361 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3362 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3363 | strWID.ps8WidVal = kmalloc((pstrDelAllStaParam->u8Num_AssocSta * ETH_ALEN) + 1, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3364 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3365 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3366 | |
| 3367 | pu8CurrByte = strWID.ps8WidVal; |
| 3368 | |
| 3369 | *(pu8CurrByte++) = pstrDelAllStaParam->u8Num_AssocSta; |
| 3370 | |
| 3371 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 3372 | if (memcmp(pstrDelAllStaParam->au8Sta_DelAllSta[i], au8Zero_Buff, ETH_ALEN)) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3373 | memcpy(pu8CurrByte, pstrDelAllStaParam->au8Sta_DelAllSta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3374 | else |
| 3375 | continue; |
| 3376 | |
| 3377 | pu8CurrByte += ETH_ALEN; |
| 3378 | } |
| 3379 | |
| 3380 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3381 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3382 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3383 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3384 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3385 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3386 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3387 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3388 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3389 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3390 | } |
| 3391 | |
| 3392 | |
| 3393 | /** |
| 3394 | * @brief Handle_DelStation |
| 3395 | * @details Sending config packet to delete station |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 3396 | * @param[in] struct del_sta *pstrDelStaParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3397 | * @return NONE |
| 3398 | * @author |
| 3399 | * @date |
| 3400 | * @version 1.0 |
| 3401 | */ |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 3402 | static void Handle_DelStation(tstrWILC_WFIDrv *drvHandler, |
| 3403 | struct del_sta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3404 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3405 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3406 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3407 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3408 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3409 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3410 | strWID.u16WIDid = (u16)WID_REMOVE_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3411 | strWID.enuWIDtype = WID_BIN; |
| 3412 | strWID.s32ValueSize = ETH_ALEN; |
| 3413 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3414 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3415 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3416 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3417 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3418 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3419 | |
| 3420 | pu8CurrByte = strWID.ps8WidVal; |
| 3421 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3422 | memcpy(pu8CurrByte, pstrDelStaParam->au8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3423 | |
| 3424 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3425 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3426 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3427 | if (s32Error) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 3428 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3429 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3430 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3431 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3432 | } |
| 3433 | |
| 3434 | |
| 3435 | /** |
| 3436 | * @brief Handle_EditStation |
| 3437 | * @details Sending config packet to edit station |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3438 | * @param[in] struct add_sta_param *pstrStationParam |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3439 | * @return NONE |
| 3440 | * @author |
| 3441 | * @date |
| 3442 | * @version 1.0 |
| 3443 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 3444 | static void Handle_EditStation(tstrWILC_WFIDrv *drvHandler, |
| 3445 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3446 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3447 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3448 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3449 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3450 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3451 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3452 | strWID.u16WIDid = (u16)WID_EDIT_STA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3453 | strWID.enuWIDtype = WID_BIN; |
| 3454 | strWID.s32ValueSize = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
| 3455 | |
| 3456 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3457 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3458 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3459 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3460 | |
| 3461 | pu8CurrByte = strWID.ps8WidVal; |
| 3462 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 3463 | |
| 3464 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3465 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3466 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3467 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3468 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3469 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3470 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3471 | kfree(pstrStationParam->pu8Rates); |
| 3472 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3473 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3474 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3475 | /** |
| 3476 | * @brief Handle_RemainOnChan |
| 3477 | * @details Sending config packet to edit station |
| 3478 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3479 | * @return NONE |
| 3480 | * @author |
| 3481 | * @date |
| 3482 | * @version 1.0 |
| 3483 | */ |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 3484 | static int Handle_RemainOnChan(tstrWILC_WFIDrv *drvHandler, |
| 3485 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3486 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3487 | s32 s32Error = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3488 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3489 | tstrWID strWID; |
| 3490 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3491 | |
| 3492 | /*If it's a pendig remain-on-channel, don't overwrite gWFiDrvHandle values (since incoming msg is garbbage)*/ |
| 3493 | if (!pstrWFIDrv->u8RemainOnChan_pendingreq) { |
| 3494 | pstrWFIDrv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 3495 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 3496 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 3497 | pstrWFIDrv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 3498 | pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
| 3499 | } else { |
| 3500 | /*Set the channel to use it as a wid val*/ |
| 3501 | pstrHostIfRemainOnChan->u16Channel = pstrWFIDrv->strHostIfRemainOnChan.u16Channel; |
| 3502 | } |
| 3503 | |
| 3504 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
| 3505 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
| 3506 | pstrWFIDrv->u8RemainOnChan_pendingreq = 1; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3507 | s32Error = -EBUSY; |
| 3508 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3509 | } |
| 3510 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
| 3511 | 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] | 3512 | s32Error = -EBUSY; |
| 3513 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3514 | } |
| 3515 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3516 | if (g_obtainingIP || connecting) { |
| 3517 | 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] | 3518 | s32Error = -EBUSY; |
| 3519 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3520 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3521 | |
| 3522 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 3523 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3524 | u8remain_on_chan_flag = true; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3525 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3526 | strWID.enuWIDtype = WID_STR; |
| 3527 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3528 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3529 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3530 | if (strWID.ps8WidVal == NULL) { |
| 3531 | s32Error = -ENOMEM; |
| 3532 | goto ERRORHANDLER; |
| 3533 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3534 | |
| 3535 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3536 | strWID.ps8WidVal[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3537 | |
| 3538 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3539 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3540 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3541 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3542 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3543 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3544 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3545 | { |
| 3546 | P2P_LISTEN_STATE = 1; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3547 | pstrWFIDrv->hRemainOnChannel.data = (unsigned long)pstrWFIDrv; |
| 3548 | mod_timer(&pstrWFIDrv->hRemainOnChannel, |
| 3549 | jiffies + |
| 3550 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3551 | |
| 3552 | /*Calling CFG ready_on_channel*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3553 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3554 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanReady(pstrWFIDrv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3555 | |
| 3556 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
| 3557 | pstrWFIDrv->u8RemainOnChan_pendingreq = 0; |
| 3558 | } |
| 3559 | return s32Error; |
| 3560 | } |
| 3561 | |
| 3562 | /** |
| 3563 | * @brief Handle_RegisterFrame |
| 3564 | * @details |
| 3565 | * @param[in] |
| 3566 | * @return NONE |
| 3567 | * @author |
| 3568 | * @date |
| 3569 | * @version 1.0 |
| 3570 | */ |
Tony Cho | bc37c5d | 2015-09-21 12:16:59 +0900 | [diff] [blame] | 3571 | static int Handle_RegisterFrame(tstrWILC_WFIDrv *drvHandler, |
| 3572 | struct reg_frame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3573 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3574 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3575 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3576 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3577 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3578 | |
| 3579 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 3580 | |
| 3581 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3582 | strWID.u16WIDid = (u16)WID_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3583 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3584 | strWID.ps8WidVal = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3585 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3586 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3587 | |
| 3588 | pu8CurrByte = strWID.ps8WidVal; |
| 3589 | |
| 3590 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 3591 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3592 | memcpy(pu8CurrByte, &(pstrHostIfRegisterFrame->u16FrameType), sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3593 | |
| 3594 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3595 | strWID.s32ValueSize = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3596 | |
| 3597 | |
| 3598 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3599 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3600 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3601 | if (s32Error) { |
| 3602 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3603 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3604 | } |
| 3605 | |
| 3606 | return s32Error; |
| 3607 | |
| 3608 | } |
| 3609 | |
| 3610 | /** |
| 3611 | * @brief Handle_ListenStateExpired |
| 3612 | * @details Handle of listen state expiration |
| 3613 | * @param[in] NONE |
| 3614 | * @return Error code. |
| 3615 | * @author |
| 3616 | * @date |
| 3617 | * @version 1.0 |
| 3618 | */ |
| 3619 | #define FALSE_FRMWR_CHANNEL 100 |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 3620 | static u32 Handle_ListenStateExpired(tstrWILC_WFIDrv *drvHandler, |
| 3621 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3622 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3623 | u8 u8remain_on_chan_flag; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3624 | tstrWID strWID; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3625 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3626 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *) drvHandler; |
| 3627 | |
| 3628 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 3629 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3630 | /*Make sure we are already in listen state*/ |
| 3631 | /*This is to handle duplicate expiry messages (listen timer fired and supplicant called cancel_remain_on_channel())*/ |
| 3632 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 3633 | u8remain_on_chan_flag = false; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3634 | strWID.u16WIDid = (u16)WID_REMAIN_ON_CHAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3635 | strWID.enuWIDtype = WID_STR; |
| 3636 | strWID.s32ValueSize = 2; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3637 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3638 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3639 | if (strWID.ps8WidVal == NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3640 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3641 | |
| 3642 | strWID.ps8WidVal[0] = u8remain_on_chan_flag; |
| 3643 | strWID.ps8WidVal[1] = FALSE_FRMWR_CHANNEL; |
| 3644 | |
| 3645 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3646 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3647 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3648 | if (s32Error != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3649 | PRINT_ER("Failed to set remain on channel\n"); |
| 3650 | goto _done_; |
| 3651 | } |
| 3652 | |
| 3653 | if (pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 3654 | pstrWFIDrv->strHostIfRemainOnChan.pRemainOnChanExpired(pstrWFIDrv->strHostIfRemainOnChan.pVoid |
| 3655 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 3656 | } |
| 3657 | P2P_LISTEN_STATE = 0; |
| 3658 | } else { |
| 3659 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3660 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3661 | } |
| 3662 | |
| 3663 | _done_: |
| 3664 | return s32Error; |
| 3665 | } |
| 3666 | |
| 3667 | |
| 3668 | /** |
| 3669 | * @brief ListenTimerCB |
| 3670 | * @details Callback function of remain-on-channel timer |
| 3671 | * @param[in] NONE |
| 3672 | * @return Error code. |
| 3673 | * @author |
| 3674 | * @date |
| 3675 | * @version 1.0 |
| 3676 | */ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3677 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3678 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3679 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3680 | struct host_if_msg msg; |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3681 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3682 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 3683 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3684 | |
| 3685 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3686 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3687 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3688 | msg.drvHandler = pstrWFIDrv; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 3689 | msg.body.remain_on_ch.u32ListenSessionID = pstrWFIDrv->strHostIfRemainOnChan.u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3690 | |
| 3691 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3692 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3693 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3694 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3695 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3696 | |
| 3697 | /** |
| 3698 | * @brief Handle_EditStation |
| 3699 | * @details Sending config packet to edit station |
| 3700 | * @param[in] tstrWILC_AddStaParam* pstrStationParam |
| 3701 | * @return NONE |
| 3702 | * @author |
| 3703 | * @date |
| 3704 | * @version 1.0 |
| 3705 | */ |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 3706 | static void Handle_PowerManagement(tstrWILC_WFIDrv *drvHandler, |
| 3707 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3708 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3709 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3710 | tstrWID strWID; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 3711 | s8 s8PowerMode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3712 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3713 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3714 | strWID.u16WIDid = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3715 | |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3716 | if (strPowerMgmtParam->bIsEnabled == true) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3717 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3718 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3719 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3720 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
| 3721 | strWID.ps8WidVal = &s8PowerMode; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 3722 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3723 | |
| 3724 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 3725 | |
| 3726 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3727 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3728 | get_id_from_handler(pstrWFIDrv)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3729 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3730 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3731 | } |
| 3732 | |
| 3733 | /** |
| 3734 | * @brief Handle_SetMulticastFilter |
| 3735 | * @details Set Multicast filter in firmware |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3736 | * @param[in] struct set_multicast *strHostIfSetMulti |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3737 | * @return NONE |
| 3738 | * @author asobhy |
| 3739 | * @date |
| 3740 | * @version 1.0 |
| 3741 | */ |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3742 | static void Handle_SetMulticastFilter(tstrWILC_WFIDrv *drvHandler, |
| 3743 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3744 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3745 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3746 | tstrWID strWID; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3747 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3748 | |
| 3749 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 3750 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3751 | strWID.u16WIDid = (u16)WID_SETUP_MULTICAST_FILTER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3752 | strWID.enuWIDtype = WID_BIN; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 3753 | strWID.s32ValueSize = sizeof(struct set_multicast) + ((strHostIfSetMulti->u32count) * ETH_ALEN); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3754 | strWID.ps8WidVal = kmalloc(strWID.s32ValueSize, GFP_KERNEL); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 3755 | if (strWID.ps8WidVal == NULL) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3756 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3757 | |
| 3758 | pu8CurrByte = strWID.ps8WidVal; |
| 3759 | *pu8CurrByte++ = (strHostIfSetMulti->bIsEnabled & 0xFF); |
| 3760 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 8) & 0xFF); |
| 3761 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 16) & 0xFF); |
| 3762 | *pu8CurrByte++ = ((strHostIfSetMulti->bIsEnabled >> 24) & 0xFF); |
| 3763 | |
| 3764 | *pu8CurrByte++ = (strHostIfSetMulti->u32count & 0xFF); |
| 3765 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 8) & 0xFF); |
| 3766 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 16) & 0xFF); |
| 3767 | *pu8CurrByte++ = ((strHostIfSetMulti->u32count >> 24) & 0xFF); |
| 3768 | |
| 3769 | if ((strHostIfSetMulti->u32count) > 0) |
| 3770 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->u32count) * ETH_ALEN)); |
| 3771 | |
| 3772 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3773 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, false, |
| 3774 | get_id_from_handler(drvHandler)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3775 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3776 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3777 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3778 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 3779 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3780 | |
| 3781 | } |
| 3782 | |
| 3783 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3784 | /** |
| 3785 | * @brief Handle_AddBASession |
| 3786 | * @details Add block ack session |
| 3787 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 3788 | * @return NONE |
| 3789 | * @author Amr Abdel-Moghny |
| 3790 | * @date Feb. 2014 |
| 3791 | * @version 9.0 |
| 3792 | */ |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 3793 | static s32 Handle_AddBASession(tstrWILC_WFIDrv *drvHandler, |
| 3794 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3795 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3796 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3797 | tstrWID strWID; |
| 3798 | int AddbaTimeout = 100; |
| 3799 | char *ptr = NULL; |
| 3800 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3801 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3802 | 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] | 3803 | strHostIfBASessionInfo->au8Bssid[0], |
| 3804 | strHostIfBASessionInfo->au8Bssid[1], |
| 3805 | strHostIfBASessionInfo->au8Bssid[2], |
| 3806 | strHostIfBASessionInfo->u16BufferSize, |
| 3807 | strHostIfBASessionInfo->u16SessionTimeout, |
| 3808 | strHostIfBASessionInfo->u8Ted); |
| 3809 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3810 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3811 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3812 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3813 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 3814 | ptr = strWID.ps8WidVal; |
| 3815 | /* *ptr++ = 0x14; */ |
| 3816 | *ptr++ = 0x14; |
| 3817 | *ptr++ = 0x3; |
| 3818 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3819 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3820 | ptr += ETH_ALEN; |
| 3821 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3822 | /* BA Policy*/ |
| 3823 | *ptr++ = 1; |
| 3824 | /* Buffer size*/ |
| 3825 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 3826 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
| 3827 | /* BA timeout*/ |
| 3828 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 3829 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 3830 | /* ADDBA timeout*/ |
| 3831 | *ptr++ = (AddbaTimeout & 0xFF); |
| 3832 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
| 3833 | /* Group Buffer Max Frames*/ |
| 3834 | *ptr++ = 8; |
| 3835 | /* Group Buffer Timeout */ |
| 3836 | *ptr++ = 0; |
| 3837 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3838 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3839 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3840 | if (s32Error) |
| 3841 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 3842 | |
| 3843 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3844 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3845 | strWID.enuWIDtype = WID_STR; |
| 3846 | strWID.s32ValueSize = 15; |
| 3847 | ptr = strWID.ps8WidVal; |
| 3848 | /* *ptr++ = 0x14; */ |
| 3849 | *ptr++ = 15; |
| 3850 | *ptr++ = 7; |
| 3851 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3852 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3853 | ptr += ETH_ALEN; |
| 3854 | /* TID*/ |
| 3855 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3856 | /* Max Num MSDU */ |
| 3857 | *ptr++ = 8; |
| 3858 | /* BA timeout*/ |
| 3859 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 3860 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
| 3861 | /*Ack-Policy */ |
| 3862 | *ptr++ = 3; |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3863 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3864 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3865 | |
| 3866 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3867 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3868 | |
| 3869 | return s32Error; |
| 3870 | |
| 3871 | } |
| 3872 | |
| 3873 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3874 | /** |
| 3875 | * @brief Handle_DelBASession |
| 3876 | * @details Delete block ack session |
| 3877 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 3878 | * @return NONE |
| 3879 | * @author Amr Abdel-Moghny |
| 3880 | * @date Feb. 2013 |
| 3881 | * @version 9.0 |
| 3882 | */ |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 3883 | static s32 Handle_DelBASession(tstrWILC_WFIDrv *drvHandler, |
| 3884 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3885 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3886 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3887 | tstrWID strWID; |
| 3888 | char *ptr = NULL; |
| 3889 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3890 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3891 | 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] | 3892 | strHostIfBASessionInfo->au8Bssid[0], |
| 3893 | strHostIfBASessionInfo->au8Bssid[1], |
| 3894 | strHostIfBASessionInfo->au8Bssid[2], |
| 3895 | strHostIfBASessionInfo->u8Ted); |
| 3896 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3897 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3898 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3899 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3900 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 3901 | ptr = strWID.ps8WidVal; |
| 3902 | /* *ptr++ = 0x14; */ |
| 3903 | *ptr++ = 0x14; |
| 3904 | *ptr++ = 0x3; |
| 3905 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3906 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3907 | ptr += ETH_ALEN; |
| 3908 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3909 | /* BA direction = recipent*/ |
| 3910 | *ptr++ = 0; |
| 3911 | /* Delba Reason */ |
| 3912 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 3913 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3914 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3915 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3916 | if (s32Error) |
| 3917 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 3918 | |
| 3919 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3920 | strWID.u16WIDid = (u16)WID_11E_P_ACTION_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3921 | strWID.enuWIDtype = WID_STR; |
| 3922 | strWID.s32ValueSize = 15; |
| 3923 | ptr = strWID.ps8WidVal; |
| 3924 | /* *ptr++ = 0x14; */ |
| 3925 | *ptr++ = 15; |
| 3926 | *ptr++ = 7; |
| 3927 | *ptr++ = 0x3; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3928 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3929 | ptr += ETH_ALEN; |
| 3930 | /* TID*/ |
| 3931 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3932 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3933 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3934 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3935 | |
| 3936 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3937 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3938 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3939 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3940 | |
| 3941 | return s32Error; |
| 3942 | |
| 3943 | } |
| 3944 | |
| 3945 | |
| 3946 | /** |
| 3947 | * @brief Handle_DelAllRxBASessions |
| 3948 | * @details Delete all Rx BA sessions |
| 3949 | * @param[in] tstrHostIFSetMulti* strHostIfSetMulti |
| 3950 | * @return NONE |
| 3951 | * @author Abdelrahman Sobhy |
| 3952 | * @date Feb. 2013 |
| 3953 | * @version 9.0 |
| 3954 | */ |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 3955 | static s32 Handle_DelAllRxBASessions(tstrWILC_WFIDrv *drvHandler, |
| 3956 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3957 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3958 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3959 | tstrWID strWID; |
| 3960 | char *ptr = NULL; |
| 3961 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)drvHandler; |
| 3962 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3963 | 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] | 3964 | strHostIfBASessionInfo->au8Bssid[0], |
| 3965 | strHostIfBASessionInfo->au8Bssid[1], |
| 3966 | strHostIfBASessionInfo->au8Bssid[2], |
| 3967 | strHostIfBASessionInfo->u8Ted); |
| 3968 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 3969 | strWID.u16WIDid = (u16)WID_DEL_ALL_RX_BA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3970 | strWID.enuWIDtype = WID_STR; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 3971 | strWID.ps8WidVal = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3972 | strWID.s32ValueSize = BLOCK_ACK_REQ_SIZE; |
| 3973 | ptr = strWID.ps8WidVal; |
| 3974 | *ptr++ = 0x14; |
| 3975 | *ptr++ = 0x3; |
| 3976 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 3977 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3978 | ptr += ETH_ALEN; |
| 3979 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
| 3980 | /* BA direction = recipent*/ |
| 3981 | *ptr++ = 0; |
| 3982 | /* Delba Reason */ |
| 3983 | *ptr++ = 32; /* Unspecific QOS reason */ |
| 3984 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 3985 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 3986 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3987 | if (s32Error) |
| 3988 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 3989 | |
| 3990 | |
| 3991 | if (strWID.ps8WidVal != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 3992 | kfree(strWID.ps8WidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3993 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 3994 | up(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3995 | |
| 3996 | return s32Error; |
| 3997 | |
| 3998 | } |
| 3999 | |
| 4000 | /** |
| 4001 | * @brief hostIFthread |
| 4002 | * @details Main thread to handle message queue requests |
| 4003 | * @param[in] void* pvArg |
| 4004 | * @return NONE |
| 4005 | * @author |
| 4006 | * @date |
| 4007 | * @version 1.0 |
| 4008 | */ |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4009 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4010 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4011 | u32 u32Ret; |
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 | tstrWILC_WFIDrv *pstrWFIDrv; |
| 4014 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4015 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4016 | |
| 4017 | while (1) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4018 | wilc_mq_recv(&gMsgQHostIF, &msg, sizeof(struct host_if_msg), &u32Ret); |
| 4019 | pstrWFIDrv = (tstrWILC_WFIDrv *)msg.drvHandler; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4020 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4021 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 4022 | break; |
| 4023 | } |
| 4024 | |
| 4025 | |
| 4026 | /*Re-Queue HIF message*/ |
| 4027 | if ((!g_wilc_initialized)) { |
| 4028 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4029 | usleep_range(200 * 1000, 200 * 1000); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4030 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4031 | continue; |
| 4032 | } |
| 4033 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4034 | if (msg.id == HOST_IF_MSG_CONNECT && pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult != NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4035 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4036 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 4037 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4038 | continue; |
| 4039 | } |
| 4040 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4041 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4042 | case HOST_IF_MSG_Q_IDLE: |
| 4043 | Handle_wait_msg_q_empty(); |
| 4044 | break; |
| 4045 | |
| 4046 | case HOST_IF_MSG_SCAN: |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 4047 | Handle_Scan(msg.drvHandler, &msg.body.scan_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4048 | break; |
| 4049 | |
| 4050 | case HOST_IF_MSG_CONNECT: |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 4051 | Handle_Connect(msg.drvHandler, &msg.body.con_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4052 | break; |
| 4053 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4054 | case HOST_IF_MSG_FLUSH_CONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4055 | Handle_FlushConnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4056 | break; |
| 4057 | |
| 4058 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 4059 | Handle_RcvdNtwrkInfo(msg.drvHandler, &msg.body.net_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4060 | break; |
| 4061 | |
| 4062 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 4063 | Handle_RcvdGnrlAsyncInfo(msg.drvHandler, &msg.body.async_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4064 | break; |
| 4065 | |
| 4066 | case HOST_IF_MSG_KEY: |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4067 | Handle_Key(msg.drvHandler, &msg.body.key_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4068 | break; |
| 4069 | |
| 4070 | case HOST_IF_MSG_CFG_PARAMS: |
| 4071 | |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 4072 | Handle_CfgParam(msg.drvHandler, &msg.body.cfg_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4073 | break; |
| 4074 | |
| 4075 | case HOST_IF_MSG_SET_CHANNEL: |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 4076 | Handle_SetChannel(msg.drvHandler, &msg.body.channel_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4077 | break; |
| 4078 | |
| 4079 | case HOST_IF_MSG_DISCONNECT: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4080 | Handle_Disconnect(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4081 | break; |
| 4082 | |
| 4083 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 4084 | del_timer(&pstrWFIDrv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4085 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 4086 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4087 | /*Allow chip sleep, only if both interfaces are not connected*/ |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4088 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4089 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4090 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4091 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4092 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4093 | if (pstrWFIDrv->u8RemainOnChan_pendingreq) |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4094 | Handle_RemainOnChan(msg.drvHandler, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4095 | |
| 4096 | break; |
| 4097 | |
| 4098 | case HOST_IF_MSG_GET_RSSI: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4099 | Handle_GetRssi(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4100 | break; |
| 4101 | |
| 4102 | case HOST_IF_MSG_GET_LINKSPEED: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4103 | Handle_GetLinkspeed(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4104 | break; |
| 4105 | |
| 4106 | case HOST_IF_MSG_GET_STATISTICS: |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 4107 | Handle_GetStatistics(msg.drvHandler, (tstrStatistics *)msg.body.data); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4108 | break; |
| 4109 | |
| 4110 | case HOST_IF_MSG_GET_CHNL: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4111 | Handle_GetChnl(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4112 | break; |
| 4113 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4114 | case HOST_IF_MSG_ADD_BEACON: |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 4115 | Handle_AddBeacon(msg.drvHandler, &msg.body.beacon_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4116 | break; |
| 4117 | |
| 4118 | case HOST_IF_MSG_DEL_BEACON: |
Tony Cho | 80bf8836 | 2015-09-30 18:44:29 +0900 | [diff] [blame] | 4119 | Handle_DelBeacon(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4120 | break; |
| 4121 | |
| 4122 | case HOST_IF_MSG_ADD_STATION: |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4123 | Handle_AddStation(msg.drvHandler, &msg.body.add_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4124 | break; |
| 4125 | |
| 4126 | case HOST_IF_MSG_DEL_STATION: |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 4127 | Handle_DelStation(msg.drvHandler, &msg.body.del_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4128 | break; |
| 4129 | |
| 4130 | case HOST_IF_MSG_EDIT_STATION: |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 4131 | Handle_EditStation(msg.drvHandler, &msg.body.edit_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4132 | break; |
| 4133 | |
| 4134 | case HOST_IF_MSG_GET_INACTIVETIME: |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 4135 | Handle_Get_InActiveTime(msg.drvHandler, &msg.body.mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4136 | break; |
| 4137 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4138 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 4139 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 4140 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4141 | Handle_ScanDone(msg.drvHandler, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4142 | break; |
| 4143 | |
| 4144 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4145 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4146 | Handle_ConnectTimeout(msg.drvHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4147 | break; |
| 4148 | |
| 4149 | case HOST_IF_MSG_POWER_MGMT: |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 4150 | Handle_PowerManagement(msg.drvHandler, &msg.body.pwr_mgmt_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4151 | break; |
| 4152 | |
| 4153 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4154 | Handle_SetWfiDrvHandler(msg.drvHandler, |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 4155 | &msg.body.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4156 | break; |
| 4157 | |
| 4158 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 4159 | Handle_SetOperationMode(msg.drvHandler, &msg.body.mode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4160 | break; |
| 4161 | |
| 4162 | case HOST_IF_MSG_SET_IPADDRESS: |
| 4163 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4164 | Handle_set_IPAddress(msg.drvHandler, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4165 | break; |
| 4166 | |
| 4167 | case HOST_IF_MSG_GET_IPADDRESS: |
| 4168 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4169 | Handle_get_IPAddress(msg.drvHandler, msg.body.ip_info.au8IPAddr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4170 | break; |
| 4171 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4172 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 4173 | Handle_SetMacAddress(msg.drvHandler, &msg.body.set_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4174 | break; |
| 4175 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4176 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 4177 | Handle_GetMacAddress(msg.drvHandler, &msg.body.get_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4178 | break; |
| 4179 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4180 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 4181 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4182 | Handle_RemainOnChan(msg.drvHandler, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4183 | break; |
| 4184 | |
| 4185 | case HOST_IF_MSG_REGISTER_FRAME: |
| 4186 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4187 | Handle_RegisterFrame(msg.drvHandler, &msg.body.reg_frame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4188 | break; |
| 4189 | |
| 4190 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4191 | Handle_ListenStateExpired(msg.drvHandler, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4192 | break; |
| 4193 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4194 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 4195 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 4196 | Handle_SetMulticastFilter(msg.drvHandler, &msg.body.multicast_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4197 | break; |
| 4198 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4199 | case HOST_IF_MSG_ADD_BA_SESSION: |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4200 | Handle_AddBASession(msg.drvHandler, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4201 | break; |
| 4202 | |
| 4203 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4204 | Handle_DelAllRxBASessions(msg.drvHandler, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4205 | break; |
| 4206 | |
| 4207 | case HOST_IF_MSG_DEL_ALL_STA: |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 4208 | Handle_DelAllSta(msg.drvHandler, &msg.body.del_all_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4209 | break; |
| 4210 | |
| 4211 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4212 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4213 | break; |
| 4214 | } |
| 4215 | } |
| 4216 | |
| 4217 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4218 | up(&hSemHostIFthrdEnd); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 4219 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4220 | } |
| 4221 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4222 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4223 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4224 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4225 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4226 | |
| 4227 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4228 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4229 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4230 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4231 | |
| 4232 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4233 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4234 | } |
| 4235 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4236 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4237 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4238 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4239 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4240 | |
| 4241 | /* prepare the Timer Callback message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4242 | memset(&msg, 0, sizeof(struct host_if_msg)); |
| 4243 | msg.drvHandler = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4244 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4245 | |
| 4246 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4247 | wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4248 | } |
| 4249 | |
| 4250 | |
| 4251 | /** |
| 4252 | * @brief removes wpa/wpa2 keys |
| 4253 | * @details only in BSS STA mode if External Supplicant support is enabled. |
| 4254 | * removes all WPA/WPA2 station key entries from MAC hardware. |
| 4255 | * @param[in,out] handle to the wifi driver |
| 4256 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4257 | * @return Error code indicating success/failure |
| 4258 | * @note |
| 4259 | * @author zsalah |
| 4260 | * @date 8 March 2012 |
| 4261 | * @version 1.0 |
| 4262 | */ |
| 4263 | /* Check implementation in core adding 9 bytes to the input! */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4264 | s32 host_int_remove_key(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4265 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4266 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4267 | tstrWID strWID; |
| 4268 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4269 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4270 | strWID.u16WIDid = (u16)WID_REMOVE_KEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4271 | strWID.enuWIDtype = WID_STR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4272 | strWID.ps8WidVal = (s8 *)pu8StaAddress; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4273 | strWID.s32ValueSize = 6; |
| 4274 | |
| 4275 | return s32Error; |
| 4276 | |
| 4277 | } |
| 4278 | |
| 4279 | /** |
| 4280 | * @brief removes WEP key |
| 4281 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4282 | * remove a WEP key entry from MAC HW. |
| 4283 | * The BSS Station automatically finds the index of the entry using its |
| 4284 | * BSS ID and removes that entry from the MAC hardware. |
| 4285 | * @param[in,out] handle to the wifi driver |
| 4286 | * @param[in] 6 bytes of Station Adress in the station entry table |
| 4287 | * @return Error code indicating success/failure |
| 4288 | * @note NO need for the STA add since it is not used for processing |
| 4289 | * @author zsalah |
| 4290 | * @date 8 March 2012 |
| 4291 | * @version 1.0 |
| 4292 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4293 | s32 host_int_remove_wep_key(tstrWILC_WFIDrv *hWFIDrv, u8 u8keyIdx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4294 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4295 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4296 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4297 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4298 | |
| 4299 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4300 | if (pstrWFIDrv == NULL) { |
| 4301 | s32Error = -EFAULT; |
| 4302 | PRINT_ER("Failed to send setup multicast config packet\n"); |
| 4303 | return s32Error; |
| 4304 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4305 | |
| 4306 | /* prepare the Remove Wep Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4307 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4308 | |
| 4309 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4310 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4311 | msg.body.key_info.enuKeyType = WEP; |
| 4312 | msg.body.key_info.u8KeyAction = REMOVEKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4313 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4314 | |
| 4315 | |
| 4316 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4317 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4318 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8keyIdx; |
| 4319 | |
| 4320 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4321 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4322 | if (s32Error) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4323 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4324 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4325 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4326 | return s32Error; |
| 4327 | } |
| 4328 | |
| 4329 | /** |
| 4330 | * @brief sets WEP default key |
| 4331 | * @details Sets the index of the WEP encryption key in use, |
| 4332 | * in the key table |
| 4333 | * @param[in,out] handle to the wifi driver |
| 4334 | * @param[in] key index ( 0, 1, 2, 3) |
| 4335 | * @return Error code indicating success/failure |
| 4336 | * @note |
| 4337 | * @author zsalah |
| 4338 | * @date 8 March 2012 |
| 4339 | * @version 1.0 |
| 4340 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4341 | s32 host_int_set_WEPDefaultKeyID(tstrWILC_WFIDrv *hWFIDrv, u8 u8Index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4342 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4343 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4344 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4345 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4346 | |
| 4347 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4348 | if (pstrWFIDrv == NULL) { |
| 4349 | s32Error = -EFAULT; |
| 4350 | PRINT_ER("driver is null\n"); |
| 4351 | return s32Error; |
| 4352 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4353 | |
| 4354 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4355 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4356 | |
| 4357 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4358 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4359 | msg.body.key_info.enuKeyType = WEP; |
| 4360 | msg.body.key_info.u8KeyAction = DEFAULTKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4361 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4362 | |
| 4363 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4364 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4365 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Index; |
| 4366 | |
| 4367 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4368 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4369 | if (s32Error) |
| 4370 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4371 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4372 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4373 | return s32Error; |
| 4374 | } |
| 4375 | |
| 4376 | /** |
| 4377 | * @brief sets WEP deafault key |
| 4378 | * @details valid only in BSS STA mode if External Supplicant support is enabled. |
| 4379 | * sets WEP key entry into MAC hardware when it receives the |
| 4380 | * corresponding request from NDIS. |
| 4381 | * @param[in,out] handle to the wifi driver |
| 4382 | * @param[in] message containing WEP Key in the following format |
| 4383 | *|---------------------------------------| |
| 4384 | *|Key ID Value | Key Length | Key | |
| 4385 | *|-------------|------------|------------| |
| 4386 | | 1byte | 1byte | Key Length | |
| 4387 | ||---------------------------------------| |
| 4388 | | |
| 4389 | * @return Error code indicating success/failure |
| 4390 | * @note |
| 4391 | * @author zsalah |
| 4392 | * @date 8 March 2012 |
| 4393 | * @version 1.0 |
| 4394 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4395 | s32 host_int_add_wep_key_bss_sta(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4396 | { |
| 4397 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4398 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4399 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4400 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4401 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4402 | if (pstrWFIDrv == NULL) { |
| 4403 | s32Error = -EFAULT; |
| 4404 | PRINT_ER("driver is null\n"); |
| 4405 | return s32Error; |
| 4406 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4407 | |
| 4408 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4409 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4410 | |
| 4411 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4412 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4413 | msg.body.key_info.enuKeyType = WEP; |
| 4414 | msg.body.key_info.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4415 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4416 | |
| 4417 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4418 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4419 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4420 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4421 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4422 | pu8WepKey, u8WepKeylen); |
| 4423 | |
| 4424 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4425 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4426 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4427 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4428 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4429 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4430 | |
| 4431 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4432 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4433 | if (s32Error) |
| 4434 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4435 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
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 | return s32Error; |
| 4438 | |
| 4439 | } |
| 4440 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4441 | /** |
| 4442 | * |
| 4443 | * @brief host_int_add_wep_key_bss_ap |
| 4444 | * @details valid only in BSS AP mode if External Supplicant support is enabled. |
| 4445 | * sets WEP key entry into MAC hardware when it receives the |
| 4446 | * |
| 4447 | * corresponding request from NDIS. |
| 4448 | * @param[in,out] handle to the wifi driver |
| 4449 | * |
| 4450 | * |
| 4451 | * @return Error code indicating success/failure |
| 4452 | * @note |
| 4453 | * @author mdaftedar |
| 4454 | * @date 28 FEB 2013 |
| 4455 | * @version 1.0 |
| 4456 | */ |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 4457 | s32 host_int_add_wep_key_bss_ap(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8WepKey, u8 u8WepKeylen, u8 u8Keyidx, u8 u8mode, enum AUTHTYPE tenuAuth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4458 | { |
| 4459 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4460 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4461 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4462 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4463 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4464 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4465 | if (pstrWFIDrv == NULL) { |
| 4466 | s32Error = -EFAULT; |
| 4467 | PRINT_ER("driver is null\n"); |
| 4468 | return s32Error; |
| 4469 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4470 | |
| 4471 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4472 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4473 | |
| 4474 | if (INFO) { |
| 4475 | for (i = 0; i < u8WepKeylen; i++) |
| 4476 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 4477 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4478 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4479 | msg.body.key_info.enuKeyType = WEP; |
| 4480 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4481 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4482 | |
| 4483 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4484 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4485 | uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey = kmalloc(u8WepKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4486 | |
| 4487 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4488 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwepAttr.pu8WepKey, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4489 | pu8WepKey, (u8WepKeylen)); |
| 4490 | |
| 4491 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4492 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4493 | uniHostIFkeyAttr.strHostIFwepAttr.u8WepKeylen = (u8WepKeylen); |
| 4494 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4495 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4496 | uniHostIFkeyAttr.strHostIFwepAttr.u8Wepidx = u8Keyidx; |
| 4497 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4498 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4499 | uniHostIFkeyAttr.strHostIFwepAttr.u8mode = u8mode; |
| 4500 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4501 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4502 | uniHostIFkeyAttr.strHostIFwepAttr.tenuAuth_type = tenuAuth_type; |
| 4503 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4504 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4505 | |
| 4506 | if (s32Error) |
| 4507 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4508 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4509 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4510 | return s32Error; |
| 4511 | |
| 4512 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4513 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4514 | /** |
| 4515 | * @brief adds ptk Key |
| 4516 | * @details |
| 4517 | * @param[in,out] handle to the wifi driver |
| 4518 | * @param[in] message containing PTK Key in the following format |
| 4519 | *|-----------------------------------------------------------------------------| |
| 4520 | *|Station address | Key Length | Temporal Key | Rx Michael Key |Tx Michael Key | |
| 4521 | *|----------------|------------|--------------|----------------|---------------| |
| 4522 | | 6 bytes | 1byte | 16 bytes | 8 bytes | 8 bytes | |
| 4523 | ||-----------------------------------------------------------------------------| |
| 4524 | * @return Error code indicating success/failure |
| 4525 | * @note |
| 4526 | * @author zsalah |
| 4527 | * @date 8 March 2012 |
| 4528 | * @version 1.0 |
| 4529 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4530 | s32 host_int_add_ptk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8Ptk, u8 u8PtkKeylen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4531 | const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode, u8 u8Idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4532 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4533 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4534 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4535 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4536 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4537 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4538 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4539 | if (pstrWFIDrv == NULL) { |
| 4540 | s32Error = -EFAULT; |
| 4541 | PRINT_ER("driver is null\n"); |
| 4542 | return s32Error; |
| 4543 | } |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4544 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4545 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4546 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4547 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4548 | |
| 4549 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4550 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4551 | |
| 4552 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4553 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4554 | msg.body.key_info.enuKeyType = WPAPtk; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4555 | if (mode == AP_MODE) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4556 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
| 4557 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4558 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8Idx; |
| 4559 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4560 | if (mode == STATION_MODE) |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4561 | msg.body.key_info.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4562 | |
| 4563 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4564 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4565 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4566 | |
| 4567 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4568 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4569 | pu8Ptk, u8PtkKeylen); |
| 4570 | |
| 4571 | if (pu8RxMic != NULL) { |
| 4572 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4573 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4574 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4575 | if (INFO) { |
| 4576 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 4577 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 4578 | } |
| 4579 | } |
| 4580 | if (pu8TxMic != NULL) { |
| 4581 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4582 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4583 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4584 | if (INFO) { |
| 4585 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 4586 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 4587 | } |
| 4588 | } |
| 4589 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4590 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4591 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4592 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4593 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4594 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4595 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4596 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8macaddr = mac_addr; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4597 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4598 | |
| 4599 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4600 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4601 | |
| 4602 | if (s32Error) |
| 4603 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 4604 | |
| 4605 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4606 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4607 | /* /////// */ |
| 4608 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4609 | return s32Error; |
| 4610 | } |
| 4611 | |
| 4612 | /** |
| 4613 | * @brief adds Rx GTk Key |
| 4614 | * @details |
| 4615 | * @param[in,out] handle to the wifi driver |
| 4616 | * @param[in] pu8RxGtk : contains temporal key | Rx Mic | Tx Mic |
| 4617 | * u8GtkKeylen :The total key length |
| 4618 | * |
| 4619 | * @return Error code indicating success/failure |
| 4620 | * @note |
| 4621 | * @author zsalah |
| 4622 | * @date 8 March 2012 |
| 4623 | * @version 1.0 |
| 4624 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4625 | s32 host_int_add_rx_gtk(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8RxGtk, u8 u8GtkKeylen, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4626 | u8 u8KeyIdx, u32 u32KeyRSClen, const u8 *KeyRSC, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4627 | const u8 *pu8RxMic, const u8 *pu8TxMic, u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4628 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4629 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4630 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4631 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4632 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4633 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4634 | if (pstrWFIDrv == NULL) { |
| 4635 | s32Error = -EFAULT; |
| 4636 | PRINT_ER("driver is null\n"); |
| 4637 | return s32Error; |
| 4638 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4639 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4640 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4641 | |
| 4642 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4643 | if (pu8RxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4644 | u8KeyLen += RX_MIC_KEY_LEN; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 4645 | if (pu8TxMic != NULL) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4646 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4647 | if (KeyRSC != NULL) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4648 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4649 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4650 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4651 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8seq, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4652 | KeyRSC, u32KeyRSClen); |
| 4653 | } |
| 4654 | |
| 4655 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4656 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4657 | msg.body.key_info.enuKeyType = WPARxGtk; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4658 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4659 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4660 | if (mode == AP_MODE) { |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4661 | msg.body.key_info.u8KeyAction = ADDKEY_AP; |
| 4662 | msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.u8Ciphermode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4663 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4664 | if (mode == STATION_MODE) |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4665 | msg.body.key_info.u8KeyAction = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4666 | |
| 4667 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4668 | msg.body.key_info. |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4669 | uniHostIFkeyAttr.strHostIFwpaAttr.pu8key = kmalloc(u8KeyLen, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4670 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4671 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4672 | pu8RxGtk, u8GtkKeylen); |
| 4673 | |
| 4674 | if (pu8RxMic != NULL) { |
| 4675 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4676 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 16, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4677 | pu8RxMic, RX_MIC_KEY_LEN); |
| 4678 | |
| 4679 | } |
| 4680 | if (pu8TxMic != NULL) { |
| 4681 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4682 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFwpaAttr.pu8key + 24, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4683 | pu8TxMic, TX_MIC_KEY_LEN); |
| 4684 | |
| 4685 | } |
| 4686 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4687 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4688 | uniHostIFkeyAttr.strHostIFwpaAttr.u8keyidx = u8KeyIdx; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4689 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4690 | uniHostIFkeyAttr.strHostIFwpaAttr.u8Keylen = u8KeyLen; |
| 4691 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4692 | msg.body.key_info. |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4693 | uniHostIFkeyAttr.strHostIFwpaAttr.u8seqlen = u32KeyRSClen; |
| 4694 | |
| 4695 | |
| 4696 | |
| 4697 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4698 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4699 | if (s32Error) |
| 4700 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
| 4701 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4702 | down(&(pstrWFIDrv->hSemTestKeyBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4703 | /* /////// */ |
| 4704 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4705 | return s32Error; |
| 4706 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4707 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4708 | /** |
| 4709 | * @brief host_int_set_pmkid_info |
| 4710 | * @details caches the pmkid valid only in BSS STA mode if External Supplicant |
| 4711 | * support is enabled. This Function sets the PMKID in firmware |
| 4712 | * when host drivr receives the corresponding request from NDIS. |
| 4713 | * The firmware then includes theset PMKID in the appropriate |
| 4714 | * management frames |
| 4715 | * @param[in,out] handle to the wifi driver |
| 4716 | * @param[in] message containing PMKID Info in the following format |
| 4717 | *|-----------------------------------------------------------------| |
| 4718 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 4719 | *|-----------|------------|----------|-------|----------|----------| |
| 4720 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 4721 | ||-----------------------------------------------------------------| |
| 4722 | * @return Error code indicating success/failure |
| 4723 | * @note |
| 4724 | * @author zsalah |
| 4725 | * @date 8 March 2012 |
| 4726 | * @version 1.0 |
| 4727 | */ |
Leo Kim | a949f90 | 2015-10-05 15:25:44 +0900 | [diff] [blame] | 4728 | s32 host_int_set_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, struct host_if_pmkid_attr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4729 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4730 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4731 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4732 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4733 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4734 | |
| 4735 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4736 | if (pstrWFIDrv == NULL) { |
| 4737 | s32Error = -EFAULT; |
| 4738 | PRINT_ER("driver is null\n"); |
| 4739 | return s32Error; |
| 4740 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4741 | |
| 4742 | /* prepare the Key Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4743 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4744 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4745 | msg.id = HOST_IF_MSG_KEY; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4746 | msg.body.key_info.enuKeyType = PMKSA; |
| 4747 | msg.body.key_info.u8KeyAction = ADDKEY; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4748 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4749 | |
| 4750 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
| 4751 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4752 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].bssid, &pu8PmkidInfoArray->pmkidlist[i].bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4753 | ETH_ALEN); |
| 4754 | |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 4755 | memcpy(msg.body.key_info.uniHostIFkeyAttr.strHostIFpmkidAttr.pmkidlist[i].pmkid, &pu8PmkidInfoArray->pmkidlist[i].pmkid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4756 | PMKID_LEN); |
| 4757 | } |
| 4758 | |
| 4759 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4760 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4761 | if (s32Error) |
| 4762 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 4763 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4764 | return s32Error; |
| 4765 | } |
| 4766 | |
| 4767 | /** |
| 4768 | * @brief gets the cached the pmkid info |
| 4769 | * @details valid only in BSS STA mode if External Supplicant |
| 4770 | * support is enabled. This Function sets the PMKID in firmware |
| 4771 | * when host drivr receives the corresponding request from NDIS. |
| 4772 | * The firmware then includes theset PMKID in the appropriate |
| 4773 | * management frames |
| 4774 | * @param[in,out] handle to the wifi driver, |
| 4775 | * message containing PMKID Info in the following format |
| 4776 | *|-----------------------------------------------------------------| |
| 4777 | *|NumEntries | BSSID[1] | PMKID[1] | ... | BSSID[K] | PMKID[K] | |
| 4778 | *|-----------|------------|----------|-------|----------|----------| |
| 4779 | | 1 | 6 | 16 | ... | 6 | 16 | |
| 4780 | ||-----------------------------------------------------------------| |
| 4781 | * @param[in] |
| 4782 | * @return Error code indicating success/failure |
| 4783 | * @note |
| 4784 | * @author zsalah |
| 4785 | * @date 8 March 2012 |
| 4786 | * @version 1.0 |
| 4787 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4788 | s32 host_int_get_pmkid_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PmkidInfoArray, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4789 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4790 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4791 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4792 | tstrWID strWID; |
| 4793 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4794 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4795 | strWID.u16WIDid = (u16)WID_PMKID_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4796 | strWID.enuWIDtype = WID_STR; |
| 4797 | strWID.s32ValueSize = u32PmkidInfoLen; |
| 4798 | strWID.ps8WidVal = pu8PmkidInfoArray; |
| 4799 | |
| 4800 | return s32Error; |
| 4801 | } |
| 4802 | |
| 4803 | /** |
| 4804 | * @brief sets the pass phrase |
| 4805 | * @details AP/STA mode. This function gives the pass phrase used to |
| 4806 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 4807 | * The length of the field can vary from 8 to 64 bytes, |
| 4808 | * the lower layer should get the |
| 4809 | * @param[in,out] handle to the wifi driver, |
| 4810 | * @param[in] String containing PSK |
| 4811 | * @return Error code indicating success/failure |
| 4812 | * @note |
| 4813 | * @author zsalah |
| 4814 | * @date 8 March 2012 |
| 4815 | * @version 1.0 |
| 4816 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4817 | s32 host_int_set_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8PassPhrase, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4818 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4819 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4820 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4821 | tstrWID strWID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4822 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4823 | /*validating psk length*/ |
| 4824 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4825 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4826 | strWID.enuWIDtype = WID_STR; |
| 4827 | strWID.ps8WidVal = pu8PassPhrase; |
| 4828 | strWID.s32ValueSize = u8Psklength; |
| 4829 | } |
| 4830 | |
| 4831 | return s32Error; |
| 4832 | } |
| 4833 | /** |
| 4834 | * @brief host_int_get_MacAddress |
| 4835 | * @details gets mac address |
| 4836 | * @param[in,out] handle to the wifi driver, |
| 4837 | * |
| 4838 | * @return Error code indicating success/failure |
| 4839 | * @note |
| 4840 | * @author mdaftedar |
| 4841 | * @date 19 April 2012 |
| 4842 | * @version 1.0 |
| 4843 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4844 | s32 host_int_get_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4845 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4846 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4847 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4848 | |
| 4849 | |
| 4850 | /* prepare the Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4851 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4852 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4853 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 4854 | msg.body.get_mac_info.u8MacAddress = pu8MacAddress; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4855 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4856 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4857 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4858 | if (s32Error) { |
| 4859 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4860 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4861 | } |
| 4862 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 4863 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4864 | return s32Error; |
| 4865 | } |
| 4866 | |
| 4867 | /** |
| 4868 | * @brief host_int_set_MacAddress |
| 4869 | * @details sets mac address |
| 4870 | * @param[in,out] handle to the wifi driver, |
| 4871 | * |
| 4872 | * @return Error code indicating success/failure |
| 4873 | * @note |
| 4874 | * @author mabubakr |
| 4875 | * @date 16 July 2012 |
| 4876 | * @version 1.0 |
| 4877 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4878 | s32 host_int_set_MacAddress(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4879 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4880 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4881 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4882 | |
| 4883 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 4884 | |
| 4885 | /* prepare setting mac address message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4886 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4887 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 4888 | memcpy(msg.body.set_mac_info.u8MacAddress, pu8MacAddress, ETH_ALEN); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4889 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4890 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4891 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4892 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4893 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4894 | |
| 4895 | return s32Error; |
| 4896 | |
| 4897 | } |
| 4898 | |
| 4899 | /** |
| 4900 | * @brief host_int_get_RSNAConfigPSKPassPhrase |
| 4901 | * @details gets the pass phrase:AP/STA mode. This function gets the pass phrase used to |
| 4902 | * generate the Pre-Shared Key when WPA/WPA2 is enabled |
| 4903 | * The length of the field can vary from 8 to 64 bytes, |
| 4904 | * the lower layer should get the |
| 4905 | * @param[in,out] handle to the wifi driver, |
| 4906 | * String containing PSK |
| 4907 | * @return Error code indicating success/failure |
| 4908 | * @note |
| 4909 | * @author zsalah |
| 4910 | * @date 8 March 2012 |
| 4911 | * @version 1.0 |
| 4912 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4913 | s32 host_int_get_RSNAConfigPSKPassPhrase(tstrWILC_WFIDrv *hWFIDrv, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4914 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4915 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4916 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4917 | tstrWID strWID; |
| 4918 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4919 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4920 | strWID.u16WIDid = (u16)WID_11I_PSK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4921 | strWID.enuWIDtype = WID_STR; |
| 4922 | strWID.s32ValueSize = u8Psklength; |
| 4923 | strWID.ps8WidVal = pu8PassPhrase; |
| 4924 | |
| 4925 | return s32Error; |
| 4926 | } |
| 4927 | |
| 4928 | /** |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4929 | * @brief sets a start scan request |
| 4930 | * @details |
| 4931 | * @param[in,out] handle to the wifi driver, |
| 4932 | * @param[in] Scan Source one of the following values |
| 4933 | * DEFAULT_SCAN 0 |
| 4934 | * USER_SCAN BIT0 |
| 4935 | * OBSS_PERIODIC_SCAN BIT1 |
| 4936 | * OBSS_ONETIME_SCAN BIT2 |
| 4937 | * @return Error code indicating success/failure |
| 4938 | * @note |
| 4939 | * @author zsalah |
| 4940 | * @date 8 March 2012 |
| 4941 | * @version 1.0 |
| 4942 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4943 | s32 host_int_set_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4944 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4945 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4946 | tstrWID strWID; |
| 4947 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4948 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4949 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4950 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4951 | strWID.ps8WidVal = (s8 *)&scanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4952 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4953 | |
| 4954 | return s32Error; |
| 4955 | } |
| 4956 | |
| 4957 | /** |
| 4958 | * @brief host_int_get_start_scan_req |
| 4959 | * @details gets a start scan request |
| 4960 | * @param[in,out] handle to the wifi driver, |
| 4961 | * @param[in] Scan Source one of the following values |
| 4962 | * DEFAULT_SCAN 0 |
| 4963 | * USER_SCAN BIT0 |
| 4964 | * OBSS_PERIODIC_SCAN BIT1 |
| 4965 | * OBSS_ONETIME_SCAN BIT2 |
| 4966 | * @return Error code indicating success/failure |
| 4967 | * @note |
| 4968 | * @author zsalah |
| 4969 | * @date 8 March 2012 |
| 4970 | * @version 1.0 |
| 4971 | */ |
| 4972 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4973 | s32 host_int_get_start_scan_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4974 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 4975 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4976 | tstrWID strWID; |
| 4977 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 4978 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4979 | strWID.u16WIDid = (u16)WID_START_SCAN_REQ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4980 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 4981 | strWID.ps8WidVal = (s8 *)pu8ScanSource; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 4982 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4983 | |
| 4984 | return s32Error; |
| 4985 | } |
| 4986 | |
| 4987 | /** |
| 4988 | * @brief host_int_set_join_req |
| 4989 | * @details sets a join request |
| 4990 | * @param[in,out] handle to the wifi driver, |
| 4991 | * @param[in] Index of the bss descriptor |
| 4992 | * @return Error code indicating success/failure |
| 4993 | * @note |
| 4994 | * @author zsalah |
| 4995 | * @date 8 March 2012 |
| 4996 | * @version 1.0 |
| 4997 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4998 | s32 host_int_set_join_req(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8bssid, |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 4999 | const u8 *pu8ssid, size_t ssidLen, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5000 | const u8 *pu8IEs, size_t IEsLen, |
Leo Kim | b6ab85f | 2015-10-05 15:25:38 +0900 | [diff] [blame] | 5001 | wilc_connect_result pfConnectResult, void *pvUserArg, |
Leo Kim | 841dfc4 | 2015-10-05 15:25:39 +0900 | [diff] [blame] | 5002 | u8 u8security, enum AUTHTYPE tenuAuth_type, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5003 | u8 u8channel, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5004 | void *pJoinParams) |
| 5005 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5006 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5007 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5008 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5009 | tenuScanConnTimer enuScanConnTimer; |
| 5010 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5011 | if (pstrWFIDrv == NULL || pfConnectResult == NULL) { |
| 5012 | s32Error = -EFAULT; |
| 5013 | PRINT_ER("Driver is null\n"); |
| 5014 | return s32Error; |
| 5015 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5016 | |
| 5017 | if (hWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5018 | PRINT_ER("Driver is null\n"); |
| 5019 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5020 | } |
| 5021 | |
| 5022 | if (pJoinParams == NULL) { |
| 5023 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5024 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5025 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5026 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5027 | /* prepare the Connect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5028 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5029 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5030 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5031 | |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 5032 | msg.body.con_info.u8security = u8security; |
| 5033 | msg.body.con_info.tenuAuth_type = tenuAuth_type; |
| 5034 | msg.body.con_info.u8channel = u8channel; |
| 5035 | msg.body.con_info.pfConnectResult = pfConnectResult; |
| 5036 | msg.body.con_info.pvUserArg = pvUserArg; |
| 5037 | msg.body.con_info.pJoinParams = pJoinParams; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5038 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5039 | |
| 5040 | if (pu8bssid != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 5041 | msg.body.con_info.pu8bssid = kmalloc(6, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5042 | memcpy(msg.body.con_info.pu8bssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5043 | pu8bssid, 6); |
| 5044 | } |
| 5045 | |
| 5046 | if (pu8ssid != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 5047 | msg.body.con_info.ssidLen = ssidLen; |
| 5048 | msg.body.con_info.pu8ssid = kmalloc(ssidLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5049 | memcpy(msg.body.con_info.pu8ssid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5050 | |
| 5051 | pu8ssid, ssidLen); |
| 5052 | } |
| 5053 | |
| 5054 | if (pu8IEs != NULL) { |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 5055 | msg.body.con_info.IEsLen = IEsLen; |
| 5056 | msg.body.con_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5057 | memcpy(msg.body.con_info.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5058 | pu8IEs, IEsLen); |
| 5059 | } |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5060 | if (pstrWFIDrv->enuHostIFstate < HOST_IF_CONNECTING) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5061 | pstrWFIDrv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 5062 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5063 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", pstrWFIDrv->enuHostIFstate); |
| 5064 | |
| 5065 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5066 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5067 | if (s32Error) { |
| 5068 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5069 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5070 | } |
| 5071 | |
| 5072 | enuScanConnTimer = CONNECT_TIMER; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5073 | pstrWFIDrv->hConnectTimer.data = (unsigned long)hWFIDrv; |
| 5074 | mod_timer(&pstrWFIDrv->hConnectTimer, |
| 5075 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5076 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5077 | return s32Error; |
| 5078 | } |
| 5079 | |
| 5080 | /** |
| 5081 | * @brief Flush a join request parameters to FW, but actual connection |
| 5082 | * @details The function is called in situation where WILC is connected to AP and |
| 5083 | * required to switch to hybrid FW for P2P connection |
| 5084 | * @param[in] handle to the wifi driver, |
| 5085 | * @return Error code indicating success/failure |
| 5086 | * @note |
| 5087 | * @author Amr Abdel-Moghny |
| 5088 | * @date 19 DEC 2013 |
| 5089 | * @version 8.0 |
| 5090 | */ |
| 5091 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5092 | s32 host_int_flush_join_req(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5093 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5094 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5095 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5096 | |
| 5097 | if (!gu8FlushedJoinReq) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5098 | s32Error = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5099 | return s32Error; |
| 5100 | } |
| 5101 | |
| 5102 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5103 | if (hWFIDrv == NULL) { |
| 5104 | s32Error = -EFAULT; |
| 5105 | PRINT_ER("Driver is null\n"); |
| 5106 | return s32Error; |
| 5107 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5108 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5109 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5110 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5111 | |
| 5112 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5113 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5114 | if (s32Error) { |
| 5115 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5116 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5117 | } |
| 5118 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5119 | return s32Error; |
| 5120 | } |
| 5121 | |
| 5122 | /** |
| 5123 | * @brief host_int_disconnect |
| 5124 | * @details disconnects from the currently associated network |
| 5125 | * @param[in,out] handle to the wifi driver, |
| 5126 | * @param[in] Reason Code of the Disconnection |
| 5127 | * @return Error code indicating success/failure |
| 5128 | * @note |
| 5129 | * @author zsalah |
| 5130 | * @date 8 March 2012 |
| 5131 | * @version 1.0 |
| 5132 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5133 | s32 host_int_disconnect(tstrWILC_WFIDrv *hWFIDrv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5134 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5135 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5136 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5137 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5138 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5139 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5140 | PRINT_ER("Driver is null\n"); |
| 5141 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5142 | } |
| 5143 | |
| 5144 | /* prepare the Disconnect Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5145 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5146 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5147 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5148 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5149 | |
| 5150 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5151 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5152 | if (s32Error) |
| 5153 | PRINT_ER("Failed to send message queue: disconnect\n"); |
| 5154 | /* ////////////// */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5155 | down(&(pstrWFIDrv->hSemTestDisconnectBlock)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5156 | /* /////// */ |
| 5157 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5158 | return s32Error; |
| 5159 | } |
| 5160 | |
| 5161 | /** |
| 5162 | * @brief host_int_disconnect_station |
| 5163 | * @details disconnects a sta |
| 5164 | * @param[in,out] handle to the wifi driver, |
| 5165 | * @param[in] Association Id of the station to be disconnected |
| 5166 | * @return Error code indicating success/failure |
| 5167 | * @note |
| 5168 | * @author zsalah |
| 5169 | * @date 8 March 2012 |
| 5170 | * @version 1.0 |
| 5171 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5172 | s32 host_int_disconnect_station(tstrWILC_WFIDrv *hWFIDrv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5173 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5174 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5175 | tstrWID strWID; |
| 5176 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5177 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5178 | strWID.u16WIDid = (u16)WID_DISCONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5179 | strWID.enuWIDtype = WID_CHAR; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5180 | strWID.ps8WidVal = (s8 *)&assoc_id; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5181 | strWID.s32ValueSize = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5182 | |
| 5183 | return s32Error; |
| 5184 | } |
| 5185 | |
| 5186 | /** |
| 5187 | * @brief host_int_get_assoc_req_info |
| 5188 | * @details gets a Association request info |
| 5189 | * @param[in,out] handle to the wifi driver, |
| 5190 | * Message containg assoc. req info in the following format |
| 5191 | * ------------------------------------------------------------------------ |
| 5192 | | Management Frame Format | |
| 5193 | ||-------------------------------------------------------------------| |
| 5194 | ||Frame Control|Duration|DA|SA|BSSID|Sequence Control|Frame Body|FCS | |
| 5195 | ||-------------|--------|--|--|-----|----------------|----------|----| |
| 5196 | | 2 |2 |6 |6 |6 | 2 |0 - 2312 | 4 | |
| 5197 | ||-------------------------------------------------------------------| |
| 5198 | | | |
| 5199 | | Association Request Frame - Frame Body | |
| 5200 | ||-------------------------------------------------------------------| |
| 5201 | | Capability Information | Listen Interval | SSID | Supported Rates | |
| 5202 | ||------------------------|-----------------|------|-----------------| |
| 5203 | | 2 | 2 | 2-34 | 3-10 | |
| 5204 | | --------------------------------------------------------------------- |
| 5205 | * @return Error code indicating success/failure |
| 5206 | * @note |
| 5207 | * @author zsalah |
| 5208 | * @date 8 March 2012 |
| 5209 | * @version 1.0 |
| 5210 | */ |
| 5211 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5212 | s32 host_int_get_assoc_req_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocReqInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5213 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5214 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5215 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5216 | tstrWID strWID; |
| 5217 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5218 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5219 | strWID.u16WIDid = (u16)WID_ASSOC_REQ_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5220 | strWID.enuWIDtype = WID_STR; |
| 5221 | strWID.ps8WidVal = pu8AssocReqInfo; |
| 5222 | strWID.s32ValueSize = u32AssocReqInfoLen; |
| 5223 | |
| 5224 | |
| 5225 | return s32Error; |
| 5226 | } |
| 5227 | |
| 5228 | /** |
| 5229 | * @brief gets a Association Response info |
| 5230 | * @details |
| 5231 | * @param[in,out] handle to the wifi driver, |
| 5232 | * Message containg assoc. resp info |
| 5233 | * @return Error code indicating success/failure |
| 5234 | * @note |
| 5235 | * @author zsalah |
| 5236 | * @date 8 March 2012 |
| 5237 | * @version 1.0 |
| 5238 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5239 | s32 host_int_get_assoc_res_info(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8AssocRespInfo, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5240 | u32 u32MaxAssocRespInfoLen, u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5241 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5242 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5243 | tstrWID strWID; |
| 5244 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5245 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5246 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5247 | PRINT_ER("Driver is null\n"); |
| 5248 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5249 | } |
| 5250 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5251 | strWID.u16WIDid = (u16)WID_ASSOC_RES_INFO; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5252 | strWID.enuWIDtype = WID_STR; |
| 5253 | strWID.ps8WidVal = pu8AssocRespInfo; |
| 5254 | strWID.s32ValueSize = u32MaxAssocRespInfoLen; |
| 5255 | |
| 5256 | |
| 5257 | /* Sending Configuration packet */ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 5258 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 5259 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5260 | if (s32Error) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5261 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5262 | PRINT_ER("Failed to send association response config packet\n"); |
| 5263 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5264 | } else { |
| 5265 | *pu32RcvdAssocRespInfoLen = strWID.s32ValueSize; |
| 5266 | } |
| 5267 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5268 | return s32Error; |
| 5269 | } |
| 5270 | |
| 5271 | /** |
| 5272 | * @brief gets a Association Response info |
| 5273 | * @details Valid only in STA mode. This function gives the RSSI |
| 5274 | * values observed in all the channels at the time of scanning. |
| 5275 | * The length of the field is 1 greater that the total number of |
| 5276 | * channels supported. Byte 0 contains the number of channels while |
| 5277 | * each of Byte N contains the observed RSSI value for the channel index N. |
| 5278 | * @param[in,out] handle to the wifi driver, |
| 5279 | * array of scanned channels' RSSI |
| 5280 | * @return Error code indicating success/failure |
| 5281 | * @note |
| 5282 | * @author zsalah |
| 5283 | * @date 8 March 2012 |
| 5284 | * @version 1.0 |
| 5285 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5286 | s32 host_int_get_rx_power_level(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8RxPowerLevel, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5287 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5288 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5289 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5290 | tstrWID strWID; |
| 5291 | /* tstrWILC_WFIDrv * pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; */ |
| 5292 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5293 | strWID.u16WIDid = (u16)WID_RX_POWER_LEVEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5294 | strWID.enuWIDtype = WID_STR; |
| 5295 | strWID.ps8WidVal = pu8RxPowerLevel; |
| 5296 | strWID.s32ValueSize = u32RxPowerLevelLen; |
| 5297 | |
| 5298 | |
| 5299 | return s32Error; |
| 5300 | } |
| 5301 | |
| 5302 | /** |
| 5303 | * @brief sets a channel |
| 5304 | * @details |
| 5305 | * @param[in,out] handle to the wifi driver, |
| 5306 | * @param[in] Index of the channel to be set |
| 5307 | *|-------------------------------------------------------------------| |
| 5308 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5309 | | Input: 1 2 14 | |
| 5310 | ||-------------------------------------------------------------------| |
| 5311 | * @return Error code indicating success/failure |
| 5312 | * @note |
| 5313 | * @author zsalah |
| 5314 | * @date 8 March 2012 |
| 5315 | * @version 1.0 |
| 5316 | */ |
Chaehyun Lim | 5ba48ec | 2015-10-02 21:44:52 +0900 | [diff] [blame] | 5317 | int host_int_set_mac_chnl_num(tstrWILC_WFIDrv *wfi_drv, u8 channel) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5318 | { |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5319 | int result; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5320 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5321 | |
Chaehyun Lim | 157da21 | 2015-10-05 11:07:21 +0900 | [diff] [blame] | 5322 | if (!wfi_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5323 | PRINT_ER("driver is null\n"); |
| 5324 | return -EFAULT; |
| 5325 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5326 | |
| 5327 | /* prepare the set channel message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5328 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5329 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Chaehyun Lim | 1c5833c | 2015-10-02 21:44:51 +0900 | [diff] [blame] | 5330 | msg.body.channel_info.u8SetChan = channel; |
Chaehyun Lim | 5ba48ec | 2015-10-02 21:44:52 +0900 | [diff] [blame] | 5331 | msg.drvHandler = wfi_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5332 | |
Chaehyun Lim | 1ef58e4 | 2015-10-02 21:44:49 +0900 | [diff] [blame] | 5333 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5334 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5335 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5336 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5337 | } |
| 5338 | |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 5339 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5340 | } |
| 5341 | |
| 5342 | |
Chaehyun Lim | 244efb1 | 2015-10-02 21:44:53 +0900 | [diff] [blame] | 5343 | int host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5344 | { |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5345 | int result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5346 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5347 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5348 | |
| 5349 | /* prepare the set driver handler message */ |
| 5350 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5351 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5352 | msg.id = HOST_IF_MSG_Q_IDLE; |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5353 | result = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
| 5354 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5355 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5356 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5357 | } |
| 5358 | |
| 5359 | /* wait untill MSG Q is empty */ |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5360 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5361 | |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 5362 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5363 | } |
| 5364 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5365 | s32 host_int_set_wfi_drv_handler(tstrWILC_WFIDrv *u32address) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5366 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5367 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5368 | |
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 set driver handler message */ |
| 5373 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5374 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5375 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 5376 | msg.body.drv.u32Address = get_id_from_handler(u32address); |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5377 | msg.drvHandler = u32address; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5378 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5379 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5380 | if (s32Error) { |
| 5381 | PRINT_ER("wilc mq send fail\n"); |
| 5382 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5383 | } |
| 5384 | |
| 5385 | return s32Error; |
| 5386 | } |
| 5387 | |
| 5388 | |
| 5389 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5390 | s32 host_int_set_operation_mode(tstrWILC_WFIDrv *hWFIDrv, u32 u32mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5391 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5392 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5393 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5394 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5395 | |
| 5396 | |
| 5397 | /* prepare the set driver handler message */ |
| 5398 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5399 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5400 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 5401 | msg.body.mode.u32Mode = u32mode; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5402 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5403 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5404 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5405 | if (s32Error) { |
| 5406 | PRINT_ER("wilc mq send fail\n"); |
| 5407 | s32Error = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5408 | } |
| 5409 | |
| 5410 | return s32Error; |
| 5411 | } |
| 5412 | |
| 5413 | /** |
| 5414 | * @brief gets the current channel index |
| 5415 | * @details |
| 5416 | * @param[in,out] handle to the wifi driver, |
| 5417 | * current channel index |
| 5418 | *|-----------------------------------------------------------------------| |
| 5419 | | CHANNEL1 CHANNEL2 .... CHANNEL14 | |
| 5420 | | Input: 1 2 14 | |
| 5421 | ||-----------------------------------------------------------------------| |
| 5422 | * @return Error code indicating success/failure |
| 5423 | * @note |
| 5424 | * @author zsalah |
| 5425 | * @date 8 March 2012 |
| 5426 | * @version 1.0 |
| 5427 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5428 | s32 host_int_get_host_chnl_num(tstrWILC_WFIDrv *hWFIDrv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5429 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5430 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5431 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5432 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5433 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5434 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5435 | PRINT_ER("driver is null\n"); |
| 5436 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5437 | } |
| 5438 | |
| 5439 | /* prepare the Get Channel Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5440 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5441 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5442 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5443 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5444 | |
| 5445 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5446 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5447 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5448 | PRINT_ER("wilc mq send fail\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5449 | down(&(pstrWFIDrv->hSemGetCHNL)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5450 | /* gu8Chnl = 11; */ |
| 5451 | |
| 5452 | *pu8ChNo = gu8Chnl; |
| 5453 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5454 | return s32Error; |
| 5455 | |
| 5456 | |
| 5457 | } |
| 5458 | |
| 5459 | |
| 5460 | /** |
| 5461 | * @brief host_int_test_set_int_wid |
| 5462 | * @details Test function for setting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5463 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32 u32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5464 | * @return Error code indicating success/failure |
| 5465 | * @note |
| 5466 | * @author zsalah |
| 5467 | * @date 8 March 2012 |
| 5468 | * @version 1.0 |
| 5469 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5470 | s32 host_int_test_set_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 u32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5471 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5472 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5473 | tstrWID strWID; |
| 5474 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5475 | |
| 5476 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5477 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5478 | PRINT_ER("driver is null\n"); |
| 5479 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5480 | } |
| 5481 | |
| 5482 | /*prepare configuration packet*/ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5483 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5484 | strWID.enuWIDtype = WID_INT; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 5485 | strWID.ps8WidVal = (char *)&u32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5486 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5487 | |
| 5488 | /*Sending Cfg*/ |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 5489 | s32Error = send_config_pkt(SET_CFG, &strWID, 1, true, |
| 5490 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5491 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5492 | PRINT_ER("Failed to set wid value\n"); |
| 5493 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5494 | } else { |
| 5495 | PRINT_D(HOSTINF_DBG, "Successfully set wid value\n"); |
| 5496 | |
| 5497 | } |
| 5498 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5499 | return s32Error; |
| 5500 | } |
| 5501 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5502 | /** |
| 5503 | * @brief host_int_get_inactive_time |
| 5504 | * @details |
| 5505 | * @param[in,out] handle to the wifi driver, |
| 5506 | * current sta macaddress, inactive_time |
| 5507 | * @return |
| 5508 | * @note |
| 5509 | * @author |
| 5510 | * @date |
| 5511 | * @version 1.0 |
| 5512 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5513 | s32 host_int_get_inactive_time(tstrWILC_WFIDrv *hWFIDrv, const u8 *mac, u32 *pu32InactiveTime) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5514 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5515 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5516 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5517 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5518 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5519 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5520 | PRINT_ER("driver is null\n"); |
| 5521 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5522 | } |
| 5523 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5524 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5525 | |
| 5526 | |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 5527 | memcpy(msg.body.mac_info.mac, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5528 | mac, ETH_ALEN); |
| 5529 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5530 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5531 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5532 | |
| 5533 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5534 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5535 | if (s32Error) |
| 5536 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5537 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5538 | down(&(pstrWFIDrv->hSemInactiveTime)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5539 | |
| 5540 | *pu32InactiveTime = gu32InactiveTime; |
| 5541 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5542 | return s32Error; |
| 5543 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 5544 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5545 | /** |
| 5546 | * @brief host_int_test_get_int_wid |
| 5547 | * @details Test function for getting wids |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5548 | * @param[in,out] WILC_WFIDrvHandle hWFIDrv, u32* pu32TestMemAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5549 | * @return Error code indicating success/failure |
| 5550 | * @note |
| 5551 | * @author zsalah |
| 5552 | * @date 8 March 2012 |
| 5553 | * @version 1.0 |
| 5554 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5555 | s32 host_int_test_get_int_wid(tstrWILC_WFIDrv *hWFIDrv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5556 | { |
| 5557 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5558 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5559 | tstrWID strWID; |
| 5560 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5561 | |
| 5562 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5563 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5564 | PRINT_ER("driver is null\n"); |
| 5565 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5566 | } |
| 5567 | |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5568 | strWID.u16WIDid = (u16)WID_MEMORY_ADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5569 | strWID.enuWIDtype = WID_INT; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5570 | strWID.ps8WidVal = (s8 *)pu32TestMemAddr; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 5571 | strWID.s32ValueSize = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5572 | |
Chaehyun Lim | cf32c3c | 2015-09-22 22:47:38 +0900 | [diff] [blame] | 5573 | s32Error = send_config_pkt(GET_CFG, &strWID, 1, true, |
| 5574 | get_id_from_handler(pstrWFIDrv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5575 | /*get the value by searching the local copy*/ |
| 5576 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5577 | PRINT_ER("Failed to get wid value\n"); |
| 5578 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5579 | } else { |
| 5580 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
| 5581 | |
| 5582 | } |
| 5583 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5584 | return s32Error; |
| 5585 | } |
| 5586 | |
| 5587 | |
| 5588 | /** |
| 5589 | * @brief host_int_get_rssi |
| 5590 | * @details gets the currently maintained RSSI value for the station. |
| 5591 | * The received signal strength value in dB. |
| 5592 | * The range of valid values is -128 to 0. |
| 5593 | * @param[in,out] handle to the wifi driver, |
| 5594 | * rssi value in dB |
| 5595 | * @return Error code indicating success/failure |
| 5596 | * @note |
| 5597 | * @author zsalah |
| 5598 | * @date 8 March 2012 |
| 5599 | * @version 1.0 |
| 5600 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5601 | s32 host_int_get_rssi(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5602 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5603 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5604 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5605 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5606 | |
| 5607 | |
| 5608 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5609 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5610 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5611 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5612 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5613 | |
| 5614 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5615 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5616 | if (s32Error) { |
| 5617 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5618 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5619 | } |
| 5620 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5621 | down(&(pstrWFIDrv->hSemGetRSSI)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5622 | |
| 5623 | |
| 5624 | if (ps8Rssi == NULL) { |
| 5625 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5626 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5627 | } |
| 5628 | |
| 5629 | |
| 5630 | *ps8Rssi = gs8Rssi; |
| 5631 | |
| 5632 | |
| 5633 | return s32Error; |
| 5634 | } |
| 5635 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5636 | s32 host_int_get_link_speed(tstrWILC_WFIDrv *hWFIDrv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5637 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5638 | struct host_if_msg msg; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5639 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5640 | |
| 5641 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5642 | |
| 5643 | |
| 5644 | |
| 5645 | /* prepare the Get LINKSPEED Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5646 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5647 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5648 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5649 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5650 | |
| 5651 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5652 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5653 | if (s32Error) { |
| 5654 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5655 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5656 | } |
| 5657 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5658 | down(&(pstrWFIDrv->hSemGetLINKSPEED)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5659 | |
| 5660 | |
| 5661 | if (ps8lnkspd == NULL) { |
| 5662 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5663 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5664 | } |
| 5665 | |
| 5666 | |
| 5667 | *ps8lnkspd = gs8lnkspd; |
| 5668 | |
| 5669 | |
| 5670 | return s32Error; |
| 5671 | } |
| 5672 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5673 | s32 host_int_get_statistics(tstrWILC_WFIDrv *hWFIDrv, tstrStatistics *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5674 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5675 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5676 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5677 | |
| 5678 | |
| 5679 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5680 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5681 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5682 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 5683 | msg.body.data = (char *)pstrStatistics; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5684 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5685 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5686 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5687 | if (s32Error) { |
| 5688 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5689 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5690 | } |
| 5691 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5692 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5693 | return s32Error; |
| 5694 | } |
| 5695 | |
| 5696 | |
| 5697 | /** |
| 5698 | * @brief host_int_scan |
| 5699 | * @details scans a set of channels |
| 5700 | * @param[in,out] handle to the wifi driver, |
| 5701 | * @param[in] Scan source |
| 5702 | * Scan Type PASSIVE_SCAN = 0, |
| 5703 | * ACTIVE_SCAN = 1 |
| 5704 | * Channels Array |
| 5705 | * Channels Array length |
| 5706 | * Scan Callback function |
| 5707 | * @return Error code indicating success/failure |
| 5708 | * @note |
| 5709 | * @author zsalah |
| 5710 | * @date 8 March 2012 |
| 5711 | * @version 1.0 |
| 5712 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5713 | s32 host_int_scan(tstrWILC_WFIDrv *hWFIDrv, u8 u8ScanSource, |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 5714 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 5715 | u8 u8ChnlListLen, const u8 *pu8IEs, |
Leo Kim | ba1d1a6 | 2015-10-05 15:25:36 +0900 | [diff] [blame] | 5716 | size_t IEsLen, wilc_scan_result ScanResult, |
Leo Kim | 607db44 | 2015-10-05 15:25:37 +0900 | [diff] [blame] | 5717 | void *pvUserArg, |
| 5718 | struct hidden_network *pstrHiddenNetwork) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5719 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5720 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5721 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5722 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5723 | tenuScanConnTimer enuScanConnTimer; |
| 5724 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5725 | if (pstrWFIDrv == NULL || ScanResult == NULL) { |
| 5726 | PRINT_ER("pstrWFIDrv or ScanResult = NULL\n"); |
| 5727 | return -EFAULT; |
| 5728 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5729 | |
| 5730 | /* prepare the Scan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5731 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5732 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5733 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5734 | |
| 5735 | if (pstrHiddenNetwork != NULL) { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5736 | msg.body.scan_info.strHiddenNetwork.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 5737 | msg.body.scan_info.strHiddenNetwork.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5738 | |
| 5739 | } else |
| 5740 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 5741 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5742 | msg.drvHandler = hWFIDrv; |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5743 | msg.body.scan_info.u8ScanSource = u8ScanSource; |
| 5744 | msg.body.scan_info.u8ScanType = u8ScanType; |
| 5745 | msg.body.scan_info.pfScanResult = ScanResult; |
| 5746 | msg.body.scan_info.pvUserArg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5747 | |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5748 | msg.body.scan_info.u8ChnlListLen = u8ChnlListLen; |
| 5749 | msg.body.scan_info.pu8ChnlFreqList = kmalloc(u8ChnlListLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5750 | memcpy(msg.body.scan_info.pu8ChnlFreqList, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5751 | pu8ChnlFreqList, u8ChnlListLen); |
| 5752 | |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 5753 | msg.body.scan_info.IEsLen = IEsLen; |
| 5754 | msg.body.scan_info.pu8IEs = kmalloc(IEsLen, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 5755 | memcpy(msg.body.scan_info.pu8IEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5756 | pu8IEs, IEsLen); |
| 5757 | |
| 5758 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5759 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5760 | if (s32Error) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5761 | PRINT_ER("Error in sending message queue\n"); |
| 5762 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5763 | } |
| 5764 | |
| 5765 | enuScanConnTimer = SCAN_TIMER; |
| 5766 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5767 | pstrWFIDrv->hScanTimer.data = (unsigned long)hWFIDrv; |
| 5768 | mod_timer(&pstrWFIDrv->hScanTimer, |
| 5769 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5770 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5771 | return s32Error; |
| 5772 | |
| 5773 | } |
| 5774 | /** |
| 5775 | * @brief hif_set_cfg |
| 5776 | * @details sets configuration wids values |
| 5777 | * @param[in,out] handle to the wifi driver, |
| 5778 | * @param[in] WID, WID value |
| 5779 | * @return Error code indicating success/failure |
| 5780 | * @note |
| 5781 | * @author zsalah |
| 5782 | * @date 8 March 2012 |
| 5783 | * @version 1.0 |
| 5784 | */ |
Leo Kim | 9529650 | 2015-10-05 15:25:46 +0900 | [diff] [blame] | 5785 | s32 hif_set_cfg(tstrWILC_WFIDrv *hWFIDrv, struct cfg_param_val *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5786 | { |
| 5787 | |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5788 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5789 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5790 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5791 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5792 | |
| 5793 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5794 | if (pstrWFIDrv == NULL) { |
| 5795 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 5796 | return -EFAULT; |
| 5797 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5798 | /* prepare the WiphyParams Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5799 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5800 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 5801 | msg.body.cfg_info.pstrCfgParamVal = *pstrCfgParamVal; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5802 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5803 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5804 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5805 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5806 | return s32Error; |
| 5807 | |
| 5808 | } |
| 5809 | |
| 5810 | |
| 5811 | /** |
| 5812 | * @brief hif_get_cfg |
| 5813 | * @details gets configuration wids values |
| 5814 | * @param[in,out] handle to the wifi driver, |
| 5815 | * WID value |
| 5816 | * @param[in] WID, |
| 5817 | * @return Error code indicating success/failure |
| 5818 | * @note |
| 5819 | * @author zsalah |
| 5820 | * |
| 5821 | * @date 8 March 2012 |
| 5822 | * @version 1.0 |
| 5823 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 5824 | s32 hif_get_cfg(tstrWILC_WFIDrv *hWFIDrv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5825 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5826 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5827 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
| 5828 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5829 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5830 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 5831 | if (pstrWFIDrv == NULL) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5832 | PRINT_ER("pstrWFIDrv NULL\n"); |
| 5833 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5834 | } |
| 5835 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 5836 | switch (u16WID) { |
| 5837 | |
| 5838 | case WID_BSS_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5839 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5840 | break; |
| 5841 | |
| 5842 | case WID_AUTH_TYPE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5843 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5844 | break; |
| 5845 | |
| 5846 | case WID_AUTH_TIMEOUT: |
| 5847 | *pu16WID_Value = pstrWFIDrv->strCfgValues.auth_timeout; |
| 5848 | break; |
| 5849 | |
| 5850 | case WID_POWER_MANAGEMENT: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5851 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5852 | break; |
| 5853 | |
| 5854 | case WID_SHORT_RETRY_LIMIT: |
| 5855 | *pu16WID_Value = pstrWFIDrv->strCfgValues.short_retry_limit; |
| 5856 | break; |
| 5857 | |
| 5858 | case WID_LONG_RETRY_LIMIT: |
| 5859 | *pu16WID_Value = pstrWFIDrv->strCfgValues.long_retry_limit; |
| 5860 | break; |
| 5861 | |
| 5862 | case WID_FRAG_THRESHOLD: |
| 5863 | *pu16WID_Value = pstrWFIDrv->strCfgValues.frag_threshold; |
| 5864 | break; |
| 5865 | |
| 5866 | case WID_RTS_THRESHOLD: |
| 5867 | *pu16WID_Value = pstrWFIDrv->strCfgValues.rts_threshold; |
| 5868 | break; |
| 5869 | |
| 5870 | case WID_PREAMBLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5871 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5872 | break; |
| 5873 | |
| 5874 | case WID_SHORT_SLOT_ALLOWED: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5875 | *pu16WID_Value = (u16) pstrWFIDrv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5876 | break; |
| 5877 | |
| 5878 | case WID_11N_TXOP_PROT_DISABLE: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5879 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5880 | break; |
| 5881 | |
| 5882 | case WID_BEACON_INTERVAL: |
| 5883 | *pu16WID_Value = pstrWFIDrv->strCfgValues.beacon_interval; |
| 5884 | break; |
| 5885 | |
| 5886 | case WID_DTIM_PERIOD: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5887 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5888 | break; |
| 5889 | |
| 5890 | case WID_SITE_SURVEY: |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 5891 | *pu16WID_Value = (u16)pstrWFIDrv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5892 | break; |
| 5893 | |
| 5894 | case WID_SITE_SURVEY_SCAN_TIME: |
| 5895 | *pu16WID_Value = pstrWFIDrv->strCfgValues.site_survey_scan_time; |
| 5896 | break; |
| 5897 | |
| 5898 | case WID_ACTIVE_SCAN_TIME: |
| 5899 | *pu16WID_Value = pstrWFIDrv->strCfgValues.active_scan_time; |
| 5900 | break; |
| 5901 | |
| 5902 | case WID_PASSIVE_SCAN_TIME: |
| 5903 | *pu16WID_Value = pstrWFIDrv->strCfgValues.passive_scan_time; |
| 5904 | break; |
| 5905 | |
| 5906 | case WID_CURRENT_TX_RATE: |
| 5907 | *pu16WID_Value = pstrWFIDrv->strCfgValues.curr_tx_rate; |
| 5908 | break; |
| 5909 | |
| 5910 | default: |
| 5911 | break; |
| 5912 | } |
| 5913 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 5914 | up(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5915 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5916 | return s32Error; |
| 5917 | |
| 5918 | } |
| 5919 | |
| 5920 | /*****************************************************************************/ |
| 5921 | /* Notification Functions */ |
| 5922 | /*****************************************************************************/ |
| 5923 | /** |
| 5924 | * @brief notifies host with join and leave requests |
| 5925 | * @details This function prepares an Information frame having the |
| 5926 | * information about a joining/leaving station. |
| 5927 | * @param[in,out] handle to the wifi driver, |
| 5928 | * @param[in] 6 byte Sta Adress |
| 5929 | * Join or leave flag: |
| 5930 | * Join = 1, |
| 5931 | * Leave =0 |
| 5932 | * @return Error code indicating success/failure |
| 5933 | * @note |
| 5934 | * @author zsalah |
| 5935 | * @date 8 March 2012 |
| 5936 | * @version 1.0 |
| 5937 | */ |
| 5938 | void host_int_send_join_leave_info_to_host |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 5939 | (u16 assocId, u8 *stationAddr, bool joining) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5940 | { |
| 5941 | } |
| 5942 | /** |
| 5943 | * @brief notifies host with stations found in scan |
| 5944 | * @details sends the beacon/probe response from scan |
| 5945 | * @param[in,out] handle to the wifi driver, |
| 5946 | * @param[in] Sta Address, |
| 5947 | * Frame length, |
| 5948 | * Rssi of the Station found |
| 5949 | * @return Error code indicating success/failure |
| 5950 | * @note |
| 5951 | * @author zsalah |
| 5952 | * @date 8 March 2012 |
| 5953 | * @version 1.0 |
| 5954 | */ |
| 5955 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5956 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5957 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 5958 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 5959 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5960 | if (pstrWFIDrv == NULL) { |
| 5961 | PRINT_ER("Driver handler is NULL\n"); |
| 5962 | return; |
| 5963 | } |
| 5964 | |
| 5965 | if (pstrWFIDrv->enuHostIFstate == HOST_IF_CONNECTED) { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 5966 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5967 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5968 | |
| 5969 | /* prepare the Get RSSI Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5970 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5971 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5972 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5973 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5974 | |
| 5975 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5976 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5977 | if (s32Error) { |
| 5978 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 5979 | return; |
| 5980 | } |
| 5981 | } |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 5982 | g_hPeriodicRSSI.data = (unsigned long)pstrWFIDrv; |
| 5983 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5984 | } |
| 5985 | |
| 5986 | |
| 5987 | void host_int_send_network_info_to_host |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 5988 | (u8 *macStartAddress, u16 u16RxFrameLen, s8 s8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5989 | { |
| 5990 | } |
| 5991 | /** |
| 5992 | * @brief host_int_init |
| 5993 | * @details host interface initialization function |
| 5994 | * @param[in,out] handle to the wifi driver, |
| 5995 | * @note |
| 5996 | * @author zsalah |
| 5997 | * @date 8 March 2012 |
| 5998 | * @version 1.0 |
| 5999 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6000 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6001 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6002 | s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6003 | { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6004 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6005 | tstrWILC_WFIDrv *pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6006 | int err; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6007 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6008 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 6009 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6010 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6011 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6012 | sema_init(&hWaitResponse, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6013 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6014 | /*Allocate host interface private structure*/ |
Chaehyun Lim | 27a82eb | 2015-09-22 18:34:55 +0900 | [diff] [blame] | 6015 | pstrWFIDrv = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL); |
Chaehyun Lim | 1604296 | 2015-09-22 18:34:56 +0900 | [diff] [blame] | 6016 | if (!pstrWFIDrv) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6017 | result = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6018 | goto _fail_timer_2; |
| 6019 | } |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6020 | *phWFIDrv = pstrWFIDrv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6021 | err = add_handler_in_list(pstrWFIDrv); |
| 6022 | if (err) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6023 | result = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6024 | goto _fail_timer_2; |
| 6025 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6026 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6027 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6028 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6029 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6030 | if (clients_count == 0) { |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6031 | sema_init(&hSemHostIFthrdEnd, 0); |
| 6032 | sema_init(&hSemDeinitDrvHandle, 0); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6033 | sema_init(&hSemHostIntDeinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6034 | } |
| 6035 | |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 6036 | sema_init(&pstrWFIDrv->hSemTestKeyBlock, 0); |
| 6037 | sema_init(&pstrWFIDrv->hSemTestDisconnectBlock, 0); |
| 6038 | sema_init(&pstrWFIDrv->hSemGetRSSI, 0); |
| 6039 | sema_init(&pstrWFIDrv->hSemGetLINKSPEED, 0); |
| 6040 | sema_init(&pstrWFIDrv->hSemGetCHNL, 0); |
| 6041 | sema_init(&pstrWFIDrv->hSemInactiveTime, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6042 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6043 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 6044 | |
| 6045 | if (clients_count == 0) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6046 | result = wilc_mq_create(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6047 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6048 | if (result < 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6049 | PRINT_ER("Failed to creat MQ\n"); |
| 6050 | goto _fail_; |
| 6051 | } |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6052 | HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); |
| 6053 | if (IS_ERR(HostIFthreadHandler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6054 | PRINT_ER("Failed to creat Thread\n"); |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6055 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6056 | goto _fail_mq_; |
| 6057 | } |
Greg Kroah-Hartman | 507d7fc | 2015-08-17 12:59:42 -0700 | [diff] [blame] | 6058 | setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI, |
| 6059 | (unsigned long)pstrWFIDrv); |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 6060 | mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6061 | } |
| 6062 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6063 | setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6064 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6065 | setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6066 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6067 | /*Remain on channel timer*/ |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 6068 | setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6069 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6070 | sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1); |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 6071 | down(&pstrWFIDrv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6072 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6073 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6074 | |
| 6075 | /*Initialize CFG WIDS Defualt Values*/ |
| 6076 | |
| 6077 | pstrWFIDrv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 6078 | pstrWFIDrv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 6079 | pstrWFIDrv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 6080 | pstrWFIDrv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 6081 | pstrWFIDrv->strCfgValues.curr_tx_rate = AUTORATE; |
| 6082 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6083 | pstrWFIDrv->u64P2p_MgmtTimeout = 0; |
| 6084 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6085 | 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", |
| 6086 | |
| 6087 | pstrWFIDrv->strCfgValues.site_survey_enabled, pstrWFIDrv->strCfgValues.scan_source, |
| 6088 | pstrWFIDrv->strCfgValues.active_scan_time, pstrWFIDrv->strCfgValues.passive_scan_time, |
| 6089 | pstrWFIDrv->strCfgValues.curr_tx_rate); |
| 6090 | |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 6091 | up(&pstrWFIDrv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6092 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6093 | clients_count++; /* increase number of created entities */ |
| 6094 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6095 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6096 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6097 | _fail_timer_2: |
Chaehyun Lim | dddaba1 | 2015-09-22 18:35:01 +0900 | [diff] [blame] | 6098 | up(&pstrWFIDrv->gtOsCfgValuesSem); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6099 | del_timer_sync(&pstrWFIDrv->hConnectTimer); |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6100 | del_timer_sync(&pstrWFIDrv->hScanTimer); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 6101 | kthread_stop(HostIFthreadHandler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6102 | _fail_mq_: |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6103 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6104 | _fail_: |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 6105 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6106 | } |
| 6107 | /** |
| 6108 | * @brief host_int_deinit |
| 6109 | * @details host interface initialization function |
| 6110 | * @param[in,out] handle to the wifi driver, |
| 6111 | * @note |
| 6112 | * @author zsalah |
| 6113 | * @date 8 March 2012 |
| 6114 | * @version 1.0 |
| 6115 | */ |
| 6116 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6117 | s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6118 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6119 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6120 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6121 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6122 | |
| 6123 | /*obtain driver handle*/ |
| 6124 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6125 | |
| 6126 | if (pstrWFIDrv == NULL) { |
| 6127 | PRINT_ER("pstrWFIDrv = NULL\n"); |
| 6128 | return 0; |
| 6129 | } |
| 6130 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6131 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6132 | |
| 6133 | terminated_handle = pstrWFIDrv; |
| 6134 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 6135 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6136 | /*Destroy all timers before acquiring hSemDeinitDrvHandle*/ |
| 6137 | /*to guarantee handling all messages befor proceeding*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6138 | if (del_timer_sync(&pstrWFIDrv->hScanTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6139 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6140 | /* msleep(HOST_IF_SCAN_TIMEOUT+1000); */ |
| 6141 | } |
| 6142 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6143 | if (del_timer_sync(&pstrWFIDrv->hConnectTimer)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6144 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6145 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6146 | } |
| 6147 | |
| 6148 | |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6149 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6150 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6151 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6152 | } |
| 6153 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6154 | /*Destroy Remain-onchannel Timer*/ |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6155 | del_timer_sync(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6156 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6157 | host_int_set_wfi_drv_handler(NULL); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6158 | down(&hSemDeinitDrvHandle); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6159 | |
| 6160 | |
| 6161 | /*Calling the CFG80211 scan done function with the abort flag set to true*/ |
| 6162 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6163 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6164 | pstrWFIDrv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
| 6165 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6166 | pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6167 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6168 | |
| 6169 | pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE; |
| 6170 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 6171 | gbScanWhileConnected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6172 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6173 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6174 | |
| 6175 | if (clients_count == 1) { |
Greg Kroah-Hartman | 4183e97 | 2015-08-14 20:11:16 -0700 | [diff] [blame] | 6176 | if (del_timer_sync(&g_hPeriodicRSSI)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6177 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6178 | /* msleep(HOST_IF_CONNECT_TIMEOUT+1000); */ |
| 6179 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6180 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6181 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6182 | |
| 6183 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6184 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6185 | if (s32Error != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6186 | 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] | 6187 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6188 | down(&hSemHostIFthrdEnd); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6189 | |
Chaehyun Lim | 1b128f6 | 2015-08-19 15:59:08 +0900 | [diff] [blame] | 6190 | wilc_mq_destroy(&gMsgQHostIF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6191 | } |
| 6192 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6193 | down(&(pstrWFIDrv->gtOsCfgValuesSem)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6194 | |
| 6195 | /*Setting the gloabl driver handler with NULL*/ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6196 | /* gWFiDrvHandle = NULL; */ |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6197 | ret = remove_handler_in_list(pstrWFIDrv); |
| 6198 | if (ret) |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6199 | s32Error = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6200 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6201 | if (pstrWFIDrv != NULL) { |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6202 | kfree(pstrWFIDrv); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6203 | /* pstrWFIDrv=NULL; */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6204 | |
| 6205 | } |
| 6206 | |
| 6207 | clients_count--; /* Decrease number of created entities */ |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6208 | terminated_handle = NULL; |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6209 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6210 | return s32Error; |
| 6211 | } |
| 6212 | |
| 6213 | |
| 6214 | /** |
| 6215 | * @brief NetworkInfoReceived |
| 6216 | * @details function to to be called when network info packet is received |
| 6217 | * @param[in] pu8Buffer the received packet |
| 6218 | * @param[in] u32Length length of the received packet |
| 6219 | * @return none |
| 6220 | * @note |
| 6221 | * @author |
| 6222 | * @date 1 Mar 2012 |
| 6223 | * @version 1.0 |
| 6224 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6225 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6226 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6227 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6228 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6229 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6230 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6231 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6232 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6233 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6234 | |
| 6235 | |
| 6236 | |
| 6237 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6238 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6239 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6240 | return; |
| 6241 | } |
| 6242 | |
| 6243 | /* prepare the Asynchronous Network Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6244 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6245 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6246 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6247 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6248 | |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 6249 | msg.body.net_info.u32Length = u32Length; |
| 6250 | msg.body.net_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6251 | memcpy(msg.body.net_info.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6252 | pu8Buffer, u32Length); |
| 6253 | |
| 6254 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6255 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6256 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6257 | 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] | 6258 | } |
| 6259 | |
| 6260 | /** |
| 6261 | * @brief GnrlAsyncInfoReceived |
| 6262 | * @details function to be called when general Asynchronous info packet is received |
| 6263 | * @param[in] pu8Buffer the received packet |
| 6264 | * @param[in] u32Length length of the received packet |
| 6265 | * @return none |
| 6266 | * @note |
| 6267 | * @author |
| 6268 | * @date 15 Mar 2012 |
| 6269 | * @version 1.0 |
| 6270 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6271 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6272 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6273 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6274 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6275 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6276 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6277 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6278 | down(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6279 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6280 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6281 | pstrWFIDrv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6282 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6283 | |
| 6284 | |
| 6285 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) { |
| 6286 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6287 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6288 | return; |
| 6289 | } |
| 6290 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6291 | if (pstrWFIDrv->strWILC_UsrConnReq.pfUserConnectResult == NULL) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6292 | /* received mac status is not needed when there is no current Connect Request */ |
| 6293 | 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] | 6294 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6295 | return; |
| 6296 | } |
| 6297 | |
| 6298 | /* prepare the General Asynchronous Info message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6299 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6300 | |
| 6301 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6302 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6303 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6304 | |
| 6305 | |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 6306 | msg.body.async_info.u32Length = u32Length; |
| 6307 | msg.body.async_info.pu8Buffer = kmalloc(u32Length, GFP_KERNEL); /* will be deallocated by the receiving thread */ |
| 6308 | memcpy(msg.body.async_info.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6309 | pu8Buffer, u32Length); |
| 6310 | |
| 6311 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6312 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6313 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6314 | 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] | 6315 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6316 | up(&hSemHostIntDeinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6317 | } |
| 6318 | |
| 6319 | /** |
| 6320 | * @brief host_int_ScanCompleteReceived |
| 6321 | * @details Setting scan complete received notifcation in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6322 | * @param[in] u8* pu8Buffer, u32 u32Length |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6323 | * @return Error code. |
| 6324 | * @author |
| 6325 | * @date |
| 6326 | * @version 1.0 |
| 6327 | */ |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6328 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6329 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6330 | s32 s32Error = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6331 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6332 | int id; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6333 | tstrWILC_WFIDrv *pstrWFIDrv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6334 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 6335 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
| 6336 | pstrWFIDrv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6337 | |
| 6338 | |
Johnny Kim | 8a14330 | 2015-06-10 17:06:46 +0900 | [diff] [blame] | 6339 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", pstrWFIDrv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6340 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6341 | if (pstrWFIDrv == NULL || pstrWFIDrv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6342 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6343 | |
| 6344 | /*if there is an ongoing scan request*/ |
| 6345 | if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) { |
| 6346 | /* prepare theScan Done message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6347 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6348 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6349 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6350 | msg.drvHandler = pstrWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6351 | |
| 6352 | |
| 6353 | /* will be deallocated by the receiving thread */ |
| 6354 | /*no need to send message body*/ |
| 6355 | |
Tony Cho | 410c248 | 2015-09-21 12:16:35 +0900 | [diff] [blame] | 6356 | /*msg.body.strScanComplete.u32Length = u32Length; |
| 6357 | * msg.body.strScanComplete.pu8Buffer = (u8*)WILC_MALLOC(u32Length); |
| 6358 | * memcpy(msg.body.strScanComplete.pu8Buffer, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6359 | * pu8Buffer, u32Length); */ |
| 6360 | |
| 6361 | /* send the message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6362 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6363 | if (s32Error) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6364 | 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] | 6365 | } |
| 6366 | |
| 6367 | |
| 6368 | return; |
| 6369 | |
| 6370 | } |
| 6371 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6372 | /** |
| 6373 | * @brief host_int_remain_on_channel |
| 6374 | * @details |
| 6375 | * @param[in] Handle to wifi driver |
| 6376 | * Duration to remain on channel |
| 6377 | * Channel to remain on |
| 6378 | * Pointer to fn to be called on receive frames in listen state |
| 6379 | * Pointer to remain-on-channel expired fn |
| 6380 | * Priv |
| 6381 | * @return Error code. |
| 6382 | * @author |
| 6383 | * @date |
| 6384 | * @version 1.0 |
| 6385 | */ |
Leo Kim | fdc22a4 | 2015-10-05 15:25:49 +0900 | [diff] [blame^] | 6386 | s32 host_int_remain_on_channel(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID, u32 u32duration, u16 chan, wilc_remain_on_chan_expired RemainOnChanExpired, tWILCpfRemainOnChanReady RemainOnChanReady, void *pvUserArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6387 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6388 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6389 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6390 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6391 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6392 | if (pstrWFIDrv == NULL) { |
| 6393 | PRINT_ER("driver is null\n"); |
| 6394 | return -EFAULT; |
| 6395 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6396 | |
| 6397 | /* prepare the remainonchan Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6398 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6399 | |
| 6400 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6401 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 6402 | msg.body.remain_on_ch.u16Channel = chan; |
| 6403 | msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired; |
| 6404 | msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; |
| 6405 | msg.body.remain_on_ch.pVoid = pvUserArg; |
| 6406 | msg.body.remain_on_ch.u32duration = u32duration; |
| 6407 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6408 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6409 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6410 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6411 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6412 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6413 | |
| 6414 | return s32Error; |
| 6415 | } |
| 6416 | |
| 6417 | /** |
| 6418 | * @brief host_int_ListenStateExpired |
| 6419 | * @details |
| 6420 | * @param[in] Handle to wifi driver |
| 6421 | * Duration to remain on channel |
| 6422 | * Channel to remain on |
| 6423 | * Pointer to fn to be called on receive frames in listen state |
| 6424 | * Pointer to remain-on-channel expired fn |
| 6425 | * Priv |
| 6426 | * @return Error code. |
| 6427 | * @author |
| 6428 | * @date |
| 6429 | * @version 1.0 |
| 6430 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6431 | s32 host_int_ListenStateExpired(tstrWILC_WFIDrv *hWFIDrv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6432 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6433 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6434 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6435 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6436 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6437 | if (pstrWFIDrv == NULL) { |
| 6438 | PRINT_ER("driver is null\n"); |
| 6439 | return -EFAULT; |
| 6440 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6441 | |
| 6442 | /*Stopping remain-on-channel timer*/ |
Greg Kroah-Hartman | 8972d0f | 2015-08-14 20:04:13 -0700 | [diff] [blame] | 6443 | del_timer(&pstrWFIDrv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6444 | |
| 6445 | /* prepare the timer fire Message */ |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6446 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6447 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6448 | msg.drvHandler = hWFIDrv; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 6449 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6450 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6451 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6452 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6453 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6454 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6455 | return s32Error; |
| 6456 | } |
| 6457 | |
| 6458 | /** |
| 6459 | * @brief host_int_frame_register |
| 6460 | * @details |
| 6461 | * @param[in] Handle to wifi driver |
| 6462 | * @return Error code. |
| 6463 | * @author |
| 6464 | * @date |
| 6465 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6466 | s32 host_int_frame_register(tstrWILC_WFIDrv *hWFIDrv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6467 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6468 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6469 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6470 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6471 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6472 | if (pstrWFIDrv == NULL) { |
| 6473 | PRINT_ER("driver is null\n"); |
| 6474 | return -EFAULT; |
| 6475 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6476 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6477 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6478 | |
| 6479 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6480 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6481 | switch (u16FrameType) { |
| 6482 | case ACTION: |
| 6483 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6484 | msg.body.reg_frame.u8Regid = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6485 | break; |
| 6486 | |
| 6487 | case PROBE_REQ: |
| 6488 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6489 | msg.body.reg_frame.u8Regid = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6490 | break; |
| 6491 | |
| 6492 | default: |
| 6493 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 6494 | break; |
| 6495 | } |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 6496 | msg.body.reg_frame.u16FrameType = u16FrameType; |
| 6497 | msg.body.reg_frame.bReg = bReg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6498 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6499 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6500 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6501 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6502 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6503 | |
| 6504 | return s32Error; |
| 6505 | |
| 6506 | |
| 6507 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6508 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6509 | /** |
| 6510 | * @brief host_int_add_beacon |
| 6511 | * @details Setting add beacon params in message queue |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6512 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u32 u32Interval, |
| 6513 | * u32 u32DTIMPeriod,u32 u32HeadLen, u8* pu8Head, |
| 6514 | * u32 u32TailLen, u8* pu8Tail |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6515 | * @return Error code. |
| 6516 | * @author |
| 6517 | * @date |
| 6518 | * @version 1.0 |
| 6519 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6520 | s32 host_int_add_beacon(tstrWILC_WFIDrv *hWFIDrv, u32 u32Interval, |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6521 | u32 u32DTIMPeriod, |
| 6522 | u32 u32HeadLen, u8 *pu8Head, |
| 6523 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6524 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6525 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6526 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6527 | struct host_if_msg msg; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 6528 | struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6529 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6530 | if (pstrWFIDrv == NULL) { |
| 6531 | PRINT_ER("driver is null\n"); |
| 6532 | return -EFAULT; |
| 6533 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6534 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6535 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6536 | |
| 6537 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 6538 | |
| 6539 | |
| 6540 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6541 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6542 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6543 | pstrSetBeaconParam->u32Interval = u32Interval; |
| 6544 | pstrSetBeaconParam->u32DTIMPeriod = u32DTIMPeriod; |
| 6545 | pstrSetBeaconParam->u32HeadLen = u32HeadLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6546 | pstrSetBeaconParam->pu8Head = kmalloc(u32HeadLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6547 | if (pstrSetBeaconParam->pu8Head == NULL) { |
| 6548 | s32Error = -ENOMEM; |
| 6549 | goto ERRORHANDLER; |
| 6550 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6551 | memcpy(pstrSetBeaconParam->pu8Head, pu8Head, u32HeadLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6552 | pstrSetBeaconParam->u32TailLen = u32TailLen; |
| 6553 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6554 | if (u32TailLen > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6555 | pstrSetBeaconParam->pu8Tail = kmalloc(u32TailLen, GFP_KERNEL); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6556 | if (pstrSetBeaconParam->pu8Tail == NULL) { |
| 6557 | s32Error = -ENOMEM; |
| 6558 | goto ERRORHANDLER; |
| 6559 | } |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6560 | memcpy(pstrSetBeaconParam->pu8Tail, pu8Tail, u32TailLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6561 | } else { |
| 6562 | pstrSetBeaconParam->pu8Tail = NULL; |
| 6563 | } |
| 6564 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6565 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6566 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6567 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6568 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6569 | ERRORHANDLER: |
| 6570 | if (s32Error) { |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6571 | if (pstrSetBeaconParam->pu8Head != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6572 | kfree(pstrSetBeaconParam->pu8Head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6573 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6574 | if (pstrSetBeaconParam->pu8Tail != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 6575 | kfree(pstrSetBeaconParam->pu8Tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6576 | } |
| 6577 | |
| 6578 | return s32Error; |
| 6579 | |
| 6580 | } |
| 6581 | |
| 6582 | |
| 6583 | /** |
| 6584 | * @brief host_int_del_beacon |
| 6585 | * @details Setting add beacon params in message queue |
| 6586 | * @param[in] WILC_WFIDrvHandle hWFIDrv |
| 6587 | * @return Error code. |
| 6588 | * @author |
| 6589 | * @date |
| 6590 | * @version 1.0 |
| 6591 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6592 | s32 host_int_del_beacon(tstrWILC_WFIDrv *hWFIDrv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6593 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6594 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6595 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6596 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6597 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6598 | if (pstrWFIDrv == NULL) { |
| 6599 | PRINT_ER("driver is null\n"); |
| 6600 | return -EFAULT; |
| 6601 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6602 | |
| 6603 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6604 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6605 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6606 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 6607 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6608 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 6609 | if (s32Error) |
| 6610 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6611 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6612 | return s32Error; |
| 6613 | } |
| 6614 | |
| 6615 | |
| 6616 | /** |
| 6617 | * @brief host_int_add_station |
| 6618 | * @details Setting add station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6619 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6620 | * @return Error code. |
| 6621 | * @author |
| 6622 | * @date |
| 6623 | * @version 1.0 |
| 6624 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6625 | s32 host_int_add_station(tstrWILC_WFIDrv *hWFIDrv, |
| 6626 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6627 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6628 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6629 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6630 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 6631 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6632 | |
| 6633 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6634 | if (pstrWFIDrv == NULL) { |
| 6635 | PRINT_ER("driver is null\n"); |
| 6636 | return -EFAULT; |
| 6637 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6638 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6639 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6640 | |
| 6641 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 6642 | |
| 6643 | |
| 6644 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6645 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6646 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6647 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6648 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6649 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6650 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6651 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 6652 | if (!rates) |
| 6653 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6654 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6655 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 6656 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6657 | } |
| 6658 | |
| 6659 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6660 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6661 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6662 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6663 | return s32Error; |
| 6664 | } |
| 6665 | |
| 6666 | /** |
| 6667 | * @brief host_int_del_station |
| 6668 | * @details Setting delete station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6669 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8* pu8MacAddr |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6670 | * @return Error code. |
| 6671 | * @author |
| 6672 | * @date |
| 6673 | * @version 1.0 |
| 6674 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6675 | s32 host_int_del_station(tstrWILC_WFIDrv *hWFIDrv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6676 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6677 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6678 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6679 | struct host_if_msg msg; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 6680 | struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6681 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6682 | if (pstrWFIDrv == NULL) { |
| 6683 | PRINT_ER("driver is null\n"); |
| 6684 | return -EFAULT; |
| 6685 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6686 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6687 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6688 | |
| 6689 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 6690 | |
| 6691 | |
| 6692 | |
| 6693 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6694 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6695 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6696 | |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 6697 | if (pu8MacAddr == NULL) |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6698 | memset(pstrDelStationMsg->au8MacAddr, 255, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6699 | else |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6700 | memcpy(pstrDelStationMsg->au8MacAddr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6701 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6702 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6703 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6704 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6705 | return s32Error; |
| 6706 | } |
| 6707 | /** |
| 6708 | * @brief host_int_del_allstation |
| 6709 | * @details Setting del station params in message queue |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6710 | * @param[in] WILC_WFIDrvHandle hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]s |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6711 | * @return Error code. |
| 6712 | * @author |
| 6713 | * @date |
| 6714 | * @version 1.0 |
| 6715 | */ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6716 | s32 host_int_del_allstation(tstrWILC_WFIDrv *hWFIDrv, u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6717 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6718 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6719 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6720 | struct host_if_msg msg; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 6721 | struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6722 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 6723 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6724 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6725 | |
| 6726 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6727 | if (pstrWFIDrv == NULL) { |
| 6728 | PRINT_ER("driver is null\n"); |
| 6729 | return -EFAULT; |
| 6730 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6731 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6732 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6733 | |
| 6734 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 6735 | |
| 6736 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6737 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6738 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6739 | |
| 6740 | /* Handling situation of deauthenticing all associated stations*/ |
| 6741 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 6742 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6743 | memcpy(pstrDelAllStationMsg->au8Sta_DelAllSta[i], pu8MacAddr[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6744 | 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], |
| 6745 | pstrDelAllStationMsg->au8Sta_DelAllSta[i][5]); |
| 6746 | u8AssocNumb++; |
| 6747 | } |
| 6748 | } |
| 6749 | if (!u8AssocNumb) { |
| 6750 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
| 6751 | return s32Error; |
| 6752 | } |
| 6753 | |
| 6754 | pstrDelAllStationMsg->u8Num_AssocSta = u8AssocNumb; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6755 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6756 | |
| 6757 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6758 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6759 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6760 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 6761 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6762 | |
| 6763 | return s32Error; |
| 6764 | |
| 6765 | } |
| 6766 | |
| 6767 | /** |
| 6768 | * @brief host_int_edit_station |
| 6769 | * @details Setting edit station params in message queue |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6770 | * @param[in] WILC_WFIDrvHandle hWFIDrv, struct add_sta_param *pstrStaParams |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6771 | * @return Error code. |
| 6772 | * @author |
| 6773 | * @date |
| 6774 | * @version 1.0 |
| 6775 | */ |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6776 | s32 host_int_edit_station(tstrWILC_WFIDrv *hWFIDrv, |
| 6777 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6778 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6779 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6780 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6781 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 6782 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6783 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6784 | if (pstrWFIDrv == NULL) { |
| 6785 | PRINT_ER("driver is null\n"); |
| 6786 | return -EFAULT; |
| 6787 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6788 | |
| 6789 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 6790 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6791 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6792 | |
| 6793 | |
| 6794 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6795 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6796 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6797 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 6798 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6799 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6800 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6801 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 6802 | if (!rates) |
| 6803 | return -ENOMEM; |
| 6804 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6805 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 6806 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6807 | } |
| 6808 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6809 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6810 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6811 | PRINT_ER("wilc_mq_send fail\n"); |
| 6812 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6813 | return s32Error; |
| 6814 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 6815 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6816 | s32 host_int_set_power_mgmt(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32Timeout) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6817 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6818 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6819 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6820 | struct host_if_msg msg; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 6821 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6822 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6823 | 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] | 6824 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6825 | if (pstrWFIDrv == NULL) { |
| 6826 | PRINT_ER("driver is null\n"); |
| 6827 | return -EFAULT; |
| 6828 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6829 | |
| 6830 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 6831 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6832 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6833 | |
| 6834 | |
| 6835 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6836 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6837 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6838 | |
| 6839 | pstrPowerMgmtParam->bIsEnabled = bIsEnabled; |
| 6840 | pstrPowerMgmtParam->u32Timeout = u32Timeout; |
| 6841 | |
| 6842 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6843 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6844 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6845 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6846 | return s32Error; |
| 6847 | } |
| 6848 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 6849 | s32 host_int_setup_multicast_filter(tstrWILC_WFIDrv *hWFIDrv, bool bIsEnabled, u32 u32count) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6850 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 6851 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6852 | |
| 6853 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6854 | struct host_if_msg msg; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 6855 | struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6856 | |
| 6857 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6858 | if (pstrWFIDrv == NULL) { |
| 6859 | PRINT_ER("driver is null\n"); |
| 6860 | return -EFAULT; |
| 6861 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6862 | |
| 6863 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 6864 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6865 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6866 | |
| 6867 | |
| 6868 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 6869 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6870 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6871 | |
| 6872 | pstrMulticastFilterParam->bIsEnabled = bIsEnabled; |
| 6873 | pstrMulticastFilterParam->u32count = u32count; |
| 6874 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 6875 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 6876 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 6877 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6878 | return s32Error; |
| 6879 | } |
| 6880 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6881 | /** |
| 6882 | * @brief host_int_ParseJoinBssParam |
| 6883 | * @details Parse Needed Join Parameters and save it in a new JoinBssParam entry |
| 6884 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 6885 | * @return |
| 6886 | * @author zsalah |
| 6887 | * @date |
| 6888 | * @version 1.0**/ |
| 6889 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 6890 | { |
| 6891 | tstrJoinBssParam *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6892 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6893 | u16 u16IEsLen; |
| 6894 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6895 | u8 suppRatesNo = 0; |
| 6896 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6897 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 6898 | u8 pcipherCount; |
| 6899 | u8 authCount; |
| 6900 | u8 pcipherTotalCount = 0; |
| 6901 | u8 authTotalCount = 0; |
| 6902 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6903 | |
| 6904 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 6905 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 6906 | |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 6907 | pNewJoinBssParam = kmalloc(sizeof(tstrJoinBssParam), GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6908 | if (pNewJoinBssParam != NULL) { |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6909 | memset(pNewJoinBssParam, 0, sizeof(tstrJoinBssParam)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6910 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 6911 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 6912 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6913 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6914 | /*for(i=0; i<6;i++) |
| 6915 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->au8bssid[i]);*/ |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 6916 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6917 | pNewJoinBssParam->ssidLen = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 6918 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 6919 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6920 | /*for(i=0; i<pNewJoinBssParam->ssidLen;i++) |
| 6921 | * PRINT_D(HOSTINF_DBG,"%c",pNewJoinBssParam->ssid[i]);*/ |
| 6922 | |
| 6923 | /* parse supported rates: */ |
| 6924 | while (index < u16IEsLen) { |
| 6925 | /* supportedRates IE */ |
| 6926 | if (pu8IEs[index] == SUPP_RATES_IE) { |
| 6927 | /* PRINT_D(HOSTINF_DBG, "Supported Rates\n"); */ |
| 6928 | suppRatesNo = pu8IEs[index + 1]; |
| 6929 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
| 6930 | index += 2; /* skipping ID and length bytes; */ |
| 6931 | |
| 6932 | for (i = 0; i < suppRatesNo; i++) { |
| 6933 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
| 6934 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[i+1]); */ |
| 6935 | } |
| 6936 | index += suppRatesNo; |
| 6937 | continue; |
| 6938 | } |
| 6939 | /* Ext SupportedRates IE */ |
| 6940 | else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
| 6941 | /* PRINT_D(HOSTINF_DBG, "Extended Supported Rates\n"); */ |
| 6942 | /* checking if no of ext. supp and supp rates < max limit */ |
| 6943 | extSuppRatesNo = pu8IEs[index + 1]; |
| 6944 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 6945 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 6946 | else |
| 6947 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 6948 | index += 2; |
| 6949 | /* pNewJoinBssParam.supp_rates[0] contains now old number not the ext. no */ |
| 6950 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) { |
| 6951 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
| 6952 | /* PRINT_D(HOSTINF_DBG,"%0x ",pNewJoinBssParam->supp_rates[suppRatesNo+i+1]); */ |
| 6953 | } |
| 6954 | index += extSuppRatesNo; |
| 6955 | continue; |
| 6956 | } |
| 6957 | /* HT Cap. IE */ |
| 6958 | else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
| 6959 | /* if IE found set the flag */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6960 | pNewJoinBssParam->ht_capable = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6961 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 6962 | /* PRINT_D(HOSTINF_DBG,"HT_CAPABALE\n"); */ |
| 6963 | continue; |
| 6964 | } else if ((pu8IEs[index] == WMM_IE) && /* WMM Element ID */ |
| 6965 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
| 6966 | (pu8IEs[index + 4] == 0xF2) && /* OUI */ |
| 6967 | (pu8IEs[index + 5] == 0x02) && /* OUI Type */ |
| 6968 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && /* OUI Sub Type */ |
| 6969 | (pu8IEs[index + 7] == 0x01)) { |
| 6970 | /* Presence of WMM Info/Param element indicates WMM capability */ |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6971 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6972 | |
| 6973 | /* Check if Bit 7 is set indicating U-APSD capability */ |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 6974 | if (pu8IEs[index + 8] & BIT(7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 6975 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6976 | index += pu8IEs[index + 1] + 2; |
| 6977 | continue; |
| 6978 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6979 | else if ((pu8IEs[index] == P2P_IE) && /* P2P Element ID */ |
| 6980 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
| 6981 | (pu8IEs[index + 4] == 0x9a) && /* OUI */ |
| 6982 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { /* OUI Type */ |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 6983 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 6984 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6985 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
| 6986 | pNewJoinBssParam->u8NoaEnbaled = 1; |
| 6987 | pNewJoinBssParam->u8Index = pu8IEs[index + 9]; |
| 6988 | |
| 6989 | /* Check if Bit 7 is set indicating Opss capability */ |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 6990 | if (pu8IEs[index + 10] & BIT(7)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6991 | pNewJoinBssParam->u8OppEnable = 1; |
| 6992 | pNewJoinBssParam->u8CtWindow = pu8IEs[index + 10]; |
| 6993 | } else |
| 6994 | pNewJoinBssParam->u8OppEnable = 0; |
| 6995 | /* HOSTINF_DBG */ |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6996 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6997 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 6998 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6999 | |
| 7000 | pNewJoinBssParam->u8Count = pu8IEs[index + 11]; |
| 7001 | u16P2P_count = index + 12; |
| 7002 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7003 | memcpy(pNewJoinBssParam->au8Duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7004 | u16P2P_count += 4; |
| 7005 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7006 | memcpy(pNewJoinBssParam->au8Interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7007 | u16P2P_count += 4; |
| 7008 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 7009 | memcpy(pNewJoinBssParam->au8StartTime, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7010 | |
| 7011 | index += pu8IEs[index + 1] + 2; |
| 7012 | continue; |
| 7013 | |
| 7014 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7015 | else if ((pu8IEs[index] == RSN_IE) || |
| 7016 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 7017 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 7018 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 7019 | u16 rsnIndex = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7020 | /*PRINT_D(HOSTINF_DBG,"RSN IE Length:%d\n",pu8IEs[rsnIndex+1]); |
| 7021 | * for(i=0; i<pu8IEs[rsnIndex+1]; i++) |
| 7022 | * { |
| 7023 | * PRINT_D(HOSTINF_DBG,"%0x ",pu8IEs[rsnIndex+2+i]); |
| 7024 | * }*/ |
| 7025 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 7026 | pNewJoinBssParam->mode_802_11i = 2; |
| 7027 | /* PRINT_D(HOSTINF_DBG,"\nRSN_IE\n"); */ |
| 7028 | } else { /* check if rsn was previously parsed */ |
| 7029 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 7030 | pNewJoinBssParam->mode_802_11i = 1; |
| 7031 | /* PRINT_D(HOSTINF_DBG,"\nWPA_IE\n"); */ |
| 7032 | rsnIndex += 4; |
| 7033 | } |
| 7034 | rsnIndex += 7; /* skipping id, length, version(2B) and first 3 bytes of gcipher */ |
| 7035 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 7036 | rsnIndex++; |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7037 | /* PRINT_D(HOSTINF_DBG,"Group Policy: %0x\n",pNewJoinBssParam->rsn_grp_policy); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7038 | /* initialize policies with invalid values */ |
| 7039 | |
| 7040 | jumpOffset = pu8IEs[rsnIndex] * 4; /* total no.of bytes of pcipher field (count*4) */ |
| 7041 | |
| 7042 | /*parsing pairwise cipher*/ |
| 7043 | |
| 7044 | /* saving 3 pcipher max. */ |
| 7045 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7046 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7047 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 7048 | /* PRINT_D(HOSTINF_DBG,"\npcipher:%d\n",pcipherCount); */ |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7049 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) { |
| 7050 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7051 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7052 | /* PRINT_D(HOSTINF_DBG,"PAIR policy = [%0x,%0x]\n",pNewJoinBssParam->rsn_pcip_policy[i],i); */ |
| 7053 | } |
| 7054 | pcipherTotalCount += pcipherCount; |
| 7055 | rsnIndex += jumpOffset; |
| 7056 | |
| 7057 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 7058 | |
| 7059 | /*parsing AKM suite (auth_policy)*/ |
| 7060 | /* saving 3 auth policies max. */ |
| 7061 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
| 7062 | rsnIndex += 2; /* jump 2 bytes of pcipher count */ |
| 7063 | |
| 7064 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) { |
| 7065 | /* each count corresponds to 4 bytes, only last byte is saved */ |
| 7066 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
| 7067 | } |
| 7068 | authTotalCount += authCount; |
| 7069 | rsnIndex += jumpOffset; |
| 7070 | /*pasring rsn cap. only if rsn IE*/ |
| 7071 | if (pu8IEs[index] == RSN_IE) { |
| 7072 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 7073 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 7074 | rsnIndex += 2; |
| 7075 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 7076 | pNewJoinBssParam->rsn_found = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7077 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7078 | continue; |
| 7079 | } else |
| 7080 | index += pu8IEs[index + 1] + 2; /* ID,Length bytes and IE body */ |
| 7081 | |
| 7082 | } |
| 7083 | |
| 7084 | |
| 7085 | } |
| 7086 | |
| 7087 | return (void *)pNewJoinBssParam; |
| 7088 | |
| 7089 | } |
| 7090 | |
| 7091 | void host_int_freeJoinParams(void *pJoinParams) |
| 7092 | { |
| 7093 | if ((tstrJoinBssParam *)pJoinParams != NULL) |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 7094 | kfree((tstrJoinBssParam *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7095 | else |
| 7096 | PRINT_ER("Unable to FREE null pointer\n"); |
| 7097 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7098 | |
| 7099 | /** |
| 7100 | * @brief host_int_addBASession |
| 7101 | * @details Open a block Ack session with the given parameters |
| 7102 | * @param[in] tstrNetworkInfo* ptstrNetworkInfo |
| 7103 | * @return |
| 7104 | * @author anoureldin |
| 7105 | * @date |
| 7106 | * @version 1.0**/ |
| 7107 | |
Johnny Kim | 2b05df5 | 2015-08-13 13:41:21 +0900 | [diff] [blame] | 7108 | static int host_int_addBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID, short int BufferSize, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7109 | short int SessionTimeout, void *drvHandler) |
| 7110 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7111 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7112 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7113 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 7114 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7115 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7116 | if (pstrWFIDrv == NULL) { |
| 7117 | PRINT_ER("driver is null\n"); |
| 7118 | return -EFAULT; |
| 7119 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7120 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7121 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7122 | |
| 7123 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7124 | msg.id = HOST_IF_MSG_ADD_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7125 | |
| 7126 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7127 | pBASessionInfo->u8Ted = TID; |
| 7128 | pBASessionInfo->u16BufferSize = BufferSize; |
| 7129 | pBASessionInfo->u16SessionTimeout = SessionTimeout; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7130 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7131 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7132 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7133 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7134 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7135 | |
| 7136 | return s32Error; |
| 7137 | } |
| 7138 | |
| 7139 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7140 | s32 host_int_delBASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7141 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7142 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7143 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7144 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 7145 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7146 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7147 | if (pstrWFIDrv == NULL) { |
| 7148 | PRINT_ER("driver is null\n"); |
| 7149 | return -EFAULT; |
| 7150 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7151 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7152 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7153 | |
| 7154 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7155 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7156 | |
| 7157 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7158 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7159 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7160 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7161 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7162 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7163 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7164 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7165 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7166 | |
| 7167 | return s32Error; |
| 7168 | } |
| 7169 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7170 | s32 host_int_del_All_Rx_BASession(tstrWILC_WFIDrv *hWFIDrv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7171 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7172 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7173 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7174 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 7175 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7176 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7177 | if (pstrWFIDrv == NULL) { |
| 7178 | PRINT_ER("driver is null\n"); |
| 7179 | return -EFAULT; |
| 7180 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7181 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7182 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7183 | |
| 7184 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7185 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7186 | |
| 7187 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 7188 | pBASessionInfo->u8Ted = TID; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7189 | msg.drvHandler = hWFIDrv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7190 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7191 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7192 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7193 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7194 | |
Arnd Bergmann | 83383ea | 2015-06-01 21:06:43 +0200 | [diff] [blame] | 7195 | down(&hWaitResponse); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7196 | |
| 7197 | return s32Error; |
| 7198 | } |
| 7199 | |
| 7200 | /** |
| 7201 | * @brief host_int_setup_ipaddress |
| 7202 | * @details setup IP in firmware |
| 7203 | * @param[in] Handle to wifi driver |
| 7204 | * @return Error code. |
| 7205 | * @author Abdelrahman Sobhy |
| 7206 | * @date |
| 7207 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7208 | s32 host_int_setup_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7209 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7210 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7211 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7212 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7213 | |
| 7214 | /* TODO: Enable This feature on softap firmware */ |
| 7215 | return 0; |
| 7216 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7217 | if (pstrWFIDrv == NULL) { |
| 7218 | PRINT_ER("driver is null\n"); |
| 7219 | return -EFAULT; |
| 7220 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7221 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7222 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7223 | |
| 7224 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7225 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7226 | |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7227 | msg.body.ip_info.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7228 | msg.drvHandler = hWFIDrv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7229 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7230 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7231 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7232 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7233 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7234 | |
| 7235 | return s32Error; |
| 7236 | |
| 7237 | |
| 7238 | } |
| 7239 | |
| 7240 | /** |
| 7241 | * @brief host_int_get_ipaddress |
| 7242 | * @details Get IP from firmware |
| 7243 | * @param[in] Handle to wifi driver |
| 7244 | * @return Error code. |
| 7245 | * @author Abdelrahman Sobhy |
| 7246 | * @date |
| 7247 | * @version 1.0*/ |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 7248 | s32 host_int_get_ipaddress(tstrWILC_WFIDrv *hWFIDrv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7249 | { |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 7250 | s32 s32Error = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7251 | tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7252 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7253 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7254 | if (pstrWFIDrv == NULL) { |
| 7255 | PRINT_ER("driver is null\n"); |
| 7256 | return -EFAULT; |
| 7257 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7258 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7259 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7260 | |
| 7261 | /* prepare the WiphyParams Message */ |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 7262 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7263 | |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7264 | msg.body.ip_info.au8IPAddr = u16ipadd; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7265 | msg.drvHandler = hWFIDrv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 7266 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7267 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 7268 | s32Error = wilc_mq_send(&gMsgQHostIF, &msg, sizeof(struct host_if_msg)); |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 7269 | if (s32Error) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 7270 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 7271 | |
| 7272 | return s32Error; |
| 7273 | |
| 7274 | |
| 7275 | } |