aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ti/wl18xx/event.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/ti/wl18xx/event.c')
-rw-r--r--drivers/net/wireless/ti/wl18xx/event.c65
1 files changed, 65 insertions, 0 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
27int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, 29int 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
50static 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
79static 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
48int wl18xx_process_mailbox_events(struct wl1271 *wl) 102int 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}