Chaehyun Lim | e215a87 | 2015-09-30 08:15:41 +0900 | [diff] [blame] | 1 | #include <linux/slab.h> |
| 2 | #include <linux/time.h> |
| 3 | #include <linux/kthread.h> |
| 4 | #include <linux/delay.h> |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5 | #include "host_interface.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6 | #include "coreconfigurator.h" |
Chaehyun Lim | 5366012 | 2015-09-17 16:48:49 +0900 | [diff] [blame] | 7 | #include "wilc_wlan_if.h" |
Chaehyun Lim | f23eb98 | 2015-09-23 18:03:47 +0900 | [diff] [blame] | 8 | #include "wilc_msgqueue.h" |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 9 | #include <linux/etherdevice.h> |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 10 | #include "wilc_wfi_netdevice.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 11 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 12 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 13 | |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 14 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 15 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 16 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 17 | |
Chaehyun Lim | 9eac3a1 | 2015-06-18 22:08:51 +0900 | [diff] [blame] | 18 | #define HOST_IF_MSG_SCAN 0 |
| 19 | #define HOST_IF_MSG_CONNECT 1 |
| 20 | #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 |
| 21 | #define HOST_IF_MSG_KEY 3 |
| 22 | #define HOST_IF_MSG_RCVD_NTWRK_INFO 4 |
| 23 | #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5 |
| 24 | #define HOST_IF_MSG_CFG_PARAMS 6 |
| 25 | #define HOST_IF_MSG_SET_CHANNEL 7 |
| 26 | #define HOST_IF_MSG_DISCONNECT 8 |
| 27 | #define HOST_IF_MSG_GET_RSSI 9 |
| 28 | #define HOST_IF_MSG_GET_CHNL 10 |
| 29 | #define HOST_IF_MSG_ADD_BEACON 11 |
| 30 | #define HOST_IF_MSG_DEL_BEACON 12 |
| 31 | #define HOST_IF_MSG_ADD_STATION 13 |
| 32 | #define HOST_IF_MSG_DEL_STATION 14 |
| 33 | #define HOST_IF_MSG_EDIT_STATION 15 |
| 34 | #define HOST_IF_MSG_SCAN_TIMER_FIRED 16 |
| 35 | #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17 |
| 36 | #define HOST_IF_MSG_POWER_MGMT 18 |
| 37 | #define HOST_IF_MSG_GET_INACTIVETIME 19 |
| 38 | #define HOST_IF_MSG_REMAIN_ON_CHAN 20 |
| 39 | #define HOST_IF_MSG_REGISTER_FRAME 21 |
| 40 | #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22 |
| 41 | #define HOST_IF_MSG_GET_LINKSPEED 23 |
| 42 | #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24 |
| 43 | #define HOST_IF_MSG_SET_MAC_ADDRESS 25 |
| 44 | #define HOST_IF_MSG_GET_MAC_ADDRESS 26 |
| 45 | #define HOST_IF_MSG_SET_OPERATION_MODE 27 |
| 46 | #define HOST_IF_MSG_SET_IPADDRESS 28 |
| 47 | #define HOST_IF_MSG_GET_IPADDRESS 29 |
| 48 | #define HOST_IF_MSG_FLUSH_CONNECT 30 |
| 49 | #define HOST_IF_MSG_GET_STATISTICS 31 |
| 50 | #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 |
| 51 | #define HOST_IF_MSG_ADD_BA_SESSION 33 |
| 52 | #define HOST_IF_MSG_DEL_BA_SESSION 34 |
| 53 | #define HOST_IF_MSG_Q_IDLE 35 |
| 54 | #define HOST_IF_MSG_DEL_ALL_STA 36 |
| 55 | #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34 |
| 56 | #define HOST_IF_MSG_EXIT 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 57 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 58 | #define HOST_IF_SCAN_TIMEOUT 4000 |
| 59 | #define HOST_IF_CONNECT_TIMEOUT 9500 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 60 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 61 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
| 62 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 |
| 63 | #define BLOCK_ACK_REQ_SIZE 0x14 |
Leo Kim | 9f3295a | 2015-10-19 18:26:10 +0900 | [diff] [blame] | 64 | #define FALSE_FRMWR_CHANNEL 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 65 | |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 66 | struct cfg_param_attr { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 67 | struct cfg_param_val cfg_attr_info; |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 68 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 69 | |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 70 | struct host_if_wpa_attr { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 71 | u8 *key; |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 72 | const u8 *mac_addr; |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 73 | u8 *seq; |
Leo Kim | dacc594 | 2015-10-13 19:49:33 +0900 | [diff] [blame] | 74 | u8 seq_len; |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 75 | u8 index; |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 76 | u8 key_len; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 77 | u8 mode; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 78 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 79 | |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 80 | struct host_if_wep_attr { |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 81 | u8 *key; |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame] | 82 | u8 key_len; |
Tony Cho | 259b3aa | 2015-10-12 16:56:13 +0900 | [diff] [blame] | 83 | u8 index; |
Tony Cho | b5eaff1 | 2015-10-12 16:56:14 +0900 | [diff] [blame] | 84 | u8 mode; |
Tony Cho | 7fa252e | 2015-10-12 16:56:15 +0900 | [diff] [blame] | 85 | enum AUTHTYPE auth_type; |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 86 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 87 | |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 88 | union host_if_key_attr { |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 89 | struct host_if_wep_attr wep; |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 90 | struct host_if_wpa_attr wpa; |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 91 | struct host_if_pmkid_attr pmkid; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 92 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 93 | |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 94 | struct key_attr { |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 95 | enum KEY_TYPE type; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 96 | u8 action; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 97 | union host_if_key_attr attr; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 98 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 99 | |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 100 | struct scan_attr { |
Leo Kim | 4256889 | 2015-10-13 19:49:37 +0900 | [diff] [blame] | 101 | u8 src; |
Leo Kim | 1e276c8 | 2015-10-13 19:49:38 +0900 | [diff] [blame] | 102 | u8 type; |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 103 | u8 *ch_freq_list; |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 104 | u8 ch_list_len; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 105 | u8 *ies; |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 106 | size_t ies_len; |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 107 | wilc_scan_result result; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 108 | void *arg; |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 109 | struct hidden_network hidden_network; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 110 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 111 | |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 112 | struct connect_attr { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 113 | u8 *bssid; |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 114 | u8 *ssid; |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 115 | size_t ssid_len; |
Leo Kim | 2ea158c | 2015-10-13 19:49:52 +0900 | [diff] [blame] | 116 | u8 *ies; |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 117 | size_t ies_len; |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 118 | u8 security; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 119 | wilc_connect_result result; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 120 | void *arg; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 121 | enum AUTHTYPE auth_type; |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 122 | u8 ch; |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 123 | void *params; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 124 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 125 | |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 126 | struct rcvd_async_info { |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 127 | u8 *buffer; |
Leo Kim | f94f488 | 2015-10-13 19:50:01 +0900 | [diff] [blame] | 128 | u32 len; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 129 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 130 | |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 131 | struct channel_attr { |
Leo Kim | 730ee05 | 2015-10-13 19:50:02 +0900 | [diff] [blame] | 132 | u8 set_ch; |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 133 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 134 | |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 135 | struct beacon_attr { |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 136 | u32 interval; |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 137 | u32 dtim_period; |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 138 | u32 head_len; |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 139 | u8 *head; |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 140 | u32 tail_len; |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 141 | u8 *tail; |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 142 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 143 | |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 144 | struct set_multicast { |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 145 | bool enabled; |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 146 | u32 cnt; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 147 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 148 | |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 149 | struct del_all_sta { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 150 | u8 del_all_sta[MAX_NUM_STA][ETH_ALEN]; |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 151 | u8 assoc_sta; |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 152 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 153 | |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 154 | struct del_sta { |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 155 | u8 mac_addr[ETH_ALEN]; |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 156 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 157 | |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 158 | struct power_mgmt_param { |
Leo Kim | 33c70c1 | 2015-10-13 20:02:07 +0900 | [diff] [blame] | 159 | bool enabled; |
Leo Kim | 937918f | 2015-10-13 20:02:08 +0900 | [diff] [blame] | 160 | u32 timeout; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 161 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 162 | |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 163 | struct set_ip_addr { |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 164 | u8 *ip_addr; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 165 | u8 idx; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 166 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 167 | |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 168 | struct sta_inactive_t { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 169 | u8 mac[6]; |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 170 | }; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 171 | |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 172 | union message_body { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 173 | struct scan_attr scan_info; |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 174 | struct connect_attr con_info; |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 175 | struct rcvd_net_info net_info; |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 176 | struct rcvd_async_info async_info; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 177 | struct key_attr key_info; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 178 | struct cfg_param_attr cfg_info; |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 179 | struct channel_attr channel_info; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 180 | struct beacon_attr beacon_info; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 181 | struct add_sta_param add_sta_info; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 182 | struct del_sta del_sta_info; |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 183 | struct add_sta_param edit_sta_info; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 184 | struct power_mgmt_param pwr_mgmt_info; |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 185 | struct sta_inactive_t mac_info; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 186 | struct set_ip_addr ip_info; |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 187 | struct drv_handler drv; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 188 | struct set_multicast multicast_info; |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 189 | struct op_mode mode; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 190 | struct set_mac_addr set_mac_info; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 191 | struct get_mac_addr get_mac_info; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 192 | struct ba_session_info session_info; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 193 | struct remain_ch remain_on_ch; |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 194 | struct reg_frame reg_frame; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 195 | char *data; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 196 | struct del_all_sta del_all_sta_info; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 197 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 198 | |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 199 | struct host_if_msg { |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 200 | u16 id; |
| 201 | union message_body body; |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 202 | struct host_if_drv *drv; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 203 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 204 | |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 205 | struct join_bss_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 206 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 207 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 208 | u16 beacon_period; |
| 209 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 210 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 211 | char ssid[MAX_SSID_LEN]; |
Leo Kim | 619d27b | 2015-10-15 13:24:42 +0900 | [diff] [blame] | 212 | u8 ssid_len; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 213 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 214 | u8 ht_capable; |
| 215 | u8 wmm_cap; |
| 216 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 217 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 218 | u8 rsn_grp_policy; |
| 219 | u8 mode_802_11i; |
| 220 | u8 rsn_pcip_policy[3]; |
| 221 | u8 rsn_auth_policy[3]; |
| 222 | u8 rsn_cap[2]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 223 | u32 tsf; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 224 | u8 noa_enabled; |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 225 | u8 opp_enabled; |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 226 | u8 ct_window; |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 227 | u8 cnt; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 228 | u8 idx; |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 229 | u8 duration[4]; |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 230 | u8 interval[4]; |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 231 | u8 start_time[4]; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 232 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 233 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 234 | static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
| 235 | struct host_if_drv *terminated_handle; |
Leo Kim | f2fc9f6 | 2015-10-13 19:49:47 +0900 | [diff] [blame] | 236 | bool g_obtainingIP; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 237 | u8 P2P_LISTEN_STATE; |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 238 | static struct task_struct *hif_thread_handler; |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 239 | static WILC_MsgQueueHandle hif_msg_q; |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 240 | static struct semaphore hif_sema_thread; |
kbuild test robot | 413f930 | 2015-10-15 14:07:41 +0800 | [diff] [blame] | 241 | static struct semaphore hif_sema_driver; |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 242 | static struct semaphore hif_sema_wait_response; |
kbuild test robot | 1722500 | 2015-10-15 14:21:32 +0800 | [diff] [blame] | 243 | static struct semaphore hif_sema_deinit; |
kbuild test robot | 24aadb8 | 2015-10-15 14:32:40 +0800 | [diff] [blame] | 244 | static struct timer_list periodic_rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 245 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 246 | u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 247 | |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 248 | static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 249 | |
kbuild test robot | f64321c | 2015-10-15 14:46:26 +0800 | [diff] [blame] | 250 | static bool scan_while_connected; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 251 | |
Leo Kim | 144b7b2 | 2015-10-15 13:25:01 +0900 | [diff] [blame] | 252 | static s8 rssi; |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 253 | static s8 link_speed; |
Leo Kim | 95ebb0f | 2015-10-15 13:25:03 +0900 | [diff] [blame] | 254 | static u8 ch_no; |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 255 | static u8 set_ip[2][4]; |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 256 | static u8 get_ip[2][4]; |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 257 | static u32 inactive_time; |
Leo Kim | a74c7bf | 2015-10-15 13:25:07 +0900 | [diff] [blame] | 258 | static u8 del_beacon; |
Leo Kim | 7178aed | 2015-10-19 18:26:09 +0900 | [diff] [blame] | 259 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 260 | |
kbuild test robot | ef59919 | 2015-10-15 15:04:15 +0800 | [diff] [blame] | 261 | static u8 *join_req; |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 262 | u8 *info_element; |
kbuild test robot | 23047d5 | 2015-10-15 15:18:34 +0800 | [diff] [blame] | 263 | static u8 mode_11i; |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 264 | u8 auth_type; |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 265 | u32 join_req_size; |
kbuild test robot | 5e0e7c2 | 2015-10-15 15:47:44 +0800 | [diff] [blame] | 266 | static u32 info_element_size; |
kbuild test robot | 23fba59 | 2015-10-15 15:59:53 +0800 | [diff] [blame] | 267 | static struct host_if_drv *join_req_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 268 | #define REAL_JOIN_REQ 0 |
| 269 | #define FLUSHED_JOIN_REQ 1 |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 270 | #define FLUSHED_BYTE_POS 79 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 271 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 272 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 273 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 274 | extern void chip_sleep_manually(u32 u32SleepTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 275 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 276 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 277 | static int add_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 278 | { |
| 279 | int i; |
| 280 | |
| 281 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 282 | if (!wfidrv_list[i]) { |
| 283 | wfidrv_list[i] = handler; |
| 284 | return 0; |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | return -ENOBUFS; |
| 289 | } |
| 290 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 291 | static int remove_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 292 | { |
| 293 | int i; |
| 294 | |
| 295 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 296 | if (wfidrv_list[i] == handler) { |
| 297 | wfidrv_list[i] = NULL; |
| 298 | return 0; |
| 299 | } |
| 300 | } |
| 301 | |
| 302 | return -EINVAL; |
| 303 | } |
| 304 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 305 | static int get_id_from_handler(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 306 | { |
| 307 | int i; |
| 308 | |
| 309 | if (!handler) |
| 310 | return 0; |
| 311 | |
| 312 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 313 | if (wfidrv_list[i] == handler) |
| 314 | return i; |
| 315 | } |
| 316 | |
| 317 | return 0; |
| 318 | } |
| 319 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 320 | static struct host_if_drv *get_handler_from_id(int id) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 321 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 322 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 323 | return NULL; |
| 324 | return wfidrv_list[id]; |
| 325 | } |
| 326 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 327 | static s32 Handle_SetChannel(struct host_if_drv *hif_drv, |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 328 | struct channel_attr *pstrHostIFSetChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 329 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 330 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 331 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 332 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 333 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 334 | wid.type = WID_CHAR; |
| 335 | wid.val = (char *)&pstrHostIFSetChan->set_ch; |
| 336 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 337 | |
| 338 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 339 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 340 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 341 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 342 | |
| 343 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 344 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 345 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 346 | } |
| 347 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 348 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 349 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 350 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 351 | static s32 Handle_SetWfiDrvHandler(struct host_if_drv *hif_drv, |
Tony Cho | 127f9d9 | 2015-09-21 12:16:51 +0900 | [diff] [blame] | 352 | struct drv_handler *pstrHostIfSetDrvHandler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 353 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 354 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 355 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 356 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 357 | wid.id = (u16)WID_SET_DRV_HANDLER; |
| 358 | wid.type = WID_INT; |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 359 | wid.val = (s8 *)&pstrHostIfSetDrvHandler->handler; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 360 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 361 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 362 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 363 | pstrHostIfSetDrvHandler->handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 364 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 365 | if (!hif_drv) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 366 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 367 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 368 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 369 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 370 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 371 | } |
| 372 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 373 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 374 | } |
| 375 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 376 | static s32 Handle_SetOperationMode(struct host_if_drv *hif_drv, |
Tony Cho | 801bee5 | 2015-09-21 12:16:53 +0900 | [diff] [blame] | 377 | struct op_mode *pstrHostIfSetOperationMode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 378 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 379 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 380 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 381 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 382 | wid.id = (u16)WID_SET_OPERATION_MODE; |
| 383 | wid.type = WID_INT; |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 384 | wid.val = (s8 *)&pstrHostIfSetOperationMode->mode; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 385 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 386 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 387 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 388 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 389 | |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 390 | if ((pstrHostIfSetOperationMode->mode) == IDLE_MODE) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 391 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 392 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 393 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 394 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 395 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 396 | } |
| 397 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 398 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 399 | } |
| 400 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 401 | s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 402 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 403 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 404 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 405 | char firmwareIPAddress[4] = {0}; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 406 | |
| 407 | if (pu8IPAddr[0] < 192) |
| 408 | pu8IPAddr[0] = 0; |
| 409 | |
Luis de Bethencourt | b3a0283 | 2015-06-26 17:40:25 +0200 | [diff] [blame] | 410 | PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", idx, pu8IPAddr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 411 | |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 412 | memcpy(set_ip[idx], pu8IPAddr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 413 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 414 | wid.id = (u16)WID_IP_ADDRESS; |
| 415 | wid.type = WID_STR; |
| 416 | wid.val = (u8 *)pu8IPAddr; |
| 417 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 418 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 419 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 420 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 421 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 422 | host_int_get_ipaddress(hif_drv, firmwareIPAddress, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 423 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 424 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 425 | PRINT_ER("Failed to set IP address\n"); |
| 426 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 427 | } |
| 428 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 429 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 430 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 431 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 432 | } |
| 433 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 434 | s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 435 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 436 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 437 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 438 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 439 | wid.id = (u16)WID_IP_ADDRESS; |
| 440 | wid.type = WID_STR; |
| 441 | wid.val = kmalloc(IP_ALEN, GFP_KERNEL); |
| 442 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 443 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 444 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 445 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 446 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 447 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 448 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 449 | memcpy(get_ip[idx], wid.val, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 450 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 451 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 452 | |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 453 | if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 454 | host_int_setup_ipaddress(hif_drv, set_ip[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 455 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 456 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 457 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 458 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 459 | } |
| 460 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 461 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 462 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", get_ip[idx]); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 463 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 464 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 465 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 466 | } |
| 467 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 468 | static s32 Handle_SetMacAddress(struct host_if_drv *hif_drv, |
Tony Cho | b7611a8 | 2015-09-21 12:16:54 +0900 | [diff] [blame] | 469 | struct set_mac_addr *pstrHostIfSetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 470 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 471 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 472 | struct wid wid; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 473 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 474 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 475 | if (!mac_buf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 476 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 477 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 478 | } |
Leo Kim | ae5e452 | 2015-10-28 15:59:31 +0900 | [diff] [blame] | 479 | memcpy(mac_buf, pstrHostIfSetMacAddress->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 480 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 481 | wid.id = (u16)WID_MAC_ADDR; |
| 482 | wid.type = WID_STR; |
| 483 | wid.val = mac_buf; |
| 484 | wid.size = ETH_ALEN; |
| 485 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 486 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 487 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 488 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 489 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 490 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 491 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 492 | } |
| 493 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 494 | kfree(mac_buf); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 495 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 496 | } |
| 497 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 498 | static s32 Handle_GetMacAddress(struct host_if_drv *hif_drv, |
Tony Cho | fcd27c5 | 2015-09-21 12:16:55 +0900 | [diff] [blame] | 499 | struct get_mac_addr *pstrHostIfGetMacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 500 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 501 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 502 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 503 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 504 | wid.id = (u16)WID_MAC_ADDR; |
| 505 | wid.type = WID_STR; |
Leo Kim | 6ceba0a | 2015-10-28 15:59:32 +0900 | [diff] [blame] | 506 | wid.val = pstrHostIfGetMacAddress->mac_addr; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 507 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 508 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 509 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 510 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 511 | |
| 512 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 513 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 514 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 515 | } |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 516 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 517 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 518 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 519 | } |
| 520 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 521 | static s32 Handle_CfgParam(struct host_if_drv *hif_drv, |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 522 | struct cfg_param_attr *strHostIFCfgParamAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 523 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 524 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 525 | struct wid strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 526 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 527 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 528 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 529 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 530 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 531 | |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 532 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & BSS_TYPE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 533 | if (strHostIFCfgParamAttr->cfg_attr_info.bss_type < 6) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 534 | strWIDList[u8WidCnt].id = WID_BSS_TYPE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 535 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.bss_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 536 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 537 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 538 | hif_drv->strCfgValues.bss_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 539 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 540 | PRINT_ER("check value 6 over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 541 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 542 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 543 | } |
| 544 | u8WidCnt++; |
| 545 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 546 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTH_TYPE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 547 | if ((strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 1 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 2 || (strHostIFCfgParamAttr->cfg_attr_info.auth_type) == 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 548 | strWIDList[u8WidCnt].id = WID_AUTH_TYPE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 549 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 550 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 551 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 552 | hif_drv->strCfgValues.auth_type = (u8)strHostIFCfgParamAttr->cfg_attr_info.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 553 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 554 | PRINT_ER("Impossible value \n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 555 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 556 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 557 | } |
| 558 | u8WidCnt++; |
| 559 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 560 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 561 | if (strHostIFCfgParamAttr->cfg_attr_info.auth_timeout > 0 && strHostIFCfgParamAttr->cfg_attr_info.auth_timeout < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 562 | strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 563 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 564 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 565 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 566 | hif_drv->strCfgValues.auth_timeout = strHostIFCfgParamAttr->cfg_attr_info.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 567 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 568 | PRINT_ER("Range(1 ~ 65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 569 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 570 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 571 | } |
| 572 | u8WidCnt++; |
| 573 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 574 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & POWER_MANAGEMENT) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 575 | if (strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode < 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 576 | strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 577 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 578 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 579 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 580 | hif_drv->strCfgValues.power_mgmt_mode = (u8)strHostIFCfgParamAttr->cfg_attr_info.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 581 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 582 | PRINT_ER("Invalide power mode\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 583 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 584 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 585 | } |
| 586 | u8WidCnt++; |
| 587 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 588 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_SHORT) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 589 | if ((strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit < 256)) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 590 | strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 591 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 592 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 593 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 594 | hif_drv->strCfgValues.short_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 595 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 596 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 597 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 598 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 599 | } |
| 600 | u8WidCnt++; |
| 601 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 602 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RETRY_LONG) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 603 | if ((strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit > 0) && (strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit < 256)) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 604 | strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 605 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 606 | |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 607 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 608 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 609 | hif_drv->strCfgValues.long_retry_limit = strHostIFCfgParamAttr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 610 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 611 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 612 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 613 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 614 | } |
| 615 | u8WidCnt++; |
| 616 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 617 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & FRAG_THRESHOLD) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 618 | if (strHostIFCfgParamAttr->cfg_attr_info.frag_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.frag_threshold < 7937) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 619 | strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 620 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 621 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 622 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 623 | hif_drv->strCfgValues.frag_threshold = strHostIFCfgParamAttr->cfg_attr_info.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 624 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 625 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 626 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 627 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 628 | } |
| 629 | u8WidCnt++; |
| 630 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 631 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & RTS_THRESHOLD) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 632 | if (strHostIFCfgParamAttr->cfg_attr_info.rts_threshold > 255 && strHostIFCfgParamAttr->cfg_attr_info.rts_threshold < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 633 | strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 634 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 635 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 636 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 637 | hif_drv->strCfgValues.rts_threshold = strHostIFCfgParamAttr->cfg_attr_info.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 638 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 639 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 640 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 641 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 642 | } |
| 643 | u8WidCnt++; |
| 644 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 645 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & PREAMBLE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 646 | if (strHostIFCfgParamAttr->cfg_attr_info.preamble_type < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 647 | strWIDList[u8WidCnt].id = WID_PREAMBLE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 648 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.preamble_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 649 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 650 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 651 | hif_drv->strCfgValues.preamble_type = strHostIFCfgParamAttr->cfg_attr_info.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 652 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 653 | PRINT_ER("Preamle Range(0~2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 654 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 655 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 656 | } |
| 657 | u8WidCnt++; |
| 658 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 659 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 660 | if (strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 661 | strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 662 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 663 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 664 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 665 | hif_drv->strCfgValues.short_slot_allowed = (u8)strHostIFCfgParamAttr->cfg_attr_info.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 666 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 667 | PRINT_ER("Short slot(2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 668 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 669 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 670 | } |
| 671 | u8WidCnt++; |
| 672 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 673 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 674 | if (strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 675 | strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 676 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 677 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 678 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 679 | hif_drv->strCfgValues.txop_prot_disabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 680 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 681 | PRINT_ER("TXOP prot disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 682 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 683 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 684 | } |
| 685 | u8WidCnt++; |
| 686 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 687 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & BEACON_INTERVAL) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 688 | if (strHostIFCfgParamAttr->cfg_attr_info.beacon_interval > 0 && strHostIFCfgParamAttr->cfg_attr_info.beacon_interval < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 689 | strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 690 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 691 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 692 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 693 | hif_drv->strCfgValues.beacon_interval = strHostIFCfgParamAttr->cfg_attr_info.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 694 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 695 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 696 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 697 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 698 | } |
| 699 | u8WidCnt++; |
| 700 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 701 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & DTIM_PERIOD) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 702 | if (strHostIFCfgParamAttr->cfg_attr_info.dtim_period > 0 && strHostIFCfgParamAttr->cfg_attr_info.dtim_period < 256) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 703 | strWIDList[u8WidCnt].id = WID_DTIM_PERIOD; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 704 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.dtim_period; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 705 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 706 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 707 | hif_drv->strCfgValues.dtim_period = strHostIFCfgParamAttr->cfg_attr_info.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 708 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 709 | PRINT_ER("DTIM range(1~255) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 710 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 711 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 712 | } |
| 713 | u8WidCnt++; |
| 714 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 715 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 716 | if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 717 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 718 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 719 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 720 | strWIDList[u8WidCnt].size = sizeof(char); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 721 | hif_drv->strCfgValues.site_survey_enabled = (u8)strHostIFCfgParamAttr->cfg_attr_info.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 722 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 723 | PRINT_ER("Site survey disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 724 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 725 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 726 | } |
| 727 | u8WidCnt++; |
| 728 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 729 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 730 | if (strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 731 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 732 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 733 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 734 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 735 | hif_drv->strCfgValues.site_survey_scan_time = strHostIFCfgParamAttr->cfg_attr_info.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 736 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 737 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 738 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 739 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 740 | } |
| 741 | u8WidCnt++; |
| 742 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 743 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & ACTIVE_SCANTIME) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 744 | if (strHostIFCfgParamAttr->cfg_attr_info.active_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.active_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 745 | strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 746 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 747 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 748 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 749 | hif_drv->strCfgValues.active_scan_time = strHostIFCfgParamAttr->cfg_attr_info.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 750 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 751 | PRINT_ER("Active scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 752 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 753 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 754 | } |
| 755 | u8WidCnt++; |
| 756 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 757 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & PASSIVE_SCANTIME) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 758 | if (strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time > 0 && strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 759 | strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 760 | strWIDList[u8WidCnt].val = (s8 *)&strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 761 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 762 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 763 | hif_drv->strCfgValues.passive_scan_time = strHostIFCfgParamAttr->cfg_attr_info.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 764 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 765 | PRINT_ER("Passive scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 766 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 767 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 768 | } |
| 769 | u8WidCnt++; |
| 770 | } |
Tony Cho | 87c05b2 | 2015-10-12 16:56:07 +0900 | [diff] [blame] | 771 | if (strHostIFCfgParamAttr->cfg_attr_info.flag & CURRENT_TX_RATE) { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 772 | enum CURRENT_TXRATE curr_tx_rate = strHostIFCfgParamAttr->cfg_attr_info.curr_tx_rate; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 773 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 774 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 775 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 776 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 777 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 778 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 779 | || curr_tx_rate == MBPS_36 || curr_tx_rate == MBPS_48 || curr_tx_rate == MBPS_54) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 780 | strWIDList[u8WidCnt].id = WID_CURRENT_TX_RATE; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 781 | strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 782 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 783 | strWIDList[u8WidCnt].size = sizeof(u16); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 784 | hif_drv->strCfgValues.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 785 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 786 | PRINT_ER("out of TX rate\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 787 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 788 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 789 | } |
| 790 | u8WidCnt++; |
| 791 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 792 | |
| 793 | result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 794 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 795 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 796 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 797 | PRINT_ER("Error in setting CFG params\n"); |
| 798 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 799 | ERRORHANDLER: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 800 | up(&hif_drv->gtOsCfgValuesSem); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 801 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 802 | } |
| 803 | |
Chaehyun Lim | fb4ec9c | 2015-06-11 14:35:59 +0900 | [diff] [blame] | 804 | static s32 Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 805 | { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 806 | g_wilc_initialized = 0; |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 807 | up(&hif_sema_wait_response); |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 808 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 809 | } |
| 810 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 811 | static s32 Handle_Scan(struct host_if_drv *hif_drv, |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 812 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 813 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 814 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 815 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 816 | u32 u32WidsCount = 0; |
| 817 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 818 | u8 *pu8Buffer; |
| 819 | u8 valuesize = 0; |
| 820 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 821 | |
| 822 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 823 | 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] | 824 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 825 | hif_drv->usr_scan_req.pfUserScanResult = pstrHostIFscanAttr->result; |
| 826 | hif_drv->usr_scan_req.u32UserScanPvoid = pstrHostIFscanAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 827 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 828 | if ((hif_drv->hif_state >= HOST_IF_SCANNING) && |
| 829 | (hif_drv->hif_state < HOST_IF_CONNECTED)) { |
| 830 | PRINT_D(GENERIC_DBG, "Don't scan already in [%d] state\n", |
| 831 | hif_drv->hif_state); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 832 | PRINT_ER("Already scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 833 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 834 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 835 | } |
| 836 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 837 | if (g_obtainingIP || connecting) { |
| 838 | 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] | 839 | PRINT_ER("Don't do obss scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 840 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 841 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 842 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 843 | |
| 844 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 845 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 846 | hif_drv->usr_scan_req.u32RcvdChCount = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 847 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 848 | strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 849 | strWIDList[u32WidsCount].type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 850 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 851 | for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) |
| 852 | valuesize += ((pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 853 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 854 | strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 855 | if (strWIDList[u32WidsCount].val) { |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 856 | pu8Buffer = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 857 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 858 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 859 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 860 | 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] | 861 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 862 | for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) { |
| 863 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 864 | memcpy(pu8Buffer, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen); |
| 865 | pu8Buffer += pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 866 | } |
| 867 | |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 868 | strWIDList[u32WidsCount].size = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 869 | u32WidsCount++; |
| 870 | } |
| 871 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 872 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 873 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_PROBE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 874 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 875 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ies; |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 876 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ies_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 877 | u32WidsCount++; |
| 878 | } |
| 879 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 880 | strWIDList[u32WidsCount].id = WID_SCAN_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 881 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 882 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 883 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 884 | u32WidsCount++; |
| 885 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 886 | strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 887 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 888 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 889 | if (pstrHostIFscanAttr->ch_freq_list && |
| 890 | pstrHostIFscanAttr->ch_list_len > 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 891 | int i; |
| 892 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 893 | for (i = 0; i < pstrHostIFscanAttr->ch_list_len; i++) { |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 894 | if (pstrHostIFscanAttr->ch_freq_list[i] > 0) |
| 895 | pstrHostIFscanAttr->ch_freq_list[i] = pstrHostIFscanAttr->ch_freq_list[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 896 | } |
| 897 | } |
| 898 | |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 899 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ch_freq_list; |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 900 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ch_list_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 901 | u32WidsCount++; |
| 902 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 903 | strWIDList[u32WidsCount].id = WID_START_SCAN_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 904 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 905 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 906 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->src; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 907 | u32WidsCount++; |
| 908 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 909 | if (hif_drv->hif_state == HOST_IF_CONNECTED) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 910 | scan_while_connected = true; |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 911 | else if (hif_drv->hif_state == HOST_IF_IDLE) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 912 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 913 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 914 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 915 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 916 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 917 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 918 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 919 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 920 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 921 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 922 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 923 | if (result) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 924 | del_timer(&hif_drv->hScanTimer); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 925 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 926 | } |
| 927 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 928 | kfree(pstrHostIFscanAttr->ch_freq_list); |
| 929 | pstrHostIFscanAttr->ch_freq_list = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 930 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 931 | kfree(pstrHostIFscanAttr->ies); |
| 932 | pstrHostIFscanAttr->ies = NULL; |
| 933 | kfree(pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo); |
| 934 | pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 935 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 936 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 937 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 938 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 939 | } |
| 940 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 941 | static s32 Handle_ScanDone(struct host_if_drv *hif_drv, |
| 942 | enum scan_event enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 943 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 944 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 945 | u8 u8abort_running_scan; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 946 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 947 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 948 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 949 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 950 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 951 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 952 | u8abort_running_scan = 1; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 953 | wid.id = (u16)WID_ABORT_RUNNING_SCAN; |
| 954 | wid.type = WID_CHAR; |
| 955 | wid.val = (s8 *)&u8abort_running_scan; |
| 956 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 957 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 958 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 959 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 960 | |
| 961 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 962 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 963 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 964 | } |
| 965 | } |
| 966 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 967 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 968 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 969 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 970 | } |
| 971 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 972 | if (hif_drv->usr_scan_req.pfUserScanResult) { |
| 973 | hif_drv->usr_scan_req.pfUserScanResult(enuEvent, NULL, |
| 974 | hif_drv->usr_scan_req.u32UserScanPvoid, NULL); |
| 975 | hif_drv->usr_scan_req.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 976 | } |
| 977 | |
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 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 981 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 982 | static s32 Handle_Connect(struct host_if_drv *hif_drv, |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 983 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 984 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 985 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 986 | struct wid strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 987 | u32 u32WidsCount = 0, dummyval = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 988 | u8 *pu8CurrByte = NULL; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 989 | struct join_bss_param *ptstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 990 | |
| 991 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 992 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 993 | if (memcmp(pstrHostIFconnectAttr->bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 994 | result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 995 | 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] | 996 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 997 | } |
| 998 | |
| 999 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1000 | |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 1001 | ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->params; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1002 | if (!ptstrJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1003 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1004 | result = -ENOENT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1005 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1006 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1007 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1008 | if (pstrHostIFconnectAttr->bssid) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1009 | hif_drv->usr_conn_req.pu8bssid = kmalloc(6, GFP_KERNEL); |
| 1010 | memcpy(hif_drv->usr_conn_req.pu8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1011 | } |
| 1012 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1013 | hif_drv->usr_conn_req.ssidLen = pstrHostIFconnectAttr->ssid_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1014 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1015 | hif_drv->usr_conn_req.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL); |
| 1016 | memcpy(hif_drv->usr_conn_req.pu8ssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1017 | pstrHostIFconnectAttr->ssid, |
| 1018 | pstrHostIFconnectAttr->ssid_len); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1019 | hif_drv->usr_conn_req.pu8ssid[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1020 | } |
| 1021 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1022 | hif_drv->usr_conn_req.ConnReqIEsLen = pstrHostIFconnectAttr->ies_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1023 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1024 | hif_drv->usr_conn_req.pu8ConnReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
| 1025 | memcpy(hif_drv->usr_conn_req.pu8ConnReqIEs, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1026 | pstrHostIFconnectAttr->ies, |
| 1027 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1028 | } |
| 1029 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1030 | hif_drv->usr_conn_req.u8security = pstrHostIFconnectAttr->security; |
| 1031 | hif_drv->usr_conn_req.tenuAuth_type = pstrHostIFconnectAttr->auth_type; |
| 1032 | hif_drv->usr_conn_req.pfUserConnectResult = pstrHostIFconnectAttr->result; |
| 1033 | hif_drv->usr_conn_req.u32UserConnectPvoid = pstrHostIFconnectAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1034 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1035 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1036 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1037 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1038 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1039 | u32WidsCount++; |
| 1040 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1041 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1042 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1043 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1044 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1045 | u32WidsCount++; |
| 1046 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1047 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1048 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1049 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1050 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1051 | u32WidsCount++; |
| 1052 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1053 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1054 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1055 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1056 | strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.pu8ConnReqIEs; |
| 1057 | strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ConnReqIEsLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1058 | u32WidsCount++; |
| 1059 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1060 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1061 | info_element_size = hif_drv->usr_conn_req.ConnReqIEsLen; |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1062 | info_element = kmalloc(info_element_size, GFP_KERNEL); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1063 | memcpy(info_element, hif_drv->usr_conn_req.pu8ConnReqIEs, |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1064 | info_element_size); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1065 | } |
| 1066 | } |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1067 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1068 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1069 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1070 | strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1071 | u32WidsCount++; |
| 1072 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1073 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1074 | mode_11i = hif_drv->usr_conn_req.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1075 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1076 | 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] | 1077 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1078 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1079 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1080 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1081 | strWIDList[u32WidsCount].val = (s8 *)(&hif_drv->usr_conn_req.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1082 | u32WidsCount++; |
| 1083 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1084 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1085 | auth_type = (u8)hif_drv->usr_conn_req.tenuAuth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1086 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1087 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", hif_drv->usr_conn_req.tenuAuth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1088 | 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] | 1089 | hif_drv->usr_conn_req.pu8ssid, pstrHostIFconnectAttr->ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1090 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1091 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1092 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1093 | strWIDList[u32WidsCount].size = 112; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1094 | strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1095 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1096 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1097 | join_req_size = strWIDList[u32WidsCount].size; |
| 1098 | join_req = kmalloc(join_req_size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1099 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1100 | if (!strWIDList[u32WidsCount].val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1101 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1102 | goto ERRORHANDLER; |
| 1103 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1104 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1105 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1106 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1107 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 1108 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len); |
| 1109 | pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1110 | } |
| 1111 | pu8CurrByte += MAX_SSID_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1112 | *(pu8CurrByte++) = INFRASTRUCTURE; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1113 | |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 1114 | if ((pstrHostIFconnectAttr->ch >= 1) && (pstrHostIFconnectAttr->ch <= 14)) { |
| 1115 | *(pu8CurrByte++) = pstrHostIFconnectAttr->ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1116 | } else { |
| 1117 | PRINT_ER("Channel out of range\n"); |
| 1118 | *(pu8CurrByte++) = 0xFF; |
| 1119 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1120 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1121 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1122 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1123 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1124 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1125 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1126 | pu8CurrByte += 6; |
| 1127 | |
Tony Cho | c0f52fb | 2015-10-20 17:10:46 +0900 | [diff] [blame] | 1128 | if (pstrHostIFconnectAttr->bssid) |
| 1129 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
| 1130 | pu8CurrByte += 6; |
| 1131 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1132 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1133 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1134 | 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] | 1135 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1136 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1137 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1138 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1139 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1140 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1141 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1142 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1143 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1144 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1145 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1146 | hif_drv->usr_conn_req.IsHTCapable = ptstrJoinBssParam->ht_capable; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1147 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1148 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1149 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1150 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1151 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1152 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1153 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1154 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1155 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1156 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1157 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1158 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1159 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1160 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1161 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1162 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1163 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1164 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1165 | *(pu8CurrByte++) = ptstrJoinBssParam->noa_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1166 | |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1167 | if (ptstrJoinBssParam->noa_enabled) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1168 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1169 | |
| 1170 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1171 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1172 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1173 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1174 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1175 | *(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 1176 | *(pu8CurrByte++) = ptstrJoinBssParam->idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1177 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1178 | if (ptstrJoinBssParam->opp_enabled) |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 1179 | *(pu8CurrByte++) = ptstrJoinBssParam->ct_window; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1180 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 1181 | *(pu8CurrByte++) = ptstrJoinBssParam->cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1182 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 1183 | memcpy(pu8CurrByte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration)); |
| 1184 | pu8CurrByte += sizeof(ptstrJoinBssParam->duration); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1185 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 1186 | memcpy(pu8CurrByte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval)); |
| 1187 | pu8CurrByte += sizeof(ptstrJoinBssParam->interval); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1188 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 1189 | memcpy(pu8CurrByte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time)); |
| 1190 | pu8CurrByte += sizeof(ptstrJoinBssParam->start_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1191 | } else |
| 1192 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1193 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1194 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1195 | u32WidsCount++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1196 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1197 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1198 | memcpy(join_req, pu8CurrByte, join_req_size); |
Leo Kim | 870515c | 2015-10-15 13:25:15 +0900 | [diff] [blame] | 1199 | join_req_drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1200 | } |
| 1201 | |
| 1202 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1203 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1204 | if (pstrHostIFconnectAttr->bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1205 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1206 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1207 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid); |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1208 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1209 | } |
| 1210 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1211 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1212 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1213 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1214 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1215 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1216 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1217 | } else { |
| 1218 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1219 | hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1220 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1221 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1222 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1223 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1224 | tstrConnectInfo strConnectInfo; |
| 1225 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1226 | del_timer(&hif_drv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1227 | |
| 1228 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 1229 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1230 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1231 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1232 | if (pstrHostIFconnectAttr->result) { |
| 1233 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1234 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1235 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1236 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 1237 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->ies_len; |
| 1238 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1239 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1240 | pstrHostIFconnectAttr->ies, |
| 1241 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1242 | } |
| 1243 | |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 1244 | pstrHostIFconnectAttr->result(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1245 | &strConnectInfo, |
| 1246 | MAC_DISCONNECTED, |
| 1247 | NULL, |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 1248 | pstrHostIFconnectAttr->arg); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1249 | hif_drv->hif_state = HOST_IF_IDLE; |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1250 | kfree(strConnectInfo.pu8ReqIEs); |
| 1251 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1252 | |
| 1253 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1254 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1255 | } |
| 1256 | } |
| 1257 | |
| 1258 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1259 | kfree(pstrHostIFconnectAttr->bssid); |
| 1260 | pstrHostIFconnectAttr->bssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1261 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1262 | kfree(pstrHostIFconnectAttr->ssid); |
| 1263 | pstrHostIFconnectAttr->ssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1264 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1265 | kfree(pstrHostIFconnectAttr->ies); |
| 1266 | pstrHostIFconnectAttr->ies = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1267 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1268 | kfree(pu8CurrByte); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1269 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1270 | } |
| 1271 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1272 | static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1273 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1274 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1275 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1276 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1277 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1278 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1279 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1280 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1281 | strWIDList[u32WidsCount].val = info_element; |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1282 | strWIDList[u32WidsCount].size = info_element_size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1283 | u32WidsCount++; |
| 1284 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1285 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1286 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1287 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 1bd9d44 | 2015-10-15 13:25:11 +0900 | [diff] [blame] | 1288 | strWIDList[u32WidsCount].val = (s8 *)(&(mode_11i)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1289 | u32WidsCount++; |
| 1290 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1291 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1292 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1293 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 1294 | strWIDList[u32WidsCount].val = (s8 *)(&auth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1295 | u32WidsCount++; |
| 1296 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1297 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1298 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1299 | strWIDList[u32WidsCount].size = join_req_size; |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1300 | strWIDList[u32WidsCount].val = (s8 *)join_req; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1301 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1302 | |
| 1303 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 1304 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 1305 | |
| 1306 | u32WidsCount++; |
| 1307 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1308 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1309 | get_id_from_handler(join_req_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1310 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1311 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1312 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1313 | } |
| 1314 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1315 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1316 | } |
| 1317 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1318 | static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1319 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1320 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1321 | tstrConnectInfo strConnectInfo; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1322 | struct wid wid; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1323 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1324 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1325 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1326 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1327 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1328 | } |
| 1329 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1330 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1331 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1332 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1333 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1334 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1335 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1336 | if (hif_drv->usr_conn_req.pfUserConnectResult) { |
| 1337 | if (hif_drv->usr_conn_req.pu8bssid) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1338 | memcpy(strConnectInfo.au8bssid, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1339 | hif_drv->usr_conn_req.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1340 | } |
| 1341 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1342 | if (hif_drv->usr_conn_req.pu8ConnReqIEs) { |
| 1343 | strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen; |
| 1344 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1345 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1346 | hif_drv->usr_conn_req.pu8ConnReqIEs, |
| 1347 | hif_drv->usr_conn_req.ConnReqIEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1348 | } |
| 1349 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1350 | hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 1351 | &strConnectInfo, |
| 1352 | MAC_DISCONNECTED, |
| 1353 | NULL, |
| 1354 | hif_drv->usr_conn_req.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1355 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1356 | kfree(strConnectInfo.pu8ReqIEs); |
| 1357 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1358 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1359 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1360 | } |
| 1361 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1362 | wid.id = (u16)WID_DISCONNECT; |
| 1363 | wid.type = WID_CHAR; |
| 1364 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1365 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1366 | |
| 1367 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1368 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1369 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1370 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1371 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1372 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1373 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1374 | hif_drv->usr_conn_req.ssidLen = 0; |
| 1375 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1376 | kfree(hif_drv->usr_conn_req.pu8bssid); |
| 1377 | hif_drv->usr_conn_req.ConnReqIEsLen = 0; |
| 1378 | kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1379 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1380 | eth_zero_addr(u8ConnectedSSID); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1381 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1382 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1383 | kfree(join_req); |
| 1384 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1385 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1386 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1387 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1388 | kfree(info_element); |
| 1389 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1390 | } |
| 1391 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1392 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1393 | } |
| 1394 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1395 | static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1396 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1397 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1398 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1399 | bool bNewNtwrkFound; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1400 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1401 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 1402 | void *pJoinParams = NULL; |
| 1403 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1404 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1405 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 1406 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1407 | if (hif_drv->usr_scan_req.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1408 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 1409 | parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1410 | if ((!pstrNetworkInfo) || |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1411 | (!hif_drv->usr_scan_req.pfUserScanResult)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1412 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1413 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1414 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1415 | } |
| 1416 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1417 | for (i = 0; i < hif_drv->usr_scan_req.u32RcvdChCount; i++) { |
| 1418 | if ((hif_drv->usr_scan_req.astrFoundNetworkInfo[i].au8bssid) && |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1419 | (pstrNetworkInfo->au8bssid)) { |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1420 | if (memcmp(hif_drv->usr_scan_req.astrFoundNetworkInfo[i].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1421 | pstrNetworkInfo->au8bssid, 6) == 0) { |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1422 | if (pstrNetworkInfo->s8rssi <= hif_drv->usr_scan_req.astrFoundNetworkInfo[i].s8rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1423 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 1424 | goto done; |
| 1425 | } else { |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1426 | hif_drv->usr_scan_req.astrFoundNetworkInfo[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1427 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1428 | break; |
| 1429 | } |
| 1430 | } |
| 1431 | } |
| 1432 | } |
| 1433 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 1434 | if (bNewNtwrkFound) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1435 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 1436 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1437 | if (hif_drv->usr_scan_req.u32RcvdChCount < MAX_NUM_SCANNED_NETWORKS) { |
| 1438 | hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].s8rssi = pstrNetworkInfo->s8rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1439 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1440 | if (hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid && |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1441 | pstrNetworkInfo->au8bssid) { |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1442 | memcpy(hif_drv->usr_scan_req.astrFoundNetworkInfo[hif_drv->usr_scan_req.u32RcvdChCount].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1443 | pstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1444 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1445 | hif_drv->usr_scan_req.u32RcvdChCount++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1446 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1447 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1448 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1449 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1450 | hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 1451 | hif_drv->usr_scan_req.u32UserScanPvoid, |
| 1452 | pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1453 | } |
| 1454 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1455 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1456 | } |
| 1457 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1458 | pstrNetworkInfo->bNewNetwork = false; |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1459 | hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
| 1460 | hif_drv->usr_scan_req.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1461 | } |
| 1462 | } |
| 1463 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1464 | done: |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1465 | kfree(pstrRcvdNetworkInfo->buffer); |
| 1466 | pstrRcvdNetworkInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1467 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1468 | if (pstrNetworkInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1469 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1470 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1471 | } |
| 1472 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1473 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1474 | } |
| 1475 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1476 | static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 1477 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1478 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1479 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1480 | u8 u8MsgType = 0; |
| 1481 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1482 | u16 u16MsgLen = 0; |
| 1483 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1484 | u8 u8WidLen = 0; |
| 1485 | u8 u8MacStatus; |
| 1486 | u8 u8MacStatusReasonCode; |
| 1487 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1488 | tstrConnectInfo strConnectInfo; |
| 1489 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1490 | s32 s32Err = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1491 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1492 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1493 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 1494 | return -ENODEV; |
| 1495 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1496 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", |
| 1497 | hif_drv->hif_state, pstrRcvdGnrlAsyncInfo->buffer[7]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1498 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1499 | if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || |
| 1500 | (hif_drv->hif_state == HOST_IF_CONNECTED) || |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1501 | hif_drv->usr_scan_req.pfUserScanResult) { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1502 | if (!pstrRcvdGnrlAsyncInfo->buffer || |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1503 | !hif_drv->usr_conn_req.pfUserConnectResult) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1504 | PRINT_ER("driver is null\n"); |
| 1505 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1506 | } |
| 1507 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1508 | u8MsgType = pstrRcvdGnrlAsyncInfo->buffer[0]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1509 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1510 | if ('I' != u8MsgType) { |
| 1511 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1512 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1513 | } |
| 1514 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1515 | u8MsgID = pstrRcvdGnrlAsyncInfo->buffer[1]; |
| 1516 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[2], pstrRcvdGnrlAsyncInfo->buffer[3]); |
| 1517 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[4], pstrRcvdGnrlAsyncInfo->buffer[5]); |
| 1518 | u8WidLen = pstrRcvdGnrlAsyncInfo->buffer[6]; |
| 1519 | u8MacStatus = pstrRcvdGnrlAsyncInfo->buffer[7]; |
| 1520 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->buffer[8]; |
| 1521 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1522 | 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] | 1523 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1524 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1525 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 1526 | |
| 1527 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 1528 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1529 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1530 | |
| 1531 | if (u8MacStatus == MAC_CONNECTED) { |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1532 | memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1533 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1534 | host_int_get_assoc_res_info(hif_drv, |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1535 | rcv_assoc_resp, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1536 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 1537 | &u32RcvdAssocRespInfoLen); |
| 1538 | |
| 1539 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 1540 | |
| 1541 | if (u32RcvdAssocRespInfoLen != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1542 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1543 | s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1544 | &pstrConnectRespInfo); |
| 1545 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1546 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1547 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1548 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 1549 | |
| 1550 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 1551 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1552 | if (pstrConnectRespInfo->pu8RespIEs) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1553 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1554 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1555 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1556 | pstrConnectRespInfo->u16RespIEsLen); |
| 1557 | } |
| 1558 | } |
| 1559 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1560 | if (pstrConnectRespInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1561 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 1562 | pstrConnectRespInfo = NULL; |
| 1563 | } |
| 1564 | } |
| 1565 | } |
| 1566 | } |
| 1567 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1568 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1569 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1570 | 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] | 1571 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1572 | |
| 1573 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 1574 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1575 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1576 | } |
| 1577 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1578 | if (hif_drv->usr_conn_req.pu8bssid) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1579 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1580 | memcpy(strConnectInfo.au8bssid, hif_drv->usr_conn_req.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1581 | |
| 1582 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1583 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame^] | 1584 | memcpy(hif_drv->assoc_bssid, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1585 | hif_drv->usr_conn_req.pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1586 | } |
| 1587 | } |
| 1588 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1589 | if (hif_drv->usr_conn_req.pu8ConnReqIEs) { |
| 1590 | strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ConnReqIEsLen; |
| 1591 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ConnReqIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1592 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1593 | hif_drv->usr_conn_req.pu8ConnReqIEs, |
| 1594 | hif_drv->usr_conn_req.ConnReqIEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1595 | } |
| 1596 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1597 | del_timer(&hif_drv->hConnectTimer); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1598 | hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_CONN_RESP, |
| 1599 | &strConnectInfo, |
| 1600 | u8MacStatus, |
| 1601 | NULL, |
| 1602 | hif_drv->usr_conn_req.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1603 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1604 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1605 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1606 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1607 | |
| 1608 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1609 | hif_drv->hif_state = HOST_IF_CONNECTED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1610 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1611 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1612 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 1613 | mod_timer(&hDuringIpTimer, |
| 1614 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1615 | } else { |
| 1616 | 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] | 1617 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1618 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1619 | } |
| 1620 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1621 | kfree(strConnectInfo.pu8RespIEs); |
| 1622 | strConnectInfo.pu8RespIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1623 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1624 | kfree(strConnectInfo.pu8ReqIEs); |
| 1625 | strConnectInfo.pu8ReqIEs = NULL; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1626 | hif_drv->usr_conn_req.ssidLen = 0; |
| 1627 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1628 | kfree(hif_drv->usr_conn_req.pu8bssid); |
| 1629 | hif_drv->usr_conn_req.ConnReqIEsLen = 0; |
| 1630 | kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1631 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1632 | (hif_drv->hif_state == HOST_IF_CONNECTED)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1633 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 1634 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1635 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1636 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1637 | if (hif_drv->usr_scan_req.pfUserScanResult) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1638 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1639 | del_timer(&hif_drv->hScanTimer); |
| 1640 | Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1641 | } |
| 1642 | |
| 1643 | strDisconnectNotifInfo.u16reason = 0; |
| 1644 | strDisconnectNotifInfo.ie = NULL; |
| 1645 | strDisconnectNotifInfo.ie_len = 0; |
| 1646 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1647 | if (hif_drv->usr_conn_req.pfUserConnectResult) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1648 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1649 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1650 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1651 | hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 1652 | NULL, |
| 1653 | 0, |
| 1654 | &strDisconnectNotifInfo, |
| 1655 | hif_drv->usr_conn_req.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1656 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1657 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1658 | } |
| 1659 | |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame^] | 1660 | eth_zero_addr(hif_drv->assoc_bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1661 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1662 | hif_drv->usr_conn_req.ssidLen = 0; |
| 1663 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1664 | kfree(hif_drv->usr_conn_req.pu8bssid); |
| 1665 | hif_drv->usr_conn_req.ConnReqIEsLen = 0; |
| 1666 | kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1667 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1668 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1669 | kfree(join_req); |
| 1670 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1671 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1672 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1673 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1674 | kfree(info_element); |
| 1675 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1676 | } |
| 1677 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1678 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1679 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1680 | |
| 1681 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1682 | (hif_drv->usr_scan_req.pfUserScanResult)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1683 | 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] | 1684 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1685 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1686 | del_timer(&hif_drv->hScanTimer); |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 1687 | if (hif_drv->usr_scan_req.pfUserScanResult) |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1688 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1689 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1690 | } |
| 1691 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1692 | kfree(pstrRcvdGnrlAsyncInfo->buffer); |
| 1693 | pstrRcvdGnrlAsyncInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1694 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1695 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1696 | } |
| 1697 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1698 | static int Handle_Key(struct host_if_drv *hif_drv, |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 1699 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1700 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1701 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1702 | struct wid wid; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1703 | struct wid strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1704 | u8 i; |
| 1705 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1706 | s8 s8idxarray[1]; |
| 1707 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1708 | |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 1709 | switch (pstrHostIFkeyAttr->type) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1710 | case WEP: |
| 1711 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1712 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1713 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1714 | 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] | 1715 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1716 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1717 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1718 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1719 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1720 | strWIDList[1].id = WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1721 | strWIDList[1].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1722 | strWIDList[1].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1723 | strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1724 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1725 | strWIDList[2].id = (u16)WID_KEY_ID; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1726 | strWIDList[2].type = WID_CHAR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1727 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1728 | strWIDList[2].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1729 | strWIDList[2].size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1730 | |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 1731 | pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key, |
| 1732 | pstrHostIFkeyAttr->attr.wep.key_len, |
| 1733 | GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1734 | |
| 1735 | if (pu8keybuf == NULL) { |
| 1736 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1737 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1738 | } |
| 1739 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1740 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1741 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1742 | strWIDList[3].id = (u16)WID_WEP_KEY_VALUE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1743 | strWIDList[3].type = WID_STR; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1744 | strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1745 | strWIDList[3].val = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1746 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1747 | result = send_config_pkt(SET_CFG, strWIDList, 4, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1748 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1749 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1750 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1751 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1752 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1753 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1754 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1755 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1756 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1757 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1758 | } |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1759 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index; |
| 1760 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1); |
| 1761 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->attr.wep.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1762 | pstrHostIFkeyAttr->attr.wep.key_len); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1763 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1764 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1765 | wid.id = (u16)WID_ADD_WEP_KEY; |
| 1766 | wid.type = WID_STR; |
| 1767 | wid.val = (s8 *)pu8keybuf; |
| 1768 | wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1769 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1770 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1771 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1772 | kfree(pu8keybuf); |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1773 | } else if (pstrHostIFkeyAttr->action & REMOVEKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1774 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1775 | wid.id = (u16)WID_REMOVE_WEP_KEY; |
| 1776 | wid.type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1777 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1778 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1779 | wid.val = s8idxarray; |
| 1780 | wid.size = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1781 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1782 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1783 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1784 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1785 | wid.id = (u16)WID_KEY_ID; |
| 1786 | wid.type = WID_CHAR; |
| 1787 | wid.val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
| 1788 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1789 | |
| 1790 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 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 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1795 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1796 | break; |
| 1797 | |
| 1798 | case WPARxGtk: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1799 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1800 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1801 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1802 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1803 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1804 | goto _WPARxGtk_end_case_; |
| 1805 | } |
| 1806 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1807 | if (pstrHostIFkeyAttr->attr.wpa.seq) |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1808 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1809 | |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1810 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1811 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1812 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1813 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1814 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1815 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1816 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1817 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1818 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1819 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1820 | strWIDList[1].id = (u16)WID_ADD_RX_GTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1821 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1822 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1823 | strWIDList[1].size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1824 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1825 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1826 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1827 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1828 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1829 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1830 | } |
| 1831 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1832 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1833 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 1834 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1835 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1836 | if (pu8keybuf == NULL) { |
| 1837 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1838 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1839 | goto _WPARxGtk_end_case_; |
| 1840 | } |
| 1841 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1842 | if (hif_drv->hif_state == HOST_IF_CONNECTED) |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame^] | 1843 | memcpy(pu8keybuf, hif_drv->assoc_bssid, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1844 | else |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1845 | 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] | 1846 | |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1847 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1848 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1849 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1850 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1851 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1852 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1853 | wid.id = (u16)WID_ADD_RX_GTK; |
| 1854 | wid.type = WID_STR; |
| 1855 | wid.val = (s8 *)pu8keybuf; |
| 1856 | wid.size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1857 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1858 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1859 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1860 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1861 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1862 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1863 | } |
| 1864 | _WPARxGtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1865 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1866 | kfree(pstrHostIFkeyAttr->attr.wpa.seq); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1867 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1868 | return ret; |
| 1869 | |
| 1870 | break; |
| 1871 | |
| 1872 | case WPAPtk: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1873 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1874 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1875 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1876 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1877 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1878 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1879 | } |
| 1880 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1881 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1882 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1883 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1884 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1885 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1886 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1887 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1888 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1889 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1890 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1891 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1892 | strWIDList[1].id = (u16)WID_ADD_PTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1893 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1894 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1895 | strWIDList[1].size = PTK_KEY_MSG_LEN + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1896 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1897 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1898 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1899 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1900 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1901 | } |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1902 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1903 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1904 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1905 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1906 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1907 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1908 | } |
| 1909 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1910 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1911 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1912 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1913 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1914 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1915 | wid.id = (u16)WID_ADD_PTK; |
| 1916 | wid.type = WID_STR; |
| 1917 | wid.val = (s8 *)pu8keybuf; |
| 1918 | wid.size = PTK_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1919 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1920 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1921 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1922 | kfree(pu8keybuf); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1923 | up(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1924 | } |
| 1925 | |
| 1926 | _WPAPtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1927 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1928 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1929 | return ret; |
| 1930 | |
| 1931 | break; |
| 1932 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1933 | case PMKSA: |
| 1934 | |
| 1935 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 1936 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1937 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1938 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1939 | PRINT_ER("No buffer to send PMKSA Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1940 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1941 | } |
| 1942 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1943 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1944 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1945 | for (i = 0; i < pstrHostIFkeyAttr->attr.pmkid.numpmkid; i++) { |
| 1946 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN); |
| 1947 | 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] | 1948 | } |
| 1949 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1950 | wid.id = (u16)WID_PMKID_INFO; |
| 1951 | wid.type = WID_STR; |
| 1952 | wid.val = (s8 *)pu8keybuf; |
| 1953 | wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1954 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1955 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1956 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1957 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1958 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1959 | break; |
| 1960 | } |
| 1961 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1962 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1963 | PRINT_ER("Failed to send key config packet\n"); |
| 1964 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1965 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1966 | } |
| 1967 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1968 | static void Handle_Disconnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1969 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1970 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1971 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1972 | s32 result = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1973 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1974 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1975 | wid.id = (u16)WID_DISCONNECT; |
| 1976 | wid.type = WID_CHAR; |
| 1977 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1978 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1979 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1980 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1981 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1982 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1983 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1984 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1985 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1986 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1987 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1988 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1989 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1990 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1991 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1992 | } else { |
| 1993 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 1994 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1995 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1996 | |
| 1997 | strDisconnectNotifInfo.u16reason = 0; |
| 1998 | strDisconnectNotifInfo.ie = NULL; |
| 1999 | strDisconnectNotifInfo.ie_len = 0; |
| 2000 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 2001 | if (hif_drv->usr_scan_req.pfUserScanResult) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2002 | del_timer(&hif_drv->hScanTimer); |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 2003 | hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
| 2004 | hif_drv->usr_scan_req.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2005 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 2006 | hif_drv->usr_scan_req.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2007 | } |
| 2008 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 2009 | if (hif_drv->usr_conn_req.pfUserConnectResult) { |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2010 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2011 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2012 | del_timer(&hif_drv->hConnectTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2013 | } |
| 2014 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 2015 | hif_drv->usr_conn_req.pfUserConnectResult(CONN_DISCONN_EVENT_DISCONN_NOTIF, NULL, |
| 2016 | 0, &strDisconnectNotifInfo, hif_drv->usr_conn_req.u32UserConnectPvoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2017 | } else { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 2018 | PRINT_ER("usr_conn_req.pfUserConnectResult = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2019 | } |
| 2020 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 2021 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2022 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2023 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2024 | |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame^] | 2025 | eth_zero_addr(hif_drv->assoc_bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2026 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 2027 | hif_drv->usr_conn_req.ssidLen = 0; |
| 2028 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 2029 | kfree(hif_drv->usr_conn_req.pu8bssid); |
| 2030 | hif_drv->usr_conn_req.ConnReqIEsLen = 0; |
| 2031 | kfree(hif_drv->usr_conn_req.pu8ConnReqIEs); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2032 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2033 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 2034 | kfree(join_req); |
| 2035 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2036 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2037 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2038 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2039 | kfree(info_element); |
| 2040 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2041 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2042 | } |
| 2043 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2044 | up(&hif_drv->hSemTestDisconnectBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2045 | } |
| 2046 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2047 | void resolve_disconnect_aberration(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2048 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2049 | if (!hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2050 | return; |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2051 | if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || |
| 2052 | (hif_drv->hif_state == HOST_IF_CONNECTING)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2053 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2054 | host_int_disconnect(hif_drv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2055 | } |
| 2056 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2057 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2058 | static s32 Handle_GetChnl(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2059 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2060 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2061 | struct wid wid; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2062 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2063 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 2064 | wid.type = WID_CHAR; |
| 2065 | wid.val = (s8 *)&ch_no; |
| 2066 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2067 | |
| 2068 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 2069 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2070 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2071 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2072 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2073 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2074 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2075 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2076 | } |
| 2077 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2078 | up(&hif_drv->hSemGetCHNL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2079 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2080 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2081 | } |
| 2082 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2083 | static void Handle_GetRssi(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2084 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2085 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2086 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2087 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2088 | wid.id = (u16)WID_RSSI; |
| 2089 | wid.type = WID_CHAR; |
| 2090 | wid.val = &rssi; |
| 2091 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2092 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2093 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 2094 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2095 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2096 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2097 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2098 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2099 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2100 | } |
| 2101 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2102 | up(&hif_drv->hSemGetRSSI); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2103 | } |
| 2104 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2105 | static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2106 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2107 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2108 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2109 | |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 2110 | link_speed = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2111 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2112 | wid.id = (u16)WID_LINKSPEED; |
| 2113 | wid.type = WID_CHAR; |
| 2114 | wid.val = &link_speed; |
| 2115 | wid.size = sizeof(char); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2116 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2117 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 2118 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2119 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2120 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2121 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2122 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2123 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2124 | } |
| 2125 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2126 | up(&hif_drv->hSemGetLINKSPEED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2127 | } |
| 2128 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2129 | 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] | 2130 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2131 | struct wid strWIDList[5]; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2132 | u32 u32WidsCount = 0, result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2133 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2134 | strWIDList[u32WidsCount].id = WID_LINKSPEED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2135 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2136 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2137 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u8LinkSpeed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2138 | u32WidsCount++; |
| 2139 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2140 | strWIDList[u32WidsCount].id = WID_RSSI; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2141 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2142 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2143 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->s8RSSI; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2144 | u32WidsCount++; |
| 2145 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2146 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2147 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2148 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2149 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxCount; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2150 | u32WidsCount++; |
| 2151 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2152 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2153 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2154 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2155 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32RxCount; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2156 | u32WidsCount++; |
| 2157 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2158 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2159 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2160 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2161 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->u32TxFailureCount; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2162 | u32WidsCount++; |
| 2163 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2164 | result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2165 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2166 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2167 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2168 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2169 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2170 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2171 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2172 | } |
| 2173 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2174 | static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 2175 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2176 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2177 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2178 | u8 *stamac; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2179 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2180 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2181 | wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
| 2182 | wid.type = WID_STR; |
| 2183 | wid.size = ETH_ALEN; |
| 2184 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2185 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2186 | stamac = wid.val; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2187 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2188 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2189 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 2190 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2191 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2192 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2193 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2194 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2195 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2196 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2197 | } |
| 2198 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2199 | wid.id = (u16)WID_GET_INACTIVE_TIME; |
| 2200 | wid.type = WID_INT; |
| 2201 | wid.val = (s8 *)&inactive_time; |
| 2202 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2203 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2204 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2205 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2206 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2207 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2208 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2209 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2210 | } |
| 2211 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 2212 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2213 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2214 | up(&hif_drv->hSemInactiveTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2215 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2216 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2217 | } |
| 2218 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2219 | static void Handle_AddBeacon(struct host_if_drv *hif_drv, |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 2220 | struct beacon_attr *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2221 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2222 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2223 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2224 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2225 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2226 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 2227 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2228 | wid.id = (u16)WID_ADD_BEACON; |
| 2229 | wid.type = WID_BIN; |
| 2230 | wid.size = pstrSetBeaconParam->head_len + pstrSetBeaconParam->tail_len + 16; |
| 2231 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2232 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2233 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2234 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2235 | pu8CurrByte = wid.val; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 2236 | *pu8CurrByte++ = (pstrSetBeaconParam->interval & 0xFF); |
| 2237 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 8) & 0xFF); |
| 2238 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 16) & 0xFF); |
| 2239 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2240 | |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 2241 | *pu8CurrByte++ = (pstrSetBeaconParam->dtim_period & 0xFF); |
| 2242 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 8) & 0xFF); |
| 2243 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 16) & 0xFF); |
| 2244 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2245 | |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2246 | *pu8CurrByte++ = (pstrSetBeaconParam->head_len & 0xFF); |
| 2247 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 8) & 0xFF); |
| 2248 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 16) & 0xFF); |
| 2249 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2250 | |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2251 | memcpy(pu8CurrByte, pstrSetBeaconParam->head, pstrSetBeaconParam->head_len); |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2252 | pu8CurrByte += pstrSetBeaconParam->head_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2253 | |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2254 | *pu8CurrByte++ = (pstrSetBeaconParam->tail_len & 0xFF); |
| 2255 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 8) & 0xFF); |
| 2256 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); |
| 2257 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2258 | |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2259 | if (pstrSetBeaconParam->tail > 0) |
| 2260 | memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2261 | pu8CurrByte += pstrSetBeaconParam->tail_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2262 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2263 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2264 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2265 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2266 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2267 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2268 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2269 | kfree(wid.val); |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2270 | kfree(pstrSetBeaconParam->head); |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2271 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2272 | } |
| 2273 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2274 | static void Handle_DelBeacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2275 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2276 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2277 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2278 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2279 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2280 | wid.id = (u16)WID_DEL_BEACON; |
| 2281 | wid.type = WID_CHAR; |
| 2282 | wid.size = sizeof(char); |
| 2283 | wid.val = &del_beacon; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2284 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2285 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2286 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2287 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2288 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2289 | |
| 2290 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2291 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2292 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2293 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2294 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2295 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2296 | } |
| 2297 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2298 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 2299 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2300 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2301 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2302 | |
| 2303 | pu8CurrByte = pu8Buffer; |
| 2304 | |
| 2305 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2306 | memcpy(pu8CurrByte, pstrStationParam->au8BSSID, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2307 | pu8CurrByte += ETH_ALEN; |
| 2308 | |
| 2309 | *pu8CurrByte++ = pstrStationParam->u16AssocID & 0xFF; |
| 2310 | *pu8CurrByte++ = (pstrStationParam->u16AssocID >> 8) & 0xFF; |
| 2311 | |
| 2312 | *pu8CurrByte++ = pstrStationParam->u8NumRates; |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2313 | if (pstrStationParam->u8NumRates > 0) |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2314 | memcpy(pu8CurrByte, pstrStationParam->pu8Rates, pstrStationParam->u8NumRates); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2315 | pu8CurrByte += pstrStationParam->u8NumRates; |
| 2316 | |
| 2317 | *pu8CurrByte++ = pstrStationParam->bIsHTSupported; |
| 2318 | *pu8CurrByte++ = pstrStationParam->u16HTCapInfo & 0xFF; |
| 2319 | *pu8CurrByte++ = (pstrStationParam->u16HTCapInfo >> 8) & 0xFF; |
| 2320 | |
| 2321 | *pu8CurrByte++ = pstrStationParam->u8AmpduParams; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2322 | memcpy(pu8CurrByte, pstrStationParam->au8SuppMCsSet, WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2323 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 2324 | |
| 2325 | *pu8CurrByte++ = pstrStationParam->u16HTExtParams & 0xFF; |
| 2326 | *pu8CurrByte++ = (pstrStationParam->u16HTExtParams >> 8) & 0xFF; |
| 2327 | |
| 2328 | *pu8CurrByte++ = pstrStationParam->u32TxBeamformingCap & 0xFF; |
| 2329 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 8) & 0xFF; |
| 2330 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 16) & 0xFF; |
| 2331 | *pu8CurrByte++ = (pstrStationParam->u32TxBeamformingCap >> 24) & 0xFF; |
| 2332 | |
| 2333 | *pu8CurrByte++ = pstrStationParam->u8ASELCap; |
| 2334 | |
| 2335 | *pu8CurrByte++ = pstrStationParam->u16FlagsMask & 0xFF; |
| 2336 | *pu8CurrByte++ = (pstrStationParam->u16FlagsMask >> 8) & 0xFF; |
| 2337 | |
| 2338 | *pu8CurrByte++ = pstrStationParam->u16FlagsSet & 0xFF; |
| 2339 | *pu8CurrByte++ = (pstrStationParam->u16FlagsSet >> 8) & 0xFF; |
| 2340 | |
| 2341 | return pu8CurrByte - pu8Buffer; |
| 2342 | } |
| 2343 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2344 | static void Handle_AddStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2345 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2346 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2347 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2348 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2349 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2350 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2351 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2352 | wid.id = (u16)WID_ADD_STA; |
| 2353 | wid.type = WID_BIN; |
| 2354 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2355 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2356 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2357 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2358 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2359 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2360 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2361 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2362 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2363 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2364 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2365 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2366 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2367 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2368 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 2369 | kfree(pstrStationParam->pu8Rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2370 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2371 | } |
| 2372 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2373 | static void Handle_DelAllSta(struct host_if_drv *hif_drv, |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 2374 | struct del_all_sta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2375 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2376 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2377 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2378 | u8 *pu8CurrByte; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2379 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 2380 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2381 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2382 | wid.id = (u16)WID_DEL_ALL_STA; |
| 2383 | wid.type = WID_STR; |
| 2384 | wid.size = (pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2385 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2386 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2387 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2388 | wid.val = kmalloc((pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL); |
| 2389 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2390 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2391 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2392 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2393 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 2394 | *(pu8CurrByte++) = pstrDelAllStaParam->assoc_sta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2395 | |
| 2396 | for (i = 0; i < MAX_NUM_STA; i++) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 2397 | if (memcmp(pstrDelAllStaParam->del_all_sta[i], au8Zero_Buff, ETH_ALEN)) |
| 2398 | memcpy(pu8CurrByte, pstrDelAllStaParam->del_all_sta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2399 | else |
| 2400 | continue; |
| 2401 | |
| 2402 | pu8CurrByte += ETH_ALEN; |
| 2403 | } |
| 2404 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2405 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2406 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2407 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2408 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2409 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2410 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2411 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2412 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2413 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2414 | } |
| 2415 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2416 | static void Handle_DelStation(struct host_if_drv *hif_drv, |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 2417 | struct del_sta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2418 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2419 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2420 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2421 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2422 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2423 | wid.id = (u16)WID_REMOVE_STA; |
| 2424 | wid.type = WID_BIN; |
| 2425 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2426 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2427 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2428 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2429 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2430 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2431 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2432 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2433 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2434 | |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 2435 | memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2436 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2437 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2438 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2439 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2440 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2441 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2442 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2443 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2444 | } |
| 2445 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2446 | static void Handle_EditStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2447 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2448 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2449 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2450 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2451 | u8 *pu8CurrByte; |
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 | wid.id = (u16)WID_EDIT_STA; |
| 2454 | wid.type = WID_BIN; |
| 2455 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->u8NumRates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2456 | |
| 2457 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2458 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2459 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2460 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2461 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2462 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2463 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2464 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2465 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2466 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2467 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2468 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2469 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2470 | ERRORHANDLER: |
Greg Kroah-Hartman | 969effe | 2015-08-14 19:15:34 -0700 | [diff] [blame] | 2471 | kfree(pstrStationParam->pu8Rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2472 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2473 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2474 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2475 | static int Handle_RemainOnChan(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2476 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2477 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2478 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2479 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2480 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2481 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2482 | if (!hif_drv->remain_on_ch_pending) { |
Leo Kim | d61f8e1 | 2015-10-28 15:59:35 +0900 | [diff] [blame] | 2483 | hif_drv->remain_on_ch.pVoid = pstrHostIfRemainOnChan->pVoid; |
| 2484 | hif_drv->remain_on_ch.pRemainOnChanExpired = pstrHostIfRemainOnChan->pRemainOnChanExpired; |
| 2485 | hif_drv->remain_on_ch.pRemainOnChanReady = pstrHostIfRemainOnChan->pRemainOnChanReady; |
| 2486 | hif_drv->remain_on_ch.u16Channel = pstrHostIfRemainOnChan->u16Channel; |
| 2487 | hif_drv->remain_on_ch.u32ListenSessionID = pstrHostIfRemainOnChan->u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2488 | } else { |
Leo Kim | d61f8e1 | 2015-10-28 15:59:35 +0900 | [diff] [blame] | 2489 | pstrHostIfRemainOnChan->u16Channel = hif_drv->remain_on_ch.u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2490 | } |
| 2491 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 2492 | if (hif_drv->usr_scan_req.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2493 | 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] | 2494 | hif_drv->remain_on_ch_pending = 1; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2495 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2496 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2497 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2498 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2499 | 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] | 2500 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2501 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2502 | } |
| 2503 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2504 | if (g_obtainingIP || connecting) { |
| 2505 | 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] | 2506 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2507 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2508 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2509 | |
| 2510 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", pstrHostIfRemainOnChan->u16Channel); |
| 2511 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2512 | u8remain_on_chan_flag = true; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2513 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2514 | wid.type = WID_STR; |
| 2515 | wid.size = 2; |
| 2516 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2517 | if (!wid.val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2518 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2519 | goto ERRORHANDLER; |
| 2520 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2521 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2522 | wid.val[0] = u8remain_on_chan_flag; |
| 2523 | wid.val[1] = (s8)pstrHostIfRemainOnChan->u16Channel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2524 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2525 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2526 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2527 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2528 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2529 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2530 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2531 | { |
| 2532 | P2P_LISTEN_STATE = 1; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2533 | hif_drv->hRemainOnChannel.data = (unsigned long)hif_drv; |
| 2534 | mod_timer(&hif_drv->hRemainOnChannel, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2535 | jiffies + |
| 2536 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2537 | |
Leo Kim | d61f8e1 | 2015-10-28 15:59:35 +0900 | [diff] [blame] | 2538 | if (hif_drv->remain_on_ch.pRemainOnChanReady) |
| 2539 | hif_drv->remain_on_ch.pRemainOnChanReady(hif_drv->remain_on_ch.pVoid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2540 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2541 | if (hif_drv->remain_on_ch_pending) |
| 2542 | hif_drv->remain_on_ch_pending = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2543 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2544 | |
| 2545 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2546 | } |
| 2547 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2548 | static int Handle_RegisterFrame(struct host_if_drv *hif_drv, |
Tony Cho | bc37c5d | 2015-09-21 12:16:59 +0900 | [diff] [blame] | 2549 | struct reg_frame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2550 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2551 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2552 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2553 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2554 | |
| 2555 | PRINT_D(HOSTINF_DBG, "Handling frame register Flag : %d FrameType: %d\n", pstrHostIfRegisterFrame->bReg, pstrHostIfRegisterFrame->u16FrameType); |
| 2556 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2557 | wid.id = (u16)WID_REGISTER_FRAME; |
| 2558 | wid.type = WID_STR; |
| 2559 | wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
| 2560 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2561 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2562 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2563 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2564 | |
| 2565 | *pu8CurrByte++ = pstrHostIfRegisterFrame->bReg; |
| 2566 | *pu8CurrByte++ = pstrHostIfRegisterFrame->u8Regid; |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 2567 | memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->u16FrameType, |
| 2568 | sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2569 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2570 | wid.size = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2571 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2572 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2573 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2574 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2575 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2576 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2577 | } |
| 2578 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2579 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2580 | } |
| 2581 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2582 | static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2583 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2584 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2585 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2586 | struct wid wid; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2587 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2588 | |
| 2589 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 2590 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2591 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2592 | u8remain_on_chan_flag = false; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2593 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2594 | wid.type = WID_STR; |
| 2595 | wid.size = 2; |
| 2596 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2597 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2598 | if (!wid.val) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2599 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2600 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2601 | wid.val[0] = u8remain_on_chan_flag; |
| 2602 | wid.val[1] = FALSE_FRMWR_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2603 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2604 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2605 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2606 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2607 | PRINT_ER("Failed to set remain on channel\n"); |
| 2608 | goto _done_; |
| 2609 | } |
| 2610 | |
Leo Kim | d61f8e1 | 2015-10-28 15:59:35 +0900 | [diff] [blame] | 2611 | if (hif_drv->remain_on_ch.pRemainOnChanExpired) { |
| 2612 | hif_drv->remain_on_ch.pRemainOnChanExpired(hif_drv->remain_on_ch.pVoid, |
| 2613 | pstrHostIfRemainOnChan->u32ListenSessionID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2614 | } |
| 2615 | P2P_LISTEN_STATE = 0; |
| 2616 | } else { |
| 2617 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2618 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2619 | } |
| 2620 | |
| 2621 | _done_: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2622 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2623 | } |
| 2624 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 2625 | static void ListenTimerCB(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2626 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2627 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2628 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2629 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2630 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2631 | del_timer(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2632 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2633 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2634 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2635 | msg.drv = hif_drv; |
Leo Kim | d61f8e1 | 2015-10-28 15:59:35 +0900 | [diff] [blame] | 2636 | msg.body.remain_on_ch.u32ListenSessionID = hif_drv->remain_on_ch.u32ListenSessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2637 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2638 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 2639 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2640 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2641 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2642 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2643 | static void Handle_PowerManagement(struct host_if_drv *hif_drv, |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 2644 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2645 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2646 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2647 | struct wid wid; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2648 | s8 s8PowerMode; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2649 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2650 | wid.id = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2651 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 2652 | if (strPowerMgmtParam->enabled) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2653 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2654 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2655 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2656 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2657 | wid.val = &s8PowerMode; |
| 2658 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2659 | |
| 2660 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 2661 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2662 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2663 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2664 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2665 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2666 | } |
| 2667 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2668 | static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 2669 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2670 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2671 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2672 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2673 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2674 | |
| 2675 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 2676 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2677 | wid.id = (u16)WID_SETUP_MULTICAST_FILTER; |
| 2678 | wid.type = WID_BIN; |
| 2679 | wid.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->cnt) * ETH_ALEN); |
| 2680 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2681 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2682 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2683 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2684 | pu8CurrByte = wid.val; |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 2685 | *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); |
| 2686 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); |
| 2687 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); |
| 2688 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2689 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2690 | *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); |
| 2691 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); |
| 2692 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 16) & 0xFF); |
| 2693 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2694 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2695 | if ((strHostIfSetMulti->cnt) > 0) |
| 2696 | memcpy(pu8CurrByte, gau8MulticastMacAddrList, ((strHostIfSetMulti->cnt) * ETH_ALEN)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2697 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2698 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2699 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2700 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2701 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2702 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2703 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2704 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2705 | } |
| 2706 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2707 | static s32 Handle_AddBASession(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2708 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2709 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2710 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2711 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2712 | int AddbaTimeout = 100; |
| 2713 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2714 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2715 | PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2716 | strHostIfBASessionInfo->au8Bssid[0], |
| 2717 | strHostIfBASessionInfo->au8Bssid[1], |
| 2718 | strHostIfBASessionInfo->au8Bssid[2], |
| 2719 | strHostIfBASessionInfo->u16BufferSize, |
| 2720 | strHostIfBASessionInfo->u16SessionTimeout, |
| 2721 | strHostIfBASessionInfo->u8Ted); |
| 2722 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2723 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2724 | wid.type = WID_STR; |
| 2725 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2726 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2727 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2728 | *ptr++ = 0x14; |
| 2729 | *ptr++ = 0x3; |
| 2730 | *ptr++ = 0x0; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2731 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2732 | ptr += ETH_ALEN; |
| 2733 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2734 | *ptr++ = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2735 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 2736 | *ptr++ = ((strHostIfBASessionInfo->u16BufferSize >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2737 | *ptr++ = (strHostIfBASessionInfo->u16SessionTimeout & 0xFF); |
| 2738 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2739 | *ptr++ = (AddbaTimeout & 0xFF); |
| 2740 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2741 | *ptr++ = 8; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2742 | *ptr++ = 0; |
| 2743 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2744 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2745 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2746 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2747 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 2748 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2749 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2750 | wid.type = WID_STR; |
| 2751 | wid.size = 15; |
| 2752 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2753 | *ptr++ = 15; |
| 2754 | *ptr++ = 7; |
| 2755 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2756 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2757 | ptr += ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2758 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2759 | *ptr++ = 8; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2760 | *ptr++ = (strHostIfBASessionInfo->u16BufferSize & 0xFF); |
| 2761 | *ptr++ = ((strHostIfBASessionInfo->u16SessionTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2762 | *ptr++ = 3; |
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)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2765 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2766 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2767 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2768 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2769 | } |
| 2770 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2771 | static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2772 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2773 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2774 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2775 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2776 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2777 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2778 | PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2779 | strHostIfBASessionInfo->au8Bssid[0], |
| 2780 | strHostIfBASessionInfo->au8Bssid[1], |
| 2781 | strHostIfBASessionInfo->au8Bssid[2], |
| 2782 | strHostIfBASessionInfo->u8Ted); |
| 2783 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2784 | wid.id = (u16)WID_DEL_ALL_RX_BA; |
| 2785 | wid.type = WID_STR; |
| 2786 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2787 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2788 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2789 | *ptr++ = 0x14; |
| 2790 | *ptr++ = 0x3; |
| 2791 | *ptr++ = 0x2; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2792 | memcpy(ptr, strHostIfBASessionInfo->au8Bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2793 | ptr += ETH_ALEN; |
| 2794 | *ptr++ = strHostIfBASessionInfo->u8Ted; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2795 | *ptr++ = 0; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2796 | *ptr++ = 32; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2797 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2798 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2799 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2800 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2801 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 2802 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2803 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2804 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2805 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2806 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2807 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2808 | } |
| 2809 | |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 2810 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2811 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2812 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2813 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2814 | struct host_if_drv *hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2815 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2816 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2817 | |
| 2818 | while (1) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2819 | 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] | 2820 | hif_drv = (struct host_if_drv *)msg.drv; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2821 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2822 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 2823 | break; |
| 2824 | } |
| 2825 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2826 | if ((!g_wilc_initialized)) { |
| 2827 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 2828 | usleep_range(200 * 1000, 200 * 1000); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2829 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2830 | continue; |
| 2831 | } |
| 2832 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2833 | if (msg.id == HOST_IF_MSG_CONNECT && |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 2834 | hif_drv->usr_scan_req.pfUserScanResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2835 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2836 | 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] | 2837 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2838 | continue; |
| 2839 | } |
| 2840 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2841 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2842 | case HOST_IF_MSG_Q_IDLE: |
| 2843 | Handle_wait_msg_q_empty(); |
| 2844 | break; |
| 2845 | |
| 2846 | case HOST_IF_MSG_SCAN: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2847 | Handle_Scan(msg.drv, &msg.body.scan_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2848 | break; |
| 2849 | |
| 2850 | case HOST_IF_MSG_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2851 | Handle_Connect(msg.drv, &msg.body.con_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2852 | break; |
| 2853 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2854 | case HOST_IF_MSG_FLUSH_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2855 | Handle_FlushConnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2856 | break; |
| 2857 | |
| 2858 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2859 | Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2860 | break; |
| 2861 | |
| 2862 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2863 | Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2864 | break; |
| 2865 | |
| 2866 | case HOST_IF_MSG_KEY: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2867 | Handle_Key(msg.drv, &msg.body.key_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2868 | break; |
| 2869 | |
| 2870 | case HOST_IF_MSG_CFG_PARAMS: |
| 2871 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2872 | Handle_CfgParam(msg.drv, &msg.body.cfg_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2873 | break; |
| 2874 | |
| 2875 | case HOST_IF_MSG_SET_CHANNEL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2876 | Handle_SetChannel(msg.drv, &msg.body.channel_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2877 | break; |
| 2878 | |
| 2879 | case HOST_IF_MSG_DISCONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2880 | Handle_Disconnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2881 | break; |
| 2882 | |
| 2883 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2884 | del_timer(&hif_drv->hScanTimer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2885 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 2886 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2887 | if (!linux_wlan_get_num_conn_ifcs()) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2888 | chip_sleep_manually(INFINITE_SLEEP_TIME); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2889 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2890 | Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2891 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2892 | if (hif_drv->remain_on_ch_pending) |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2893 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2894 | |
| 2895 | break; |
| 2896 | |
| 2897 | case HOST_IF_MSG_GET_RSSI: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2898 | Handle_GetRssi(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2899 | break; |
| 2900 | |
| 2901 | case HOST_IF_MSG_GET_LINKSPEED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2902 | Handle_GetLinkspeed(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2903 | break; |
| 2904 | |
| 2905 | case HOST_IF_MSG_GET_STATISTICS: |
Leo Kim | 03e7b9c | 2015-10-12 16:55:58 +0900 | [diff] [blame] | 2906 | Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2907 | break; |
| 2908 | |
| 2909 | case HOST_IF_MSG_GET_CHNL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2910 | Handle_GetChnl(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2911 | break; |
| 2912 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2913 | case HOST_IF_MSG_ADD_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2914 | Handle_AddBeacon(msg.drv, &msg.body.beacon_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2915 | break; |
| 2916 | |
| 2917 | case HOST_IF_MSG_DEL_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2918 | Handle_DelBeacon(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2919 | break; |
| 2920 | |
| 2921 | case HOST_IF_MSG_ADD_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2922 | Handle_AddStation(msg.drv, &msg.body.add_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2923 | break; |
| 2924 | |
| 2925 | case HOST_IF_MSG_DEL_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2926 | Handle_DelStation(msg.drv, &msg.body.del_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2927 | break; |
| 2928 | |
| 2929 | case HOST_IF_MSG_EDIT_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2930 | Handle_EditStation(msg.drv, &msg.body.edit_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2931 | break; |
| 2932 | |
| 2933 | case HOST_IF_MSG_GET_INACTIVETIME: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2934 | Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2935 | break; |
| 2936 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2937 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 2938 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 2939 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2940 | Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2941 | break; |
| 2942 | |
| 2943 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2944 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2945 | Handle_ConnectTimeout(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2946 | break; |
| 2947 | |
| 2948 | case HOST_IF_MSG_POWER_MGMT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2949 | Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2950 | break; |
| 2951 | |
| 2952 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2953 | Handle_SetWfiDrvHandler(msg.drv, |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 2954 | &msg.body.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2955 | break; |
| 2956 | |
| 2957 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2958 | Handle_SetOperationMode(msg.drv, &msg.body.mode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2959 | break; |
| 2960 | |
| 2961 | case HOST_IF_MSG_SET_IPADDRESS: |
| 2962 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 2963 | Handle_set_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2964 | break; |
| 2965 | |
| 2966 | case HOST_IF_MSG_GET_IPADDRESS: |
| 2967 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 2968 | Handle_get_IPAddress(msg.drv, msg.body.ip_info.ip_addr, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2969 | break; |
| 2970 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2971 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2972 | Handle_SetMacAddress(msg.drv, &msg.body.set_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2973 | break; |
| 2974 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2975 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2976 | Handle_GetMacAddress(msg.drv, &msg.body.get_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2977 | break; |
| 2978 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2979 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 2980 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2981 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2982 | break; |
| 2983 | |
| 2984 | case HOST_IF_MSG_REGISTER_FRAME: |
| 2985 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2986 | Handle_RegisterFrame(msg.drv, &msg.body.reg_frame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2987 | break; |
| 2988 | |
| 2989 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2990 | Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2991 | break; |
| 2992 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2993 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 2994 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2995 | Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2996 | break; |
| 2997 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2998 | case HOST_IF_MSG_ADD_BA_SESSION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2999 | Handle_AddBASession(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3000 | break; |
| 3001 | |
| 3002 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3003 | Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3004 | break; |
| 3005 | |
| 3006 | case HOST_IF_MSG_DEL_ALL_STA: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3007 | Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3008 | break; |
| 3009 | |
| 3010 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3011 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3012 | break; |
| 3013 | } |
| 3014 | } |
| 3015 | |
| 3016 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 3017 | up(&hif_sema_thread); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 3018 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3019 | } |
| 3020 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3021 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3022 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3023 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3024 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3025 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3026 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3027 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3028 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3029 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3030 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3031 | } |
| 3032 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3033 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3034 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3035 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3036 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3037 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3038 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3039 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3040 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3041 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3042 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3043 | } |
| 3044 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3045 | 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] | 3046 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3047 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3048 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3049 | wid.id = (u16)WID_REMOVE_KEY; |
| 3050 | wid.type = WID_STR; |
| 3051 | wid.val = (s8 *)pu8StaAddress; |
| 3052 | wid.size = 6; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3053 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3054 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3055 | } |
| 3056 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3057 | 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] | 3058 | { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3059 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3060 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3061 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3062 | if (!hif_drv) { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3063 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3064 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3065 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3066 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3067 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3068 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3069 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3070 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3071 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3072 | msg.body.key_info.action = REMOVEKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3073 | msg.drv = hif_drv; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 3074 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3075 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3076 | 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] | 3077 | if (result) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3078 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3079 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3080 | |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3081 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3082 | } |
| 3083 | |
Chaehyun Lim | df8b483 | 2015-10-26 09:44:45 +0900 | [diff] [blame] | 3084 | 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] | 3085 | { |
Chaehyun Lim | 5b41c7c | 2015-10-26 09:44:42 +0900 | [diff] [blame] | 3086 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3087 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3088 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3089 | if (!hif_drv) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3090 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3091 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3092 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3093 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3094 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3095 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3096 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3097 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3098 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3099 | msg.body.key_info.action = DEFAULTKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3100 | msg.drv = hif_drv; |
Chaehyun Lim | e91d034 | 2015-10-26 09:44:44 +0900 | [diff] [blame] | 3101 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3102 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3103 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3104 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3105 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3106 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3107 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3108 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3109 | } |
| 3110 | |
Chaehyun Lim | 66b8cb8 | 2015-10-27 20:40:32 +0900 | [diff] [blame] | 3111 | 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] | 3112 | const u8 *key, |
Chaehyun Lim | dbc5319 | 2015-10-27 20:40:35 +0900 | [diff] [blame] | 3113 | u8 len, |
Chaehyun Lim | 0b2cc3e | 2015-10-27 20:40:36 +0900 | [diff] [blame] | 3114 | u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3115 | { |
Chaehyun Lim | 66b8cb8 | 2015-10-27 20:40:32 +0900 | [diff] [blame] | 3116 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3117 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3118 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3119 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3120 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3121 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3122 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3123 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3124 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3125 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3126 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3127 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3128 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3129 | msg.drv = hif_drv; |
Chaehyun Lim | 1cc0c32 | 2015-10-27 20:40:37 +0900 | [diff] [blame] | 3130 | msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); |
| 3131 | if (!msg.body.key_info.attr.wep.key) |
| 3132 | return -ENOMEM; |
| 3133 | |
Chaehyun Lim | dbc5319 | 2015-10-27 20:40:35 +0900 | [diff] [blame] | 3134 | msg.body.key_info.attr.wep.key_len = len; |
Chaehyun Lim | 0b2cc3e | 2015-10-27 20:40:36 +0900 | [diff] [blame] | 3135 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3136 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3137 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3138 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3139 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3140 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3141 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3142 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3143 | } |
| 3144 | |
Chaehyun Lim | 641c20a | 2015-10-28 08:19:19 +0900 | [diff] [blame] | 3145 | 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] | 3146 | const u8 *key, |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3147 | u8 len, |
Chaehyun Lim | a76dc95 | 2015-10-28 08:19:24 +0900 | [diff] [blame] | 3148 | u8 index, |
Chaehyun Lim | 730a28d | 2015-10-28 08:19:25 +0900 | [diff] [blame] | 3149 | u8 mode, |
Chaehyun Lim | ff3bce2 | 2015-10-28 08:19:26 +0900 | [diff] [blame] | 3150 | enum AUTHTYPE auth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3151 | { |
Chaehyun Lim | 641c20a | 2015-10-28 08:19:19 +0900 | [diff] [blame] | 3152 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3153 | struct host_if_msg msg; |
Chaehyun Lim | fd74146 | 2015-10-28 08:19:21 +0900 | [diff] [blame] | 3154 | int i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3155 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3156 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3157 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3158 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3159 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3160 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3161 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3162 | |
| 3163 | if (INFO) { |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3164 | for (i = 0; i < len; i++) |
Chaehyun Lim | 8111725 | 2015-10-28 08:19:22 +0900 | [diff] [blame] | 3165 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", key[i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3166 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3167 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3168 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3169 | msg.body.key_info.action = ADDKEY_AP; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3170 | msg.drv = hif_drv; |
Chaehyun Lim | 58eabd6 | 2015-10-28 08:19:27 +0900 | [diff] [blame] | 3171 | msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); |
| 3172 | if (!msg.body.key_info.attr.wep.key) |
| 3173 | return -ENOMEM; |
| 3174 | |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3175 | msg.body.key_info.attr.wep.key_len = len; |
Chaehyun Lim | a76dc95 | 2015-10-28 08:19:24 +0900 | [diff] [blame] | 3176 | msg.body.key_info.attr.wep.index = index; |
Chaehyun Lim | 730a28d | 2015-10-28 08:19:25 +0900 | [diff] [blame] | 3177 | msg.body.key_info.attr.wep.mode = mode; |
Chaehyun Lim | ff3bce2 | 2015-10-28 08:19:26 +0900 | [diff] [blame] | 3178 | msg.body.key_info.attr.wep.auth_type = auth_type; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3179 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3180 | 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] | 3181 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3182 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3183 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3184 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3185 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3186 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3187 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3188 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3189 | s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, |
| 3190 | u8 u8PtkKeylen, const u8 *mac_addr, |
| 3191 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 3192 | u8 mode, u8 u8Ciphermode, u8 u8Idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3193 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3194 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3195 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3196 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3197 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3198 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3199 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3200 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3201 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3202 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3203 | |
| 3204 | if (pu8RxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3205 | u8KeyLen += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3206 | |
| 3207 | if (pu8TxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3208 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3209 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3210 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3211 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3212 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3213 | msg.body.key_info.type = WPAPtk; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3214 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3215 | msg.body.key_info.action = ADDKEY_AP; |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 3216 | msg.body.key_info.attr.wpa.index = u8Idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3217 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3218 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3219 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3220 | |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3221 | msg.body.key_info.attr.wpa.key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
| 3222 | memcpy(msg.body.key_info.attr.wpa.key, pu8Ptk, u8PtkKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3223 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3224 | if (pu8RxMic) { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3225 | memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, RX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3226 | if (INFO) { |
| 3227 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 3228 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 3229 | } |
| 3230 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3231 | if (pu8TxMic) { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3232 | memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, TX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3233 | if (INFO) { |
| 3234 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 3235 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 3236 | } |
| 3237 | } |
| 3238 | |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 3239 | msg.body.key_info.attr.wpa.key_len = u8KeyLen; |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 3240 | msg.body.key_info.attr.wpa.mac_addr = mac_addr; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 3241 | msg.body.key_info.attr.wpa.mode = u8Ciphermode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3242 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3243 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3244 | 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] | 3245 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3246 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3247 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 3248 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3249 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3250 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3251 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3252 | } |
| 3253 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3254 | s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, |
| 3255 | u8 u8GtkKeylen, u8 u8KeyIdx, |
| 3256 | u32 u32KeyRSClen, const u8 *KeyRSC, |
| 3257 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 3258 | u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3259 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3260 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3261 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3262 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3263 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3264 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3265 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3266 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3267 | } |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3268 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3269 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3270 | if (pu8RxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3271 | u8KeyLen += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3272 | |
| 3273 | if (pu8TxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3274 | u8KeyLen += TX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3275 | |
| 3276 | if (KeyRSC) { |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 3277 | msg.body.key_info.attr.wpa.seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
| 3278 | memcpy(msg.body.key_info.attr.wpa.seq, KeyRSC, u32KeyRSClen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3279 | } |
| 3280 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3281 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3282 | msg.body.key_info.type = WPARxGtk; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3283 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3284 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3285 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3286 | msg.body.key_info.action = ADDKEY_AP; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 3287 | msg.body.key_info.attr.wpa.mode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3288 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3289 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3290 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3291 | |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3292 | msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL); |
| 3293 | memcpy(msg.body.key_info.attr.wpa.key, pu8RxGtk, u8GtkKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3294 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3295 | if (pu8RxMic) |
| 3296 | memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, |
| 3297 | RX_MIC_KEY_LEN); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3298 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3299 | if (pu8TxMic) |
| 3300 | memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, |
| 3301 | TX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3302 | |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 3303 | msg.body.key_info.attr.wpa.index = u8KeyIdx; |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 3304 | msg.body.key_info.attr.wpa.key_len = u8KeyLen; |
Leo Kim | dacc594 | 2015-10-13 19:49:33 +0900 | [diff] [blame] | 3305 | msg.body.key_info.attr.wpa.seq_len = u32KeyRSClen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3306 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3307 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3308 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3309 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3310 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3311 | down(&hif_drv->hSemTestKeyBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3312 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3313 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3314 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3315 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3316 | 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] | 3317 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3318 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3319 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3320 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3321 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3322 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3323 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3324 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3325 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3326 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3327 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3328 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3329 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3330 | msg.body.key_info.type = PMKSA; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3331 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3332 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3333 | |
| 3334 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3335 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].bssid, |
| 3336 | &pu8PmkidInfoArray->pmkidlist[i].bssid, ETH_ALEN); |
| 3337 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].pmkid, |
| 3338 | &pu8PmkidInfoArray->pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3339 | } |
| 3340 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3341 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3342 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3343 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 3344 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3345 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3346 | } |
| 3347 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3348 | s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv, |
| 3349 | u8 *pu8PmkidInfoArray, |
| 3350 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3351 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3352 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3353 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3354 | wid.id = (u16)WID_PMKID_INFO; |
| 3355 | wid.type = WID_STR; |
| 3356 | wid.size = u32PmkidInfoLen; |
| 3357 | wid.val = pu8PmkidInfoArray; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3358 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3359 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3360 | } |
| 3361 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3362 | s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3363 | u8 *pu8PassPhrase, |
| 3364 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3365 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3366 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3367 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3368 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3369 | wid.id = (u16)WID_11I_PSK; |
| 3370 | wid.type = WID_STR; |
| 3371 | wid.val = pu8PassPhrase; |
| 3372 | wid.size = u8Psklength; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3373 | } |
| 3374 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3375 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3376 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3377 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3378 | s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3379 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3380 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3381 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3382 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3383 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3384 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3385 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Leo Kim | 6ceba0a | 2015-10-28 15:59:32 +0900 | [diff] [blame] | 3386 | msg.body.get_mac_info.mac_addr = pu8MacAddress; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3387 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3388 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3389 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3390 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3391 | PRINT_ER("Failed to send get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3392 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3393 | } |
| 3394 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3395 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3396 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3397 | } |
| 3398 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3399 | 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] | 3400 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3401 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3402 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3403 | |
| 3404 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 3405 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3406 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3407 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Leo Kim | ae5e452 | 2015-10-28 15:59:31 +0900 | [diff] [blame] | 3408 | memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3409 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3410 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3411 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3412 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3413 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
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 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3416 | } |
| 3417 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3418 | s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3419 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3420 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3421 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3422 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3423 | wid.id = (u16)WID_11I_PSK; |
| 3424 | wid.type = WID_STR; |
| 3425 | wid.size = u8Psklength; |
| 3426 | wid.val = pu8PassPhrase; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3427 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3428 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3429 | } |
| 3430 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3431 | 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] | 3432 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3433 | struct wid wid; |
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 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3436 | wid.type = WID_CHAR; |
| 3437 | wid.val = (s8 *)&scanSource; |
| 3438 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3439 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3440 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3441 | } |
| 3442 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3443 | 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] | 3444 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3445 | struct wid wid; |
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 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3448 | wid.type = WID_CHAR; |
| 3449 | wid.val = (s8 *)pu8ScanSource; |
| 3450 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3451 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3452 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3453 | } |
| 3454 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3455 | s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, |
| 3456 | const u8 *pu8ssid, size_t ssidLen, |
| 3457 | const u8 *pu8IEs, size_t IEsLen, |
| 3458 | wilc_connect_result pfConnectResult, void *pvUserArg, |
| 3459 | u8 u8security, enum AUTHTYPE tenuAuth_type, |
| 3460 | u8 u8channel, void *pJoinParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3461 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3462 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3463 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3464 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3465 | if (!hif_drv || !pfConnectResult) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3466 | PRINT_ER("Driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3467 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3468 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3469 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3470 | if (!pJoinParams) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3471 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3472 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3473 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3474 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3475 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3476 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3477 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3478 | |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 3479 | msg.body.con_info.security = u8security; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 3480 | msg.body.con_info.auth_type = tenuAuth_type; |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 3481 | msg.body.con_info.ch = u8channel; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 3482 | msg.body.con_info.result = pfConnectResult; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 3483 | msg.body.con_info.arg = pvUserArg; |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 3484 | msg.body.con_info.params = pJoinParams; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3485 | msg.drv = hif_drv ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3486 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3487 | if (pu8bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 3488 | msg.body.con_info.bssid = kmalloc(6, GFP_KERNEL); |
| 3489 | memcpy(msg.body.con_info.bssid, pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3490 | } |
| 3491 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3492 | if (pu8ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 3493 | msg.body.con_info.ssid_len = ssidLen; |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 3494 | msg.body.con_info.ssid = kmalloc(ssidLen, GFP_KERNEL); |
| 3495 | memcpy(msg.body.con_info.ssid, pu8ssid, ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3496 | } |
| 3497 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3498 | if (pu8IEs) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 3499 | msg.body.con_info.ies_len = IEsLen; |
Leo Kim | 2ea158c | 2015-10-13 19:49:52 +0900 | [diff] [blame] | 3500 | msg.body.con_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3501 | memcpy(msg.body.con_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3502 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 3503 | if (hif_drv->hif_state < HOST_IF_CONNECTING) |
| 3504 | hif_drv->hif_state = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3505 | else |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 3506 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' : %d\n", |
| 3507 | hif_drv->hif_state); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3508 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3509 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3510 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3511 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3512 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3513 | } |
| 3514 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3515 | hif_drv->hConnectTimer.data = (unsigned long)hif_drv; |
| 3516 | mod_timer(&hif_drv->hConnectTimer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3517 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3518 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3519 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3520 | } |
| 3521 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3522 | s32 host_int_flush_join_req(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3523 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3524 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3525 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3526 | |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3527 | if (!join_req) |
| 3528 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3529 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3530 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3531 | PRINT_ER("Driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3532 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3533 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3534 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3535 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3536 | msg.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 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3539 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3540 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3541 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3542 | } |
| 3543 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3544 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3545 | } |
| 3546 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3547 | s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3548 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3549 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3550 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3551 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3552 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3553 | PRINT_ER("Driver is null\n"); |
| 3554 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3555 | } |
| 3556 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3557 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3558 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3559 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3560 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3561 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3562 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3563 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3564 | PRINT_ER("Failed to send message queue: disconnect\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3565 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3566 | down(&hif_drv->hSemTestDisconnectBlock); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3567 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3568 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3569 | } |
| 3570 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3571 | 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] | 3572 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3573 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3574 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3575 | wid.id = (u16)WID_DISCONNECT; |
| 3576 | wid.type = WID_CHAR; |
| 3577 | wid.val = (s8 *)&assoc_id; |
| 3578 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3579 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3580 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3581 | } |
| 3582 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3583 | s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, |
| 3584 | u8 *pu8AssocReqInfo, |
| 3585 | u32 u32AssocReqInfoLen) |
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_ASSOC_REQ_INFO; |
| 3590 | wid.type = WID_STR; |
| 3591 | wid.val = pu8AssocReqInfo; |
| 3592 | wid.size = u32AssocReqInfoLen; |
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_res_info(struct host_if_drv *hif_drv, |
| 3598 | u8 *pu8AssocRespInfo, |
| 3599 | u32 u32MaxAssocRespInfoLen, |
| 3600 | u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3601 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3602 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3603 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3604 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3605 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3606 | PRINT_ER("Driver is null\n"); |
| 3607 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3608 | } |
| 3609 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3610 | wid.id = (u16)WID_ASSOC_RES_INFO; |
| 3611 | wid.type = WID_STR; |
| 3612 | wid.val = pu8AssocRespInfo; |
| 3613 | wid.size = u32MaxAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3614 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3615 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3616 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3617 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3618 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3619 | PRINT_ER("Failed to send association response config packet\n"); |
| 3620 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3621 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3622 | *pu32RcvdAssocRespInfoLen = wid.size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3623 | } |
| 3624 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3625 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3626 | } |
| 3627 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3628 | s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, |
| 3629 | u8 *pu8RxPowerLevel, |
| 3630 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3631 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3632 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3633 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3634 | wid.id = (u16)WID_RX_POWER_LEVEL; |
| 3635 | wid.type = WID_STR; |
| 3636 | wid.val = pu8RxPowerLevel; |
| 3637 | wid.size = u32RxPowerLevelLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3638 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3639 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3640 | } |
| 3641 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3642 | 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] | 3643 | { |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3644 | int result; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3645 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3646 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3647 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3648 | PRINT_ER("driver is null\n"); |
| 3649 | return -EFAULT; |
| 3650 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3651 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3652 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3653 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Leo Kim | 730ee05 | 2015-10-13 19:50:02 +0900 | [diff] [blame] | 3654 | msg.body.channel_info.set_ch = channel; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3655 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3656 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3657 | 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] | 3658 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3659 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3660 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3661 | } |
| 3662 | |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3663 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3664 | } |
| 3665 | |
Chaehyun Lim | 244efb1 | 2015-10-02 21:44:53 +0900 | [diff] [blame] | 3666 | int host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3667 | { |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3668 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3669 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3670 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3671 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3672 | msg.id = HOST_IF_MSG_Q_IDLE; |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3673 | 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] | 3674 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3675 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3676 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3677 | } |
| 3678 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3679 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3680 | |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3681 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3682 | } |
| 3683 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3684 | 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] | 3685 | { |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3686 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3687 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3688 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3689 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3690 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 3691 | msg.body.drv.handler = get_id_from_handler(hif_drv); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3692 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3693 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3694 | 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] | 3695 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3696 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3697 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3698 | } |
| 3699 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3700 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3701 | } |
| 3702 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3703 | 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] | 3704 | { |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3705 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3706 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3707 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3708 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3709 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 3710 | msg.body.mode.mode = mode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3711 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3712 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3713 | 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] | 3714 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3715 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3716 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3717 | } |
| 3718 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3719 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3720 | } |
| 3721 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3722 | 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] | 3723 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3724 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3725 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3726 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3727 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3728 | PRINT_ER("driver is null\n"); |
| 3729 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3730 | } |
| 3731 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3732 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3733 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3734 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3735 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3736 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3737 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3738 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3739 | PRINT_ER("wilc mq send fail\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3740 | down(&hif_drv->hSemGetCHNL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3741 | |
Leo Kim | 95ebb0f | 2015-10-15 13:25:03 +0900 | [diff] [blame] | 3742 | *pu8ChNo = ch_no; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3743 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3744 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3745 | } |
| 3746 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3747 | s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, |
| 3748 | const u8 *mac, u32 *pu32InactiveTime) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3749 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3750 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3751 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3752 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3753 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3754 | PRINT_ER("driver is null\n"); |
| 3755 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3756 | } |
| 3757 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3758 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3759 | memcpy(msg.body.mac_info.mac, mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3760 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3761 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3762 | msg.drv = hif_drv; |
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 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3765 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3766 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 3767 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3768 | down(&hif_drv->hSemInactiveTime); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3769 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 3770 | *pu32InactiveTime = inactive_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3771 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3772 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3773 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3774 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3775 | 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] | 3776 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3777 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3778 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3779 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3780 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3781 | PRINT_ER("driver is null\n"); |
| 3782 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3783 | } |
| 3784 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3785 | wid.id = (u16)WID_MEMORY_ADDRESS; |
| 3786 | wid.type = WID_INT; |
| 3787 | wid.val = (s8 *)pu32TestMemAddr; |
| 3788 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3789 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3790 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3791 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3792 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3793 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3794 | PRINT_ER("Failed to get wid value\n"); |
| 3795 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3796 | } else { |
| 3797 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3798 | } |
| 3799 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3800 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3801 | } |
| 3802 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3803 | 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] | 3804 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3805 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3806 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3807 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3808 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3809 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3810 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3811 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3812 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3813 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3814 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3815 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3816 | } |
| 3817 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3818 | down(&hif_drv->hSemGetRSSI); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3819 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3820 | if (!ps8Rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3821 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3822 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3823 | } |
| 3824 | |
Leo Kim | 144b7b2 | 2015-10-15 13:25:01 +0900 | [diff] [blame] | 3825 | *ps8Rssi = rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3826 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3827 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3828 | } |
| 3829 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3830 | 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] | 3831 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3832 | struct host_if_msg msg; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3833 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3834 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3835 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3836 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3837 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3838 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3839 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3840 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3841 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3842 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3843 | } |
| 3844 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3845 | down(&hif_drv->hSemGetLINKSPEED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3846 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3847 | if (!ps8lnkspd) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3848 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3849 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3850 | } |
| 3851 | |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 3852 | *ps8lnkspd = link_speed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3853 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3854 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3855 | } |
| 3856 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3857 | 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] | 3858 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3859 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3860 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3861 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3862 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3863 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 3864 | msg.body.data = (char *)pstrStatistics; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3865 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3866 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3867 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3868 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3869 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3870 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3871 | } |
| 3872 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3873 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3874 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3875 | } |
| 3876 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3877 | s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, |
| 3878 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 3879 | u8 u8ChnlListLen, const u8 *pu8IEs, |
| 3880 | size_t IEsLen, wilc_scan_result ScanResult, |
| 3881 | void *pvUserArg, struct hidden_network *pstrHiddenNetwork) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3882 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3883 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3884 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3885 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3886 | if (!hif_drv || !ScanResult) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3887 | PRINT_ER("hif_drv or ScanResult = NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3888 | return -EFAULT; |
| 3889 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3890 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3891 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3892 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3893 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3894 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3895 | if (pstrHiddenNetwork) { |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 3896 | msg.body.scan_info.hidden_network.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 3897 | msg.body.scan_info.hidden_network.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3898 | |
| 3899 | } else |
| 3900 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 3901 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3902 | msg.drv = hif_drv; |
Leo Kim | 4256889 | 2015-10-13 19:49:37 +0900 | [diff] [blame] | 3903 | msg.body.scan_info.src = u8ScanSource; |
Leo Kim | 1e276c8 | 2015-10-13 19:49:38 +0900 | [diff] [blame] | 3904 | msg.body.scan_info.type = u8ScanType; |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 3905 | msg.body.scan_info.result = ScanResult; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 3906 | msg.body.scan_info.arg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3907 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 3908 | msg.body.scan_info.ch_list_len = u8ChnlListLen; |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 3909 | msg.body.scan_info.ch_freq_list = kmalloc(u8ChnlListLen, GFP_KERNEL); |
| 3910 | memcpy(msg.body.scan_info.ch_freq_list, pu8ChnlFreqList, u8ChnlListLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3911 | |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 3912 | msg.body.scan_info.ies_len = IEsLen; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 3913 | msg.body.scan_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3914 | memcpy(msg.body.scan_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3915 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3916 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3917 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3918 | PRINT_ER("Error in sending message queue\n"); |
| 3919 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3920 | } |
| 3921 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3922 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3923 | hif_drv->hScanTimer.data = (unsigned long)hif_drv; |
| 3924 | mod_timer(&hif_drv->hScanTimer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3925 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3926 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3927 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3928 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3929 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3930 | s32 hif_set_cfg(struct host_if_drv *hif_drv, |
| 3931 | struct cfg_param_val *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3932 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3933 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3934 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3935 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3936 | if (!hif_drv) { |
| 3937 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3938 | return -EFAULT; |
| 3939 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3940 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3941 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3942 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 3943 | msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3944 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3945 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3946 | 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] | 3947 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3948 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3949 | } |
| 3950 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3951 | 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] | 3952 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3953 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3954 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3955 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3956 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3957 | if (!hif_drv) { |
| 3958 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3959 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3960 | } |
| 3961 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 3962 | switch (u16WID) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3963 | case WID_BSS_TYPE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3964 | *pu16WID_Value = (u16)hif_drv->strCfgValues.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3965 | break; |
| 3966 | |
| 3967 | case WID_AUTH_TYPE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3968 | *pu16WID_Value = (u16)hif_drv->strCfgValues.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3969 | break; |
| 3970 | |
| 3971 | case WID_AUTH_TIMEOUT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3972 | *pu16WID_Value = hif_drv->strCfgValues.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3973 | break; |
| 3974 | |
| 3975 | case WID_POWER_MANAGEMENT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3976 | *pu16WID_Value = (u16)hif_drv->strCfgValues.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3977 | break; |
| 3978 | |
| 3979 | case WID_SHORT_RETRY_LIMIT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3980 | *pu16WID_Value = hif_drv->strCfgValues.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3981 | break; |
| 3982 | |
| 3983 | case WID_LONG_RETRY_LIMIT: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3984 | *pu16WID_Value = hif_drv->strCfgValues.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3985 | break; |
| 3986 | |
| 3987 | case WID_FRAG_THRESHOLD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3988 | *pu16WID_Value = hif_drv->strCfgValues.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3989 | break; |
| 3990 | |
| 3991 | case WID_RTS_THRESHOLD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3992 | *pu16WID_Value = hif_drv->strCfgValues.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3993 | break; |
| 3994 | |
| 3995 | case WID_PREAMBLE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3996 | *pu16WID_Value = (u16)hif_drv->strCfgValues.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3997 | break; |
| 3998 | |
| 3999 | case WID_SHORT_SLOT_ALLOWED: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4000 | *pu16WID_Value = (u16) hif_drv->strCfgValues.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4001 | break; |
| 4002 | |
| 4003 | case WID_11N_TXOP_PROT_DISABLE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4004 | *pu16WID_Value = (u16)hif_drv->strCfgValues.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4005 | break; |
| 4006 | |
| 4007 | case WID_BEACON_INTERVAL: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4008 | *pu16WID_Value = hif_drv->strCfgValues.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4009 | break; |
| 4010 | |
| 4011 | case WID_DTIM_PERIOD: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4012 | *pu16WID_Value = (u16)hif_drv->strCfgValues.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4013 | break; |
| 4014 | |
| 4015 | case WID_SITE_SURVEY: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4016 | *pu16WID_Value = (u16)hif_drv->strCfgValues.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4017 | break; |
| 4018 | |
| 4019 | case WID_SITE_SURVEY_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4020 | *pu16WID_Value = hif_drv->strCfgValues.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4021 | break; |
| 4022 | |
| 4023 | case WID_ACTIVE_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4024 | *pu16WID_Value = hif_drv->strCfgValues.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4025 | break; |
| 4026 | |
| 4027 | case WID_PASSIVE_SCAN_TIME: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4028 | *pu16WID_Value = hif_drv->strCfgValues.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4029 | break; |
| 4030 | |
| 4031 | case WID_CURRENT_TX_RATE: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4032 | *pu16WID_Value = hif_drv->strCfgValues.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4033 | break; |
| 4034 | |
| 4035 | default: |
| 4036 | break; |
| 4037 | } |
| 4038 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4039 | up(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4040 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4041 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4042 | } |
| 4043 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4044 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4045 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4046 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4047 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4048 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4049 | PRINT_ER("Driver handler is NULL\n"); |
| 4050 | return; |
| 4051 | } |
| 4052 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4053 | if (hif_drv->hif_state == HOST_IF_CONNECTED) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4054 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4055 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4056 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4057 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4058 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4059 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4060 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4061 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4062 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4063 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4064 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 4065 | return; |
| 4066 | } |
| 4067 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4068 | periodic_rssi.data = (unsigned long)hif_drv; |
| 4069 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4070 | } |
| 4071 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4072 | 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] | 4073 | { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4074 | s32 result = 0; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4075 | struct host_if_drv *hif_drv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4076 | int err; |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4077 | perInterface_wlan_t *nic; |
| 4078 | struct wilc *wilc; |
| 4079 | |
| 4080 | nic = netdev_priv(dev); |
| 4081 | wilc = nic->wilc; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4082 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4083 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 4084 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4085 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4086 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4087 | sema_init(&hif_sema_wait_response, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4088 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4089 | hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL); |
| 4090 | if (!hif_drv) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4091 | result = -ENOMEM; |
Vincent Stehlé | 17db84e | 2015-10-07 07:08:25 +0200 | [diff] [blame] | 4092 | goto _fail_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4093 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4094 | *hif_drv_handler = hif_drv; |
| 4095 | err = add_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4096 | if (err) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4097 | result = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4098 | goto _fail_timer_2; |
| 4099 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4100 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 4101 | g_obtainingIP = false; |
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 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4104 | if (clients_count == 0) { |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4105 | sema_init(&hif_sema_thread, 0); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4106 | sema_init(&hif_sema_driver, 0); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4107 | sema_init(&hif_sema_deinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4108 | } |
| 4109 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4110 | sema_init(&hif_drv->hSemTestKeyBlock, 0); |
| 4111 | sema_init(&hif_drv->hSemTestDisconnectBlock, 0); |
| 4112 | sema_init(&hif_drv->hSemGetRSSI, 0); |
| 4113 | sema_init(&hif_drv->hSemGetLINKSPEED, 0); |
| 4114 | sema_init(&hif_drv->hSemGetCHNL, 0); |
| 4115 | sema_init(&hif_drv->hSemInactiveTime, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4116 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4117 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 4118 | |
| 4119 | if (clients_count == 0) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4120 | result = wilc_mq_create(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4121 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4122 | if (result < 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4123 | PRINT_ER("Failed to creat MQ\n"); |
| 4124 | goto _fail_; |
| 4125 | } |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4126 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4127 | hif_thread_handler = kthread_run(hostIFthread, wilc, |
| 4128 | "WILC_kthread"); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4129 | |
| 4130 | if (IS_ERR(hif_thread_handler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4131 | PRINT_ER("Failed to creat Thread\n"); |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4132 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4133 | goto _fail_mq_; |
| 4134 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4135 | setup_timer(&periodic_rssi, GetPeriodicRSSI, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4136 | (unsigned long)hif_drv); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4137 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4138 | } |
| 4139 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4140 | setup_timer(&hif_drv->hScanTimer, TimerCB_Scan, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4141 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4142 | setup_timer(&hif_drv->hConnectTimer, TimerCB_Connect, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4143 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4144 | setup_timer(&hif_drv->hRemainOnChannel, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4145 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 4146 | sema_init(&hif_drv->gtOsCfgValuesSem, 1); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4147 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4148 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4149 | hif_drv->hif_state = HOST_IF_IDLE; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4150 | hif_drv->strCfgValues.site_survey_enabled = SITE_SURVEY_OFF; |
| 4151 | hif_drv->strCfgValues.scan_source = DEFAULT_SCAN; |
| 4152 | hif_drv->strCfgValues.active_scan_time = ACTIVE_SCAN_TIME; |
| 4153 | hif_drv->strCfgValues.passive_scan_time = PASSIVE_SCAN_TIME; |
| 4154 | hif_drv->strCfgValues.curr_tx_rate = AUTORATE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4155 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4156 | hif_drv->u64P2p_MgmtTimeout = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4157 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4158 | 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", |
| 4159 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4160 | hif_drv->strCfgValues.site_survey_enabled, hif_drv->strCfgValues.scan_source, |
| 4161 | hif_drv->strCfgValues.active_scan_time, hif_drv->strCfgValues.passive_scan_time, |
| 4162 | hif_drv->strCfgValues.curr_tx_rate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4163 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4164 | up(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4165 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4166 | clients_count++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4167 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4168 | return result; |
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 | _fail_timer_2: |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4171 | up(&hif_drv->gtOsCfgValuesSem); |
| 4172 | del_timer_sync(&hif_drv->hConnectTimer); |
| 4173 | del_timer_sync(&hif_drv->hScanTimer); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4174 | kthread_stop(hif_thread_handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4175 | _fail_mq_: |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4176 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4177 | _fail_: |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4178 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4179 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4180 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4181 | s32 host_int_deinit(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4182 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4183 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4184 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4185 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4186 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4187 | if (!hif_drv) { |
| 4188 | PRINT_ER("hif_drv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4189 | return 0; |
| 4190 | } |
| 4191 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4192 | down(&hif_sema_deinit); |
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 | terminated_handle = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4195 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 4196 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4197 | if (del_timer_sync(&hif_drv->hScanTimer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4198 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4199 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4200 | if (del_timer_sync(&hif_drv->hConnectTimer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4201 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4202 | |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4203 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4204 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4205 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4206 | del_timer_sync(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4207 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4208 | host_int_set_wfi_drv_handler(NULL); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4209 | down(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4210 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 4211 | if (hif_drv->usr_scan_req.pfUserScanResult) { |
| 4212 | hif_drv->usr_scan_req.pfUserScanResult(SCAN_EVENT_ABORTED, NULL, |
| 4213 | hif_drv->usr_scan_req.u32UserScanPvoid, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4214 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 4215 | hif_drv->usr_scan_req.pfUserScanResult = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4216 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4217 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4218 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4219 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4220 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4221 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4222 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4223 | |
| 4224 | if (clients_count == 1) { |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4225 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4226 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4227 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4228 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4229 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4230 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4231 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4232 | if (result != 0) |
| 4233 | 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] | 4234 | |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4235 | down(&hif_sema_thread); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4236 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4237 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4238 | } |
| 4239 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 4240 | down(&hif_drv->gtOsCfgValuesSem); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4241 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4242 | ret = remove_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4243 | if (ret) |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4244 | result = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4245 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4246 | kfree(hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4247 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4248 | clients_count--; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 4249 | terminated_handle = NULL; |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4250 | up(&hif_sema_deinit); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4251 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4252 | } |
| 4253 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4254 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4255 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4256 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4257 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4258 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4259 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4260 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4261 | 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] | 4262 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4263 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4264 | if (!hif_drv || hif_drv == terminated_handle) { |
| 4265 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4266 | return; |
| 4267 | } |
| 4268 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4269 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4270 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4271 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4272 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4273 | |
Leo Kim | 3bffac6 | 2015-10-13 20:02:11 +0900 | [diff] [blame] | 4274 | msg.body.net_info.len = u32Length; |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 4275 | msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4276 | memcpy(msg.body.net_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4277 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4278 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4279 | if (result) |
| 4280 | 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] | 4281 | } |
| 4282 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4283 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4284 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4285 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4286 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4287 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4288 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4289 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4290 | down(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4291 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4292 | 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] | 4293 | hif_drv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4294 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4295 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4296 | if (!hif_drv || hif_drv == terminated_handle) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4297 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4298 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4299 | return; |
| 4300 | } |
| 4301 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 4302 | if (!hif_drv->usr_conn_req.pfUserConnectResult) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4303 | 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] | 4304 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4305 | return; |
| 4306 | } |
| 4307 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4308 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4309 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4310 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4311 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4312 | |
Leo Kim | f94f488 | 2015-10-13 19:50:01 +0900 | [diff] [blame] | 4313 | msg.body.async_info.len = u32Length; |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 4314 | msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4315 | memcpy(msg.body.async_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4316 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4317 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4318 | if (result) |
| 4319 | 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] | 4320 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4321 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4322 | } |
| 4323 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4324 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4325 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4326 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4327 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4328 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4329 | struct host_if_drv *hif_drv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4330 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4331 | 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] | 4332 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4333 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4334 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4335 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4336 | if (!hif_drv || hif_drv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4337 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4338 | |
Leo Kim | 70793b2 | 2015-10-28 15:59:33 +0900 | [diff] [blame] | 4339 | if (hif_drv->usr_scan_req.pfUserScanResult) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4340 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4341 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4342 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4343 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4344 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4345 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4346 | if (result) |
| 4347 | 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] | 4348 | } |
| 4349 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4350 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4351 | } |
| 4352 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4353 | s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, |
| 4354 | u32 u32duration, u16 chan, |
| 4355 | wilc_remain_on_chan_expired RemainOnChanExpired, |
| 4356 | wilc_remain_on_chan_ready RemainOnChanReady, |
| 4357 | void *pvUserArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4358 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4359 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4360 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4361 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4362 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4363 | PRINT_ER("driver is null\n"); |
| 4364 | return -EFAULT; |
| 4365 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4366 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4367 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4368 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4369 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4370 | msg.body.remain_on_ch.u16Channel = chan; |
| 4371 | msg.body.remain_on_ch.pRemainOnChanExpired = RemainOnChanExpired; |
| 4372 | msg.body.remain_on_ch.pRemainOnChanReady = RemainOnChanReady; |
| 4373 | msg.body.remain_on_ch.pVoid = pvUserArg; |
| 4374 | msg.body.remain_on_ch.u32duration = u32duration; |
| 4375 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4376 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4377 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4378 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4379 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4380 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4381 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4382 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4383 | } |
| 4384 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4385 | s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4386 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4387 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4388 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4389 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4390 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4391 | PRINT_ER("driver is null\n"); |
| 4392 | return -EFAULT; |
| 4393 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4394 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4395 | del_timer(&hif_drv->hRemainOnChannel); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4396 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4397 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4398 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4399 | msg.drv = hif_drv; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4400 | msg.body.remain_on_ch.u32ListenSessionID = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4401 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4402 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4403 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4404 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4405 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4406 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4407 | } |
| 4408 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4409 | 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] | 4410 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4411 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4412 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4413 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4414 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4415 | PRINT_ER("driver is null\n"); |
| 4416 | return -EFAULT; |
| 4417 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4418 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4419 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4420 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4421 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4422 | switch (u16FrameType) { |
| 4423 | case ACTION: |
| 4424 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4425 | msg.body.reg_frame.u8Regid = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4426 | break; |
| 4427 | |
| 4428 | case PROBE_REQ: |
| 4429 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4430 | msg.body.reg_frame.u8Regid = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4431 | break; |
| 4432 | |
| 4433 | default: |
| 4434 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 4435 | break; |
| 4436 | } |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 4437 | msg.body.reg_frame.u16FrameType = u16FrameType; |
| 4438 | msg.body.reg_frame.bReg = bReg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4439 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4440 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4441 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4442 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4443 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4444 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4445 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4446 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4447 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4448 | s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, |
| 4449 | u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, |
| 4450 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4451 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4452 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4453 | struct host_if_msg msg; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 4454 | struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4455 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4456 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4457 | PRINT_ER("driver is null\n"); |
| 4458 | return -EFAULT; |
| 4459 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4460 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4461 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4462 | |
| 4463 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 4464 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4465 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4466 | msg.drv = hif_drv; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 4467 | pstrSetBeaconParam->interval = u32Interval; |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 4468 | pstrSetBeaconParam->dtim_period = u32DTIMPeriod; |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 4469 | pstrSetBeaconParam->head_len = u32HeadLen; |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4470 | pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4471 | if (!pstrSetBeaconParam->head) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4472 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4473 | goto ERRORHANDLER; |
| 4474 | } |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 4475 | pstrSetBeaconParam->tail_len = u32TailLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4476 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4477 | if (u32TailLen > 0) { |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4478 | pstrSetBeaconParam->tail = kmemdup(pu8Tail, u32TailLen, |
| 4479 | GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4480 | if (!pstrSetBeaconParam->tail) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4481 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4482 | goto ERRORHANDLER; |
| 4483 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4484 | } else { |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 4485 | pstrSetBeaconParam->tail = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4486 | } |
| 4487 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4488 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4489 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4490 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4491 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4492 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4493 | if (result) { |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4494 | kfree(pstrSetBeaconParam->head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4495 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4496 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4497 | } |
| 4498 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4499 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4500 | } |
| 4501 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4502 | s32 host_int_del_beacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4503 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4504 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4505 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4506 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4507 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4508 | PRINT_ER("driver is null\n"); |
| 4509 | return -EFAULT; |
| 4510 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4511 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4512 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4513 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4514 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 4515 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4516 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4517 | if (result) |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 4518 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4519 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4520 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4521 | } |
| 4522 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4523 | s32 host_int_add_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4524 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4525 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4526 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4527 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4528 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4529 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4530 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4531 | PRINT_ER("driver is null\n"); |
| 4532 | return -EFAULT; |
| 4533 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4534 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4535 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4536 | |
| 4537 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 4538 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4539 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4540 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4541 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4542 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4543 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4544 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 4545 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4546 | if (!rates) |
| 4547 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4548 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4549 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 4550 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4551 | } |
| 4552 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4553 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4554 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4555 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4556 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4557 | } |
| 4558 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4559 | s32 host_int_del_station(struct host_if_drv *hif_drv, const u8 *pu8MacAddr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4560 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4561 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4562 | struct host_if_msg msg; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 4563 | struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4564 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4565 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4566 | PRINT_ER("driver is null\n"); |
| 4567 | return -EFAULT; |
| 4568 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4569 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4570 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4571 | |
| 4572 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 4573 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4574 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4575 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4576 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4577 | if (!pu8MacAddr) |
Punit Vara | 0bc8524 | 2015-10-29 01:53:30 +0530 | [diff] [blame] | 4578 | eth_broadcast_addr(pstrDelStationMsg->mac_addr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4579 | else |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 4580 | memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4581 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4582 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4583 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4584 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4585 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4586 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4587 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4588 | s32 host_int_del_allstation(struct host_if_drv *hif_drv, |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 4589 | u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4590 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4591 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4592 | struct host_if_msg msg; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 4593 | struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4594 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4595 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4596 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4597 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4598 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4599 | PRINT_ER("driver is null\n"); |
| 4600 | return -EFAULT; |
| 4601 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4602 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4603 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4604 | |
| 4605 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 4606 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4607 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4608 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4609 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4610 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 4611 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 4612 | memcpy(pstrDelAllStationMsg->del_all_sta[i], pu8MacAddr[i], ETH_ALEN); |
| 4613 | PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", |
| 4614 | pstrDelAllStationMsg->del_all_sta[i][0], |
| 4615 | pstrDelAllStationMsg->del_all_sta[i][1], |
| 4616 | pstrDelAllStationMsg->del_all_sta[i][2], |
| 4617 | pstrDelAllStationMsg->del_all_sta[i][3], |
| 4618 | pstrDelAllStationMsg->del_all_sta[i][4], |
| 4619 | pstrDelAllStationMsg->del_all_sta[i][5]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4620 | u8AssocNumb++; |
| 4621 | } |
| 4622 | } |
| 4623 | if (!u8AssocNumb) { |
| 4624 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4625 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4626 | } |
| 4627 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 4628 | pstrDelAllStationMsg->assoc_sta = u8AssocNumb; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4629 | 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] | 4630 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4631 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4632 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4633 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4634 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4635 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4636 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4637 | } |
| 4638 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4639 | s32 host_int_edit_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4640 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4641 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4642 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4643 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4644 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4645 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4646 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4647 | PRINT_ER("driver is null\n"); |
| 4648 | return -EFAULT; |
| 4649 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4650 | |
| 4651 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 4652 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4653 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4654 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4655 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4656 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4657 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4658 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4659 | if (pstrAddStationMsg->u8NumRates > 0) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 4660 | u8 *rates = kmalloc(pstrAddStationMsg->u8NumRates, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 4661 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4662 | if (!rates) |
| 4663 | return -ENOMEM; |
| 4664 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4665 | memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); |
Arnd Bergmann | 057d1e9 | 2015-06-01 21:06:44 +0200 | [diff] [blame] | 4666 | pstrAddStationMsg->pu8Rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4667 | } |
| 4668 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4669 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4670 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4671 | PRINT_ER("wilc_mq_send fail\n"); |
| 4672 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4673 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4674 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4675 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4676 | s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv, |
| 4677 | bool bIsEnabled, |
| 4678 | u32 u32Timeout) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4679 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4680 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4681 | struct host_if_msg msg; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 4682 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4683 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4684 | 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] | 4685 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4686 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4687 | PRINT_ER("driver is null\n"); |
| 4688 | return -EFAULT; |
| 4689 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4690 | |
| 4691 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 4692 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4693 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4694 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4695 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4696 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4697 | |
Leo Kim | 33c70c1 | 2015-10-13 20:02:07 +0900 | [diff] [blame] | 4698 | pstrPowerMgmtParam->enabled = bIsEnabled; |
Leo Kim | 937918f | 2015-10-13 20:02:08 +0900 | [diff] [blame] | 4699 | pstrPowerMgmtParam->timeout = u32Timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4700 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4701 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4702 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4703 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4704 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4705 | } |
| 4706 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4707 | s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv, |
| 4708 | bool bIsEnabled, |
| 4709 | u32 u32count) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4710 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4711 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4712 | struct host_if_msg msg; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 4713 | struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4714 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4715 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4716 | PRINT_ER("driver is null\n"); |
| 4717 | return -EFAULT; |
| 4718 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4719 | |
| 4720 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 4721 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4722 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4723 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4724 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4725 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4726 | |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 4727 | pstrMulticastFilterParam->enabled = bIsEnabled; |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 4728 | pstrMulticastFilterParam->cnt = u32count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4729 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4730 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4731 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4732 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4733 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4734 | } |
| 4735 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4736 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 4737 | { |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4738 | struct join_bss_param *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4739 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4740 | u16 u16IEsLen; |
| 4741 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4742 | u8 suppRatesNo = 0; |
| 4743 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4744 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4745 | u8 pcipherCount; |
| 4746 | u8 authCount; |
| 4747 | u8 pcipherTotalCount = 0; |
| 4748 | u8 authTotalCount = 0; |
| 4749 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4750 | |
| 4751 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 4752 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 4753 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 4754 | pNewJoinBssParam = kzalloc(sizeof(struct join_bss_param), GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4755 | if (pNewJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4756 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 4757 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 4758 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4759 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4760 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Leo Kim | 619d27b | 2015-10-15 13:24:42 +0900 | [diff] [blame] | 4761 | pNewJoinBssParam->ssid_len = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4762 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 4763 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4764 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4765 | while (index < u16IEsLen) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4766 | if (pu8IEs[index] == SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4767 | suppRatesNo = pu8IEs[index + 1]; |
| 4768 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4769 | index += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4770 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4771 | for (i = 0; i < suppRatesNo; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4772 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4773 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4774 | index += suppRatesNo; |
| 4775 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4776 | } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4777 | extSuppRatesNo = pu8IEs[index + 1]; |
| 4778 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 4779 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 4780 | else |
| 4781 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 4782 | index += 2; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4783 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4784 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4785 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4786 | index += extSuppRatesNo; |
| 4787 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4788 | } else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4789 | pNewJoinBssParam->ht_capable = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4790 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4791 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4792 | } else if ((pu8IEs[index] == WMM_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4793 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4794 | (pu8IEs[index + 4] == 0xF2) && |
| 4795 | (pu8IEs[index + 5] == 0x02) && |
| 4796 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4797 | (pu8IEs[index + 7] == 0x01)) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4798 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4799 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4800 | if (pu8IEs[index + 8] & BIT(7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4801 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4802 | index += pu8IEs[index + 1] + 2; |
| 4803 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4804 | } else if ((pu8IEs[index] == P2P_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4805 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4806 | (pu8IEs[index + 4] == 0x9a) && |
| 4807 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4808 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4809 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4810 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 4811 | pNewJoinBssParam->noa_enabled = 1; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 4812 | pNewJoinBssParam->idx = pu8IEs[index + 9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4813 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4814 | if (pu8IEs[index + 10] & BIT(7)) { |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4815 | pNewJoinBssParam->opp_enabled = 1; |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 4816 | pNewJoinBssParam->ct_window = pu8IEs[index + 10]; |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4817 | } else { |
| 4818 | pNewJoinBssParam->opp_enabled = 0; |
| 4819 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4820 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4821 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4822 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4823 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4824 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 4825 | pNewJoinBssParam->cnt = pu8IEs[index + 11]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4826 | u16P2P_count = index + 12; |
| 4827 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 4828 | memcpy(pNewJoinBssParam->duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4829 | u16P2P_count += 4; |
| 4830 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 4831 | memcpy(pNewJoinBssParam->interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4832 | u16P2P_count += 4; |
| 4833 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 4834 | memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4835 | |
| 4836 | index += pu8IEs[index + 1] + 2; |
| 4837 | continue; |
| 4838 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4839 | } else if ((pu8IEs[index] == RSN_IE) || |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4840 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 4841 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 4842 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4843 | u16 rsnIndex = index; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4844 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4845 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 4846 | pNewJoinBssParam->mode_802_11i = 2; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4847 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4848 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 4849 | pNewJoinBssParam->mode_802_11i = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4850 | rsnIndex += 4; |
| 4851 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4852 | |
| 4853 | rsnIndex += 7; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4854 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 4855 | rsnIndex++; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4856 | jumpOffset = pu8IEs[rsnIndex] * 4; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4857 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4858 | rsnIndex += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4859 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4860 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4861 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4862 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4863 | pcipherTotalCount += pcipherCount; |
| 4864 | rsnIndex += jumpOffset; |
| 4865 | |
| 4866 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 4867 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4868 | authCount = (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 = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4872 | pNewJoinBssParam->rsn_auth_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 | authTotalCount += authCount; |
| 4875 | rsnIndex += jumpOffset; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4876 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4877 | if (pu8IEs[index] == RSN_IE) { |
| 4878 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 4879 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 4880 | rsnIndex += 2; |
| 4881 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 4882 | pNewJoinBssParam->rsn_found = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4883 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4884 | continue; |
| 4885 | } else |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4886 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4887 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4888 | } |
| 4889 | |
| 4890 | return (void *)pNewJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4891 | } |
| 4892 | |
| 4893 | void host_int_freeJoinParams(void *pJoinParams) |
| 4894 | { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4895 | if ((struct bss_param *)pJoinParams) |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4896 | kfree((struct bss_param *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4897 | else |
| 4898 | PRINT_ER("Unable to FREE null pointer\n"); |
| 4899 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4900 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4901 | 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] | 4902 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4903 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4904 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4905 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4906 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4907 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4908 | PRINT_ER("driver is null\n"); |
| 4909 | return -EFAULT; |
| 4910 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4911 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4912 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4913 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4914 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4915 | |
| 4916 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 4917 | pBASessionInfo->u8Ted = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4918 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4919 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4920 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4921 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4922 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4923 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4924 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4925 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4926 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4927 | } |
| 4928 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4929 | s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, |
| 4930 | char *pBSSID, |
| 4931 | char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4932 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4933 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4934 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4935 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4936 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4937 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4938 | PRINT_ER("driver is null\n"); |
| 4939 | return -EFAULT; |
| 4940 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4941 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4942 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4943 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4944 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4945 | |
| 4946 | memcpy(pBASessionInfo->au8Bssid, pBSSID, ETH_ALEN); |
| 4947 | pBASessionInfo->u8Ted = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4948 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4949 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4950 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4951 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4952 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4953 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4954 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4955 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4956 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4957 | } |
| 4958 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4959 | 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] | 4960 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4961 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4962 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4963 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4964 | return 0; |
| 4965 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4966 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4967 | PRINT_ER("driver is null\n"); |
| 4968 | return -EFAULT; |
| 4969 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4970 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4971 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4972 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4973 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4974 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 4975 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4976 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4977 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4978 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4979 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4980 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4981 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4982 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4983 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4984 | } |
| 4985 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4986 | 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] | 4987 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4988 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4989 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4990 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4991 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4992 | PRINT_ER("driver is null\n"); |
| 4993 | return -EFAULT; |
| 4994 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4995 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4996 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4997 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4998 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4999 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 5000 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5001 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 5002 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5003 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5004 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 5005 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5006 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5007 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5008 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5009 | } |