diff options
author | Eliad Peller <eliad@wizery.com> | 2014-07-10 20:01:33 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2014-07-15 15:59:57 -0400 |
commit | e93e15fb47e53bd5dc256e2c3e40785b39ff8ff7 (patch) | |
tree | ef5d8c266cac446e4bc460c5d47e6142c732899f /drivers/net/wireless/ti | |
parent | 80ff8063e87c352072c6d96fb2d87becaf591966 (diff) |
wlcore/wl18xx: handle smart config events
add defintions and handling for smart config events
(SMART_CONFIG_SYNC_EVENT_ID and SMART_CONFIG_DECODE_EVENT_ID)
parse the relevant info and send it to userspace as
vendor event.
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ti')
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/event.c | 65 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/event.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wl18xx/main.c | 5 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/vendor_cmd.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/ti/wlcore/vendor_cmd.h | 9 |
5 files changed, 93 insertions, 1 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/event.c b/drivers/net/wireless/ti/wl18xx/event.c index c9199d7804c6..eb1848e08424 100644 --- a/drivers/net/wireless/ti/wl18xx/event.c +++ b/drivers/net/wireless/ti/wl18xx/event.c | |||
@@ -19,10 +19,12 @@ | |||
19 | * | 19 | * |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <net/genetlink.h> | ||
22 | #include "event.h" | 23 | #include "event.h" |
23 | #include "scan.h" | 24 | #include "scan.h" |
24 | #include "../wlcore/cmd.h" | 25 | #include "../wlcore/cmd.h" |
25 | #include "../wlcore/debug.h" | 26 | #include "../wlcore/debug.h" |
27 | #include "../wlcore/vendor_cmd.h" | ||
26 | 28 | ||
27 | int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, | 29 | int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, |
28 | bool *timeout) | 30 | bool *timeout) |
@@ -45,6 +47,58 @@ int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, | |||
45 | return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout); | 47 | return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout); |
46 | } | 48 | } |
47 | 49 | ||
50 | static int wlcore_smart_config_sync_event(struct wl1271 *wl, u8 sync_channel, | ||
51 | u8 sync_band) | ||
52 | { | ||
53 | struct sk_buff *skb; | ||
54 | enum ieee80211_band band; | ||
55 | int freq; | ||
56 | |||
57 | if (sync_band == WLCORE_BAND_5GHZ) | ||
58 | band = IEEE80211_BAND_5GHZ; | ||
59 | else | ||
60 | band = IEEE80211_BAND_2GHZ; | ||
61 | |||
62 | freq = ieee80211_channel_to_frequency(sync_channel, band); | ||
63 | |||
64 | wl1271_debug(DEBUG_EVENT, | ||
65 | "SMART_CONFIG_SYNC_EVENT_ID, freq: %d (chan: %d band %d)", | ||
66 | freq, sync_channel, sync_band); | ||
67 | skb = cfg80211_vendor_event_alloc(wl->hw->wiphy, 20, | ||
68 | WLCORE_VENDOR_EVENT_SC_SYNC, | ||
69 | GFP_KERNEL); | ||
70 | |||
71 | if (nla_put_u32(skb, WLCORE_VENDOR_ATTR_FREQ, freq)) { | ||
72 | kfree_skb(skb); | ||
73 | return -EMSGSIZE; | ||
74 | } | ||
75 | cfg80211_vendor_event(skb, GFP_KERNEL); | ||
76 | return 0; | ||
77 | } | ||
78 | |||
79 | static int wlcore_smart_config_decode_event(struct wl1271 *wl, | ||
80 | u8 ssid_len, u8 *ssid, | ||
81 | u8 pwd_len, u8 *pwd) | ||
82 | { | ||
83 | struct sk_buff *skb; | ||
84 | |||
85 | wl1271_debug(DEBUG_EVENT, "SMART_CONFIG_DECODE_EVENT_ID"); | ||
86 | wl1271_dump_ascii(DEBUG_EVENT, "SSID:", ssid, ssid_len); | ||
87 | |||
88 | skb = cfg80211_vendor_event_alloc(wl->hw->wiphy, | ||
89 | ssid_len + pwd_len + 20, | ||
90 | WLCORE_VENDOR_EVENT_SC_DECODE, | ||
91 | GFP_KERNEL); | ||
92 | |||
93 | if (nla_put(skb, WLCORE_VENDOR_ATTR_SSID, ssid_len, ssid) || | ||
94 | nla_put(skb, WLCORE_VENDOR_ATTR_PSK, pwd_len, pwd)) { | ||
95 | kfree_skb(skb); | ||
96 | return -EMSGSIZE; | ||
97 | } | ||
98 | cfg80211_vendor_event(skb, GFP_KERNEL); | ||
99 | return 0; | ||
100 | } | ||
101 | |||
48 | int wl18xx_process_mailbox_events(struct wl1271 *wl) | 102 | int wl18xx_process_mailbox_events(struct wl1271 *wl) |
49 | { | 103 | { |
50 | struct wl18xx_event_mailbox *mbox = wl->mbox; | 104 | struct wl18xx_event_mailbox *mbox = wl->mbox; |
@@ -107,5 +161,16 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl) | |||
107 | if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) | 161 | if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) |
108 | wlcore_event_roc_complete(wl); | 162 | wlcore_event_roc_complete(wl); |
109 | 163 | ||
164 | if (vector & SMART_CONFIG_SYNC_EVENT_ID) | ||
165 | wlcore_smart_config_sync_event(wl, mbox->sc_sync_channel, | ||
166 | mbox->sc_sync_band); | ||
167 | |||
168 | if (vector & SMART_CONFIG_DECODE_EVENT_ID) | ||
169 | wlcore_smart_config_decode_event(wl, | ||
170 | mbox->sc_ssid_len, | ||
171 | mbox->sc_ssid, | ||
172 | mbox->sc_pwd_len, | ||
173 | mbox->sc_pwd); | ||
174 | |||
110 | return 0; | 175 | return 0; |
111 | } | 176 | } |
diff --git a/drivers/net/wireless/ti/wl18xx/event.h b/drivers/net/wireless/ti/wl18xx/event.h index a76e98eb8372..0680312d4943 100644 --- a/drivers/net/wireless/ti/wl18xx/event.h +++ b/drivers/net/wireless/ti/wl18xx/event.h | |||
@@ -38,6 +38,8 @@ enum { | |||
38 | REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(18), | 38 | REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(18), |
39 | DFS_CHANNELS_CONFIG_COMPLETE_EVENT = BIT(19), | 39 | DFS_CHANNELS_CONFIG_COMPLETE_EVENT = BIT(19), |
40 | PERIODIC_SCAN_REPORT_EVENT_ID = BIT(20), | 40 | PERIODIC_SCAN_REPORT_EVENT_ID = BIT(20), |
41 | SMART_CONFIG_SYNC_EVENT_ID = BIT(22), | ||
42 | SMART_CONFIG_DECODE_EVENT_ID = BIT(23), | ||
41 | }; | 43 | }; |
42 | 44 | ||
43 | struct wl18xx_event_mailbox { | 45 | struct wl18xx_event_mailbox { |
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c index 2727ca38807c..4422ecf0e726 100644 --- a/drivers/net/wireless/ti/wl18xx/main.c +++ b/drivers/net/wireless/ti/wl18xx/main.c | |||
@@ -992,7 +992,10 @@ static int wl18xx_boot(struct wl1271 *wl) | |||
992 | REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | | 992 | REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | |
993 | INACTIVE_STA_EVENT_ID | | 993 | INACTIVE_STA_EVENT_ID | |
994 | CHANNEL_SWITCH_COMPLETE_EVENT_ID | | 994 | CHANNEL_SWITCH_COMPLETE_EVENT_ID | |
995 | DFS_CHANNELS_CONFIG_COMPLETE_EVENT; | 995 | DFS_CHANNELS_CONFIG_COMPLETE_EVENT | |
996 | SMART_CONFIG_SYNC_EVENT_ID | | ||
997 | SMART_CONFIG_DECODE_EVENT_ID; | ||
998 | ; | ||
996 | 999 | ||
997 | wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID; | 1000 | wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID; |
998 | 1001 | ||
diff --git a/drivers/net/wireless/ti/wlcore/vendor_cmd.c b/drivers/net/wireless/ti/wlcore/vendor_cmd.c index 98852b2ceb4d..ad86a48dcfcb 100644 --- a/drivers/net/wireless/ti/wlcore/vendor_cmd.c +++ b/drivers/net/wireless/ti/wlcore/vendor_cmd.c | |||
@@ -177,8 +177,21 @@ static const struct wiphy_vendor_command wlcore_vendor_commands[] = { | |||
177 | }, | 177 | }, |
178 | }; | 178 | }; |
179 | 179 | ||
180 | static const struct nl80211_vendor_cmd_info wlcore_vendor_events[] = { | ||
181 | { | ||
182 | .vendor_id = TI_OUI, | ||
183 | .subcmd = WLCORE_VENDOR_EVENT_SC_SYNC, | ||
184 | }, | ||
185 | { | ||
186 | .vendor_id = TI_OUI, | ||
187 | .subcmd = WLCORE_VENDOR_EVENT_SC_DECODE, | ||
188 | }, | ||
189 | }; | ||
190 | |||
180 | void wlcore_set_vendor_commands(struct wiphy *wiphy) | 191 | void wlcore_set_vendor_commands(struct wiphy *wiphy) |
181 | { | 192 | { |
182 | wiphy->vendor_commands = wlcore_vendor_commands; | 193 | wiphy->vendor_commands = wlcore_vendor_commands; |
183 | wiphy->n_vendor_commands = ARRAY_SIZE(wlcore_vendor_commands); | 194 | wiphy->n_vendor_commands = ARRAY_SIZE(wlcore_vendor_commands); |
195 | wiphy->vendor_events = wlcore_vendor_events; | ||
196 | wiphy->n_vendor_events = ARRAY_SIZE(wlcore_vendor_events); | ||
184 | } | 197 | } |
diff --git a/drivers/net/wireless/ti/wlcore/vendor_cmd.h b/drivers/net/wireless/ti/wlcore/vendor_cmd.h index 7e8e92fad16c..6e0c15e30f03 100644 --- a/drivers/net/wireless/ti/wlcore/vendor_cmd.h +++ b/drivers/net/wireless/ti/wlcore/vendor_cmd.h | |||
@@ -11,6 +11,10 @@ | |||
11 | #ifndef __WLCORE_VENDOR_H__ | 11 | #ifndef __WLCORE_VENDOR_H__ |
12 | #define __WLCORE_VENDOR_H__ | 12 | #define __WLCORE_VENDOR_H__ |
13 | 13 | ||
14 | #ifdef __KERNEL__ | ||
15 | void wlcore_set_vendor_commands(struct wiphy *wiphy); | ||
16 | #endif | ||
17 | |||
14 | #define TI_OUI 0x080028 | 18 | #define TI_OUI 0x080028 |
15 | 19 | ||
16 | enum wlcore_vendor_commands { | 20 | enum wlcore_vendor_commands { |
@@ -33,4 +37,9 @@ enum wlcore_vendor_attributes { | |||
33 | MAX_WLCORE_VENDOR_ATTR = NUM_WLCORE_VENDOR_ATTR - 1 | 37 | MAX_WLCORE_VENDOR_ATTR = NUM_WLCORE_VENDOR_ATTR - 1 |
34 | }; | 38 | }; |
35 | 39 | ||
40 | enum wlcore_vendor_events { | ||
41 | WLCORE_VENDOR_EVENT_SC_SYNC, | ||
42 | WLCORE_VENDOR_EVENT_SC_DECODE, | ||
43 | }; | ||
44 | |||
36 | #endif /* __WLCORE_VENDOR_H__ */ | 45 | #endif /* __WLCORE_VENDOR_H__ */ |