Chaehyun Lim | e215a87 | 2015-09-30 08:15:41 +0900 | [diff] [blame] | 1 | #include <linux/slab.h> |
| 2 | #include <linux/time.h> |
| 3 | #include <linux/kthread.h> |
| 4 | #include <linux/delay.h> |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5 | #include "host_interface.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 6 | #include "coreconfigurator.h" |
Chaehyun Lim | 5366012 | 2015-09-17 16:48:49 +0900 | [diff] [blame] | 7 | #include "wilc_wlan_if.h" |
Chaehyun Lim | f23eb98 | 2015-09-23 18:03:47 +0900 | [diff] [blame] | 8 | #include "wilc_msgqueue.h" |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 9 | #include <linux/etherdevice.h> |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 10 | #include "wilc_wfi_netdevice.h" |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 11 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 12 | extern u8 connecting; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 13 | |
Greg Kroah-Hartman | da711eb | 2015-08-14 19:46:06 -0700 | [diff] [blame] | 14 | extern struct timer_list hDuringIpTimer; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 15 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 16 | extern u8 g_wilc_initialized; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 17 | |
Chaehyun Lim | 9eac3a1 | 2015-06-18 22:08:51 +0900 | [diff] [blame] | 18 | #define HOST_IF_MSG_SCAN 0 |
| 19 | #define HOST_IF_MSG_CONNECT 1 |
| 20 | #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO 2 |
| 21 | #define HOST_IF_MSG_KEY 3 |
| 22 | #define HOST_IF_MSG_RCVD_NTWRK_INFO 4 |
| 23 | #define HOST_IF_MSG_RCVD_SCAN_COMPLETE 5 |
| 24 | #define HOST_IF_MSG_CFG_PARAMS 6 |
| 25 | #define HOST_IF_MSG_SET_CHANNEL 7 |
| 26 | #define HOST_IF_MSG_DISCONNECT 8 |
| 27 | #define HOST_IF_MSG_GET_RSSI 9 |
| 28 | #define HOST_IF_MSG_GET_CHNL 10 |
| 29 | #define HOST_IF_MSG_ADD_BEACON 11 |
| 30 | #define HOST_IF_MSG_DEL_BEACON 12 |
| 31 | #define HOST_IF_MSG_ADD_STATION 13 |
| 32 | #define HOST_IF_MSG_DEL_STATION 14 |
| 33 | #define HOST_IF_MSG_EDIT_STATION 15 |
| 34 | #define HOST_IF_MSG_SCAN_TIMER_FIRED 16 |
| 35 | #define HOST_IF_MSG_CONNECT_TIMER_FIRED 17 |
| 36 | #define HOST_IF_MSG_POWER_MGMT 18 |
| 37 | #define HOST_IF_MSG_GET_INACTIVETIME 19 |
| 38 | #define HOST_IF_MSG_REMAIN_ON_CHAN 20 |
| 39 | #define HOST_IF_MSG_REGISTER_FRAME 21 |
| 40 | #define HOST_IF_MSG_LISTEN_TIMER_FIRED 22 |
| 41 | #define HOST_IF_MSG_GET_LINKSPEED 23 |
| 42 | #define HOST_IF_MSG_SET_WFIDRV_HANDLER 24 |
| 43 | #define HOST_IF_MSG_SET_MAC_ADDRESS 25 |
| 44 | #define HOST_IF_MSG_GET_MAC_ADDRESS 26 |
| 45 | #define HOST_IF_MSG_SET_OPERATION_MODE 27 |
| 46 | #define HOST_IF_MSG_SET_IPADDRESS 28 |
| 47 | #define HOST_IF_MSG_GET_IPADDRESS 29 |
| 48 | #define HOST_IF_MSG_FLUSH_CONNECT 30 |
| 49 | #define HOST_IF_MSG_GET_STATISTICS 31 |
| 50 | #define HOST_IF_MSG_SET_MULTICAST_FILTER 32 |
| 51 | #define HOST_IF_MSG_ADD_BA_SESSION 33 |
| 52 | #define HOST_IF_MSG_DEL_BA_SESSION 34 |
| 53 | #define HOST_IF_MSG_Q_IDLE 35 |
| 54 | #define HOST_IF_MSG_DEL_ALL_STA 36 |
| 55 | #define HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS 34 |
| 56 | #define HOST_IF_MSG_EXIT 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 57 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 58 | #define HOST_IF_SCAN_TIMEOUT 4000 |
| 59 | #define HOST_IF_CONNECT_TIMEOUT 9500 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 60 | |
Chaehyun Lim | e54d5b7 | 2015-06-18 22:08:50 +0900 | [diff] [blame] | 61 | #define BA_SESSION_DEFAULT_BUFFER_SIZE 16 |
| 62 | #define BA_SESSION_DEFAULT_TIMEOUT 1000 |
| 63 | #define BLOCK_ACK_REQ_SIZE 0x14 |
Leo Kim | 9f3295a | 2015-10-19 18:26:10 +0900 | [diff] [blame] | 64 | #define FALSE_FRMWR_CHANNEL 100 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 65 | |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 66 | struct cfg_param_attr { |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 67 | struct cfg_param_val cfg_attr_info; |
Tony Cho | 361ff84 | 2015-09-21 12:16:41 +0900 | [diff] [blame] | 68 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 69 | |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 70 | struct host_if_wpa_attr { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 71 | u8 *key; |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 72 | const u8 *mac_addr; |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 73 | u8 *seq; |
Leo Kim | dacc594 | 2015-10-13 19:49:33 +0900 | [diff] [blame] | 74 | u8 seq_len; |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 75 | u8 index; |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 76 | u8 key_len; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 77 | u8 mode; |
Leo Kim | 4372d3d | 2015-10-05 15:25:43 +0900 | [diff] [blame] | 78 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 79 | |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 80 | struct host_if_wep_attr { |
Tony Cho | e5538d3 | 2015-10-12 16:56:11 +0900 | [diff] [blame] | 81 | u8 *key; |
Tony Cho | d520e35 | 2015-10-12 16:56:12 +0900 | [diff] [blame] | 82 | u8 key_len; |
Tony Cho | 259b3aa | 2015-10-12 16:56:13 +0900 | [diff] [blame] | 83 | u8 index; |
Tony Cho | b5eaff1 | 2015-10-12 16:56:14 +0900 | [diff] [blame] | 84 | u8 mode; |
Tony Cho | 7fa252e | 2015-10-12 16:56:15 +0900 | [diff] [blame] | 85 | enum AUTHTYPE auth_type; |
Leo Kim | c276c44 | 2015-10-05 15:25:42 +0900 | [diff] [blame] | 86 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 87 | |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 88 | union host_if_key_attr { |
Tony Cho | 2ed7a2f | 2015-10-12 16:56:08 +0900 | [diff] [blame] | 89 | struct host_if_wep_attr wep; |
Tony Cho | e3501a4 | 2015-10-12 16:56:09 +0900 | [diff] [blame] | 90 | struct host_if_wpa_attr wpa; |
Tony Cho | 610e386 | 2015-10-12 16:56:10 +0900 | [diff] [blame] | 91 | struct host_if_pmkid_attr pmkid; |
Leo Kim | 40cc2c9 | 2015-10-05 15:25:41 +0900 | [diff] [blame] | 92 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 93 | |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 94 | struct key_attr { |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 95 | enum KEY_TYPE type; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 96 | u8 action; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 97 | union host_if_key_attr attr; |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 98 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 99 | |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 100 | struct scan_attr { |
Leo Kim | 4256889 | 2015-10-13 19:49:37 +0900 | [diff] [blame] | 101 | u8 src; |
Leo Kim | 1e276c8 | 2015-10-13 19:49:38 +0900 | [diff] [blame] | 102 | u8 type; |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 103 | u8 *ch_freq_list; |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 104 | u8 ch_list_len; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 105 | u8 *ies; |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 106 | size_t ies_len; |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 107 | wilc_scan_result result; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 108 | void *arg; |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 109 | struct hidden_network hidden_network; |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 110 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 111 | |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 112 | struct connect_attr { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 113 | u8 *bssid; |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 114 | u8 *ssid; |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 115 | size_t ssid_len; |
Leo Kim | 2ea158c | 2015-10-13 19:49:52 +0900 | [diff] [blame] | 116 | u8 *ies; |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 117 | size_t ies_len; |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 118 | u8 security; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 119 | wilc_connect_result result; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 120 | void *arg; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 121 | enum AUTHTYPE auth_type; |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 122 | u8 ch; |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 123 | void *params; |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 124 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 125 | |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 126 | struct rcvd_async_info { |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 127 | u8 *buffer; |
Leo Kim | f94f488 | 2015-10-13 19:50:01 +0900 | [diff] [blame] | 128 | u32 len; |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 129 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 130 | |
Tony Cho | 94bdfe4 | 2015-09-30 18:44:27 +0900 | [diff] [blame] | 131 | struct channel_attr { |
Leo Kim | 730ee05 | 2015-10-13 19:50:02 +0900 | [diff] [blame] | 132 | u8 set_ch; |
Tony Cho | 326b323 | 2015-09-21 12:16:42 +0900 | [diff] [blame] | 133 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 134 | |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 135 | struct beacon_attr { |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 136 | u32 interval; |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 137 | u32 dtim_period; |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 138 | u32 head_len; |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 139 | u8 *head; |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 140 | u32 tail_len; |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 141 | u8 *tail; |
Tony Cho | 902362b | 2015-09-21 12:16:44 +0900 | [diff] [blame] | 142 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 143 | |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 144 | struct set_multicast { |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 145 | bool enabled; |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 146 | u32 cnt; |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 147 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 148 | |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 149 | struct del_all_sta { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 150 | u8 del_all_sta[MAX_NUM_STA][ETH_ALEN]; |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 151 | u8 assoc_sta; |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 152 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 153 | |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 154 | struct del_sta { |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 155 | u8 mac_addr[ETH_ALEN]; |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 156 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 157 | |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 158 | struct power_mgmt_param { |
Leo Kim | 33c70c1 | 2015-10-13 20:02:07 +0900 | [diff] [blame] | 159 | bool enabled; |
Leo Kim | 937918f | 2015-10-13 20:02:08 +0900 | [diff] [blame] | 160 | u32 timeout; |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 161 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 162 | |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 163 | struct set_ip_addr { |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 164 | u8 *ip_addr; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 165 | u8 idx; |
Tony Cho | 15191ea | 2015-09-21 12:16:50 +0900 | [diff] [blame] | 166 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 167 | |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 168 | struct sta_inactive_t { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 169 | u8 mac[6]; |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 170 | }; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 171 | |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 172 | union message_body { |
Tony Cho | 4528bdb | 2015-09-30 18:44:20 +0900 | [diff] [blame] | 173 | struct scan_attr scan_info; |
Tony Cho | 3f50197 | 2015-09-30 18:44:21 +0900 | [diff] [blame] | 174 | struct connect_attr con_info; |
Tony Cho | 02d1946 | 2015-09-30 18:44:22 +0900 | [diff] [blame] | 175 | struct rcvd_net_info net_info; |
Tony Cho | 66add62 | 2015-09-30 18:44:23 +0900 | [diff] [blame] | 176 | struct rcvd_async_info async_info; |
Tony Cho | 18990bf | 2015-09-30 18:44:24 +0900 | [diff] [blame] | 177 | struct key_attr key_info; |
Tony Cho | a2340c3 | 2015-09-30 18:44:25 +0900 | [diff] [blame] | 178 | struct cfg_param_attr cfg_info; |
Tony Cho | ffd6dbc | 2015-09-30 18:44:28 +0900 | [diff] [blame] | 179 | struct channel_attr channel_info; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 180 | struct beacon_attr beacon_info; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 181 | struct add_sta_param add_sta_info; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 182 | struct del_sta del_sta_info; |
Tony Cho | 4a93096 | 2015-09-30 18:44:34 +0900 | [diff] [blame] | 183 | struct add_sta_param edit_sta_info; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 184 | struct power_mgmt_param pwr_mgmt_info; |
Tony Cho | 66bac7f | 2015-09-30 18:44:37 +0900 | [diff] [blame] | 185 | struct sta_inactive_t mac_info; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 186 | struct set_ip_addr ip_info; |
Tony Cho | 5e4377e | 2015-09-30 18:44:38 +0900 | [diff] [blame] | 187 | struct drv_handler drv; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 188 | struct set_multicast multicast_info; |
Tony Cho | 00c4630 | 2015-09-30 18:55:06 +0900 | [diff] [blame] | 189 | struct op_mode mode; |
Tony Cho | 15326e2 | 2015-09-30 18:55:07 +0900 | [diff] [blame] | 190 | struct set_mac_addr set_mac_info; |
Tony Cho | a584869 | 2015-09-30 18:55:08 +0900 | [diff] [blame] | 191 | struct get_mac_addr get_mac_info; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 192 | struct ba_session_info session_info; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 193 | struct remain_ch remain_on_ch; |
Tony Cho | 5c4008d | 2015-10-05 13:50:44 +0900 | [diff] [blame] | 194 | struct reg_frame reg_frame; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 195 | char *data; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 196 | struct del_all_sta del_all_sta_info; |
Tony Cho | dfc7663 | 2015-09-21 12:16:34 +0900 | [diff] [blame] | 197 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 198 | |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 199 | struct host_if_msg { |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 200 | u16 id; |
| 201 | union message_body body; |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 202 | struct host_if_drv *drv; |
Tony Cho | 3a8c41b | 2015-09-18 18:11:04 +0900 | [diff] [blame] | 203 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 204 | |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 205 | struct join_bss_param { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 206 | BSSTYPE_T bss_type; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 207 | u8 dtim_period; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 208 | u16 beacon_period; |
| 209 | u16 cap_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 210 | u8 au8bssid[6]; |
Dean Lee | 576917a | 2015-06-15 11:58:57 +0900 | [diff] [blame] | 211 | char ssid[MAX_SSID_LEN]; |
Leo Kim | 619d27b | 2015-10-15 13:24:42 +0900 | [diff] [blame] | 212 | u8 ssid_len; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 213 | u8 supp_rates[MAX_RATES_SUPPORTED + 1]; |
| 214 | u8 ht_capable; |
| 215 | u8 wmm_cap; |
| 216 | u8 uapsd_cap; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 217 | bool rsn_found; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 218 | u8 rsn_grp_policy; |
| 219 | u8 mode_802_11i; |
| 220 | u8 rsn_pcip_policy[3]; |
| 221 | u8 rsn_auth_policy[3]; |
| 222 | u8 rsn_cap[2]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 223 | u32 tsf; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 224 | u8 noa_enabled; |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 225 | u8 opp_enabled; |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 226 | u8 ct_window; |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 227 | u8 cnt; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 228 | u8 idx; |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 229 | u8 duration[4]; |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 230 | u8 interval[4]; |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 231 | u8 start_time[4]; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 232 | }; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 233 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 234 | static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1]; |
| 235 | struct host_if_drv *terminated_handle; |
Leo Kim | f2fc9f6 | 2015-10-13 19:49:47 +0900 | [diff] [blame] | 236 | bool g_obtainingIP; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 237 | u8 P2P_LISTEN_STATE; |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 238 | static struct task_struct *hif_thread_handler; |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 239 | static WILC_MsgQueueHandle hif_msg_q; |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 240 | static struct semaphore hif_sema_thread; |
kbuild test robot | 413f930 | 2015-10-15 14:07:41 +0800 | [diff] [blame] | 241 | static struct semaphore hif_sema_driver; |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 242 | static struct semaphore hif_sema_wait_response; |
kbuild test robot | 1722500 | 2015-10-15 14:21:32 +0800 | [diff] [blame] | 243 | static struct semaphore hif_sema_deinit; |
kbuild test robot | 24aadb8 | 2015-10-15 14:32:40 +0800 | [diff] [blame] | 244 | static struct timer_list periodic_rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 245 | |
Leo Kim | fb70e9f | 2015-11-05 14:36:09 +0900 | [diff] [blame] | 246 | u8 multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 247 | |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 248 | static u8 rcv_assoc_resp[MAX_ASSOC_RESP_FRAME_SIZE]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 249 | |
kbuild test robot | f64321c | 2015-10-15 14:46:26 +0800 | [diff] [blame] | 250 | static bool scan_while_connected; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 251 | |
Leo Kim | 144b7b2 | 2015-10-15 13:25:01 +0900 | [diff] [blame] | 252 | static s8 rssi; |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 253 | static s8 link_speed; |
Leo Kim | 95ebb0f | 2015-10-15 13:25:03 +0900 | [diff] [blame] | 254 | static u8 ch_no; |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 255 | static u8 set_ip[2][4]; |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 256 | static u8 get_ip[2][4]; |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 257 | static u32 inactive_time; |
Leo Kim | a74c7bf | 2015-10-15 13:25:07 +0900 | [diff] [blame] | 258 | static u8 del_beacon; |
Leo Kim | 7178aed | 2015-10-19 18:26:09 +0900 | [diff] [blame] | 259 | static u32 clients_count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 260 | |
kbuild test robot | ef59919 | 2015-10-15 15:04:15 +0800 | [diff] [blame] | 261 | static u8 *join_req; |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 262 | u8 *info_element; |
kbuild test robot | 23047d5 | 2015-10-15 15:18:34 +0800 | [diff] [blame] | 263 | static u8 mode_11i; |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 264 | u8 auth_type; |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 265 | u32 join_req_size; |
kbuild test robot | 5e0e7c2 | 2015-10-15 15:47:44 +0800 | [diff] [blame] | 266 | static u32 info_element_size; |
kbuild test robot | 23fba59 | 2015-10-15 15:59:53 +0800 | [diff] [blame] | 267 | static struct host_if_drv *join_req_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 268 | #define REAL_JOIN_REQ 0 |
| 269 | #define FLUSHED_JOIN_REQ 1 |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 270 | #define FLUSHED_BYTE_POS 79 |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 271 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 272 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 273 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 274 | extern int linux_wlan_get_num_conn_ifcs(void); |
| 275 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 276 | static int add_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 277 | { |
| 278 | int i; |
| 279 | |
| 280 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 281 | if (!wfidrv_list[i]) { |
| 282 | wfidrv_list[i] = handler; |
| 283 | return 0; |
| 284 | } |
| 285 | } |
| 286 | |
| 287 | return -ENOBUFS; |
| 288 | } |
| 289 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 290 | static int remove_handler_in_list(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 291 | { |
| 292 | int i; |
| 293 | |
| 294 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 295 | if (wfidrv_list[i] == handler) { |
| 296 | wfidrv_list[i] = NULL; |
| 297 | return 0; |
| 298 | } |
| 299 | } |
| 300 | |
| 301 | return -EINVAL; |
| 302 | } |
| 303 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 304 | static int get_id_from_handler(struct host_if_drv *handler) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 305 | { |
| 306 | int i; |
| 307 | |
| 308 | if (!handler) |
| 309 | return 0; |
| 310 | |
| 311 | for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) { |
| 312 | if (wfidrv_list[i] == handler) |
| 313 | return i; |
| 314 | } |
| 315 | |
| 316 | return 0; |
| 317 | } |
| 318 | |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 319 | static struct host_if_drv *get_handler_from_id(int id) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 320 | { |
Dan Carpenter | 6ae9ac0 | 2015-09-15 09:54:33 +0300 | [diff] [blame] | 321 | if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list)) |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 322 | return NULL; |
| 323 | return wfidrv_list[id]; |
| 324 | } |
| 325 | |
Leo Kim | 3eec50c | 2015-11-06 11:20:03 +0900 | [diff] [blame] | 326 | static s32 handle_set_channel(struct host_if_drv *hif_drv, |
Leo Kim | 9cf7878 | 2015-10-29 12:05:54 +0900 | [diff] [blame] | 327 | struct channel_attr *hif_set_ch) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 328 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 329 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 330 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 331 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 332 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 333 | wid.type = WID_CHAR; |
Leo Kim | 9cf7878 | 2015-10-29 12:05:54 +0900 | [diff] [blame] | 334 | wid.val = (char *)&hif_set_ch->set_ch; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 335 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 336 | |
| 337 | PRINT_D(HOSTINF_DBG, "Setting channel\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 338 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 339 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 340 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 341 | |
| 342 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 343 | PRINT_ER("Failed to set channel\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 344 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 345 | } |
| 346 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 347 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 348 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 349 | |
Leo Kim | 23f2bad | 2015-11-06 11:20:04 +0900 | [diff] [blame] | 350 | static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv, |
| 351 | struct drv_handler *hif_drv_handler) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 352 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 353 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 354 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 355 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 356 | wid.id = (u16)WID_SET_DRV_HANDLER; |
| 357 | wid.type = WID_INT; |
Leo Kim | 6b73c74 | 2015-10-29 12:05:55 +0900 | [diff] [blame] | 358 | wid.val = (s8 *)&hif_drv_handler->handler; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 359 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 360 | |
Leo Kim | 6b73c74 | 2015-10-29 12:05:55 +0900 | [diff] [blame] | 361 | result = send_config_pkt(SET_CFG, &wid, 1, hif_drv_handler->handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 362 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 363 | if (!hif_drv) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 364 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 365 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 366 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 367 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 368 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 369 | } |
| 370 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 371 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 372 | } |
| 373 | |
Leo Kim | 97b5c59 | 2015-11-06 11:20:05 +0900 | [diff] [blame] | 374 | static s32 handle_set_operation_mode(struct host_if_drv *hif_drv, |
| 375 | struct op_mode *hif_op_mode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 376 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 377 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 378 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 379 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 380 | wid.id = (u16)WID_SET_OPERATION_MODE; |
| 381 | wid.type = WID_INT; |
Leo Kim | acff1d7 | 2015-10-29 12:05:56 +0900 | [diff] [blame] | 382 | wid.val = (s8 *)&hif_op_mode->mode; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 383 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 384 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 385 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 386 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 387 | |
Leo Kim | acff1d7 | 2015-10-29 12:05:56 +0900 | [diff] [blame] | 388 | if ((hif_op_mode->mode) == IDLE_MODE) |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 389 | up(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 390 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 391 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 392 | PRINT_ER("Failed to set driver handler\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 393 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 394 | } |
| 395 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 396 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 397 | } |
| 398 | |
Leo Kim | a6e6d48 | 2015-11-06 11:20:06 +0900 | [diff] [blame] | 399 | s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 400 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 401 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 402 | struct wid wid; |
Leo Kim | ebc57d1 | 2015-11-05 14:36:03 +0900 | [diff] [blame] | 403 | char firmware_ip_addr[4] = {0}; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 404 | |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 405 | if (ip_addr[0] < 192) |
| 406 | ip_addr[0] = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 407 | |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 408 | PRINT_INFO(HOSTINF_DBG, "Indx = %d, Handling set IP = %pI4\n", |
| 409 | idx, ip_addr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 410 | |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 411 | memcpy(set_ip[idx], ip_addr, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 412 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 413 | wid.id = (u16)WID_IP_ADDRESS; |
| 414 | wid.type = WID_STR; |
Leo Kim | a6527c3 | 2015-11-05 14:36:02 +0900 | [diff] [blame] | 415 | wid.val = (u8 *)ip_addr; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 416 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 417 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 418 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 419 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 420 | |
Leo Kim | ebc57d1 | 2015-11-05 14:36:03 +0900 | [diff] [blame] | 421 | host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 422 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 423 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 424 | PRINT_ER("Failed to set IP address\n"); |
| 425 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 426 | } |
| 427 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 428 | PRINT_INFO(HOSTINF_DBG, "IP address set\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 429 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 430 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 431 | } |
| 432 | |
Leo Kim | d451695 | 2015-11-06 11:20:07 +0900 | [diff] [blame] | 433 | s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 434 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 435 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 436 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 437 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 438 | wid.id = (u16)WID_IP_ADDRESS; |
| 439 | wid.type = WID_STR; |
| 440 | wid.val = kmalloc(IP_ALEN, GFP_KERNEL); |
| 441 | wid.size = IP_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 442 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 443 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 444 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 445 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 446 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 447 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 448 | memcpy(get_ip[idx], wid.val, IP_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 449 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 450 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 451 | |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 452 | if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0) |
Leo Kim | 078b1e9 | 2015-10-15 13:25:04 +0900 | [diff] [blame] | 453 | host_int_setup_ipaddress(hif_drv, set_ip[idx], idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 454 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 455 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 456 | PRINT_ER("Failed to get IP address\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 457 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 458 | } |
| 459 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 460 | PRINT_INFO(HOSTINF_DBG, "IP address retrieved:: u8IfIdx = %d\n", idx); |
Leo Kim | 1e75d01 | 2015-10-15 13:25:05 +0900 | [diff] [blame] | 461 | PRINT_INFO(HOSTINF_DBG, "%pI4\n", get_ip[idx]); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 462 | PRINT_INFO(HOSTINF_DBG, "\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 463 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 464 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 465 | } |
| 466 | |
Leo Kim | a826742 | 2015-11-06 11:20:08 +0900 | [diff] [blame] | 467 | static s32 handle_set_mac_address(struct host_if_drv *hif_drv, |
| 468 | struct set_mac_addr *set_mac_addr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 469 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 470 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 471 | struct wid wid; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 472 | u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 473 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 474 | if (!mac_buf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 475 | PRINT_ER("No buffer to send mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 476 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 477 | } |
Leo Kim | 090dbb1 | 2015-11-05 14:36:05 +0900 | [diff] [blame] | 478 | memcpy(mac_buf, set_mac_addr->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 479 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 480 | wid.id = (u16)WID_MAC_ADDR; |
| 481 | wid.type = WID_STR; |
| 482 | wid.val = mac_buf; |
| 483 | wid.size = ETH_ALEN; |
| 484 | PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 485 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 486 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 487 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 488 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 489 | PRINT_ER("Failed to set mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 490 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 491 | } |
| 492 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 493 | kfree(mac_buf); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 494 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 495 | } |
| 496 | |
Leo Kim | b3bf8fd | 2015-11-06 11:20:09 +0900 | [diff] [blame] | 497 | static s32 handle_get_mac_address(struct host_if_drv *hif_drv, |
| 498 | struct get_mac_addr *get_mac_addr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 499 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 500 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 501 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 502 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 503 | wid.id = (u16)WID_MAC_ADDR; |
| 504 | wid.type = WID_STR; |
Leo Kim | 7f0ee9a | 2015-11-05 14:36:06 +0900 | [diff] [blame] | 505 | wid.val = get_mac_addr->mac_addr; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 506 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 507 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 508 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 509 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 510 | |
| 511 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 512 | PRINT_ER("Failed to get mac address\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 513 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 514 | } |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 515 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 516 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 517 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 518 | } |
| 519 | |
Leo Kim | dc27666 | 2015-11-06 11:20:10 +0900 | [diff] [blame^] | 520 | static s32 handle_cfg_param(struct host_if_drv *hif_drv, |
| 521 | struct cfg_param_attr *cfg_param_attr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 522 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 523 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 524 | struct wid strWIDList[32]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 525 | u8 u8WidCnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 526 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 527 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 528 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 529 | PRINT_D(HOSTINF_DBG, "Setting CFG params\n"); |
| 530 | |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 531 | if (cfg_param_attr->cfg_attr_info.flag & BSS_TYPE) { |
| 532 | if (cfg_param_attr->cfg_attr_info.bss_type < 6) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 533 | strWIDList[u8WidCnt].id = WID_BSS_TYPE; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 534 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.bss_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 535 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 536 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 537 | hif_drv->cfg_values.bss_type = (u8)cfg_param_attr->cfg_attr_info.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 538 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 539 | PRINT_ER("check value 6 over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 540 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 541 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 542 | } |
| 543 | u8WidCnt++; |
| 544 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 545 | if (cfg_param_attr->cfg_attr_info.flag & AUTH_TYPE) { |
| 546 | if (cfg_param_attr->cfg_attr_info.auth_type == 1 || |
| 547 | cfg_param_attr->cfg_attr_info.auth_type == 2 || |
| 548 | cfg_param_attr->cfg_attr_info.auth_type == 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 549 | strWIDList[u8WidCnt].id = WID_AUTH_TYPE; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 550 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 551 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 552 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 553 | hif_drv->cfg_values.auth_type = (u8)cfg_param_attr->cfg_attr_info.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 554 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 555 | PRINT_ER("Impossible value \n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 556 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 557 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 558 | } |
| 559 | u8WidCnt++; |
| 560 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 561 | if (cfg_param_attr->cfg_attr_info.flag & AUTHEN_TIMEOUT) { |
| 562 | if (cfg_param_attr->cfg_attr_info.auth_timeout > 0 && |
| 563 | cfg_param_attr->cfg_attr_info.auth_timeout < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 564 | strWIDList[u8WidCnt].id = WID_AUTH_TIMEOUT; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 565 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.auth_timeout; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 566 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 567 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 568 | hif_drv->cfg_values.auth_timeout = cfg_param_attr->cfg_attr_info.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 569 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 570 | PRINT_ER("Range(1 ~ 65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 571 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 572 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 573 | } |
| 574 | u8WidCnt++; |
| 575 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 576 | if (cfg_param_attr->cfg_attr_info.flag & POWER_MANAGEMENT) { |
| 577 | if (cfg_param_attr->cfg_attr_info.power_mgmt_mode < 5) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 578 | strWIDList[u8WidCnt].id = WID_POWER_MANAGEMENT; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 579 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.power_mgmt_mode; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 580 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 581 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 582 | hif_drv->cfg_values.power_mgmt_mode = (u8)cfg_param_attr->cfg_attr_info.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 583 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 584 | PRINT_ER("Invalide power mode\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 585 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 586 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 587 | } |
| 588 | u8WidCnt++; |
| 589 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 590 | if (cfg_param_attr->cfg_attr_info.flag & RETRY_SHORT) { |
| 591 | if (cfg_param_attr->cfg_attr_info.short_retry_limit > 0 && |
| 592 | cfg_param_attr->cfg_attr_info.short_retry_limit < 256) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 593 | strWIDList[u8WidCnt].id = WID_SHORT_RETRY_LIMIT; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 594 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_retry_limit; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 595 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 596 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 597 | hif_drv->cfg_values.short_retry_limit = cfg_param_attr->cfg_attr_info.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 598 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 599 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 600 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 601 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 602 | } |
| 603 | u8WidCnt++; |
| 604 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 605 | if (cfg_param_attr->cfg_attr_info.flag & RETRY_LONG) { |
| 606 | if (cfg_param_attr->cfg_attr_info.long_retry_limit > 0 && |
| 607 | cfg_param_attr->cfg_attr_info.long_retry_limit < 256) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 608 | strWIDList[u8WidCnt].id = WID_LONG_RETRY_LIMIT; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 609 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 610 | |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 611 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 612 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 613 | hif_drv->cfg_values.long_retry_limit = cfg_param_attr->cfg_attr_info.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 614 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 615 | PRINT_ER("Range(1~256) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 616 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 617 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 618 | } |
| 619 | u8WidCnt++; |
| 620 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 621 | if (cfg_param_attr->cfg_attr_info.flag & FRAG_THRESHOLD) { |
| 622 | if (cfg_param_attr->cfg_attr_info.frag_threshold > 255 && |
| 623 | cfg_param_attr->cfg_attr_info.frag_threshold < 7937) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 624 | strWIDList[u8WidCnt].id = WID_FRAG_THRESHOLD; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 625 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.frag_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 626 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 627 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 628 | hif_drv->cfg_values.frag_threshold = cfg_param_attr->cfg_attr_info.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 629 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 630 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 631 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 632 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 633 | } |
| 634 | u8WidCnt++; |
| 635 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 636 | if (cfg_param_attr->cfg_attr_info.flag & RTS_THRESHOLD) { |
| 637 | if (cfg_param_attr->cfg_attr_info.rts_threshold > 255 && |
| 638 | cfg_param_attr->cfg_attr_info.rts_threshold < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 639 | strWIDList[u8WidCnt].id = WID_RTS_THRESHOLD; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 640 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.rts_threshold; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 641 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 642 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 643 | hif_drv->cfg_values.rts_threshold = cfg_param_attr->cfg_attr_info.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 644 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 645 | PRINT_ER("Threshold Range fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 646 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 647 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 648 | } |
| 649 | u8WidCnt++; |
| 650 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 651 | if (cfg_param_attr->cfg_attr_info.flag & PREAMBLE) { |
| 652 | if (cfg_param_attr->cfg_attr_info.preamble_type < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 653 | strWIDList[u8WidCnt].id = WID_PREAMBLE; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 654 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.preamble_type; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 655 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 656 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 657 | hif_drv->cfg_values.preamble_type = cfg_param_attr->cfg_attr_info.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 658 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 659 | PRINT_ER("Preamle Range(0~2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 660 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 661 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 662 | } |
| 663 | u8WidCnt++; |
| 664 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 665 | if (cfg_param_attr->cfg_attr_info.flag & SHORT_SLOT_ALLOWED) { |
| 666 | if (cfg_param_attr->cfg_attr_info.short_slot_allowed < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 667 | strWIDList[u8WidCnt].id = WID_SHORT_SLOT_ALLOWED; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 668 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.short_slot_allowed; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 669 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 670 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 671 | hif_drv->cfg_values.short_slot_allowed = (u8)cfg_param_attr->cfg_attr_info.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 672 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 673 | PRINT_ER("Short slot(2) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 674 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 675 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 676 | } |
| 677 | u8WidCnt++; |
| 678 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 679 | if (cfg_param_attr->cfg_attr_info.flag & TXOP_PROT_DISABLE) { |
| 680 | if (cfg_param_attr->cfg_attr_info.txop_prot_disabled < 2) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 681 | strWIDList[u8WidCnt].id = WID_11N_TXOP_PROT_DISABLE; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 682 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.txop_prot_disabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 683 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 684 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 685 | hif_drv->cfg_values.txop_prot_disabled = (u8)cfg_param_attr->cfg_attr_info.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 686 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 687 | PRINT_ER("TXOP prot disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 688 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 689 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 690 | } |
| 691 | u8WidCnt++; |
| 692 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 693 | if (cfg_param_attr->cfg_attr_info.flag & BEACON_INTERVAL) { |
| 694 | if (cfg_param_attr->cfg_attr_info.beacon_interval > 0 && |
| 695 | cfg_param_attr->cfg_attr_info.beacon_interval < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 696 | strWIDList[u8WidCnt].id = WID_BEACON_INTERVAL; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 697 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.beacon_interval; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 698 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 699 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 700 | hif_drv->cfg_values.beacon_interval = cfg_param_attr->cfg_attr_info.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 701 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 702 | PRINT_ER("Beacon interval(1~65535) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 703 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 704 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 705 | } |
| 706 | u8WidCnt++; |
| 707 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 708 | if (cfg_param_attr->cfg_attr_info.flag & DTIM_PERIOD) { |
| 709 | if (cfg_param_attr->cfg_attr_info.dtim_period > 0 && |
| 710 | cfg_param_attr->cfg_attr_info.dtim_period < 256) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 711 | strWIDList[u8WidCnt].id = WID_DTIM_PERIOD; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 712 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.dtim_period; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 713 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 714 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 715 | hif_drv->cfg_values.dtim_period = cfg_param_attr->cfg_attr_info.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 716 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 717 | PRINT_ER("DTIM range(1~255) fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 718 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 719 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 720 | } |
| 721 | u8WidCnt++; |
| 722 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 723 | if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY) { |
| 724 | if (cfg_param_attr->cfg_attr_info.site_survey_enabled < 3) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 725 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 726 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_enabled; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 727 | strWIDList[u8WidCnt].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 728 | strWIDList[u8WidCnt].size = sizeof(char); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 729 | hif_drv->cfg_values.site_survey_enabled = (u8)cfg_param_attr->cfg_attr_info.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 730 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 731 | PRINT_ER("Site survey disable\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 732 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 733 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 734 | } |
| 735 | u8WidCnt++; |
| 736 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 737 | if (cfg_param_attr->cfg_attr_info.flag & SITE_SURVEY_SCAN_TIME) { |
| 738 | if (cfg_param_attr->cfg_attr_info.site_survey_scan_time > 0 && |
| 739 | cfg_param_attr->cfg_attr_info.site_survey_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 740 | strWIDList[u8WidCnt].id = WID_SITE_SURVEY_SCAN_TIME; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 741 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.site_survey_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 742 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 743 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 744 | hif_drv->cfg_values.site_survey_scan_time = cfg_param_attr->cfg_attr_info.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 745 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 746 | PRINT_ER("Site survey scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 747 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 748 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 749 | } |
| 750 | u8WidCnt++; |
| 751 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 752 | if (cfg_param_attr->cfg_attr_info.flag & ACTIVE_SCANTIME) { |
| 753 | if (cfg_param_attr->cfg_attr_info.active_scan_time > 0 && |
| 754 | cfg_param_attr->cfg_attr_info.active_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 755 | strWIDList[u8WidCnt].id = WID_ACTIVE_SCAN_TIME; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 756 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.active_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 757 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 758 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 759 | hif_drv->cfg_values.active_scan_time = cfg_param_attr->cfg_attr_info.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 760 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 761 | PRINT_ER("Active scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 762 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 763 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 764 | } |
| 765 | u8WidCnt++; |
| 766 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 767 | if (cfg_param_attr->cfg_attr_info.flag & PASSIVE_SCANTIME) { |
| 768 | if (cfg_param_attr->cfg_attr_info.passive_scan_time > 0 && |
| 769 | cfg_param_attr->cfg_attr_info.passive_scan_time < 65536) { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 770 | strWIDList[u8WidCnt].id = WID_PASSIVE_SCAN_TIME; |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 771 | strWIDList[u8WidCnt].val = (s8 *)&cfg_param_attr->cfg_attr_info.passive_scan_time; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 772 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 773 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 774 | hif_drv->cfg_values.passive_scan_time = cfg_param_attr->cfg_attr_info.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 775 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 776 | PRINT_ER("Passive scan time(1~65535) over\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 777 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 778 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 779 | } |
| 780 | u8WidCnt++; |
| 781 | } |
Leo Kim | 02ae2bd | 2015-11-05 14:36:07 +0900 | [diff] [blame] | 782 | if (cfg_param_attr->cfg_attr_info.flag & CURRENT_TX_RATE) { |
| 783 | enum CURRENT_TXRATE curr_tx_rate = cfg_param_attr->cfg_attr_info.curr_tx_rate; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 784 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 785 | if (curr_tx_rate == AUTORATE || curr_tx_rate == MBPS_1 |
| 786 | || curr_tx_rate == MBPS_2 || curr_tx_rate == MBPS_5_5 |
| 787 | || curr_tx_rate == MBPS_11 || curr_tx_rate == MBPS_6 |
| 788 | || curr_tx_rate == MBPS_9 || curr_tx_rate == MBPS_12 |
| 789 | || curr_tx_rate == MBPS_18 || curr_tx_rate == MBPS_24 |
| 790 | || 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] | 791 | strWIDList[u8WidCnt].id = WID_CURRENT_TX_RATE; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 792 | strWIDList[u8WidCnt].val = (s8 *)&curr_tx_rate; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 793 | strWIDList[u8WidCnt].type = WID_SHORT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 794 | strWIDList[u8WidCnt].size = sizeof(u16); |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 795 | hif_drv->cfg_values.curr_tx_rate = (u8)curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 796 | } else { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 797 | PRINT_ER("out of TX rate\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 798 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 799 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 800 | } |
| 801 | u8WidCnt++; |
| 802 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 803 | |
| 804 | result = send_config_pkt(SET_CFG, strWIDList, u8WidCnt, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 805 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 806 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 807 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 808 | PRINT_ER("Error in setting CFG params\n"); |
| 809 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 810 | ERRORHANDLER: |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 811 | up(&hif_drv->sem_cfg_values); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 812 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 813 | } |
| 814 | |
Leo Kim | 3b840e4 | 2015-11-05 14:36:08 +0900 | [diff] [blame] | 815 | static void Handle_wait_msg_q_empty(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 816 | { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 817 | g_wilc_initialized = 0; |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 818 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 819 | } |
| 820 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 821 | static s32 Handle_Scan(struct host_if_drv *hif_drv, |
Tony Cho | c476feb | 2015-09-21 12:16:36 +0900 | [diff] [blame] | 822 | struct scan_attr *pstrHostIFscanAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 823 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 824 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 825 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 826 | u32 u32WidsCount = 0; |
| 827 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 828 | u8 *pu8Buffer; |
| 829 | u8 valuesize = 0; |
| 830 | u8 *pu8HdnNtwrksWidVal = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 831 | |
| 832 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 833 | 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] | 834 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 835 | hif_drv->usr_scan_req.scan_result = pstrHostIFscanAttr->result; |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 836 | hif_drv->usr_scan_req.arg = pstrHostIFscanAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 837 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 838 | if ((hif_drv->hif_state >= HOST_IF_SCANNING) && |
| 839 | (hif_drv->hif_state < HOST_IF_CONNECTED)) { |
| 840 | PRINT_D(GENERIC_DBG, "Don't scan already in [%d] state\n", |
| 841 | hif_drv->hif_state); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 842 | PRINT_ER("Already scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 843 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 844 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 845 | } |
| 846 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 847 | if (g_obtainingIP || connecting) { |
| 848 | 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] | 849 | PRINT_ER("Don't do obss scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 850 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 851 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 852 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 853 | |
| 854 | PRINT_D(HOSTINF_DBG, "Setting SCAN params\n"); |
| 855 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 856 | hif_drv->usr_scan_req.rcvd_ch_cnt = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 857 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 858 | strWIDList[u32WidsCount].id = (u16)WID_SSID_PROBE_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 859 | strWIDList[u32WidsCount].type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 860 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 861 | for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) |
| 862 | valuesize += ((pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen) + 1); |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 863 | pu8HdnNtwrksWidVal = kmalloc(valuesize + 1, GFP_KERNEL); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 864 | strWIDList[u32WidsCount].val = pu8HdnNtwrksWidVal; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 865 | if (strWIDList[u32WidsCount].val) { |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 866 | pu8Buffer = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 867 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 868 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 869 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 870 | 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] | 871 | |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 872 | for (i = 0; i < pstrHostIFscanAttr->hidden_network.u8ssidnum; i++) { |
| 873 | *pu8Buffer++ = pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
| 874 | memcpy(pu8Buffer, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].pu8ssid, pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen); |
| 875 | pu8Buffer += pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo[i].u8ssidlen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 876 | } |
| 877 | |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 878 | strWIDList[u32WidsCount].size = (s32)(valuesize + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 879 | u32WidsCount++; |
| 880 | } |
| 881 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 882 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 883 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_PROBE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 884 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 885 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ies; |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 886 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ies_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 887 | u32WidsCount++; |
| 888 | } |
| 889 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 890 | strWIDList[u32WidsCount].id = WID_SCAN_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 891 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 892 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 893 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 894 | u32WidsCount++; |
| 895 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 896 | strWIDList[u32WidsCount].id = WID_SCAN_CHANNEL_LIST; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 897 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 898 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 899 | if (pstrHostIFscanAttr->ch_freq_list && |
| 900 | pstrHostIFscanAttr->ch_list_len > 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 901 | int i; |
| 902 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 903 | for (i = 0; i < pstrHostIFscanAttr->ch_list_len; i++) { |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 904 | if (pstrHostIFscanAttr->ch_freq_list[i] > 0) |
| 905 | pstrHostIFscanAttr->ch_freq_list[i] = pstrHostIFscanAttr->ch_freq_list[i] - 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 906 | } |
| 907 | } |
| 908 | |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 909 | strWIDList[u32WidsCount].val = pstrHostIFscanAttr->ch_freq_list; |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 910 | strWIDList[u32WidsCount].size = pstrHostIFscanAttr->ch_list_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 911 | u32WidsCount++; |
| 912 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 913 | strWIDList[u32WidsCount].id = WID_START_SCAN_REQ; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 914 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 915 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 916 | strWIDList[u32WidsCount].val = (s8 *)&pstrHostIFscanAttr->src; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 917 | u32WidsCount++; |
| 918 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 919 | if (hif_drv->hif_state == HOST_IF_CONNECTED) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 920 | scan_while_connected = true; |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 921 | else if (hif_drv->hif_state == HOST_IF_IDLE) |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 922 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 923 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 924 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 925 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 926 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 927 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 928 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 929 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 930 | PRINT_D(HOSTINF_DBG, "Successfully sent SCAN params config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 931 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 932 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 933 | if (result) { |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 934 | del_timer(&hif_drv->scan_timer); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 935 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 936 | } |
| 937 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 938 | kfree(pstrHostIFscanAttr->ch_freq_list); |
| 939 | pstrHostIFscanAttr->ch_freq_list = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 940 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 941 | kfree(pstrHostIFscanAttr->ies); |
| 942 | pstrHostIFscanAttr->ies = NULL; |
| 943 | kfree(pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo); |
| 944 | pstrHostIFscanAttr->hidden_network.pstrHiddenNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 945 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 946 | kfree(pu8HdnNtwrksWidVal); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 947 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 948 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 949 | } |
| 950 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 951 | static s32 Handle_ScanDone(struct host_if_drv *hif_drv, |
| 952 | enum scan_event enuEvent) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 953 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 954 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 955 | u8 u8abort_running_scan; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 956 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 957 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 958 | PRINT_D(HOSTINF_DBG, "in Handle_ScanDone()\n"); |
| 959 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 960 | if (enuEvent == SCAN_EVENT_ABORTED) { |
| 961 | PRINT_D(GENERIC_DBG, "Abort running scan\n"); |
| 962 | u8abort_running_scan = 1; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 963 | wid.id = (u16)WID_ABORT_RUNNING_SCAN; |
| 964 | wid.type = WID_CHAR; |
| 965 | wid.val = (s8 *)&u8abort_running_scan; |
| 966 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 967 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 968 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 969 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 970 | |
| 971 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 972 | PRINT_ER("Failed to set abort running scan\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 973 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 974 | } |
| 975 | } |
| 976 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 977 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 978 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 979 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 980 | } |
| 981 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 982 | if (hif_drv->usr_scan_req.scan_result) { |
| 983 | hif_drv->usr_scan_req.scan_result(enuEvent, NULL, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 984 | hif_drv->usr_scan_req.arg, NULL); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 985 | hif_drv->usr_scan_req.scan_result = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 986 | } |
| 987 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 988 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 989 | } |
| 990 | |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 991 | u8 u8ConnectedSSID[6] = {0}; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 992 | static s32 Handle_Connect(struct host_if_drv *hif_drv, |
Tony Cho | 120ae59 | 2015-09-21 12:16:37 +0900 | [diff] [blame] | 993 | struct connect_attr *pstrHostIFconnectAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 994 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 995 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 996 | struct wid strWIDList[8]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 997 | u32 u32WidsCount = 0, dummyval = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 998 | u8 *pu8CurrByte = NULL; |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 999 | struct join_bss_param *ptstrJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1000 | |
| 1001 | PRINT_D(GENERIC_DBG, "Handling connect request\n"); |
| 1002 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1003 | if (memcmp(pstrHostIFconnectAttr->bssid, u8ConnectedSSID, ETH_ALEN) == 0) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1004 | result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1005 | 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] | 1006 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1007 | } |
| 1008 | |
| 1009 | PRINT_INFO(HOSTINF_DBG, "Saving connection parameters in global structure\n"); |
| 1010 | |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 1011 | ptstrJoinBssParam = (struct join_bss_param *)pstrHostIFconnectAttr->params; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1012 | if (!ptstrJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1013 | PRINT_ER("Required BSSID not found\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1014 | result = -ENOENT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1015 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1016 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1017 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1018 | if (pstrHostIFconnectAttr->bssid) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1019 | hif_drv->usr_conn_req.pu8bssid = kmalloc(6, GFP_KERNEL); |
| 1020 | memcpy(hif_drv->usr_conn_req.pu8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1021 | } |
| 1022 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1023 | hif_drv->usr_conn_req.ssid_len = pstrHostIFconnectAttr->ssid_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1024 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1025 | hif_drv->usr_conn_req.pu8ssid = kmalloc(pstrHostIFconnectAttr->ssid_len + 1, GFP_KERNEL); |
| 1026 | memcpy(hif_drv->usr_conn_req.pu8ssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1027 | pstrHostIFconnectAttr->ssid, |
| 1028 | pstrHostIFconnectAttr->ssid_len); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1029 | hif_drv->usr_conn_req.pu8ssid[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1030 | } |
| 1031 | |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1032 | hif_drv->usr_conn_req.ies_len = pstrHostIFconnectAttr->ies_len; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1033 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1034 | hif_drv->usr_conn_req.ies = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
| 1035 | memcpy(hif_drv->usr_conn_req.ies, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1036 | pstrHostIFconnectAttr->ies, |
| 1037 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1038 | } |
| 1039 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1040 | hif_drv->usr_conn_req.u8security = pstrHostIFconnectAttr->security; |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1041 | hif_drv->usr_conn_req.auth_type = pstrHostIFconnectAttr->auth_type; |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1042 | hif_drv->usr_conn_req.conn_result = pstrHostIFconnectAttr->result; |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1043 | hif_drv->usr_conn_req.arg = pstrHostIFconnectAttr->arg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1044 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1045 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1046 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1047 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1048 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1049 | u32WidsCount++; |
| 1050 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1051 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1052 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1053 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1054 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1055 | u32WidsCount++; |
| 1056 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1057 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1058 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1059 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1060 | strWIDList[u32WidsCount].val = (s8 *)(&(dummyval)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1061 | u32WidsCount++; |
| 1062 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1063 | { |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1064 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1065 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1066 | strWIDList[u32WidsCount].val = hif_drv->usr_conn_req.ies; |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1067 | strWIDList[u32WidsCount].size = hif_drv->usr_conn_req.ies_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1068 | u32WidsCount++; |
| 1069 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1070 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1071 | info_element_size = hif_drv->usr_conn_req.ies_len; |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1072 | info_element = kmalloc(info_element_size, GFP_KERNEL); |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1073 | memcpy(info_element, hif_drv->usr_conn_req.ies, |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1074 | info_element_size); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1075 | } |
| 1076 | } |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1077 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1078 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1079 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1080 | strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1081 | u32WidsCount++; |
| 1082 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1083 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1084 | mode_11i = hif_drv->usr_conn_req.u8security; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1085 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1086 | 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] | 1087 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1088 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1089 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1090 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1091 | strWIDList[u32WidsCount].val = (s8 *)&hif_drv->usr_conn_req.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1092 | u32WidsCount++; |
| 1093 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1094 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1095 | auth_type = (u8)hif_drv->usr_conn_req.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1096 | |
Leo Kim | 7d06972 | 2015-10-29 12:05:37 +0900 | [diff] [blame] | 1097 | PRINT_INFO(HOSTINF_DBG, "Authentication Type = %x\n", |
| 1098 | hif_drv->usr_conn_req.auth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1099 | 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] | 1100 | hif_drv->usr_conn_req.pu8ssid, pstrHostIFconnectAttr->ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1101 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1102 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1103 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1104 | strWIDList[u32WidsCount].size = 112; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1105 | strWIDList[u32WidsCount].val = kmalloc(strWIDList[u32WidsCount].size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1106 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1107 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1108 | join_req_size = strWIDList[u32WidsCount].size; |
| 1109 | join_req = kmalloc(join_req_size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1110 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1111 | if (!strWIDList[u32WidsCount].val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1112 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1113 | goto ERRORHANDLER; |
| 1114 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1115 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1116 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1117 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1118 | if (pstrHostIFconnectAttr->ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 1119 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->ssid, pstrHostIFconnectAttr->ssid_len); |
| 1120 | pu8CurrByte[pstrHostIFconnectAttr->ssid_len] = '\0'; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1121 | } |
| 1122 | pu8CurrByte += MAX_SSID_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1123 | *(pu8CurrByte++) = INFRASTRUCTURE; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1124 | |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 1125 | if ((pstrHostIFconnectAttr->ch >= 1) && (pstrHostIFconnectAttr->ch <= 14)) { |
| 1126 | *(pu8CurrByte++) = pstrHostIFconnectAttr->ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1127 | } else { |
| 1128 | PRINT_ER("Channel out of range\n"); |
| 1129 | *(pu8CurrByte++) = 0xFF; |
| 1130 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1131 | *(pu8CurrByte++) = (ptstrJoinBssParam->cap_info) & 0xFF; |
| 1132 | *(pu8CurrByte++) = ((ptstrJoinBssParam->cap_info) >> 8) & 0xFF; |
| 1133 | PRINT_D(HOSTINF_DBG, "* Cap Info %0x*\n", (*(pu8CurrByte - 2) | ((*(pu8CurrByte - 1)) << 8))); |
| 1134 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1135 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1136 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1137 | pu8CurrByte += 6; |
| 1138 | |
Tony Cho | c0f52fb | 2015-10-20 17:10:46 +0900 | [diff] [blame] | 1139 | if (pstrHostIFconnectAttr->bssid) |
| 1140 | memcpy(pu8CurrByte, pstrHostIFconnectAttr->bssid, 6); |
| 1141 | pu8CurrByte += 6; |
| 1142 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1143 | *(pu8CurrByte++) = (ptstrJoinBssParam->beacon_period) & 0xFF; |
| 1144 | *(pu8CurrByte++) = ((ptstrJoinBssParam->beacon_period) >> 8) & 0xFF; |
| 1145 | 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] | 1146 | *(pu8CurrByte++) = ptstrJoinBssParam->dtim_period; |
| 1147 | PRINT_D(HOSTINF_DBG, "* DTIM Period %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1148 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1149 | memcpy(pu8CurrByte, ptstrJoinBssParam->supp_rates, MAX_RATES_SUPPORTED + 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1150 | pu8CurrByte += (MAX_RATES_SUPPORTED + 1); |
| 1151 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1152 | *(pu8CurrByte++) = ptstrJoinBssParam->wmm_cap; |
| 1153 | PRINT_D(HOSTINF_DBG, "* wmm cap%d*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1154 | *(pu8CurrByte++) = ptstrJoinBssParam->uapsd_cap; |
| 1155 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1156 | *(pu8CurrByte++) = ptstrJoinBssParam->ht_capable; |
Leo Kim | ff06982 | 2015-10-29 12:05:26 +0900 | [diff] [blame] | 1157 | hif_drv->usr_conn_req.ht_capable = ptstrJoinBssParam->ht_capable; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1158 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1159 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_found; |
| 1160 | PRINT_D(HOSTINF_DBG, "* rsn found %d*\n", *(pu8CurrByte - 1)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1161 | *(pu8CurrByte++) = ptstrJoinBssParam->rsn_grp_policy; |
| 1162 | PRINT_D(HOSTINF_DBG, "* rsn group policy %0x*\n", (*(pu8CurrByte - 1))); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1163 | *(pu8CurrByte++) = ptstrJoinBssParam->mode_802_11i; |
| 1164 | PRINT_D(HOSTINF_DBG, "* mode_802_11i %d*\n", (*(pu8CurrByte - 1))); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1165 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1166 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_pcip_policy, sizeof(ptstrJoinBssParam->rsn_pcip_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1167 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_pcip_policy); |
| 1168 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1169 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_auth_policy, sizeof(ptstrJoinBssParam->rsn_auth_policy)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1170 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_auth_policy); |
| 1171 | |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1172 | memcpy(pu8CurrByte, ptstrJoinBssParam->rsn_cap, sizeof(ptstrJoinBssParam->rsn_cap)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1173 | pu8CurrByte += sizeof(ptstrJoinBssParam->rsn_cap); |
| 1174 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1175 | *(pu8CurrByte++) = REAL_JOIN_REQ; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1176 | *(pu8CurrByte++) = ptstrJoinBssParam->noa_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1177 | |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 1178 | if (ptstrJoinBssParam->noa_enabled) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1179 | PRINT_D(HOSTINF_DBG, "NOA present\n"); |
| 1180 | |
| 1181 | *(pu8CurrByte++) = (ptstrJoinBssParam->tsf) & 0xFF; |
| 1182 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 8) & 0xFF; |
| 1183 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 16) & 0xFF; |
| 1184 | *(pu8CurrByte++) = ((ptstrJoinBssParam->tsf) >> 24) & 0xFF; |
| 1185 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1186 | *(pu8CurrByte++) = ptstrJoinBssParam->opp_enabled; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 1187 | *(pu8CurrByte++) = ptstrJoinBssParam->idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1188 | |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 1189 | if (ptstrJoinBssParam->opp_enabled) |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 1190 | *(pu8CurrByte++) = ptstrJoinBssParam->ct_window; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1191 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 1192 | *(pu8CurrByte++) = ptstrJoinBssParam->cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1193 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 1194 | memcpy(pu8CurrByte, ptstrJoinBssParam->duration, sizeof(ptstrJoinBssParam->duration)); |
| 1195 | pu8CurrByte += sizeof(ptstrJoinBssParam->duration); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1196 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 1197 | memcpy(pu8CurrByte, ptstrJoinBssParam->interval, sizeof(ptstrJoinBssParam->interval)); |
| 1198 | pu8CurrByte += sizeof(ptstrJoinBssParam->interval); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1199 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 1200 | memcpy(pu8CurrByte, ptstrJoinBssParam->start_time, sizeof(ptstrJoinBssParam->start_time)); |
| 1201 | pu8CurrByte += sizeof(ptstrJoinBssParam->start_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1202 | } else |
| 1203 | PRINT_D(HOSTINF_DBG, "NOA not present\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1204 | |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1205 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1206 | u32WidsCount++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1207 | |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 1208 | if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) { |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1209 | memcpy(join_req, pu8CurrByte, join_req_size); |
Leo Kim | 870515c | 2015-10-15 13:25:15 +0900 | [diff] [blame] | 1210 | join_req_drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1211 | } |
| 1212 | |
| 1213 | PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n"); |
| 1214 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1215 | if (pstrHostIFconnectAttr->bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1216 | memcpy(u8ConnectedSSID, pstrHostIFconnectAttr->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1217 | |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1218 | PRINT_D(GENERIC_DBG, "save Bssid = %pM\n", pstrHostIFconnectAttr->bssid); |
Alexander Kuleshov | 310a28f | 2015-09-04 00:48:14 +0600 | [diff] [blame] | 1219 | PRINT_D(GENERIC_DBG, "save bssid = %pM\n", u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1220 | } |
| 1221 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1222 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1223 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1224 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1225 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1226 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1227 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1228 | } else { |
| 1229 | PRINT_D(GENERIC_DBG, "set HOST_IF_WAITING_CONN_RESP\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1230 | hif_drv->hif_state = HOST_IF_WAITING_CONN_RESP; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1231 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1232 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1233 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1234 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1235 | tstrConnectInfo strConnectInfo; |
| 1236 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 1237 | del_timer(&hif_drv->connect_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1238 | |
| 1239 | PRINT_D(HOSTINF_DBG, "could not start connecting to the required network\n"); |
| 1240 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1241 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1242 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1243 | if (pstrHostIFconnectAttr->result) { |
| 1244 | if (pstrHostIFconnectAttr->bssid) |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 1245 | memcpy(strConnectInfo.au8bssid, pstrHostIFconnectAttr->bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1246 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1247 | if (pstrHostIFconnectAttr->ies) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 1248 | strConnectInfo.ReqIEsLen = pstrHostIFconnectAttr->ies_len; |
| 1249 | strConnectInfo.pu8ReqIEs = kmalloc(pstrHostIFconnectAttr->ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1250 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1251 | pstrHostIFconnectAttr->ies, |
| 1252 | pstrHostIFconnectAttr->ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1253 | } |
| 1254 | |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 1255 | pstrHostIFconnectAttr->result(CONN_DISCONN_EVENT_CONN_RESP, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1256 | &strConnectInfo, |
| 1257 | MAC_DISCONNECTED, |
| 1258 | NULL, |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 1259 | pstrHostIFconnectAttr->arg); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1260 | hif_drv->hif_state = HOST_IF_IDLE; |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1261 | kfree(strConnectInfo.pu8ReqIEs); |
| 1262 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1263 | |
| 1264 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1265 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1266 | } |
| 1267 | } |
| 1268 | |
| 1269 | PRINT_D(HOSTINF_DBG, "Deallocating connection parameters\n"); |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1270 | kfree(pstrHostIFconnectAttr->bssid); |
| 1271 | pstrHostIFconnectAttr->bssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1272 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1273 | kfree(pstrHostIFconnectAttr->ssid); |
| 1274 | pstrHostIFconnectAttr->ssid = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1275 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1276 | kfree(pstrHostIFconnectAttr->ies); |
| 1277 | pstrHostIFconnectAttr->ies = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1278 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1279 | kfree(pu8CurrByte); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1280 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1281 | } |
| 1282 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1283 | static s32 Handle_FlushConnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1284 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1285 | s32 result = 0; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1286 | struct wid strWIDList[5]; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1287 | u32 u32WidsCount = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1288 | u8 *pu8CurrByte = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1289 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1290 | strWIDList[u32WidsCount].id = WID_INFO_ELEMENT_ASSOCIATE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1291 | strWIDList[u32WidsCount].type = WID_BIN_DATA; |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1292 | strWIDList[u32WidsCount].val = info_element; |
Leo Kim | dfef7b8 | 2015-10-15 13:25:14 +0900 | [diff] [blame] | 1293 | strWIDList[u32WidsCount].size = info_element_size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1294 | u32WidsCount++; |
| 1295 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1296 | strWIDList[u32WidsCount].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1297 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1298 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 1bd9d44 | 2015-10-15 13:25:11 +0900 | [diff] [blame] | 1299 | strWIDList[u32WidsCount].val = (s8 *)(&(mode_11i)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1300 | u32WidsCount++; |
| 1301 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1302 | strWIDList[u32WidsCount].id = (u16)WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1303 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1304 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | fba4989 | 2015-10-15 13:25:12 +0900 | [diff] [blame] | 1305 | strWIDList[u32WidsCount].val = (s8 *)(&auth_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1306 | u32WidsCount++; |
| 1307 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1308 | strWIDList[u32WidsCount].id = (u16)WID_JOIN_REQ_EXTENDED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1309 | strWIDList[u32WidsCount].type = WID_STR; |
Leo Kim | 0626baa | 2015-10-15 13:25:13 +0900 | [diff] [blame] | 1310 | strWIDList[u32WidsCount].size = join_req_size; |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1311 | strWIDList[u32WidsCount].val = (s8 *)join_req; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1312 | pu8CurrByte = strWIDList[u32WidsCount].val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1313 | |
| 1314 | pu8CurrByte += FLUSHED_BYTE_POS; |
| 1315 | *(pu8CurrByte) = FLUSHED_JOIN_REQ; |
| 1316 | |
| 1317 | u32WidsCount++; |
| 1318 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1319 | result = send_config_pkt(SET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1320 | get_id_from_handler(join_req_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1321 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1322 | PRINT_ER("failed to send config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1323 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1324 | } |
| 1325 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1326 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1327 | } |
| 1328 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1329 | static s32 Handle_ConnectTimeout(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1330 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1331 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1332 | tstrConnectInfo strConnectInfo; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1333 | struct wid wid; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1334 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1335 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1336 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1337 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1338 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1339 | } |
| 1340 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1341 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1342 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1343 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1344 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1345 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1346 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1347 | if (hif_drv->usr_conn_req.conn_result) { |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1348 | if (hif_drv->usr_conn_req.pu8bssid) { |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1349 | memcpy(strConnectInfo.au8bssid, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1350 | hif_drv->usr_conn_req.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1351 | } |
| 1352 | |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1353 | if (hif_drv->usr_conn_req.ies) { |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1354 | strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ies_len; |
| 1355 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1356 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1357 | hif_drv->usr_conn_req.ies, |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1358 | hif_drv->usr_conn_req.ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1359 | } |
| 1360 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1361 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP, |
| 1362 | &strConnectInfo, |
| 1363 | MAC_DISCONNECTED, |
| 1364 | NULL, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1365 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1366 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1367 | kfree(strConnectInfo.pu8ReqIEs); |
| 1368 | strConnectInfo.pu8ReqIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1369 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1370 | PRINT_ER("Connect callback function pointer is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1371 | } |
| 1372 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1373 | wid.id = (u16)WID_DISCONNECT; |
| 1374 | wid.type = WID_CHAR; |
| 1375 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1376 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1377 | |
| 1378 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1379 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1380 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1381 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1382 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1383 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1384 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1385 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1386 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1387 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1388 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1389 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1390 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1391 | eth_zero_addr(u8ConnectedSSID); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1392 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1393 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1394 | kfree(join_req); |
| 1395 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1396 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1397 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1398 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1399 | kfree(info_element); |
| 1400 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1401 | } |
| 1402 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1403 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1404 | } |
| 1405 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1406 | static s32 Handle_RcvdNtwrkInfo(struct host_if_drv *hif_drv, |
Tony Cho | 3bbd59f | 2015-09-21 12:16:38 +0900 | [diff] [blame] | 1407 | struct rcvd_net_info *pstrRcvdNetworkInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1408 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1409 | u32 i; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1410 | bool bNewNtwrkFound; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1411 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1412 | tstrNetworkInfo *pstrNetworkInfo = NULL; |
| 1413 | void *pJoinParams = NULL; |
| 1414 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1415 | bNewNtwrkFound = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1416 | PRINT_INFO(HOSTINF_DBG, "Handling received network info\n"); |
| 1417 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1418 | if (hif_drv->usr_scan_req.scan_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1419 | PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network information received\n"); |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 1420 | parse_network_info(pstrRcvdNetworkInfo->buffer, &pstrNetworkInfo); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1421 | if ((!pstrNetworkInfo) || |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1422 | (!hif_drv->usr_scan_req.scan_result)) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1423 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1424 | result = -EINVAL; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1425 | goto done; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1426 | } |
| 1427 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1428 | for (i = 0; i < hif_drv->usr_scan_req.rcvd_ch_cnt; i++) { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1429 | if ((hif_drv->usr_scan_req.net_info[i].au8bssid) && |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1430 | (pstrNetworkInfo->au8bssid)) { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1431 | if (memcmp(hif_drv->usr_scan_req.net_info[i].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1432 | pstrNetworkInfo->au8bssid, 6) == 0) { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1433 | if (pstrNetworkInfo->s8rssi <= hif_drv->usr_scan_req.net_info[i].s8rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1434 | PRINT_D(HOSTINF_DBG, "Network previously discovered\n"); |
| 1435 | goto done; |
| 1436 | } else { |
Leo Kim | af973f3 | 2015-10-29 11:58:52 +0900 | [diff] [blame] | 1437 | hif_drv->usr_scan_req.net_info[i].s8rssi = pstrNetworkInfo->s8rssi; |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1438 | bNewNtwrkFound = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1439 | break; |
| 1440 | } |
| 1441 | } |
| 1442 | } |
| 1443 | } |
| 1444 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 1445 | if (bNewNtwrkFound) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1446 | PRINT_D(HOSTINF_DBG, "New network found\n"); |
| 1447 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1448 | if (hif_drv->usr_scan_req.rcvd_ch_cnt < MAX_NUM_SCANNED_NETWORKS) { |
| 1449 | hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].s8rssi = pstrNetworkInfo->s8rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1450 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1451 | if (hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].au8bssid && |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1452 | pstrNetworkInfo->au8bssid) { |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1453 | memcpy(hif_drv->usr_scan_req.net_info[hif_drv->usr_scan_req.rcvd_ch_cnt].au8bssid, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1454 | pstrNetworkInfo->au8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1455 | |
Leo Kim | f79756e | 2015-10-29 12:05:36 +0900 | [diff] [blame] | 1456 | hif_drv->usr_scan_req.rcvd_ch_cnt++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1457 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1458 | pstrNetworkInfo->bNewNetwork = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1459 | pJoinParams = host_int_ParseJoinBssParam(pstrNetworkInfo); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1460 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1461 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 1462 | hif_drv->usr_scan_req.arg, |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1463 | pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1464 | } |
| 1465 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1466 | PRINT_WRN(HOSTINF_DBG, "Discovered networks exceeded max. limit\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1467 | } |
| 1468 | } else { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1469 | pstrNetworkInfo->bNewNetwork = false; |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1470 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_NETWORK_FOUND, pstrNetworkInfo, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 1471 | hif_drv->usr_scan_req.arg, NULL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1472 | } |
| 1473 | } |
| 1474 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1475 | done: |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1476 | kfree(pstrRcvdNetworkInfo->buffer); |
| 1477 | pstrRcvdNetworkInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1478 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1479 | if (pstrNetworkInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1480 | DeallocateNetworkInfo(pstrNetworkInfo); |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 1481 | pstrNetworkInfo = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1482 | } |
| 1483 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1484 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1485 | } |
| 1486 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1487 | static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv, |
Tony Cho | f23a9ea | 2015-09-21 12:16:39 +0900 | [diff] [blame] | 1488 | struct rcvd_async_info *pstrRcvdGnrlAsyncInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1489 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1490 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1491 | u8 u8MsgType = 0; |
| 1492 | u8 u8MsgID = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1493 | u16 u16MsgLen = 0; |
| 1494 | u16 u16WidID = (u16)WID_NIL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1495 | u8 u8WidLen = 0; |
| 1496 | u8 u8MacStatus; |
| 1497 | u8 u8MacStatusReasonCode; |
| 1498 | u8 u8MacStatusAdditionalInfo; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1499 | tstrConnectInfo strConnectInfo; |
| 1500 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 1501 | s32 s32Err = 0; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 1502 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1503 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1504 | PRINT_ER("Driver handler is NULL\n"); |
Leo Kim | 234837d | 2015-09-22 14:34:43 +0900 | [diff] [blame] | 1505 | return -ENODEV; |
| 1506 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1507 | PRINT_D(GENERIC_DBG, "Current State = %d,Received state = %d\n", |
| 1508 | hif_drv->hif_state, pstrRcvdGnrlAsyncInfo->buffer[7]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1509 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1510 | if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || |
| 1511 | (hif_drv->hif_state == HOST_IF_CONNECTED) || |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1512 | hif_drv->usr_scan_req.scan_result) { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1513 | if (!pstrRcvdGnrlAsyncInfo->buffer || |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1514 | !hif_drv->usr_conn_req.conn_result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1515 | PRINT_ER("driver is null\n"); |
| 1516 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1517 | } |
| 1518 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1519 | u8MsgType = pstrRcvdGnrlAsyncInfo->buffer[0]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1520 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1521 | if ('I' != u8MsgType) { |
| 1522 | PRINT_ER("Received Message format incorrect.\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 1523 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1524 | } |
| 1525 | |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 1526 | u8MsgID = pstrRcvdGnrlAsyncInfo->buffer[1]; |
| 1527 | u16MsgLen = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[2], pstrRcvdGnrlAsyncInfo->buffer[3]); |
| 1528 | u16WidID = MAKE_WORD16(pstrRcvdGnrlAsyncInfo->buffer[4], pstrRcvdGnrlAsyncInfo->buffer[5]); |
| 1529 | u8WidLen = pstrRcvdGnrlAsyncInfo->buffer[6]; |
| 1530 | u8MacStatus = pstrRcvdGnrlAsyncInfo->buffer[7]; |
| 1531 | u8MacStatusReasonCode = pstrRcvdGnrlAsyncInfo->buffer[8]; |
| 1532 | u8MacStatusAdditionalInfo = pstrRcvdGnrlAsyncInfo->buffer[9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1533 | 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] | 1534 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 1535 | u32 u32RcvdAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1536 | tstrConnectRespInfo *pstrConnectRespInfo = NULL; |
| 1537 | |
| 1538 | PRINT_D(HOSTINF_DBG, "Recieved MAC status = %d with Reason = %d , Code = %d\n", u8MacStatus, u8MacStatusReasonCode, u8MacStatusAdditionalInfo); |
| 1539 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1540 | memset(&strConnectInfo, 0, sizeof(tstrConnectInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1541 | |
| 1542 | if (u8MacStatus == MAC_CONNECTED) { |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1543 | memset(rcv_assoc_resp, 0, MAX_ASSOC_RESP_FRAME_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1544 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1545 | host_int_get_assoc_res_info(hif_drv, |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1546 | rcv_assoc_resp, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1547 | MAX_ASSOC_RESP_FRAME_SIZE, |
| 1548 | &u32RcvdAssocRespInfoLen); |
| 1549 | |
| 1550 | PRINT_INFO(HOSTINF_DBG, "Received association response with length = %d\n", u32RcvdAssocRespInfoLen); |
| 1551 | |
| 1552 | if (u32RcvdAssocRespInfoLen != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1553 | PRINT_D(HOSTINF_DBG, "Parsing association response\n"); |
Leo Kim | a633c0b | 2015-10-15 13:24:59 +0900 | [diff] [blame] | 1554 | s32Err = ParseAssocRespInfo(rcv_assoc_resp, u32RcvdAssocRespInfoLen, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1555 | &pstrConnectRespInfo); |
| 1556 | if (s32Err) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1557 | PRINT_ER("ParseAssocRespInfo() returned error %d\n", s32Err); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1558 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1559 | strConnectInfo.u16ConnectStatus = pstrConnectRespInfo->u16ConnectStatus; |
| 1560 | |
| 1561 | if (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE) { |
| 1562 | PRINT_INFO(HOSTINF_DBG, "Association response received : Successful connection status\n"); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1563 | if (pstrConnectRespInfo->pu8RespIEs) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1564 | strConnectInfo.u16RespIEsLen = pstrConnectRespInfo->u16RespIEsLen; |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1565 | strConnectInfo.pu8RespIEs = kmalloc(pstrConnectRespInfo->u16RespIEsLen, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1566 | memcpy(strConnectInfo.pu8RespIEs, pstrConnectRespInfo->pu8RespIEs, |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1567 | pstrConnectRespInfo->u16RespIEsLen); |
| 1568 | } |
| 1569 | } |
| 1570 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1571 | if (pstrConnectRespInfo) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1572 | DeallocateAssocRespInfo(pstrConnectRespInfo); |
| 1573 | pstrConnectRespInfo = NULL; |
| 1574 | } |
| 1575 | } |
| 1576 | } |
| 1577 | } |
| 1578 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1579 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1580 | (strConnectInfo.u16ConnectStatus != SUCCESSFUL_STATUSCODE)) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1581 | 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] | 1582 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1583 | |
| 1584 | } else if (u8MacStatus == MAC_DISCONNECTED) { |
| 1585 | PRINT_ER("Received MAC status is MAC_DISCONNECTED\n"); |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1586 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1587 | } |
| 1588 | |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1589 | if (hif_drv->usr_conn_req.pu8bssid) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1590 | PRINT_D(HOSTINF_DBG, "Retrieving actual BSSID from AP\n"); |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1591 | memcpy(strConnectInfo.au8bssid, hif_drv->usr_conn_req.pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1592 | |
| 1593 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1594 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 1595 | memcpy(hif_drv->assoc_bssid, |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1596 | hif_drv->usr_conn_req.pu8bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1597 | } |
| 1598 | } |
| 1599 | |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1600 | if (hif_drv->usr_conn_req.ies) { |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1601 | strConnectInfo.ReqIEsLen = hif_drv->usr_conn_req.ies_len; |
| 1602 | strConnectInfo.pu8ReqIEs = kmalloc(hif_drv->usr_conn_req.ies_len, GFP_KERNEL); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 1603 | memcpy(strConnectInfo.pu8ReqIEs, |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1604 | hif_drv->usr_conn_req.ies, |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1605 | hif_drv->usr_conn_req.ies_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1606 | } |
| 1607 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 1608 | del_timer(&hif_drv->connect_timer); |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1609 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_CONN_RESP, |
| 1610 | &strConnectInfo, |
| 1611 | u8MacStatus, |
| 1612 | NULL, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1613 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1614 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1615 | if ((u8MacStatus == MAC_CONNECTED) && |
| 1616 | (strConnectInfo.u16ConnectStatus == SUCCESSFUL_STATUSCODE)) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1617 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1618 | |
| 1619 | PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED and Connect Status : Successful\n"); |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1620 | hif_drv->hif_state = HOST_IF_CONNECTED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1621 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1622 | PRINT_D(GENERIC_DBG, "Obtaining an IP, Disable Scan\n"); |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1623 | g_obtainingIP = true; |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 1624 | mod_timer(&hDuringIpTimer, |
| 1625 | jiffies + msecs_to_jiffies(10000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1626 | } else { |
| 1627 | 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] | 1628 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1629 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1630 | } |
| 1631 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1632 | kfree(strConnectInfo.pu8RespIEs); |
| 1633 | strConnectInfo.pu8RespIEs = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1634 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1635 | kfree(strConnectInfo.pu8ReqIEs); |
| 1636 | strConnectInfo.pu8ReqIEs = NULL; |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1637 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1638 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1639 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1640 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1641 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1642 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1643 | (hif_drv->hif_state == HOST_IF_CONNECTED)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1644 | PRINT_D(HOSTINF_DBG, "Received MAC_DISCONNECTED from the FW\n"); |
| 1645 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 1646 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1647 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1648 | if (hif_drv->usr_scan_req.scan_result) { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1649 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running OBSS Scan >>\n\n"); |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 1650 | del_timer(&hif_drv->scan_timer); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1651 | Handle_ScanDone((void *)hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1652 | } |
| 1653 | |
| 1654 | strDisconnectNotifInfo.u16reason = 0; |
| 1655 | strDisconnectNotifInfo.ie = NULL; |
| 1656 | strDisconnectNotifInfo.ie_len = 0; |
| 1657 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1658 | if (hif_drv->usr_conn_req.conn_result) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1659 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1660 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1661 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 1662 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 1663 | NULL, |
| 1664 | 0, |
| 1665 | &strDisconnectNotifInfo, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 1666 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1667 | } else { |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 1668 | PRINT_ER("Connect result callback function is NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1669 | } |
| 1670 | |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 1671 | eth_zero_addr(hif_drv->assoc_bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1672 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 1673 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 1674 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 1675 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 1676 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 1677 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1678 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1679 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 1680 | kfree(join_req); |
| 1681 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1682 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1683 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1684 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 1685 | kfree(info_element); |
| 1686 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1687 | } |
| 1688 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1689 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 1690 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1691 | |
| 1692 | } else if ((u8MacStatus == MAC_DISCONNECTED) && |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1693 | (hif_drv->usr_scan_req.scan_result)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1694 | 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] | 1695 | PRINT_D(HOSTINF_DBG, "\n\n<< Abort the running Scan >>\n\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 1696 | |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 1697 | del_timer(&hif_drv->scan_timer); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 1698 | if (hif_drv->usr_scan_req.scan_result) |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1699 | Handle_ScanDone(hif_drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1700 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1701 | } |
| 1702 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 1703 | kfree(pstrRcvdGnrlAsyncInfo->buffer); |
| 1704 | pstrRcvdGnrlAsyncInfo->buffer = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1705 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1706 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1707 | } |
| 1708 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1709 | static int Handle_Key(struct host_if_drv *hif_drv, |
Tony Cho | c98387a | 2015-09-21 12:16:40 +0900 | [diff] [blame] | 1710 | struct key_attr *pstrHostIFkeyAttr) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1711 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1712 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1713 | struct wid wid; |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 1714 | struct wid strWIDList[5]; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 1715 | u8 i; |
| 1716 | u8 *pu8keybuf; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 1717 | s8 s8idxarray[1]; |
| 1718 | s8 ret = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1719 | |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 1720 | switch (pstrHostIFkeyAttr->type) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1721 | case WEP: |
| 1722 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1723 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1724 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1725 | 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] | 1726 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1727 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1728 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1729 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1730 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1731 | strWIDList[1].id = WID_AUTH_TYPE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1732 | strWIDList[1].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1733 | strWIDList[1].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1734 | strWIDList[1].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1735 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1736 | strWIDList[2].id = (u16)WID_KEY_ID; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1737 | strWIDList[2].type = WID_CHAR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1738 | |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1739 | strWIDList[2].val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1740 | strWIDList[2].size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1741 | |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 1742 | pu8keybuf = kmemdup(pstrHostIFkeyAttr->attr.wep.key, |
| 1743 | pstrHostIFkeyAttr->attr.wep.key_len, |
| 1744 | GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1745 | |
| 1746 | if (pu8keybuf == NULL) { |
| 1747 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1748 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1749 | } |
| 1750 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1751 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1752 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1753 | strWIDList[3].id = (u16)WID_WEP_KEY_VALUE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1754 | strWIDList[3].type = WID_STR; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1755 | strWIDList[3].size = pstrHostIFkeyAttr->attr.wep.key_len; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1756 | strWIDList[3].val = (s8 *)pu8keybuf; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1757 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1758 | result = send_config_pkt(SET_CFG, strWIDList, 4, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1759 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1760 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1761 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1762 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1763 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1764 | PRINT_D(HOSTINF_DBG, "Handling WEP key\n"); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1765 | pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len + 2, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1766 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1767 | PRINT_ER("No buffer to send Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1768 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1769 | } |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1770 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index; |
| 1771 | memcpy(pu8keybuf + 1, &pstrHostIFkeyAttr->attr.wep.key_len, 1); |
| 1772 | memcpy(pu8keybuf + 2, pstrHostIFkeyAttr->attr.wep.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1773 | pstrHostIFkeyAttr->attr.wep.key_len); |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1774 | kfree(pstrHostIFkeyAttr->attr.wep.key); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1775 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1776 | wid.id = (u16)WID_ADD_WEP_KEY; |
| 1777 | wid.type = WID_STR; |
| 1778 | wid.val = (s8 *)pu8keybuf; |
| 1779 | wid.size = pstrHostIFkeyAttr->attr.wep.key_len + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1780 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1781 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1782 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1783 | kfree(pu8keybuf); |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1784 | } else if (pstrHostIFkeyAttr->action & REMOVEKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1785 | PRINT_D(HOSTINF_DBG, "Removing key\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1786 | wid.id = (u16)WID_REMOVE_WEP_KEY; |
| 1787 | wid.type = WID_STR; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1788 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1789 | s8idxarray[0] = (s8)pstrHostIFkeyAttr->attr.wep.index; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1790 | wid.val = s8idxarray; |
| 1791 | wid.size = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1792 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1793 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1794 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1795 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1796 | wid.id = (u16)WID_KEY_ID; |
| 1797 | wid.type = WID_CHAR; |
| 1798 | wid.val = (s8 *)&pstrHostIFkeyAttr->attr.wep.index; |
| 1799 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1800 | |
| 1801 | PRINT_D(HOSTINF_DBG, "Setting default key index\n"); |
| 1802 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1803 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1804 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1805 | } |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1806 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1807 | break; |
| 1808 | |
Leo Kim | 5cd8f7a | 2015-10-29 12:05:34 +0900 | [diff] [blame] | 1809 | case WPA_RX_GTK: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1810 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1811 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1812 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1813 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1814 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1815 | goto _WPARxGtk_end_case_; |
| 1816 | } |
| 1817 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1818 | if (pstrHostIFkeyAttr->attr.wpa.seq) |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1819 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1820 | |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1821 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1822 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1823 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1824 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1825 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1826 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1827 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1828 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1829 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1830 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1831 | strWIDList[1].id = (u16)WID_ADD_RX_GTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1832 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1833 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1834 | strWIDList[1].size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1835 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1836 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1837 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1838 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1839 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1840 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1841 | } |
| 1842 | |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1843 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1844 | PRINT_D(HOSTINF_DBG, "Handling group key(Rx) function\n"); |
| 1845 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 1846 | pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1847 | if (pu8keybuf == NULL) { |
| 1848 | PRINT_ER("No buffer to send RxGTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1849 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1850 | goto _WPARxGtk_end_case_; |
| 1851 | } |
| 1852 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1853 | if (hif_drv->hif_state == HOST_IF_CONNECTED) |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 1854 | memcpy(pu8keybuf, hif_drv->assoc_bssid, ETH_ALEN); |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 1855 | else |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 1856 | 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] | 1857 | |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1858 | memcpy(pu8keybuf + 6, pstrHostIFkeyAttr->attr.wpa.seq, 8); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1859 | memcpy(pu8keybuf + 14, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1860 | memcpy(pu8keybuf + 15, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1861 | memcpy(pu8keybuf + 16, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1862 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1863 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1864 | wid.id = (u16)WID_ADD_RX_GTK; |
| 1865 | wid.type = WID_STR; |
| 1866 | wid.val = (s8 *)pu8keybuf; |
| 1867 | wid.size = RX_MIC_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1868 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1869 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1870 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1871 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1872 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1873 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1874 | } |
| 1875 | _WPARxGtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1876 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 1877 | kfree(pstrHostIFkeyAttr->attr.wpa.seq); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1878 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1879 | return ret; |
| 1880 | |
| 1881 | break; |
| 1882 | |
Leo Kim | 2141fe3 | 2015-10-29 12:05:35 +0900 | [diff] [blame] | 1883 | case WPA_PTK: |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1884 | if (pstrHostIFkeyAttr->action & ADDKEY_AP) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1885 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1886 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1887 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1888 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1889 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1890 | } |
| 1891 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1892 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 1893 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.index, 1); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1894 | memcpy(pu8keybuf + 7, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1895 | memcpy(pu8keybuf + 8, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1896 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1897 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1898 | strWIDList[0].id = (u16)WID_11I_MODE; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1899 | strWIDList[0].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1900 | strWIDList[0].size = sizeof(char); |
Leo Kim | bafaa69 | 2015-10-28 15:59:21 +0900 | [diff] [blame] | 1901 | strWIDList[0].val = (s8 *)&pstrHostIFkeyAttr->attr.wpa.mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1902 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 1903 | strWIDList[1].id = (u16)WID_ADD_PTK; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 1904 | strWIDList[1].type = WID_STR; |
Leo Kim | 900bb4a | 2015-10-12 16:55:46 +0900 | [diff] [blame] | 1905 | strWIDList[1].val = (s8 *)pu8keybuf; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 1906 | strWIDList[1].size = PTK_KEY_MSG_LEN + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1907 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1908 | result = send_config_pkt(SET_CFG, strWIDList, 2, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1909 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1910 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1911 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1912 | } |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 1913 | if (pstrHostIFkeyAttr->action & ADDKEY) { |
Glen Lee | f305258 | 2015-09-10 12:03:04 +0900 | [diff] [blame] | 1914 | pu8keybuf = kmalloc(PTK_KEY_MSG_LEN, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1915 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1916 | PRINT_ER("No buffer to send PTK Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1917 | ret = -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1918 | goto _WPAPtk_end_case_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1919 | } |
| 1920 | |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 1921 | memcpy(pu8keybuf, pstrHostIFkeyAttr->attr.wpa.mac_addr, 6); |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 1922 | memcpy(pu8keybuf + 6, &pstrHostIFkeyAttr->attr.wpa.key_len, 1); |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1923 | memcpy(pu8keybuf + 7, pstrHostIFkeyAttr->attr.wpa.key, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1924 | pstrHostIFkeyAttr->attr.wpa.key_len); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1925 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1926 | wid.id = (u16)WID_ADD_PTK; |
| 1927 | wid.type = WID_STR; |
| 1928 | wid.val = (s8 *)pu8keybuf; |
| 1929 | wid.size = PTK_KEY_MSG_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1930 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1931 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1932 | get_id_from_handler(hif_drv)); |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1933 | kfree(pu8keybuf); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 1934 | up(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1935 | } |
| 1936 | |
| 1937 | _WPAPtk_end_case_: |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 1938 | kfree(pstrHostIFkeyAttr->attr.wpa.key); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1939 | if (ret) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1940 | return ret; |
| 1941 | |
| 1942 | break; |
| 1943 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1944 | case PMKSA: |
| 1945 | |
| 1946 | PRINT_D(HOSTINF_DBG, "Handling PMKSA key\n"); |
| 1947 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1948 | pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 1949 | if (!pu8keybuf) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1950 | PRINT_ER("No buffer to send PMKSA Key\n"); |
Luis de Bethencourt | 9081987 | 2015-10-26 05:52:50 +0000 | [diff] [blame] | 1951 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1952 | } |
| 1953 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1954 | pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1955 | |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 1956 | for (i = 0; i < pstrHostIFkeyAttr->attr.pmkid.numpmkid; i++) { |
| 1957 | memcpy(pu8keybuf + ((PMKSA_KEY_LEN * i) + 1), pstrHostIFkeyAttr->attr.pmkid.pmkidlist[i].bssid, ETH_ALEN); |
| 1958 | 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] | 1959 | } |
| 1960 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1961 | wid.id = (u16)WID_PMKID_INFO; |
| 1962 | wid.type = WID_STR; |
| 1963 | wid.val = (s8 *)pu8keybuf; |
| 1964 | wid.size = (pstrHostIFkeyAttr->attr.pmkid.numpmkid * PMKSA_KEY_LEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1965 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1966 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1967 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1968 | |
Chaehyun Lim | 49188af | 2015-08-11 10:32:41 +0900 | [diff] [blame] | 1969 | kfree(pu8keybuf); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1970 | break; |
| 1971 | } |
| 1972 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1973 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1974 | PRINT_ER("Failed to send key config packet\n"); |
| 1975 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1976 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1977 | } |
| 1978 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1979 | static void Handle_Disconnect(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1980 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1981 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1982 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 1983 | s32 result = 0; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 1984 | u16 u16DummyReasonCode = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1985 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1986 | wid.id = (u16)WID_DISCONNECT; |
| 1987 | wid.type = WID_CHAR; |
| 1988 | wid.val = (s8 *)&u16DummyReasonCode; |
| 1989 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1990 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1991 | PRINT_D(HOSTINF_DBG, "Sending disconnect request\n"); |
| 1992 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 1993 | g_obtainingIP = false; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 1994 | host_int_set_power_mgmt(hif_drv, 0, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1995 | |
Shraddha Barke | 281dd5a | 2015-10-05 17:00:33 +0530 | [diff] [blame] | 1996 | eth_zero_addr(u8ConnectedSSID); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 1997 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 1998 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 1999 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2000 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2001 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2002 | PRINT_ER("Failed to send dissconect config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2003 | } else { |
| 2004 | tstrDisconnectNotifInfo strDisconnectNotifInfo; |
| 2005 | |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 2006 | memset(&strDisconnectNotifInfo, 0, sizeof(tstrDisconnectNotifInfo)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2007 | |
| 2008 | strDisconnectNotifInfo.u16reason = 0; |
| 2009 | strDisconnectNotifInfo.ie = NULL; |
| 2010 | strDisconnectNotifInfo.ie_len = 0; |
| 2011 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2012 | if (hif_drv->usr_scan_req.scan_result) { |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 2013 | del_timer(&hif_drv->scan_timer); |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2014 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, |
| 2015 | NULL, |
| 2016 | hif_drv->usr_scan_req.arg, |
| 2017 | NULL); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2018 | hif_drv->usr_scan_req.scan_result = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2019 | } |
| 2020 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2021 | if (hif_drv->usr_conn_req.conn_result) { |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2022 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2023 | PRINT_D(HOSTINF_DBG, "Upper layer requested termination of connection\n"); |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 2024 | del_timer(&hif_drv->connect_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2025 | } |
| 2026 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2027 | hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF, |
| 2028 | NULL, |
| 2029 | 0, |
| 2030 | &strDisconnectNotifInfo, |
Leo Kim | 73abaa4 | 2015-10-29 12:05:27 +0900 | [diff] [blame] | 2031 | hif_drv->usr_conn_req.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2032 | } else { |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 2033 | PRINT_ER("usr_conn_req.conn_result = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2034 | } |
| 2035 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 2036 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2037 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2038 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2039 | |
Leo Kim | 2a4eded | 2015-10-29 11:58:25 +0900 | [diff] [blame] | 2040 | eth_zero_addr(hif_drv->assoc_bssid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2041 | |
Leo Kim | 74ab5e4 | 2015-10-29 11:58:53 +0900 | [diff] [blame] | 2042 | hif_drv->usr_conn_req.ssid_len = 0; |
Leo Kim | f8b1713 | 2015-10-28 15:59:34 +0900 | [diff] [blame] | 2043 | kfree(hif_drv->usr_conn_req.pu8ssid); |
| 2044 | kfree(hif_drv->usr_conn_req.pu8bssid); |
Leo Kim | 331ed08 | 2015-10-29 11:58:55 +0900 | [diff] [blame] | 2045 | hif_drv->usr_conn_req.ies_len = 0; |
Leo Kim | a3b2f4b | 2015-10-29 11:58:54 +0900 | [diff] [blame] | 2046 | kfree(hif_drv->usr_conn_req.ies); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2047 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2048 | if (join_req && join_req_drv == hif_drv) { |
Leo Kim | 044a6410 | 2015-10-15 13:25:09 +0900 | [diff] [blame] | 2049 | kfree(join_req); |
| 2050 | join_req = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2051 | } |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2052 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2053 | if (info_element && join_req_drv == hif_drv) { |
Leo Kim | 48ce246 | 2015-10-15 13:25:10 +0900 | [diff] [blame] | 2054 | kfree(info_element); |
| 2055 | info_element = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2056 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2057 | } |
| 2058 | |
Leo Kim | e55e496 | 2015-10-29 11:58:29 +0900 | [diff] [blame] | 2059 | up(&hif_drv->sem_test_disconn_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2060 | } |
| 2061 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2062 | void resolve_disconnect_aberration(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2063 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2064 | if (!hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2065 | return; |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2066 | if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) || |
| 2067 | (hif_drv->hif_state == HOST_IF_CONNECTING)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2068 | PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state machine >>\n\n"); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2069 | host_int_disconnect(hif_drv, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2070 | } |
| 2071 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2072 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2073 | static s32 Handle_GetChnl(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2074 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2075 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2076 | struct wid wid; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2077 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2078 | wid.id = (u16)WID_CURRENT_CHANNEL; |
| 2079 | wid.type = WID_CHAR; |
| 2080 | wid.val = (s8 *)&ch_no; |
| 2081 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2082 | |
| 2083 | PRINT_D(HOSTINF_DBG, "Getting channel value\n"); |
| 2084 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2085 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2086 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2087 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2088 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2089 | PRINT_ER("Failed to get channel number\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2090 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2091 | } |
| 2092 | |
Leo Kim | 4ea9000 | 2015-10-29 11:58:32 +0900 | [diff] [blame] | 2093 | up(&hif_drv->sem_get_chnl); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2094 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2095 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2096 | } |
| 2097 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2098 | static void Handle_GetRssi(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2099 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2100 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2101 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2102 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2103 | wid.id = (u16)WID_RSSI; |
| 2104 | wid.type = WID_CHAR; |
| 2105 | wid.val = &rssi; |
| 2106 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2107 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2108 | PRINT_D(HOSTINF_DBG, "Getting RSSI value\n"); |
| 2109 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2110 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2111 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2112 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2113 | PRINT_ER("Failed to get RSSI value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2114 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2115 | } |
| 2116 | |
Leo Kim | 7e111f9 | 2015-10-29 11:58:30 +0900 | [diff] [blame] | 2117 | up(&hif_drv->sem_get_rssi); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2118 | } |
| 2119 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2120 | static void Handle_GetLinkspeed(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2121 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2122 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2123 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2124 | |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 2125 | link_speed = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2126 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2127 | wid.id = (u16)WID_LINKSPEED; |
| 2128 | wid.type = WID_CHAR; |
| 2129 | wid.val = &link_speed; |
| 2130 | wid.size = sizeof(char); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2131 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2132 | PRINT_D(HOSTINF_DBG, "Getting LINKSPEED value\n"); |
| 2133 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2134 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2135 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2136 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2137 | PRINT_ER("Failed to get LINKSPEED value\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2138 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2139 | } |
| 2140 | |
Leo Kim | bc34da6 | 2015-10-29 11:58:31 +0900 | [diff] [blame] | 2141 | up(&hif_drv->sem_get_link_speed); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2142 | } |
| 2143 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2144 | 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] | 2145 | { |
Leo Kim | e9e0c26 | 2015-10-12 16:55:41 +0900 | [diff] [blame] | 2146 | struct wid strWIDList[5]; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2147 | u32 u32WidsCount = 0, result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2148 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2149 | strWIDList[u32WidsCount].id = WID_LINKSPEED; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2150 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2151 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 5babeec | 2015-10-29 12:05:29 +0900 | [diff] [blame] | 2152 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->link_speed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2153 | u32WidsCount++; |
| 2154 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2155 | strWIDList[u32WidsCount].id = WID_RSSI; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2156 | strWIDList[u32WidsCount].type = WID_CHAR; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2157 | strWIDList[u32WidsCount].size = sizeof(char); |
Leo Kim | 00c8dfc | 2015-10-29 12:05:30 +0900 | [diff] [blame] | 2158 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2159 | u32WidsCount++; |
| 2160 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2161 | strWIDList[u32WidsCount].id = WID_SUCCESS_FRAME_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2162 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2163 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 7e84ff4 | 2015-10-29 12:05:31 +0900 | [diff] [blame] | 2164 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2165 | u32WidsCount++; |
| 2166 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2167 | strWIDList[u32WidsCount].id = WID_RECEIVED_FRAGMENT_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2168 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2169 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 9b99274 | 2015-10-29 12:05:32 +0900 | [diff] [blame] | 2170 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->rx_cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2171 | u32WidsCount++; |
| 2172 | |
Leo Kim | daaf16b | 2015-10-12 16:55:44 +0900 | [diff] [blame] | 2173 | strWIDList[u32WidsCount].id = WID_FAILED_COUNT; |
Leo Kim | 416d832 | 2015-10-12 16:55:43 +0900 | [diff] [blame] | 2174 | strWIDList[u32WidsCount].type = WID_INT; |
Leo Kim | 2fd3e44 | 2015-10-12 16:55:45 +0900 | [diff] [blame] | 2175 | strWIDList[u32WidsCount].size = sizeof(u32); |
Leo Kim | 5416037 | 2015-10-29 12:05:33 +0900 | [diff] [blame] | 2176 | strWIDList[u32WidsCount].val = (s8 *)&pstrStatistics->tx_fail_cnt; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2177 | u32WidsCount++; |
| 2178 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2179 | result = send_config_pkt(GET_CFG, strWIDList, u32WidsCount, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2180 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2181 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2182 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2183 | PRINT_ER("Failed to send scan paramters config packet\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2184 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2185 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2186 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2187 | } |
| 2188 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2189 | static s32 Handle_Get_InActiveTime(struct host_if_drv *hif_drv, |
Tony Cho | 3d1eac0 | 2015-09-21 12:16:49 +0900 | [diff] [blame] | 2190 | struct sta_inactive_t *strHostIfStaInactiveT) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2191 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2192 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2193 | u8 *stamac; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2194 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2195 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2196 | wid.id = (u16)WID_SET_STA_MAC_INACTIVE_TIME; |
| 2197 | wid.type = WID_STR; |
| 2198 | wid.size = ETH_ALEN; |
| 2199 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2200 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2201 | stamac = wid.val; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 2202 | memcpy(stamac, strHostIfStaInactiveT->mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2203 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2204 | PRINT_D(CFG80211_DBG, "SETING STA inactive time\n"); |
| 2205 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2206 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2207 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2208 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2209 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2210 | PRINT_ER("Failed to SET incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2211 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2212 | } |
| 2213 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2214 | wid.id = (u16)WID_GET_INACTIVE_TIME; |
| 2215 | wid.type = WID_INT; |
| 2216 | wid.val = (s8 *)&inactive_time; |
| 2217 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2218 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2219 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2220 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2221 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2222 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2223 | PRINT_ER("Failed to get incative time\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2224 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2225 | } |
| 2226 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 2227 | PRINT_D(CFG80211_DBG, "Getting inactive time : %d\n", inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2228 | |
Leo Kim | 569a3c6 | 2015-10-29 11:58:33 +0900 | [diff] [blame] | 2229 | up(&hif_drv->sem_inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2230 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2231 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2232 | } |
| 2233 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2234 | static void Handle_AddBeacon(struct host_if_drv *hif_drv, |
Tony Cho | 7f33fec | 2015-09-30 18:44:30 +0900 | [diff] [blame] | 2235 | struct beacon_attr *pstrSetBeaconParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2236 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2237 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2238 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2239 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2240 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2241 | PRINT_D(HOSTINF_DBG, "Adding BEACON\n"); |
| 2242 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2243 | wid.id = (u16)WID_ADD_BEACON; |
| 2244 | wid.type = WID_BIN; |
| 2245 | wid.size = pstrSetBeaconParam->head_len + pstrSetBeaconParam->tail_len + 16; |
| 2246 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2247 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2248 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2249 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2250 | pu8CurrByte = wid.val; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 2251 | *pu8CurrByte++ = (pstrSetBeaconParam->interval & 0xFF); |
| 2252 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 8) & 0xFF); |
| 2253 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 16) & 0xFF); |
| 2254 | *pu8CurrByte++ = ((pstrSetBeaconParam->interval >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2255 | |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 2256 | *pu8CurrByte++ = (pstrSetBeaconParam->dtim_period & 0xFF); |
| 2257 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 8) & 0xFF); |
| 2258 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 16) & 0xFF); |
| 2259 | *pu8CurrByte++ = ((pstrSetBeaconParam->dtim_period >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2260 | |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2261 | *pu8CurrByte++ = (pstrSetBeaconParam->head_len & 0xFF); |
| 2262 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 8) & 0xFF); |
| 2263 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 16) & 0xFF); |
| 2264 | *pu8CurrByte++ = ((pstrSetBeaconParam->head_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2265 | |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2266 | memcpy(pu8CurrByte, pstrSetBeaconParam->head, pstrSetBeaconParam->head_len); |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 2267 | pu8CurrByte += pstrSetBeaconParam->head_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2268 | |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2269 | *pu8CurrByte++ = (pstrSetBeaconParam->tail_len & 0xFF); |
| 2270 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 8) & 0xFF); |
| 2271 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 16) & 0xFF); |
| 2272 | *pu8CurrByte++ = ((pstrSetBeaconParam->tail_len >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2273 | |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2274 | if (pstrSetBeaconParam->tail > 0) |
| 2275 | memcpy(pu8CurrByte, pstrSetBeaconParam->tail, pstrSetBeaconParam->tail_len); |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 2276 | pu8CurrByte += pstrSetBeaconParam->tail_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2277 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2278 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2279 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2280 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2281 | PRINT_ER("Failed to send add beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2282 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2283 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2284 | kfree(wid.val); |
Leo Kim | 8ce528b | 2015-10-13 19:50:06 +0900 | [diff] [blame] | 2285 | kfree(pstrSetBeaconParam->head); |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 2286 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2287 | } |
| 2288 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2289 | static void Handle_DelBeacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2290 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2291 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2292 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2293 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2294 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2295 | wid.id = (u16)WID_DEL_BEACON; |
| 2296 | wid.type = WID_CHAR; |
| 2297 | wid.size = sizeof(char); |
| 2298 | wid.val = &del_beacon; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2299 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2300 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2301 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2302 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2303 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2304 | |
| 2305 | PRINT_D(HOSTINF_DBG, "Deleting BEACON\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2306 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2307 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2308 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2309 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2310 | PRINT_ER("Failed to send delete beacon config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2311 | } |
| 2312 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2313 | static u32 WILC_HostIf_PackStaParam(u8 *pu8Buffer, |
| 2314 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2315 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2316 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2317 | |
| 2318 | pu8CurrByte = pu8Buffer; |
| 2319 | |
| 2320 | PRINT_D(HOSTINF_DBG, "Packing STA params\n"); |
Leo Kim | 2353c38 | 2015-10-29 12:05:41 +0900 | [diff] [blame] | 2321 | memcpy(pu8CurrByte, pstrStationParam->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2322 | pu8CurrByte += ETH_ALEN; |
| 2323 | |
Leo Kim | 4101eb8 | 2015-10-29 12:05:42 +0900 | [diff] [blame] | 2324 | *pu8CurrByte++ = pstrStationParam->aid & 0xFF; |
| 2325 | *pu8CurrByte++ = (pstrStationParam->aid >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2326 | |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2327 | *pu8CurrByte++ = pstrStationParam->rates_len; |
| 2328 | if (pstrStationParam->rates_len > 0) |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 2329 | memcpy(pu8CurrByte, pstrStationParam->rates, |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2330 | pstrStationParam->rates_len); |
| 2331 | pu8CurrByte += pstrStationParam->rates_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2332 | |
Leo Kim | 2252012 | 2015-10-29 12:05:45 +0900 | [diff] [blame] | 2333 | *pu8CurrByte++ = pstrStationParam->ht_supported; |
Leo Kim | 0d073f6 | 2015-10-29 12:05:46 +0900 | [diff] [blame] | 2334 | *pu8CurrByte++ = pstrStationParam->ht_capa_info & 0xFF; |
| 2335 | *pu8CurrByte++ = (pstrStationParam->ht_capa_info >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2336 | |
Leo Kim | fba1f2d | 2015-10-29 12:05:47 +0900 | [diff] [blame] | 2337 | *pu8CurrByte++ = pstrStationParam->ht_ampdu_params; |
Leo Kim | 5ebbf4f | 2015-10-29 12:05:48 +0900 | [diff] [blame] | 2338 | memcpy(pu8CurrByte, pstrStationParam->ht_supp_mcs_set, |
| 2339 | WILC_SUPP_MCS_SET_SIZE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2340 | pu8CurrByte += WILC_SUPP_MCS_SET_SIZE; |
| 2341 | |
Leo Kim | 223741d | 2015-10-29 12:05:49 +0900 | [diff] [blame] | 2342 | *pu8CurrByte++ = pstrStationParam->ht_ext_params & 0xFF; |
| 2343 | *pu8CurrByte++ = (pstrStationParam->ht_ext_params >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2344 | |
Leo Kim | 74fe73c | 2015-10-29 12:05:50 +0900 | [diff] [blame] | 2345 | *pu8CurrByte++ = pstrStationParam->ht_tx_bf_cap & 0xFF; |
| 2346 | *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 8) & 0xFF; |
| 2347 | *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 16) & 0xFF; |
| 2348 | *pu8CurrByte++ = (pstrStationParam->ht_tx_bf_cap >> 24) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2349 | |
Leo Kim | a486baf | 2015-10-29 12:05:51 +0900 | [diff] [blame] | 2350 | *pu8CurrByte++ = pstrStationParam->ht_ante_sel; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2351 | |
Leo Kim | f676e17 | 2015-10-29 12:05:52 +0900 | [diff] [blame] | 2352 | *pu8CurrByte++ = pstrStationParam->flags_mask & 0xFF; |
| 2353 | *pu8CurrByte++ = (pstrStationParam->flags_mask >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2354 | |
Leo Kim | 67ab64e | 2015-10-29 12:05:53 +0900 | [diff] [blame] | 2355 | *pu8CurrByte++ = pstrStationParam->flags_set & 0xFF; |
| 2356 | *pu8CurrByte++ = (pstrStationParam->flags_set >> 8) & 0xFF; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2357 | |
| 2358 | return pu8CurrByte - pu8Buffer; |
| 2359 | } |
| 2360 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2361 | static void Handle_AddStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2362 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2363 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2364 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2365 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2366 | u8 *pu8CurrByte; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2367 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2368 | PRINT_D(HOSTINF_DBG, "Handling add station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2369 | wid.id = (u16)WID_ADD_STA; |
| 2370 | wid.type = WID_BIN; |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2371 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->rates_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2372 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2373 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2374 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2375 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2376 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2377 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2378 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2379 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2380 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2381 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2382 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2383 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2384 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2385 | ERRORHANDLER: |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 2386 | kfree(pstrStationParam->rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2387 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2388 | } |
| 2389 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2390 | static void Handle_DelAllSta(struct host_if_drv *hif_drv, |
Tony Cho | b4e644e | 2015-09-21 12:17:00 +0900 | [diff] [blame] | 2391 | struct del_all_sta *pstrDelAllStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2392 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2393 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2394 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2395 | u8 *pu8CurrByte; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2396 | u8 i; |
Chaehyun Lim | 3703480 | 2015-06-11 14:34:32 +0900 | [diff] [blame] | 2397 | u8 au8Zero_Buff[6] = {0}; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2398 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2399 | wid.id = (u16)WID_DEL_ALL_STA; |
| 2400 | wid.type = WID_STR; |
| 2401 | wid.size = (pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2402 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2403 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2404 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2405 | wid.val = kmalloc((pstrDelAllStaParam->assoc_sta * ETH_ALEN) + 1, GFP_KERNEL); |
| 2406 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2407 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2408 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2409 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2410 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 2411 | *(pu8CurrByte++) = pstrDelAllStaParam->assoc_sta; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2412 | |
| 2413 | for (i = 0; i < MAX_NUM_STA; i++) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 2414 | if (memcmp(pstrDelAllStaParam->del_all_sta[i], au8Zero_Buff, ETH_ALEN)) |
| 2415 | memcpy(pu8CurrByte, pstrDelAllStaParam->del_all_sta[i], ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2416 | else |
| 2417 | continue; |
| 2418 | |
| 2419 | pu8CurrByte += ETH_ALEN; |
| 2420 | } |
| 2421 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2422 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2423 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2424 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2425 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2426 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2427 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2428 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2429 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2430 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2431 | } |
| 2432 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2433 | static void Handle_DelStation(struct host_if_drv *hif_drv, |
Tony Cho | fb93a1e | 2015-09-21 12:16:57 +0900 | [diff] [blame] | 2434 | struct del_sta *pstrDelStaParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2435 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2436 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2437 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2438 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2439 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2440 | wid.id = (u16)WID_REMOVE_STA; |
| 2441 | wid.type = WID_BIN; |
| 2442 | wid.size = ETH_ALEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2443 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2444 | PRINT_D(HOSTINF_DBG, "Handling delete station\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2445 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2446 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2447 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2448 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2449 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2450 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2451 | |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 2452 | memcpy(pu8CurrByte, pstrDelStaParam->mac_addr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2453 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2454 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2455 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2456 | if (result) |
Luis de Bethencourt | 83cc9be | 2015-06-26 16:47:28 +0200 | [diff] [blame] | 2457 | PRINT_ER("Failed to send add station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2458 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2459 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2460 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2461 | } |
| 2462 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2463 | static void Handle_EditStation(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 2464 | struct add_sta_param *pstrStationParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2465 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2466 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2467 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2468 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2469 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2470 | wid.id = (u16)WID_EDIT_STA; |
| 2471 | wid.type = WID_BIN; |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 2472 | wid.size = WILC_ADD_STA_LENGTH + pstrStationParam->rates_len; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2473 | |
| 2474 | PRINT_D(HOSTINF_DBG, "Handling edit station\n"); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2475 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2476 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2477 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2478 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2479 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2480 | pu8CurrByte += WILC_HostIf_PackStaParam(pu8CurrByte, pstrStationParam); |
| 2481 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2482 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2483 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2484 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2485 | PRINT_ER("Failed to send edit station config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2486 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2487 | ERRORHANDLER: |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 2488 | kfree(pstrStationParam->rates); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2489 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2490 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2491 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2492 | static int Handle_RemainOnChan(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2493 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2494 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2495 | s32 result = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2496 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2497 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2498 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2499 | if (!hif_drv->remain_on_ch_pending) { |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 2500 | hif_drv->remain_on_ch.arg = pstrHostIfRemainOnChan->arg; |
Leo Kim | bfb62ab | 2015-10-29 11:58:42 +0900 | [diff] [blame] | 2501 | hif_drv->remain_on_ch.expired = pstrHostIfRemainOnChan->expired; |
Leo Kim | 5e5f791 | 2015-10-29 11:58:43 +0900 | [diff] [blame] | 2502 | hif_drv->remain_on_ch.ready = pstrHostIfRemainOnChan->ready; |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2503 | hif_drv->remain_on_ch.ch = pstrHostIfRemainOnChan->ch; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 2504 | hif_drv->remain_on_ch.id = pstrHostIfRemainOnChan->id; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2505 | } else { |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2506 | pstrHostIfRemainOnChan->ch = hif_drv->remain_on_ch.ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2507 | } |
| 2508 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2509 | if (hif_drv->usr_scan_req.scan_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2510 | 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] | 2511 | hif_drv->remain_on_ch_pending = 1; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2512 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2513 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2514 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 2515 | if (hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2516 | 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] | 2517 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2518 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2519 | } |
| 2520 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2521 | if (g_obtainingIP || connecting) { |
| 2522 | 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] | 2523 | result = -EBUSY; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2524 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2525 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2526 | |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2527 | PRINT_D(HOSTINF_DBG, "Setting channel :%d\n", |
| 2528 | pstrHostIfRemainOnChan->ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2529 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2530 | u8remain_on_chan_flag = true; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2531 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2532 | wid.type = WID_STR; |
| 2533 | wid.size = 2; |
| 2534 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2535 | if (!wid.val) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2536 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2537 | goto ERRORHANDLER; |
| 2538 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2539 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2540 | wid.val[0] = u8remain_on_chan_flag; |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 2541 | wid.val[1] = (s8)pstrHostIfRemainOnChan->ch; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2542 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2543 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2544 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2545 | if (result != 0) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2546 | PRINT_ER("Failed to set remain on channel\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2547 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2548 | ERRORHANDLER: |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2549 | { |
| 2550 | P2P_LISTEN_STATE = 1; |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 2551 | hif_drv->remain_on_ch_timer.data = (unsigned long)hif_drv; |
| 2552 | mod_timer(&hif_drv->remain_on_ch_timer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 2553 | jiffies + |
| 2554 | msecs_to_jiffies(pstrHostIfRemainOnChan->u32duration)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2555 | |
Leo Kim | 5e5f791 | 2015-10-29 11:58:43 +0900 | [diff] [blame] | 2556 | if (hif_drv->remain_on_ch.ready) |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 2557 | hif_drv->remain_on_ch.ready(hif_drv->remain_on_ch.arg); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2558 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2559 | if (hif_drv->remain_on_ch_pending) |
| 2560 | hif_drv->remain_on_ch_pending = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2561 | } |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2562 | |
| 2563 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2564 | } |
| 2565 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2566 | static int Handle_RegisterFrame(struct host_if_drv *hif_drv, |
Tony Cho | bc37c5d | 2015-09-21 12:16:59 +0900 | [diff] [blame] | 2567 | struct reg_frame *pstrHostIfRegisterFrame) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2568 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2569 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2570 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2571 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2572 | |
Leo Kim | 6abf868 | 2015-10-29 11:58:38 +0900 | [diff] [blame] | 2573 | PRINT_D(HOSTINF_DBG, "Handling frame register : %d FrameType: %d\n", |
| 2574 | pstrHostIfRegisterFrame->reg, |
Leo Kim | d5f654c | 2015-10-29 11:58:39 +0900 | [diff] [blame] | 2575 | pstrHostIfRegisterFrame->frame_type); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2576 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2577 | wid.id = (u16)WID_REGISTER_FRAME; |
| 2578 | wid.type = WID_STR; |
| 2579 | wid.val = kmalloc(sizeof(u16) + 2, GFP_KERNEL); |
| 2580 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2581 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2582 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2583 | pu8CurrByte = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2584 | |
Leo Kim | 6abf868 | 2015-10-29 11:58:38 +0900 | [diff] [blame] | 2585 | *pu8CurrByte++ = pstrHostIfRegisterFrame->reg; |
Leo Kim | bcb410b | 2015-10-29 11:58:40 +0900 | [diff] [blame] | 2586 | *pu8CurrByte++ = pstrHostIfRegisterFrame->reg_id; |
Leo Kim | d5f654c | 2015-10-29 11:58:39 +0900 | [diff] [blame] | 2587 | memcpy(pu8CurrByte, &pstrHostIfRegisterFrame->frame_type, sizeof(u16)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2588 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2589 | wid.size = sizeof(u16) + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2590 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2591 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2592 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2593 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2594 | PRINT_ER("Failed to frame register config packet\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2595 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2596 | } |
| 2597 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2598 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2599 | } |
| 2600 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2601 | static u32 Handle_ListenStateExpired(struct host_if_drv *hif_drv, |
Tony Cho | 2f9c03f | 2015-09-21 12:16:58 +0900 | [diff] [blame] | 2602 | struct remain_ch *pstrHostIfRemainOnChan) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2603 | { |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2604 | u8 u8remain_on_chan_flag; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2605 | struct wid wid; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2606 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2607 | |
| 2608 | PRINT_D(HOSTINF_DBG, "CANCEL REMAIN ON CHAN\n"); |
| 2609 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2610 | if (P2P_LISTEN_STATE) { |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 2611 | u8remain_on_chan_flag = false; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2612 | wid.id = (u16)WID_REMAIN_ON_CHAN; |
| 2613 | wid.type = WID_STR; |
| 2614 | wid.size = 2; |
| 2615 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2616 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2617 | if (!wid.val) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2618 | PRINT_ER("Failed to allocate memory\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2619 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2620 | wid.val[0] = u8remain_on_chan_flag; |
| 2621 | wid.val[1] = FALSE_FRMWR_CHANNEL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2622 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2623 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2624 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2625 | if (result != 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2626 | PRINT_ER("Failed to set remain on channel\n"); |
| 2627 | goto _done_; |
| 2628 | } |
| 2629 | |
Leo Kim | bfb62ab | 2015-10-29 11:58:42 +0900 | [diff] [blame] | 2630 | if (hif_drv->remain_on_ch.expired) { |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 2631 | hif_drv->remain_on_ch.expired(hif_drv->remain_on_ch.arg, |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 2632 | pstrHostIfRemainOnChan->id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2633 | } |
| 2634 | P2P_LISTEN_STATE = 0; |
| 2635 | } else { |
| 2636 | PRINT_D(GENERIC_DBG, "Not in listen state\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2637 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2638 | } |
| 2639 | |
| 2640 | _done_: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2641 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2642 | } |
| 2643 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 2644 | static void ListenTimerCB(unsigned long arg) |
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; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2647 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2648 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2649 | |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 2650 | del_timer(&hif_drv->remain_on_ch_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2651 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2652 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2653 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2654 | msg.drv = hif_drv; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 2655 | msg.body.remain_on_ch.id = hif_drv->remain_on_ch.id; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2656 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2657 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 2658 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2659 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2660 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2661 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2662 | static void Handle_PowerManagement(struct host_if_drv *hif_drv, |
Tony Cho | 5a008f1 | 2015-09-21 12:16:48 +0900 | [diff] [blame] | 2663 | struct power_mgmt_param *strPowerMgmtParam) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2664 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2665 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2666 | struct wid wid; |
Chaehyun Lim | ca356ad | 2015-06-11 14:35:57 +0900 | [diff] [blame] | 2667 | s8 s8PowerMode; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 2668 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2669 | wid.id = (u16)WID_POWER_MANAGEMENT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2670 | |
Punit Vara | 047e664 | 2015-10-25 04:01:25 +0530 | [diff] [blame] | 2671 | if (strPowerMgmtParam->enabled) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2672 | s8PowerMode = MIN_FAST_PS; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 2673 | else |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2674 | s8PowerMode = NO_POWERSAVE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2675 | PRINT_D(HOSTINF_DBG, "Handling power mgmt to %d\n", s8PowerMode); |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2676 | wid.val = &s8PowerMode; |
| 2677 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2678 | |
| 2679 | PRINT_D(HOSTINF_DBG, "Handling Power Management\n"); |
| 2680 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2681 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2682 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2683 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2684 | PRINT_ER("Failed to send power management config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2685 | } |
| 2686 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2687 | static void Handle_SetMulticastFilter(struct host_if_drv *hif_drv, |
Tony Cho | 641210a | 2015-09-21 12:16:52 +0900 | [diff] [blame] | 2688 | struct set_multicast *strHostIfSetMulti) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2689 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2690 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2691 | struct wid wid; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 2692 | u8 *pu8CurrByte; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2693 | |
| 2694 | PRINT_D(HOSTINF_DBG, "Setup Multicast Filter\n"); |
| 2695 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2696 | wid.id = (u16)WID_SETUP_MULTICAST_FILTER; |
| 2697 | wid.type = WID_BIN; |
| 2698 | wid.size = sizeof(struct set_multicast) + ((strHostIfSetMulti->cnt) * ETH_ALEN); |
| 2699 | wid.val = kmalloc(wid.size, GFP_KERNEL); |
| 2700 | if (!wid.val) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2701 | goto ERRORHANDLER; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2702 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2703 | pu8CurrByte = wid.val; |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 2704 | *pu8CurrByte++ = (strHostIfSetMulti->enabled & 0xFF); |
| 2705 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 8) & 0xFF); |
| 2706 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 16) & 0xFF); |
| 2707 | *pu8CurrByte++ = ((strHostIfSetMulti->enabled >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2708 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2709 | *pu8CurrByte++ = (strHostIfSetMulti->cnt & 0xFF); |
| 2710 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 8) & 0xFF); |
| 2711 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 16) & 0xFF); |
| 2712 | *pu8CurrByte++ = ((strHostIfSetMulti->cnt >> 24) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2713 | |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 2714 | if ((strHostIfSetMulti->cnt) > 0) |
Leo Kim | fb70e9f | 2015-11-05 14:36:09 +0900 | [diff] [blame] | 2715 | memcpy(pu8CurrByte, multicast_mac_addr_list, |
| 2716 | ((strHostIfSetMulti->cnt) * ETH_ALEN)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2717 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2718 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2719 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2720 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2721 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2722 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 2723 | ERRORHANDLER: |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2724 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2725 | } |
| 2726 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2727 | static s32 Handle_AddBASession(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2728 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2729 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2730 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2731 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2732 | int AddbaTimeout = 100; |
| 2733 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2734 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2735 | PRINT_D(HOSTINF_DBG, "Opening Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\nBufferSize == %d\nSessionTimeOut = %d\n", |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2736 | strHostIfBASessionInfo->bssid[0], |
| 2737 | strHostIfBASessionInfo->bssid[1], |
| 2738 | strHostIfBASessionInfo->bssid[2], |
Leo Kim | 277c213 | 2015-10-29 11:58:47 +0900 | [diff] [blame] | 2739 | strHostIfBASessionInfo->buf_size, |
Leo Kim | 23d0bfa | 2015-10-29 11:58:48 +0900 | [diff] [blame] | 2740 | strHostIfBASessionInfo->time_out, |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2741 | strHostIfBASessionInfo->tid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2742 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2743 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2744 | wid.type = WID_STR; |
| 2745 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2746 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2747 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2748 | *ptr++ = 0x14; |
| 2749 | *ptr++ = 0x3; |
| 2750 | *ptr++ = 0x0; |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2751 | memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2752 | ptr += ETH_ALEN; |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2753 | *ptr++ = strHostIfBASessionInfo->tid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2754 | *ptr++ = 1; |
Leo Kim | 277c213 | 2015-10-29 11:58:47 +0900 | [diff] [blame] | 2755 | *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); |
| 2756 | *ptr++ = ((strHostIfBASessionInfo->buf_size >> 16) & 0xFF); |
Leo Kim | 23d0bfa | 2015-10-29 11:58:48 +0900 | [diff] [blame] | 2757 | *ptr++ = (strHostIfBASessionInfo->time_out & 0xFF); |
| 2758 | *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2759 | *ptr++ = (AddbaTimeout & 0xFF); |
| 2760 | *ptr++ = ((AddbaTimeout >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2761 | *ptr++ = 8; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2762 | *ptr++ = 0; |
| 2763 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2764 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2765 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2766 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2767 | PRINT_D(HOSTINF_DBG, "Couldn't open BA Session\n"); |
| 2768 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2769 | wid.id = (u16)WID_11E_P_ACTION_REQ; |
| 2770 | wid.type = WID_STR; |
| 2771 | wid.size = 15; |
| 2772 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2773 | *ptr++ = 15; |
| 2774 | *ptr++ = 7; |
| 2775 | *ptr++ = 0x2; |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2776 | memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2777 | ptr += ETH_ALEN; |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2778 | *ptr++ = strHostIfBASessionInfo->tid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2779 | *ptr++ = 8; |
Leo Kim | 277c213 | 2015-10-29 11:58:47 +0900 | [diff] [blame] | 2780 | *ptr++ = (strHostIfBASessionInfo->buf_size & 0xFF); |
Leo Kim | 23d0bfa | 2015-10-29 11:58:48 +0900 | [diff] [blame] | 2781 | *ptr++ = ((strHostIfBASessionInfo->time_out >> 16) & 0xFF); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2782 | *ptr++ = 3; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2783 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2784 | get_id_from_handler(hif_drv)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2785 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2786 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2787 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2788 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2789 | } |
| 2790 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2791 | static s32 Handle_DelAllRxBASessions(struct host_if_drv *hif_drv, |
Tony Cho | 5426547 | 2015-09-21 12:16:56 +0900 | [diff] [blame] | 2792 | struct ba_session_info *strHostIfBASessionInfo) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2793 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2794 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2795 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2796 | char *ptr = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2797 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2798 | PRINT_D(GENERIC_DBG, "Delete Block Ack session with\nBSSID = %.2x:%.2x:%.2x\nTID=%d\n", |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2799 | strHostIfBASessionInfo->bssid[0], |
| 2800 | strHostIfBASessionInfo->bssid[1], |
| 2801 | strHostIfBASessionInfo->bssid[2], |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2802 | strHostIfBASessionInfo->tid); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2803 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2804 | wid.id = (u16)WID_DEL_ALL_RX_BA; |
| 2805 | wid.type = WID_STR; |
| 2806 | wid.val = kmalloc(BLOCK_ACK_REQ_SIZE, GFP_KERNEL); |
| 2807 | wid.size = BLOCK_ACK_REQ_SIZE; |
| 2808 | ptr = wid.val; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2809 | *ptr++ = 0x14; |
| 2810 | *ptr++ = 0x3; |
| 2811 | *ptr++ = 0x2; |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 2812 | memcpy(ptr, strHostIfBASessionInfo->bssid, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2813 | ptr += ETH_ALEN; |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 2814 | *ptr++ = strHostIfBASessionInfo->tid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2815 | *ptr++ = 0; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 2816 | *ptr++ = 32; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2817 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2818 | result = send_config_pkt(SET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 2819 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2820 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2821 | PRINT_D(HOSTINF_DBG, "Couldn't delete BA Session\n"); |
| 2822 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 2823 | kfree(wid.val); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2824 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 2825 | up(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2826 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 2827 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2828 | } |
| 2829 | |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 2830 | static int hostIFthread(void *pvArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2831 | { |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 2832 | u32 u32Ret; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2833 | struct host_if_msg msg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 2834 | struct host_if_drv *hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2835 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 2836 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2837 | |
| 2838 | while (1) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2839 | 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] | 2840 | hif_drv = (struct host_if_drv *)msg.drv; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2841 | if (msg.id == HOST_IF_MSG_EXIT) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2842 | PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n"); |
| 2843 | break; |
| 2844 | } |
| 2845 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2846 | if ((!g_wilc_initialized)) { |
| 2847 | PRINT_D(GENERIC_DBG, "--WAIT--"); |
Greg Kroah-Hartman | 80e29c7 | 2015-08-14 19:42:23 -0700 | [diff] [blame] | 2848 | usleep_range(200 * 1000, 200 * 1000); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2849 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2850 | continue; |
| 2851 | } |
| 2852 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 2853 | if (msg.id == HOST_IF_MSG_CONNECT && |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 2854 | hif_drv->usr_scan_req.scan_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2855 | PRINT_D(HOSTINF_DBG, "Requeue connect request till scan done received\n"); |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 2856 | 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] | 2857 | usleep_range(2 * 1000, 2 * 1000); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2858 | continue; |
| 2859 | } |
| 2860 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 2861 | switch (msg.id) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2862 | case HOST_IF_MSG_Q_IDLE: |
| 2863 | Handle_wait_msg_q_empty(); |
| 2864 | break; |
| 2865 | |
| 2866 | case HOST_IF_MSG_SCAN: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2867 | Handle_Scan(msg.drv, &msg.body.scan_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2868 | break; |
| 2869 | |
| 2870 | case HOST_IF_MSG_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2871 | Handle_Connect(msg.drv, &msg.body.con_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2872 | break; |
| 2873 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2874 | case HOST_IF_MSG_FLUSH_CONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2875 | Handle_FlushConnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2876 | break; |
| 2877 | |
| 2878 | case HOST_IF_MSG_RCVD_NTWRK_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2879 | Handle_RcvdNtwrkInfo(msg.drv, &msg.body.net_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2880 | break; |
| 2881 | |
| 2882 | case HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2883 | Handle_RcvdGnrlAsyncInfo(msg.drv, &msg.body.async_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2884 | break; |
| 2885 | |
| 2886 | case HOST_IF_MSG_KEY: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2887 | Handle_Key(msg.drv, &msg.body.key_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2888 | break; |
| 2889 | |
| 2890 | case HOST_IF_MSG_CFG_PARAMS: |
Leo Kim | dc27666 | 2015-11-06 11:20:10 +0900 | [diff] [blame^] | 2891 | handle_cfg_param(msg.drv, &msg.body.cfg_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2892 | break; |
| 2893 | |
| 2894 | case HOST_IF_MSG_SET_CHANNEL: |
Leo Kim | 3eec50c | 2015-11-06 11:20:03 +0900 | [diff] [blame] | 2895 | handle_set_channel(msg.drv, &msg.body.channel_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2896 | break; |
| 2897 | |
| 2898 | case HOST_IF_MSG_DISCONNECT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2899 | Handle_Disconnect(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2900 | break; |
| 2901 | |
| 2902 | case HOST_IF_MSG_RCVD_SCAN_COMPLETE: |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 2903 | del_timer(&hif_drv->scan_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2904 | PRINT_D(HOSTINF_DBG, "scan completed successfully\n"); |
| 2905 | |
Luis de Bethencourt | 2b9d5b4 | 2015-06-26 16:44:24 +0200 | [diff] [blame] | 2906 | if (!linux_wlan_get_num_conn_ifcs()) |
Leo Kim | 1b721bf | 2015-11-06 11:13:00 +0900 | [diff] [blame] | 2907 | chip_sleep_manually(); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2908 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2909 | Handle_ScanDone(msg.drv, SCAN_EVENT_DONE); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2910 | |
Leo Kim | 5beef2c | 2015-10-28 15:59:36 +0900 | [diff] [blame] | 2911 | if (hif_drv->remain_on_ch_pending) |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2912 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2913 | |
| 2914 | break; |
| 2915 | |
| 2916 | case HOST_IF_MSG_GET_RSSI: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2917 | Handle_GetRssi(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2918 | break; |
| 2919 | |
| 2920 | case HOST_IF_MSG_GET_LINKSPEED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2921 | Handle_GetLinkspeed(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2922 | break; |
| 2923 | |
| 2924 | case HOST_IF_MSG_GET_STATISTICS: |
Leo Kim | 03e7b9c | 2015-10-12 16:55:58 +0900 | [diff] [blame] | 2925 | Handle_GetStatistics(msg.drv, (struct rf_info *)msg.body.data); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2926 | break; |
| 2927 | |
| 2928 | case HOST_IF_MSG_GET_CHNL: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2929 | Handle_GetChnl(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2930 | break; |
| 2931 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2932 | case HOST_IF_MSG_ADD_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2933 | Handle_AddBeacon(msg.drv, &msg.body.beacon_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2934 | break; |
| 2935 | |
| 2936 | case HOST_IF_MSG_DEL_BEACON: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2937 | Handle_DelBeacon(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2938 | break; |
| 2939 | |
| 2940 | case HOST_IF_MSG_ADD_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2941 | Handle_AddStation(msg.drv, &msg.body.add_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2942 | break; |
| 2943 | |
| 2944 | case HOST_IF_MSG_DEL_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2945 | Handle_DelStation(msg.drv, &msg.body.del_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2946 | break; |
| 2947 | |
| 2948 | case HOST_IF_MSG_EDIT_STATION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2949 | Handle_EditStation(msg.drv, &msg.body.edit_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2950 | break; |
| 2951 | |
| 2952 | case HOST_IF_MSG_GET_INACTIVETIME: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2953 | Handle_Get_InActiveTime(msg.drv, &msg.body.mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2954 | break; |
| 2955 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2956 | case HOST_IF_MSG_SCAN_TIMER_FIRED: |
| 2957 | PRINT_D(HOSTINF_DBG, "Scan Timeout\n"); |
| 2958 | |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2959 | Handle_ScanDone(msg.drv, SCAN_EVENT_ABORTED); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2960 | break; |
| 2961 | |
| 2962 | case HOST_IF_MSG_CONNECT_TIMER_FIRED: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 2963 | PRINT_D(HOSTINF_DBG, "Connect Timeout\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2964 | Handle_ConnectTimeout(msg.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2965 | break; |
| 2966 | |
| 2967 | case HOST_IF_MSG_POWER_MGMT: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 2968 | Handle_PowerManagement(msg.drv, &msg.body.pwr_mgmt_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2969 | break; |
| 2970 | |
| 2971 | case HOST_IF_MSG_SET_WFIDRV_HANDLER: |
Leo Kim | 23f2bad | 2015-11-06 11:20:04 +0900 | [diff] [blame] | 2972 | handle_set_wfi_drv_handler(msg.drv, &msg.body.drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2973 | break; |
| 2974 | |
| 2975 | case HOST_IF_MSG_SET_OPERATION_MODE: |
Leo Kim | 97b5c59 | 2015-11-06 11:20:05 +0900 | [diff] [blame] | 2976 | handle_set_operation_mode(msg.drv, &msg.body.mode); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2977 | break; |
| 2978 | |
| 2979 | case HOST_IF_MSG_SET_IPADDRESS: |
| 2980 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | a6e6d48 | 2015-11-06 11:20:06 +0900 | [diff] [blame] | 2981 | handle_set_ip_address(msg.drv, |
| 2982 | msg.body.ip_info.ip_addr, |
| 2983 | msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2984 | break; |
| 2985 | |
| 2986 | case HOST_IF_MSG_GET_IPADDRESS: |
| 2987 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_IPADDRESS\n"); |
Leo Kim | d451695 | 2015-11-06 11:20:07 +0900 | [diff] [blame] | 2988 | handle_get_ip_address(msg.drv, msg.body.ip_info.idx); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2989 | break; |
| 2990 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2991 | case HOST_IF_MSG_SET_MAC_ADDRESS: |
Leo Kim | a826742 | 2015-11-06 11:20:08 +0900 | [diff] [blame] | 2992 | handle_set_mac_address(msg.drv, |
| 2993 | &msg.body.set_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2994 | break; |
| 2995 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2996 | case HOST_IF_MSG_GET_MAC_ADDRESS: |
Leo Kim | b3bf8fd | 2015-11-06 11:20:09 +0900 | [diff] [blame] | 2997 | handle_get_mac_address(msg.drv, |
| 2998 | &msg.body.get_mac_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 2999 | break; |
| 3000 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3001 | case HOST_IF_MSG_REMAIN_ON_CHAN: |
| 3002 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REMAIN_ON_CHAN\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3003 | Handle_RemainOnChan(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3004 | break; |
| 3005 | |
| 3006 | case HOST_IF_MSG_REGISTER_FRAME: |
| 3007 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_REGISTER_FRAME\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3008 | Handle_RegisterFrame(msg.drv, &msg.body.reg_frame); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3009 | break; |
| 3010 | |
| 3011 | case HOST_IF_MSG_LISTEN_TIMER_FIRED: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3012 | Handle_ListenStateExpired(msg.drv, &msg.body.remain_on_ch); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3013 | break; |
| 3014 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3015 | case HOST_IF_MSG_SET_MULTICAST_FILTER: |
| 3016 | PRINT_D(HOSTINF_DBG, "HOST_IF_MSG_SET_MULTICAST_FILTER\n"); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3017 | Handle_SetMulticastFilter(msg.drv, &msg.body.multicast_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3018 | break; |
| 3019 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3020 | case HOST_IF_MSG_ADD_BA_SESSION: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3021 | Handle_AddBASession(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3022 | break; |
| 3023 | |
| 3024 | case HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3025 | Handle_DelAllRxBASessions(msg.drv, &msg.body.session_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3026 | break; |
| 3027 | |
| 3028 | case HOST_IF_MSG_DEL_ALL_STA: |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3029 | Handle_DelAllSta(msg.drv, &msg.body.del_all_sta_info); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3030 | break; |
| 3031 | |
| 3032 | default: |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3033 | PRINT_ER("[Host Interface] undefined Received Msg ID\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3034 | break; |
| 3035 | } |
| 3036 | } |
| 3037 | |
| 3038 | PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 3039 | up(&hif_sema_thread); |
Arnd Bergmann | 1999bd5 | 2015-05-29 22:52:14 +0200 | [diff] [blame] | 3040 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3041 | } |
| 3042 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3043 | static void TimerCB_Scan(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3044 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3045 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3046 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3047 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3048 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3049 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3050 | msg.id = HOST_IF_MSG_SCAN_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3051 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3052 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3053 | } |
| 3054 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3055 | static void TimerCB_Connect(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3056 | { |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 3057 | void *pvArg = (void *)arg; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3058 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3059 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3060 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 2482a79 | 2015-10-12 16:55:36 +0900 | [diff] [blame] | 3061 | msg.drv = pvArg; |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3062 | msg.id = HOST_IF_MSG_CONNECT_TIMER_FIRED; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3063 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3064 | wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3065 | } |
| 3066 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3067 | 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] | 3068 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3069 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3070 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3071 | wid.id = (u16)WID_REMOVE_KEY; |
| 3072 | wid.type = WID_STR; |
| 3073 | wid.val = (s8 *)pu8StaAddress; |
| 3074 | wid.size = 6; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3075 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3076 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3077 | } |
| 3078 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3079 | 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] | 3080 | { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3081 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3082 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3083 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3084 | if (!hif_drv) { |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3085 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3086 | PRINT_ER("Failed to send setup multicast config packet\n"); |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3087 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3088 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3089 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3090 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3091 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3092 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3093 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3094 | msg.body.key_info.action = REMOVEKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3095 | msg.drv = hif_drv; |
Leo Kim | 73b2e38 | 2015-10-13 19:49:29 +0900 | [diff] [blame] | 3096 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3097 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3098 | 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] | 3099 | if (result) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 3100 | PRINT_ER("Error in sending message queue : Request to remove WEP key\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3101 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3102 | |
Chaehyun Lim | 9e5e8b4 | 2015-10-05 19:35:00 +0900 | [diff] [blame] | 3103 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3104 | } |
| 3105 | |
Chaehyun Lim | df8b483 | 2015-10-26 09:44:45 +0900 | [diff] [blame] | 3106 | 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] | 3107 | { |
Chaehyun Lim | 5b41c7c | 2015-10-26 09:44:42 +0900 | [diff] [blame] | 3108 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3109 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3110 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3111 | if (!hif_drv) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3112 | result = -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3113 | PRINT_ER("driver is null\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3114 | return result; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3115 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3116 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3117 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3118 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3119 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3120 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3121 | msg.body.key_info.action = DEFAULTKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3122 | msg.drv = hif_drv; |
Chaehyun Lim | e91d034 | 2015-10-26 09:44:44 +0900 | [diff] [blame] | 3123 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3124 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3125 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3126 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3127 | PRINT_ER("Error in sending message queue : Default key index\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3128 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3129 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3130 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3131 | } |
| 3132 | |
Chaehyun Lim | 66b8cb8 | 2015-10-27 20:40:32 +0900 | [diff] [blame] | 3133 | 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] | 3134 | const u8 *key, |
Chaehyun Lim | dbc5319 | 2015-10-27 20:40:35 +0900 | [diff] [blame] | 3135 | u8 len, |
Chaehyun Lim | 0b2cc3e | 2015-10-27 20:40:36 +0900 | [diff] [blame] | 3136 | u8 index) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3137 | { |
Chaehyun Lim | 66b8cb8 | 2015-10-27 20:40:32 +0900 | [diff] [blame] | 3138 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3139 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3140 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3141 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3142 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3143 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3144 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3145 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3146 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3147 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3148 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3149 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3150 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3151 | msg.drv = hif_drv; |
Chaehyun Lim | 1cc0c32 | 2015-10-27 20:40:37 +0900 | [diff] [blame] | 3152 | msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); |
| 3153 | if (!msg.body.key_info.attr.wep.key) |
| 3154 | return -ENOMEM; |
| 3155 | |
Chaehyun Lim | dbc5319 | 2015-10-27 20:40:35 +0900 | [diff] [blame] | 3156 | msg.body.key_info.attr.wep.key_len = len; |
Chaehyun Lim | 0b2cc3e | 2015-10-27 20:40:36 +0900 | [diff] [blame] | 3157 | msg.body.key_info.attr.wep.index = index; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3158 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3159 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3160 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3161 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3162 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3163 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3164 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3165 | } |
| 3166 | |
Chaehyun Lim | 641c20a | 2015-10-28 08:19:19 +0900 | [diff] [blame] | 3167 | 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] | 3168 | const u8 *key, |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3169 | u8 len, |
Chaehyun Lim | a76dc95 | 2015-10-28 08:19:24 +0900 | [diff] [blame] | 3170 | u8 index, |
Chaehyun Lim | 730a28d | 2015-10-28 08:19:25 +0900 | [diff] [blame] | 3171 | u8 mode, |
Chaehyun Lim | ff3bce2 | 2015-10-28 08:19:26 +0900 | [diff] [blame] | 3172 | enum AUTHTYPE auth_type) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3173 | { |
Chaehyun Lim | 641c20a | 2015-10-28 08:19:19 +0900 | [diff] [blame] | 3174 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3175 | struct host_if_msg msg; |
Chaehyun Lim | fd74146 | 2015-10-28 08:19:21 +0900 | [diff] [blame] | 3176 | int i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3177 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3178 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3179 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3180 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3181 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3182 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3183 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3184 | |
| 3185 | if (INFO) { |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3186 | for (i = 0; i < len; i++) |
Chaehyun Lim | 8111725 | 2015-10-28 08:19:22 +0900 | [diff] [blame] | 3187 | PRINT_INFO(HOSTAPD_DBG, "KEY is %x\n", key[i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3188 | } |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3189 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3190 | msg.body.key_info.type = WEP; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3191 | msg.body.key_info.action = ADDKEY_AP; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3192 | msg.drv = hif_drv; |
Chaehyun Lim | 58eabd6 | 2015-10-28 08:19:27 +0900 | [diff] [blame] | 3193 | msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL); |
| 3194 | if (!msg.body.key_info.attr.wep.key) |
| 3195 | return -ENOMEM; |
| 3196 | |
Chaehyun Lim | a5389b0 | 2015-10-28 08:19:23 +0900 | [diff] [blame] | 3197 | msg.body.key_info.attr.wep.key_len = len; |
Chaehyun Lim | a76dc95 | 2015-10-28 08:19:24 +0900 | [diff] [blame] | 3198 | msg.body.key_info.attr.wep.index = index; |
Chaehyun Lim | 730a28d | 2015-10-28 08:19:25 +0900 | [diff] [blame] | 3199 | msg.body.key_info.attr.wep.mode = mode; |
Chaehyun Lim | ff3bce2 | 2015-10-28 08:19:26 +0900 | [diff] [blame] | 3200 | msg.body.key_info.attr.wep.auth_type = auth_type; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3201 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3202 | 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] | 3203 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3204 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3205 | PRINT_ER("Error in sending message queue :WEP Key\n"); |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3206 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3207 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3208 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3209 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3210 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3211 | s32 host_int_add_ptk(struct host_if_drv *hif_drv, const u8 *pu8Ptk, |
| 3212 | u8 u8PtkKeylen, const u8 *mac_addr, |
| 3213 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 3214 | u8 mode, u8 u8Ciphermode, u8 u8Idx) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3215 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3216 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3217 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3218 | u8 u8KeyLen = u8PtkKeylen; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3219 | u32 i; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 3220 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3221 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3222 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3223 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3224 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3225 | |
| 3226 | if (pu8RxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3227 | u8KeyLen += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3228 | |
| 3229 | if (pu8TxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3230 | u8KeyLen += TX_MIC_KEY_LEN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3231 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3232 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3233 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3234 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 2141fe3 | 2015-10-29 12:05:35 +0900 | [diff] [blame] | 3235 | msg.body.key_info.type = WPA_PTK; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3236 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3237 | msg.body.key_info.action = ADDKEY_AP; |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 3238 | msg.body.key_info.attr.wpa.index = u8Idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3239 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3240 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3241 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3242 | |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3243 | msg.body.key_info.attr.wpa.key = kmalloc(u8PtkKeylen, GFP_KERNEL); |
| 3244 | memcpy(msg.body.key_info.attr.wpa.key, pu8Ptk, u8PtkKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3245 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3246 | if (pu8RxMic) { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3247 | 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] | 3248 | if (INFO) { |
| 3249 | for (i = 0; i < RX_MIC_KEY_LEN; i++) |
| 3250 | PRINT_INFO(CFG80211_DBG, "PairwiseRx[%d] = %x\n", i, pu8RxMic[i]); |
| 3251 | } |
| 3252 | } |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3253 | if (pu8TxMic) { |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3254 | 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] | 3255 | if (INFO) { |
| 3256 | for (i = 0; i < TX_MIC_KEY_LEN; i++) |
| 3257 | PRINT_INFO(CFG80211_DBG, "PairwiseTx[%d] = %x\n", i, pu8TxMic[i]); |
| 3258 | } |
| 3259 | } |
| 3260 | |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 3261 | msg.body.key_info.attr.wpa.key_len = u8KeyLen; |
Leo Kim | 248080a | 2015-10-13 19:49:31 +0900 | [diff] [blame] | 3262 | msg.body.key_info.attr.wpa.mac_addr = mac_addr; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 3263 | msg.body.key_info.attr.wpa.mode = u8Ciphermode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3264 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3265 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3266 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3267 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3268 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3269 | PRINT_ER("Error in sending message queue: PTK Key\n"); |
| 3270 | |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3271 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3272 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3273 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3274 | } |
| 3275 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3276 | s32 host_int_add_rx_gtk(struct host_if_drv *hif_drv, const u8 *pu8RxGtk, |
| 3277 | u8 u8GtkKeylen, u8 u8KeyIdx, |
| 3278 | u32 u32KeyRSClen, const u8 *KeyRSC, |
| 3279 | const u8 *pu8RxMic, const u8 *pu8TxMic, |
| 3280 | u8 mode, u8 u8Ciphermode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3281 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3282 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3283 | struct host_if_msg msg; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 3284 | u8 u8KeyLen = u8GtkKeylen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3285 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3286 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3287 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3288 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3289 | } |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3290 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3291 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3292 | if (pu8RxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3293 | u8KeyLen += RX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3294 | |
| 3295 | if (pu8TxMic) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3296 | u8KeyLen += TX_MIC_KEY_LEN; |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3297 | |
| 3298 | if (KeyRSC) { |
Leo Kim | 0e74c00 | 2015-10-13 19:49:32 +0900 | [diff] [blame] | 3299 | msg.body.key_info.attr.wpa.seq = kmalloc(u32KeyRSClen, GFP_KERNEL); |
| 3300 | memcpy(msg.body.key_info.attr.wpa.seq, KeyRSC, u32KeyRSClen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3301 | } |
| 3302 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3303 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 5cd8f7a | 2015-10-29 12:05:34 +0900 | [diff] [blame] | 3304 | msg.body.key_info.type = WPA_RX_GTK; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3305 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3306 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3307 | if (mode == AP_MODE) { |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3308 | msg.body.key_info.action = ADDKEY_AP; |
Leo Kim | 7b2ebb2 | 2015-10-13 19:49:36 +0900 | [diff] [blame] | 3309 | msg.body.key_info.attr.wpa.mode = u8Ciphermode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3310 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3311 | if (mode == STATION_MODE) |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3312 | msg.body.key_info.action = ADDKEY; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3313 | |
Leo Kim | 124968fc | 2015-10-13 19:49:30 +0900 | [diff] [blame] | 3314 | msg.body.key_info.attr.wpa.key = kmalloc(u8KeyLen, GFP_KERNEL); |
| 3315 | memcpy(msg.body.key_info.attr.wpa.key, pu8RxGtk, u8GtkKeylen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3316 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3317 | if (pu8RxMic) |
| 3318 | memcpy(msg.body.key_info.attr.wpa.key + 16, pu8RxMic, |
| 3319 | RX_MIC_KEY_LEN); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3320 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 3321 | if (pu8TxMic) |
| 3322 | memcpy(msg.body.key_info.attr.wpa.key + 24, pu8TxMic, |
| 3323 | TX_MIC_KEY_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3324 | |
Leo Kim | e2dfbac | 2015-10-13 19:49:34 +0900 | [diff] [blame] | 3325 | msg.body.key_info.attr.wpa.index = u8KeyIdx; |
Leo Kim | 6acf291 | 2015-10-13 19:49:35 +0900 | [diff] [blame] | 3326 | msg.body.key_info.attr.wpa.key_len = u8KeyLen; |
Leo Kim | dacc594 | 2015-10-13 19:49:33 +0900 | [diff] [blame] | 3327 | msg.body.key_info.attr.wpa.seq_len = u32KeyRSClen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3328 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3329 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3330 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3331 | PRINT_ER("Error in sending message queue: RX GTK\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3332 | |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 3333 | down(&hif_drv->sem_test_key_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3334 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3335 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3336 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3337 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3338 | 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] | 3339 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3340 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3341 | struct host_if_msg msg; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 3342 | u32 i; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3343 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3344 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3345 | PRINT_ER("driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3346 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3347 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3348 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3349 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3350 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3351 | msg.id = HOST_IF_MSG_KEY; |
Leo Kim | 8e9f427 | 2015-10-13 19:49:27 +0900 | [diff] [blame] | 3352 | msg.body.key_info.type = PMKSA; |
Leo Kim | 0d17e38 | 2015-10-13 19:49:28 +0900 | [diff] [blame] | 3353 | msg.body.key_info.action = ADDKEY; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3354 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3355 | |
| 3356 | for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) { |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3357 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].bssid, |
| 3358 | &pu8PmkidInfoArray->pmkidlist[i].bssid, ETH_ALEN); |
| 3359 | memcpy(msg.body.key_info.attr.pmkid.pmkidlist[i].pmkid, |
| 3360 | &pu8PmkidInfoArray->pmkidlist[i].pmkid, PMKID_LEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3361 | } |
| 3362 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3363 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3364 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3365 | PRINT_ER(" Error in sending messagequeue: PMKID Info\n"); |
| 3366 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3367 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3368 | } |
| 3369 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3370 | s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv, |
| 3371 | u8 *pu8PmkidInfoArray, |
| 3372 | u32 u32PmkidInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3373 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3374 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3375 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3376 | wid.id = (u16)WID_PMKID_INFO; |
| 3377 | wid.type = WID_STR; |
| 3378 | wid.size = u32PmkidInfoLen; |
| 3379 | wid.val = pu8PmkidInfoArray; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3380 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3381 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3382 | } |
| 3383 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3384 | s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3385 | u8 *pu8PassPhrase, |
| 3386 | u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3387 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3388 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3389 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3390 | if ((u8Psklength > 7) && (u8Psklength < 65)) { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3391 | wid.id = (u16)WID_11I_PSK; |
| 3392 | wid.type = WID_STR; |
| 3393 | wid.val = pu8PassPhrase; |
| 3394 | wid.size = u8Psklength; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3395 | } |
| 3396 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3397 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3398 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3399 | |
Leo Kim | e5f3524 | 2015-11-05 14:36:36 +0900 | [diff] [blame] | 3400 | s32 hif_get_mac_address(struct host_if_drv *hif_drv, u8 *pu8MacAddress) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3401 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3402 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3403 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3404 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3405 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3406 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3407 | msg.id = HOST_IF_MSG_GET_MAC_ADDRESS; |
Leo Kim | 6ceba0a | 2015-10-28 15:59:32 +0900 | [diff] [blame] | 3408 | msg.body.get_mac_info.mac_addr = pu8MacAddress; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3409 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +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 get mac address\n"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3414 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3415 | } |
| 3416 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3417 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3418 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3419 | } |
| 3420 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3421 | 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] | 3422 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3423 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3424 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3425 | |
| 3426 | PRINT_D(GENERIC_DBG, "mac addr = %x:%x:%x\n", pu8MacAddress[0], pu8MacAddress[1], pu8MacAddress[2]); |
| 3427 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3428 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3429 | msg.id = HOST_IF_MSG_SET_MAC_ADDRESS; |
Leo Kim | ae5e452 | 2015-10-28 15:59:31 +0900 | [diff] [blame] | 3430 | memcpy(msg.body.set_mac_info.mac_addr, pu8MacAddress, ETH_ALEN); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3431 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3432 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3433 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3434 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3435 | PRINT_ER("Failed to send message queue: Set mac address\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3436 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3437 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3438 | } |
| 3439 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3440 | s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv, |
| 3441 | u8 *pu8PassPhrase, u8 u8Psklength) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3442 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3443 | struct wid wid; |
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 | wid.id = (u16)WID_11I_PSK; |
| 3446 | wid.type = WID_STR; |
| 3447 | wid.size = u8Psklength; |
| 3448 | wid.val = pu8PassPhrase; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3449 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3450 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3451 | } |
| 3452 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3453 | 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] | 3454 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3455 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3456 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3457 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3458 | wid.type = WID_CHAR; |
| 3459 | wid.val = (s8 *)&scanSource; |
| 3460 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3461 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3462 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3463 | } |
| 3464 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3465 | 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] | 3466 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3467 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3468 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3469 | wid.id = (u16)WID_START_SCAN_REQ; |
| 3470 | wid.type = WID_CHAR; |
| 3471 | wid.val = (s8 *)pu8ScanSource; |
| 3472 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3473 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3474 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3475 | } |
| 3476 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3477 | s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid, |
| 3478 | const u8 *pu8ssid, size_t ssidLen, |
| 3479 | const u8 *pu8IEs, size_t IEsLen, |
| 3480 | wilc_connect_result pfConnectResult, void *pvUserArg, |
| 3481 | u8 u8security, enum AUTHTYPE tenuAuth_type, |
| 3482 | u8 u8channel, void *pJoinParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3483 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3484 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3485 | struct host_if_msg msg; |
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 (!hif_drv || !pfConnectResult) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3488 | PRINT_ER("Driver is null\n"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3489 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3490 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3491 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3492 | if (!pJoinParams) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3493 | PRINT_ER("Unable to Join - JoinParams is NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3494 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3495 | } |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3496 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3497 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3498 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3499 | msg.id = HOST_IF_MSG_CONNECT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3500 | |
Leo Kim | a64fd67 | 2015-10-13 19:49:54 +0900 | [diff] [blame] | 3501 | msg.body.con_info.security = u8security; |
Leo Kim | 61b4fd0 | 2015-10-13 19:49:57 +0900 | [diff] [blame] | 3502 | msg.body.con_info.auth_type = tenuAuth_type; |
Leo Kim | 0d1527e | 2015-10-13 19:49:58 +0900 | [diff] [blame] | 3503 | msg.body.con_info.ch = u8channel; |
Leo Kim | 6abcc11 | 2015-10-13 19:49:55 +0900 | [diff] [blame] | 3504 | msg.body.con_info.result = pfConnectResult; |
Leo Kim | 8f38db8 | 2015-10-13 19:49:56 +0900 | [diff] [blame] | 3505 | msg.body.con_info.arg = pvUserArg; |
Leo Kim | f2bed2c | 2015-10-13 19:49:59 +0900 | [diff] [blame] | 3506 | msg.body.con_info.params = pJoinParams; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3507 | msg.drv = hif_drv ; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3508 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3509 | if (pu8bssid) { |
Leo Kim | 9254db0 | 2015-10-13 19:49:49 +0900 | [diff] [blame] | 3510 | msg.body.con_info.bssid = kmalloc(6, GFP_KERNEL); |
| 3511 | memcpy(msg.body.con_info.bssid, pu8bssid, 6); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3512 | } |
| 3513 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3514 | if (pu8ssid) { |
Leo Kim | 8b3c9fa | 2015-10-13 19:49:51 +0900 | [diff] [blame] | 3515 | msg.body.con_info.ssid_len = ssidLen; |
Leo Kim | f7bbd9c | 2015-10-13 19:49:50 +0900 | [diff] [blame] | 3516 | msg.body.con_info.ssid = kmalloc(ssidLen, GFP_KERNEL); |
| 3517 | memcpy(msg.body.con_info.ssid, pu8ssid, ssidLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3518 | } |
| 3519 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3520 | if (pu8IEs) { |
Leo Kim | b59d5c5 | 2015-10-13 19:49:53 +0900 | [diff] [blame] | 3521 | msg.body.con_info.ies_len = IEsLen; |
Leo Kim | 2ea158c | 2015-10-13 19:49:52 +0900 | [diff] [blame] | 3522 | msg.body.con_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3523 | memcpy(msg.body.con_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3524 | } |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 3525 | if (hif_drv->hif_state < HOST_IF_CONNECTING) |
| 3526 | hif_drv->hif_state = HOST_IF_CONNECTING; |
Chandra S Gorentla | 78174ad | 2015-08-08 17:41:36 +0530 | [diff] [blame] | 3527 | else |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 3528 | PRINT_D(GENERIC_DBG, "Don't set state to 'connecting' : %d\n", |
| 3529 | hif_drv->hif_state); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3530 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3531 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3532 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3533 | PRINT_ER("Failed to send message queue: Set join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3534 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3535 | } |
| 3536 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 3537 | hif_drv->connect_timer.data = (unsigned long)hif_drv; |
| 3538 | mod_timer(&hif_drv->connect_timer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3539 | jiffies + msecs_to_jiffies(HOST_IF_CONNECT_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3540 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3541 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3542 | } |
| 3543 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3544 | s32 host_int_flush_join_req(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3545 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3546 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3547 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3548 | |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3549 | if (!join_req) |
| 3550 | return -EFAULT; |
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"); |
Leo Kim | 771788078 | 2015-10-19 18:26:11 +0900 | [diff] [blame] | 3554 | return -EFAULT; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3555 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3556 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3557 | msg.id = HOST_IF_MSG_FLUSH_CONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3558 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3559 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3560 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3561 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3562 | PRINT_ER("Failed to send message queue: Flush join request\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3563 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3564 | } |
| 3565 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3566 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3567 | } |
| 3568 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3569 | s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 u16ReasonCode) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3570 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3571 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3572 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3573 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3574 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3575 | PRINT_ER("Driver is null\n"); |
| 3576 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3577 | } |
| 3578 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3579 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3580 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3581 | msg.id = HOST_IF_MSG_DISCONNECT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3582 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3583 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3584 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3585 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3586 | PRINT_ER("Failed to send message queue: disconnect\n"); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3587 | |
Leo Kim | e55e496 | 2015-10-29 11:58:29 +0900 | [diff] [blame] | 3588 | down(&hif_drv->sem_test_disconn_block); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3589 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3590 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3591 | } |
| 3592 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3593 | 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] | 3594 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3595 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3596 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3597 | wid.id = (u16)WID_DISCONNECT; |
| 3598 | wid.type = WID_CHAR; |
| 3599 | wid.val = (s8 *)&assoc_id; |
| 3600 | wid.size = sizeof(char); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3601 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3602 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3603 | } |
| 3604 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3605 | s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, |
| 3606 | u8 *pu8AssocReqInfo, |
| 3607 | u32 u32AssocReqInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3608 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3609 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3610 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3611 | wid.id = (u16)WID_ASSOC_REQ_INFO; |
| 3612 | wid.type = WID_STR; |
| 3613 | wid.val = pu8AssocReqInfo; |
| 3614 | wid.size = u32AssocReqInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3615 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3616 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3617 | } |
| 3618 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3619 | s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, |
| 3620 | u8 *pu8AssocRespInfo, |
| 3621 | u32 u32MaxAssocRespInfoLen, |
| 3622 | u32 *pu32RcvdAssocRespInfoLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3623 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3624 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3625 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3626 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3627 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3628 | PRINT_ER("Driver is null\n"); |
| 3629 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3630 | } |
| 3631 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3632 | wid.id = (u16)WID_ASSOC_RES_INFO; |
| 3633 | wid.type = WID_STR; |
| 3634 | wid.val = pu8AssocRespInfo; |
| 3635 | wid.size = u32MaxAssocRespInfoLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3636 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3637 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3638 | get_id_from_handler(hif_drv)); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3639 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3640 | *pu32RcvdAssocRespInfoLen = 0; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3641 | PRINT_ER("Failed to send association response config packet\n"); |
| 3642 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3643 | } else { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3644 | *pu32RcvdAssocRespInfoLen = wid.size; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3645 | } |
| 3646 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3647 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3648 | } |
| 3649 | |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3650 | s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, |
| 3651 | u8 *pu8RxPowerLevel, |
| 3652 | u32 u32RxPowerLevelLen) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3653 | { |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3654 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3655 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3656 | wid.id = (u16)WID_RX_POWER_LEVEL; |
| 3657 | wid.type = WID_STR; |
| 3658 | wid.val = pu8RxPowerLevel; |
| 3659 | wid.size = u32RxPowerLevelLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3660 | |
Leo Kim | b68d820b | 2015-10-12 16:55:37 +0900 | [diff] [blame] | 3661 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3662 | } |
| 3663 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3664 | 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] | 3665 | { |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3666 | int result; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3667 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3668 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3669 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3670 | PRINT_ER("driver is null\n"); |
| 3671 | return -EFAULT; |
| 3672 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3673 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3674 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3675 | msg.id = HOST_IF_MSG_SET_CHANNEL; |
Leo Kim | 730ee05 | 2015-10-13 19:50:02 +0900 | [diff] [blame] | 3676 | msg.body.channel_info.set_ch = channel; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3677 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3678 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3679 | 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] | 3680 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3681 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3682 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3683 | } |
| 3684 | |
Chaehyun Lim | 792fb25 | 2015-10-05 11:07:22 +0900 | [diff] [blame] | 3685 | return 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3686 | } |
| 3687 | |
Chaehyun Lim | 244efb1 | 2015-10-02 21:44:53 +0900 | [diff] [blame] | 3688 | int host_int_wait_msg_queue_idle(void) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3689 | { |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3690 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3691 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3692 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3693 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3694 | msg.id = HOST_IF_MSG_Q_IDLE; |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3695 | 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] | 3696 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3697 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3698 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3699 | } |
| 3700 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3701 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3702 | |
Chaehyun Lim | 6d6c9bb | 2015-10-02 21:44:54 +0900 | [diff] [blame] | 3703 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3704 | } |
| 3705 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3706 | 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] | 3707 | { |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3708 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3709 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3710 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3711 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3712 | msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER; |
Leo Kim | a7f3b12 | 2015-10-28 15:59:29 +0900 | [diff] [blame] | 3713 | msg.body.drv.handler = get_id_from_handler(hif_drv); |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3714 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3715 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3716 | 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] | 3717 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3718 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3719 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3720 | } |
| 3721 | |
Chaehyun Lim | a094101 | 2015-10-05 19:34:47 +0900 | [diff] [blame] | 3722 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3723 | } |
| 3724 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3725 | 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] | 3726 | { |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3727 | int result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3728 | struct host_if_msg msg; |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3729 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3730 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3731 | msg.id = HOST_IF_MSG_SET_OPERATION_MODE; |
Leo Kim | c96debf | 2015-10-28 15:59:30 +0900 | [diff] [blame] | 3732 | msg.body.mode.mode = mode; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3733 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3734 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 3735 | 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] | 3736 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3737 | PRINT_ER("wilc mq send fail\n"); |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3738 | result = -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3739 | } |
| 3740 | |
Chaehyun Lim | a0c1ee0 | 2015-10-05 19:34:50 +0900 | [diff] [blame] | 3741 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3742 | } |
| 3743 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3744 | 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] | 3745 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3746 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3747 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3748 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3749 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3750 | PRINT_ER("driver is null\n"); |
| 3751 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3752 | } |
| 3753 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3754 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3755 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3756 | msg.id = HOST_IF_MSG_GET_CHNL; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3757 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3758 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3759 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3760 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3761 | PRINT_ER("wilc mq send fail\n"); |
Leo Kim | 4ea9000 | 2015-10-29 11:58:32 +0900 | [diff] [blame] | 3762 | down(&hif_drv->sem_get_chnl); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3763 | |
Leo Kim | 95ebb0f | 2015-10-15 13:25:03 +0900 | [diff] [blame] | 3764 | *pu8ChNo = ch_no; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3765 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3766 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3767 | } |
| 3768 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3769 | s32 host_int_get_inactive_time(struct host_if_drv *hif_drv, |
| 3770 | const u8 *mac, u32 *pu32InactiveTime) |
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 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3773 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3774 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3775 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3776 | PRINT_ER("driver is null\n"); |
| 3777 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3778 | } |
| 3779 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3780 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3781 | memcpy(msg.body.mac_info.mac, mac, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3782 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3783 | msg.id = HOST_IF_MSG_GET_INACTIVETIME; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3784 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3785 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3786 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3787 | if (result) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3788 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 3789 | |
Leo Kim | 569a3c6 | 2015-10-29 11:58:33 +0900 | [diff] [blame] | 3790 | down(&hif_drv->sem_inactive_time); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3791 | |
Leo Kim | ad26906 | 2015-10-15 13:25:06 +0900 | [diff] [blame] | 3792 | *pu32InactiveTime = inactive_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3793 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3794 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3795 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 3796 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3797 | 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] | 3798 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3799 | s32 result = 0; |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3800 | struct wid wid; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3801 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3802 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3803 | PRINT_ER("driver is null\n"); |
| 3804 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3805 | } |
| 3806 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3807 | wid.id = (u16)WID_MEMORY_ADDRESS; |
| 3808 | wid.type = WID_INT; |
| 3809 | wid.val = (s8 *)pu32TestMemAddr; |
| 3810 | wid.size = sizeof(u32); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3811 | |
Leo Kim | 45102f8 | 2015-10-28 15:59:28 +0900 | [diff] [blame] | 3812 | result = send_config_pkt(GET_CFG, &wid, 1, |
Leo Kim | 8c8360b | 2015-10-19 18:26:12 +0900 | [diff] [blame] | 3813 | get_id_from_handler(hif_drv)); |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3814 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3815 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3816 | PRINT_ER("Failed to get wid value\n"); |
| 3817 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3818 | } else { |
| 3819 | PRINT_D(HOSTINF_DBG, "Successfully got wid value\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3820 | } |
| 3821 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3822 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3823 | } |
| 3824 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3825 | 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] | 3826 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3827 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3828 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3829 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3830 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3831 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3832 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3833 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3834 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3835 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3836 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3837 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3838 | } |
| 3839 | |
Leo Kim | 7e111f9 | 2015-10-29 11:58:30 +0900 | [diff] [blame] | 3840 | down(&hif_drv->sem_get_rssi); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3841 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3842 | if (!ps8Rssi) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3843 | PRINT_ER("RSS pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3844 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3845 | } |
| 3846 | |
Leo Kim | 144b7b2 | 2015-10-15 13:25:01 +0900 | [diff] [blame] | 3847 | *ps8Rssi = rssi; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3848 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3849 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3850 | } |
| 3851 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3852 | 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] | 3853 | { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3854 | struct host_if_msg msg; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3855 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3856 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3857 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3858 | msg.id = HOST_IF_MSG_GET_LINKSPEED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3859 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3860 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3861 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3862 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3863 | PRINT_ER("Failed to send GET_LINKSPEED to message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3864 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3865 | } |
| 3866 | |
Leo Kim | bc34da6 | 2015-10-29 11:58:31 +0900 | [diff] [blame] | 3867 | down(&hif_drv->sem_get_link_speed); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3868 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3869 | if (!ps8lnkspd) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3870 | PRINT_ER("LINKSPEED pointer value is null"); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3871 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3872 | } |
| 3873 | |
Leo Kim | 75327a0 | 2015-10-15 13:25:02 +0900 | [diff] [blame] | 3874 | *ps8lnkspd = link_speed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3875 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3876 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3877 | } |
| 3878 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3879 | 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] | 3880 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3881 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3882 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3883 | |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 3884 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3885 | msg.id = HOST_IF_MSG_GET_STATISTICS; |
Tony Cho | e60831e | 2015-10-05 13:50:45 +0900 | [diff] [blame] | 3886 | msg.body.data = (char *)pstrStatistics; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3887 | msg.drv = hif_drv; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3888 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3889 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3890 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3891 | PRINT_ER("Failed to send get host channel param's message queue "); |
Leo Kim | e6e1266 | 2015-09-16 18:36:03 +0900 | [diff] [blame] | 3892 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3893 | } |
| 3894 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 3895 | down(&hif_sema_wait_response); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3896 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3897 | } |
| 3898 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3899 | s32 host_int_scan(struct host_if_drv *hif_drv, u8 u8ScanSource, |
| 3900 | u8 u8ScanType, u8 *pu8ChnlFreqList, |
| 3901 | u8 u8ChnlListLen, const u8 *pu8IEs, |
| 3902 | size_t IEsLen, wilc_scan_result ScanResult, |
| 3903 | void *pvUserArg, struct hidden_network *pstrHiddenNetwork) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3904 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3905 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3906 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3907 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3908 | if (!hif_drv || !ScanResult) { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3909 | PRINT_ER("hif_drv or ScanResult = NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3910 | return -EFAULT; |
| 3911 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3912 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3913 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3914 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3915 | msg.id = HOST_IF_MSG_SCAN; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3916 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 3917 | if (pstrHiddenNetwork) { |
Leo Kim | 629b9ca | 2015-10-13 19:49:46 +0900 | [diff] [blame] | 3918 | msg.body.scan_info.hidden_network.pstrHiddenNetworkInfo = pstrHiddenNetwork->pstrHiddenNetworkInfo; |
| 3919 | msg.body.scan_info.hidden_network.u8ssidnum = pstrHiddenNetwork->u8ssidnum; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3920 | |
| 3921 | } else |
| 3922 | PRINT_D(HOSTINF_DBG, "pstrHiddenNetwork IS EQUAL TO NULL\n"); |
| 3923 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3924 | msg.drv = hif_drv; |
Leo Kim | 4256889 | 2015-10-13 19:49:37 +0900 | [diff] [blame] | 3925 | msg.body.scan_info.src = u8ScanSource; |
Leo Kim | 1e276c8 | 2015-10-13 19:49:38 +0900 | [diff] [blame] | 3926 | msg.body.scan_info.type = u8ScanType; |
Leo Kim | c17c6da | 2015-10-13 19:49:44 +0900 | [diff] [blame] | 3927 | msg.body.scan_info.result = ScanResult; |
Leo Kim | 5f2b50c | 2015-10-13 19:49:45 +0900 | [diff] [blame] | 3928 | msg.body.scan_info.arg = pvUserArg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3929 | |
Leo Kim | f97bd9c | 2015-10-13 19:49:41 +0900 | [diff] [blame] | 3930 | msg.body.scan_info.ch_list_len = u8ChnlListLen; |
Leo Kim | 82eeb0a | 2015-10-13 19:49:40 +0900 | [diff] [blame] | 3931 | msg.body.scan_info.ch_freq_list = kmalloc(u8ChnlListLen, GFP_KERNEL); |
| 3932 | memcpy(msg.body.scan_info.ch_freq_list, pu8ChnlFreqList, u8ChnlListLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3933 | |
Leo Kim | 7b1f76c | 2015-10-13 19:49:43 +0900 | [diff] [blame] | 3934 | msg.body.scan_info.ies_len = IEsLen; |
Leo Kim | d6f19aa | 2015-10-13 19:49:42 +0900 | [diff] [blame] | 3935 | msg.body.scan_info.ies = kmalloc(IEsLen, GFP_KERNEL); |
| 3936 | memcpy(msg.body.scan_info.ies, pu8IEs, IEsLen); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3937 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3938 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 3939 | if (result) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3940 | PRINT_ER("Error in sending message queue\n"); |
| 3941 | return -EINVAL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3942 | } |
| 3943 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3944 | PRINT_D(HOSTINF_DBG, ">> Starting the SCAN timer\n"); |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 3945 | hif_drv->scan_timer.data = (unsigned long)hif_drv; |
| 3946 | mod_timer(&hif_drv->scan_timer, |
Greg Kroah-Hartman | 9eb0664 | 2015-08-17 11:10:55 -0700 | [diff] [blame] | 3947 | jiffies + msecs_to_jiffies(HOST_IF_SCAN_TIMEOUT)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3948 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3949 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3950 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3951 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3952 | s32 hif_set_cfg(struct host_if_drv *hif_drv, |
| 3953 | struct cfg_param_val *pstrCfgParamVal) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3954 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3955 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3956 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3957 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3958 | if (!hif_drv) { |
| 3959 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3960 | return -EFAULT; |
| 3961 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 3962 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 3963 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 3964 | msg.id = HOST_IF_MSG_CFG_PARAMS; |
Tony Cho | 221371e | 2015-10-12 16:56:06 +0900 | [diff] [blame] | 3965 | msg.body.cfg_info.cfg_attr_info = *pstrCfgParamVal; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3966 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3967 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3968 | 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] | 3969 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3970 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3971 | } |
| 3972 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3973 | 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] | 3974 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 3975 | s32 result = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3976 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 3977 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3978 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 3979 | if (!hif_drv) { |
| 3980 | PRINT_ER("hif_drv NULL\n"); |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 3981 | return -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3982 | } |
| 3983 | PRINT_D(HOSTINF_DBG, "Getting configuration parameters\n"); |
| 3984 | switch (u16WID) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3985 | case WID_BSS_TYPE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3986 | *pu16WID_Value = (u16)hif_drv->cfg_values.bss_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3987 | break; |
| 3988 | |
| 3989 | case WID_AUTH_TYPE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3990 | *pu16WID_Value = (u16)hif_drv->cfg_values.auth_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3991 | break; |
| 3992 | |
| 3993 | case WID_AUTH_TIMEOUT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3994 | *pu16WID_Value = hif_drv->cfg_values.auth_timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3995 | break; |
| 3996 | |
| 3997 | case WID_POWER_MANAGEMENT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 3998 | *pu16WID_Value = (u16)hif_drv->cfg_values.power_mgmt_mode; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 3999 | break; |
| 4000 | |
| 4001 | case WID_SHORT_RETRY_LIMIT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4002 | *pu16WID_Value = hif_drv->cfg_values.short_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4003 | break; |
| 4004 | |
| 4005 | case WID_LONG_RETRY_LIMIT: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4006 | *pu16WID_Value = hif_drv->cfg_values.long_retry_limit; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4007 | break; |
| 4008 | |
| 4009 | case WID_FRAG_THRESHOLD: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4010 | *pu16WID_Value = hif_drv->cfg_values.frag_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4011 | break; |
| 4012 | |
| 4013 | case WID_RTS_THRESHOLD: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4014 | *pu16WID_Value = hif_drv->cfg_values.rts_threshold; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4015 | break; |
| 4016 | |
| 4017 | case WID_PREAMBLE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4018 | *pu16WID_Value = (u16)hif_drv->cfg_values.preamble_type; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4019 | break; |
| 4020 | |
| 4021 | case WID_SHORT_SLOT_ALLOWED: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4022 | *pu16WID_Value = (u16)hif_drv->cfg_values.short_slot_allowed; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4023 | break; |
| 4024 | |
| 4025 | case WID_11N_TXOP_PROT_DISABLE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4026 | *pu16WID_Value = (u16)hif_drv->cfg_values.txop_prot_disabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4027 | break; |
| 4028 | |
| 4029 | case WID_BEACON_INTERVAL: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4030 | *pu16WID_Value = hif_drv->cfg_values.beacon_interval; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4031 | break; |
| 4032 | |
| 4033 | case WID_DTIM_PERIOD: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4034 | *pu16WID_Value = (u16)hif_drv->cfg_values.dtim_period; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4035 | break; |
| 4036 | |
| 4037 | case WID_SITE_SURVEY: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4038 | *pu16WID_Value = (u16)hif_drv->cfg_values.site_survey_enabled; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4039 | break; |
| 4040 | |
| 4041 | case WID_SITE_SURVEY_SCAN_TIME: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4042 | *pu16WID_Value = hif_drv->cfg_values.site_survey_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4043 | break; |
| 4044 | |
| 4045 | case WID_ACTIVE_SCAN_TIME: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4046 | *pu16WID_Value = hif_drv->cfg_values.active_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4047 | break; |
| 4048 | |
| 4049 | case WID_PASSIVE_SCAN_TIME: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4050 | *pu16WID_Value = hif_drv->cfg_values.passive_scan_time; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4051 | break; |
| 4052 | |
| 4053 | case WID_CURRENT_TX_RATE: |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4054 | *pu16WID_Value = hif_drv->cfg_values.curr_tx_rate; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4055 | break; |
| 4056 | |
| 4057 | default: |
| 4058 | break; |
| 4059 | } |
| 4060 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4061 | up(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4062 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4063 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4064 | } |
| 4065 | |
Greg Kroah-Hartman | 93dee8e | 2015-08-14 20:28:32 -0700 | [diff] [blame] | 4066 | static void GetPeriodicRSSI(unsigned long arg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4067 | { |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4068 | struct host_if_drv *hif_drv = (struct host_if_drv *)arg; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4069 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4070 | if (!hif_drv) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4071 | PRINT_ER("Driver handler is NULL\n"); |
| 4072 | return; |
| 4073 | } |
| 4074 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4075 | if (hif_drv->hif_state == HOST_IF_CONNECTED) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4076 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4077 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4078 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4079 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4080 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4081 | msg.id = HOST_IF_MSG_GET_RSSI; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4082 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4083 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4084 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4085 | if (result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4086 | PRINT_ER("Failed to send get host channel param's message queue "); |
| 4087 | return; |
| 4088 | } |
| 4089 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4090 | periodic_rssi.data = (unsigned long)hif_drv; |
| 4091 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4092 | } |
| 4093 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4094 | 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] | 4095 | { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4096 | s32 result = 0; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4097 | struct host_if_drv *hif_drv; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4098 | int err; |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4099 | perInterface_wlan_t *nic; |
| 4100 | struct wilc *wilc; |
| 4101 | |
| 4102 | nic = netdev_priv(dev); |
| 4103 | wilc = nic->wilc; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4104 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4105 | PRINT_D(HOSTINF_DBG, "Initializing host interface for client %d\n", clients_count + 1); |
| 4106 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4107 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4108 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4109 | sema_init(&hif_sema_wait_response, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4110 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4111 | hif_drv = kzalloc(sizeof(struct host_if_drv), GFP_KERNEL); |
| 4112 | if (!hif_drv) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4113 | result = -ENOMEM; |
Vincent Stehlé | 17db84e | 2015-10-07 07:08:25 +0200 | [diff] [blame] | 4114 | goto _fail_; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4115 | } |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4116 | *hif_drv_handler = hif_drv; |
| 4117 | err = add_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4118 | if (err) { |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4119 | result = -EFAULT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4120 | goto _fail_timer_2; |
| 4121 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4122 | |
Dean Lee | 72ed4dc | 2015-06-12 14:11:44 +0900 | [diff] [blame] | 4123 | g_obtainingIP = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4124 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4125 | PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4126 | if (clients_count == 0) { |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4127 | sema_init(&hif_sema_thread, 0); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4128 | sema_init(&hif_sema_driver, 0); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4129 | sema_init(&hif_sema_deinit, 1); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4130 | } |
| 4131 | |
Leo Kim | 9ea4713 | 2015-10-29 11:58:28 +0900 | [diff] [blame] | 4132 | sema_init(&hif_drv->sem_test_key_block, 0); |
Leo Kim | e55e496 | 2015-10-29 11:58:29 +0900 | [diff] [blame] | 4133 | sema_init(&hif_drv->sem_test_disconn_block, 0); |
Leo Kim | 7e111f9 | 2015-10-29 11:58:30 +0900 | [diff] [blame] | 4134 | sema_init(&hif_drv->sem_get_rssi, 0); |
Leo Kim | bc34da6 | 2015-10-29 11:58:31 +0900 | [diff] [blame] | 4135 | sema_init(&hif_drv->sem_get_link_speed, 0); |
Leo Kim | 4ea9000 | 2015-10-29 11:58:32 +0900 | [diff] [blame] | 4136 | sema_init(&hif_drv->sem_get_chnl, 0); |
Leo Kim | 569a3c6 | 2015-10-29 11:58:33 +0900 | [diff] [blame] | 4137 | sema_init(&hif_drv->sem_inactive_time, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4138 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4139 | PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count); |
| 4140 | |
| 4141 | if (clients_count == 0) { |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4142 | result = wilc_mq_create(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4143 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4144 | if (result < 0) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4145 | PRINT_ER("Failed to creat MQ\n"); |
| 4146 | goto _fail_; |
| 4147 | } |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4148 | |
Glen Lee | d5382219 | 2015-10-27 18:27:49 +0900 | [diff] [blame] | 4149 | hif_thread_handler = kthread_run(hostIFthread, wilc, |
| 4150 | "WILC_kthread"); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4151 | |
| 4152 | if (IS_ERR(hif_thread_handler)) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4153 | PRINT_ER("Failed to creat Thread\n"); |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4154 | result = -EFAULT; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4155 | goto _fail_mq_; |
| 4156 | } |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4157 | setup_timer(&periodic_rssi, GetPeriodicRSSI, |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4158 | (unsigned long)hif_drv); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4159 | mod_timer(&periodic_rssi, jiffies + msecs_to_jiffies(5000)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4160 | } |
| 4161 | |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 4162 | setup_timer(&hif_drv->scan_timer, TimerCB_Scan, 0); |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 4163 | setup_timer(&hif_drv->connect_timer, TimerCB_Connect, 0); |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 4164 | setup_timer(&hif_drv->remain_on_ch_timer, ListenTimerCB, 0); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4165 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4166 | sema_init(&hif_drv->sem_cfg_values, 1); |
| 4167 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4168 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4169 | hif_drv->hif_state = HOST_IF_IDLE; |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4170 | hif_drv->cfg_values.site_survey_enabled = SITE_SURVEY_OFF; |
| 4171 | hif_drv->cfg_values.scan_source = DEFAULT_SCAN; |
| 4172 | hif_drv->cfg_values.active_scan_time = ACTIVE_SCAN_TIME; |
| 4173 | hif_drv->cfg_values.passive_scan_time = PASSIVE_SCAN_TIME; |
| 4174 | hif_drv->cfg_values.curr_tx_rate = AUTORATE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4175 | |
Leo Kim | 1229b1a | 2015-10-29 12:05:39 +0900 | [diff] [blame] | 4176 | hif_drv->p2p_timeout = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4177 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4178 | PRINT_INFO(HOSTINF_DBG, "Initialization values, Site survey value: %d\n Scan source: %d\n Active scan time: %d\n Passive scan time: %d\nCurrent tx Rate = %d\n", |
Leo Kim | ace303f | 2015-10-29 11:58:26 +0900 | [diff] [blame] | 4179 | hif_drv->cfg_values.site_survey_enabled, |
| 4180 | hif_drv->cfg_values.scan_source, |
| 4181 | hif_drv->cfg_values.active_scan_time, |
| 4182 | hif_drv->cfg_values.passive_scan_time, |
| 4183 | hif_drv->cfg_values.curr_tx_rate); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4184 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4185 | up(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4186 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4187 | clients_count++; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4188 | |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4189 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4190 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4191 | _fail_timer_2: |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4192 | up(&hif_drv->sem_cfg_values); |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 4193 | del_timer_sync(&hif_drv->connect_timer); |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 4194 | del_timer_sync(&hif_drv->scan_timer); |
Leo Kim | c2115d8 | 2015-10-15 13:24:52 +0900 | [diff] [blame] | 4195 | kthread_stop(hif_thread_handler); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4196 | _fail_mq_: |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4197 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4198 | _fail_: |
Chaehyun Lim | 5b09bd3 | 2015-09-22 18:34:59 +0900 | [diff] [blame] | 4199 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4200 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4201 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4202 | s32 host_int_deinit(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4203 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4204 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4205 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4206 | int ret; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4207 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4208 | if (!hif_drv) { |
| 4209 | PRINT_ER("hif_drv = NULL\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4210 | return 0; |
| 4211 | } |
| 4212 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4213 | down(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4214 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4215 | terminated_handle = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4216 | PRINT_D(HOSTINF_DBG, "De-initializing host interface for client %d\n", clients_count); |
| 4217 | |
Leo Kim | 13b313e | 2015-10-29 11:58:34 +0900 | [diff] [blame] | 4218 | if (del_timer_sync(&hif_drv->scan_timer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4219 | PRINT_D(HOSTINF_DBG, ">> Scan timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4220 | |
Leo Kim | 81a5950 | 2015-10-29 11:58:35 +0900 | [diff] [blame] | 4221 | if (del_timer_sync(&hif_drv->connect_timer)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4222 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4223 | |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4224 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4225 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4226 | |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 4227 | del_timer_sync(&hif_drv->remain_on_ch_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4228 | |
Johnny Kim | 218dc40 | 2015-08-13 13:41:19 +0900 | [diff] [blame] | 4229 | host_int_set_wfi_drv_handler(NULL); |
Leo Kim | 27ff216 | 2015-10-15 13:24:55 +0900 | [diff] [blame] | 4230 | down(&hif_sema_driver); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4231 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 4232 | if (hif_drv->usr_scan_req.scan_result) { |
| 4233 | hif_drv->usr_scan_req.scan_result(SCAN_EVENT_ABORTED, NULL, |
Leo Kim | 66eaea3 | 2015-10-29 11:58:51 +0900 | [diff] [blame] | 4234 | hif_drv->usr_scan_req.arg, NULL); |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 4235 | hif_drv->usr_scan_req.scan_result = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4236 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4237 | |
Leo Kim | b60005a | 2015-10-29 11:58:24 +0900 | [diff] [blame] | 4238 | hif_drv->hif_state = HOST_IF_IDLE; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4239 | |
Leo Kim | ca8540e4 | 2015-10-15 13:25:00 +0900 | [diff] [blame] | 4240 | scan_while_connected = false; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4241 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4242 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4243 | |
| 4244 | if (clients_count == 1) { |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4245 | if (del_timer_sync(&periodic_rssi)) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4246 | PRINT_D(HOSTINF_DBG, ">> Connect timer is active\n"); |
Leo Kim | 262f55e | 2015-10-15 13:24:58 +0900 | [diff] [blame] | 4247 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4248 | msg.id = HOST_IF_MSG_EXIT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4249 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4250 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4251 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4252 | if (result != 0) |
| 4253 | 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] | 4254 | |
Leo Kim | 834e0cb | 2015-10-15 13:24:54 +0900 | [diff] [blame] | 4255 | down(&hif_sema_thread); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4256 | |
Leo Kim | cb067dc | 2015-10-15 13:24:53 +0900 | [diff] [blame] | 4257 | wilc_mq_destroy(&hif_msg_q); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4258 | } |
| 4259 | |
Leo Kim | 33110ad | 2015-10-29 11:58:27 +0900 | [diff] [blame] | 4260 | down(&hif_drv->sem_cfg_values); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4261 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4262 | ret = remove_handler_in_list(hif_drv); |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4263 | if (ret) |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4264 | result = -ENOENT; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4265 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4266 | kfree(hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4267 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4268 | clients_count--; |
Greg Kroah-Hartman | b1413b6 | 2015-06-02 14:11:12 +0900 | [diff] [blame] | 4269 | terminated_handle = NULL; |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4270 | up(&hif_sema_deinit); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4271 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4272 | } |
| 4273 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4274 | void NetworkInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4275 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4276 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4277 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4278 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4279 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4280 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4281 | 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] | 4282 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4283 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4284 | if (!hif_drv || hif_drv == terminated_handle) { |
| 4285 | PRINT_ER("NetworkInfo received but driver not init[%p]\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4286 | return; |
| 4287 | } |
| 4288 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4289 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4290 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4291 | msg.id = HOST_IF_MSG_RCVD_NTWRK_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4292 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4293 | |
Leo Kim | 3bffac6 | 2015-10-13 20:02:11 +0900 | [diff] [blame] | 4294 | msg.body.net_info.len = u32Length; |
Leo Kim | b021b80 | 2015-10-13 20:02:10 +0900 | [diff] [blame] | 4295 | msg.body.net_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4296 | memcpy(msg.body.net_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4297 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4298 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4299 | if (result) |
| 4300 | 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] | 4301 | } |
| 4302 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4303 | void GnrlAsyncInfoReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4304 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4305 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4306 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4307 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4308 | struct host_if_drv *hif_drv = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4309 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4310 | down(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4311 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4312 | 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] | 4313 | hif_drv = get_handler_from_id(id); |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4314 | PRINT_D(HOSTINF_DBG, "General asynchronous info packet received\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4315 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4316 | if (!hif_drv || hif_drv == terminated_handle) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4317 | PRINT_D(HOSTINF_DBG, "Wifi driver handler is equal to NULL\n"); |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4318 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4319 | return; |
| 4320 | } |
| 4321 | |
Leo Kim | 33bfb19 | 2015-10-29 11:58:56 +0900 | [diff] [blame] | 4322 | if (!hif_drv->usr_conn_req.conn_result) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4323 | 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] | 4324 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4325 | return; |
| 4326 | } |
| 4327 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4328 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4329 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4330 | msg.id = HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4331 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4332 | |
Leo Kim | f94f488 | 2015-10-13 19:50:01 +0900 | [diff] [blame] | 4333 | msg.body.async_info.len = u32Length; |
Leo Kim | 33722ac7 | 2015-10-13 19:50:00 +0900 | [diff] [blame] | 4334 | msg.body.async_info.buffer = kmalloc(u32Length, GFP_KERNEL); |
| 4335 | memcpy(msg.body.async_info.buffer, pu8Buffer, u32Length); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4336 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4337 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4338 | if (result) |
| 4339 | 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] | 4340 | |
Leo Kim | 440e8993 | 2015-10-15 13:24:57 +0900 | [diff] [blame] | 4341 | up(&hif_sema_deinit); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4342 | } |
| 4343 | |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4344 | void host_int_ScanCompleteReceived(u8 *pu8Buffer, u32 u32Length) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4345 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4346 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4347 | struct host_if_msg msg; |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4348 | int id; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4349 | struct host_if_drv *hif_drv = NULL; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4350 | |
Johnny Kim | d42ab08 | 2015-08-20 16:32:52 +0900 | [diff] [blame] | 4351 | 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] | 4352 | hif_drv = get_handler_from_id(id); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4353 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4354 | PRINT_D(GENERIC_DBG, "Scan notification received %p\n", hif_drv); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4355 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4356 | if (!hif_drv || hif_drv == terminated_handle) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4357 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4358 | |
Leo Kim | bc80185 | 2015-10-29 11:58:50 +0900 | [diff] [blame] | 4359 | if (hif_drv->usr_scan_req.scan_result) { |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4360 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4361 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4362 | msg.id = HOST_IF_MSG_RCVD_SCAN_COMPLETE; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4363 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4364 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4365 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4366 | if (result) |
| 4367 | 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] | 4368 | } |
| 4369 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4370 | return; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4371 | } |
| 4372 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4373 | s32 host_int_remain_on_channel(struct host_if_drv *hif_drv, u32 u32SessionID, |
| 4374 | u32 u32duration, u16 chan, |
| 4375 | wilc_remain_on_chan_expired RemainOnChanExpired, |
| 4376 | wilc_remain_on_chan_ready RemainOnChanReady, |
| 4377 | void *pvUserArg) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4378 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4379 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4380 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4381 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4382 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4383 | PRINT_ER("driver is null\n"); |
| 4384 | return -EFAULT; |
| 4385 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4386 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4387 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4388 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4389 | msg.id = HOST_IF_MSG_REMAIN_ON_CHAN; |
Leo Kim | 839ab70 | 2015-10-29 11:58:41 +0900 | [diff] [blame] | 4390 | msg.body.remain_on_ch.ch = chan; |
Leo Kim | bfb62ab | 2015-10-29 11:58:42 +0900 | [diff] [blame] | 4391 | msg.body.remain_on_ch.expired = RemainOnChanExpired; |
Leo Kim | 5e5f791 | 2015-10-29 11:58:43 +0900 | [diff] [blame] | 4392 | msg.body.remain_on_ch.ready = RemainOnChanReady; |
Leo Kim | c5cc4b1 | 2015-10-29 11:58:44 +0900 | [diff] [blame] | 4393 | msg.body.remain_on_ch.arg = pvUserArg; |
Tony Cho | 070d365 | 2015-09-30 18:55:10 +0900 | [diff] [blame] | 4394 | msg.body.remain_on_ch.u32duration = u32duration; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 4395 | msg.body.remain_on_ch.id = u32SessionID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4396 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4397 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4398 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4399 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4400 | PRINT_ER("wilc mq send fail\n"); |
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 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4403 | } |
| 4404 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4405 | s32 host_int_ListenStateExpired(struct host_if_drv *hif_drv, u32 u32SessionID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4406 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4407 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4408 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4409 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4410 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4411 | PRINT_ER("driver is null\n"); |
| 4412 | return -EFAULT; |
| 4413 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4414 | |
Leo Kim | cc2d7e9 | 2015-10-29 11:58:36 +0900 | [diff] [blame] | 4415 | del_timer(&hif_drv->remain_on_ch_timer); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4416 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4417 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4418 | msg.id = HOST_IF_MSG_LISTEN_TIMER_FIRED; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4419 | msg.drv = hif_drv; |
Leo Kim | 9d764e3 | 2015-10-29 12:05:38 +0900 | [diff] [blame] | 4420 | msg.body.remain_on_ch.id = u32SessionID; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4421 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4422 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4423 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4424 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4425 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4426 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4427 | } |
| 4428 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4429 | 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] | 4430 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4431 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4432 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4433 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4434 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4435 | PRINT_ER("driver is null\n"); |
| 4436 | return -EFAULT; |
| 4437 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4438 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4439 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4440 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4441 | msg.id = HOST_IF_MSG_REGISTER_FRAME; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4442 | switch (u16FrameType) { |
| 4443 | case ACTION: |
| 4444 | PRINT_D(HOSTINF_DBG, "ACTION\n"); |
Leo Kim | bcb410b | 2015-10-29 11:58:40 +0900 | [diff] [blame] | 4445 | msg.body.reg_frame.reg_id = ACTION_FRM_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4446 | break; |
| 4447 | |
| 4448 | case PROBE_REQ: |
| 4449 | PRINT_D(HOSTINF_DBG, "PROBE REQ\n"); |
Leo Kim | bcb410b | 2015-10-29 11:58:40 +0900 | [diff] [blame] | 4450 | msg.body.reg_frame.reg_id = PROBE_REQ_IDX; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4451 | break; |
| 4452 | |
| 4453 | default: |
| 4454 | PRINT_D(HOSTINF_DBG, "Not valid frame type\n"); |
| 4455 | break; |
| 4456 | } |
Leo Kim | d5f654c | 2015-10-29 11:58:39 +0900 | [diff] [blame] | 4457 | msg.body.reg_frame.frame_type = u16FrameType; |
Leo Kim | 6abf868 | 2015-10-29 11:58:38 +0900 | [diff] [blame] | 4458 | msg.body.reg_frame.reg = bReg; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4459 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4460 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4461 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4462 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4463 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4464 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4465 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4466 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4467 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4468 | s32 host_int_add_beacon(struct host_if_drv *hif_drv, u32 u32Interval, |
| 4469 | u32 u32DTIMPeriod, u32 u32HeadLen, u8 *pu8Head, |
| 4470 | u32 u32TailLen, u8 *pu8Tail) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4471 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4472 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4473 | struct host_if_msg msg; |
Tony Cho | a98491e | 2015-09-30 18:44:31 +0900 | [diff] [blame] | 4474 | struct beacon_attr *pstrSetBeaconParam = &msg.body.beacon_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4475 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4476 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4477 | PRINT_ER("driver is null\n"); |
| 4478 | return -EFAULT; |
| 4479 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4480 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4481 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4482 | |
| 4483 | PRINT_D(HOSTINF_DBG, "Setting adding beacon message queue params\n"); |
| 4484 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4485 | msg.id = HOST_IF_MSG_ADD_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4486 | msg.drv = hif_drv; |
Leo Kim | 12262dd | 2015-10-13 19:50:03 +0900 | [diff] [blame] | 4487 | pstrSetBeaconParam->interval = u32Interval; |
Leo Kim | e76ab77 | 2015-10-13 19:50:04 +0900 | [diff] [blame] | 4488 | pstrSetBeaconParam->dtim_period = u32DTIMPeriod; |
Leo Kim | 51c6618 | 2015-10-13 19:50:05 +0900 | [diff] [blame] | 4489 | pstrSetBeaconParam->head_len = u32HeadLen; |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4490 | pstrSetBeaconParam->head = kmemdup(pu8Head, u32HeadLen, GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4491 | if (!pstrSetBeaconParam->head) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4492 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4493 | goto ERRORHANDLER; |
| 4494 | } |
Leo Kim | 030c57e | 2015-10-13 19:50:07 +0900 | [diff] [blame] | 4495 | pstrSetBeaconParam->tail_len = u32TailLen; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4496 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4497 | if (u32TailLen > 0) { |
Shraddha Barke | 543f5b1 | 2015-10-16 10:47:11 +0530 | [diff] [blame] | 4498 | pstrSetBeaconParam->tail = kmemdup(pu8Tail, u32TailLen, |
| 4499 | GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4500 | if (!pstrSetBeaconParam->tail) { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4501 | result = -ENOMEM; |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4502 | goto ERRORHANDLER; |
| 4503 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4504 | } else { |
Leo Kim | 7dbcb6d3 | 2015-10-13 19:50:08 +0900 | [diff] [blame] | 4505 | pstrSetBeaconParam->tail = NULL; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4506 | } |
| 4507 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4508 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4509 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4510 | PRINT_ER("wilc mq send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4511 | |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4512 | ERRORHANDLER: |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4513 | if (result) { |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4514 | kfree(pstrSetBeaconParam->head); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4515 | |
Shraddha Barke | 95f840f | 2015-10-14 07:29:19 +0530 | [diff] [blame] | 4516 | kfree(pstrSetBeaconParam->tail); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4517 | } |
| 4518 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4519 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4520 | } |
| 4521 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4522 | s32 host_int_del_beacon(struct host_if_drv *hif_drv) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4523 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4524 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4525 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4526 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4527 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4528 | PRINT_ER("driver is null\n"); |
| 4529 | return -EFAULT; |
| 4530 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4531 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4532 | msg.id = HOST_IF_MSG_DEL_BEACON; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4533 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4534 | PRINT_D(HOSTINF_DBG, "Setting deleting beacon message queue params\n"); |
| 4535 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4536 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4537 | if (result) |
Leo Kim | 7dc1d0c | 2015-09-16 18:36:00 +0900 | [diff] [blame] | 4538 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4539 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4540 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4541 | } |
| 4542 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4543 | s32 host_int_add_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4544 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4545 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4546 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4547 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4548 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4549 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4550 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4551 | PRINT_ER("driver is null\n"); |
| 4552 | return -EFAULT; |
| 4553 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4554 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4555 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4556 | |
| 4557 | PRINT_D(HOSTINF_DBG, "Setting adding station message queue params\n"); |
| 4558 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4559 | msg.id = HOST_IF_MSG_ADD_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4560 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4561 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4562 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 4563 | if (pstrAddStationMsg->rates_len > 0) { |
| 4564 | u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 4565 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4566 | if (!rates) |
| 4567 | return -ENOMEM; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4568 | |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 4569 | memcpy(rates, pstrStaParams->rates, |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 4570 | pstrAddStationMsg->rates_len); |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 4571 | pstrAddStationMsg->rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4572 | } |
| 4573 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4574 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4575 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4576 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4577 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4578 | } |
| 4579 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4580 | 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] | 4581 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4582 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4583 | struct host_if_msg msg; |
Tony Cho | 889c25b | 2015-09-30 18:44:33 +0900 | [diff] [blame] | 4584 | struct del_sta *pstrDelStationMsg = &msg.body.del_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4585 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4586 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4587 | PRINT_ER("driver is null\n"); |
| 4588 | return -EFAULT; |
| 4589 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4590 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4591 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4592 | |
| 4593 | PRINT_D(HOSTINF_DBG, "Setting deleting station message queue params\n"); |
| 4594 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4595 | msg.id = HOST_IF_MSG_DEL_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4596 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4597 | |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4598 | if (!pu8MacAddr) |
Punit Vara | 0bc8524 | 2015-10-29 01:53:30 +0530 | [diff] [blame] | 4599 | eth_broadcast_addr(pstrDelStationMsg->mac_addr); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4600 | else |
Leo Kim | e4839d3 | 2015-10-13 20:02:06 +0900 | [diff] [blame] | 4601 | memcpy(pstrDelStationMsg->mac_addr, pu8MacAddr, ETH_ALEN); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4602 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4603 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4604 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4605 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4606 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4607 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4608 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4609 | s32 host_int_del_allstation(struct host_if_drv *hif_drv, |
Leo Kim | 441dc60 | 2015-10-12 16:55:35 +0900 | [diff] [blame] | 4610 | u8 pu8MacAddr[][ETH_ALEN]) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4611 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4612 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4613 | struct host_if_msg msg; |
Tony Cho | b0c1e80 | 2015-10-05 13:50:46 +0900 | [diff] [blame] | 4614 | struct del_all_sta *pstrDelAllStationMsg = &msg.body.del_all_sta_info; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4615 | u8 au8Zero_Buff[ETH_ALEN] = {0}; |
Chaehyun Lim | 4e4467f | 2015-06-11 14:35:55 +0900 | [diff] [blame] | 4616 | u32 i; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4617 | u8 u8AssocNumb = 0; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4618 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4619 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4620 | PRINT_ER("driver is null\n"); |
| 4621 | return -EFAULT; |
| 4622 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4623 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4624 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4625 | |
| 4626 | PRINT_D(HOSTINF_DBG, "Setting deauthenticating station message queue params\n"); |
| 4627 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4628 | msg.id = HOST_IF_MSG_DEL_ALL_STA; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4629 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4630 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4631 | for (i = 0; i < MAX_NUM_STA; i++) { |
| 4632 | if (memcmp(pu8MacAddr[i], au8Zero_Buff, ETH_ALEN)) { |
Leo Kim | e51b921 | 2015-10-13 19:50:09 +0900 | [diff] [blame] | 4633 | memcpy(pstrDelAllStationMsg->del_all_sta[i], pu8MacAddr[i], ETH_ALEN); |
| 4634 | PRINT_D(CFG80211_DBG, "BSSID = %x%x%x%x%x%x\n", |
| 4635 | pstrDelAllStationMsg->del_all_sta[i][0], |
| 4636 | pstrDelAllStationMsg->del_all_sta[i][1], |
| 4637 | pstrDelAllStationMsg->del_all_sta[i][2], |
| 4638 | pstrDelAllStationMsg->del_all_sta[i][3], |
| 4639 | pstrDelAllStationMsg->del_all_sta[i][4], |
| 4640 | pstrDelAllStationMsg->del_all_sta[i][5]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4641 | u8AssocNumb++; |
| 4642 | } |
| 4643 | } |
| 4644 | if (!u8AssocNumb) { |
| 4645 | PRINT_D(CFG80211_DBG, "NO ASSOCIATED STAS\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4646 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4647 | } |
| 4648 | |
Leo Kim | 8ba1803 | 2015-10-13 19:50:10 +0900 | [diff] [blame] | 4649 | pstrDelAllStationMsg->assoc_sta = u8AssocNumb; |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4650 | 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] | 4651 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4652 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4653 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4654 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4655 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4656 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4657 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4658 | } |
| 4659 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4660 | s32 host_int_edit_station(struct host_if_drv *hif_drv, |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4661 | struct add_sta_param *pstrStaParams) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4662 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4663 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4664 | struct host_if_msg msg; |
Tony Cho | ca8f47f | 2015-09-30 18:44:32 +0900 | [diff] [blame] | 4665 | struct add_sta_param *pstrAddStationMsg = &msg.body.add_sta_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4666 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4667 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4668 | PRINT_ER("driver is null\n"); |
| 4669 | return -EFAULT; |
| 4670 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4671 | |
| 4672 | PRINT_D(HOSTINF_DBG, "Setting editing station message queue params\n"); |
| 4673 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4674 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4675 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4676 | msg.id = HOST_IF_MSG_EDIT_STATION; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4677 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4678 | |
Tony Cho | 6a89ba9 | 2015-09-21 12:16:46 +0900 | [diff] [blame] | 4679 | memcpy(pstrAddStationMsg, pstrStaParams, sizeof(struct add_sta_param)); |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 4680 | if (pstrAddStationMsg->rates_len > 0) { |
| 4681 | u8 *rates = kmalloc(pstrAddStationMsg->rates_len, GFP_KERNEL); |
Leo Kim | c09389a | 2015-10-28 15:59:24 +0900 | [diff] [blame] | 4682 | |
Leo Kim | 7ae4336 | 2015-09-16 18:35:59 +0900 | [diff] [blame] | 4683 | if (!rates) |
| 4684 | return -ENOMEM; |
| 4685 | |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 4686 | memcpy(rates, pstrStaParams->rates, |
Leo Kim | e734223 | 2015-10-29 12:05:43 +0900 | [diff] [blame] | 4687 | pstrAddStationMsg->rates_len); |
Leo Kim | a622e01 | 2015-10-29 12:05:44 +0900 | [diff] [blame] | 4688 | pstrAddStationMsg->rates = rates; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4689 | } |
| 4690 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4691 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4692 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4693 | PRINT_ER("wilc_mq_send fail\n"); |
| 4694 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4695 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4696 | } |
Glen Lee | 108b343 | 2015-09-16 18:53:20 +0900 | [diff] [blame] | 4697 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4698 | s32 host_int_set_power_mgmt(struct host_if_drv *hif_drv, |
| 4699 | bool bIsEnabled, |
| 4700 | u32 u32Timeout) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4701 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4702 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4703 | struct host_if_msg msg; |
Tony Cho | 49e1f81 | 2015-09-30 18:44:36 +0900 | [diff] [blame] | 4704 | struct power_mgmt_param *pstrPowerMgmtParam = &msg.body.pwr_mgmt_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4705 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4706 | 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] | 4707 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4708 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4709 | PRINT_ER("driver is null\n"); |
| 4710 | return -EFAULT; |
| 4711 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4712 | |
| 4713 | PRINT_D(HOSTINF_DBG, "Setting Power management message queue params\n"); |
| 4714 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4715 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4716 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4717 | msg.id = HOST_IF_MSG_POWER_MGMT; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4718 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4719 | |
Leo Kim | 33c70c1 | 2015-10-13 20:02:07 +0900 | [diff] [blame] | 4720 | pstrPowerMgmtParam->enabled = bIsEnabled; |
Leo Kim | 937918f | 2015-10-13 20:02:08 +0900 | [diff] [blame] | 4721 | pstrPowerMgmtParam->timeout = u32Timeout; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4722 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4723 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4724 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4725 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4726 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4727 | } |
| 4728 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4729 | s32 host_int_setup_multicast_filter(struct host_if_drv *hif_drv, |
| 4730 | bool bIsEnabled, |
| 4731 | u32 u32count) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4732 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4733 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4734 | struct host_if_msg msg; |
Tony Cho | a079cf4d | 2015-09-30 18:55:05 +0900 | [diff] [blame] | 4735 | struct set_multicast *pstrMulticastFilterParam = &msg.body.multicast_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4736 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4737 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4738 | PRINT_ER("driver is null\n"); |
| 4739 | return -EFAULT; |
| 4740 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4741 | |
| 4742 | PRINT_D(HOSTINF_DBG, "Setting Multicast Filter params\n"); |
| 4743 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4744 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4745 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4746 | msg.id = HOST_IF_MSG_SET_MULTICAST_FILTER; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4747 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4748 | |
Leo Kim | bae636eb | 2015-10-13 20:02:04 +0900 | [diff] [blame] | 4749 | pstrMulticastFilterParam->enabled = bIsEnabled; |
Leo Kim | adab2f7 | 2015-10-13 20:02:05 +0900 | [diff] [blame] | 4750 | pstrMulticastFilterParam->cnt = u32count; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4751 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4752 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4753 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4754 | PRINT_ER("wilc_mq_send fail\n"); |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4755 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4756 | } |
| 4757 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4758 | static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo) |
| 4759 | { |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4760 | struct join_bss_param *pNewJoinBssParam = NULL; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4761 | u8 *pu8IEs; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4762 | u16 u16IEsLen; |
| 4763 | u16 index = 0; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4764 | u8 suppRatesNo = 0; |
| 4765 | u8 extSuppRatesNo; |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4766 | u16 jumpOffset; |
Greg Kroah-Hartman | 63d03e4 | 2015-06-02 14:16:04 +0900 | [diff] [blame] | 4767 | u8 pcipherCount; |
| 4768 | u8 authCount; |
| 4769 | u8 pcipherTotalCount = 0; |
| 4770 | u8 authTotalCount = 0; |
| 4771 | u8 i, j; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4772 | |
| 4773 | pu8IEs = ptstrNetworkInfo->pu8IEs; |
| 4774 | u16IEsLen = ptstrNetworkInfo->u16IEsLen; |
| 4775 | |
Shraddha Barke | b156f1e | 2015-10-13 23:07:00 +0530 | [diff] [blame] | 4776 | pNewJoinBssParam = kzalloc(sizeof(struct join_bss_param), GFP_KERNEL); |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4777 | if (pNewJoinBssParam) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4778 | pNewJoinBssParam->dtim_period = ptstrNetworkInfo->u8DtimPeriod; |
| 4779 | pNewJoinBssParam->beacon_period = ptstrNetworkInfo->u16BeaconPeriod; |
| 4780 | pNewJoinBssParam->cap_info = ptstrNetworkInfo->u16CapInfo; |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4781 | memcpy(pNewJoinBssParam->au8bssid, ptstrNetworkInfo->au8bssid, 6); |
Chaehyun Lim | d00d2ba | 2015-08-10 11:33:19 +0900 | [diff] [blame] | 4782 | memcpy((u8 *)pNewJoinBssParam->ssid, ptstrNetworkInfo->au8ssid, ptstrNetworkInfo->u8SsidLen + 1); |
Leo Kim | 619d27b | 2015-10-15 13:24:42 +0900 | [diff] [blame] | 4783 | pNewJoinBssParam->ssid_len = ptstrNetworkInfo->u8SsidLen; |
Chaehyun Lim | 2cc4683 | 2015-08-07 09:02:01 +0900 | [diff] [blame] | 4784 | memset(pNewJoinBssParam->rsn_pcip_policy, 0xFF, 3); |
| 4785 | memset(pNewJoinBssParam->rsn_auth_policy, 0xFF, 3); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4786 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4787 | while (index < u16IEsLen) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4788 | if (pu8IEs[index] == SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4789 | suppRatesNo = pu8IEs[index + 1]; |
| 4790 | pNewJoinBssParam->supp_rates[0] = suppRatesNo; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4791 | index += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4792 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4793 | for (i = 0; i < suppRatesNo; i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4794 | pNewJoinBssParam->supp_rates[i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4795 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4796 | index += suppRatesNo; |
| 4797 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4798 | } else if (pu8IEs[index] == EXT_SUPP_RATES_IE) { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4799 | extSuppRatesNo = pu8IEs[index + 1]; |
| 4800 | if (extSuppRatesNo > (MAX_RATES_SUPPORTED - suppRatesNo)) |
| 4801 | pNewJoinBssParam->supp_rates[0] = MAX_RATES_SUPPORTED; |
| 4802 | else |
| 4803 | pNewJoinBssParam->supp_rates[0] += extSuppRatesNo; |
| 4804 | index += 2; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4805 | for (i = 0; i < (pNewJoinBssParam->supp_rates[0] - suppRatesNo); i++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4806 | pNewJoinBssParam->supp_rates[suppRatesNo + i + 1] = pu8IEs[index + i]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4807 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4808 | index += extSuppRatesNo; |
| 4809 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4810 | } else if (pu8IEs[index] == HT_CAPABILITY_IE) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4811 | pNewJoinBssParam->ht_capable = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4812 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4813 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4814 | } else if ((pu8IEs[index] == WMM_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4815 | (pu8IEs[index + 2] == 0x00) && (pu8IEs[index + 3] == 0x50) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4816 | (pu8IEs[index + 4] == 0xF2) && |
| 4817 | (pu8IEs[index + 5] == 0x02) && |
| 4818 | ((pu8IEs[index + 6] == 0x00) || (pu8IEs[index + 6] == 0x01)) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4819 | (pu8IEs[index + 7] == 0x01)) { |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4820 | pNewJoinBssParam->wmm_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4821 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4822 | if (pu8IEs[index + 8] & BIT(7)) |
Chaehyun Lim | 0be1eb7 | 2015-06-13 15:41:18 +0900 | [diff] [blame] | 4823 | pNewJoinBssParam->uapsd_cap = true; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4824 | index += pu8IEs[index + 1] + 2; |
| 4825 | continue; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4826 | } else if ((pu8IEs[index] == P2P_IE) && |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4827 | (pu8IEs[index + 2] == 0x50) && (pu8IEs[index + 3] == 0x6f) && |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4828 | (pu8IEs[index + 4] == 0x9a) && |
| 4829 | (pu8IEs[index + 5] == 0x09) && (pu8IEs[index + 6] == 0x0c)) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4830 | u16 u16P2P_count; |
Luis de Bethencourt | 78c8759 | 2015-06-26 16:45:14 +0200 | [diff] [blame] | 4831 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4832 | pNewJoinBssParam->tsf = ptstrNetworkInfo->u32Tsf; |
Leo Kim | 7a8d51d | 2015-10-15 13:24:43 +0900 | [diff] [blame] | 4833 | pNewJoinBssParam->noa_enabled = 1; |
Leo Kim | cc17900 | 2015-10-15 13:24:47 +0900 | [diff] [blame] | 4834 | pNewJoinBssParam->idx = pu8IEs[index + 9]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4835 | |
Anish Bhatt | ffda203 | 2015-09-29 12:15:49 -0700 | [diff] [blame] | 4836 | if (pu8IEs[index + 10] & BIT(7)) { |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4837 | pNewJoinBssParam->opp_enabled = 1; |
Leo Kim | 99b6694 | 2015-10-15 13:24:45 +0900 | [diff] [blame] | 4838 | pNewJoinBssParam->ct_window = pu8IEs[index + 10]; |
Leo Kim | d72b33c | 2015-10-15 13:24:44 +0900 | [diff] [blame] | 4839 | } else { |
| 4840 | pNewJoinBssParam->opp_enabled = 0; |
| 4841 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4842 | |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4843 | PRINT_D(GENERIC_DBG, "P2P Dump\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4844 | for (i = 0; i < pu8IEs[index + 7]; i++) |
Luis de Bethencourt | 03b2d5e | 2015-06-26 16:45:58 +0200 | [diff] [blame] | 4845 | PRINT_D(GENERIC_DBG, " %x\n", pu8IEs[index + 9 + i]); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4846 | |
Leo Kim | c21047e | 2015-10-15 13:24:46 +0900 | [diff] [blame] | 4847 | pNewJoinBssParam->cnt = pu8IEs[index + 11]; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4848 | u16P2P_count = index + 12; |
| 4849 | |
Leo Kim | 109e6ca | 2015-10-15 13:24:48 +0900 | [diff] [blame] | 4850 | memcpy(pNewJoinBssParam->duration, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4851 | u16P2P_count += 4; |
| 4852 | |
Leo Kim | 1d8b76b | 2015-10-15 13:24:49 +0900 | [diff] [blame] | 4853 | memcpy(pNewJoinBssParam->interval, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4854 | u16P2P_count += 4; |
| 4855 | |
Leo Kim | 4be55e2 | 2015-10-28 15:59:27 +0900 | [diff] [blame] | 4856 | memcpy(pNewJoinBssParam->start_time, pu8IEs + u16P2P_count, 4); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4857 | |
| 4858 | index += pu8IEs[index + 1] + 2; |
| 4859 | continue; |
| 4860 | |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4861 | } else if ((pu8IEs[index] == RSN_IE) || |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4862 | ((pu8IEs[index] == WPA_IE) && (pu8IEs[index + 2] == 0x00) && |
| 4863 | (pu8IEs[index + 3] == 0x50) && (pu8IEs[index + 4] == 0xF2) && |
| 4864 | (pu8IEs[index + 5] == 0x01))) { |
Chaehyun Lim | d85f532 | 2015-06-11 14:35:54 +0900 | [diff] [blame] | 4865 | u16 rsnIndex = index; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4866 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4867 | if (pu8IEs[rsnIndex] == RSN_IE) { |
| 4868 | pNewJoinBssParam->mode_802_11i = 2; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4869 | } else { |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4870 | if (pNewJoinBssParam->mode_802_11i == 0) |
| 4871 | pNewJoinBssParam->mode_802_11i = 1; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4872 | rsnIndex += 4; |
| 4873 | } |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4874 | |
| 4875 | rsnIndex += 7; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4876 | pNewJoinBssParam->rsn_grp_policy = pu8IEs[rsnIndex]; |
| 4877 | rsnIndex++; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4878 | jumpOffset = pu8IEs[rsnIndex] * 4; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4879 | pcipherCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4880 | rsnIndex += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4881 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4882 | for (i = pcipherTotalCount, j = 0; i < pcipherCount + pcipherTotalCount && i < 3; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4883 | pNewJoinBssParam->rsn_pcip_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4884 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4885 | pcipherTotalCount += pcipherCount; |
| 4886 | rsnIndex += jumpOffset; |
| 4887 | |
| 4888 | jumpOffset = pu8IEs[rsnIndex] * 4; |
| 4889 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4890 | authCount = (pu8IEs[rsnIndex] > 3) ? 3 : pu8IEs[rsnIndex]; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4891 | rsnIndex += 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4892 | |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4893 | for (i = authTotalCount, j = 0; i < authTotalCount + authCount; i++, j++) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4894 | pNewJoinBssParam->rsn_auth_policy[i] = pu8IEs[rsnIndex + ((j + 1) * 4) - 1]; |
Leo Kim | d1666e2 | 2015-10-28 15:59:22 +0900 | [diff] [blame] | 4895 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4896 | authTotalCount += authCount; |
| 4897 | rsnIndex += jumpOffset; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4898 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4899 | if (pu8IEs[index] == RSN_IE) { |
| 4900 | pNewJoinBssParam->rsn_cap[0] = pu8IEs[rsnIndex]; |
| 4901 | pNewJoinBssParam->rsn_cap[1] = pu8IEs[rsnIndex + 1]; |
| 4902 | rsnIndex += 2; |
| 4903 | } |
Abdul Hussain | f717c0eb | 2015-06-16 09:49:49 +0000 | [diff] [blame] | 4904 | pNewJoinBssParam->rsn_found = true; |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4905 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4906 | continue; |
| 4907 | } else |
Leo Kim | ae4dfa5 | 2015-10-13 19:49:26 +0900 | [diff] [blame] | 4908 | index += pu8IEs[index + 1] + 2; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4909 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4910 | } |
| 4911 | |
| 4912 | return (void *)pNewJoinBssParam; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4913 | } |
| 4914 | |
| 4915 | void host_int_freeJoinParams(void *pJoinParams) |
| 4916 | { |
Leo Kim | 91109e1 | 2015-10-19 18:26:13 +0900 | [diff] [blame] | 4917 | if ((struct bss_param *)pJoinParams) |
Leo Kim | e0a1221 | 2015-10-12 16:55:49 +0900 | [diff] [blame] | 4918 | kfree((struct bss_param *)pJoinParams); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4919 | else |
| 4920 | PRINT_ER("Unable to FREE null pointer\n"); |
| 4921 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4922 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4923 | 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] | 4924 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4925 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4926 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4927 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4928 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4929 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4930 | PRINT_ER("driver is null\n"); |
| 4931 | return -EFAULT; |
| 4932 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4933 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4934 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4935 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4936 | msg.id = HOST_IF_MSG_DEL_BA_SESSION; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4937 | |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 4938 | memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 4939 | pBASessionInfo->tid = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4940 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4941 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4942 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4943 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4944 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4945 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4946 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4947 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4948 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4949 | } |
| 4950 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4951 | s32 host_int_del_All_Rx_BASession(struct host_if_drv *hif_drv, |
| 4952 | char *pBSSID, |
| 4953 | char TID) |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4954 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4955 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4956 | struct host_if_msg msg; |
Tony Cho | c833b47 | 2015-09-30 18:55:09 +0900 | [diff] [blame] | 4957 | struct ba_session_info *pBASessionInfo = &msg.body.session_info; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4958 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4959 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4960 | PRINT_ER("driver is null\n"); |
| 4961 | return -EFAULT; |
| 4962 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4963 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4964 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4965 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4966 | msg.id = HOST_IF_MSG_DEL_ALL_RX_BA_SESSIONS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4967 | |
Leo Kim | 3fc4999 | 2015-10-29 11:58:45 +0900 | [diff] [blame] | 4968 | memcpy(pBASessionInfo->bssid, pBSSID, ETH_ALEN); |
Leo Kim | 16c9b39 | 2015-10-29 11:58:46 +0900 | [diff] [blame] | 4969 | pBASessionInfo->tid = TID; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4970 | msg.drv = hif_drv; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4971 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4972 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 4973 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4974 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4975 | |
Leo Kim | 2d25af8 | 2015-10-15 13:24:56 +0900 | [diff] [blame] | 4976 | down(&hif_sema_wait_response); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4977 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4978 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4979 | } |
| 4980 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4981 | 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] | 4982 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 4983 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4984 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4985 | |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4986 | return 0; |
| 4987 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4988 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 4989 | PRINT_ER("driver is null\n"); |
| 4990 | return -EFAULT; |
| 4991 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4992 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 4993 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4994 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 4995 | msg.id = HOST_IF_MSG_SET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 4996 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 4997 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 4998 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 4999 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5000 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5001 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 5002 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5003 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5004 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5005 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5006 | } |
| 5007 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5008 | 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] | 5009 | { |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5010 | s32 result = 0; |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5011 | struct host_if_msg msg; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5012 | |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5013 | if (!hif_drv) { |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5014 | PRINT_ER("driver is null\n"); |
| 5015 | return -EFAULT; |
| 5016 | } |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5017 | |
Tony Cho | 143eb95 | 2015-09-21 12:16:32 +0900 | [diff] [blame] | 5018 | memset(&msg, 0, sizeof(struct host_if_msg)); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5019 | |
Tony Cho | a9f812a | 2015-09-21 12:16:33 +0900 | [diff] [blame] | 5020 | msg.id = HOST_IF_MSG_GET_IPADDRESS; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5021 | |
Leo Kim | 78675be | 2015-10-13 20:02:09 +0900 | [diff] [blame] | 5022 | msg.body.ip_info.ip_addr = u16ipadd; |
Tony Cho | a4ab1ad | 2015-10-12 16:56:05 +0900 | [diff] [blame] | 5023 | msg.drv = hif_drv; |
Tony Cho | fb2d65e | 2015-09-30 18:44:39 +0900 | [diff] [blame] | 5024 | msg.body.ip_info.idx = idx; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5025 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5026 | result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg)); |
| 5027 | if (result) |
Leo Kim | 24db713 | 2015-09-16 18:36:01 +0900 | [diff] [blame] | 5028 | PRINT_ER("wilc_mq_send fail\n"); |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5029 | |
Leo Kim | 31390ee | 2015-10-19 18:26:08 +0900 | [diff] [blame] | 5030 | return result; |
Johnny Kim | c5c77ba | 2015-05-11 14:30:56 +0900 | [diff] [blame] | 5031 | } |