Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Eliad Peller and committed by
John W. Linville
e93e15fb 80ff8063

+93 -1
+65
drivers/net/wireless/ti/wl18xx/event.c
··· 19 19 * 20 20 */ 21 21 22 + #include <net/genetlink.h> 22 23 #include "event.h" 23 24 #include "scan.h" 24 25 #include "../wlcore/cmd.h" 25 26 #include "../wlcore/debug.h" 27 + #include "../wlcore/vendor_cmd.h" 26 28 27 29 int wl18xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event, 28 30 bool *timeout) ··· 45 43 return 0; 46 44 } 47 45 return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout); 46 + } 47 + 48 + static int wlcore_smart_config_sync_event(struct wl1271 *wl, u8 sync_channel, 49 + u8 sync_band) 50 + { 51 + struct sk_buff *skb; 52 + enum ieee80211_band band; 53 + int freq; 54 + 55 + if (sync_band == WLCORE_BAND_5GHZ) 56 + band = IEEE80211_BAND_5GHZ; 57 + else 58 + band = IEEE80211_BAND_2GHZ; 59 + 60 + freq = ieee80211_channel_to_frequency(sync_channel, band); 61 + 62 + wl1271_debug(DEBUG_EVENT, 63 + "SMART_CONFIG_SYNC_EVENT_ID, freq: %d (chan: %d band %d)", 64 + freq, sync_channel, sync_band); 65 + skb = cfg80211_vendor_event_alloc(wl->hw->wiphy, 20, 66 + WLCORE_VENDOR_EVENT_SC_SYNC, 67 + GFP_KERNEL); 68 + 69 + if (nla_put_u32(skb, WLCORE_VENDOR_ATTR_FREQ, freq)) { 70 + kfree_skb(skb); 71 + return -EMSGSIZE; 72 + } 73 + cfg80211_vendor_event(skb, GFP_KERNEL); 74 + return 0; 75 + } 76 + 77 + static int wlcore_smart_config_decode_event(struct wl1271 *wl, 78 + u8 ssid_len, u8 *ssid, 79 + u8 pwd_len, u8 *pwd) 80 + { 81 + struct sk_buff *skb; 82 + 83 + wl1271_debug(DEBUG_EVENT, "SMART_CONFIG_DECODE_EVENT_ID"); 84 + wl1271_dump_ascii(DEBUG_EVENT, "SSID:", ssid, ssid_len); 85 + 86 + skb = cfg80211_vendor_event_alloc(wl->hw->wiphy, 87 + ssid_len + pwd_len + 20, 88 + WLCORE_VENDOR_EVENT_SC_DECODE, 89 + GFP_KERNEL); 90 + 91 + if (nla_put(skb, WLCORE_VENDOR_ATTR_SSID, ssid_len, ssid) || 92 + nla_put(skb, WLCORE_VENDOR_ATTR_PSK, pwd_len, pwd)) { 93 + kfree_skb(skb); 94 + return -EMSGSIZE; 95 + } 96 + cfg80211_vendor_event(skb, GFP_KERNEL); 97 + return 0; 48 98 } 49 99 50 100 int wl18xx_process_mailbox_events(struct wl1271 *wl) ··· 160 106 161 107 if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID) 162 108 wlcore_event_roc_complete(wl); 109 + 110 + if (vector & SMART_CONFIG_SYNC_EVENT_ID) 111 + wlcore_smart_config_sync_event(wl, mbox->sc_sync_channel, 112 + mbox->sc_sync_band); 113 + 114 + if (vector & SMART_CONFIG_DECODE_EVENT_ID) 115 + wlcore_smart_config_decode_event(wl, 116 + mbox->sc_ssid_len, 117 + mbox->sc_ssid, 118 + mbox->sc_pwd_len, 119 + mbox->sc_pwd); 163 120 164 121 return 0; 165 122 }
+2
drivers/net/wireless/ti/wl18xx/event.h
··· 38 38 REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID = BIT(18), 39 39 DFS_CHANNELS_CONFIG_COMPLETE_EVENT = BIT(19), 40 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 45 struct wl18xx_event_mailbox {
+4 -1
drivers/net/wireless/ti/wl18xx/main.c
··· 992 992 REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | 993 993 INACTIVE_STA_EVENT_ID | 994 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 1000 wl->ap_event_mask = MAX_TX_FAILURE_EVENT_ID; 998 1001
+13
drivers/net/wireless/ti/wlcore/vendor_cmd.c
··· 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 191 void wlcore_set_vendor_commands(struct wiphy *wiphy) 181 192 { 182 193 wiphy->vendor_commands = wlcore_vendor_commands; 183 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 }
+9
drivers/net/wireless/ti/wlcore/vendor_cmd.h
··· 11 11 #ifndef __WLCORE_VENDOR_H__ 12 12 #define __WLCORE_VENDOR_H__ 13 13 14 + #ifdef __KERNEL__ 15 + void wlcore_set_vendor_commands(struct wiphy *wiphy); 16 + #endif 17 + 14 18 #define TI_OUI 0x080028 15 19 16 20 enum wlcore_vendor_commands { ··· 35 31 36 32 NUM_WLCORE_VENDOR_ATTR, 37 33 MAX_WLCORE_VENDOR_ATTR = NUM_WLCORE_VENDOR_ATTR - 1 34 + }; 35 + 36 + enum wlcore_vendor_events { 37 + WLCORE_VENDOR_EVENT_SC_SYNC, 38 + WLCORE_VENDOR_EVENT_SC_DECODE, 38 39 }; 39 40 40 41 #endif /* __WLCORE_VENDOR_H__ */