Chaehyun Lim | e215a87 | 2015-09-30 08:15:41 +0900 | [diff] [blame] | 1 | #include <linux/slab.h> |
| 2 | #include <linux/time.h> |
| 3 | #include <linux/kthread.h> |
| 4 | #include <linux/delay.h> |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5 | #include "host_interface.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6 | #include "coreconfigurator.h" |
Chaehyun Lim | 5366012 | 2015-09-17 16:48:49 +0900 | [diff] [blame] | 7 | #include "wilc_wlan_if.h" |
Chaehyun Lim | f23eb98 | 2015-09-23 18:03:47 +0900 | [diff] [blame] | 8 | #include "wilc_msgqueue.h" |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 9 | #include <linux/etherdevice.h> |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 10 | #include "wilc_wfi_netdevice.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 11 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 12 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 13 | |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 14 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 15 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 16 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 17 | |
Chaehyun Lim | 9eac3a1 | 2015-06-18 22:08:51 +0900 | [diff] [blame] | 18 | #define HOST_IF_MSG_SCAN 0 |
| 19 | #define HOST_IF_MSG_CONNECT 1 |
| 20 | #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 |
| 21 | #define HOST_IF_MSG_KEY 3 |
| 22 | #define HOST_IF_MSG_RCVD_NTWRK_INFO 4 |
| 23 | #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5 |
| 24 | #define HOST_IF_MSG_CFG_PARAMS 6 |
| 25 | #define HOST_IF_MSG_SET_CHANNEL 7 |
| 26 | #define HOST_IF_MSG_DISCONNECT 8 |
| 27 | #define HOST_IF_MSG_GET_RSSI 9 |
| 28 | #define HOST_IF_MSG_GET_CHNL 10 |
| 29 | #define HOST_IF_MSG_ADD_BEACON 11 |
| 30 | #define HOST_IF_MSG_DEL_BEACON 12 |
| 31 | #define HOST_IF_MSG_ADD_STATION 13 |
| 32 | #define HOST_IF_MSG_DEL_STATION 14 |
| 33 | #define HOST_IF_MSG_EDIT_STATION 15 |
| 34 | #define HOST_IF_MSG_SCAN_TIMER_FIRED 16 |
| 35 | #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17 |
| 36 | #define HOST_IF_MSG_POWER_MGMT 18 |
| 37 | #define HOST_IF_MSG_GET_INACTIVETIME 19 |
| 38 | #define HOST_IF_MSG_REMAIN_ON_CHAN 20 |
| 39 | #define HOST_IF_MSG_REGISTER_FRAME 21 |
| 40 | #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22 |
| 41 | #define HOST_IF_MSG_GET_LINKSPEED 23 |
| 42 | #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24 |
| 43 | #define HOST_IF_MSG_SET_MAC_ADDRESS 25 |
| 44 | #define HOST_IF_MSG_GET_MAC_ADDRESS 26 |
| 45 | #define HOST_IF_MSG_SET_OPERATION_MODE 27 |
| 46 | #define HOST_IF_MSG_SET_IPADDRESS 28 |
| 47 | #define HOST_IF_MSG_GET_IPADDRESS 29 |
| 48 | #define HOST_IF_MSG_FLUSH_CONNECT 30 |
| 49 | #define HOST_IF_MSG_GET_STATISTICS 31 |
| 50 | #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 |
| 51 | #define HOST_IF_MSG_ADD_BA_SESSION 33 |
| 52 | #define HOST_IF_MSG_DEL_BA_SESSION 34 |
| 53 | #define HOST_IF_MSG_Q_IDLE 35 |
| 54 | #define HOST_IF_MSG_DEL_ALL_STA 36 |
| 55 | #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34 |
| 56 | #define HOST_IF_MSG_EXIT 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 57 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 58 | #define HOST_IF_SCAN_TIMEOUT 4000 |
| 59 | #define HOST_IF_CONNECT_TIMEOUT 9500 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 60 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 61 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
| 62 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 |
| 63 | #define BLOCK_ACK_REQ_SIZE 0x14 |
Leo Kim | 9f3295a | 2015-10-19 18:26:10 +0900 | [diff] [blame] | 64 | #define FALSE_FRMWR_CHANNEL 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 65 | |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 66 | struct cfg_param_attr { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 67 | struct cfg_param_val cfg_attr_info; |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 68 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 69 | |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 70 | struct host_if_wpa_attr { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 71 | u8 *key; |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 72 | const u8 *mac_addr; |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 73 | u8 *seq; |
Leo Kim | dacc594 | 2015-10-13 19:49:33 +0900 | [diff] [blame] | 74 | u8 seq_len; |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 75 | u8 index; |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 76 | u8 key_len; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 77 | u8 mode; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 78 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 79 | |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 80 | struct host_if_wep_attr { |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 81 | u8 *key; |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame] | 82 | u8 key_len; |
Tony Cho | 259b3aa | 2015-10-12 16:56:13 +0900 | [diff] [blame] | 83 | u8 index; |
Tony Cho | b5eaff1 | 2015-10-12 16:56:14 +0900 | [diff] [blame] | 84 | u8 mode; |
Tony Cho | 7fa252e | 2015-10-12 16:56:15 +0900 | [diff] [blame] | 85 | enum AUTHTYPE auth_type; |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 86 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 87 | |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 88 | union host_if_key_attr { |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 89 | struct host_if_wep_attr wep; |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 90 | struct host_if_wpa_attr wpa; |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 91 | struct host_if_pmkid_attr pmkid; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 92 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 93 | |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 94 | struct key_attr { |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 95 | enum KEY_TYPE type; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 96 | u8 action; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 97 | union host_if_key_attr attr; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 98 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 99 | |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 100 | struct scan_attr { |
Leo Kim | 4256889 | 2015-10-13 19:49:37 +0900 | [diff] [blame] | 101 | u8 src; |
Leo Kim | 1e276c8 | 2015-10-13 19:49:38 +0900 | [diff] [blame] | 102 | u8 type; |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 103 | u8 *ch_freq_list; |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 104 | u8 ch_list_len; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 105 | u8 *ies; |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 106 | size_t ies_len; |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 107 | wilc_scan_result result; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 108 | void *arg; |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 109 | struct hidden_network hidden_network; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 110 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 111 | |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 112 | struct connect_attr { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 113 | u8 *bssid; |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 114 | u8 *ssid; |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 115 | size_t ssid_len; |
Leo Kim | 2ea158c | 2015-10-13 19:49:52 +0900 | [diff] [blame] | 116 | u8 *ies; |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 117 | size_t ies_len; |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 118 | u8 security; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 119 | wilc_connect_result result; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 120 | void *arg; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 121 | enum AUTHTYPE auth_type; |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 122 | u8 ch; |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 123 | void *params; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 124 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 125 | |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 126 | struct rcvd_async_info { |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 127 | u8 *buffer; |
Leo Kim | f94f488 | 2015-10-13 19:50:01 +0900 | [diff] [blame] | 128 | u32 len; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 129 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 130 | |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 131 | struct channel_attr { |
Leo Kim | 730ee05 | 2015-10-13 19:50:02 +0900 | [diff] [blame] | 132 | u8 set_ch; |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 133 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 134 | |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 135 | struct beacon_attr { |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 136 | u32 interval; |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 137 | u32 dtim_period; |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 138 | u32 head_len; |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 139 | u8 *head; |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 140 | u32 tail_len; |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 141 | u8 *tail; |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 142 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 143 | |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 144 | struct set_multicast { |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 145 | bool enabled; |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 146 | u32 cnt; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 147 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 148 | |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 149 | struct del_all_sta { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 150 | u8 del_all_sta[MAX_NUM_STA][ETH_ALEN]; |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 151 | u8 assoc_sta; |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 152 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 153 | |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 154 | struct del_sta { |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 155 | u8 mac_addr[ETH_ALEN]; |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 156 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 157 | |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 158 | struct power_mgmt_param { |
Leo Kim | 33c70c1 | 2015-10-13 20:02:07 +0900 | [diff] [blame] | 159 | bool enabled; |
Leo Kim | 937918f | 2015-10-13 20:02:08 +0900 | [diff] [blame] | 160 | u32 timeout; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 161 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 162 | |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 163 | struct set_ip_addr { |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 164 | u8 *ip_addr; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 165 | u8 idx; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 166 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 167 | |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 168 | struct sta_inactive_t { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 169 | u8 mac[6]; |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 170 | }; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 171 | |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 172 | union message_body { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 173 | struct scan_attr scan_info; |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 174 | struct connect_attr con_info; |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 175 | struct rcvd_net_info net_info; |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 176 | struct rcvd_async_info async_info; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 177 | struct key_attr key_info; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 178 | struct cfg_param_attr cfg_info; |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 179 | struct channel_attr channel_info; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 180 | struct beacon_attr beacon_info; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 181 | struct add_sta_param add_sta_info; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 182 | struct del_sta del_sta_info; |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 183 | struct add_sta_param edit_sta_info; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 184 | struct power_mgmt_param pwr_mgmt_info; |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 185 | struct sta_inactive_t mac_info; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 186 | struct set_ip_addr ip_info; |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 187 | struct drv_handler drv; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 188 | struct set_multicast multicast_info; |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 189 | struct op_mode mode; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 190 | struct set_mac_addr set_mac_info; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 191 | struct get_mac_addr get_mac_info; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 192 | struct ba_session_info session_info; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 193 | struct remain_ch remain_on_ch; |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 194 | struct reg_frame reg_frame; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 195 | char *data; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 196 | struct del_all_sta del_all_sta_info; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 197 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 198 | |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 199 | struct host_if_msg { |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 200 | u16 id; |
| 201 | union message_body body; |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 202 | struct host_if_drv *drv; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 203 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 204 | |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 205 | struct join_bss_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 206 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 207 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 208 | u16 beacon_period; |
| 209 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 210 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 211 | char ssid[MAX_SSID_LEN]; |
Leo Kim | 619d27b | 2015-10-15 13:24:42 +0900 | [diff] [blame] | 212 | u8 ssid_len; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 213 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 214 | u8 ht_capable; |
| 215 | u8 wmm_cap; |
| 216 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 217 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 218 | u8 rsn_grp_policy; |
| 219 | u8 mode_802_11i; |
| 220 | u8 rsn_pcip_policy[3]; |
| 221 | u8 rsn_auth_policy[3]; |
| 222 | u8 rsn_cap[2]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 223 | u32 tsf; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 224 | u8 noa_enabled; |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 225 | u8 opp_enabled; |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 226 | u8 ct_window; |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 227 | u8 cnt; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 228 | u8 idx; |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 229 | u8 duration[4]; |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 230 | u8 interval[4]; |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 231 | u8 start_time[4]; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 232 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 233 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 234 | static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
| 235 | struct host_if_drv *terminated_handle; |
Leo Kim | f2fc9f6 | 2015-10-13 19:49:47 +0900 | [diff] [blame] | 236 | bool g_obtainingIP; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 237 | u8 P2P_LISTEN_STATE; |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 238 | static struct task_struct *hif_thread_handler; |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 239 | static WILC_MsgQueueHandle hif_msg_q; |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 240 | static struct semaphore hif_sema_thread; |
kbuild test robot | 413f930 | 2015-10-15 14:07:41 +0800 | [diff] [blame] | 241 | static struct semaphore hif_sema_driver; |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 242 | static struct semaphore hif_sema_wait_response; |
kbuild test robot | 1722500 | 2015-10-15 14:21:32 +0800 | [diff] [blame] | 243 | static struct semaphore hif_sema_deinit; |
kbuild test robot | 24aadb8 | 2015-10-15 14:32:40 +0800 | [diff] [blame] | 244 | static struct timer_list periodic_rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 245 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 246 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 247 | |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 248 | static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 249 | |
kbuild test robot | f64321c | 2015-10-15 14:46:26 +0800 | [diff] [blame] | 250 | static bool scan_while_connected; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 251 | |
Leo Kim | 144b7b2 | 2015-10-15 13:25:01 +0900 | [diff] [blame] | 252 | static s8 rssi; |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 253 | static s8 link_speed; |
Leo Kim | 95ebb0f | 2015-10-15 13:25:03 +0900 | [diff] [blame] | 254 | static u8 ch_no; |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 255 | static u8 set_ip[2][4]; |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 256 | static u8 get_ip[2][4]; |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 257 | static u32 inactive_time; |
Leo Kim | a74c7bf | 2015-10-15 13:25:07 +0900 | [diff] [blame] | 258 | static u8 del_beacon; |
Leo Kim | 7178aed | 2015-10-19 18:26:09 +0900 | [diff] [blame] | 259 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 260 | |
kbuild test robot | ef59919 | 2015-10-15 15:04:15 +0800 | [diff] [blame] | 261 | static u8 *join_req; |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 262 | u8 *info_element; |
kbuild test robot | 23047d5 | 2015-10-15 15:18:34 +0800 | [diff] [blame] | 263 | static u8 mode_11i; |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 264 | u8 auth_type; |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 265 | u32 join_req_size; |
kbuild test robot | 5e0e7c2 | 2015-10-15 15:47:44 +0800 | [diff] [blame] | 266 | static u32 info_element_size; |
kbuild test robot | 23fba59 | 2015-10-15 15:59:53 +0800 | [diff] [blame] | 267 | static struct host_if_drv *join_req_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 268 | #define REAL_JOIN_REQ 0 |
| 269 | #define FLUSHED_JOIN_REQ 1 |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 270 | #define FLUSHED_BYTE_POS 79 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 271 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 272 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 273 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 274 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 275 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 276 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 277 | static int add_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 278 | { |
| 279 | int i; |
| 280 | |
| 281 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 282 | if (!wfidrv_list[i]) { |
| 283 | wfidrv_list[i] = handler; |
| 284 | return 0; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | return -ENOBUFS; |
| 289 | } |
| 290 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 291 | static int remove_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 292 | { |
| 293 | int i; |
| 294 | |
| 295 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 296 | if (wfidrv_list[i] == handler) { |
| 297 | wfidrv_list[i] = NULL; |
| 298 | return 0; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | return -EINVAL; |
| 303 | } |
| 304 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 305 | static int get_id_from_handler(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 306 | { |
| 307 | int i; |
| 308 | |
| 309 | if (!handler) |
| 310 | return 0; |
| 311 | |
| 312 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 313 | if (wfidrv_list[i] == handler) |
| 314 | return i; |
| 315 | } |
| 316 | |
| 317 | return 0; |
| 318 | } |
| 319 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 320 | static struct host_if_drv *get_handler_from_id(int id) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 321 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 322 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 323 | return NULL; |
| 324 | return wfidrv_list[id]; |
| 325 | } |
| 326 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 327 | static s32 Handle_SetChannel(struct host_if_drv *hif_drv, |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 328 | struct channel_attr *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 329 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 330 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 331 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 332 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 333 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 334 | wid.type = WID_CHAR; |
| 335 | wid.val = (char *)&pstrHostIFSetChan->set_ch; |
| 336 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 337 | |
| 338 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 339 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 340 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 341 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 342 | |
| 343 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 344 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 345 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 346 | } |
| 347 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 348 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 349 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 350 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 351 | static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv, |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 352 | struct drv_handler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 353 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 354 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 355 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 356 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 357 | wid.id = (u16)WID_SET_DRV_HANDLER; |
| 358 | wid.type = WID_INT; |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 359 | wid.val = (s8 *)&pstrHostIfSetDrvHandler->handler; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 360 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 361 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 362 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 363 | pstrHostIfSetDrvHandler->handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 364 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 365 | if (!hif_drv) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 366 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 367 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 368 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 369 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 370 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 371 | } |
| 372 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 373 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 374 | } |
| 375 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 376 | static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv, |
Tony Cho | 801bee5 | 2015-09-21 12:16:53 +0900 | [diff] [blame] | 377 | struct op_mode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 378 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 379 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 380 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 381 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 382 | wid.id = (u16)WID_SET_OPERATION_MODE; |
| 383 | wid.type = WID_INT; |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 384 | wid.val = (s8 *)&pstrHostIfSetOperationMode->mode; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 385 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 386 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 387 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 388 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 389 | |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 390 | if ((pstrHostIfSetOperationMode->mode) == IDLE_MODE) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 391 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 392 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 393 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 394 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 395 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 396 | } |
| 397 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 398 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 399 | } |
| 400 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 401 | s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 402 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 403 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 404 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 405 | char firmwareIPAddress[4] = {0}; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 406 | |
| 407 | if (pu8IPAddr[0] < 192) |
| 408 | pu8IPAddr[0] = 0; |
| 409 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 410 | 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] | 411 | |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 412 | memcpy(set_ip[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 413 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 414 | wid.id = (u16)WID_IP_ADDRESS; |
| 415 | wid.type = WID_STR; |
| 416 | wid.val = (u8 *)pu8IPAddr; |
| 417 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 418 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 419 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 420 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 421 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 422 | host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 423 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 424 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 425 | PRINT_ER("Failed to set IP address\n"); |
| 426 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 427 | } |
| 428 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 429 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 430 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 431 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 432 | } |
| 433 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 434 | s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 435 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 436 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 437 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 438 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 439 | wid.id = (u16)WID_IP_ADDRESS; |
| 440 | wid.type = WID_STR; |
| 441 | wid.val = kmalloc(IP_ALEN, GFP_KERNEL); |
| 442 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 443 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 444 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 445 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 446 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 447 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 448 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 449 | memcpy(get_ip[idx], wid.val, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 450 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 451 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 452 | |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 453 | if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 454 | host_int_setup_ipaddress(hif_drv, set_ip[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 455 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 456 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 457 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 458 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 459 | } |
| 460 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 461 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 462 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", get_ip[idx]); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 463 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 464 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 465 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 466 | } |
| 467 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 468 | static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv, |
Tony Cho | b7611a8 | 2015-09-21 12:16:54 +0900 | [diff] [blame] | 469 | struct set_mac_addr *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 470 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 471 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 472 | struct wid wid; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 473 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 474 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 475 | if (!mac_buf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 476 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 477 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 478 | } |
Leo Kim | ae5e452 | 2015-10-28 15:59:31 +0900 | [diff] [blame^] | 479 | memcpy(mac_buf, pstrHostIfSetMacAddress->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 480 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 481 | wid.id = (u16)WID_MAC_ADDR; |
| 482 | wid.type = WID_STR; |
| 483 | wid.val = mac_buf; |
| 484 | wid.size = ETH_ALEN; |
| 485 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 486 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 487 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 488 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 489 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 490 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 491 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 492 | } |
| 493 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 494 | kfree(mac_buf); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 495 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 496 | } |
| 497 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 498 | static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv, |
Tony Cho | fcd27c5 | 2015-09-21 12:16:55 +0900 | [diff] [blame] | 499 | struct get_mac_addr *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 500 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 501 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 502 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 503 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 504 | wid.id = (u16)WID_MAC_ADDR; |
| 505 | wid.type = WID_STR; |
| 506 | wid.val = pstrHostIfGetMacAddress->u8MacAddress; |
| 507 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 508 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 509 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 510 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 511 | |
| 512 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 513 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 514 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 515 | } |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 516 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 517 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 518 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 519 | } |
| 520 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 521 | static s32 Handle_CfgParam(struct host_if_drv *hif_drv, |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 522 | struct cfg_param_attr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 523 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 524 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 525 | struct wid strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 526 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 527 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 528 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 529 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 530 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 531 | |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 532 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & BSS_TYPE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 533 | if (strHostIFCfgParamAttr->cfg_attr_info.bss_type < 6) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 534 | strWIDList[u8WidCnt].id = WID_BSS_TYPE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 535 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.bss_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 536 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 537 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 538 | hif_drv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 539 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 540 | PRINT_ER("check value 6 over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 541 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 542 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 543 | } |
| 544 | u8WidCnt++; |
| 545 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 546 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTH_TYPE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 547 | if ((strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 1 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 2 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 548 | strWIDList[u8WidCnt].id = WID_AUTH_TYPE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 549 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 550 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 551 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 552 | hif_drv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 553 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 554 | PRINT_ER("Impossible value \n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 555 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 556 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 557 | } |
| 558 | u8WidCnt++; |
| 559 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 560 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 561 | if (strHostIFCfgParamAttr->cfg_attr_info.auth_timeout > 0 && strHostIFCfgParamAttr->cfg_attr_info.auth_timeout < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 562 | strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 563 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 564 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 565 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 566 | hif_drv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 567 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 568 | PRINT_ER("Range(1 ~ 65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 569 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 570 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 571 | } |
| 572 | u8WidCnt++; |
| 573 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 574 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & POWER_MANAGEMENT) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 575 | if (strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode < 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 576 | strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 577 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 578 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 579 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 580 | hif_drv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 581 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 582 | PRINT_ER("Invalide power mode\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 583 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 584 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 585 | } |
| 586 | u8WidCnt++; |
| 587 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 588 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_SHORT) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 589 | if ((strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit < 256)) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 590 | strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 591 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 592 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 593 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 594 | hif_drv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 595 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 596 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 597 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 598 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 599 | } |
| 600 | u8WidCnt++; |
| 601 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 602 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_LONG) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 603 | if ((strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit < 256)) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 604 | strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 605 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 606 | |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 607 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 608 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 609 | hif_drv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 610 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 611 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 612 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 613 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 614 | } |
| 615 | u8WidCnt++; |
| 616 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 617 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & FRAG_THRESHOLD) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 618 | if (strHostIFCfgParamAttr->cfg_attr_info.frag_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.frag_threshold < 7937) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 619 | strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 620 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 621 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 622 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 623 | hif_drv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 624 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 625 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 626 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 627 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 628 | } |
| 629 | u8WidCnt++; |
| 630 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 631 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RTS_THRESHOLD) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 632 | if (strHostIFCfgParamAttr->cfg_attr_info.rts_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.rts_threshold < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 633 | strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 634 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 635 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 636 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 637 | hif_drv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 638 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 639 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 640 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 641 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 642 | } |
| 643 | u8WidCnt++; |
| 644 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 645 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & PREAMBLE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 646 | if (strHostIFCfgParamAttr->cfg_attr_info.preamble_type < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 647 | strWIDList[u8WidCnt].id = WID_PREAMBLE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 648 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.preamble_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 649 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 650 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 651 | hif_drv->strCfgValues.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 652 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 653 | PRINT_ER("Preamle Range(0~2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 654 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 655 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 656 | } |
| 657 | u8WidCnt++; |
| 658 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 659 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 660 | if (strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 661 | strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 662 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 663 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 664 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 665 | hif_drv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 666 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 667 | PRINT_ER("Short slot(2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 668 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 669 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 670 | } |
| 671 | u8WidCnt++; |
| 672 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 673 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 674 | if (strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 675 | strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 676 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 677 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 678 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 679 | hif_drv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 680 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 681 | PRINT_ER("TXOP prot disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 682 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 683 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 684 | } |
| 685 | u8WidCnt++; |
| 686 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 687 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & BEACON_INTERVAL) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 688 | if (strHostIFCfgParamAttr->cfg_attr_info.beacon_interval > 0 && strHostIFCfgParamAttr->cfg_attr_info.beacon_interval < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 689 | strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 690 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 691 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 692 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 693 | hif_drv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 694 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 695 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 696 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 697 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 698 | } |
| 699 | u8WidCnt++; |
| 700 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 701 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & DTIM_PERIOD) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 702 | if (strHostIFCfgParamAttr->cfg_attr_info.dtim_period > 0 && strHostIFCfgParamAttr->cfg_attr_info.dtim_period < 256) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 703 | strWIDList[u8WidCnt].id = WID_DTIM_PERIOD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 704 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.dtim_period; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 705 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 706 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 707 | hif_drv->strCfgValues.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 708 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 709 | PRINT_ER("DTIM range(1~255) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 710 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 711 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 712 | } |
| 713 | u8WidCnt++; |
| 714 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 715 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 716 | if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 717 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 718 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 719 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 720 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 721 | hif_drv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 722 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 723 | PRINT_ER("Site survey disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 724 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 725 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 726 | } |
| 727 | u8WidCnt++; |
| 728 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 729 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 730 | if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 731 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 732 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 733 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 734 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 735 | hif_drv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 736 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 737 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 738 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 739 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 740 | } |
| 741 | u8WidCnt++; |
| 742 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 743 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & ACTIVE_SCANTIME) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 744 | if (strHostIFCfgParamAttr->cfg_attr_info.active_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.active_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 745 | strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 746 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 747 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 748 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 749 | hif_drv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 750 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 751 | PRINT_ER("Active scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 752 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 753 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 754 | } |
| 755 | u8WidCnt++; |
| 756 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 757 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & PASSIVE_SCANTIME) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 758 | if (strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 759 | strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 760 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 761 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 762 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 763 | hif_drv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 764 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 765 | PRINT_ER("Passive scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 766 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 767 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 768 | } |
| 769 | u8WidCnt++; |
| 770 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 771 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & CURRENT_TX_RATE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 772 | enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->cfg_attr_info.curr_tx_rate; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 773 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 774 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 775 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 776 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 777 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 778 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 779 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 780 | strWIDList[u8WidCnt].id = WID_CURRENT_TX_RATE; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 781 | strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 782 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 783 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 784 | hif_drv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 785 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 786 | PRINT_ER("out of TX rate\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 787 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 788 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 789 | } |
| 790 | u8WidCnt++; |
| 791 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 792 | |
| 793 | result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 794 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 795 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 796 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 797 | PRINT_ER("Error in setting CFG params\n"); |
| 798 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 799 | ERRORHANDLER: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 800 | up(&hif_drv->gtOsCfgValuesSem); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 801 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 802 | } |
| 803 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 804 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 805 | { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 806 | g_wilc_initialized = 0; |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 807 | up(&hif_sema_wait_response); |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 808 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 809 | } |
| 810 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 811 | static s32 Handle_Scan(struct host_if_drv *hif_drv, |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 812 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 813 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 814 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 815 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 816 | u32 u32WidsCount = 0; |
| 817 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 818 | u8 *pu8Buffer; |
| 819 | u8 valuesize = 0; |
| 820 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 821 | |
| 822 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 823 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 824 | |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 825 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = pstrHostIFscanAttr->result; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 826 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid = pstrHostIFscanAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 827 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 828 | if ((hif_drv->enuHostIFstate >= HOST_IF_SCANNING) && (hif_drv->enuHostIFstate < HOST_IF_CONNECTED)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 829 | PRINT_D(GENERIC_DBG, "Don't scan we are already in [%d] state\n", hif_drv->enuHostIFstate); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 830 | PRINT_ER("Already scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 831 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 832 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 833 | } |
| 834 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 835 | if (g_obtainingIP || connecting) { |
| 836 | 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] | 837 | PRINT_ER("Don't do obss scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 838 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 839 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 840 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 841 | |
| 842 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 843 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 844 | hif_drv->strWILC_UsrScanReq.u32RcvdChCount = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 845 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 846 | strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 847 | strWIDList[u32WidsCount].type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 848 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 849 | for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) |
| 850 | valuesize += ((pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 851 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 852 | strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 853 | if (strWIDList[u32WidsCount].val) { |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 854 | pu8Buffer = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 855 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 856 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 857 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 858 | PRINT_D(HOSTINF_DBG, "In Handle_ProbeRequest number of ssid %d\n", pstrHostIFscanAttr->hidden_network.u8ssidnum); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 859 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 860 | for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) { |
| 861 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 862 | memcpy(pu8Buffer, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen); |
| 863 | pu8Buffer += pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 864 | } |
| 865 | |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 866 | strWIDList[u32WidsCount].size = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 867 | u32WidsCount++; |
| 868 | } |
| 869 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 870 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 871 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_PROBE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 872 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 873 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ies; |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 874 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ies_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 875 | u32WidsCount++; |
| 876 | } |
| 877 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 878 | strWIDList[u32WidsCount].id = WID_SCAN_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 879 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 880 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 881 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 882 | u32WidsCount++; |
| 883 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 884 | strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 885 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 886 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 887 | if (pstrHostIFscanAttr->ch_freq_list && |
| 888 | pstrHostIFscanAttr->ch_list_len > 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 889 | int i; |
| 890 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 891 | for (i = 0; i < pstrHostIFscanAttr->ch_list_len; i++) { |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 892 | if (pstrHostIFscanAttr->ch_freq_list[i] > 0) |
| 893 | pstrHostIFscanAttr->ch_freq_list[i] = pstrHostIFscanAttr->ch_freq_list[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 894 | } |
| 895 | } |
| 896 | |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 897 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ch_freq_list; |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 898 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ch_list_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 899 | u32WidsCount++; |
| 900 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 901 | strWIDList[u32WidsCount].id = WID_START_SCAN_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 902 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 903 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 904 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->src; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 905 | u32WidsCount++; |
| 906 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 907 | if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 908 | scan_while_connected = true; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 909 | else if (hif_drv->enuHostIFstate == HOST_IF_IDLE) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 910 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 911 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 912 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 913 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 914 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 915 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 916 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 917 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 918 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 919 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 920 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 921 | if (result) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 922 | del_timer(&hif_drv->hScanTimer); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 923 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 924 | } |
| 925 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 926 | kfree(pstrHostIFscanAttr->ch_freq_list); |
| 927 | pstrHostIFscanAttr->ch_freq_list = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 928 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 929 | kfree(pstrHostIFscanAttr->ies); |
| 930 | pstrHostIFscanAttr->ies = NULL; |
| 931 | kfree(pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo); |
| 932 | pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 933 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 934 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 935 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 936 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 937 | } |
| 938 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 939 | static s32 Handle_ScanDone(struct host_if_drv *hif_drv, |
| 940 | enum scan_event enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 941 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 942 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 943 | u8 u8abort_running_scan; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 944 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 945 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 946 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 947 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 948 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 949 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 950 | u8abort_running_scan = 1; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 951 | wid.id = (u16)WID_ABORT_RUNNING_SCAN; |
| 952 | wid.type = WID_CHAR; |
| 953 | wid.val = (s8 *)&u8abort_running_scan; |
| 954 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 955 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 956 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 957 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 958 | |
| 959 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 960 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 961 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 962 | } |
| 963 | } |
| 964 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 965 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 966 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 967 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 968 | } |
| 969 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 970 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
| 971 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(enuEvent, NULL, |
| 972 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 973 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 974 | } |
| 975 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 976 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 977 | } |
| 978 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 979 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 980 | static s32 Handle_Connect(struct host_if_drv *hif_drv, |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 981 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 982 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 983 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 984 | struct wid strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 985 | u32 u32WidsCount = 0, dummyval = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 986 | u8 *pu8CurrByte = NULL; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 987 | struct join_bss_param *ptstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 988 | |
| 989 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 990 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 991 | if (memcmp(pstrHostIFconnectAttr->bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 992 | result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 993 | PRINT_ER("Trying to connect to an already connected AP, Discard connect request\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 994 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 995 | } |
| 996 | |
| 997 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 998 | |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 999 | ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->params; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1000 | if (!ptstrJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1001 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1002 | result = -ENOENT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1003 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1004 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1005 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1006 | if (pstrHostIFconnectAttr->bssid) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1007 | hif_drv->strWILC_UsrConnReq.pu8bssid = kmalloc(6, GFP_KERNEL); |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1008 | memcpy(hif_drv->strWILC_UsrConnReq.pu8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1009 | } |
| 1010 | |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 1011 | hif_drv->strWILC_UsrConnReq.ssidLen = pstrHostIFconnectAttr->ssid_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1012 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 1013 | hif_drv->strWILC_UsrConnReq.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL); |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1014 | memcpy(hif_drv->strWILC_UsrConnReq.pu8ssid, |
| 1015 | pstrHostIFconnectAttr->ssid, |
| 1016 | pstrHostIFconnectAttr->ssid_len); |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 1017 | hif_drv->strWILC_UsrConnReq.pu8ssid[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1018 | } |
| 1019 | |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 1020 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = pstrHostIFconnectAttr->ies_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1021 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 1022 | hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1023 | memcpy(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1024 | pstrHostIFconnectAttr->ies, |
| 1025 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1026 | } |
| 1027 | |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 1028 | hif_drv->strWILC_UsrConnReq.u8security = pstrHostIFconnectAttr->security; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 1029 | hif_drv->strWILC_UsrConnReq.tenuAuth_type = pstrHostIFconnectAttr->auth_type; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 1030 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult = pstrHostIFconnectAttr->result; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 1031 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid = pstrHostIFconnectAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1032 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1033 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1034 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1035 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1036 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1037 | u32WidsCount++; |
| 1038 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1039 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1040 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1041 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1042 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1043 | u32WidsCount++; |
| 1044 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1045 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1046 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1047 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1048 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1049 | u32WidsCount++; |
| 1050 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1051 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1052 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1053 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1054 | strWIDList[u32WidsCount].val = hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs; |
| 1055 | strWIDList[u32WidsCount].size = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1056 | u32WidsCount++; |
| 1057 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1058 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1059 | info_element_size = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1060 | info_element = kmalloc(info_element_size, GFP_KERNEL); |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1061 | memcpy(info_element, hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1062 | info_element_size); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1063 | } |
| 1064 | } |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1065 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1066 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1067 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1068 | strWIDList[u32WidsCount].val = (s8 *)&hif_drv->strWILC_UsrConnReq.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1069 | u32WidsCount++; |
| 1070 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1071 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) |
Leo Kim | 1bd9d44 | 2015-10-15 13:25:11 +0900 | [diff] [blame] | 1072 | mode_11i = hif_drv->strWILC_UsrConnReq.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1073 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1074 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", hif_drv->strWILC_UsrConnReq.u8security); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1075 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1076 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1077 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1078 | strWIDList[u32WidsCount].size = sizeof(char); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1079 | strWIDList[u32WidsCount].val = (s8 *)(&hif_drv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1080 | u32WidsCount++; |
| 1081 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1082 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 1083 | auth_type = (u8)hif_drv->strWILC_UsrConnReq.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1084 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1085 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", hif_drv->strWILC_UsrConnReq.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1086 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 1087 | hif_drv->strWILC_UsrConnReq.pu8ssid, pstrHostIFconnectAttr->ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1088 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1089 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1090 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1091 | strWIDList[u32WidsCount].size = 112; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1092 | strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1093 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1094 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1095 | join_req_size = strWIDList[u32WidsCount].size; |
| 1096 | join_req = kmalloc(join_req_size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1097 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1098 | if (!strWIDList[u32WidsCount].val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1099 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1100 | goto ERRORHANDLER; |
| 1101 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1102 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1103 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1104 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1105 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 1106 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len); |
| 1107 | pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1108 | } |
| 1109 | pu8CurrByte += MAX_SSID_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1110 | *(pu8CurrByte++) = INFRASTRUCTURE; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1111 | |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 1112 | if ((pstrHostIFconnectAttr->ch >= 1) && (pstrHostIFconnectAttr->ch <= 14)) { |
| 1113 | *(pu8CurrByte++) = pstrHostIFconnectAttr->ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1114 | } else { |
| 1115 | PRINT_ER("Channel out of range\n"); |
| 1116 | *(pu8CurrByte++) = 0xFF; |
| 1117 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1118 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1119 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1120 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1121 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1122 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1123 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1124 | pu8CurrByte += 6; |
| 1125 | |
Tony Cho | c0f52fb | 2015-10-20 17:10:46 +0900 | [diff] [blame] | 1126 | if (pstrHostIFconnectAttr->bssid) |
| 1127 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
| 1128 | pu8CurrByte += 6; |
| 1129 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1130 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1131 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1132 | PRINT_D(HOSTINF_DBG, "* Beacon Period %d*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1133 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1134 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1135 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1136 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1137 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1138 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1139 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1140 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1141 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1142 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1143 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1144 | hif_drv->strWILC_UsrConnReq.IsHTCapable = ptstrJoinBssParam->ht_capable; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1145 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1146 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1147 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1148 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1149 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1150 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1151 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1152 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1153 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1154 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1155 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1156 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1157 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1158 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1159 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1160 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1161 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1162 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1163 | *(pu8CurrByte++) = ptstrJoinBssParam->noa_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1164 | |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1165 | if (ptstrJoinBssParam->noa_enabled) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1166 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1167 | |
| 1168 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1169 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1170 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1171 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1172 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1173 | *(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 1174 | *(pu8CurrByte++) = ptstrJoinBssParam->idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1175 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1176 | if (ptstrJoinBssParam->opp_enabled) |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 1177 | *(pu8CurrByte++) = ptstrJoinBssParam->ct_window; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1178 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 1179 | *(pu8CurrByte++) = ptstrJoinBssParam->cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1180 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 1181 | memcpy(pu8CurrByte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration)); |
| 1182 | pu8CurrByte += sizeof(ptstrJoinBssParam->duration); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1183 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 1184 | memcpy(pu8CurrByte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval)); |
| 1185 | pu8CurrByte += sizeof(ptstrJoinBssParam->interval); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1186 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 1187 | memcpy(pu8CurrByte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time)); |
| 1188 | pu8CurrByte += sizeof(ptstrJoinBssParam->start_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1189 | } else |
| 1190 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1191 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1192 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1193 | u32WidsCount++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1194 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1195 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1196 | memcpy(join_req, pu8CurrByte, join_req_size); |
Leo Kim | 870515c | 2015-10-15 13:25:15 +0900 | [diff] [blame] | 1197 | join_req_drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1198 | } |
| 1199 | |
| 1200 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1201 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1202 | if (pstrHostIFconnectAttr->bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1203 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1204 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1205 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid); |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1206 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1207 | } |
| 1208 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1209 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1210 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1211 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1212 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1213 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1214 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1215 | } else { |
| 1216 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1217 | hif_drv->enuHostIFstate = HOST_IF_WAITING_CONN_RESP; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1218 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1219 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1220 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1221 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1222 | tstrConnectInfo strConnectInfo; |
| 1223 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1224 | del_timer(&hif_drv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1225 | |
| 1226 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 1227 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1228 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1229 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1230 | if (pstrHostIFconnectAttr->result) { |
| 1231 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1232 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1233 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1234 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 1235 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->ies_len; |
| 1236 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1237 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1238 | pstrHostIFconnectAttr->ies, |
| 1239 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1240 | } |
| 1241 | |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 1242 | pstrHostIFconnectAttr->result(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1243 | &strConnectInfo, |
| 1244 | MAC_DISCONNECTED, |
| 1245 | NULL, |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 1246 | pstrHostIFconnectAttr->arg); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1247 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1248 | kfree(strConnectInfo.pu8ReqIEs); |
| 1249 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1250 | |
| 1251 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1252 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1253 | } |
| 1254 | } |
| 1255 | |
| 1256 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1257 | kfree(pstrHostIFconnectAttr->bssid); |
| 1258 | pstrHostIFconnectAttr->bssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1259 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1260 | kfree(pstrHostIFconnectAttr->ssid); |
| 1261 | pstrHostIFconnectAttr->ssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1262 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1263 | kfree(pstrHostIFconnectAttr->ies); |
| 1264 | pstrHostIFconnectAttr->ies = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1265 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1266 | kfree(pu8CurrByte); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1267 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1268 | } |
| 1269 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1270 | static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1271 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1272 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1273 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1274 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1275 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1276 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1277 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1278 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1279 | strWIDList[u32WidsCount].val = info_element; |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1280 | strWIDList[u32WidsCount].size = info_element_size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1281 | u32WidsCount++; |
| 1282 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1283 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1284 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1285 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 1bd9d44 | 2015-10-15 13:25:11 +0900 | [diff] [blame] | 1286 | strWIDList[u32WidsCount].val = (s8 *)(&(mode_11i)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1287 | u32WidsCount++; |
| 1288 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1289 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1290 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1291 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 1292 | strWIDList[u32WidsCount].val = (s8 *)(&auth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1293 | u32WidsCount++; |
| 1294 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1295 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1296 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1297 | strWIDList[u32WidsCount].size = join_req_size; |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1298 | strWIDList[u32WidsCount].val = (s8 *)join_req; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1299 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1300 | |
| 1301 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 1302 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 1303 | |
| 1304 | u32WidsCount++; |
| 1305 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1306 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1307 | get_id_from_handler(join_req_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1308 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1309 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1310 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1311 | } |
| 1312 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1313 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1314 | } |
| 1315 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1316 | static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1317 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1318 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1319 | tstrConnectInfo strConnectInfo; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1320 | struct wid wid; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1321 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1322 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1323 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1324 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1325 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1326 | } |
| 1327 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1328 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1329 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1330 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1331 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1332 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1333 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1334 | if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult) { |
| 1335 | if (hif_drv->strWILC_UsrConnReq.pu8bssid) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1336 | memcpy(strConnectInfo.au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1337 | hif_drv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1338 | } |
| 1339 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1340 | if (hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1341 | strConnectInfo.ReqIEsLen = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1342 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1343 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1344 | hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1345 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1346 | } |
| 1347 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1348 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1349 | &strConnectInfo, |
| 1350 | MAC_DISCONNECTED, |
| 1351 | NULL, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1352 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1353 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1354 | kfree(strConnectInfo.pu8ReqIEs); |
| 1355 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1356 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1357 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1358 | } |
| 1359 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1360 | wid.id = (u16)WID_DISCONNECT; |
| 1361 | wid.type = WID_CHAR; |
| 1362 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1363 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1364 | |
| 1365 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1366 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1367 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1368 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1369 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1370 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1371 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1372 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 1373 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 1374 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 1375 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 1376 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1377 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1378 | eth_zero_addr(u8ConnectedSSID); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1379 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1380 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1381 | kfree(join_req); |
| 1382 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1383 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1384 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1385 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1386 | kfree(info_element); |
| 1387 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1388 | } |
| 1389 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1390 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1391 | } |
| 1392 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1393 | static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1394 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1395 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1396 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1397 | bool bNewNtwrkFound; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1398 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1399 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 1400 | void *pJoinParams = NULL; |
| 1401 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1402 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1403 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 1404 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1405 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1406 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 1407 | parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1408 | if ((!pstrNetworkInfo) || |
| 1409 | (!hif_drv->strWILC_UsrScanReq.pfUserScanResult)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1410 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1411 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1412 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1413 | } |
| 1414 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1415 | for (i = 0; i < hif_drv->strWILC_UsrScanReq.u32RcvdChCount; i++) { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1416 | if ((hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid) && |
| 1417 | (pstrNetworkInfo->au8bssid)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1418 | if (memcmp(hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1419 | pstrNetworkInfo->au8bssid, 6) == 0) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1420 | if (pstrNetworkInfo->s8rssi <= hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1421 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 1422 | goto done; |
| 1423 | } else { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1424 | hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1425 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1426 | break; |
| 1427 | } |
| 1428 | } |
| 1429 | } |
| 1430 | } |
| 1431 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 1432 | if (bNewNtwrkFound) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1433 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 1434 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1435 | if (hif_drv->strWILC_UsrScanReq.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 1436 | hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1437 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1438 | if (hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid && |
| 1439 | pstrNetworkInfo->au8bssid) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1440 | memcpy(hif_drv->strWILC_UsrScanReq.astrFoundNetworkInfo[hif_drv->strWILC_UsrScanReq.u32RcvdChCount].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1441 | pstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1442 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1443 | hif_drv->strWILC_UsrScanReq.u32RcvdChCount++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1444 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1445 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1446 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1447 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1448 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 1449 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1450 | pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1451 | } |
| 1452 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1453 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1454 | } |
| 1455 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1456 | pstrNetworkInfo->bNewNetwork = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1457 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 1458 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1459 | } |
| 1460 | } |
| 1461 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1462 | done: |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1463 | kfree(pstrRcvdNetworkInfo->buffer); |
| 1464 | pstrRcvdNetworkInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1465 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1466 | if (pstrNetworkInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1467 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1468 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1469 | } |
| 1470 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1471 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1472 | } |
| 1473 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1474 | static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 1475 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1476 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1477 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1478 | u8 u8MsgType = 0; |
| 1479 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1480 | u16 u16MsgLen = 0; |
| 1481 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1482 | u8 u8WidLen = 0; |
| 1483 | u8 u8MacStatus; |
| 1484 | u8 u8MacStatusReasonCode; |
| 1485 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1486 | tstrConnectInfo strConnectInfo; |
| 1487 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1488 | s32 s32Err = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1489 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1490 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1491 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 1492 | return -ENODEV; |
| 1493 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1494 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", hif_drv->enuHostIFstate, |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1495 | pstrRcvdGnrlAsyncInfo->buffer[7]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1496 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1497 | if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || |
| 1498 | (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) || |
| 1499 | hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1500 | if (!pstrRcvdGnrlAsyncInfo->buffer || |
| 1501 | !hif_drv->strWILC_UsrConnReq.pfUserConnectResult) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1502 | PRINT_ER("driver is null\n"); |
| 1503 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1504 | } |
| 1505 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1506 | u8MsgType = pstrRcvdGnrlAsyncInfo->buffer[0]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1507 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1508 | if ('I' != u8MsgType) { |
| 1509 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1510 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1511 | } |
| 1512 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1513 | u8MsgID = pstrRcvdGnrlAsyncInfo->buffer[1]; |
| 1514 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[2], pstrRcvdGnrlAsyncInfo->buffer[3]); |
| 1515 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[4], pstrRcvdGnrlAsyncInfo->buffer[5]); |
| 1516 | u8WidLen = pstrRcvdGnrlAsyncInfo->buffer[6]; |
| 1517 | u8MacStatus = pstrRcvdGnrlAsyncInfo->buffer[7]; |
| 1518 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->buffer[8]; |
| 1519 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1520 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1521 | if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1522 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1523 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 1524 | |
| 1525 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 1526 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1527 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1528 | |
| 1529 | if (u8MacStatus == MAC_CONNECTED) { |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1530 | memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1531 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1532 | host_int_get_assoc_res_info(hif_drv, |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1533 | rcv_assoc_resp, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1534 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 1535 | &u32RcvdAssocRespInfoLen); |
| 1536 | |
| 1537 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 1538 | |
| 1539 | if (u32RcvdAssocRespInfoLen != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1540 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1541 | s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1542 | &pstrConnectRespInfo); |
| 1543 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1544 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1545 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1546 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 1547 | |
| 1548 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 1549 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1550 | if (pstrConnectRespInfo->pu8RespIEs) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1551 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1552 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1553 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1554 | pstrConnectRespInfo->u16RespIEsLen); |
| 1555 | } |
| 1556 | } |
| 1557 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1558 | if (pstrConnectRespInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1559 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 1560 | pstrConnectRespInfo = NULL; |
| 1561 | } |
| 1562 | } |
| 1563 | } |
| 1564 | } |
| 1565 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1566 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1567 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1568 | PRINT_ER("Received MAC status is MAC_CONNECTED while the received status code in Asoc Resp is not SUCCESSFUL_STATUSCODE\n"); |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1569 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1570 | |
| 1571 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 1572 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1573 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1574 | } |
| 1575 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1576 | if (hif_drv->strWILC_UsrConnReq.pu8bssid) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1577 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1578 | memcpy(strConnectInfo.au8bssid, hif_drv->strWILC_UsrConnReq.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1579 | |
| 1580 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1581 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1582 | memcpy(hif_drv->au8AssociatedBSSID, |
| 1583 | hif_drv->strWILC_UsrConnReq.pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1584 | } |
| 1585 | } |
| 1586 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1587 | if (hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1588 | strConnectInfo.ReqIEsLen = hif_drv->strWILC_UsrConnReq.ConnReqIEsLen; |
| 1589 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->strWILC_UsrConnReq.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1590 | memcpy(strConnectInfo.pu8ReqIEs, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1591 | hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs, |
| 1592 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1593 | } |
| 1594 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1595 | del_timer(&hif_drv->hConnectTimer); |
| 1596 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1597 | &strConnectInfo, |
| 1598 | u8MacStatus, |
| 1599 | NULL, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1600 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1601 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1602 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1603 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1604 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1605 | |
| 1606 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1607 | hif_drv->enuHostIFstate = HOST_IF_CONNECTED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1608 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1609 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1610 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 1611 | mod_timer(&hDuringIpTimer, |
| 1612 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1613 | } else { |
| 1614 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1615 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1616 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1617 | } |
| 1618 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1619 | kfree(strConnectInfo.pu8RespIEs); |
| 1620 | strConnectInfo.pu8RespIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1621 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1622 | kfree(strConnectInfo.pu8ReqIEs); |
| 1623 | strConnectInfo.pu8ReqIEs = NULL; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1624 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 1625 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 1626 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 1627 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 1628 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1629 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1630 | (hif_drv->enuHostIFstate == HOST_IF_CONNECTED)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1631 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 1632 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1633 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1634 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1635 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1636 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1637 | del_timer(&hif_drv->hScanTimer); |
| 1638 | Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1639 | } |
| 1640 | |
| 1641 | strDisconnectNotifInfo.u16reason = 0; |
| 1642 | strDisconnectNotifInfo.ie = NULL; |
| 1643 | strDisconnectNotifInfo.ie_len = 0; |
| 1644 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1645 | if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1646 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1647 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1648 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1649 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1650 | NULL, |
| 1651 | 0, |
| 1652 | &strDisconnectNotifInfo, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1653 | hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1654 | |
| 1655 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1656 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1657 | } |
| 1658 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1659 | eth_zero_addr(hif_drv->au8AssociatedBSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1660 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1661 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 1662 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 1663 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 1664 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 1665 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1666 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1667 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1668 | kfree(join_req); |
| 1669 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1670 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1671 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1672 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1673 | kfree(info_element); |
| 1674 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1675 | } |
| 1676 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1677 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1678 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1679 | |
| 1680 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1681 | (hif_drv->strWILC_UsrScanReq.pfUserScanResult)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1682 | 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] | 1683 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1684 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1685 | del_timer(&hif_drv->hScanTimer); |
| 1686 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) |
| 1687 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1688 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1689 | } |
| 1690 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1691 | kfree(pstrRcvdGnrlAsyncInfo->buffer); |
| 1692 | pstrRcvdGnrlAsyncInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1693 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1694 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1695 | } |
| 1696 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1697 | static int Handle_Key(struct host_if_drv *hif_drv, |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 1698 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1699 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1700 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1701 | struct wid wid; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1702 | struct wid strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1703 | u8 i; |
| 1704 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1705 | s8 s8idxarray[1]; |
| 1706 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1707 | |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 1708 | switch (pstrHostIFkeyAttr->type) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1709 | case WEP: |
| 1710 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1711 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1712 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1713 | PRINT_D(GENERIC_DBG, "ID Hostint is %d\n", pstrHostIFkeyAttr->attr.wep.index); |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1714 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1715 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1716 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1717 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1718 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1719 | strWIDList[1].id = WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1720 | strWIDList[1].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1721 | strWIDList[1].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1722 | strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1723 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1724 | strWIDList[2].id = (u16)WID_KEY_ID; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1725 | strWIDList[2].type = WID_CHAR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1726 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1727 | strWIDList[2].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1728 | strWIDList[2].size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1729 | |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 1730 | pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key, |
| 1731 | pstrHostIFkeyAttr->attr.wep.key_len, |
| 1732 | GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1733 | |
| 1734 | if (pu8keybuf == NULL) { |
| 1735 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1736 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1737 | } |
| 1738 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1739 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1740 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1741 | strWIDList[3].id = (u16)WID_WEP_KEY_VALUE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1742 | strWIDList[3].type = WID_STR; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1743 | strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1744 | strWIDList[3].val = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1745 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1746 | result = send_config_pkt(SET_CFG, strWIDList, 4, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1747 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1748 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1749 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1750 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1751 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1752 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1753 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1754 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1755 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1756 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1757 | } |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1758 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index; |
| 1759 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1); |
| 1760 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->attr.wep.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1761 | pstrHostIFkeyAttr->attr.wep.key_len); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1762 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1763 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1764 | wid.id = (u16)WID_ADD_WEP_KEY; |
| 1765 | wid.type = WID_STR; |
| 1766 | wid.val = (s8 *)pu8keybuf; |
| 1767 | wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1768 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1769 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1770 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1771 | kfree(pu8keybuf); |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1772 | } else if (pstrHostIFkeyAttr->action & REMOVEKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1773 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1774 | wid.id = (u16)WID_REMOVE_WEP_KEY; |
| 1775 | wid.type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1776 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1777 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1778 | wid.val = s8idxarray; |
| 1779 | wid.size = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1780 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1781 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1782 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1783 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1784 | wid.id = (u16)WID_KEY_ID; |
| 1785 | wid.type = WID_CHAR; |
| 1786 | wid.val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
| 1787 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1788 | |
| 1789 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 1790 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1791 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1792 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1793 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1794 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1795 | break; |
| 1796 | |
| 1797 | case WPARxGtk: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1798 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1799 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1800 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1801 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1802 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1803 | goto _WPARxGtk_end_case_; |
| 1804 | } |
| 1805 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1806 | if (pstrHostIFkeyAttr->attr.wpa.seq) |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1807 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1808 | |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1809 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1810 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1811 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1812 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1813 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1814 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1815 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1816 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1817 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1818 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1819 | strWIDList[1].id = (u16)WID_ADD_RX_GTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1820 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1821 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1822 | strWIDList[1].size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1823 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1824 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1825 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1826 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1827 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1828 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1829 | } |
| 1830 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1831 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1832 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 1833 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1834 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1835 | if (pu8keybuf == NULL) { |
| 1836 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1837 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1838 | goto _WPARxGtk_end_case_; |
| 1839 | } |
| 1840 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1841 | if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) |
| 1842 | memcpy(pu8keybuf, hif_drv->au8AssociatedBSSID, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1843 | else |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1844 | 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] | 1845 | |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1846 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1847 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1848 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1849 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1850 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1851 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1852 | wid.id = (u16)WID_ADD_RX_GTK; |
| 1853 | wid.type = WID_STR; |
| 1854 | wid.val = (s8 *)pu8keybuf; |
| 1855 | wid.size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1856 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1857 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1858 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1859 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1860 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1861 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1862 | } |
| 1863 | _WPARxGtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1864 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1865 | kfree(pstrHostIFkeyAttr->attr.wpa.seq); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1866 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1867 | return ret; |
| 1868 | |
| 1869 | break; |
| 1870 | |
| 1871 | case WPAPtk: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1872 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1873 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1874 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1875 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1876 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1877 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1878 | } |
| 1879 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1880 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1881 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1882 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1883 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1884 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1885 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1886 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1887 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1888 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1889 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1890 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1891 | strWIDList[1].id = (u16)WID_ADD_PTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1892 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1893 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1894 | strWIDList[1].size = PTK_KEY_MSG_LEN + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1895 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1896 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1897 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1898 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1899 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1900 | } |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1901 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1902 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1903 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1904 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1905 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1906 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1907 | } |
| 1908 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1909 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1910 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1911 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1912 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1913 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1914 | wid.id = (u16)WID_ADD_PTK; |
| 1915 | wid.type = WID_STR; |
| 1916 | wid.val = (s8 *)pu8keybuf; |
| 1917 | wid.size = PTK_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1918 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1919 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1920 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1921 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1922 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1923 | } |
| 1924 | |
| 1925 | _WPAPtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1926 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1927 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1928 | return ret; |
| 1929 | |
| 1930 | break; |
| 1931 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1932 | case PMKSA: |
| 1933 | |
| 1934 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 1935 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1936 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1937 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1938 | PRINT_ER("No buffer to send PMKSA Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1939 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1940 | } |
| 1941 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1942 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1943 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1944 | for (i = 0; i < pstrHostIFkeyAttr->attr.pmkid.numpmkid; i++) { |
| 1945 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN); |
| 1946 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + ETH_ALEN + 1), pstrHostIFkeyAttr->attr.pmkid.pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1947 | } |
| 1948 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1949 | wid.id = (u16)WID_PMKID_INFO; |
| 1950 | wid.type = WID_STR; |
| 1951 | wid.val = (s8 *)pu8keybuf; |
| 1952 | wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1953 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1954 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1955 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1956 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1957 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1958 | break; |
| 1959 | } |
| 1960 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1961 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1962 | PRINT_ER("Failed to send key config packet\n"); |
| 1963 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1964 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1965 | } |
| 1966 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1967 | static void Handle_Disconnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1968 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1969 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1970 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1971 | s32 result = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1972 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1973 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1974 | wid.id = (u16)WID_DISCONNECT; |
| 1975 | wid.type = WID_CHAR; |
| 1976 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1977 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1978 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1979 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1980 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1981 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1982 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1983 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1984 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1985 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1986 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1987 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1988 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1989 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1990 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1991 | } else { |
| 1992 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 1993 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1994 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1995 | |
| 1996 | strDisconnectNotifInfo.u16reason = 0; |
| 1997 | strDisconnectNotifInfo.ie = NULL; |
| 1998 | strDisconnectNotifInfo.ie_len = 0; |
| 1999 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2000 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
| 2001 | del_timer(&hif_drv->hScanTimer); |
| 2002 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
| 2003 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2004 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2005 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2006 | } |
| 2007 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2008 | if (hif_drv->strWILC_UsrConnReq.pfUserConnectResult) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2009 | if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2010 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2011 | del_timer(&hif_drv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2012 | } |
| 2013 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2014 | hif_drv->strWILC_UsrConnReq.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 2015 | 0, &strDisconnectNotifInfo, hif_drv->strWILC_UsrConnReq.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2016 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2017 | PRINT_ER("strWILC_UsrConnReq.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2018 | } |
| 2019 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 2020 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2021 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2022 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2023 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2024 | eth_zero_addr(hif_drv->au8AssociatedBSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2025 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2026 | hif_drv->strWILC_UsrConnReq.ssidLen = 0; |
| 2027 | kfree(hif_drv->strWILC_UsrConnReq.pu8ssid); |
| 2028 | kfree(hif_drv->strWILC_UsrConnReq.pu8bssid); |
| 2029 | hif_drv->strWILC_UsrConnReq.ConnReqIEsLen = 0; |
| 2030 | kfree(hif_drv->strWILC_UsrConnReq.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2031 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2032 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 2033 | kfree(join_req); |
| 2034 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2035 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2036 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2037 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2038 | kfree(info_element); |
| 2039 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2040 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2041 | } |
| 2042 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2043 | up(&hif_drv->hSemTestDisconnectBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2044 | } |
| 2045 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2046 | void resolve_disconnect_aberration(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2047 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2048 | if (!hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2049 | return; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2050 | if ((hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) || (hif_drv->enuHostIFstate == HOST_IF_CONNECTING)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2051 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2052 | host_int_disconnect(hif_drv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2053 | } |
| 2054 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2055 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2056 | static s32 Handle_GetChnl(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2057 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2058 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2059 | struct wid wid; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2060 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2061 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 2062 | wid.type = WID_CHAR; |
| 2063 | wid.val = (s8 *)&ch_no; |
| 2064 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2065 | |
| 2066 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 2067 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2068 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2069 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2070 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2071 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2072 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2073 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2074 | } |
| 2075 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2076 | up(&hif_drv->hSemGetCHNL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2077 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2078 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2079 | } |
| 2080 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2081 | static void Handle_GetRssi(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2082 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2083 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2084 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2085 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2086 | wid.id = (u16)WID_RSSI; |
| 2087 | wid.type = WID_CHAR; |
| 2088 | wid.val = &rssi; |
| 2089 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2090 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2091 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 2092 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2093 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2094 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2095 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2096 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2097 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2098 | } |
| 2099 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2100 | up(&hif_drv->hSemGetRSSI); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2101 | } |
| 2102 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2103 | static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2104 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2105 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2106 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2107 | |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 2108 | link_speed = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2109 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2110 | wid.id = (u16)WID_LINKSPEED; |
| 2111 | wid.type = WID_CHAR; |
| 2112 | wid.val = &link_speed; |
| 2113 | wid.size = sizeof(char); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2114 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2115 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 2116 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2117 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2118 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2119 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2120 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2121 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2122 | } |
| 2123 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2124 | up(&hif_drv->hSemGetLINKSPEED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2125 | } |
| 2126 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2127 | s32 Handle_GetStatistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2128 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2129 | struct wid strWIDList[5]; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2130 | u32 u32WidsCount = 0, result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2131 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2132 | strWIDList[u32WidsCount].id = WID_LINKSPEED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2133 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2134 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2135 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u8LinkSpeed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2136 | u32WidsCount++; |
| 2137 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2138 | strWIDList[u32WidsCount].id = WID_RSSI; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2139 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2140 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2141 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->s8RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2142 | u32WidsCount++; |
| 2143 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2144 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2145 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2146 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2147 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxCount; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2148 | u32WidsCount++; |
| 2149 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2150 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2151 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2152 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2153 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32RxCount; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2154 | u32WidsCount++; |
| 2155 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2156 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2157 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2158 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2159 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxFailureCount; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2160 | u32WidsCount++; |
| 2161 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2162 | result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2163 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2164 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2165 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2166 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2167 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2168 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2169 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2170 | } |
| 2171 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2172 | static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 2173 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2174 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2175 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2176 | u8 *stamac; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2177 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2178 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2179 | wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
| 2180 | wid.type = WID_STR; |
| 2181 | wid.size = ETH_ALEN; |
| 2182 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2183 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2184 | stamac = wid.val; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2185 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2186 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2187 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 2188 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2189 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2190 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2191 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2192 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2193 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2194 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2195 | } |
| 2196 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2197 | wid.id = (u16)WID_GET_INACTIVE_TIME; |
| 2198 | wid.type = WID_INT; |
| 2199 | wid.val = (s8 *)&inactive_time; |
| 2200 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2201 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2202 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2203 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2204 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2205 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2206 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2207 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2208 | } |
| 2209 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 2210 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2211 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2212 | up(&hif_drv->hSemInactiveTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2213 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2214 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2215 | } |
| 2216 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2217 | static void Handle_AddBeacon(struct host_if_drv *hif_drv, |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 2218 | struct beacon_attr *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2219 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2220 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2221 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2222 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2223 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2224 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 2225 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2226 | wid.id = (u16)WID_ADD_BEACON; |
| 2227 | wid.type = WID_BIN; |
| 2228 | wid.size = pstrSetBeaconParam->head_len + pstrSetBeaconParam->tail_len + 16; |
| 2229 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2230 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2231 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2232 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2233 | pu8CurrByte = wid.val; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 2234 | *pu8CurrByte++ = (pstrSetBeaconParam->interval & 0xFF); |
| 2235 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 8) & 0xFF); |
| 2236 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 16) & 0xFF); |
| 2237 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2238 | |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 2239 | *pu8CurrByte++ = (pstrSetBeaconParam->dtim_period & 0xFF); |
| 2240 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 8) & 0xFF); |
| 2241 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 16) & 0xFF); |
| 2242 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2243 | |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2244 | *pu8CurrByte++ = (pstrSetBeaconParam->head_len & 0xFF); |
| 2245 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 8) & 0xFF); |
| 2246 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 16) & 0xFF); |
| 2247 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2248 | |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2249 | memcpy(pu8CurrByte, pstrSetBeaconParam->head, pstrSetBeaconParam->head_len); |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2250 | pu8CurrByte += pstrSetBeaconParam->head_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2251 | |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2252 | *pu8CurrByte++ = (pstrSetBeaconParam->tail_len & 0xFF); |
| 2253 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 8) & 0xFF); |
| 2254 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); |
| 2255 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2256 | |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2257 | if (pstrSetBeaconParam->tail > 0) |
| 2258 | memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2259 | pu8CurrByte += pstrSetBeaconParam->tail_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2260 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2261 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2262 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2263 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2264 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2265 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2266 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2267 | kfree(wid.val); |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2268 | kfree(pstrSetBeaconParam->head); |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2269 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2270 | } |
| 2271 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2272 | static void Handle_DelBeacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2273 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2274 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2275 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2276 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2277 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2278 | wid.id = (u16)WID_DEL_BEACON; |
| 2279 | wid.type = WID_CHAR; |
| 2280 | wid.size = sizeof(char); |
| 2281 | wid.val = &del_beacon; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2282 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2283 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2284 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2285 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2286 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2287 | |
| 2288 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2289 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2290 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2291 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2292 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2293 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2294 | } |
| 2295 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2296 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 2297 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2298 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2299 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2300 | |
| 2301 | pu8CurrByte = pu8Buffer; |
| 2302 | |
| 2303 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2304 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2305 | pu8CurrByte += ETH_ALEN; |
| 2306 | |
| 2307 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 2308 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 2309 | |
| 2310 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2311 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2312 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2313 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 2314 | |
| 2315 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 2316 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 2317 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 2318 | |
| 2319 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2320 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2321 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 2322 | |
| 2323 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 2324 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 2325 | |
| 2326 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 2327 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 2328 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 2329 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 2330 | |
| 2331 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 2332 | |
| 2333 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 2334 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 2335 | |
| 2336 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 2337 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 2338 | |
| 2339 | return pu8CurrByte - pu8Buffer; |
| 2340 | } |
| 2341 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2342 | static void Handle_AddStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2343 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2344 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2345 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2346 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2347 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2348 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2349 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2350 | wid.id = (u16)WID_ADD_STA; |
| 2351 | wid.type = WID_BIN; |
| 2352 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2353 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2354 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2355 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2356 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2357 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2358 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2359 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2360 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2361 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2362 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2363 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2364 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2365 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2366 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 2367 | kfree(pstrStationParam->pu8Rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2368 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2369 | } |
| 2370 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2371 | static void Handle_DelAllSta(struct host_if_drv *hif_drv, |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 2372 | struct del_all_sta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2373 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2374 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2375 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2376 | u8 *pu8CurrByte; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2377 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 2378 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2379 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2380 | wid.id = (u16)WID_DEL_ALL_STA; |
| 2381 | wid.type = WID_STR; |
| 2382 | wid.size = (pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2383 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2384 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2385 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2386 | wid.val = kmalloc((pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL); |
| 2387 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2388 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2389 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2390 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2391 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 2392 | *(pu8CurrByte++) = pstrDelAllStaParam->assoc_sta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2393 | |
| 2394 | for (i = 0; i < MAX_NUM_STA; i++) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 2395 | if (memcmp(pstrDelAllStaParam->del_all_sta[i], au8Zero_Buff, ETH_ALEN)) |
| 2396 | memcpy(pu8CurrByte, pstrDelAllStaParam->del_all_sta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2397 | else |
| 2398 | continue; |
| 2399 | |
| 2400 | pu8CurrByte += ETH_ALEN; |
| 2401 | } |
| 2402 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2403 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2404 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2405 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2406 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2407 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2408 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2409 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2410 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2411 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2412 | } |
| 2413 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2414 | static void Handle_DelStation(struct host_if_drv *hif_drv, |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 2415 | struct del_sta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2416 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2417 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2418 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2419 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2420 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2421 | wid.id = (u16)WID_REMOVE_STA; |
| 2422 | wid.type = WID_BIN; |
| 2423 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2424 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2425 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2426 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2427 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2428 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2429 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2430 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2431 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2432 | |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 2433 | memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2434 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2435 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2436 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2437 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2438 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2439 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2440 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2441 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2442 | } |
| 2443 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2444 | static void Handle_EditStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2445 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2446 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2447 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2448 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2449 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2450 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2451 | wid.id = (u16)WID_EDIT_STA; |
| 2452 | wid.type = WID_BIN; |
| 2453 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2454 | |
| 2455 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2456 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2457 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2458 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2459 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2460 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2461 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2462 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2463 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2464 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2465 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2466 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2467 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2468 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 2469 | kfree(pstrStationParam->pu8Rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2470 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2471 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2472 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2473 | static int Handle_RemainOnChan(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2474 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2475 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2476 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2477 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2478 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2479 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2480 | if (!hif_drv->u8RemainOnChan_pendingreq) { |
| 2481 | hif_drv->strHostIfRemainOnChan.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 2482 | hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 2483 | hif_drv->strHostIfRemainOnChan.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 2484 | hif_drv->strHostIfRemainOnChan.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 2485 | hif_drv->strHostIfRemainOnChan.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2486 | } else { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2487 | pstrHostIfRemainOnChan->u16Channel = hif_drv->strHostIfRemainOnChan.u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2488 | } |
| 2489 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2490 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2491 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2492 | hif_drv->u8RemainOnChan_pendingreq = 1; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2493 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2494 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2495 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2496 | if (hif_drv->enuHostIFstate == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2497 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while connecting return\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2498 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2499 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2500 | } |
| 2501 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2502 | if (g_obtainingIP || connecting) { |
| 2503 | PRINT_D(GENERIC_DBG, "[handle_scan]: Don't do obss scan until IP adresss is obtained\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2504 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2505 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2506 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2507 | |
| 2508 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 2509 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2510 | u8remain_on_chan_flag = true; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2511 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2512 | wid.type = WID_STR; |
| 2513 | wid.size = 2; |
| 2514 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2515 | if (!wid.val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2516 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2517 | goto ERRORHANDLER; |
| 2518 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2519 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2520 | wid.val[0] = u8remain_on_chan_flag; |
| 2521 | wid.val[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2522 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2523 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2524 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2525 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2526 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2527 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2528 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2529 | { |
| 2530 | P2P_LISTEN_STATE = 1; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2531 | hif_drv->hRemainOnChannel.data = (unsigned long)hif_drv; |
| 2532 | mod_timer(&hif_drv->hRemainOnChannel, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2533 | jiffies + |
| 2534 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2535 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2536 | if (hif_drv->strHostIfRemainOnChan.pRemainOnChanReady) |
| 2537 | hif_drv->strHostIfRemainOnChan.pRemainOnChanReady(hif_drv->strHostIfRemainOnChan.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2538 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2539 | if (hif_drv->u8RemainOnChan_pendingreq) |
| 2540 | hif_drv->u8RemainOnChan_pendingreq = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2541 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2542 | |
| 2543 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2544 | } |
| 2545 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2546 | static int Handle_RegisterFrame(struct host_if_drv *hif_drv, |
Tony Cho | bc37c5d | 2015-09-21 12:16:59 +0900 | [diff] [blame] | 2547 | struct reg_frame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2548 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2549 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2550 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2551 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2552 | |
| 2553 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 2554 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2555 | wid.id = (u16)WID_REGISTER_FRAME; |
| 2556 | wid.type = WID_STR; |
| 2557 | wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
| 2558 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2559 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2560 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2561 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2562 | |
| 2563 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 2564 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2565 | memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->u16FrameType, |
| 2566 | sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2567 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2568 | wid.size = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2569 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2570 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2571 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2572 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2573 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2574 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2575 | } |
| 2576 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2577 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2578 | } |
| 2579 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2580 | static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2581 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2582 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2583 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2584 | struct wid wid; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2585 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2586 | |
| 2587 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 2588 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2589 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2590 | u8remain_on_chan_flag = false; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2591 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2592 | wid.type = WID_STR; |
| 2593 | wid.size = 2; |
| 2594 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2595 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2596 | if (!wid.val) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2597 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2598 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2599 | wid.val[0] = u8remain_on_chan_flag; |
| 2600 | wid.val[1] = FALSE_FRMWR_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2601 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2602 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2603 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2604 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2605 | PRINT_ER("Failed to set remain on channel\n"); |
| 2606 | goto _done_; |
| 2607 | } |
| 2608 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2609 | if (hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired) { |
| 2610 | hif_drv->strHostIfRemainOnChan.pRemainOnChanExpired(hif_drv->strHostIfRemainOnChan.pVoid |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2611 | , pstrHostIfRemainOnChan->u32ListenSessionID); |
| 2612 | } |
| 2613 | P2P_LISTEN_STATE = 0; |
| 2614 | } else { |
| 2615 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2616 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2617 | } |
| 2618 | |
| 2619 | _done_: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2620 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2621 | } |
| 2622 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 2623 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2624 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2625 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2626 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2627 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2628 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2629 | del_timer(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2630 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2631 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2632 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2633 | msg.drv = hif_drv; |
| 2634 | msg.body.remain_on_ch.u32ListenSessionID = hif_drv->strHostIfRemainOnChan.u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2635 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2636 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 2637 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2638 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2639 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2640 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2641 | static void Handle_PowerManagement(struct host_if_drv *hif_drv, |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 2642 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2643 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2644 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2645 | struct wid wid; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2646 | s8 s8PowerMode; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2647 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2648 | wid.id = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2649 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 2650 | if (strPowerMgmtParam->enabled) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2651 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2652 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2653 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2654 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2655 | wid.val = &s8PowerMode; |
| 2656 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2657 | |
| 2658 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 2659 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2660 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2661 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2662 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2663 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2664 | } |
| 2665 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2666 | static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 2667 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2668 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2669 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2670 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2671 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2672 | |
| 2673 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 2674 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2675 | wid.id = (u16)WID_SETUP_MULTICAST_FILTER; |
| 2676 | wid.type = WID_BIN; |
| 2677 | wid.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->cnt) * ETH_ALEN); |
| 2678 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2679 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2680 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2681 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2682 | pu8CurrByte = wid.val; |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 2683 | *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); |
| 2684 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); |
| 2685 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); |
| 2686 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2687 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2688 | *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); |
| 2689 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); |
| 2690 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 16) & 0xFF); |
| 2691 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2692 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2693 | if ((strHostIfSetMulti->cnt) > 0) |
| 2694 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->cnt) * ETH_ALEN)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2695 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2696 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2697 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2698 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2699 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2700 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2701 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2702 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2703 | } |
| 2704 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2705 | static s32 Handle_AddBASession(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2706 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2707 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2708 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2709 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2710 | int AddbaTimeout = 100; |
| 2711 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2712 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2713 | 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] | 2714 | strHostIfBASessionInfo->au8Bssid[0], |
| 2715 | strHostIfBASessionInfo->au8Bssid[1], |
| 2716 | strHostIfBASessionInfo->au8Bssid[2], |
| 2717 | strHostIfBASessionInfo->u16BufferSize, |
| 2718 | strHostIfBASessionInfo->u16SessionTimeout, |
| 2719 | strHostIfBASessionInfo->u8Ted); |
| 2720 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2721 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2722 | wid.type = WID_STR; |
| 2723 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2724 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2725 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2726 | *ptr++ = 0x14; |
| 2727 | *ptr++ = 0x3; |
| 2728 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2729 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2730 | ptr += ETH_ALEN; |
| 2731 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2732 | *ptr++ = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2733 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 2734 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2735 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 2736 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2737 | *ptr++ = (AddbaTimeout & 0xFF); |
| 2738 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2739 | *ptr++ = 8; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2740 | *ptr++ = 0; |
| 2741 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2742 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2743 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2744 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2745 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 2746 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2747 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2748 | wid.type = WID_STR; |
| 2749 | wid.size = 15; |
| 2750 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2751 | *ptr++ = 15; |
| 2752 | *ptr++ = 7; |
| 2753 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2754 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2755 | ptr += ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2756 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2757 | *ptr++ = 8; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2758 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 2759 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2760 | *ptr++ = 3; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2761 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2762 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2763 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2764 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2765 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2766 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2767 | } |
| 2768 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2769 | static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2770 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2771 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2772 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2773 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2774 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2775 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2776 | 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] | 2777 | strHostIfBASessionInfo->au8Bssid[0], |
| 2778 | strHostIfBASessionInfo->au8Bssid[1], |
| 2779 | strHostIfBASessionInfo->au8Bssid[2], |
| 2780 | strHostIfBASessionInfo->u8Ted); |
| 2781 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2782 | wid.id = (u16)WID_DEL_ALL_RX_BA; |
| 2783 | wid.type = WID_STR; |
| 2784 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2785 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2786 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2787 | *ptr++ = 0x14; |
| 2788 | *ptr++ = 0x3; |
| 2789 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2790 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2791 | ptr += ETH_ALEN; |
| 2792 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2793 | *ptr++ = 0; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2794 | *ptr++ = 32; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2795 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2796 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2797 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2798 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2799 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 2800 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2801 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2802 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2803 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2804 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2805 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2806 | } |
| 2807 | |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 2808 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2809 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2810 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2811 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2812 | struct host_if_drv *hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2813 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2814 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2815 | |
| 2816 | while (1) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2817 | wilc_mq_recv(&hif_msg_q, &msg, sizeof(struct host_if_msg), &u32Ret); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2818 | hif_drv = (struct host_if_drv *)msg.drv; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2819 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2820 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 2821 | break; |
| 2822 | } |
| 2823 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2824 | if ((!g_wilc_initialized)) { |
| 2825 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 2826 | usleep_range(200 * 1000, 200 * 1000); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2827 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2828 | continue; |
| 2829 | } |
| 2830 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2831 | if (msg.id == HOST_IF_MSG_CONNECT && |
| 2832 | hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2833 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2834 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 2835 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2836 | continue; |
| 2837 | } |
| 2838 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2839 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2840 | case HOST_IF_MSG_Q_IDLE: |
| 2841 | Handle_wait_msg_q_empty(); |
| 2842 | break; |
| 2843 | |
| 2844 | case HOST_IF_MSG_SCAN: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2845 | Handle_Scan(msg.drv, &msg.body.scan_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2846 | break; |
| 2847 | |
| 2848 | case HOST_IF_MSG_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2849 | Handle_Connect(msg.drv, &msg.body.con_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2850 | break; |
| 2851 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2852 | case HOST_IF_MSG_FLUSH_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2853 | Handle_FlushConnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2854 | break; |
| 2855 | |
| 2856 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2857 | Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2858 | break; |
| 2859 | |
| 2860 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2861 | Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2862 | break; |
| 2863 | |
| 2864 | case HOST_IF_MSG_KEY: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2865 | Handle_Key(msg.drv, &msg.body.key_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2866 | break; |
| 2867 | |
| 2868 | case HOST_IF_MSG_CFG_PARAMS: |
| 2869 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2870 | Handle_CfgParam(msg.drv, &msg.body.cfg_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2871 | break; |
| 2872 | |
| 2873 | case HOST_IF_MSG_SET_CHANNEL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2874 | Handle_SetChannel(msg.drv, &msg.body.channel_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2875 | break; |
| 2876 | |
| 2877 | case HOST_IF_MSG_DISCONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2878 | Handle_Disconnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2879 | break; |
| 2880 | |
| 2881 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2882 | del_timer(&hif_drv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2883 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 2884 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2885 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2886 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2887 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2888 | Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2889 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2890 | if (hif_drv->u8RemainOnChan_pendingreq) |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2891 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2892 | |
| 2893 | break; |
| 2894 | |
| 2895 | case HOST_IF_MSG_GET_RSSI: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2896 | Handle_GetRssi(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2897 | break; |
| 2898 | |
| 2899 | case HOST_IF_MSG_GET_LINKSPEED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2900 | Handle_GetLinkspeed(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2901 | break; |
| 2902 | |
| 2903 | case HOST_IF_MSG_GET_STATISTICS: |
Leo Kim | 03e7b9c | 2015-10-12 16:55:58 +0900 | [diff] [blame] | 2904 | Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2905 | break; |
| 2906 | |
| 2907 | case HOST_IF_MSG_GET_CHNL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2908 | Handle_GetChnl(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2909 | break; |
| 2910 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2911 | case HOST_IF_MSG_ADD_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2912 | Handle_AddBeacon(msg.drv, &msg.body.beacon_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2913 | break; |
| 2914 | |
| 2915 | case HOST_IF_MSG_DEL_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2916 | Handle_DelBeacon(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2917 | break; |
| 2918 | |
| 2919 | case HOST_IF_MSG_ADD_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2920 | Handle_AddStation(msg.drv, &msg.body.add_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2921 | break; |
| 2922 | |
| 2923 | case HOST_IF_MSG_DEL_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2924 | Handle_DelStation(msg.drv, &msg.body.del_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2925 | break; |
| 2926 | |
| 2927 | case HOST_IF_MSG_EDIT_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2928 | Handle_EditStation(msg.drv, &msg.body.edit_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2929 | break; |
| 2930 | |
| 2931 | case HOST_IF_MSG_GET_INACTIVETIME: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2932 | Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2933 | break; |
| 2934 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2935 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 2936 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 2937 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2938 | Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2939 | break; |
| 2940 | |
| 2941 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2942 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2943 | Handle_ConnectTimeout(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2944 | break; |
| 2945 | |
| 2946 | case HOST_IF_MSG_POWER_MGMT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2947 | Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2948 | break; |
| 2949 | |
| 2950 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2951 | Handle_SetWfiDrvHandler(msg.drv, |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 2952 | &msg.body.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2953 | break; |
| 2954 | |
| 2955 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2956 | Handle_SetOperationMode(msg.drv, &msg.body.mode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2957 | break; |
| 2958 | |
| 2959 | case HOST_IF_MSG_SET_IPADDRESS: |
| 2960 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 2961 | Handle_set_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2962 | break; |
| 2963 | |
| 2964 | case HOST_IF_MSG_GET_IPADDRESS: |
| 2965 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 2966 | Handle_get_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2967 | break; |
| 2968 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2969 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2970 | Handle_SetMacAddress(msg.drv, &msg.body.set_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2971 | break; |
| 2972 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2973 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2974 | Handle_GetMacAddress(msg.drv, &msg.body.get_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2975 | break; |
| 2976 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2977 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 2978 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2979 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2980 | break; |
| 2981 | |
| 2982 | case HOST_IF_MSG_REGISTER_FRAME: |
| 2983 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2984 | Handle_RegisterFrame(msg.drv, &msg.body.reg_frame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2985 | break; |
| 2986 | |
| 2987 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2988 | Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2989 | break; |
| 2990 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2991 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 2992 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2993 | Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2994 | break; |
| 2995 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2996 | case HOST_IF_MSG_ADD_BA_SESSION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2997 | Handle_AddBASession(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2998 | break; |
| 2999 | |
| 3000 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3001 | Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3002 | break; |
| 3003 | |
| 3004 | case HOST_IF_MSG_DEL_ALL_STA: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3005 | Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3006 | break; |
| 3007 | |
| 3008 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3009 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3010 | break; |
| 3011 | } |
| 3012 | } |
| 3013 | |
| 3014 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 3015 | up(&hif_sema_thread); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 3016 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3017 | } |
| 3018 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3019 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3020 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3021 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3022 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3023 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3024 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3025 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3026 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3027 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3028 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3029 | } |
| 3030 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3031 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3032 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3033 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3034 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3035 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3036 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3037 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3038 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3039 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3040 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3041 | } |
| 3042 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3043 | s32 host_int_remove_key(struct host_if_drv *hif_drv, const u8 *pu8StaAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3044 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3045 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3046 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3047 | wid.id = (u16)WID_REMOVE_KEY; |
| 3048 | wid.type = WID_STR; |
| 3049 | wid.val = (s8 *)pu8StaAddress; |
| 3050 | wid.size = 6; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3051 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3052 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3053 | } |
| 3054 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3055 | int host_int_remove_wep_key(struct host_if_drv *hif_drv, u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3056 | { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3057 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3058 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3059 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3060 | if (!hif_drv) { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3061 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3062 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3063 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3064 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3065 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3066 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3067 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3068 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3069 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3070 | msg.body.key_info.action = REMOVEKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3071 | msg.drv = hif_drv; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 3072 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3073 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3074 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3075 | if (result) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3076 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3077 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3078 | |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3079 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3080 | } |
| 3081 | |
Chaehyun Lim | df8b483 | 2015-10-26 09:44:45 +0900 | [diff] [blame] | 3082 | int host_int_set_wep_default_key(struct host_if_drv *hif_drv, u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3083 | { |
Chaehyun Lim | 5b41c7c | 2015-10-26 09:44:42 +0900 | [diff] [blame] | 3084 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3085 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3086 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3087 | if (!hif_drv) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3088 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3089 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3090 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3091 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3092 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3093 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3094 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3095 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3096 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3097 | msg.body.key_info.action = DEFAULTKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3098 | msg.drv = hif_drv; |
Chaehyun Lim | e91d034 | 2015-10-26 09:44:44 +0900 | [diff] [blame] | 3099 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3100 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3101 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3102 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3103 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3104 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3105 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3106 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3107 | } |
| 3108 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3109 | s32 host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, |
| 3110 | const u8 *pu8WepKey, |
| 3111 | u8 u8WepKeylen, |
| 3112 | u8 u8Keyidx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3113 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3114 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3115 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3116 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3117 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3118 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3119 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3120 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3121 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3122 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3123 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3124 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3125 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3126 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3127 | msg.drv = hif_drv; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 3128 | msg.body.key_info.attr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL); |
| 3129 | memcpy(msg.body.key_info.attr.wep.key, pu8WepKey, u8WepKeylen); |
| 3130 | msg.body.key_info.attr.wep.key_len = (u8WepKeylen); |
| 3131 | msg.body.key_info.attr.wep.index = u8Keyidx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3132 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3133 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3134 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3135 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3136 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3137 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3138 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3139 | } |
| 3140 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3141 | s32 host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, |
| 3142 | const u8 *pu8WepKey, |
| 3143 | u8 u8WepKeylen, |
| 3144 | u8 u8Keyidx, |
| 3145 | u8 u8mode, |
| 3146 | enum AUTHTYPE tenuAuth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3147 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3148 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3149 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3150 | u8 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3151 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3152 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3153 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3154 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3155 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3156 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3157 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3158 | |
| 3159 | if (INFO) { |
| 3160 | for (i = 0; i < u8WepKeylen; i++) |
| 3161 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", pu8WepKey[i]); |
| 3162 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3163 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3164 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3165 | msg.body.key_info.action = ADDKEY_AP; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3166 | msg.drv = hif_drv; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 3167 | msg.body.key_info.attr.wep.key = kmalloc(u8WepKeylen, GFP_KERNEL); |
| 3168 | memcpy(msg.body.key_info.attr.wep.key, pu8WepKey, (u8WepKeylen)); |
| 3169 | msg.body.key_info.attr.wep.key_len = (u8WepKeylen); |
| 3170 | msg.body.key_info.attr.wep.index = u8Keyidx; |
| 3171 | msg.body.key_info.attr.wep.mode = u8mode; |
| 3172 | msg.body.key_info.attr.wep.auth_type = tenuAuth_type; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3173 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3174 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3175 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3176 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3177 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3178 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3179 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3180 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3181 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3182 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3183 | s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, |
| 3184 | u8 u8PtkKeylen, const u8 *mac_addr, |
| 3185 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 3186 | u8 mode, u8 u8Ciphermode, u8 u8Idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3187 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3188 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3189 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3190 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3191 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3192 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3193 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3194 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3195 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3196 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3197 | |
| 3198 | if (pu8RxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3199 | u8KeyLen += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3200 | |
| 3201 | if (pu8TxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3202 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3203 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3204 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3205 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3206 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3207 | msg.body.key_info.type = WPAPtk; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3208 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3209 | msg.body.key_info.action = ADDKEY_AP; |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 3210 | msg.body.key_info.attr.wpa.index = u8Idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3211 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3212 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3213 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3214 | |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3215 | msg.body.key_info.attr.wpa.key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
| 3216 | memcpy(msg.body.key_info.attr.wpa.key, pu8Ptk, u8PtkKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3217 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3218 | if (pu8RxMic) { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3219 | memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, RX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3220 | if (INFO) { |
| 3221 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 3222 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 3223 | } |
| 3224 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3225 | if (pu8TxMic) { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3226 | memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, TX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3227 | if (INFO) { |
| 3228 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 3229 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 3230 | } |
| 3231 | } |
| 3232 | |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 3233 | msg.body.key_info.attr.wpa.key_len = u8KeyLen; |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 3234 | msg.body.key_info.attr.wpa.mac_addr = mac_addr; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 3235 | msg.body.key_info.attr.wpa.mode = u8Ciphermode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3236 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3237 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3238 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3239 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3240 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3241 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 3242 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3243 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3244 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3245 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3246 | } |
| 3247 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3248 | s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, |
| 3249 | u8 u8GtkKeylen, u8 u8KeyIdx, |
| 3250 | u32 u32KeyRSClen, const u8 *KeyRSC, |
| 3251 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 3252 | u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3253 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3254 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3255 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3256 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3257 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3258 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3259 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3260 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3261 | } |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3262 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3263 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3264 | if (pu8RxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3265 | u8KeyLen += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3266 | |
| 3267 | if (pu8TxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3268 | u8KeyLen += TX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3269 | |
| 3270 | if (KeyRSC) { |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 3271 | msg.body.key_info.attr.wpa.seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
| 3272 | memcpy(msg.body.key_info.attr.wpa.seq, KeyRSC, u32KeyRSClen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3273 | } |
| 3274 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3275 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3276 | msg.body.key_info.type = WPARxGtk; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3277 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3278 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3279 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3280 | msg.body.key_info.action = ADDKEY_AP; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 3281 | msg.body.key_info.attr.wpa.mode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3282 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3283 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3284 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3285 | |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3286 | msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL); |
| 3287 | memcpy(msg.body.key_info.attr.wpa.key, pu8RxGtk, u8GtkKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3288 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3289 | if (pu8RxMic) |
| 3290 | memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, |
| 3291 | RX_MIC_KEY_LEN); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3292 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3293 | if (pu8TxMic) |
| 3294 | memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, |
| 3295 | TX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3296 | |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 3297 | msg.body.key_info.attr.wpa.index = u8KeyIdx; |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 3298 | msg.body.key_info.attr.wpa.key_len = u8KeyLen; |
Leo Kim | dacc594 | 2015-10-13 19:49:33 +0900 | [diff] [blame] | 3299 | msg.body.key_info.attr.wpa.seq_len = u32KeyRSClen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3300 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3301 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3302 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3303 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3304 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3305 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3306 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3307 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3308 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3309 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3310 | s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, struct host_if_pmkid_attr *pu8PmkidInfoArray) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3311 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3312 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3313 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3314 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3315 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3316 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3317 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3318 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3319 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3320 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3321 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3322 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3323 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3324 | msg.body.key_info.type = PMKSA; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3325 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3326 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3327 | |
| 3328 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3329 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].bssid, |
| 3330 | &pu8PmkidInfoArray->pmkidlist[i].bssid, ETH_ALEN); |
| 3331 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].pmkid, |
| 3332 | &pu8PmkidInfoArray->pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3333 | } |
| 3334 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3335 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3336 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3337 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 3338 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3339 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3340 | } |
| 3341 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3342 | s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv, |
| 3343 | u8 *pu8PmkidInfoArray, |
| 3344 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3345 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3346 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3347 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3348 | wid.id = (u16)WID_PMKID_INFO; |
| 3349 | wid.type = WID_STR; |
| 3350 | wid.size = u32PmkidInfoLen; |
| 3351 | wid.val = pu8PmkidInfoArray; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3352 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3353 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3354 | } |
| 3355 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3356 | s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3357 | u8 *pu8PassPhrase, |
| 3358 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3359 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3360 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3361 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3362 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3363 | wid.id = (u16)WID_11I_PSK; |
| 3364 | wid.type = WID_STR; |
| 3365 | wid.val = pu8PassPhrase; |
| 3366 | wid.size = u8Psklength; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3367 | } |
| 3368 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3369 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3370 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3371 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3372 | s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3373 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3374 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3375 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3376 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3377 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3378 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3379 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 3380 | msg.body.get_mac_info.u8MacAddress = pu8MacAddress; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3381 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3382 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3383 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3384 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3385 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3386 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3387 | } |
| 3388 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3389 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3390 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3391 | } |
| 3392 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3393 | s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3394 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3395 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3396 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3397 | |
| 3398 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 3399 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3400 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3401 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Leo Kim | ae5e452 | 2015-10-28 15:59:31 +0900 | [diff] [blame^] | 3402 | memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3403 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3404 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3405 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3406 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3407 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3408 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3409 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3410 | } |
| 3411 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3412 | s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3413 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3414 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3415 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3416 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3417 | wid.id = (u16)WID_11I_PSK; |
| 3418 | wid.type = WID_STR; |
| 3419 | wid.size = u8Psklength; |
| 3420 | wid.val = pu8PassPhrase; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3421 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3422 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3423 | } |
| 3424 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3425 | s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3426 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3427 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3428 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3429 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3430 | wid.type = WID_CHAR; |
| 3431 | wid.val = (s8 *)&scanSource; |
| 3432 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3433 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3434 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3435 | } |
| 3436 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3437 | s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3438 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3439 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3440 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3441 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3442 | wid.type = WID_CHAR; |
| 3443 | wid.val = (s8 *)pu8ScanSource; |
| 3444 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3445 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3446 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3447 | } |
| 3448 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3449 | s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, |
| 3450 | const u8 *pu8ssid, size_t ssidLen, |
| 3451 | const u8 *pu8IEs, size_t IEsLen, |
| 3452 | wilc_connect_result pfConnectResult, void *pvUserArg, |
| 3453 | u8 u8security, enum AUTHTYPE tenuAuth_type, |
| 3454 | u8 u8channel, void *pJoinParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3455 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3456 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3457 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3458 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3459 | if (!hif_drv || !pfConnectResult) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3460 | PRINT_ER("Driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3461 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3462 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3463 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3464 | if (!pJoinParams) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3465 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3466 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3467 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3468 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3469 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3470 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3471 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3472 | |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 3473 | msg.body.con_info.security = u8security; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 3474 | msg.body.con_info.auth_type = tenuAuth_type; |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 3475 | msg.body.con_info.ch = u8channel; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 3476 | msg.body.con_info.result = pfConnectResult; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 3477 | msg.body.con_info.arg = pvUserArg; |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 3478 | msg.body.con_info.params = pJoinParams; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3479 | msg.drv = hif_drv ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3480 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3481 | if (pu8bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 3482 | msg.body.con_info.bssid = kmalloc(6, GFP_KERNEL); |
| 3483 | memcpy(msg.body.con_info.bssid, pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3484 | } |
| 3485 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3486 | if (pu8ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 3487 | msg.body.con_info.ssid_len = ssidLen; |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 3488 | msg.body.con_info.ssid = kmalloc(ssidLen, GFP_KERNEL); |
| 3489 | memcpy(msg.body.con_info.ssid, pu8ssid, ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3490 | } |
| 3491 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3492 | if (pu8IEs) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 3493 | msg.body.con_info.ies_len = IEsLen; |
Leo Kim | 2ea158c | 2015-10-13 19:49:52 +0900 | [diff] [blame] | 3494 | msg.body.con_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3495 | memcpy(msg.body.con_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3496 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3497 | if (hif_drv->enuHostIFstate < HOST_IF_CONNECTING) |
| 3498 | hif_drv->enuHostIFstate = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3499 | else |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3500 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' as state is %d\n", hif_drv->enuHostIFstate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3501 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3502 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3503 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3504 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3505 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3506 | } |
| 3507 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3508 | hif_drv->hConnectTimer.data = (unsigned long)hif_drv; |
| 3509 | mod_timer(&hif_drv->hConnectTimer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3510 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3511 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3512 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3513 | } |
| 3514 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3515 | s32 host_int_flush_join_req(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3516 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3517 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3518 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3519 | |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3520 | if (!join_req) |
| 3521 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3522 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3523 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3524 | PRINT_ER("Driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3525 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3526 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3527 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3528 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3529 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3530 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3531 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3532 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3533 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3534 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3535 | } |
| 3536 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3537 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3538 | } |
| 3539 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3540 | s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3541 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3542 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3543 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3544 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3545 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3546 | PRINT_ER("Driver is null\n"); |
| 3547 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3548 | } |
| 3549 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3550 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3551 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3552 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3553 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3554 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3555 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3556 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3557 | PRINT_ER("Failed to send message queue: disconnect\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3558 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3559 | down(&hif_drv->hSemTestDisconnectBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3560 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3561 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3562 | } |
| 3563 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3564 | s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3565 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3566 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3567 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3568 | wid.id = (u16)WID_DISCONNECT; |
| 3569 | wid.type = WID_CHAR; |
| 3570 | wid.val = (s8 *)&assoc_id; |
| 3571 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3572 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3573 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3574 | } |
| 3575 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3576 | s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, |
| 3577 | u8 *pu8AssocReqInfo, |
| 3578 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3579 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3580 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3581 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3582 | wid.id = (u16)WID_ASSOC_REQ_INFO; |
| 3583 | wid.type = WID_STR; |
| 3584 | wid.val = pu8AssocReqInfo; |
| 3585 | wid.size = u32AssocReqInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3586 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3587 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3588 | } |
| 3589 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3590 | s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, |
| 3591 | u8 *pu8AssocRespInfo, |
| 3592 | u32 u32MaxAssocRespInfoLen, |
| 3593 | u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3594 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3595 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3596 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3597 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3598 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3599 | PRINT_ER("Driver is null\n"); |
| 3600 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3601 | } |
| 3602 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3603 | wid.id = (u16)WID_ASSOC_RES_INFO; |
| 3604 | wid.type = WID_STR; |
| 3605 | wid.val = pu8AssocRespInfo; |
| 3606 | wid.size = u32MaxAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3607 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3608 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3609 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3610 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3611 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3612 | PRINT_ER("Failed to send association response config packet\n"); |
| 3613 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3614 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3615 | *pu32RcvdAssocRespInfoLen = wid.size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3616 | } |
| 3617 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3618 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3619 | } |
| 3620 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3621 | s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, |
| 3622 | u8 *pu8RxPowerLevel, |
| 3623 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3624 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3625 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3626 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3627 | wid.id = (u16)WID_RX_POWER_LEVEL; |
| 3628 | wid.type = WID_STR; |
| 3629 | wid.val = pu8RxPowerLevel; |
| 3630 | wid.size = u32RxPowerLevelLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3631 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3632 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3633 | } |
| 3634 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3635 | int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3636 | { |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3637 | int result; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3638 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3639 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3640 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3641 | PRINT_ER("driver is null\n"); |
| 3642 | return -EFAULT; |
| 3643 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3644 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3645 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3646 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Leo Kim | 730ee05 | 2015-10-13 19:50:02 +0900 | [diff] [blame] | 3647 | msg.body.channel_info.set_ch = channel; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3648 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3649 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3650 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Chaehyun Lim | 1ef58e4 | 2015-10-02 21:44:49 +0900 | [diff] [blame] | 3651 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3652 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3653 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3654 | } |
| 3655 | |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3656 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3657 | } |
| 3658 | |
Chaehyun Lim | 244efb1 | 2015-10-02 21:44:53 +0900 | [diff] [blame] | 3659 | int host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3660 | { |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3661 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3662 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3663 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3664 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3665 | msg.id = HOST_IF_MSG_Q_IDLE; |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3666 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3667 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3668 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3669 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3670 | } |
| 3671 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3672 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3673 | |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3674 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3675 | } |
| 3676 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3677 | int host_int_set_wfi_drv_handler(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3678 | { |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3679 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3680 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3681 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3682 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3683 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 3684 | msg.body.drv.handler = get_id_from_handler(hif_drv); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3685 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3686 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3687 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3688 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3689 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3690 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3691 | } |
| 3692 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3693 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3694 | } |
| 3695 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3696 | int host_int_set_operation_mode(struct host_if_drv *hif_drv, u32 mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3697 | { |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3698 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3699 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3700 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3701 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3702 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 3703 | msg.body.mode.mode = mode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3704 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3705 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3706 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3707 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3708 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3709 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3710 | } |
| 3711 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3712 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3713 | } |
| 3714 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3715 | s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3716 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3717 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3718 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3719 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3720 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3721 | PRINT_ER("driver is null\n"); |
| 3722 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3723 | } |
| 3724 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3725 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3726 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3727 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3728 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3729 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3730 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3731 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3732 | PRINT_ER("wilc mq send fail\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3733 | down(&hif_drv->hSemGetCHNL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3734 | |
Leo Kim | 95ebb0f | 2015-10-15 13:25:03 +0900 | [diff] [blame] | 3735 | *pu8ChNo = ch_no; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3736 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3737 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3738 | } |
| 3739 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3740 | s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, |
| 3741 | const u8 *mac, u32 *pu32InactiveTime) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3742 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3743 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3744 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3745 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3746 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3747 | PRINT_ER("driver is null\n"); |
| 3748 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3749 | } |
| 3750 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3751 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3752 | memcpy(msg.body.mac_info.mac, mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3753 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3754 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3755 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3756 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3757 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3758 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3759 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 3760 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3761 | down(&hif_drv->hSemInactiveTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3762 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 3763 | *pu32InactiveTime = inactive_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3764 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3765 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3766 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3767 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3768 | s32 host_int_test_get_int_wid(struct host_if_drv *hif_drv, u32 *pu32TestMemAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3769 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3770 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3771 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3772 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3773 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3774 | PRINT_ER("driver is null\n"); |
| 3775 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3776 | } |
| 3777 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3778 | wid.id = (u16)WID_MEMORY_ADDRESS; |
| 3779 | wid.type = WID_INT; |
| 3780 | wid.val = (s8 *)pu32TestMemAddr; |
| 3781 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3782 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3783 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3784 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3785 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3786 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3787 | PRINT_ER("Failed to get wid value\n"); |
| 3788 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3789 | } else { |
| 3790 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3791 | } |
| 3792 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3793 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3794 | } |
| 3795 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3796 | s32 host_int_get_rssi(struct host_if_drv *hif_drv, s8 *ps8Rssi) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3797 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3798 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3799 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3800 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3801 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3802 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3803 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3804 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3805 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3806 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3807 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3808 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3809 | } |
| 3810 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3811 | down(&hif_drv->hSemGetRSSI); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3812 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3813 | if (!ps8Rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3814 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3815 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3816 | } |
| 3817 | |
Leo Kim | 144b7b2 | 2015-10-15 13:25:01 +0900 | [diff] [blame] | 3818 | *ps8Rssi = rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3819 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3820 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3821 | } |
| 3822 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3823 | s32 host_int_get_link_speed(struct host_if_drv *hif_drv, s8 *ps8lnkspd) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3824 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3825 | struct host_if_msg msg; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3826 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3827 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3828 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3829 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3830 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3831 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3832 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3833 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3834 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3835 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3836 | } |
| 3837 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3838 | down(&hif_drv->hSemGetLINKSPEED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3839 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3840 | if (!ps8lnkspd) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3841 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3842 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3843 | } |
| 3844 | |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 3845 | *ps8lnkspd = link_speed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3846 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3847 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3848 | } |
| 3849 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3850 | s32 host_int_get_statistics(struct host_if_drv *hif_drv, struct rf_info *pstrStatistics) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3851 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3852 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3853 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3854 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3855 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3856 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 3857 | msg.body.data = (char *)pstrStatistics; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3858 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3859 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3860 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3861 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3862 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3863 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3864 | } |
| 3865 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3866 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3867 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3868 | } |
| 3869 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3870 | s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, |
| 3871 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 3872 | u8 u8ChnlListLen, const u8 *pu8IEs, |
| 3873 | size_t IEsLen, wilc_scan_result ScanResult, |
| 3874 | void *pvUserArg, struct hidden_network *pstrHiddenNetwork) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3875 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3876 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3877 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3878 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3879 | if (!hif_drv || !ScanResult) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3880 | PRINT_ER("hif_drv or ScanResult = NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3881 | return -EFAULT; |
| 3882 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3883 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3884 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3885 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3886 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3887 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3888 | if (pstrHiddenNetwork) { |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 3889 | msg.body.scan_info.hidden_network.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 3890 | msg.body.scan_info.hidden_network.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3891 | |
| 3892 | } else |
| 3893 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 3894 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3895 | msg.drv = hif_drv; |
Leo Kim | 4256889 | 2015-10-13 19:49:37 +0900 | [diff] [blame] | 3896 | msg.body.scan_info.src = u8ScanSource; |
Leo Kim | 1e276c8 | 2015-10-13 19:49:38 +0900 | [diff] [blame] | 3897 | msg.body.scan_info.type = u8ScanType; |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 3898 | msg.body.scan_info.result = ScanResult; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 3899 | msg.body.scan_info.arg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3900 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 3901 | msg.body.scan_info.ch_list_len = u8ChnlListLen; |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 3902 | msg.body.scan_info.ch_freq_list = kmalloc(u8ChnlListLen, GFP_KERNEL); |
| 3903 | memcpy(msg.body.scan_info.ch_freq_list, pu8ChnlFreqList, u8ChnlListLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3904 | |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 3905 | msg.body.scan_info.ies_len = IEsLen; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 3906 | msg.body.scan_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3907 | memcpy(msg.body.scan_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3908 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3909 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3910 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3911 | PRINT_ER("Error in sending message queue\n"); |
| 3912 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3913 | } |
| 3914 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3915 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3916 | hif_drv->hScanTimer.data = (unsigned long)hif_drv; |
| 3917 | mod_timer(&hif_drv->hScanTimer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3918 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3919 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3920 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3921 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3922 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3923 | s32 hif_set_cfg(struct host_if_drv *hif_drv, |
| 3924 | struct cfg_param_val *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3925 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3926 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3927 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3928 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3929 | if (!hif_drv) { |
| 3930 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3931 | return -EFAULT; |
| 3932 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3933 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3934 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3935 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 3936 | msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3937 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3938 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3939 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3940 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3941 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3942 | } |
| 3943 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3944 | s32 hif_get_cfg(struct host_if_drv *hif_drv, u16 u16WID, u16 *pu16WID_Value) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3945 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3946 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3947 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3948 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3949 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3950 | if (!hif_drv) { |
| 3951 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3952 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3953 | } |
| 3954 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 3955 | switch (u16WID) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3956 | case WID_BSS_TYPE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3957 | *pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3958 | break; |
| 3959 | |
| 3960 | case WID_AUTH_TYPE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3961 | *pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3962 | break; |
| 3963 | |
| 3964 | case WID_AUTH_TIMEOUT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3965 | *pu16WID_Value = hif_drv->strCfgValues.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3966 | break; |
| 3967 | |
| 3968 | case WID_POWER_MANAGEMENT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3969 | *pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3970 | break; |
| 3971 | |
| 3972 | case WID_SHORT_RETRY_LIMIT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3973 | *pu16WID_Value = hif_drv->strCfgValues.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3974 | break; |
| 3975 | |
| 3976 | case WID_LONG_RETRY_LIMIT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3977 | *pu16WID_Value = hif_drv->strCfgValues.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3978 | break; |
| 3979 | |
| 3980 | case WID_FRAG_THRESHOLD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3981 | *pu16WID_Value = hif_drv->strCfgValues.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3982 | break; |
| 3983 | |
| 3984 | case WID_RTS_THRESHOLD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3985 | *pu16WID_Value = hif_drv->strCfgValues.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3986 | break; |
| 3987 | |
| 3988 | case WID_PREAMBLE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3989 | *pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3990 | break; |
| 3991 | |
| 3992 | case WID_SHORT_SLOT_ALLOWED: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3993 | *pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3994 | break; |
| 3995 | |
| 3996 | case WID_11N_TXOP_PROT_DISABLE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3997 | *pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3998 | break; |
| 3999 | |
| 4000 | case WID_BEACON_INTERVAL: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4001 | *pu16WID_Value = hif_drv->strCfgValues.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4002 | break; |
| 4003 | |
| 4004 | case WID_DTIM_PERIOD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4005 | *pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4006 | break; |
| 4007 | |
| 4008 | case WID_SITE_SURVEY: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4009 | *pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4010 | break; |
| 4011 | |
| 4012 | case WID_SITE_SURVEY_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4013 | *pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4014 | break; |
| 4015 | |
| 4016 | case WID_ACTIVE_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4017 | *pu16WID_Value = hif_drv->strCfgValues.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4018 | break; |
| 4019 | |
| 4020 | case WID_PASSIVE_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4021 | *pu16WID_Value = hif_drv->strCfgValues.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4022 | break; |
| 4023 | |
| 4024 | case WID_CURRENT_TX_RATE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4025 | *pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4026 | break; |
| 4027 | |
| 4028 | default: |
| 4029 | break; |
| 4030 | } |
| 4031 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4032 | up(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4033 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4034 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4035 | } |
| 4036 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4037 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4038 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4039 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4040 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4041 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4042 | PRINT_ER("Driver handler is NULL\n"); |
| 4043 | return; |
| 4044 | } |
| 4045 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4046 | if (hif_drv->enuHostIFstate == HOST_IF_CONNECTED) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4047 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4048 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4049 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4050 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4051 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4052 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4053 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4054 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4055 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4056 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4057 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 4058 | return; |
| 4059 | } |
| 4060 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4061 | periodic_rssi.data = (unsigned long)hif_drv; |
| 4062 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4063 | } |
| 4064 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4065 | s32 host_int_init(struct net_device *dev, struct host_if_drv **hif_drv_handler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4066 | { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4067 | s32 result = 0; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4068 | struct host_if_drv *hif_drv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4069 | int err; |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4070 | perInterface_wlan_t *nic; |
| 4071 | struct wilc *wilc; |
| 4072 | |
| 4073 | nic = netdev_priv(dev); |
| 4074 | wilc = nic->wilc; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4075 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4076 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 4077 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4078 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4079 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4080 | sema_init(&hif_sema_wait_response, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4081 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4082 | hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL); |
| 4083 | if (!hif_drv) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4084 | result = -ENOMEM; |
Vincent Stehlé | 17db84e | 2015-10-07 07:08:25 +0200 | [diff] [blame] | 4085 | goto _fail_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4086 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4087 | *hif_drv_handler = hif_drv; |
| 4088 | err = add_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4089 | if (err) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4090 | result = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4091 | goto _fail_timer_2; |
| 4092 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4093 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 4094 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4095 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4096 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4097 | if (clients_count == 0) { |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4098 | sema_init(&hif_sema_thread, 0); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4099 | sema_init(&hif_sema_driver, 0); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4100 | sema_init(&hif_sema_deinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4101 | } |
| 4102 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4103 | sema_init(&hif_drv->hSemTestKeyBlock, 0); |
| 4104 | sema_init(&hif_drv->hSemTestDisconnectBlock, 0); |
| 4105 | sema_init(&hif_drv->hSemGetRSSI, 0); |
| 4106 | sema_init(&hif_drv->hSemGetLINKSPEED, 0); |
| 4107 | sema_init(&hif_drv->hSemGetCHNL, 0); |
| 4108 | sema_init(&hif_drv->hSemInactiveTime, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4109 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4110 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 4111 | |
| 4112 | if (clients_count == 0) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4113 | result = wilc_mq_create(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4114 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4115 | if (result < 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4116 | PRINT_ER("Failed to creat MQ\n"); |
| 4117 | goto _fail_; |
| 4118 | } |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4119 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4120 | hif_thread_handler = kthread_run(hostIFthread, wilc, |
| 4121 | "WILC_kthread"); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4122 | |
| 4123 | if (IS_ERR(hif_thread_handler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4124 | PRINT_ER("Failed to creat Thread\n"); |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4125 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4126 | goto _fail_mq_; |
| 4127 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4128 | setup_timer(&periodic_rssi, GetPeriodicRSSI, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4129 | (unsigned long)hif_drv); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4130 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4131 | } |
| 4132 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4133 | setup_timer(&hif_drv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4134 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4135 | setup_timer(&hif_drv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4136 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4137 | setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4138 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 4139 | sema_init(&hif_drv->gtOsCfgValuesSem, 1); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4140 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4141 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4142 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4143 | hif_drv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 4144 | hif_drv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 4145 | hif_drv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 4146 | hif_drv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 4147 | hif_drv->strCfgValues.curr_tx_rate = AUTORATE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4148 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4149 | hif_drv->u64P2p_MgmtTimeout = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4150 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4151 | 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", |
| 4152 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4153 | hif_drv->strCfgValues.site_survey_enabled, hif_drv->strCfgValues.scan_source, |
| 4154 | hif_drv->strCfgValues.active_scan_time, hif_drv->strCfgValues.passive_scan_time, |
| 4155 | hif_drv->strCfgValues.curr_tx_rate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4156 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4157 | up(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4158 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4159 | clients_count++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4160 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4161 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4162 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4163 | _fail_timer_2: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4164 | up(&hif_drv->gtOsCfgValuesSem); |
| 4165 | del_timer_sync(&hif_drv->hConnectTimer); |
| 4166 | del_timer_sync(&hif_drv->hScanTimer); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4167 | kthread_stop(hif_thread_handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4168 | _fail_mq_: |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4169 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4170 | _fail_: |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4171 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4172 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4173 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4174 | s32 host_int_deinit(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4175 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4176 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4177 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4178 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4179 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4180 | if (!hif_drv) { |
| 4181 | PRINT_ER("hif_drv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4182 | return 0; |
| 4183 | } |
| 4184 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4185 | down(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4186 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4187 | terminated_handle = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4188 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 4189 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4190 | if (del_timer_sync(&hif_drv->hScanTimer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4191 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4192 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4193 | if (del_timer_sync(&hif_drv->hConnectTimer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4194 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4195 | |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4196 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4197 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4198 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4199 | del_timer_sync(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4200 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4201 | host_int_set_wfi_drv_handler(NULL); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4202 | down(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4203 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4204 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
| 4205 | hif_drv->strWILC_UsrScanReq.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
| 4206 | hif_drv->strWILC_UsrScanReq.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4207 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4208 | hif_drv->strWILC_UsrScanReq.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4209 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4210 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4211 | hif_drv->enuHostIFstate = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4212 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4213 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4214 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4215 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4216 | |
| 4217 | if (clients_count == 1) { |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4218 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4219 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4220 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4221 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4222 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4223 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4224 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4225 | if (result != 0) |
| 4226 | PRINT_ER("Error in sending deinit's message queue message function: Error(%d)\n", result); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4227 | |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4228 | down(&hif_sema_thread); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4229 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4230 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4231 | } |
| 4232 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 4233 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4234 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4235 | ret = remove_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4236 | if (ret) |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4237 | result = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4238 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4239 | kfree(hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4240 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4241 | clients_count--; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 4242 | terminated_handle = NULL; |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4243 | up(&hif_sema_deinit); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4244 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4245 | } |
| 4246 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4247 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4248 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4249 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4250 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4251 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4252 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4253 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4254 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4255 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4256 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4257 | if (!hif_drv || hif_drv == terminated_handle) { |
| 4258 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4259 | return; |
| 4260 | } |
| 4261 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4262 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4263 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4264 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4265 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4266 | |
Leo Kim | 3bffac6 | 2015-10-13 20:02:11 +0900 | [diff] [blame] | 4267 | msg.body.net_info.len = u32Length; |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 4268 | msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4269 | memcpy(msg.body.net_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4270 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4271 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4272 | if (result) |
| 4273 | PRINT_ER("Error in sending network info message queue message parameters: Error(%d)\n", result); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4274 | } |
| 4275 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4276 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4277 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4278 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4279 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4280 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4281 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4282 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4283 | down(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4284 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4285 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4286 | hif_drv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4287 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4288 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4289 | if (!hif_drv || hif_drv == terminated_handle) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4290 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4291 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4292 | return; |
| 4293 | } |
| 4294 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4295 | if (!hif_drv->strWILC_UsrConnReq.pfUserConnectResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4296 | PRINT_ER("Received mac status is not needed when there is no current Connect Reques\n"); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4297 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4298 | return; |
| 4299 | } |
| 4300 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4301 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4302 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4303 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4304 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4305 | |
Leo Kim | f94f488 | 2015-10-13 19:50:01 +0900 | [diff] [blame] | 4306 | msg.body.async_info.len = u32Length; |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 4307 | msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4308 | memcpy(msg.body.async_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4309 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4310 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4311 | if (result) |
| 4312 | PRINT_ER("Error in sending message queue asynchronous message info: Error(%d)\n", result); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4313 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4314 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4315 | } |
| 4316 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4317 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4318 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4319 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4320 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4321 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4322 | struct host_if_drv *hif_drv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4323 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4324 | id = ((pu8Buffer[u32Length - 4]) | (pu8Buffer[u32Length - 3] << 8) | (pu8Buffer[u32Length - 2] << 16) | (pu8Buffer[u32Length - 1] << 24)); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4325 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4326 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4327 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4328 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4329 | if (!hif_drv || hif_drv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4330 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4331 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4332 | if (hif_drv->strWILC_UsrScanReq.pfUserScanResult) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4333 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4334 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4335 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4336 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4337 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4338 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4339 | if (result) |
| 4340 | PRINT_ER("Error in sending message queue scan complete parameters: Error(%d)\n", result); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4341 | } |
| 4342 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4343 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4344 | } |
| 4345 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4346 | s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, |
| 4347 | u32 u32duration, u16 chan, |
| 4348 | wilc_remain_on_chan_expired RemainOnChanExpired, |
| 4349 | wilc_remain_on_chan_ready RemainOnChanReady, |
| 4350 | void *pvUserArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4351 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4352 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4353 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4354 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4355 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4356 | PRINT_ER("driver is null\n"); |
| 4357 | return -EFAULT; |
| 4358 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4359 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4360 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4361 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4362 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4363 | msg.body.remain_on_ch.u16Channel = chan; |
| 4364 | msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired; |
| 4365 | msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; |
| 4366 | msg.body.remain_on_ch.pVoid = pvUserArg; |
| 4367 | msg.body.remain_on_ch.u32duration = u32duration; |
| 4368 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4369 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4370 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4371 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4372 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4373 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4374 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4375 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4376 | } |
| 4377 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4378 | s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4379 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4380 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4381 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4382 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4383 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4384 | PRINT_ER("driver is null\n"); |
| 4385 | return -EFAULT; |
| 4386 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4387 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4388 | del_timer(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4389 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4390 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4391 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4392 | msg.drv = hif_drv; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4393 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4394 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4395 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4396 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4397 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4398 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4399 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4400 | } |
| 4401 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4402 | s32 host_int_frame_register(struct host_if_drv *hif_drv, u16 u16FrameType, bool bReg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4403 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4404 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4405 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4406 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4407 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4408 | PRINT_ER("driver is null\n"); |
| 4409 | return -EFAULT; |
| 4410 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4411 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4412 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4413 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4414 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4415 | switch (u16FrameType) { |
| 4416 | case ACTION: |
| 4417 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4418 | msg.body.reg_frame.u8Regid = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4419 | break; |
| 4420 | |
| 4421 | case PROBE_REQ: |
| 4422 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4423 | msg.body.reg_frame.u8Regid = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4424 | break; |
| 4425 | |
| 4426 | default: |
| 4427 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 4428 | break; |
| 4429 | } |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4430 | msg.body.reg_frame.u16FrameType = u16FrameType; |
| 4431 | msg.body.reg_frame.bReg = bReg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4432 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4433 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4434 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4435 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4436 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4437 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4438 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4439 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4440 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4441 | s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, |
| 4442 | u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, |
| 4443 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4444 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4445 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4446 | struct host_if_msg msg; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 4447 | struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4448 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4449 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4450 | PRINT_ER("driver is null\n"); |
| 4451 | return -EFAULT; |
| 4452 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4453 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4454 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4455 | |
| 4456 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 4457 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4458 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4459 | msg.drv = hif_drv; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 4460 | pstrSetBeaconParam->interval = u32Interval; |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 4461 | pstrSetBeaconParam->dtim_period = u32DTIMPeriod; |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 4462 | pstrSetBeaconParam->head_len = u32HeadLen; |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4463 | pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4464 | if (!pstrSetBeaconParam->head) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4465 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4466 | goto ERRORHANDLER; |
| 4467 | } |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 4468 | pstrSetBeaconParam->tail_len = u32TailLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4469 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4470 | if (u32TailLen > 0) { |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4471 | pstrSetBeaconParam->tail = kmemdup(pu8Tail, u32TailLen, |
| 4472 | GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4473 | if (!pstrSetBeaconParam->tail) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4474 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4475 | goto ERRORHANDLER; |
| 4476 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4477 | } else { |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 4478 | pstrSetBeaconParam->tail = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4479 | } |
| 4480 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4481 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4482 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4483 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4484 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4485 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4486 | if (result) { |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4487 | kfree(pstrSetBeaconParam->head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4488 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4489 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4490 | } |
| 4491 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4492 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4493 | } |
| 4494 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4495 | s32 host_int_del_beacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4496 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4497 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4498 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4499 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4500 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4501 | PRINT_ER("driver is null\n"); |
| 4502 | return -EFAULT; |
| 4503 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4504 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4505 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4506 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4507 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 4508 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4509 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4510 | if (result) |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 4511 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4512 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4513 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4514 | } |
| 4515 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4516 | s32 host_int_add_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4517 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4518 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4519 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4520 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4521 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4522 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4523 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4524 | PRINT_ER("driver is null\n"); |
| 4525 | return -EFAULT; |
| 4526 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4527 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4528 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4529 | |
| 4530 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 4531 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4532 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4533 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4534 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4535 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4536 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4537 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 4538 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4539 | if (!rates) |
| 4540 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4541 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4542 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 4543 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4544 | } |
| 4545 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4546 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4547 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4548 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4549 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4550 | } |
| 4551 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4552 | s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4553 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4554 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4555 | struct host_if_msg msg; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 4556 | struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4557 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4558 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4559 | PRINT_ER("driver is null\n"); |
| 4560 | return -EFAULT; |
| 4561 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4562 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4563 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4564 | |
| 4565 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 4566 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4567 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4568 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4569 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4570 | if (!pu8MacAddr) |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 4571 | memset(pstrDelStationMsg->mac_addr, 255, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4572 | else |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 4573 | memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4574 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4575 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4576 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4577 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4578 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4579 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4580 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4581 | s32 host_int_del_allstation(struct host_if_drv *hif_drv, |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 4582 | u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4583 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4584 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4585 | struct host_if_msg msg; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 4586 | struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4587 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4588 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4589 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4590 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4591 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4592 | PRINT_ER("driver is null\n"); |
| 4593 | return -EFAULT; |
| 4594 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4595 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4596 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4597 | |
| 4598 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 4599 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4600 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4601 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4602 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4603 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 4604 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 4605 | memcpy(pstrDelAllStationMsg->del_all_sta[i], pu8MacAddr[i], ETH_ALEN); |
| 4606 | PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", |
| 4607 | pstrDelAllStationMsg->del_all_sta[i][0], |
| 4608 | pstrDelAllStationMsg->del_all_sta[i][1], |
| 4609 | pstrDelAllStationMsg->del_all_sta[i][2], |
| 4610 | pstrDelAllStationMsg->del_all_sta[i][3], |
| 4611 | pstrDelAllStationMsg->del_all_sta[i][4], |
| 4612 | pstrDelAllStationMsg->del_all_sta[i][5]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4613 | u8AssocNumb++; |
| 4614 | } |
| 4615 | } |
| 4616 | if (!u8AssocNumb) { |
| 4617 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4618 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4619 | } |
| 4620 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 4621 | pstrDelAllStationMsg->assoc_sta = u8AssocNumb; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4622 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4623 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4624 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4625 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4626 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4627 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4628 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4629 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4630 | } |
| 4631 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4632 | s32 host_int_edit_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4633 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4634 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4635 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4636 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4637 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4638 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4639 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4640 | PRINT_ER("driver is null\n"); |
| 4641 | return -EFAULT; |
| 4642 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4643 | |
| 4644 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 4645 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4646 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4647 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4648 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4649 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4650 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4651 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4652 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4653 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 4654 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4655 | if (!rates) |
| 4656 | return -ENOMEM; |
| 4657 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4658 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 4659 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4660 | } |
| 4661 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4662 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4663 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4664 | PRINT_ER("wilc_mq_send fail\n"); |
| 4665 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4666 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4667 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4668 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4669 | s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv, |
| 4670 | bool bIsEnabled, |
| 4671 | u32 u32Timeout) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4672 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4673 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4674 | struct host_if_msg msg; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 4675 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4676 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4677 | 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] | 4678 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4679 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4680 | PRINT_ER("driver is null\n"); |
| 4681 | return -EFAULT; |
| 4682 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4683 | |
| 4684 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 4685 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4686 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4687 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4688 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4689 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4690 | |
Leo Kim | 33c70c1 | 2015-10-13 20:02:07 +0900 | [diff] [blame] | 4691 | pstrPowerMgmtParam->enabled = bIsEnabled; |
Leo Kim | 937918f | 2015-10-13 20:02:08 +0900 | [diff] [blame] | 4692 | pstrPowerMgmtParam->timeout = u32Timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4693 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4694 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4695 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4696 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4697 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4698 | } |
| 4699 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4700 | s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv, |
| 4701 | bool bIsEnabled, |
| 4702 | u32 u32count) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4703 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4704 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4705 | struct host_if_msg msg; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 4706 | struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4707 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4708 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4709 | PRINT_ER("driver is null\n"); |
| 4710 | return -EFAULT; |
| 4711 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4712 | |
| 4713 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 4714 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4715 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4716 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4717 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4718 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4719 | |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 4720 | pstrMulticastFilterParam->enabled = bIsEnabled; |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 4721 | pstrMulticastFilterParam->cnt = u32count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4722 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4723 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4724 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4725 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4726 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4727 | } |
| 4728 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4729 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 4730 | { |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4731 | struct join_bss_param *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4732 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4733 | u16 u16IEsLen; |
| 4734 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4735 | u8 suppRatesNo = 0; |
| 4736 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4737 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4738 | u8 pcipherCount; |
| 4739 | u8 authCount; |
| 4740 | u8 pcipherTotalCount = 0; |
| 4741 | u8 authTotalCount = 0; |
| 4742 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4743 | |
| 4744 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 4745 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 4746 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 4747 | pNewJoinBssParam = kzalloc(sizeof(struct join_bss_param), GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4748 | if (pNewJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4749 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 4750 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 4751 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4752 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4753 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Leo Kim | 619d27b | 2015-10-15 13:24:42 +0900 | [diff] [blame] | 4754 | pNewJoinBssParam->ssid_len = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4755 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 4756 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4757 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4758 | while (index < u16IEsLen) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4759 | if (pu8IEs[index] == SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4760 | suppRatesNo = pu8IEs[index + 1]; |
| 4761 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4762 | index += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4763 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4764 | for (i = 0; i < suppRatesNo; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4765 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4766 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4767 | index += suppRatesNo; |
| 4768 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4769 | } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4770 | extSuppRatesNo = pu8IEs[index + 1]; |
| 4771 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 4772 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 4773 | else |
| 4774 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 4775 | index += 2; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4776 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4777 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4778 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4779 | index += extSuppRatesNo; |
| 4780 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4781 | } else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4782 | pNewJoinBssParam->ht_capable = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4783 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4784 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4785 | } else if ((pu8IEs[index] == WMM_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4786 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4787 | (pu8IEs[index + 4] == 0xF2) && |
| 4788 | (pu8IEs[index + 5] == 0x02) && |
| 4789 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4790 | (pu8IEs[index + 7] == 0x01)) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4791 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4792 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4793 | if (pu8IEs[index + 8] & BIT(7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4794 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4795 | index += pu8IEs[index + 1] + 2; |
| 4796 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4797 | } else if ((pu8IEs[index] == P2P_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4798 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4799 | (pu8IEs[index + 4] == 0x9a) && |
| 4800 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4801 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4802 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4803 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 4804 | pNewJoinBssParam->noa_enabled = 1; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 4805 | pNewJoinBssParam->idx = pu8IEs[index + 9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4806 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4807 | if (pu8IEs[index + 10] & BIT(7)) { |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4808 | pNewJoinBssParam->opp_enabled = 1; |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 4809 | pNewJoinBssParam->ct_window = pu8IEs[index + 10]; |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4810 | } else { |
| 4811 | pNewJoinBssParam->opp_enabled = 0; |
| 4812 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4813 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4814 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4815 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4816 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4817 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 4818 | pNewJoinBssParam->cnt = pu8IEs[index + 11]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4819 | u16P2P_count = index + 12; |
| 4820 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 4821 | memcpy(pNewJoinBssParam->duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4822 | u16P2P_count += 4; |
| 4823 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 4824 | memcpy(pNewJoinBssParam->interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4825 | u16P2P_count += 4; |
| 4826 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 4827 | memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4828 | |
| 4829 | index += pu8IEs[index + 1] + 2; |
| 4830 | continue; |
| 4831 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4832 | } else if ((pu8IEs[index] == RSN_IE) || |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4833 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 4834 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 4835 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4836 | u16 rsnIndex = index; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4837 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4838 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 4839 | pNewJoinBssParam->mode_802_11i = 2; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4840 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4841 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 4842 | pNewJoinBssParam->mode_802_11i = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4843 | rsnIndex += 4; |
| 4844 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4845 | |
| 4846 | rsnIndex += 7; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4847 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 4848 | rsnIndex++; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4849 | jumpOffset = pu8IEs[rsnIndex] * 4; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4850 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4851 | rsnIndex += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4852 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4853 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4854 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4855 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4856 | pcipherTotalCount += pcipherCount; |
| 4857 | rsnIndex += jumpOffset; |
| 4858 | |
| 4859 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 4860 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4861 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4862 | rsnIndex += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4863 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4864 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4865 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4866 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4867 | authTotalCount += authCount; |
| 4868 | rsnIndex += jumpOffset; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4869 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4870 | if (pu8IEs[index] == RSN_IE) { |
| 4871 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 4872 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 4873 | rsnIndex += 2; |
| 4874 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 4875 | pNewJoinBssParam->rsn_found = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4876 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4877 | continue; |
| 4878 | } else |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4879 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4880 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4881 | } |
| 4882 | |
| 4883 | return (void *)pNewJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4884 | } |
| 4885 | |
| 4886 | void host_int_freeJoinParams(void *pJoinParams) |
| 4887 | { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4888 | if ((struct bss_param *)pJoinParams) |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4889 | kfree((struct bss_param *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4890 | else |
| 4891 | PRINT_ER("Unable to FREE null pointer\n"); |
| 4892 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4893 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4894 | s32 host_int_delBASession(struct host_if_drv *hif_drv, char *pBSSID, char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4895 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4896 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4897 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4898 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4899 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4900 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4901 | PRINT_ER("driver is null\n"); |
| 4902 | return -EFAULT; |
| 4903 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4904 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4905 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4906 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4907 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4908 | |
| 4909 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 4910 | pBASessionInfo->u8Ted = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4911 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4912 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4913 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4914 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4915 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4916 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4917 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4918 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4919 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4920 | } |
| 4921 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4922 | s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, |
| 4923 | char *pBSSID, |
| 4924 | char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4925 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4926 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4927 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4928 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4929 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4930 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4931 | PRINT_ER("driver is null\n"); |
| 4932 | return -EFAULT; |
| 4933 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4934 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4935 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4936 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4937 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4938 | |
| 4939 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 4940 | pBASessionInfo->u8Ted = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4941 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4942 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4943 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4944 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4945 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4946 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4947 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4948 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4949 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4950 | } |
| 4951 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4952 | s32 host_int_setup_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4953 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4954 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4955 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4956 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4957 | return 0; |
| 4958 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4959 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4960 | PRINT_ER("driver is null\n"); |
| 4961 | return -EFAULT; |
| 4962 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4963 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4964 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4965 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4966 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4967 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 4968 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4969 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4970 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4971 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4972 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4973 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4974 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4975 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4976 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4977 | } |
| 4978 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4979 | s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4980 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4981 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4982 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4983 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4984 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4985 | PRINT_ER("driver is null\n"); |
| 4986 | return -EFAULT; |
| 4987 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4988 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4989 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4990 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4991 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4992 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 4993 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4994 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4995 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4996 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4997 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4998 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4999 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5000 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5001 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5002 | } |