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 | |
Leo Kim | fb70e9f | 2015-11-05 14:36:09 +0900 | [diff] [blame] | 246 | u8 multicast_mac_addr_list[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 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 274 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 275 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 276 | static int add_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 277 | { |
| 278 | int i; |
| 279 | |
| 280 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 281 | if (!wfidrv_list[i]) { |
| 282 | wfidrv_list[i] = handler; |
| 283 | return 0; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | return -ENOBUFS; |
| 288 | } |
| 289 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 290 | static int remove_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 291 | { |
| 292 | int i; |
| 293 | |
| 294 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 295 | if (wfidrv_list[i] == handler) { |
| 296 | wfidrv_list[i] = NULL; |
| 297 | return 0; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | return -EINVAL; |
| 302 | } |
| 303 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 304 | static int get_id_from_handler(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 305 | { |
| 306 | int i; |
| 307 | |
| 308 | if (!handler) |
| 309 | return 0; |
| 310 | |
| 311 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 312 | if (wfidrv_list[i] == handler) |
| 313 | return i; |
| 314 | } |
| 315 | |
| 316 | return 0; |
| 317 | } |
| 318 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 319 | static struct host_if_drv *get_handler_from_id(int id) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 320 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 321 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 322 | return NULL; |
| 323 | return wfidrv_list[id]; |
| 324 | } |
| 325 | |
Leo Kim | 3eec50c | 2015-11-06 11:20:03 +0900 | [diff] [blame] | 326 | static s32 handle_set_channel(struct host_if_drv *hif_drv, |
Leo Kim | 9cf7878 | 2015-10-29 12:05:54 +0900 | [diff] [blame] | 327 | struct channel_attr *hif_set_ch) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 328 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 329 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 330 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 331 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 332 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 333 | wid.type = WID_CHAR; |
Leo Kim | 9cf7878 | 2015-10-29 12:05:54 +0900 | [diff] [blame] | 334 | wid.val = (char *)&hif_set_ch->set_ch; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 335 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 336 | |
| 337 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 338 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 339 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 340 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 341 | |
| 342 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 343 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 344 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 345 | } |
| 346 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 347 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 348 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 349 | |
Leo Kim | 23f2bad | 2015-11-06 11:20:04 +0900 | [diff] [blame] | 350 | static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, |
| 351 | struct drv_handler *hif_drv_handler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 352 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 353 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 354 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 355 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 356 | wid.id = (u16)WID_SET_DRV_HANDLER; |
| 357 | wid.type = WID_INT; |
Leo Kim | 6b73c74 | 2015-10-29 12:05:55 +0900 | [diff] [blame] | 358 | wid.val = (s8 *)&hif_drv_handler->handler; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 359 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 360 | |
Leo Kim | 6b73c74 | 2015-10-29 12:05:55 +0900 | [diff] [blame] | 361 | result = send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 362 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 363 | if (!hif_drv) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 364 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 365 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 366 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 367 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 368 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 369 | } |
| 370 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 371 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 372 | } |
| 373 | |
Leo Kim | 97b5c59 | 2015-11-06 11:20:05 +0900 | [diff] [blame] | 374 | static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, |
| 375 | struct op_mode *hif_op_mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 376 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 377 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 378 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 379 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 380 | wid.id = (u16)WID_SET_OPERATION_MODE; |
| 381 | wid.type = WID_INT; |
Leo Kim | acff1d7 | 2015-10-29 12:05:56 +0900 | [diff] [blame] | 382 | wid.val = (s8 *)&hif_op_mode->mode; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 383 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 384 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 385 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 386 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 387 | |
Leo Kim | acff1d7 | 2015-10-29 12:05:56 +0900 | [diff] [blame] | 388 | if ((hif_op_mode->mode) == IDLE_MODE) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 389 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 390 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 391 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 392 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 393 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 394 | } |
| 395 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 396 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 397 | } |
| 398 | |
Leo Kim | a6e6d48 | 2015-11-06 11:20:06 +0900 | [diff] [blame] | 399 | s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 400 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 401 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 402 | struct wid wid; |
Leo Kim | ebc57d1 | 2015-11-05 14:36:03 +0900 | [diff] [blame] | 403 | char firmware_ip_addr[4] = {0}; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 404 | |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 405 | if (ip_addr[0] < 192) |
| 406 | ip_addr[0] = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 407 | |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 408 | PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", |
| 409 | idx, ip_addr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 410 | |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 411 | memcpy(set_ip[idx], ip_addr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 412 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 413 | wid.id = (u16)WID_IP_ADDRESS; |
| 414 | wid.type = WID_STR; |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 415 | wid.val = (u8 *)ip_addr; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 416 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 417 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 418 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 419 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 420 | |
Leo Kim | ebc57d1 | 2015-11-05 14:36:03 +0900 | [diff] [blame] | 421 | host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 422 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 423 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 424 | PRINT_ER("Failed to set IP address\n"); |
| 425 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 426 | } |
| 427 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 428 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 429 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 430 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 431 | } |
| 432 | |
Leo Kim | d451695 | 2015-11-06 11:20:07 +0900 | [diff] [blame] | 433 | s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 434 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 435 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 436 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 437 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 438 | wid.id = (u16)WID_IP_ADDRESS; |
| 439 | wid.type = WID_STR; |
| 440 | wid.val = kmalloc(IP_ALEN, GFP_KERNEL); |
| 441 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 442 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 443 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 444 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 445 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 446 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 447 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 448 | memcpy(get_ip[idx], wid.val, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 449 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 450 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 451 | |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 452 | if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 453 | host_int_setup_ipaddress(hif_drv, set_ip[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 454 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 455 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 456 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 457 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 458 | } |
| 459 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 460 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 461 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", get_ip[idx]); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 462 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 463 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 464 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 465 | } |
| 466 | |
Leo Kim | a826742 | 2015-11-06 11:20:08 +0900 | [diff] [blame] | 467 | static s32 handle_set_mac_address(struct host_if_drv *hif_drv, |
| 468 | struct set_mac_addr *set_mac_addr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 469 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 470 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 471 | struct wid wid; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 472 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 473 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 474 | if (!mac_buf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 475 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 476 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 477 | } |
Leo Kim | 090dbb1 | 2015-11-05 14:36:05 +0900 | [diff] [blame] | 478 | memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 479 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 480 | wid.id = (u16)WID_MAC_ADDR; |
| 481 | wid.type = WID_STR; |
| 482 | wid.val = mac_buf; |
| 483 | wid.size = ETH_ALEN; |
| 484 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 485 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 486 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 487 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 488 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 489 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 490 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 491 | } |
| 492 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 493 | kfree(mac_buf); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 494 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 495 | } |
| 496 | |
Leo Kim | b3bf8fd | 2015-11-06 11:20:09 +0900 | [diff] [blame] | 497 | static s32 handle_get_mac_address(struct host_if_drv *hif_drv, |
| 498 | struct get_mac_addr *get_mac_addr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 499 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 500 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 501 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 502 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 503 | wid.id = (u16)WID_MAC_ADDR; |
| 504 | wid.type = WID_STR; |
Leo Kim | 7f0ee9a | 2015-11-05 14:36:06 +0900 | [diff] [blame] | 505 | wid.val = get_mac_addr->mac_addr; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 506 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 507 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 508 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 509 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 510 | |
| 511 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 512 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 513 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 514 | } |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 515 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 516 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 517 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 518 | } |
| 519 | |
Leo Kim | dc27666 | 2015-11-06 11:20:10 +0900 | [diff] [blame] | 520 | static s32 handle_cfg_param(struct host_if_drv *hif_drv, |
| 521 | struct cfg_param_attr *cfg_param_attr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 522 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 523 | s32 result = 0; |
Leo Kim | 13ca52a | 2015-11-06 11:20:11 +0900 | [diff] [blame] | 524 | struct wid wid_list[32]; |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 525 | u8 wid_cnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 526 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 527 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 528 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 529 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 530 | |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 531 | if (cfg_param_attr->cfg_attr_info.flag & BSS_TYPE) { |
| 532 | if (cfg_param_attr->cfg_attr_info.bss_type < 6) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 533 | wid_list[wid_cnt].id = WID_BSS_TYPE; |
| 534 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.bss_type; |
| 535 | wid_list[wid_cnt].type = WID_CHAR; |
| 536 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 537 | hif_drv->cfg_values.bss_type = (u8)cfg_param_attr->cfg_attr_info.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 538 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 539 | PRINT_ER("check value 6 over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 540 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 541 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 542 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 543 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 544 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 545 | if (cfg_param_attr->cfg_attr_info.flag & AUTH_TYPE) { |
| 546 | if (cfg_param_attr->cfg_attr_info.auth_type == 1 || |
| 547 | cfg_param_attr->cfg_attr_info.auth_type == 2 || |
| 548 | cfg_param_attr->cfg_attr_info.auth_type == 5) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 549 | wid_list[wid_cnt].id = WID_AUTH_TYPE; |
| 550 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_type; |
| 551 | wid_list[wid_cnt].type = WID_CHAR; |
| 552 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 553 | hif_drv->cfg_values.auth_type = (u8)cfg_param_attr->cfg_attr_info.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 554 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 555 | PRINT_ER("Impossible value \n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 556 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 557 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 558 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 559 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 560 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 561 | if (cfg_param_attr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { |
| 562 | if (cfg_param_attr->cfg_attr_info.auth_timeout > 0 && |
| 563 | cfg_param_attr->cfg_attr_info.auth_timeout < 65536) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 564 | wid_list[wid_cnt].id = WID_AUTH_TIMEOUT; |
| 565 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_timeout; |
| 566 | wid_list[wid_cnt].type = WID_SHORT; |
| 567 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 568 | hif_drv->cfg_values.auth_timeout = cfg_param_attr->cfg_attr_info.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 569 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 570 | PRINT_ER("Range(1 ~ 65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 571 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 572 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 573 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 574 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 575 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 576 | if (cfg_param_attr->cfg_attr_info.flag & POWER_MANAGEMENT) { |
| 577 | if (cfg_param_attr->cfg_attr_info.power_mgmt_mode < 5) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 578 | wid_list[wid_cnt].id = WID_POWER_MANAGEMENT; |
| 579 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.power_mgmt_mode; |
| 580 | wid_list[wid_cnt].type = WID_CHAR; |
| 581 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 582 | hif_drv->cfg_values.power_mgmt_mode = (u8)cfg_param_attr->cfg_attr_info.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 583 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 584 | PRINT_ER("Invalide power mode\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 585 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 586 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 587 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 588 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 589 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 590 | if (cfg_param_attr->cfg_attr_info.flag & RETRY_SHORT) { |
| 591 | if (cfg_param_attr->cfg_attr_info.short_retry_limit > 0 && |
| 592 | cfg_param_attr->cfg_attr_info.short_retry_limit < 256) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 593 | wid_list[wid_cnt].id = WID_SHORT_RETRY_LIMIT; |
| 594 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_retry_limit; |
| 595 | wid_list[wid_cnt].type = WID_SHORT; |
| 596 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 597 | hif_drv->cfg_values.short_retry_limit = cfg_param_attr->cfg_attr_info.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 598 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 599 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 600 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 601 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 602 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 603 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 604 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 605 | if (cfg_param_attr->cfg_attr_info.flag & RETRY_LONG) { |
| 606 | if (cfg_param_attr->cfg_attr_info.long_retry_limit > 0 && |
| 607 | cfg_param_attr->cfg_attr_info.long_retry_limit < 256) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 608 | wid_list[wid_cnt].id = WID_LONG_RETRY_LIMIT; |
| 609 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.long_retry_limit; |
| 610 | wid_list[wid_cnt].type = WID_SHORT; |
| 611 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 612 | hif_drv->cfg_values.long_retry_limit = cfg_param_attr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 613 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 614 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 615 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 616 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 617 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 618 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 619 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 620 | if (cfg_param_attr->cfg_attr_info.flag & FRAG_THRESHOLD) { |
| 621 | if (cfg_param_attr->cfg_attr_info.frag_threshold > 255 && |
| 622 | cfg_param_attr->cfg_attr_info.frag_threshold < 7937) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 623 | wid_list[wid_cnt].id = WID_FRAG_THRESHOLD; |
| 624 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.frag_threshold; |
| 625 | wid_list[wid_cnt].type = WID_SHORT; |
| 626 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 627 | hif_drv->cfg_values.frag_threshold = cfg_param_attr->cfg_attr_info.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 628 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 629 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 630 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 631 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 632 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 633 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 634 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 635 | if (cfg_param_attr->cfg_attr_info.flag & RTS_THRESHOLD) { |
| 636 | if (cfg_param_attr->cfg_attr_info.rts_threshold > 255 && |
| 637 | cfg_param_attr->cfg_attr_info.rts_threshold < 65536) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 638 | wid_list[wid_cnt].id = WID_RTS_THRESHOLD; |
| 639 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.rts_threshold; |
| 640 | wid_list[wid_cnt].type = WID_SHORT; |
| 641 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 642 | hif_drv->cfg_values.rts_threshold = cfg_param_attr->cfg_attr_info.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 643 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 644 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 645 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 646 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 647 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 648 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 649 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 650 | if (cfg_param_attr->cfg_attr_info.flag & PREAMBLE) { |
| 651 | if (cfg_param_attr->cfg_attr_info.preamble_type < 3) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 652 | wid_list[wid_cnt].id = WID_PREAMBLE; |
| 653 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.preamble_type; |
| 654 | wid_list[wid_cnt].type = WID_CHAR; |
| 655 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 656 | hif_drv->cfg_values.preamble_type = cfg_param_attr->cfg_attr_info.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 657 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 658 | PRINT_ER("Preamle Range(0~2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 659 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 660 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 661 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 662 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 663 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 664 | if (cfg_param_attr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { |
| 665 | if (cfg_param_attr->cfg_attr_info.short_slot_allowed < 2) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 666 | wid_list[wid_cnt].id = WID_SHORT_SLOT_ALLOWED; |
| 667 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_slot_allowed; |
| 668 | wid_list[wid_cnt].type = WID_CHAR; |
| 669 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 670 | hif_drv->cfg_values.short_slot_allowed = (u8)cfg_param_attr->cfg_attr_info.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 671 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 672 | PRINT_ER("Short slot(2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 673 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 674 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 675 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 676 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 677 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 678 | if (cfg_param_attr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { |
| 679 | if (cfg_param_attr->cfg_attr_info.txop_prot_disabled < 2) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 680 | wid_list[wid_cnt].id = WID_11N_TXOP_PROT_DISABLE; |
| 681 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.txop_prot_disabled; |
| 682 | wid_list[wid_cnt].type = WID_CHAR; |
| 683 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 684 | hif_drv->cfg_values.txop_prot_disabled = (u8)cfg_param_attr->cfg_attr_info.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 685 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 686 | PRINT_ER("TXOP prot disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 687 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 688 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 689 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 690 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 691 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 692 | if (cfg_param_attr->cfg_attr_info.flag & BEACON_INTERVAL) { |
| 693 | if (cfg_param_attr->cfg_attr_info.beacon_interval > 0 && |
| 694 | cfg_param_attr->cfg_attr_info.beacon_interval < 65536) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 695 | wid_list[wid_cnt].id = WID_BEACON_INTERVAL; |
| 696 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.beacon_interval; |
| 697 | wid_list[wid_cnt].type = WID_SHORT; |
| 698 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 699 | hif_drv->cfg_values.beacon_interval = cfg_param_attr->cfg_attr_info.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 700 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 701 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 702 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 703 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 704 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 705 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 706 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 707 | if (cfg_param_attr->cfg_attr_info.flag & DTIM_PERIOD) { |
| 708 | if (cfg_param_attr->cfg_attr_info.dtim_period > 0 && |
| 709 | cfg_param_attr->cfg_attr_info.dtim_period < 256) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 710 | wid_list[wid_cnt].id = WID_DTIM_PERIOD; |
| 711 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.dtim_period; |
| 712 | wid_list[wid_cnt].type = WID_CHAR; |
| 713 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 714 | hif_drv->cfg_values.dtim_period = cfg_param_attr->cfg_attr_info.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 715 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 716 | PRINT_ER("DTIM range(1~255) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 717 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 718 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 719 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 720 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 721 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 722 | if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY) { |
| 723 | if (cfg_param_attr->cfg_attr_info.site_survey_enabled < 3) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 724 | wid_list[wid_cnt].id = WID_SITE_SURVEY; |
| 725 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_enabled; |
| 726 | wid_list[wid_cnt].type = WID_CHAR; |
| 727 | wid_list[wid_cnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 728 | hif_drv->cfg_values.site_survey_enabled = (u8)cfg_param_attr->cfg_attr_info.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 729 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 730 | PRINT_ER("Site survey disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 731 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 732 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 733 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 734 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 735 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 736 | if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { |
| 737 | if (cfg_param_attr->cfg_attr_info.site_survey_scan_time > 0 && |
| 738 | cfg_param_attr->cfg_attr_info.site_survey_scan_time < 65536) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 739 | wid_list[wid_cnt].id = WID_SITE_SURVEY_SCAN_TIME; |
| 740 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_scan_time; |
| 741 | wid_list[wid_cnt].type = WID_SHORT; |
| 742 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 743 | hif_drv->cfg_values.site_survey_scan_time = cfg_param_attr->cfg_attr_info.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 744 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 745 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 746 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 747 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 748 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 749 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 750 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 751 | if (cfg_param_attr->cfg_attr_info.flag & ACTIVE_SCANTIME) { |
| 752 | if (cfg_param_attr->cfg_attr_info.active_scan_time > 0 && |
| 753 | cfg_param_attr->cfg_attr_info.active_scan_time < 65536) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 754 | wid_list[wid_cnt].id = WID_ACTIVE_SCAN_TIME; |
| 755 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.active_scan_time; |
| 756 | wid_list[wid_cnt].type = WID_SHORT; |
| 757 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 758 | hif_drv->cfg_values.active_scan_time = cfg_param_attr->cfg_attr_info.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 759 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 760 | PRINT_ER("Active scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 761 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 762 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 763 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 764 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 765 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 766 | if (cfg_param_attr->cfg_attr_info.flag & PASSIVE_SCANTIME) { |
| 767 | if (cfg_param_attr->cfg_attr_info.passive_scan_time > 0 && |
| 768 | cfg_param_attr->cfg_attr_info.passive_scan_time < 65536) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 769 | wid_list[wid_cnt].id = WID_PASSIVE_SCAN_TIME; |
| 770 | wid_list[wid_cnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.passive_scan_time; |
| 771 | wid_list[wid_cnt].type = WID_SHORT; |
| 772 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 773 | hif_drv->cfg_values.passive_scan_time = cfg_param_attr->cfg_attr_info.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 774 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 775 | PRINT_ER("Passive scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 776 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 777 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 778 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 779 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 780 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 781 | if (cfg_param_attr->cfg_attr_info.flag & CURRENT_TX_RATE) { |
| 782 | enum CURRENT_TXRATE curr_tx_rate = cfg_param_attr->cfg_attr_info.curr_tx_rate; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 783 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 784 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 785 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 786 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 787 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 788 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 789 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 790 | wid_list[wid_cnt].id = WID_CURRENT_TX_RATE; |
| 791 | wid_list[wid_cnt].val = (s8 *)&curr_tx_rate; |
| 792 | wid_list[wid_cnt].type = WID_SHORT; |
| 793 | wid_list[wid_cnt].size = sizeof(u16); |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 794 | hif_drv->cfg_values.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 795 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 796 | PRINT_ER("out of TX rate\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 797 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 798 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 799 | } |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 800 | wid_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 801 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 802 | |
Leo Kim | 540c3e8 | 2015-11-06 11:20:12 +0900 | [diff] [blame] | 803 | result = send_config_pkt(SET_CFG, wid_list, wid_cnt, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 804 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 805 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 806 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 807 | PRINT_ER("Error in setting CFG params\n"); |
| 808 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 809 | ERRORHANDLER: |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 810 | up(&hif_drv->sem_cfg_values); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 811 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 812 | } |
| 813 | |
Leo Kim | 3b840e4 | 2015-11-05 14:36:08 +0900 | [diff] [blame] | 814 | static void Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 815 | { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 816 | g_wilc_initialized = 0; |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 817 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 818 | } |
| 819 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 820 | static s32 Handle_Scan(struct host_if_drv *hif_drv, |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 821 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 822 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 823 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 824 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 825 | u32 u32WidsCount = 0; |
| 826 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 827 | u8 *pu8Buffer; |
| 828 | u8 valuesize = 0; |
| 829 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 830 | |
| 831 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 832 | PRINT_D(HOSTINF_DBG, "Scanning: In [%d] state\n", hif_drv->hif_state); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 833 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 834 | hif_drv->usr_scan_req.scan_result = pstrHostIFscanAttr->result; |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 835 | hif_drv->usr_scan_req.arg = pstrHostIFscanAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 836 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 837 | if ((hif_drv->hif_state >= HOST_IF_SCANNING) && |
| 838 | (hif_drv->hif_state < HOST_IF_CONNECTED)) { |
| 839 | PRINT_D(GENERIC_DBG, "Don't scan already in [%d] state\n", |
| 840 | hif_drv->hif_state); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 841 | PRINT_ER("Already scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 842 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 843 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 844 | } |
| 845 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 846 | if (g_obtainingIP || connecting) { |
| 847 | 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] | 848 | PRINT_ER("Don't do obss scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 849 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 850 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 851 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 852 | |
| 853 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 854 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 855 | hif_drv->usr_scan_req.rcvd_ch_cnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 856 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 857 | strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 858 | strWIDList[u32WidsCount].type = WID_STR; |
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 | valuesize += ((pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 862 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 863 | strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 864 | if (strWIDList[u32WidsCount].val) { |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 865 | pu8Buffer = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 866 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 867 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 868 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 869 | 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] | 870 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 871 | for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) { |
| 872 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 873 | memcpy(pu8Buffer, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen); |
| 874 | pu8Buffer += pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 875 | } |
| 876 | |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 877 | strWIDList[u32WidsCount].size = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 878 | u32WidsCount++; |
| 879 | } |
| 880 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 881 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 882 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_PROBE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 883 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 884 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ies; |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 885 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ies_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 886 | u32WidsCount++; |
| 887 | } |
| 888 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 889 | strWIDList[u32WidsCount].id = WID_SCAN_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 890 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 891 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 892 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 893 | u32WidsCount++; |
| 894 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 895 | strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 896 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 897 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 898 | if (pstrHostIFscanAttr->ch_freq_list && |
| 899 | pstrHostIFscanAttr->ch_list_len > 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 900 | int i; |
| 901 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 902 | for (i = 0; i < pstrHostIFscanAttr->ch_list_len; i++) { |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 903 | if (pstrHostIFscanAttr->ch_freq_list[i] > 0) |
| 904 | pstrHostIFscanAttr->ch_freq_list[i] = pstrHostIFscanAttr->ch_freq_list[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 905 | } |
| 906 | } |
| 907 | |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 908 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ch_freq_list; |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 909 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ch_list_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 910 | u32WidsCount++; |
| 911 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 912 | strWIDList[u32WidsCount].id = WID_START_SCAN_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 913 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 914 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 915 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->src; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 916 | u32WidsCount++; |
| 917 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 918 | if (hif_drv->hif_state == HOST_IF_CONNECTED) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 919 | scan_while_connected = true; |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 920 | else if (hif_drv->hif_state == HOST_IF_IDLE) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 921 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 922 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 923 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 924 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 925 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 926 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 927 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 928 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 929 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 930 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 931 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 932 | if (result) { |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 933 | del_timer(&hif_drv->scan_timer); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 934 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 935 | } |
| 936 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 937 | kfree(pstrHostIFscanAttr->ch_freq_list); |
| 938 | pstrHostIFscanAttr->ch_freq_list = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 939 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 940 | kfree(pstrHostIFscanAttr->ies); |
| 941 | pstrHostIFscanAttr->ies = NULL; |
| 942 | kfree(pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo); |
| 943 | pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 944 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 945 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 946 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 947 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 948 | } |
| 949 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 950 | static s32 Handle_ScanDone(struct host_if_drv *hif_drv, |
| 951 | enum scan_event enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 952 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 953 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 954 | u8 u8abort_running_scan; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 955 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 956 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 957 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 958 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 959 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 960 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 961 | u8abort_running_scan = 1; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 962 | wid.id = (u16)WID_ABORT_RUNNING_SCAN; |
| 963 | wid.type = WID_CHAR; |
| 964 | wid.val = (s8 *)&u8abort_running_scan; |
| 965 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 966 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 967 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 968 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 969 | |
| 970 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 971 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 972 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 973 | } |
| 974 | } |
| 975 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 976 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 977 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 978 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 979 | } |
| 980 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 981 | if (hif_drv->usr_scan_req.scan_result) { |
| 982 | hif_drv->usr_scan_req.scan_result(enuEvent, NULL, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 983 | hif_drv->usr_scan_req.arg, NULL); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 984 | hif_drv->usr_scan_req.scan_result = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 985 | } |
| 986 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 987 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 988 | } |
| 989 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 990 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 991 | static s32 Handle_Connect(struct host_if_drv *hif_drv, |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 992 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 993 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 994 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 995 | struct wid strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 996 | u32 u32WidsCount = 0, dummyval = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 997 | u8 *pu8CurrByte = NULL; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 998 | struct join_bss_param *ptstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 999 | |
| 1000 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1001 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1002 | if (memcmp(pstrHostIFconnectAttr->bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1003 | result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1004 | 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] | 1005 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1006 | } |
| 1007 | |
| 1008 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1009 | |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 1010 | ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->params; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1011 | if (!ptstrJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1012 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1013 | result = -ENOENT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1014 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1015 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1016 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1017 | if (pstrHostIFconnectAttr->bssid) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1018 | hif_drv->usr_conn_req.pu8bssid = kmalloc(6, GFP_KERNEL); |
| 1019 | memcpy(hif_drv->usr_conn_req.pu8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1020 | } |
| 1021 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1022 | hif_drv->usr_conn_req.ssid_len = pstrHostIFconnectAttr->ssid_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1023 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1024 | hif_drv->usr_conn_req.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL); |
| 1025 | memcpy(hif_drv->usr_conn_req.pu8ssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1026 | pstrHostIFconnectAttr->ssid, |
| 1027 | pstrHostIFconnectAttr->ssid_len); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1028 | hif_drv->usr_conn_req.pu8ssid[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1029 | } |
| 1030 | |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1031 | hif_drv->usr_conn_req.ies_len = pstrHostIFconnectAttr->ies_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1032 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1033 | hif_drv->usr_conn_req.ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
| 1034 | memcpy(hif_drv->usr_conn_req.ies, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1035 | pstrHostIFconnectAttr->ies, |
| 1036 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1037 | } |
| 1038 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1039 | hif_drv->usr_conn_req.u8security = pstrHostIFconnectAttr->security; |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1040 | hif_drv->usr_conn_req.auth_type = pstrHostIFconnectAttr->auth_type; |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1041 | hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result; |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1042 | hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1043 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1044 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1045 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1046 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1047 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1048 | u32WidsCount++; |
| 1049 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1050 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1051 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1052 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1053 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1054 | u32WidsCount++; |
| 1055 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1056 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1057 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1058 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1059 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1060 | u32WidsCount++; |
| 1061 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1062 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1063 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1064 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1065 | strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.ies; |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1066 | strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ies_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1067 | u32WidsCount++; |
| 1068 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1069 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1070 | info_element_size = hif_drv->usr_conn_req.ies_len; |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1071 | info_element = kmalloc(info_element_size, GFP_KERNEL); |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1072 | memcpy(info_element, hif_drv->usr_conn_req.ies, |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1073 | info_element_size); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1074 | } |
| 1075 | } |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1076 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
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); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1079 | strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.u8security; |
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 | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1083 | mode_11i = hif_drv->usr_conn_req.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1084 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1085 | PRINT_INFO(HOSTINF_DBG, "Encrypt Mode = %x\n", hif_drv->usr_conn_req.u8security); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1086 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1087 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1088 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1089 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1090 | strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1091 | u32WidsCount++; |
| 1092 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1093 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1094 | auth_type = (u8)hif_drv->usr_conn_req.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1095 | |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1096 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", |
| 1097 | hif_drv->usr_conn_req.auth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1098 | PRINT_D(HOSTINF_DBG, "Connecting to network of SSID %s on channel %d\n", |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1099 | hif_drv->usr_conn_req.pu8ssid, pstrHostIFconnectAttr->ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1100 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1101 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1102 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1103 | strWIDList[u32WidsCount].size = 112; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1104 | strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1105 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1106 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1107 | join_req_size = strWIDList[u32WidsCount].size; |
| 1108 | join_req = kmalloc(join_req_size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1109 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1110 | if (!strWIDList[u32WidsCount].val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1111 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1112 | goto ERRORHANDLER; |
| 1113 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1114 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1115 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1116 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1117 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 1118 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len); |
| 1119 | pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1120 | } |
| 1121 | pu8CurrByte += MAX_SSID_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1122 | *(pu8CurrByte++) = INFRASTRUCTURE; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1123 | |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 1124 | if ((pstrHostIFconnectAttr->ch >= 1) && (pstrHostIFconnectAttr->ch <= 14)) { |
| 1125 | *(pu8CurrByte++) = pstrHostIFconnectAttr->ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1126 | } else { |
| 1127 | PRINT_ER("Channel out of range\n"); |
| 1128 | *(pu8CurrByte++) = 0xFF; |
| 1129 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1130 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1131 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1132 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1133 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1134 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1135 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1136 | pu8CurrByte += 6; |
| 1137 | |
Tony Cho | c0f52fb | 2015-10-20 17:10:46 +0900 | [diff] [blame] | 1138 | if (pstrHostIFconnectAttr->bssid) |
| 1139 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
| 1140 | pu8CurrByte += 6; |
| 1141 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1142 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1143 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1144 | 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] | 1145 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1146 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1147 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1148 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1149 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1150 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1151 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1152 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1153 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1154 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1155 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
Leo Kim | ff06982 | 2015-10-29 12:05:26 +0900 | [diff] [blame] | 1156 | hif_drv->usr_conn_req.ht_capable = ptstrJoinBssParam->ht_capable; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1157 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1158 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1159 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1160 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1161 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1162 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1163 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1164 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1165 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1166 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1167 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1168 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1169 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1170 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1171 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1172 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1173 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1174 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1175 | *(pu8CurrByte++) = ptstrJoinBssParam->noa_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1176 | |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1177 | if (ptstrJoinBssParam->noa_enabled) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1178 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1179 | |
| 1180 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1181 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1182 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1183 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1184 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1185 | *(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 1186 | *(pu8CurrByte++) = ptstrJoinBssParam->idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1187 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1188 | if (ptstrJoinBssParam->opp_enabled) |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 1189 | *(pu8CurrByte++) = ptstrJoinBssParam->ct_window; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1190 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 1191 | *(pu8CurrByte++) = ptstrJoinBssParam->cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1192 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 1193 | memcpy(pu8CurrByte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration)); |
| 1194 | pu8CurrByte += sizeof(ptstrJoinBssParam->duration); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1195 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 1196 | memcpy(pu8CurrByte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval)); |
| 1197 | pu8CurrByte += sizeof(ptstrJoinBssParam->interval); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1198 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 1199 | memcpy(pu8CurrByte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time)); |
| 1200 | pu8CurrByte += sizeof(ptstrJoinBssParam->start_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1201 | } else |
| 1202 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1203 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1204 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1205 | u32WidsCount++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1206 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1207 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1208 | memcpy(join_req, pu8CurrByte, join_req_size); |
Leo Kim | 870515c | 2015-10-15 13:25:15 +0900 | [diff] [blame] | 1209 | join_req_drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1210 | } |
| 1211 | |
| 1212 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1213 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1214 | if (pstrHostIFconnectAttr->bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1215 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1216 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1217 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid); |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1218 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1219 | } |
| 1220 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1221 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1222 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1223 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1224 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1225 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1226 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1227 | } else { |
| 1228 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1229 | hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1230 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1231 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1232 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1233 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1234 | tstrConnectInfo strConnectInfo; |
| 1235 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 1236 | del_timer(&hif_drv->connect_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1237 | |
| 1238 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 1239 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1240 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1241 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1242 | if (pstrHostIFconnectAttr->result) { |
| 1243 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1244 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1245 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1246 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 1247 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->ies_len; |
| 1248 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1249 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1250 | pstrHostIFconnectAttr->ies, |
| 1251 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1252 | } |
| 1253 | |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 1254 | pstrHostIFconnectAttr->result(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1255 | &strConnectInfo, |
| 1256 | MAC_DISCONNECTED, |
| 1257 | NULL, |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 1258 | pstrHostIFconnectAttr->arg); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1259 | hif_drv->hif_state = HOST_IF_IDLE; |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1260 | kfree(strConnectInfo.pu8ReqIEs); |
| 1261 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1262 | |
| 1263 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1264 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1265 | } |
| 1266 | } |
| 1267 | |
| 1268 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1269 | kfree(pstrHostIFconnectAttr->bssid); |
| 1270 | pstrHostIFconnectAttr->bssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1271 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1272 | kfree(pstrHostIFconnectAttr->ssid); |
| 1273 | pstrHostIFconnectAttr->ssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1274 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1275 | kfree(pstrHostIFconnectAttr->ies); |
| 1276 | pstrHostIFconnectAttr->ies = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1277 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1278 | kfree(pu8CurrByte); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1279 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1280 | } |
| 1281 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1282 | static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1283 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1284 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1285 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1286 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1287 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1288 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1289 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1290 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1291 | strWIDList[u32WidsCount].val = info_element; |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1292 | strWIDList[u32WidsCount].size = info_element_size; |
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_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1296 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1297 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 1bd9d44 | 2015-10-15 13:25:11 +0900 | [diff] [blame] | 1298 | strWIDList[u32WidsCount].val = (s8 *)(&(mode_11i)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1299 | u32WidsCount++; |
| 1300 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1301 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1302 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1303 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 1304 | strWIDList[u32WidsCount].val = (s8 *)(&auth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1305 | u32WidsCount++; |
| 1306 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1307 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1308 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1309 | strWIDList[u32WidsCount].size = join_req_size; |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1310 | strWIDList[u32WidsCount].val = (s8 *)join_req; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1311 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1312 | |
| 1313 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 1314 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 1315 | |
| 1316 | u32WidsCount++; |
| 1317 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1318 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1319 | get_id_from_handler(join_req_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1320 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1321 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1322 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1323 | } |
| 1324 | |
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 | static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1329 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1330 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1331 | tstrConnectInfo strConnectInfo; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1332 | struct wid wid; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1333 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1334 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1335 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1336 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1337 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1338 | } |
| 1339 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1340 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1341 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1342 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1343 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1344 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1345 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1346 | if (hif_drv->usr_conn_req.conn_result) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1347 | if (hif_drv->usr_conn_req.pu8bssid) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1348 | memcpy(strConnectInfo.au8bssid, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1349 | hif_drv->usr_conn_req.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1350 | } |
| 1351 | |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1352 | if (hif_drv->usr_conn_req.ies) { |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1353 | strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ies_len; |
| 1354 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1355 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1356 | hif_drv->usr_conn_req.ies, |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1357 | hif_drv->usr_conn_req.ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1358 | } |
| 1359 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1360 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP, |
| 1361 | &strConnectInfo, |
| 1362 | MAC_DISCONNECTED, |
| 1363 | NULL, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1364 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1365 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1366 | kfree(strConnectInfo.pu8ReqIEs); |
| 1367 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1368 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1369 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1370 | } |
| 1371 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1372 | wid.id = (u16)WID_DISCONNECT; |
| 1373 | wid.type = WID_CHAR; |
| 1374 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1375 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1376 | |
| 1377 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1378 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1379 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1380 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1381 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1382 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1383 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1384 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1385 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1386 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1387 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1388 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1389 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1390 | eth_zero_addr(u8ConnectedSSID); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1391 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1392 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1393 | kfree(join_req); |
| 1394 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1395 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1396 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1397 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1398 | kfree(info_element); |
| 1399 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1400 | } |
| 1401 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1402 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1403 | } |
| 1404 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1405 | static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1406 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1407 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1408 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1409 | bool bNewNtwrkFound; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1410 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1411 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 1412 | void *pJoinParams = NULL; |
| 1413 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1414 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1415 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 1416 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1417 | if (hif_drv->usr_scan_req.scan_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1418 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 1419 | parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1420 | if ((!pstrNetworkInfo) || |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1421 | (!hif_drv->usr_scan_req.scan_result)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1422 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1423 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1424 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1425 | } |
| 1426 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1427 | for (i = 0; i < hif_drv->usr_scan_req.rcvd_ch_cnt; i++) { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1428 | if ((hif_drv->usr_scan_req.net_info[i].au8bssid) && |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1429 | (pstrNetworkInfo->au8bssid)) { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1430 | if (memcmp(hif_drv->usr_scan_req.net_info[i].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1431 | pstrNetworkInfo->au8bssid, 6) == 0) { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1432 | if (pstrNetworkInfo->s8rssi <= hif_drv->usr_scan_req.net_info[i].s8rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1433 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 1434 | goto done; |
| 1435 | } else { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1436 | hif_drv->usr_scan_req.net_info[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1437 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1438 | break; |
| 1439 | } |
| 1440 | } |
| 1441 | } |
| 1442 | } |
| 1443 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 1444 | if (bNewNtwrkFound) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1445 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 1446 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1447 | if (hif_drv->usr_scan_req.rcvd_ch_cnt < MAX_NUM_SCANNED_NETWORKS) { |
| 1448 | hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].s8rssi = pstrNetworkInfo->s8rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1449 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1450 | if (hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].au8bssid && |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1451 | pstrNetworkInfo->au8bssid) { |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1452 | memcpy(hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1453 | pstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1454 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1455 | hif_drv->usr_scan_req.rcvd_ch_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1456 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1457 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1458 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1459 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1460 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 1461 | hif_drv->usr_scan_req.arg, |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1462 | pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1463 | } |
| 1464 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1465 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1466 | } |
| 1467 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1468 | pstrNetworkInfo->bNewNetwork = false; |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1469 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 1470 | hif_drv->usr_scan_req.arg, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1471 | } |
| 1472 | } |
| 1473 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1474 | done: |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1475 | kfree(pstrRcvdNetworkInfo->buffer); |
| 1476 | pstrRcvdNetworkInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1477 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1478 | if (pstrNetworkInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1479 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1480 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1481 | } |
| 1482 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1483 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1484 | } |
| 1485 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1486 | static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 1487 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1488 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1489 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1490 | u8 u8MsgType = 0; |
| 1491 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1492 | u16 u16MsgLen = 0; |
| 1493 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1494 | u8 u8WidLen = 0; |
| 1495 | u8 u8MacStatus; |
| 1496 | u8 u8MacStatusReasonCode; |
| 1497 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1498 | tstrConnectInfo strConnectInfo; |
| 1499 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1500 | s32 s32Err = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1501 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1502 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1503 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 1504 | return -ENODEV; |
| 1505 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1506 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", |
| 1507 | hif_drv->hif_state, pstrRcvdGnrlAsyncInfo->buffer[7]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1508 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1509 | if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || |
| 1510 | (hif_drv->hif_state == HOST_IF_CONNECTED) || |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1511 | hif_drv->usr_scan_req.scan_result) { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1512 | if (!pstrRcvdGnrlAsyncInfo->buffer || |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1513 | !hif_drv->usr_conn_req.conn_result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1514 | PRINT_ER("driver is null\n"); |
| 1515 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1516 | } |
| 1517 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1518 | u8MsgType = pstrRcvdGnrlAsyncInfo->buffer[0]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1519 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1520 | if ('I' != u8MsgType) { |
| 1521 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1522 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1523 | } |
| 1524 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1525 | u8MsgID = pstrRcvdGnrlAsyncInfo->buffer[1]; |
| 1526 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[2], pstrRcvdGnrlAsyncInfo->buffer[3]); |
| 1527 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[4], pstrRcvdGnrlAsyncInfo->buffer[5]); |
| 1528 | u8WidLen = pstrRcvdGnrlAsyncInfo->buffer[6]; |
| 1529 | u8MacStatus = pstrRcvdGnrlAsyncInfo->buffer[7]; |
| 1530 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->buffer[8]; |
| 1531 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1532 | PRINT_INFO(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Info = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1533 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1534 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1535 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 1536 | |
| 1537 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 1538 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1539 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1540 | |
| 1541 | if (u8MacStatus == MAC_CONNECTED) { |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1542 | memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1543 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1544 | host_int_get_assoc_res_info(hif_drv, |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1545 | rcv_assoc_resp, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1546 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 1547 | &u32RcvdAssocRespInfoLen); |
| 1548 | |
| 1549 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 1550 | |
| 1551 | if (u32RcvdAssocRespInfoLen != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1552 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1553 | s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1554 | &pstrConnectRespInfo); |
| 1555 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1556 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1557 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1558 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 1559 | |
| 1560 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 1561 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1562 | if (pstrConnectRespInfo->pu8RespIEs) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1563 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1564 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1565 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1566 | pstrConnectRespInfo->u16RespIEsLen); |
| 1567 | } |
| 1568 | } |
| 1569 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1570 | if (pstrConnectRespInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1571 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 1572 | pstrConnectRespInfo = NULL; |
| 1573 | } |
| 1574 | } |
| 1575 | } |
| 1576 | } |
| 1577 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1578 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1579 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1580 | 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] | 1581 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1582 | |
| 1583 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 1584 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1585 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1586 | } |
| 1587 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1588 | if (hif_drv->usr_conn_req.pu8bssid) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1589 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1590 | memcpy(strConnectInfo.au8bssid, hif_drv->usr_conn_req.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1591 | |
| 1592 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1593 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 1594 | memcpy(hif_drv->assoc_bssid, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1595 | hif_drv->usr_conn_req.pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1596 | } |
| 1597 | } |
| 1598 | |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1599 | if (hif_drv->usr_conn_req.ies) { |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1600 | strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ies_len; |
| 1601 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1602 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1603 | hif_drv->usr_conn_req.ies, |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1604 | hif_drv->usr_conn_req.ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1605 | } |
| 1606 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 1607 | del_timer(&hif_drv->connect_timer); |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1608 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP, |
| 1609 | &strConnectInfo, |
| 1610 | u8MacStatus, |
| 1611 | NULL, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1612 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1613 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1614 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1615 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1616 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1617 | |
| 1618 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1619 | hif_drv->hif_state = HOST_IF_CONNECTED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1620 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1621 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1622 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 1623 | mod_timer(&hDuringIpTimer, |
| 1624 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1625 | } else { |
| 1626 | PRINT_D(HOSTINF_DBG, "MAC status : %d and Connect Status : %d\n", u8MacStatus, strConnectInfo.u16ConnectStatus); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1627 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1628 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1629 | } |
| 1630 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1631 | kfree(strConnectInfo.pu8RespIEs); |
| 1632 | strConnectInfo.pu8RespIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1633 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1634 | kfree(strConnectInfo.pu8ReqIEs); |
| 1635 | strConnectInfo.pu8ReqIEs = NULL; |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1636 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1637 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1638 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1639 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1640 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1641 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1642 | (hif_drv->hif_state == HOST_IF_CONNECTED)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1643 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 1644 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1645 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1646 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1647 | if (hif_drv->usr_scan_req.scan_result) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1648 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 1649 | del_timer(&hif_drv->scan_timer); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1650 | Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1651 | } |
| 1652 | |
| 1653 | strDisconnectNotifInfo.u16reason = 0; |
| 1654 | strDisconnectNotifInfo.ie = NULL; |
| 1655 | strDisconnectNotifInfo.ie_len = 0; |
| 1656 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1657 | if (hif_drv->usr_conn_req.conn_result) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1658 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1659 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1660 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1661 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 1662 | NULL, |
| 1663 | 0, |
| 1664 | &strDisconnectNotifInfo, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1665 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1666 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1667 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1668 | } |
| 1669 | |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 1670 | eth_zero_addr(hif_drv->assoc_bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1671 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1672 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1673 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1674 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1675 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1676 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1677 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1678 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1679 | kfree(join_req); |
| 1680 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1681 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1682 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1683 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1684 | kfree(info_element); |
| 1685 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1686 | } |
| 1687 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1688 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1689 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1690 | |
| 1691 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1692 | (hif_drv->usr_scan_req.scan_result)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1693 | 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] | 1694 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1695 | |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 1696 | del_timer(&hif_drv->scan_timer); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1697 | if (hif_drv->usr_scan_req.scan_result) |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1698 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1699 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1700 | } |
| 1701 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1702 | kfree(pstrRcvdGnrlAsyncInfo->buffer); |
| 1703 | pstrRcvdGnrlAsyncInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1704 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1705 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1706 | } |
| 1707 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1708 | static int Handle_Key(struct host_if_drv *hif_drv, |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 1709 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1710 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1711 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1712 | struct wid wid; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1713 | struct wid strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1714 | u8 i; |
| 1715 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1716 | s8 s8idxarray[1]; |
| 1717 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1718 | |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 1719 | switch (pstrHostIFkeyAttr->type) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1720 | case WEP: |
| 1721 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1722 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1723 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1724 | 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] | 1725 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1726 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1727 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1728 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1729 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1730 | strWIDList[1].id = WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1731 | strWIDList[1].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1732 | strWIDList[1].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1733 | strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1734 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1735 | strWIDList[2].id = (u16)WID_KEY_ID; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1736 | strWIDList[2].type = WID_CHAR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1737 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1738 | strWIDList[2].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1739 | strWIDList[2].size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1740 | |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 1741 | pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key, |
| 1742 | pstrHostIFkeyAttr->attr.wep.key_len, |
| 1743 | GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1744 | |
| 1745 | if (pu8keybuf == NULL) { |
| 1746 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1747 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1748 | } |
| 1749 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1750 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1751 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1752 | strWIDList[3].id = (u16)WID_WEP_KEY_VALUE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1753 | strWIDList[3].type = WID_STR; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1754 | strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1755 | strWIDList[3].val = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1756 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1757 | result = send_config_pkt(SET_CFG, strWIDList, 4, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1758 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1759 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1760 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1761 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1762 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1763 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1764 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1765 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1766 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1767 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1768 | } |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1769 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index; |
| 1770 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1); |
| 1771 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->attr.wep.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1772 | pstrHostIFkeyAttr->attr.wep.key_len); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1773 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1774 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1775 | wid.id = (u16)WID_ADD_WEP_KEY; |
| 1776 | wid.type = WID_STR; |
| 1777 | wid.val = (s8 *)pu8keybuf; |
| 1778 | wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1779 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1780 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1781 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1782 | kfree(pu8keybuf); |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1783 | } else if (pstrHostIFkeyAttr->action & REMOVEKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1784 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1785 | wid.id = (u16)WID_REMOVE_WEP_KEY; |
| 1786 | wid.type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1787 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1788 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1789 | wid.val = s8idxarray; |
| 1790 | wid.size = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1791 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1792 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1793 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1794 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1795 | wid.id = (u16)WID_KEY_ID; |
| 1796 | wid.type = WID_CHAR; |
| 1797 | wid.val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
| 1798 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1799 | |
| 1800 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 1801 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1802 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1803 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1804 | } |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1805 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1806 | break; |
| 1807 | |
Leo Kim | 5cd8f7a | 2015-10-29 12:05:34 +0900 | [diff] [blame] | 1808 | case WPA_RX_GTK: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1809 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1810 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1811 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1812 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1813 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1814 | goto _WPARxGtk_end_case_; |
| 1815 | } |
| 1816 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1817 | if (pstrHostIFkeyAttr->attr.wpa.seq) |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1818 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1819 | |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1820 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1821 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1822 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1823 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1824 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1825 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1826 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1827 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1828 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1829 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1830 | strWIDList[1].id = (u16)WID_ADD_RX_GTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1831 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1832 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1833 | strWIDList[1].size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1834 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1835 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1836 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1837 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1838 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1839 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1840 | } |
| 1841 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1842 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1843 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 1844 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1845 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1846 | if (pu8keybuf == NULL) { |
| 1847 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1848 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1849 | goto _WPARxGtk_end_case_; |
| 1850 | } |
| 1851 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1852 | if (hif_drv->hif_state == HOST_IF_CONNECTED) |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 1853 | memcpy(pu8keybuf, hif_drv->assoc_bssid, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1854 | else |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1855 | PRINT_ER("Couldn't handle WPARxGtk while state is not HOST_IF_CONNECTED\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1856 | |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1857 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1858 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1859 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1860 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1861 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1862 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1863 | wid.id = (u16)WID_ADD_RX_GTK; |
| 1864 | wid.type = WID_STR; |
| 1865 | wid.val = (s8 *)pu8keybuf; |
| 1866 | wid.size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1867 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1868 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1869 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1870 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1871 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1872 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1873 | } |
| 1874 | _WPARxGtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1875 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1876 | kfree(pstrHostIFkeyAttr->attr.wpa.seq); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1877 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1878 | return ret; |
| 1879 | |
| 1880 | break; |
| 1881 | |
Leo Kim | 2141fe3 | 2015-10-29 12:05:35 +0900 | [diff] [blame] | 1882 | case WPA_PTK: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1883 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1884 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1885 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1886 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1887 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1888 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1889 | } |
| 1890 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1891 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1892 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1893 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1894 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1895 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1896 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1897 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1898 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1899 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1900 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1901 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1902 | strWIDList[1].id = (u16)WID_ADD_PTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1903 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1904 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1905 | strWIDList[1].size = PTK_KEY_MSG_LEN + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1906 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1907 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1908 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1909 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1910 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1911 | } |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1912 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1913 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1914 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1915 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1916 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1917 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1918 | } |
| 1919 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1920 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1921 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1922 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1923 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1924 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1925 | wid.id = (u16)WID_ADD_PTK; |
| 1926 | wid.type = WID_STR; |
| 1927 | wid.val = (s8 *)pu8keybuf; |
| 1928 | wid.size = PTK_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1929 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1930 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1931 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1932 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1933 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1934 | } |
| 1935 | |
| 1936 | _WPAPtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1937 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1938 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1939 | return ret; |
| 1940 | |
| 1941 | break; |
| 1942 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1943 | case PMKSA: |
| 1944 | |
| 1945 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 1946 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1947 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1948 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1949 | PRINT_ER("No buffer to send PMKSA Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1950 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1951 | } |
| 1952 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1953 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1954 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1955 | for (i = 0; i < pstrHostIFkeyAttr->attr.pmkid.numpmkid; i++) { |
| 1956 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN); |
| 1957 | 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] | 1958 | } |
| 1959 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1960 | wid.id = (u16)WID_PMKID_INFO; |
| 1961 | wid.type = WID_STR; |
| 1962 | wid.val = (s8 *)pu8keybuf; |
| 1963 | wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1964 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1965 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1966 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1967 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1968 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1969 | break; |
| 1970 | } |
| 1971 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1972 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1973 | PRINT_ER("Failed to send key config packet\n"); |
| 1974 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1975 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1976 | } |
| 1977 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1978 | static void Handle_Disconnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1979 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1980 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1981 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1982 | s32 result = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1983 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1984 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1985 | wid.id = (u16)WID_DISCONNECT; |
| 1986 | wid.type = WID_CHAR; |
| 1987 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1988 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1989 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1990 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1991 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1992 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1993 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1994 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1995 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1996 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1997 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1998 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1999 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2000 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2001 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2002 | } else { |
| 2003 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 2004 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2005 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2006 | |
| 2007 | strDisconnectNotifInfo.u16reason = 0; |
| 2008 | strDisconnectNotifInfo.ie = NULL; |
| 2009 | strDisconnectNotifInfo.ie_len = 0; |
| 2010 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2011 | if (hif_drv->usr_scan_req.scan_result) { |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 2012 | del_timer(&hif_drv->scan_timer); |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2013 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, |
| 2014 | NULL, |
| 2015 | hif_drv->usr_scan_req.arg, |
| 2016 | NULL); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2017 | hif_drv->usr_scan_req.scan_result = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2018 | } |
| 2019 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2020 | if (hif_drv->usr_conn_req.conn_result) { |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2021 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2022 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 2023 | del_timer(&hif_drv->connect_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2024 | } |
| 2025 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2026 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2027 | NULL, |
| 2028 | 0, |
| 2029 | &strDisconnectNotifInfo, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 2030 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2031 | } else { |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2032 | PRINT_ER("usr_conn_req.conn_result = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2033 | } |
| 2034 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 2035 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2036 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2037 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2038 | |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 2039 | eth_zero_addr(hif_drv->assoc_bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2040 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 2041 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 2042 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 2043 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 2044 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 2045 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2046 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2047 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 2048 | kfree(join_req); |
| 2049 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2050 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2051 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2052 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2053 | kfree(info_element); |
| 2054 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2055 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2056 | } |
| 2057 | |
Leo Kim | e55e496 | 2015-10-29 11:58:29 +0900 | [diff] [blame] | 2058 | up(&hif_drv->sem_test_disconn_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2059 | } |
| 2060 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2061 | void resolve_disconnect_aberration(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2062 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2063 | if (!hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2064 | return; |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2065 | if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || |
| 2066 | (hif_drv->hif_state == HOST_IF_CONNECTING)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2067 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2068 | host_int_disconnect(hif_drv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2069 | } |
| 2070 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2071 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2072 | static s32 Handle_GetChnl(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2073 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2074 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2075 | struct wid wid; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2076 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2077 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 2078 | wid.type = WID_CHAR; |
| 2079 | wid.val = (s8 *)&ch_no; |
| 2080 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2081 | |
| 2082 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 2083 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2084 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2085 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2086 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2087 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2088 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2089 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2090 | } |
| 2091 | |
Leo Kim | 4ea9000 | 2015-10-29 11:58:32 +0900 | [diff] [blame] | 2092 | up(&hif_drv->sem_get_chnl); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2093 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2094 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2095 | } |
| 2096 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2097 | static void Handle_GetRssi(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2098 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2099 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2100 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2101 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2102 | wid.id = (u16)WID_RSSI; |
| 2103 | wid.type = WID_CHAR; |
| 2104 | wid.val = &rssi; |
| 2105 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2106 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2107 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 2108 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2109 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2110 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2111 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2112 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2113 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2114 | } |
| 2115 | |
Leo Kim | 7e111f9 | 2015-10-29 11:58:30 +0900 | [diff] [blame] | 2116 | up(&hif_drv->sem_get_rssi); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2117 | } |
| 2118 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2119 | static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2120 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2121 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2122 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2123 | |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 2124 | link_speed = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2125 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2126 | wid.id = (u16)WID_LINKSPEED; |
| 2127 | wid.type = WID_CHAR; |
| 2128 | wid.val = &link_speed; |
| 2129 | wid.size = sizeof(char); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2130 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2131 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 2132 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2133 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2134 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2135 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2136 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2137 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2138 | } |
| 2139 | |
Leo Kim | bc34da6 | 2015-10-29 11:58:31 +0900 | [diff] [blame] | 2140 | up(&hif_drv->sem_get_link_speed); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2141 | } |
| 2142 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2143 | 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] | 2144 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2145 | struct wid strWIDList[5]; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2146 | u32 u32WidsCount = 0, result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2147 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2148 | strWIDList[u32WidsCount].id = WID_LINKSPEED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2149 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2150 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 5babeec | 2015-10-29 12:05:29 +0900 | [diff] [blame] | 2151 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->link_speed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2152 | u32WidsCount++; |
| 2153 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2154 | strWIDList[u32WidsCount].id = WID_RSSI; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2155 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2156 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 00c8dfc | 2015-10-29 12:05:30 +0900 | [diff] [blame] | 2157 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2158 | u32WidsCount++; |
| 2159 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2160 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2161 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2162 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 7e84ff4 | 2015-10-29 12:05:31 +0900 | [diff] [blame] | 2163 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2164 | u32WidsCount++; |
| 2165 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2166 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2167 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2168 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 9b99274 | 2015-10-29 12:05:32 +0900 | [diff] [blame] | 2169 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rx_cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2170 | u32WidsCount++; |
| 2171 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2172 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2173 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2174 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 5416037 | 2015-10-29 12:05:33 +0900 | [diff] [blame] | 2175 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2176 | u32WidsCount++; |
| 2177 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2178 | result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2179 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2180 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2181 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2182 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2183 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2184 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2185 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2186 | } |
| 2187 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2188 | static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 2189 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2190 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2191 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2192 | u8 *stamac; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2193 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2194 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2195 | wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
| 2196 | wid.type = WID_STR; |
| 2197 | wid.size = ETH_ALEN; |
| 2198 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2199 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2200 | stamac = wid.val; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2201 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2202 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2203 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 2204 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2205 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2206 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2207 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2208 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2209 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2210 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2211 | } |
| 2212 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2213 | wid.id = (u16)WID_GET_INACTIVE_TIME; |
| 2214 | wid.type = WID_INT; |
| 2215 | wid.val = (s8 *)&inactive_time; |
| 2216 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2217 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2218 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2219 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2220 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2221 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2222 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2223 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2224 | } |
| 2225 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 2226 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2227 | |
Leo Kim | 569a3c6 | 2015-10-29 11:58:33 +0900 | [diff] [blame] | 2228 | up(&hif_drv->sem_inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2229 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2230 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2231 | } |
| 2232 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2233 | static void Handle_AddBeacon(struct host_if_drv *hif_drv, |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 2234 | struct beacon_attr *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2235 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2236 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2237 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2238 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2239 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2240 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 2241 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2242 | wid.id = (u16)WID_ADD_BEACON; |
| 2243 | wid.type = WID_BIN; |
| 2244 | wid.size = pstrSetBeaconParam->head_len + pstrSetBeaconParam->tail_len + 16; |
| 2245 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2246 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2247 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2248 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2249 | pu8CurrByte = wid.val; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 2250 | *pu8CurrByte++ = (pstrSetBeaconParam->interval & 0xFF); |
| 2251 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 8) & 0xFF); |
| 2252 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 16) & 0xFF); |
| 2253 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2254 | |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 2255 | *pu8CurrByte++ = (pstrSetBeaconParam->dtim_period & 0xFF); |
| 2256 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 8) & 0xFF); |
| 2257 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 16) & 0xFF); |
| 2258 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2259 | |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2260 | *pu8CurrByte++ = (pstrSetBeaconParam->head_len & 0xFF); |
| 2261 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 8) & 0xFF); |
| 2262 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 16) & 0xFF); |
| 2263 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2264 | |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2265 | memcpy(pu8CurrByte, pstrSetBeaconParam->head, pstrSetBeaconParam->head_len); |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2266 | pu8CurrByte += pstrSetBeaconParam->head_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2267 | |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2268 | *pu8CurrByte++ = (pstrSetBeaconParam->tail_len & 0xFF); |
| 2269 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 8) & 0xFF); |
| 2270 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); |
| 2271 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2272 | |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2273 | if (pstrSetBeaconParam->tail > 0) |
| 2274 | memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2275 | pu8CurrByte += pstrSetBeaconParam->tail_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2276 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2277 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2278 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2279 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2280 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2281 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2282 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2283 | kfree(wid.val); |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2284 | kfree(pstrSetBeaconParam->head); |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2285 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2286 | } |
| 2287 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2288 | static void Handle_DelBeacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2289 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2290 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2291 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2292 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2293 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2294 | wid.id = (u16)WID_DEL_BEACON; |
| 2295 | wid.type = WID_CHAR; |
| 2296 | wid.size = sizeof(char); |
| 2297 | wid.val = &del_beacon; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2298 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2299 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2300 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2301 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2302 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2303 | |
| 2304 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2305 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2306 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2307 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2308 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2309 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2310 | } |
| 2311 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2312 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 2313 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2314 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2315 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2316 | |
| 2317 | pu8CurrByte = pu8Buffer; |
| 2318 | |
| 2319 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Leo Kim | 2353c38 | 2015-10-29 12:05:41 +0900 | [diff] [blame] | 2320 | memcpy(pu8CurrByte, pstrStationParam->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2321 | pu8CurrByte += ETH_ALEN; |
| 2322 | |
Leo Kim | 4101eb8 | 2015-10-29 12:05:42 +0900 | [diff] [blame] | 2323 | *pu8CurrByte++ = pstrStationParam->aid & 0xFF; |
| 2324 | *pu8CurrByte++ = (pstrStationParam->aid >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2325 | |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2326 | *pu8CurrByte++ = pstrStationParam->rates_len; |
| 2327 | if (pstrStationParam->rates_len > 0) |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 2328 | memcpy(pu8CurrByte, pstrStationParam->rates, |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2329 | pstrStationParam->rates_len); |
| 2330 | pu8CurrByte += pstrStationParam->rates_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2331 | |
Leo Kim | 2252012 | 2015-10-29 12:05:45 +0900 | [diff] [blame] | 2332 | *pu8CurrByte++ = pstrStationParam->ht_supported; |
Leo Kim | 0d073f6 | 2015-10-29 12:05:46 +0900 | [diff] [blame] | 2333 | *pu8CurrByte++ = pstrStationParam->ht_capa_info & 0xFF; |
| 2334 | *pu8CurrByte++ = (pstrStationParam->ht_capa_info >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2335 | |
Leo Kim | fba1f2d | 2015-10-29 12:05:47 +0900 | [diff] [blame] | 2336 | *pu8CurrByte++ = pstrStationParam->ht_ampdu_params; |
Leo Kim | 5ebbf4f | 2015-10-29 12:05:48 +0900 | [diff] [blame] | 2337 | memcpy(pu8CurrByte, pstrStationParam->ht_supp_mcs_set, |
| 2338 | WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2339 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 2340 | |
Leo Kim | 223741d | 2015-10-29 12:05:49 +0900 | [diff] [blame] | 2341 | *pu8CurrByte++ = pstrStationParam->ht_ext_params & 0xFF; |
| 2342 | *pu8CurrByte++ = (pstrStationParam->ht_ext_params >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2343 | |
Leo Kim | 74fe73c | 2015-10-29 12:05:50 +0900 | [diff] [blame] | 2344 | *pu8CurrByte++ = pstrStationParam->ht_tx_bf_cap & 0xFF; |
| 2345 | *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 8) & 0xFF; |
| 2346 | *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 16) & 0xFF; |
| 2347 | *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 24) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2348 | |
Leo Kim | a486baf | 2015-10-29 12:05:51 +0900 | [diff] [blame] | 2349 | *pu8CurrByte++ = pstrStationParam->ht_ante_sel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2350 | |
Leo Kim | f676e17 | 2015-10-29 12:05:52 +0900 | [diff] [blame] | 2351 | *pu8CurrByte++ = pstrStationParam->flags_mask & 0xFF; |
| 2352 | *pu8CurrByte++ = (pstrStationParam->flags_mask >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2353 | |
Leo Kim | 67ab64e | 2015-10-29 12:05:53 +0900 | [diff] [blame] | 2354 | *pu8CurrByte++ = pstrStationParam->flags_set & 0xFF; |
| 2355 | *pu8CurrByte++ = (pstrStationParam->flags_set >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2356 | |
| 2357 | return pu8CurrByte - pu8Buffer; |
| 2358 | } |
| 2359 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2360 | static void Handle_AddStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2361 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2362 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2363 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2364 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2365 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2366 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2367 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2368 | wid.id = (u16)WID_ADD_STA; |
| 2369 | wid.type = WID_BIN; |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2370 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->rates_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2371 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2372 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2373 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2374 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2375 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2376 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2377 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2378 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2379 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2380 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2381 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2382 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2383 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2384 | ERRORHANDLER: |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 2385 | kfree(pstrStationParam->rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2386 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2387 | } |
| 2388 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2389 | static void Handle_DelAllSta(struct host_if_drv *hif_drv, |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 2390 | struct del_all_sta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2391 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2392 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2393 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2394 | u8 *pu8CurrByte; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2395 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 2396 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2397 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2398 | wid.id = (u16)WID_DEL_ALL_STA; |
| 2399 | wid.type = WID_STR; |
| 2400 | wid.size = (pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2401 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2402 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2403 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2404 | wid.val = kmalloc((pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL); |
| 2405 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2406 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2407 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2408 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2409 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 2410 | *(pu8CurrByte++) = pstrDelAllStaParam->assoc_sta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2411 | |
| 2412 | for (i = 0; i < MAX_NUM_STA; i++) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 2413 | if (memcmp(pstrDelAllStaParam->del_all_sta[i], au8Zero_Buff, ETH_ALEN)) |
| 2414 | memcpy(pu8CurrByte, pstrDelAllStaParam->del_all_sta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2415 | else |
| 2416 | continue; |
| 2417 | |
| 2418 | pu8CurrByte += ETH_ALEN; |
| 2419 | } |
| 2420 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2421 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2422 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2423 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2424 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2425 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2426 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2427 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2428 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2429 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2430 | } |
| 2431 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2432 | static void Handle_DelStation(struct host_if_drv *hif_drv, |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 2433 | struct del_sta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2434 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2435 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2436 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2437 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2438 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2439 | wid.id = (u16)WID_REMOVE_STA; |
| 2440 | wid.type = WID_BIN; |
| 2441 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2442 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2443 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2444 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2445 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2446 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2447 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2448 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2449 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2450 | |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 2451 | memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2452 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2453 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2454 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2455 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2456 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2457 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2458 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2459 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2460 | } |
| 2461 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2462 | static void Handle_EditStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2463 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2464 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2465 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2466 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2467 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2468 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2469 | wid.id = (u16)WID_EDIT_STA; |
| 2470 | wid.type = WID_BIN; |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2471 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->rates_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2472 | |
| 2473 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2474 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2475 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2476 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2477 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2478 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2479 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2480 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2481 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2482 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2483 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2484 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2485 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2486 | ERRORHANDLER: |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 2487 | kfree(pstrStationParam->rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2488 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2489 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2490 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2491 | static int Handle_RemainOnChan(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2492 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2493 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2494 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2495 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2496 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2497 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2498 | if (!hif_drv->remain_on_ch_pending) { |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 2499 | hif_drv->remain_on_ch.arg = pstrHostIfRemainOnChan->arg; |
Leo Kim | bfb62ab | 2015-10-29 11:58:42 +0900 | [diff] [blame] | 2500 | hif_drv->remain_on_ch.expired = pstrHostIfRemainOnChan->expired; |
Leo Kim | 5e5f791 | 2015-10-29 11:58:43 +0900 | [diff] [blame] | 2501 | hif_drv->remain_on_ch.ready = pstrHostIfRemainOnChan->ready; |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2502 | hif_drv->remain_on_ch.ch = pstrHostIfRemainOnChan->ch; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 2503 | hif_drv->remain_on_ch.id = pstrHostIfRemainOnChan->id; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2504 | } else { |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2505 | pstrHostIfRemainOnChan->ch = hif_drv->remain_on_ch.ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2506 | } |
| 2507 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2508 | if (hif_drv->usr_scan_req.scan_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2509 | PRINT_INFO(GENERIC_DBG, "Required to remain on chan while scanning return\n"); |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2510 | hif_drv->remain_on_ch_pending = 1; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2511 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2512 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2513 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2514 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2515 | 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] | 2516 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2517 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2518 | } |
| 2519 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2520 | if (g_obtainingIP || connecting) { |
| 2521 | 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] | 2522 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2523 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2524 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2525 | |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2526 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", |
| 2527 | pstrHostIfRemainOnChan->ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2528 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2529 | u8remain_on_chan_flag = true; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2530 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2531 | wid.type = WID_STR; |
| 2532 | wid.size = 2; |
| 2533 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2534 | if (!wid.val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2535 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2536 | goto ERRORHANDLER; |
| 2537 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2538 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2539 | wid.val[0] = u8remain_on_chan_flag; |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2540 | wid.val[1] = (s8)pstrHostIfRemainOnChan->ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2541 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2542 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2543 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2544 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2545 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2546 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2547 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2548 | { |
| 2549 | P2P_LISTEN_STATE = 1; |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 2550 | hif_drv->remain_on_ch_timer.data = (unsigned long)hif_drv; |
| 2551 | mod_timer(&hif_drv->remain_on_ch_timer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2552 | jiffies + |
| 2553 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2554 | |
Leo Kim | 5e5f791 | 2015-10-29 11:58:43 +0900 | [diff] [blame] | 2555 | if (hif_drv->remain_on_ch.ready) |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 2556 | hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2557 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2558 | if (hif_drv->remain_on_ch_pending) |
| 2559 | hif_drv->remain_on_ch_pending = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2560 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2561 | |
| 2562 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2563 | } |
| 2564 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2565 | static int Handle_RegisterFrame(struct host_if_drv *hif_drv, |
Tony Cho | bc37c5d | 2015-09-21 12:16:59 +0900 | [diff] [blame] | 2566 | struct reg_frame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2567 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2568 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2569 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2570 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2571 | |
Leo Kim | 6abf868 | 2015-10-29 11:58:38 +0900 | [diff] [blame] | 2572 | PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n", |
| 2573 | pstrHostIfRegisterFrame->reg, |
Leo Kim | d5f654c | 2015-10-29 11:58:39 +0900 | [diff] [blame] | 2574 | pstrHostIfRegisterFrame->frame_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2575 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2576 | wid.id = (u16)WID_REGISTER_FRAME; |
| 2577 | wid.type = WID_STR; |
| 2578 | wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
| 2579 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2580 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2581 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2582 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2583 | |
Leo Kim | 6abf868 | 2015-10-29 11:58:38 +0900 | [diff] [blame] | 2584 | *pu8CurrByte++ = pstrHostIfRegisterFrame->reg; |
Leo Kim | bcb410b | 2015-10-29 11:58:40 +0900 | [diff] [blame] | 2585 | *pu8CurrByte++ = pstrHostIfRegisterFrame->reg_id; |
Leo Kim | d5f654c | 2015-10-29 11:58:39 +0900 | [diff] [blame] | 2586 | memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->frame_type, sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2587 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2588 | wid.size = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2589 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2590 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2591 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2592 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2593 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2594 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2595 | } |
| 2596 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2597 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2598 | } |
| 2599 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2600 | static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2601 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2602 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2603 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2604 | struct wid wid; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2605 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2606 | |
| 2607 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 2608 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2609 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2610 | u8remain_on_chan_flag = false; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2611 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2612 | wid.type = WID_STR; |
| 2613 | wid.size = 2; |
| 2614 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2615 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2616 | if (!wid.val) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2617 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2618 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2619 | wid.val[0] = u8remain_on_chan_flag; |
| 2620 | wid.val[1] = FALSE_FRMWR_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2621 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2622 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2623 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2624 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2625 | PRINT_ER("Failed to set remain on channel\n"); |
| 2626 | goto _done_; |
| 2627 | } |
| 2628 | |
Leo Kim | bfb62ab | 2015-10-29 11:58:42 +0900 | [diff] [blame] | 2629 | if (hif_drv->remain_on_ch.expired) { |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 2630 | hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg, |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 2631 | pstrHostIfRemainOnChan->id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2632 | } |
| 2633 | P2P_LISTEN_STATE = 0; |
| 2634 | } else { |
| 2635 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2636 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2637 | } |
| 2638 | |
| 2639 | _done_: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2640 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2641 | } |
| 2642 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 2643 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2644 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2645 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2646 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2647 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2648 | |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 2649 | del_timer(&hif_drv->remain_on_ch_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2650 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2651 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2652 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2653 | msg.drv = hif_drv; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 2654 | msg.body.remain_on_ch.id = hif_drv->remain_on_ch.id; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2655 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2656 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 2657 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2658 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2659 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2660 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2661 | static void Handle_PowerManagement(struct host_if_drv *hif_drv, |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 2662 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2663 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2664 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2665 | struct wid wid; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2666 | s8 s8PowerMode; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2667 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2668 | wid.id = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2669 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 2670 | if (strPowerMgmtParam->enabled) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2671 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2672 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2673 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2674 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2675 | wid.val = &s8PowerMode; |
| 2676 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2677 | |
| 2678 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 2679 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2680 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2681 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2682 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2683 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2684 | } |
| 2685 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2686 | static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 2687 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2688 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2689 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2690 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2691 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2692 | |
| 2693 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 2694 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2695 | wid.id = (u16)WID_SETUP_MULTICAST_FILTER; |
| 2696 | wid.type = WID_BIN; |
| 2697 | wid.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->cnt) * ETH_ALEN); |
| 2698 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2699 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2700 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2701 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2702 | pu8CurrByte = wid.val; |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 2703 | *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); |
| 2704 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); |
| 2705 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); |
| 2706 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2707 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2708 | *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); |
| 2709 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); |
| 2710 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 16) & 0xFF); |
| 2711 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2712 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2713 | if ((strHostIfSetMulti->cnt) > 0) |
Leo Kim | fb70e9f | 2015-11-05 14:36:09 +0900 | [diff] [blame] | 2714 | memcpy(pu8CurrByte, multicast_mac_addr_list, |
| 2715 | ((strHostIfSetMulti->cnt) * ETH_ALEN)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2716 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2717 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2718 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2719 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2720 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2721 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2722 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2723 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2724 | } |
| 2725 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2726 | static s32 Handle_AddBASession(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2727 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2728 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2729 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2730 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2731 | int AddbaTimeout = 100; |
| 2732 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2733 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2734 | PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2735 | strHostIfBASessionInfo->bssid[0], |
| 2736 | strHostIfBASessionInfo->bssid[1], |
| 2737 | strHostIfBASessionInfo->bssid[2], |
Leo Kim | 277c213 | 2015-10-29 11:58:47 +0900 | [diff] [blame] | 2738 | strHostIfBASessionInfo->buf_size, |
Leo Kim | 23d0bfa | 2015-10-29 11:58:48 +0900 | [diff] [blame] | 2739 | strHostIfBASessionInfo->time_out, |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2740 | strHostIfBASessionInfo->tid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2741 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2742 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2743 | wid.type = WID_STR; |
| 2744 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2745 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2746 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2747 | *ptr++ = 0x14; |
| 2748 | *ptr++ = 0x3; |
| 2749 | *ptr++ = 0x0; |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2750 | memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2751 | ptr += ETH_ALEN; |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2752 | *ptr++ = strHostIfBASessionInfo->tid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2753 | *ptr++ = 1; |
Leo Kim | 277c213 | 2015-10-29 11:58:47 +0900 | [diff] [blame] | 2754 | *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); |
| 2755 | *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF); |
Leo Kim | 23d0bfa | 2015-10-29 11:58:48 +0900 | [diff] [blame] | 2756 | *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF); |
| 2757 | *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2758 | *ptr++ = (AddbaTimeout & 0xFF); |
| 2759 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2760 | *ptr++ = 8; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2761 | *ptr++ = 0; |
| 2762 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2763 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2764 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2765 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2766 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 2767 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2768 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2769 | wid.type = WID_STR; |
| 2770 | wid.size = 15; |
| 2771 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2772 | *ptr++ = 15; |
| 2773 | *ptr++ = 7; |
| 2774 | *ptr++ = 0x2; |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2775 | memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2776 | ptr += ETH_ALEN; |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2777 | *ptr++ = strHostIfBASessionInfo->tid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2778 | *ptr++ = 8; |
Leo Kim | 277c213 | 2015-10-29 11:58:47 +0900 | [diff] [blame] | 2779 | *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); |
Leo Kim | 23d0bfa | 2015-10-29 11:58:48 +0900 | [diff] [blame] | 2780 | *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2781 | *ptr++ = 3; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2782 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2783 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2784 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2785 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2786 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2787 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2788 | } |
| 2789 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2790 | static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2791 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2792 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2793 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2794 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2795 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2796 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2797 | PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2798 | strHostIfBASessionInfo->bssid[0], |
| 2799 | strHostIfBASessionInfo->bssid[1], |
| 2800 | strHostIfBASessionInfo->bssid[2], |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2801 | strHostIfBASessionInfo->tid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2802 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2803 | wid.id = (u16)WID_DEL_ALL_RX_BA; |
| 2804 | wid.type = WID_STR; |
| 2805 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2806 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2807 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2808 | *ptr++ = 0x14; |
| 2809 | *ptr++ = 0x3; |
| 2810 | *ptr++ = 0x2; |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2811 | memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2812 | ptr += ETH_ALEN; |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2813 | *ptr++ = strHostIfBASessionInfo->tid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2814 | *ptr++ = 0; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2815 | *ptr++ = 32; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2816 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2817 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2818 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2819 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2820 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 2821 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2822 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2823 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2824 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2825 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2826 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2827 | } |
| 2828 | |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 2829 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2830 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2831 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2832 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2833 | struct host_if_drv *hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2834 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2835 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2836 | |
| 2837 | while (1) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2838 | 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] | 2839 | hif_drv = (struct host_if_drv *)msg.drv; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2840 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2841 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 2842 | break; |
| 2843 | } |
| 2844 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2845 | if ((!g_wilc_initialized)) { |
| 2846 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 2847 | usleep_range(200 * 1000, 200 * 1000); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2848 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2849 | continue; |
| 2850 | } |
| 2851 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2852 | if (msg.id == HOST_IF_MSG_CONNECT && |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2853 | hif_drv->usr_scan_req.scan_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2854 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2855 | 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] | 2856 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2857 | continue; |
| 2858 | } |
| 2859 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2860 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2861 | case HOST_IF_MSG_Q_IDLE: |
| 2862 | Handle_wait_msg_q_empty(); |
| 2863 | break; |
| 2864 | |
| 2865 | case HOST_IF_MSG_SCAN: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2866 | Handle_Scan(msg.drv, &msg.body.scan_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2867 | break; |
| 2868 | |
| 2869 | case HOST_IF_MSG_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2870 | Handle_Connect(msg.drv, &msg.body.con_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2871 | break; |
| 2872 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2873 | case HOST_IF_MSG_FLUSH_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2874 | Handle_FlushConnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2875 | break; |
| 2876 | |
| 2877 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2878 | Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2879 | break; |
| 2880 | |
| 2881 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2882 | Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2883 | break; |
| 2884 | |
| 2885 | case HOST_IF_MSG_KEY: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2886 | Handle_Key(msg.drv, &msg.body.key_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2887 | break; |
| 2888 | |
| 2889 | case HOST_IF_MSG_CFG_PARAMS: |
Leo Kim | dc27666 | 2015-11-06 11:20:10 +0900 | [diff] [blame] | 2890 | handle_cfg_param(msg.drv, &msg.body.cfg_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2891 | break; |
| 2892 | |
| 2893 | case HOST_IF_MSG_SET_CHANNEL: |
Leo Kim | 3eec50c | 2015-11-06 11:20:03 +0900 | [diff] [blame] | 2894 | handle_set_channel(msg.drv, &msg.body.channel_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2895 | break; |
| 2896 | |
| 2897 | case HOST_IF_MSG_DISCONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2898 | Handle_Disconnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2899 | break; |
| 2900 | |
| 2901 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 2902 | del_timer(&hif_drv->scan_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2903 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 2904 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2905 | if (!linux_wlan_get_num_conn_ifcs()) |
Leo Kim | 1b721bf | 2015-11-06 11:13:00 +0900 | [diff] [blame] | 2906 | chip_sleep_manually(); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2907 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2908 | Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2909 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2910 | if (hif_drv->remain_on_ch_pending) |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2911 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2912 | |
| 2913 | break; |
| 2914 | |
| 2915 | case HOST_IF_MSG_GET_RSSI: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2916 | Handle_GetRssi(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2917 | break; |
| 2918 | |
| 2919 | case HOST_IF_MSG_GET_LINKSPEED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2920 | Handle_GetLinkspeed(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2921 | break; |
| 2922 | |
| 2923 | case HOST_IF_MSG_GET_STATISTICS: |
Leo Kim | 03e7b9c | 2015-10-12 16:55:58 +0900 | [diff] [blame] | 2924 | Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2925 | break; |
| 2926 | |
| 2927 | case HOST_IF_MSG_GET_CHNL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2928 | Handle_GetChnl(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2929 | break; |
| 2930 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2931 | case HOST_IF_MSG_ADD_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2932 | Handle_AddBeacon(msg.drv, &msg.body.beacon_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2933 | break; |
| 2934 | |
| 2935 | case HOST_IF_MSG_DEL_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2936 | Handle_DelBeacon(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2937 | break; |
| 2938 | |
| 2939 | case HOST_IF_MSG_ADD_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2940 | Handle_AddStation(msg.drv, &msg.body.add_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2941 | break; |
| 2942 | |
| 2943 | case HOST_IF_MSG_DEL_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2944 | Handle_DelStation(msg.drv, &msg.body.del_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2945 | break; |
| 2946 | |
| 2947 | case HOST_IF_MSG_EDIT_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2948 | Handle_EditStation(msg.drv, &msg.body.edit_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2949 | break; |
| 2950 | |
| 2951 | case HOST_IF_MSG_GET_INACTIVETIME: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2952 | Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2953 | break; |
| 2954 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2955 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 2956 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 2957 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2958 | Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2959 | break; |
| 2960 | |
| 2961 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2962 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2963 | Handle_ConnectTimeout(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2964 | break; |
| 2965 | |
| 2966 | case HOST_IF_MSG_POWER_MGMT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2967 | Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2968 | break; |
| 2969 | |
| 2970 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Leo Kim | 23f2bad | 2015-11-06 11:20:04 +0900 | [diff] [blame] | 2971 | handle_set_wfi_drv_handler(msg.drv, &msg.body.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2972 | break; |
| 2973 | |
| 2974 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Leo Kim | 97b5c59 | 2015-11-06 11:20:05 +0900 | [diff] [blame] | 2975 | handle_set_operation_mode(msg.drv, &msg.body.mode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2976 | break; |
| 2977 | |
| 2978 | case HOST_IF_MSG_SET_IPADDRESS: |
| 2979 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | a6e6d48 | 2015-11-06 11:20:06 +0900 | [diff] [blame] | 2980 | handle_set_ip_address(msg.drv, |
| 2981 | msg.body.ip_info.ip_addr, |
| 2982 | msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2983 | break; |
| 2984 | |
| 2985 | case HOST_IF_MSG_GET_IPADDRESS: |
| 2986 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | d451695 | 2015-11-06 11:20:07 +0900 | [diff] [blame] | 2987 | handle_get_ip_address(msg.drv, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2988 | break; |
| 2989 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2990 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Leo Kim | a826742 | 2015-11-06 11:20:08 +0900 | [diff] [blame] | 2991 | handle_set_mac_address(msg.drv, |
| 2992 | &msg.body.set_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2993 | break; |
| 2994 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2995 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Leo Kim | b3bf8fd | 2015-11-06 11:20:09 +0900 | [diff] [blame] | 2996 | handle_get_mac_address(msg.drv, |
| 2997 | &msg.body.get_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2998 | break; |
| 2999 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3000 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 3001 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3002 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3003 | break; |
| 3004 | |
| 3005 | case HOST_IF_MSG_REGISTER_FRAME: |
| 3006 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3007 | Handle_RegisterFrame(msg.drv, &msg.body.reg_frame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3008 | break; |
| 3009 | |
| 3010 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3011 | Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3012 | break; |
| 3013 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3014 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 3015 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3016 | Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3017 | break; |
| 3018 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3019 | case HOST_IF_MSG_ADD_BA_SESSION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3020 | Handle_AddBASession(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3021 | break; |
| 3022 | |
| 3023 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3024 | Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3025 | break; |
| 3026 | |
| 3027 | case HOST_IF_MSG_DEL_ALL_STA: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3028 | Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3029 | break; |
| 3030 | |
| 3031 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3032 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3033 | break; |
| 3034 | } |
| 3035 | } |
| 3036 | |
| 3037 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 3038 | up(&hif_sema_thread); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 3039 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3040 | } |
| 3041 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3042 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3043 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3044 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3045 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3046 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3047 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3048 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3049 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3050 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3051 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3052 | } |
| 3053 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3054 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3055 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3056 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3057 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3058 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3059 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3060 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3061 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3062 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3063 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3064 | } |
| 3065 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3066 | 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] | 3067 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3068 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3069 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3070 | wid.id = (u16)WID_REMOVE_KEY; |
| 3071 | wid.type = WID_STR; |
| 3072 | wid.val = (s8 *)pu8StaAddress; |
| 3073 | wid.size = 6; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3074 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3075 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3076 | } |
| 3077 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3078 | 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] | 3079 | { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3080 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3081 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3082 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3083 | if (!hif_drv) { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3084 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3085 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3086 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3087 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3088 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3089 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3090 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3091 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3092 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3093 | msg.body.key_info.action = REMOVEKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3094 | msg.drv = hif_drv; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 3095 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3096 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3097 | 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] | 3098 | if (result) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3099 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3100 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3101 | |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3102 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3103 | } |
| 3104 | |
Chaehyun Lim | df8b483 | 2015-10-26 09:44:45 +0900 | [diff] [blame] | 3105 | 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] | 3106 | { |
Chaehyun Lim | 5b41c7c | 2015-10-26 09:44:42 +0900 | [diff] [blame] | 3107 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3108 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3109 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3110 | if (!hif_drv) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3111 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3112 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3113 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3114 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3115 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3116 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3117 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3118 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3119 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3120 | msg.body.key_info.action = DEFAULTKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3121 | msg.drv = hif_drv; |
Chaehyun Lim | e91d034 | 2015-10-26 09:44:44 +0900 | [diff] [blame] | 3122 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3123 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3124 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3125 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3126 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3127 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3128 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3129 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3130 | } |
| 3131 | |
Chaehyun Lim | 66b8cb8 | 2015-10-27 20:40:32 +0900 | [diff] [blame] | 3132 | int host_int_add_wep_key_bss_sta(struct host_if_drv *hif_drv, |
Chaehyun Lim | fba778b | 2015-10-27 20:40:34 +0900 | [diff] [blame] | 3133 | const u8 *key, |
Chaehyun Lim | dbc5319 | 2015-10-27 20:40:35 +0900 | [diff] [blame] | 3134 | u8 len, |
Chaehyun Lim | 0b2cc3e | 2015-10-27 20:40:36 +0900 | [diff] [blame] | 3135 | u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3136 | { |
Chaehyun Lim | 66b8cb8 | 2015-10-27 20:40:32 +0900 | [diff] [blame] | 3137 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3138 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3139 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3140 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3141 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3142 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3143 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3144 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3145 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3146 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3147 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3148 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3149 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3150 | msg.drv = hif_drv; |
Chaehyun Lim | 1cc0c32 | 2015-10-27 20:40:37 +0900 | [diff] [blame] | 3151 | msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); |
| 3152 | if (!msg.body.key_info.attr.wep.key) |
| 3153 | return -ENOMEM; |
| 3154 | |
Chaehyun Lim | dbc5319 | 2015-10-27 20:40:35 +0900 | [diff] [blame] | 3155 | msg.body.key_info.attr.wep.key_len = len; |
Chaehyun Lim | 0b2cc3e | 2015-10-27 20:40:36 +0900 | [diff] [blame] | 3156 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3157 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3158 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3159 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3160 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3161 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3162 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3163 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3164 | } |
| 3165 | |
Chaehyun Lim | 641c20a | 2015-10-28 08:19:19 +0900 | [diff] [blame] | 3166 | int host_int_add_wep_key_bss_ap(struct host_if_drv *hif_drv, |
Chaehyun Lim | 8111725 | 2015-10-28 08:19:22 +0900 | [diff] [blame] | 3167 | const u8 *key, |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3168 | u8 len, |
Chaehyun Lim | a76dc95 | 2015-10-28 08:19:24 +0900 | [diff] [blame] | 3169 | u8 index, |
Chaehyun Lim | 730a28d | 2015-10-28 08:19:25 +0900 | [diff] [blame] | 3170 | u8 mode, |
Chaehyun Lim | ff3bce2 | 2015-10-28 08:19:26 +0900 | [diff] [blame] | 3171 | enum AUTHTYPE auth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3172 | { |
Chaehyun Lim | 641c20a | 2015-10-28 08:19:19 +0900 | [diff] [blame] | 3173 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3174 | struct host_if_msg msg; |
Chaehyun Lim | fd74146 | 2015-10-28 08:19:21 +0900 | [diff] [blame] | 3175 | int i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3176 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3177 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3178 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3179 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3180 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3181 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3182 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3183 | |
| 3184 | if (INFO) { |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3185 | for (i = 0; i < len; i++) |
Chaehyun Lim | 8111725 | 2015-10-28 08:19:22 +0900 | [diff] [blame] | 3186 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", key[i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3187 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3188 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3189 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3190 | msg.body.key_info.action = ADDKEY_AP; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3191 | msg.drv = hif_drv; |
Chaehyun Lim | 58eabd6 | 2015-10-28 08:19:27 +0900 | [diff] [blame] | 3192 | msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); |
| 3193 | if (!msg.body.key_info.attr.wep.key) |
| 3194 | return -ENOMEM; |
| 3195 | |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3196 | msg.body.key_info.attr.wep.key_len = len; |
Chaehyun Lim | a76dc95 | 2015-10-28 08:19:24 +0900 | [diff] [blame] | 3197 | msg.body.key_info.attr.wep.index = index; |
Chaehyun Lim | 730a28d | 2015-10-28 08:19:25 +0900 | [diff] [blame] | 3198 | msg.body.key_info.attr.wep.mode = mode; |
Chaehyun Lim | ff3bce2 | 2015-10-28 08:19:26 +0900 | [diff] [blame] | 3199 | msg.body.key_info.attr.wep.auth_type = auth_type; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3200 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3201 | 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] | 3202 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3203 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3204 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3205 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3206 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3207 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3208 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3209 | |
Chaehyun Lim | d170536 | 2015-11-08 16:48:56 +0900 | [diff] [blame] | 3210 | int host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *ptk, |
Chaehyun Lim | 0743b7e | 2015-11-08 16:48:57 +0900 | [diff] [blame] | 3211 | u8 ptk_key_len, const u8 *mac_addr, |
Chaehyun Lim | d7c0242 | 2015-11-08 16:48:59 +0900 | [diff] [blame] | 3212 | const u8 *rx_mic, const u8 *tx_mic, |
Chaehyun Lim | 3e5c4ab | 2015-11-08 16:49:01 +0900 | [diff] [blame] | 3213 | u8 mode, u8 cipher_mode, u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3214 | { |
Chaehyun Lim | 706ab42 | 2015-11-08 16:48:54 +0900 | [diff] [blame] | 3215 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3216 | struct host_if_msg msg; |
Chaehyun Lim | 53bbbb5 | 2015-11-08 16:49:03 +0900 | [diff] [blame] | 3217 | u8 key_len = ptk_key_len; |
Chaehyun Lim | fa26907 | 2015-11-08 16:49:02 +0900 | [diff] [blame] | 3218 | int i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3219 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3220 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3221 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3222 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3223 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3224 | |
Chaehyun Lim | 38f6629 | 2015-11-08 16:48:58 +0900 | [diff] [blame] | 3225 | if (rx_mic) |
Chaehyun Lim | 53bbbb5 | 2015-11-08 16:49:03 +0900 | [diff] [blame] | 3226 | key_len += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3227 | |
Chaehyun Lim | d7c0242 | 2015-11-08 16:48:59 +0900 | [diff] [blame] | 3228 | if (tx_mic) |
Chaehyun Lim | 53bbbb5 | 2015-11-08 16:49:03 +0900 | [diff] [blame] | 3229 | key_len += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3230 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3231 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3232 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3233 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 2141fe3 | 2015-10-29 12:05:35 +0900 | [diff] [blame] | 3234 | msg.body.key_info.type = WPA_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3235 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3236 | msg.body.key_info.action = ADDKEY_AP; |
Chaehyun Lim | 3e5c4ab | 2015-11-08 16:49:01 +0900 | [diff] [blame] | 3237 | msg.body.key_info.attr.wpa.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3238 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3239 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3240 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3241 | |
Chaehyun Lim | 8ab8c59 | 2015-11-08 16:49:04 +0900 | [diff] [blame] | 3242 | msg.body.key_info.attr.wpa.key = kmemdup(ptk, ptk_key_len, GFP_KERNEL); |
| 3243 | if (!msg.body.key_info.attr.wpa.key) |
| 3244 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3245 | |
Chaehyun Lim | 38f6629 | 2015-11-08 16:48:58 +0900 | [diff] [blame] | 3246 | if (rx_mic) { |
| 3247 | memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, RX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3248 | if (INFO) { |
| 3249 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
Chaehyun Lim | 38f6629 | 2015-11-08 16:48:58 +0900 | [diff] [blame] | 3250 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, rx_mic[i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3251 | } |
| 3252 | } |
Chaehyun Lim | d7c0242 | 2015-11-08 16:48:59 +0900 | [diff] [blame] | 3253 | if (tx_mic) { |
| 3254 | memcpy(msg.body.key_info.attr.wpa.key + 24, tx_mic, TX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3255 | if (INFO) { |
| 3256 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
Chaehyun Lim | d7c0242 | 2015-11-08 16:48:59 +0900 | [diff] [blame] | 3257 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, tx_mic[i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3258 | } |
| 3259 | } |
| 3260 | |
Chaehyun Lim | 53bbbb5 | 2015-11-08 16:49:03 +0900 | [diff] [blame] | 3261 | msg.body.key_info.attr.wpa.key_len = key_len; |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 3262 | msg.body.key_info.attr.wpa.mac_addr = mac_addr; |
Chaehyun Lim | f0c8257 | 2015-11-08 16:49:00 +0900 | [diff] [blame] | 3263 | msg.body.key_info.attr.wpa.mode = cipher_mode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3264 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3265 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3266 | 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] | 3267 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3268 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3269 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 3270 | |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3271 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3272 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3273 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3274 | } |
| 3275 | |
Chaehyun Lim | 3c0bf6b | 2015-11-08 16:49:07 +0900 | [diff] [blame] | 3276 | int host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *rx_gtk, |
Chaehyun Lim | 9a5e5736 | 2015-11-08 16:49:09 +0900 | [diff] [blame] | 3277 | u8 gtk_key_len, u8 index, |
Chaehyun Lim | 982859c | 2015-11-08 16:49:11 +0900 | [diff] [blame] | 3278 | u32 key_rsc_len, const u8 *key_rsc, |
Chaehyun Lim | 2f79758 | 2015-11-08 16:49:13 +0900 | [diff] [blame] | 3279 | const u8 *rx_mic, const u8 *tx_mic, |
Chaehyun Lim | 57bfcbc | 2015-11-08 16:49:14 +0900 | [diff] [blame] | 3280 | u8 mode, u8 cipher_mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3281 | { |
Chaehyun Lim | 1503457 | 2015-11-08 16:49:05 +0900 | [diff] [blame] | 3282 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3283 | struct host_if_msg msg; |
Chaehyun Lim | d002fcc | 2015-11-08 16:49:15 +0900 | [diff] [blame] | 3284 | u8 key_len = gtk_key_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3285 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3286 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3287 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3288 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3289 | } |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3290 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3291 | |
Chaehyun Lim | 6d36c27 | 2015-11-08 16:49:12 +0900 | [diff] [blame] | 3292 | if (rx_mic) |
Chaehyun Lim | d002fcc | 2015-11-08 16:49:15 +0900 | [diff] [blame] | 3293 | key_len += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3294 | |
Chaehyun Lim | 2f79758 | 2015-11-08 16:49:13 +0900 | [diff] [blame] | 3295 | if (tx_mic) |
Chaehyun Lim | d002fcc | 2015-11-08 16:49:15 +0900 | [diff] [blame] | 3296 | key_len += TX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3297 | |
Chaehyun Lim | 982859c | 2015-11-08 16:49:11 +0900 | [diff] [blame] | 3298 | if (key_rsc) { |
Chaehyun Lim | 9bfda38 | 2015-11-08 16:49:16 +0900 | [diff] [blame] | 3299 | msg.body.key_info.attr.wpa.seq = kmemdup(key_rsc, |
| 3300 | key_rsc_len, |
| 3301 | GFP_KERNEL); |
| 3302 | if (!msg.body.key_info.attr.wpa.seq) |
| 3303 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3304 | } |
| 3305 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3306 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 5cd8f7a | 2015-10-29 12:05:34 +0900 | [diff] [blame] | 3307 | msg.body.key_info.type = WPA_RX_GTK; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3308 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3309 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3310 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3311 | msg.body.key_info.action = ADDKEY_AP; |
Chaehyun Lim | 57bfcbc | 2015-11-08 16:49:14 +0900 | [diff] [blame] | 3312 | msg.body.key_info.attr.wpa.mode = cipher_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3313 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3314 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3315 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3316 | |
Chaehyun Lim | 9bfda38 | 2015-11-08 16:49:16 +0900 | [diff] [blame] | 3317 | msg.body.key_info.attr.wpa.key = kmemdup(rx_gtk, |
| 3318 | key_len, |
| 3319 | GFP_KERNEL); |
| 3320 | if (!msg.body.key_info.attr.wpa.key) |
| 3321 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3322 | |
Chaehyun Lim | 6d36c27 | 2015-11-08 16:49:12 +0900 | [diff] [blame] | 3323 | if (rx_mic) |
| 3324 | memcpy(msg.body.key_info.attr.wpa.key + 16, rx_mic, |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3325 | RX_MIC_KEY_LEN); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3326 | |
Chaehyun Lim | 2f79758 | 2015-11-08 16:49:13 +0900 | [diff] [blame] | 3327 | if (tx_mic) |
| 3328 | memcpy(msg.body.key_info.attr.wpa.key + 24, tx_mic, |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3329 | TX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3330 | |
Chaehyun Lim | 9a5e5736 | 2015-11-08 16:49:09 +0900 | [diff] [blame] | 3331 | msg.body.key_info.attr.wpa.index = index; |
Chaehyun Lim | d002fcc | 2015-11-08 16:49:15 +0900 | [diff] [blame] | 3332 | msg.body.key_info.attr.wpa.key_len = key_len; |
Chaehyun Lim | 18bef99 | 2015-11-08 16:49:10 +0900 | [diff] [blame] | 3333 | msg.body.key_info.attr.wpa.seq_len = key_rsc_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 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 message queue: RX GTK\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3338 | |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3339 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3340 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3341 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3342 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3343 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3344 | 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] | 3345 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3346 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3347 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3348 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3349 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3350 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3351 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3352 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3353 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3354 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3355 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3356 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3357 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3358 | msg.body.key_info.type = PMKSA; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3359 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3360 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3361 | |
| 3362 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3363 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].bssid, |
| 3364 | &pu8PmkidInfoArray->pmkidlist[i].bssid, ETH_ALEN); |
| 3365 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].pmkid, |
| 3366 | &pu8PmkidInfoArray->pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3367 | } |
| 3368 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3369 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3370 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3371 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 3372 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3373 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3374 | } |
| 3375 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3376 | s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3377 | u8 *pu8PassPhrase, |
| 3378 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3379 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3380 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3381 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3382 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3383 | wid.id = (u16)WID_11I_PSK; |
| 3384 | wid.type = WID_STR; |
| 3385 | wid.val = pu8PassPhrase; |
| 3386 | wid.size = u8Psklength; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3387 | } |
| 3388 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3389 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3390 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3391 | |
Leo Kim | e5f3524 | 2015-11-05 14:36:36 +0900 | [diff] [blame] | 3392 | s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3393 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3394 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3395 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3396 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3397 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3398 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3399 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Leo Kim | 6ceba0a | 2015-10-28 15:59:32 +0900 | [diff] [blame] | 3400 | msg.body.get_mac_info.mac_addr = pu8MacAddress; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3401 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3402 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3403 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3404 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3405 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3406 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3407 | } |
| 3408 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3409 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3410 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3411 | } |
| 3412 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3413 | 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] | 3414 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3415 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3416 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3417 | |
| 3418 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 3419 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3420 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3421 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Leo Kim | ae5e452 | 2015-10-28 15:59:31 +0900 | [diff] [blame] | 3422 | memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3423 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3424 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3425 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3426 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3427 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3428 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3429 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3430 | } |
| 3431 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3432 | s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3433 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3434 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3435 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3436 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3437 | wid.id = (u16)WID_11I_PSK; |
| 3438 | wid.type = WID_STR; |
| 3439 | wid.size = u8Psklength; |
| 3440 | wid.val = pu8PassPhrase; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3441 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3442 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3443 | } |
| 3444 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3445 | 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] | 3446 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3447 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3448 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3449 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3450 | wid.type = WID_CHAR; |
| 3451 | wid.val = (s8 *)&scanSource; |
| 3452 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3453 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3454 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3455 | } |
| 3456 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3457 | 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] | 3458 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3459 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3460 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3461 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3462 | wid.type = WID_CHAR; |
| 3463 | wid.val = (s8 *)pu8ScanSource; |
| 3464 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3465 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3466 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3467 | } |
| 3468 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3469 | s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, |
| 3470 | const u8 *pu8ssid, size_t ssidLen, |
| 3471 | const u8 *pu8IEs, size_t IEsLen, |
| 3472 | wilc_connect_result pfConnectResult, void *pvUserArg, |
| 3473 | u8 u8security, enum AUTHTYPE tenuAuth_type, |
| 3474 | u8 u8channel, void *pJoinParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3475 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3476 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3477 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3478 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3479 | if (!hif_drv || !pfConnectResult) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3480 | PRINT_ER("Driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3481 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3482 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3483 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3484 | if (!pJoinParams) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3485 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3486 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3487 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3488 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3489 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3490 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3491 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3492 | |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 3493 | msg.body.con_info.security = u8security; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 3494 | msg.body.con_info.auth_type = tenuAuth_type; |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 3495 | msg.body.con_info.ch = u8channel; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 3496 | msg.body.con_info.result = pfConnectResult; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 3497 | msg.body.con_info.arg = pvUserArg; |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 3498 | msg.body.con_info.params = pJoinParams; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3499 | msg.drv = hif_drv ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3500 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3501 | if (pu8bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 3502 | msg.body.con_info.bssid = kmalloc(6, GFP_KERNEL); |
| 3503 | memcpy(msg.body.con_info.bssid, pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3504 | } |
| 3505 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3506 | if (pu8ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 3507 | msg.body.con_info.ssid_len = ssidLen; |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 3508 | msg.body.con_info.ssid = kmalloc(ssidLen, GFP_KERNEL); |
| 3509 | memcpy(msg.body.con_info.ssid, pu8ssid, ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3510 | } |
| 3511 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3512 | if (pu8IEs) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 3513 | msg.body.con_info.ies_len = IEsLen; |
Leo Kim | 2ea158c | 2015-10-13 19:49:52 +0900 | [diff] [blame] | 3514 | msg.body.con_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3515 | memcpy(msg.body.con_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3516 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 3517 | if (hif_drv->hif_state < HOST_IF_CONNECTING) |
| 3518 | hif_drv->hif_state = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3519 | else |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 3520 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' : %d\n", |
| 3521 | hif_drv->hif_state); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3522 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3523 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3524 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3525 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3526 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3527 | } |
| 3528 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 3529 | hif_drv->connect_timer.data = (unsigned long)hif_drv; |
| 3530 | mod_timer(&hif_drv->connect_timer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3531 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3532 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3533 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3534 | } |
| 3535 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3536 | s32 host_int_flush_join_req(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3537 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3538 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3539 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3540 | |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3541 | if (!join_req) |
| 3542 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3543 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3544 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3545 | PRINT_ER("Driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3546 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3547 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3548 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3549 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3550 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3551 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3552 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3553 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3554 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3555 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3556 | } |
| 3557 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3558 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3559 | } |
| 3560 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3561 | s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3562 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3563 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3564 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3565 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3566 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3567 | PRINT_ER("Driver is null\n"); |
| 3568 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3569 | } |
| 3570 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3571 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3572 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3573 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3574 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3575 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3576 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3577 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3578 | PRINT_ER("Failed to send message queue: disconnect\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3579 | |
Leo Kim | e55e496 | 2015-10-29 11:58:29 +0900 | [diff] [blame] | 3580 | down(&hif_drv->sem_test_disconn_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3581 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3582 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3583 | } |
| 3584 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3585 | 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] | 3586 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3587 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3588 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3589 | wid.id = (u16)WID_DISCONNECT; |
| 3590 | wid.type = WID_CHAR; |
| 3591 | wid.val = (s8 *)&assoc_id; |
| 3592 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3593 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3594 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3595 | } |
| 3596 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3597 | s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, |
| 3598 | u8 *pu8AssocReqInfo, |
| 3599 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3600 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3601 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3602 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3603 | wid.id = (u16)WID_ASSOC_REQ_INFO; |
| 3604 | wid.type = WID_STR; |
| 3605 | wid.val = pu8AssocReqInfo; |
| 3606 | wid.size = u32AssocReqInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3607 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3608 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3609 | } |
| 3610 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3611 | s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, |
| 3612 | u8 *pu8AssocRespInfo, |
| 3613 | u32 u32MaxAssocRespInfoLen, |
| 3614 | u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3615 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3616 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3617 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3618 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3619 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3620 | PRINT_ER("Driver is null\n"); |
| 3621 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3622 | } |
| 3623 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3624 | wid.id = (u16)WID_ASSOC_RES_INFO; |
| 3625 | wid.type = WID_STR; |
| 3626 | wid.val = pu8AssocRespInfo; |
| 3627 | wid.size = u32MaxAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3628 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3629 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3630 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3631 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3632 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3633 | PRINT_ER("Failed to send association response config packet\n"); |
| 3634 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3635 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3636 | *pu32RcvdAssocRespInfoLen = wid.size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3637 | } |
| 3638 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3639 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3640 | } |
| 3641 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3642 | s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, |
| 3643 | u8 *pu8RxPowerLevel, |
| 3644 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3645 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3646 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3647 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3648 | wid.id = (u16)WID_RX_POWER_LEVEL; |
| 3649 | wid.type = WID_STR; |
| 3650 | wid.val = pu8RxPowerLevel; |
| 3651 | wid.size = u32RxPowerLevelLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3652 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3653 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3654 | } |
| 3655 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3656 | 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] | 3657 | { |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3658 | int result; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3659 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3660 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3661 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3662 | PRINT_ER("driver is null\n"); |
| 3663 | return -EFAULT; |
| 3664 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3665 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3666 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3667 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Leo Kim | 730ee05 | 2015-10-13 19:50:02 +0900 | [diff] [blame] | 3668 | msg.body.channel_info.set_ch = channel; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3669 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3670 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3671 | 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] | 3672 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3673 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3674 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3675 | } |
| 3676 | |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3677 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3678 | } |
| 3679 | |
Chaehyun Lim | 244efb1 | 2015-10-02 21:44:53 +0900 | [diff] [blame] | 3680 | int host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3681 | { |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3682 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3683 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3684 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3685 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3686 | msg.id = HOST_IF_MSG_Q_IDLE; |
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 | 6d6c9bb | 2015-10-02 21:44:54 +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 | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3690 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3691 | } |
| 3692 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3693 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3694 | |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3695 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3696 | } |
| 3697 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3698 | 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] | 3699 | { |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3700 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3701 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3702 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3703 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3704 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 3705 | msg.body.drv.handler = get_id_from_handler(hif_drv); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3706 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3707 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3708 | 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] | 3709 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3710 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3711 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3712 | } |
| 3713 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3714 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3715 | } |
| 3716 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3717 | 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] | 3718 | { |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3719 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3720 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3721 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3722 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3723 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 3724 | msg.body.mode.mode = mode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3725 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3726 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3727 | 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] | 3728 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3729 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3730 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3731 | } |
| 3732 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3733 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3734 | } |
| 3735 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3736 | 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] | 3737 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3738 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3739 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3740 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3741 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3742 | PRINT_ER("driver is null\n"); |
| 3743 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3744 | } |
| 3745 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3746 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3747 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3748 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3749 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3750 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3751 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3752 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3753 | PRINT_ER("wilc mq send fail\n"); |
Leo Kim | 4ea9000 | 2015-10-29 11:58:32 +0900 | [diff] [blame] | 3754 | down(&hif_drv->sem_get_chnl); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3755 | |
Leo Kim | 95ebb0f | 2015-10-15 13:25:03 +0900 | [diff] [blame] | 3756 | *pu8ChNo = ch_no; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3757 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3758 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3759 | } |
| 3760 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3761 | s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, |
| 3762 | const u8 *mac, u32 *pu32InactiveTime) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3763 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3764 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3765 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3766 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3767 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3768 | PRINT_ER("driver is null\n"); |
| 3769 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3770 | } |
| 3771 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3772 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3773 | memcpy(msg.body.mac_info.mac, mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3774 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3775 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3776 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3777 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3778 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3779 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3780 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 3781 | |
Leo Kim | 569a3c6 | 2015-10-29 11:58:33 +0900 | [diff] [blame] | 3782 | down(&hif_drv->sem_inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3783 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 3784 | *pu32InactiveTime = inactive_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3785 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3786 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3787 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3788 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3789 | 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] | 3790 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3791 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3792 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3793 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3794 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3795 | PRINT_ER("driver is null\n"); |
| 3796 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3797 | } |
| 3798 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3799 | wid.id = (u16)WID_MEMORY_ADDRESS; |
| 3800 | wid.type = WID_INT; |
| 3801 | wid.val = (s8 *)pu32TestMemAddr; |
| 3802 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3803 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3804 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3805 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3806 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3807 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3808 | PRINT_ER("Failed to get wid value\n"); |
| 3809 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3810 | } else { |
| 3811 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3812 | } |
| 3813 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3814 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3815 | } |
| 3816 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3817 | 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] | 3818 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3819 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3820 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3821 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3822 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3823 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3824 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3825 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3826 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3827 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3828 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3829 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3830 | } |
| 3831 | |
Leo Kim | 7e111f9 | 2015-10-29 11:58:30 +0900 | [diff] [blame] | 3832 | down(&hif_drv->sem_get_rssi); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3833 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3834 | if (!ps8Rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3835 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3836 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3837 | } |
| 3838 | |
Leo Kim | 144b7b2 | 2015-10-15 13:25:01 +0900 | [diff] [blame] | 3839 | *ps8Rssi = rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3840 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3841 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3842 | } |
| 3843 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3844 | 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] | 3845 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3846 | struct host_if_msg msg; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3847 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3848 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3849 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3850 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3851 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3852 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3853 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3854 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3855 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3856 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3857 | } |
| 3858 | |
Leo Kim | bc34da6 | 2015-10-29 11:58:31 +0900 | [diff] [blame] | 3859 | down(&hif_drv->sem_get_link_speed); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3860 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3861 | if (!ps8lnkspd) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3862 | PRINT_ER("LINKSPEED pointer value is null"); |
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 | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 3866 | *ps8lnkspd = link_speed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3867 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3868 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3869 | } |
| 3870 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3871 | 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] | 3872 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3873 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3874 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3875 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3876 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3877 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 3878 | msg.body.data = (char *)pstrStatistics; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3879 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3880 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3881 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3882 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3883 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3884 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3885 | } |
| 3886 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3887 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3888 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3889 | } |
| 3890 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3891 | s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, |
| 3892 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 3893 | u8 u8ChnlListLen, const u8 *pu8IEs, |
| 3894 | size_t IEsLen, wilc_scan_result ScanResult, |
| 3895 | void *pvUserArg, struct hidden_network *pstrHiddenNetwork) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3896 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3897 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3898 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3899 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3900 | if (!hif_drv || !ScanResult) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3901 | PRINT_ER("hif_drv or ScanResult = NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3902 | return -EFAULT; |
| 3903 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3904 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3905 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3906 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3907 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3908 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3909 | if (pstrHiddenNetwork) { |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 3910 | msg.body.scan_info.hidden_network.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 3911 | msg.body.scan_info.hidden_network.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3912 | |
| 3913 | } else |
| 3914 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 3915 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3916 | msg.drv = hif_drv; |
Leo Kim | 4256889 | 2015-10-13 19:49:37 +0900 | [diff] [blame] | 3917 | msg.body.scan_info.src = u8ScanSource; |
Leo Kim | 1e276c8 | 2015-10-13 19:49:38 +0900 | [diff] [blame] | 3918 | msg.body.scan_info.type = u8ScanType; |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 3919 | msg.body.scan_info.result = ScanResult; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 3920 | msg.body.scan_info.arg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3921 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 3922 | msg.body.scan_info.ch_list_len = u8ChnlListLen; |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 3923 | msg.body.scan_info.ch_freq_list = kmalloc(u8ChnlListLen, GFP_KERNEL); |
| 3924 | memcpy(msg.body.scan_info.ch_freq_list, pu8ChnlFreqList, u8ChnlListLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3925 | |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 3926 | msg.body.scan_info.ies_len = IEsLen; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 3927 | msg.body.scan_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3928 | memcpy(msg.body.scan_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3929 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3930 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3931 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3932 | PRINT_ER("Error in sending message queue\n"); |
| 3933 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3934 | } |
| 3935 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3936 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 3937 | hif_drv->scan_timer.data = (unsigned long)hif_drv; |
| 3938 | mod_timer(&hif_drv->scan_timer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3939 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
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 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3943 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3944 | s32 hif_set_cfg(struct host_if_drv *hif_drv, |
| 3945 | struct cfg_param_val *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3946 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3947 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3948 | struct host_if_msg msg; |
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; |
| 3953 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3954 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3955 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3956 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 3957 | msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3958 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3959 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3960 | 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] | 3961 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3962 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3963 | } |
| 3964 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3965 | 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] | 3966 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3967 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3968 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 3969 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3970 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3971 | if (!hif_drv) { |
| 3972 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3973 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3974 | } |
| 3975 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 3976 | switch (u16WID) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3977 | case WID_BSS_TYPE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3978 | *pu16WID_Value = (u16)hif_drv->cfg_values.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3979 | break; |
| 3980 | |
| 3981 | case WID_AUTH_TYPE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3982 | *pu16WID_Value = (u16)hif_drv->cfg_values.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3983 | break; |
| 3984 | |
| 3985 | case WID_AUTH_TIMEOUT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3986 | *pu16WID_Value = hif_drv->cfg_values.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3987 | break; |
| 3988 | |
| 3989 | case WID_POWER_MANAGEMENT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3990 | *pu16WID_Value = (u16)hif_drv->cfg_values.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3991 | break; |
| 3992 | |
| 3993 | case WID_SHORT_RETRY_LIMIT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3994 | *pu16WID_Value = hif_drv->cfg_values.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3995 | break; |
| 3996 | |
| 3997 | case WID_LONG_RETRY_LIMIT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3998 | *pu16WID_Value = hif_drv->cfg_values.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3999 | break; |
| 4000 | |
| 4001 | case WID_FRAG_THRESHOLD: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4002 | *pu16WID_Value = hif_drv->cfg_values.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4003 | break; |
| 4004 | |
| 4005 | case WID_RTS_THRESHOLD: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4006 | *pu16WID_Value = hif_drv->cfg_values.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4007 | break; |
| 4008 | |
| 4009 | case WID_PREAMBLE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4010 | *pu16WID_Value = (u16)hif_drv->cfg_values.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4011 | break; |
| 4012 | |
| 4013 | case WID_SHORT_SLOT_ALLOWED: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4014 | *pu16WID_Value = (u16)hif_drv->cfg_values.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4015 | break; |
| 4016 | |
| 4017 | case WID_11N_TXOP_PROT_DISABLE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4018 | *pu16WID_Value = (u16)hif_drv->cfg_values.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4019 | break; |
| 4020 | |
| 4021 | case WID_BEACON_INTERVAL: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4022 | *pu16WID_Value = hif_drv->cfg_values.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4023 | break; |
| 4024 | |
| 4025 | case WID_DTIM_PERIOD: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4026 | *pu16WID_Value = (u16)hif_drv->cfg_values.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4027 | break; |
| 4028 | |
| 4029 | case WID_SITE_SURVEY: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4030 | *pu16WID_Value = (u16)hif_drv->cfg_values.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4031 | break; |
| 4032 | |
| 4033 | case WID_SITE_SURVEY_SCAN_TIME: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4034 | *pu16WID_Value = hif_drv->cfg_values.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4035 | break; |
| 4036 | |
| 4037 | case WID_ACTIVE_SCAN_TIME: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4038 | *pu16WID_Value = hif_drv->cfg_values.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4039 | break; |
| 4040 | |
| 4041 | case WID_PASSIVE_SCAN_TIME: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4042 | *pu16WID_Value = hif_drv->cfg_values.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4043 | break; |
| 4044 | |
| 4045 | case WID_CURRENT_TX_RATE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4046 | *pu16WID_Value = hif_drv->cfg_values.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4047 | break; |
| 4048 | |
| 4049 | default: |
| 4050 | break; |
| 4051 | } |
| 4052 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4053 | up(&hif_drv->sem_cfg_values); |
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 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4056 | } |
| 4057 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4058 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4059 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4060 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4061 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4062 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4063 | PRINT_ER("Driver handler is NULL\n"); |
| 4064 | return; |
| 4065 | } |
| 4066 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4067 | if (hif_drv->hif_state == HOST_IF_CONNECTED) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4068 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4069 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4070 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4071 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4072 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4073 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4074 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4075 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4076 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4077 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4078 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 4079 | return; |
| 4080 | } |
| 4081 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4082 | periodic_rssi.data = (unsigned long)hif_drv; |
| 4083 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4084 | } |
| 4085 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4086 | 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] | 4087 | { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4088 | s32 result = 0; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4089 | struct host_if_drv *hif_drv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4090 | int err; |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4091 | perInterface_wlan_t *nic; |
| 4092 | struct wilc *wilc; |
| 4093 | |
| 4094 | nic = netdev_priv(dev); |
| 4095 | wilc = nic->wilc; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4096 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4097 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 4098 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4099 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4100 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4101 | sema_init(&hif_sema_wait_response, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4102 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4103 | hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL); |
| 4104 | if (!hif_drv) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4105 | result = -ENOMEM; |
Vincent Stehlé | 17db84e | 2015-10-07 07:08:25 +0200 | [diff] [blame] | 4106 | goto _fail_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4107 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4108 | *hif_drv_handler = hif_drv; |
| 4109 | err = add_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4110 | if (err) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4111 | result = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4112 | goto _fail_timer_2; |
| 4113 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4114 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 4115 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4116 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4117 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4118 | if (clients_count == 0) { |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4119 | sema_init(&hif_sema_thread, 0); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4120 | sema_init(&hif_sema_driver, 0); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4121 | sema_init(&hif_sema_deinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4122 | } |
| 4123 | |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 4124 | sema_init(&hif_drv->sem_test_key_block, 0); |
Leo Kim | e55e496 | 2015-10-29 11:58:29 +0900 | [diff] [blame] | 4125 | sema_init(&hif_drv->sem_test_disconn_block, 0); |
Leo Kim | 7e111f9 | 2015-10-29 11:58:30 +0900 | [diff] [blame] | 4126 | sema_init(&hif_drv->sem_get_rssi, 0); |
Leo Kim | bc34da6 | 2015-10-29 11:58:31 +0900 | [diff] [blame] | 4127 | sema_init(&hif_drv->sem_get_link_speed, 0); |
Leo Kim | 4ea9000 | 2015-10-29 11:58:32 +0900 | [diff] [blame] | 4128 | sema_init(&hif_drv->sem_get_chnl, 0); |
Leo Kim | 569a3c6 | 2015-10-29 11:58:33 +0900 | [diff] [blame] | 4129 | sema_init(&hif_drv->sem_inactive_time, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4130 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4131 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 4132 | |
| 4133 | if (clients_count == 0) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4134 | result = wilc_mq_create(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4135 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4136 | if (result < 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4137 | PRINT_ER("Failed to creat MQ\n"); |
| 4138 | goto _fail_; |
| 4139 | } |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4140 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4141 | hif_thread_handler = kthread_run(hostIFthread, wilc, |
| 4142 | "WILC_kthread"); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4143 | |
| 4144 | if (IS_ERR(hif_thread_handler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4145 | PRINT_ER("Failed to creat Thread\n"); |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4146 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4147 | goto _fail_mq_; |
| 4148 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4149 | setup_timer(&periodic_rssi, GetPeriodicRSSI, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4150 | (unsigned long)hif_drv); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4151 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4152 | } |
| 4153 | |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 4154 | setup_timer(&hif_drv->scan_timer, TimerCB_Scan, 0); |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 4155 | setup_timer(&hif_drv->connect_timer, TimerCB_Connect, 0); |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 4156 | setup_timer(&hif_drv->remain_on_ch_timer, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4157 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4158 | sema_init(&hif_drv->sem_cfg_values, 1); |
| 4159 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4160 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4161 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4162 | hif_drv->cfg_values.site_survey_enabled = SITE_SURVEY_OFF; |
| 4163 | hif_drv->cfg_values.scan_source = DEFAULT_SCAN; |
| 4164 | hif_drv->cfg_values.active_scan_time = ACTIVE_SCAN_TIME; |
| 4165 | hif_drv->cfg_values.passive_scan_time = PASSIVE_SCAN_TIME; |
| 4166 | hif_drv->cfg_values.curr_tx_rate = AUTORATE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4167 | |
Leo Kim | 1229b1a | 2015-10-29 12:05:39 +0900 | [diff] [blame] | 4168 | hif_drv->p2p_timeout = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4169 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4170 | 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", |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4171 | hif_drv->cfg_values.site_survey_enabled, |
| 4172 | hif_drv->cfg_values.scan_source, |
| 4173 | hif_drv->cfg_values.active_scan_time, |
| 4174 | hif_drv->cfg_values.passive_scan_time, |
| 4175 | hif_drv->cfg_values.curr_tx_rate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4176 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4177 | up(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4178 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4179 | clients_count++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4180 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4181 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4182 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4183 | _fail_timer_2: |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4184 | up(&hif_drv->sem_cfg_values); |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 4185 | del_timer_sync(&hif_drv->connect_timer); |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 4186 | del_timer_sync(&hif_drv->scan_timer); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4187 | kthread_stop(hif_thread_handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4188 | _fail_mq_: |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4189 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4190 | _fail_: |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4191 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4192 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4193 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4194 | s32 host_int_deinit(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4195 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4196 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4197 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4198 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4199 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4200 | if (!hif_drv) { |
| 4201 | PRINT_ER("hif_drv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4202 | return 0; |
| 4203 | } |
| 4204 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4205 | down(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4206 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4207 | terminated_handle = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4208 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 4209 | |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 4210 | if (del_timer_sync(&hif_drv->scan_timer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4211 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4212 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 4213 | if (del_timer_sync(&hif_drv->connect_timer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4214 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4215 | |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4216 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4217 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4218 | |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 4219 | del_timer_sync(&hif_drv->remain_on_ch_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4220 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4221 | host_int_set_wfi_drv_handler(NULL); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4222 | down(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4223 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 4224 | if (hif_drv->usr_scan_req.scan_result) { |
| 4225 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 4226 | hif_drv->usr_scan_req.arg, NULL); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 4227 | hif_drv->usr_scan_req.scan_result = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4228 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4229 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4230 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4231 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4232 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4233 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4234 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4235 | |
| 4236 | if (clients_count == 1) { |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4237 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4238 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4239 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4240 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4241 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4242 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4243 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4244 | if (result != 0) |
| 4245 | 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] | 4246 | |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4247 | down(&hif_sema_thread); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4248 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4249 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4250 | } |
| 4251 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4252 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4253 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4254 | ret = remove_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4255 | if (ret) |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4256 | result = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4257 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4258 | kfree(hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4259 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4260 | clients_count--; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 4261 | terminated_handle = NULL; |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4262 | up(&hif_sema_deinit); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4263 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4264 | } |
| 4265 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4266 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4267 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4268 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4269 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4270 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4271 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4272 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4273 | 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] | 4274 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4275 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4276 | if (!hif_drv || hif_drv == terminated_handle) { |
| 4277 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4278 | return; |
| 4279 | } |
| 4280 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4281 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4282 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4283 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4284 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4285 | |
Leo Kim | 3bffac6 | 2015-10-13 20:02:11 +0900 | [diff] [blame] | 4286 | msg.body.net_info.len = u32Length; |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 4287 | msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4288 | memcpy(msg.body.net_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4289 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4290 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4291 | if (result) |
| 4292 | 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] | 4293 | } |
| 4294 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4295 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4296 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4297 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4298 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4299 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4300 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4301 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4302 | down(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4303 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4304 | 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] | 4305 | hif_drv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4306 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4307 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4308 | if (!hif_drv || hif_drv == terminated_handle) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4309 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4310 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4311 | return; |
| 4312 | } |
| 4313 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 4314 | if (!hif_drv->usr_conn_req.conn_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4315 | 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] | 4316 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4317 | return; |
| 4318 | } |
| 4319 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4320 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4321 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4322 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4323 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4324 | |
Leo Kim | f94f488 | 2015-10-13 19:50:01 +0900 | [diff] [blame] | 4325 | msg.body.async_info.len = u32Length; |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 4326 | msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4327 | memcpy(msg.body.async_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4328 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4329 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4330 | if (result) |
| 4331 | 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] | 4332 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4333 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4334 | } |
| 4335 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4336 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
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 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4339 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4340 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4341 | struct host_if_drv *hif_drv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4342 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4343 | 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] | 4344 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4345 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4346 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4347 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4348 | if (!hif_drv || hif_drv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4349 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4350 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 4351 | if (hif_drv->usr_scan_req.scan_result) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4352 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4353 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4354 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4355 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4356 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4357 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4358 | if (result) |
| 4359 | 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] | 4360 | } |
| 4361 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4362 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4363 | } |
| 4364 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4365 | s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, |
| 4366 | u32 u32duration, u16 chan, |
| 4367 | wilc_remain_on_chan_expired RemainOnChanExpired, |
| 4368 | wilc_remain_on_chan_ready RemainOnChanReady, |
| 4369 | void *pvUserArg) |
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 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4372 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4373 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4374 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4375 | PRINT_ER("driver is null\n"); |
| 4376 | return -EFAULT; |
| 4377 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4378 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4379 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4380 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4381 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 4382 | msg.body.remain_on_ch.ch = chan; |
Leo Kim | bfb62ab | 2015-10-29 11:58:42 +0900 | [diff] [blame] | 4383 | msg.body.remain_on_ch.expired = RemainOnChanExpired; |
Leo Kim | 5e5f791 | 2015-10-29 11:58:43 +0900 | [diff] [blame] | 4384 | msg.body.remain_on_ch.ready = RemainOnChanReady; |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 4385 | msg.body.remain_on_ch.arg = pvUserArg; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4386 | msg.body.remain_on_ch.u32duration = u32duration; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 4387 | msg.body.remain_on_ch.id = u32SessionID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4388 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4389 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4390 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4391 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4392 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4393 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4394 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4395 | } |
| 4396 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4397 | s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) |
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 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4400 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4401 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4402 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4403 | PRINT_ER("driver is null\n"); |
| 4404 | return -EFAULT; |
| 4405 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4406 | |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 4407 | del_timer(&hif_drv->remain_on_ch_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4408 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4409 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4410 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4411 | msg.drv = hif_drv; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 4412 | msg.body.remain_on_ch.id = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4413 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4414 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4415 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4416 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4417 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4418 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4419 | } |
| 4420 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4421 | 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] | 4422 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4423 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4424 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4425 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4426 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4427 | PRINT_ER("driver is null\n"); |
| 4428 | return -EFAULT; |
| 4429 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4430 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4431 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4432 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4433 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4434 | switch (u16FrameType) { |
| 4435 | case ACTION: |
| 4436 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Leo Kim | bcb410b | 2015-10-29 11:58:40 +0900 | [diff] [blame] | 4437 | msg.body.reg_frame.reg_id = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4438 | break; |
| 4439 | |
| 4440 | case PROBE_REQ: |
| 4441 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Leo Kim | bcb410b | 2015-10-29 11:58:40 +0900 | [diff] [blame] | 4442 | msg.body.reg_frame.reg_id = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4443 | break; |
| 4444 | |
| 4445 | default: |
| 4446 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 4447 | break; |
| 4448 | } |
Leo Kim | d5f654c | 2015-10-29 11:58:39 +0900 | [diff] [blame] | 4449 | msg.body.reg_frame.frame_type = u16FrameType; |
Leo Kim | 6abf868 | 2015-10-29 11:58:38 +0900 | [diff] [blame] | 4450 | msg.body.reg_frame.reg = bReg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4451 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4452 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4453 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4454 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4455 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4456 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4457 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4458 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4459 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4460 | s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, |
| 4461 | u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, |
| 4462 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4463 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4464 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4465 | struct host_if_msg msg; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 4466 | struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4467 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4468 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4469 | PRINT_ER("driver is null\n"); |
| 4470 | return -EFAULT; |
| 4471 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4472 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4473 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4474 | |
| 4475 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 4476 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4477 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4478 | msg.drv = hif_drv; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 4479 | pstrSetBeaconParam->interval = u32Interval; |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 4480 | pstrSetBeaconParam->dtim_period = u32DTIMPeriod; |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 4481 | pstrSetBeaconParam->head_len = u32HeadLen; |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4482 | pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4483 | if (!pstrSetBeaconParam->head) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4484 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4485 | goto ERRORHANDLER; |
| 4486 | } |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 4487 | pstrSetBeaconParam->tail_len = u32TailLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4488 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4489 | if (u32TailLen > 0) { |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4490 | pstrSetBeaconParam->tail = kmemdup(pu8Tail, u32TailLen, |
| 4491 | GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4492 | if (!pstrSetBeaconParam->tail) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4493 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4494 | goto ERRORHANDLER; |
| 4495 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4496 | } else { |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 4497 | pstrSetBeaconParam->tail = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4498 | } |
| 4499 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4500 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4501 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4502 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4503 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4504 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4505 | if (result) { |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4506 | kfree(pstrSetBeaconParam->head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4507 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4508 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4509 | } |
| 4510 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4511 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4512 | } |
| 4513 | |
Chaehyun Lim | 0a5298c | 2015-11-06 19:11:10 +0900 | [diff] [blame] | 4514 | int host_int_del_beacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4515 | { |
Chaehyun Lim | 0a5298c | 2015-11-06 19:11:10 +0900 | [diff] [blame] | 4516 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4517 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4518 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4519 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4520 | PRINT_ER("driver is null\n"); |
| 4521 | return -EFAULT; |
| 4522 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4523 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4524 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4525 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4526 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 4527 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4528 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4529 | if (result) |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 4530 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4531 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4532 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4533 | } |
| 4534 | |
Chaehyun Lim | 18cfbd3 | 2015-11-06 19:11:16 +0900 | [diff] [blame] | 4535 | int host_int_add_station(struct host_if_drv *hif_drv, |
Chaehyun Lim | e337854 | 2015-11-06 19:11:18 +0900 | [diff] [blame] | 4536 | struct add_sta_param *sta_param) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4537 | { |
Chaehyun Lim | 18cfbd3 | 2015-11-06 19:11:16 +0900 | [diff] [blame] | 4538 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4539 | struct host_if_msg msg; |
Chaehyun Lim | 773e02e | 2015-11-06 19:11:19 +0900 | [diff] [blame] | 4540 | struct add_sta_param *add_sta_info = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4541 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4542 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4543 | PRINT_ER("driver is null\n"); |
| 4544 | return -EFAULT; |
| 4545 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4546 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4547 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4548 | |
| 4549 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 4550 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4551 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4552 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4553 | |
Chaehyun Lim | 773e02e | 2015-11-06 19:11:19 +0900 | [diff] [blame] | 4554 | memcpy(add_sta_info, sta_param, sizeof(struct add_sta_param)); |
| 4555 | if (add_sta_info->rates_len > 0) { |
Chaehyun Lim | 9062305 | 2015-11-06 19:11:21 +0900 | [diff] [blame] | 4556 | add_sta_info->rates = kmemdup(sta_param->rates, |
| 4557 | add_sta_info->rates_len, |
| 4558 | GFP_KERNEL); |
| 4559 | if (!add_sta_info->rates) |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4560 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4561 | } |
| 4562 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4563 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4564 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4565 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4566 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4567 | } |
| 4568 | |
Chaehyun Lim | c9c4eb4 | 2015-11-06 19:11:14 +0900 | [diff] [blame] | 4569 | int host_int_del_station(struct host_if_drv *hif_drv, const u8 *mac_addr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4570 | { |
Chaehyun Lim | 79a0c0a | 2015-11-06 19:11:12 +0900 | [diff] [blame] | 4571 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4572 | struct host_if_msg msg; |
Chaehyun Lim | c87fbed | 2015-11-06 19:11:15 +0900 | [diff] [blame] | 4573 | struct del_sta *del_sta_info = &msg.body.del_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4574 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4575 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4576 | PRINT_ER("driver is null\n"); |
| 4577 | return -EFAULT; |
| 4578 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4579 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4580 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4581 | |
| 4582 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 4583 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4584 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4585 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4586 | |
Chaehyun Lim | c9c4eb4 | 2015-11-06 19:11:14 +0900 | [diff] [blame] | 4587 | if (!mac_addr) |
Chaehyun Lim | c87fbed | 2015-11-06 19:11:15 +0900 | [diff] [blame] | 4588 | eth_broadcast_addr(del_sta_info->mac_addr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4589 | else |
Chaehyun Lim | c87fbed | 2015-11-06 19:11:15 +0900 | [diff] [blame] | 4590 | memcpy(del_sta_info->mac_addr, mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4591 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4592 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4593 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4594 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4595 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4596 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4597 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4598 | s32 host_int_del_allstation(struct host_if_drv *hif_drv, |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 4599 | u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4600 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4601 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4602 | struct host_if_msg msg; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 4603 | struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4604 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4605 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4606 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4607 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4608 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4609 | PRINT_ER("driver is null\n"); |
| 4610 | return -EFAULT; |
| 4611 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4612 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4613 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4614 | |
| 4615 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 4616 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4617 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4618 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4619 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4620 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 4621 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 4622 | memcpy(pstrDelAllStationMsg->del_all_sta[i], pu8MacAddr[i], ETH_ALEN); |
| 4623 | PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", |
| 4624 | pstrDelAllStationMsg->del_all_sta[i][0], |
| 4625 | pstrDelAllStationMsg->del_all_sta[i][1], |
| 4626 | pstrDelAllStationMsg->del_all_sta[i][2], |
| 4627 | pstrDelAllStationMsg->del_all_sta[i][3], |
| 4628 | pstrDelAllStationMsg->del_all_sta[i][4], |
| 4629 | pstrDelAllStationMsg->del_all_sta[i][5]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4630 | u8AssocNumb++; |
| 4631 | } |
| 4632 | } |
| 4633 | if (!u8AssocNumb) { |
| 4634 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4635 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4636 | } |
| 4637 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 4638 | pstrDelAllStationMsg->assoc_sta = u8AssocNumb; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4639 | 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] | 4640 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4641 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4642 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4643 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4644 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4645 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4646 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4647 | } |
| 4648 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4649 | s32 host_int_edit_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4650 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4651 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4652 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4653 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4654 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4655 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4656 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4657 | PRINT_ER("driver is null\n"); |
| 4658 | return -EFAULT; |
| 4659 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4660 | |
| 4661 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 4662 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4663 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4664 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4665 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4666 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4667 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4668 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 4669 | if (pstrAddStationMsg->rates_len > 0) { |
| 4670 | u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 4671 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4672 | if (!rates) |
| 4673 | return -ENOMEM; |
| 4674 | |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 4675 | memcpy(rates, pstrStaParams->rates, |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 4676 | pstrAddStationMsg->rates_len); |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 4677 | pstrAddStationMsg->rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4678 | } |
| 4679 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4680 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4681 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4682 | PRINT_ER("wilc_mq_send fail\n"); |
| 4683 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4684 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4685 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4686 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4687 | s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv, |
| 4688 | bool bIsEnabled, |
| 4689 | u32 u32Timeout) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4690 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4691 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4692 | struct host_if_msg msg; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 4693 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4694 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4695 | 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] | 4696 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4697 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4698 | PRINT_ER("driver is null\n"); |
| 4699 | return -EFAULT; |
| 4700 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4701 | |
| 4702 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 4703 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4704 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4705 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4706 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4707 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4708 | |
Leo Kim | 33c70c1 | 2015-10-13 20:02:07 +0900 | [diff] [blame] | 4709 | pstrPowerMgmtParam->enabled = bIsEnabled; |
Leo Kim | 937918f | 2015-10-13 20:02:08 +0900 | [diff] [blame] | 4710 | pstrPowerMgmtParam->timeout = u32Timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4711 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4712 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4713 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4714 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4715 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4716 | } |
| 4717 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4718 | s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv, |
| 4719 | bool bIsEnabled, |
| 4720 | u32 u32count) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4721 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4722 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4723 | struct host_if_msg msg; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 4724 | struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4725 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4726 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4727 | PRINT_ER("driver is null\n"); |
| 4728 | return -EFAULT; |
| 4729 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4730 | |
| 4731 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 4732 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4733 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4734 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4735 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4736 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4737 | |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 4738 | pstrMulticastFilterParam->enabled = bIsEnabled; |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 4739 | pstrMulticastFilterParam->cnt = u32count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4740 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4741 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4742 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4743 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4744 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4745 | } |
| 4746 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4747 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 4748 | { |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4749 | struct join_bss_param *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4750 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4751 | u16 u16IEsLen; |
| 4752 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4753 | u8 suppRatesNo = 0; |
| 4754 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4755 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4756 | u8 pcipherCount; |
| 4757 | u8 authCount; |
| 4758 | u8 pcipherTotalCount = 0; |
| 4759 | u8 authTotalCount = 0; |
| 4760 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4761 | |
| 4762 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 4763 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 4764 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 4765 | pNewJoinBssParam = kzalloc(sizeof(struct join_bss_param), GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4766 | if (pNewJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4767 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 4768 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 4769 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4770 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4771 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Leo Kim | 619d27b | 2015-10-15 13:24:42 +0900 | [diff] [blame] | 4772 | pNewJoinBssParam->ssid_len = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4773 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 4774 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4775 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4776 | while (index < u16IEsLen) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4777 | if (pu8IEs[index] == SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4778 | suppRatesNo = pu8IEs[index + 1]; |
| 4779 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4780 | index += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4781 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4782 | for (i = 0; i < suppRatesNo; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4783 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4784 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4785 | index += suppRatesNo; |
| 4786 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4787 | } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4788 | extSuppRatesNo = pu8IEs[index + 1]; |
| 4789 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 4790 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 4791 | else |
| 4792 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 4793 | index += 2; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4794 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4795 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4796 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4797 | index += extSuppRatesNo; |
| 4798 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4799 | } else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4800 | pNewJoinBssParam->ht_capable = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4801 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4802 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4803 | } else if ((pu8IEs[index] == WMM_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4804 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4805 | (pu8IEs[index + 4] == 0xF2) && |
| 4806 | (pu8IEs[index + 5] == 0x02) && |
| 4807 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4808 | (pu8IEs[index + 7] == 0x01)) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4809 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4810 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4811 | if (pu8IEs[index + 8] & BIT(7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4812 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4813 | index += pu8IEs[index + 1] + 2; |
| 4814 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4815 | } else if ((pu8IEs[index] == P2P_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4816 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4817 | (pu8IEs[index + 4] == 0x9a) && |
| 4818 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4819 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4820 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4821 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 4822 | pNewJoinBssParam->noa_enabled = 1; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 4823 | pNewJoinBssParam->idx = pu8IEs[index + 9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4824 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4825 | if (pu8IEs[index + 10] & BIT(7)) { |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4826 | pNewJoinBssParam->opp_enabled = 1; |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 4827 | pNewJoinBssParam->ct_window = pu8IEs[index + 10]; |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4828 | } else { |
| 4829 | pNewJoinBssParam->opp_enabled = 0; |
| 4830 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4831 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4832 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4833 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4834 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4835 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 4836 | pNewJoinBssParam->cnt = pu8IEs[index + 11]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4837 | u16P2P_count = index + 12; |
| 4838 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 4839 | memcpy(pNewJoinBssParam->duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4840 | u16P2P_count += 4; |
| 4841 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 4842 | memcpy(pNewJoinBssParam->interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4843 | u16P2P_count += 4; |
| 4844 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 4845 | memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4846 | |
| 4847 | index += pu8IEs[index + 1] + 2; |
| 4848 | continue; |
| 4849 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4850 | } else if ((pu8IEs[index] == RSN_IE) || |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4851 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 4852 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 4853 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4854 | u16 rsnIndex = index; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4855 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4856 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 4857 | pNewJoinBssParam->mode_802_11i = 2; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4858 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4859 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 4860 | pNewJoinBssParam->mode_802_11i = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4861 | rsnIndex += 4; |
| 4862 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4863 | |
| 4864 | rsnIndex += 7; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4865 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 4866 | rsnIndex++; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4867 | jumpOffset = pu8IEs[rsnIndex] * 4; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4868 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4869 | rsnIndex += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4870 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4871 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4872 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4873 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4874 | pcipherTotalCount += pcipherCount; |
| 4875 | rsnIndex += jumpOffset; |
| 4876 | |
| 4877 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 4878 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4879 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4880 | rsnIndex += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4881 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4882 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4883 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4884 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4885 | authTotalCount += authCount; |
| 4886 | rsnIndex += jumpOffset; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4887 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4888 | if (pu8IEs[index] == RSN_IE) { |
| 4889 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 4890 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 4891 | rsnIndex += 2; |
| 4892 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 4893 | pNewJoinBssParam->rsn_found = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4894 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4895 | continue; |
| 4896 | } else |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4897 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4898 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4899 | } |
| 4900 | |
| 4901 | return (void *)pNewJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4902 | } |
| 4903 | |
| 4904 | void host_int_freeJoinParams(void *pJoinParams) |
| 4905 | { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4906 | if ((struct bss_param *)pJoinParams) |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4907 | kfree((struct bss_param *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4908 | else |
| 4909 | PRINT_ER("Unable to FREE null pointer\n"); |
| 4910 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4911 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4912 | 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] | 4913 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4914 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4915 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4916 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4917 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4918 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4919 | PRINT_ER("driver is null\n"); |
| 4920 | return -EFAULT; |
| 4921 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4922 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4923 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4924 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4925 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4926 | |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 4927 | memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 4928 | pBASessionInfo->tid = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4929 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4930 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4931 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4932 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4933 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4934 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4935 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4936 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4937 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4938 | } |
| 4939 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4940 | s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, |
| 4941 | char *pBSSID, |
| 4942 | char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4943 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4944 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4945 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4946 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4947 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4948 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4949 | PRINT_ER("driver is null\n"); |
| 4950 | return -EFAULT; |
| 4951 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4952 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4953 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4954 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4955 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4956 | |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 4957 | memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 4958 | pBASessionInfo->tid = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4959 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4960 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4961 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4962 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4963 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4964 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4965 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4966 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4967 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4968 | } |
| 4969 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4970 | 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] | 4971 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4972 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4973 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4974 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4975 | return 0; |
| 4976 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4977 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4978 | PRINT_ER("driver is null\n"); |
| 4979 | return -EFAULT; |
| 4980 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4981 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4982 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4983 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4984 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4985 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 4986 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4987 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4988 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4989 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4990 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4991 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4992 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4993 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4994 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4995 | } |
| 4996 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4997 | 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] | 4998 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4999 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5000 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5001 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5002 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5003 | PRINT_ER("driver is null\n"); |
| 5004 | return -EFAULT; |
| 5005 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5006 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5007 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5008 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5009 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5010 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 5011 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5012 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 5013 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5014 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5015 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 5016 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5017 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5018 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5019 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5020 | } |