Commit e93e15fb authored by Eliad Peller's avatar Eliad Peller Committed by John W. Linville

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: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 80ff8063
...@@ -19,10 +19,12 @@ ...@@ -19,10 +19,12 @@
* *
*/ */
#include <net/genetlink.h>
#include "event.h" #include "event.h"
#include "scan.h" #include "scan.h"
#include "../wlcore/cmd.h" #include "../wlcore/cmd.h"
#include "../wlcore/debug.h" #include "../wlcore/debug.h"
#include "../wlcore/vendor_cmd.h"
int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
bool *timeout) bool *timeout)
...@@ -45,6 +47,58 @@ int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, ...@@ -45,6 +47,58 @@ int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout); return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout);
} }
static int wlcore_smart_config_sync_event(struct wl1271 *wl, u8 sync_channel,
u8 sync_band)
{
struct sk_buff *skb;
enum ieee80211_band band;
int freq;
if (sync_band == WLCORE_BAND_5GHZ)
band = IEEE80211_BAND_5GHZ;
else
band = IEEE80211_BAND_2GHZ;
freq = ieee80211_channel_to_frequency(sync_channel, band);
wl1271_debug(DEBUG_EVENT,
"SMART_CONFIG_SYNC_EVENT_ID, freq: %d (chan: %d band %d)",
freq, sync_channel, sync_band);
skb = cfg80211_vendor_event_alloc(wl->hw->wiphy, 20,
WLCORE_VENDOR_EVENT_SC_SYNC,
GFP_KERNEL);
if (nla_put_u32(skb, WLCORE_VENDOR_ATTR_FREQ, freq)) {
kfree_skb(skb);
return -EMSGSIZE;
}
cfg80211_vendor_event(skb, GFP_KERNEL);
return 0;
}
static int wlcore_smart_config_decode_event(struct wl1271 *wl,
u8 ssid_len, u8 *ssid,
u8 pwd_len, u8 *pwd)
{
struct sk_buff *skb;
wl1271_debug(DEBUG_EVENT, "SMART_CONFIG_DECODE_EVENT_ID");
wl1271_dump_ascii(DEBUG_EVENT, "SSID:", ssid, ssid_len);
skb = cfg80211_vendor_event_alloc(wl->hw->wiphy,
ssid_len + pwd_len + 20,
WLCORE_VENDOR_EVENT_SC_DECODE,
GFP_KERNEL);
if (nla_put(skb, WLCORE_VENDOR_ATTR_SSID, ssid_len, ssid) ||
nla_put(skb, WLCORE_VENDOR_ATTR_PSK, pwd_len, pwd)) {
kfree_skb(skb);
return -EMSGSIZE;
}
cfg80211_vendor_event(skb, GFP_KERNEL);
return 0;
}
int wl18xx_process_mailbox_events(struct wl1271 *wl) int wl18xx_process_mailbox_events(struct wl1271 *wl)
{ {
struct wl18xx_event_mailbox *mbox = wl->mbox; struct wl18xx_event_mailbox *mbox = wl->mbox;
...@@ -107,5 +161,16 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl) ...@@ -107,5 +161,16 @@ int wl18xx_process_mailbox_events(struct wl1271 *wl)
if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID)
wlcore_event_roc_complete(wl); wlcore_event_roc_complete(wl);
if (vector & SMART_CONFIG_SYNC_EVENT_ID)
wlcore_smart_config_sync_event(wl, mbox->sc_sync_channel,
mbox->sc_sync_band);
if (vector & SMART_CONFIG_DECODE_EVENT_ID)
wlcore_smart_config_decode_event(wl,
mbox->sc_ssid_len,
mbox->sc_ssid,
mbox->sc_pwd_len,
mbox->sc_pwd);
return 0; return 0;
} }
...@@ -38,6 +38,8 @@ enum { ...@@ -38,6 +38,8 @@ enum {
REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(18), REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(18),
DFS_CHANNELS_CONFIG_COMPLETE_EVENT = BIT(19), DFS_CHANNELS_CONFIG_COMPLETE_EVENT = BIT(19),
PERIODIC_SCAN_REPORT_EVENT_ID = BIT(20), PERIODIC_SCAN_REPORT_EVENT_ID = BIT(20),
SMART_CONFIG_SYNC_EVENT_ID = BIT(22),
SMART_CONFIG_DECODE_EVENT_ID = BIT(23),
}; };
struct wl18xx_event_mailbox { struct wl18xx_event_mailbox {
......
...@@ -992,7 +992,10 @@ static int wl18xx_boot(struct wl1271 *wl) ...@@ -992,7 +992,10 @@ static int wl18xx_boot(struct wl1271 *wl)
REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID |
INACTIVE_STA_EVENT_ID | INACTIVE_STA_EVENT_ID |
CHANNEL_SWITCH_COMPLETE_EVENT_ID | CHANNEL_SWITCH_COMPLETE_EVENT_ID |
DFS_CHANNELS_CONFIG_COMPLETE_EVENT; DFS_CHANNELS_CONFIG_COMPLETE_EVENT |
SMART_CONFIG_SYNC_EVENT_ID |
SMART_CONFIG_DECODE_EVENT_ID;
;
wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID; wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID;
......
...@@ -177,8 +177,21 @@ static const struct wiphy_vendor_command wlcore_vendor_commands[] = { ...@@ -177,8 +177,21 @@ static const struct wiphy_vendor_command wlcore_vendor_commands[] = {
}, },
}; };
static const struct nl80211_vendor_cmd_info wlcore_vendor_events[] = {
{
.vendor_id = TI_OUI,
.subcmd = WLCORE_VENDOR_EVENT_SC_SYNC,
},
{
.vendor_id = TI_OUI,
.subcmd = WLCORE_VENDOR_EVENT_SC_DECODE,
},
};
void wlcore_set_vendor_commands(struct wiphy *wiphy) void wlcore_set_vendor_commands(struct wiphy *wiphy)
{ {
wiphy->vendor_commands = wlcore_vendor_commands; wiphy->vendor_commands = wlcore_vendor_commands;
wiphy->n_vendor_commands = ARRAY_SIZE(wlcore_vendor_commands); wiphy->n_vendor_commands = ARRAY_SIZE(wlcore_vendor_commands);
wiphy->vendor_events = wlcore_vendor_events;
wiphy->n_vendor_events = ARRAY_SIZE(wlcore_vendor_events);
} }
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
#ifndef __WLCORE_VENDOR_H__ #ifndef __WLCORE_VENDOR_H__
#define __WLCORE_VENDOR_H__ #define __WLCORE_VENDOR_H__
#ifdef __KERNEL__
void wlcore_set_vendor_commands(struct wiphy *wiphy);
#endif
#define TI_OUI 0x080028 #define TI_OUI 0x080028
enum wlcore_vendor_commands { enum wlcore_vendor_commands {
...@@ -33,4 +37,9 @@ enum wlcore_vendor_attributes { ...@@ -33,4 +37,9 @@ enum wlcore_vendor_attributes {
MAX_WLCORE_VENDOR_ATTR = NUM_WLCORE_VENDOR_ATTR - 1 MAX_WLCORE_VENDOR_ATTR = NUM_WLCORE_VENDOR_ATTR - 1
}; };
enum wlcore_vendor_events {
WLCORE_VENDOR_EVENT_SC_SYNC,
WLCORE_VENDOR_EVENT_SC_DECODE,
};
#endif /* __WLCORE_VENDOR_H__ */ #endif /* __WLCORE_VENDOR_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment