aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/Makefile4
-rw-r--r--net/wireless/ap.c3
-rw-r--r--net/wireless/chan.c16
-rw-r--r--net/wireless/core.c16
-rw-r--r--net/wireless/core.h6
-rw-r--r--net/wireless/ethtool.c15
-rw-r--r--net/wireless/ibss.c9
-rw-r--r--net/wireless/mesh.c11
-rw-r--r--net/wireless/mlme.c92
-rw-r--r--net/wireless/nl80211.c259
-rw-r--r--net/wireless/rdev-ops.h879
-rw-r--r--net/wireless/scan.c138
-rw-r--r--net/wireless/sme.c12
-rw-r--r--net/wireless/sysfs.c5
-rw-r--r--net/wireless/trace.c7
-rw-r--r--net/wireless/trace.h2296
-rw-r--r--net/wireless/util.c14
-rw-r--r--net/wireless/wext-compat.c48
18 files changed, 3599 insertions, 231 deletions
diff --git a/net/wireless/Makefile b/net/wireless/Makefile
index 0f7e0d621ab0..a761670af31d 100644
--- a/net/wireless/Makefile
+++ b/net/wireless/Makefile
@@ -10,11 +10,13 @@ obj-$(CONFIG_WEXT_SPY) += wext-spy.o
10obj-$(CONFIG_WEXT_PRIV) += wext-priv.o 10obj-$(CONFIG_WEXT_PRIV) += wext-priv.o
11 11
12cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o 12cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o
13cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o 13cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o
14cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o 14cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o
15cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o 15cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
16cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o 16cfg80211-$(CONFIG_CFG80211_INTERNAL_REGDB) += regdb.o
17 17
18CFLAGS_trace.o := -I$(src)
19
18ccflags-y += -D__CHECK_ENDIAN__ 20ccflags-y += -D__CHECK_ENDIAN__
19 21
20$(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk 22$(obj)/regdb.c: $(src)/db.txt $(src)/genregdb.awk
diff --git a/net/wireless/ap.c b/net/wireless/ap.c
index fcc60d8dbefa..e143505f05bc 100644
--- a/net/wireless/ap.c
+++ b/net/wireless/ap.c
@@ -3,6 +3,7 @@
3#include <net/cfg80211.h> 3#include <net/cfg80211.h>
4#include "nl80211.h" 4#include "nl80211.h"
5#include "core.h" 5#include "core.h"
6#include "rdev-ops.h"
6 7
7 8
8static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev, 9static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
@@ -23,7 +24,7 @@ static int __cfg80211_stop_ap(struct cfg80211_registered_device *rdev,
23 if (!wdev->beacon_interval) 24 if (!wdev->beacon_interval)
24 return -ENOENT; 25 return -ENOENT;
25 26
26 err = rdev->ops->stop_ap(&rdev->wiphy, dev); 27 err = rdev_stop_ap(rdev, dev);
27 if (!err) { 28 if (!err) {
28 wdev->beacon_interval = 0; 29 wdev->beacon_interval = 0;
29 wdev->channel = NULL; 30 wdev->channel = NULL;
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 2f876b9ee344..48febd2160ba 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -9,6 +9,7 @@
9#include <linux/export.h> 9#include <linux/export.h>
10#include <net/cfg80211.h> 10#include <net/cfg80211.h>
11#include "core.h" 11#include "core.h"
12#include "rdev-ops.h"
12 13
13struct ieee80211_channel * 14struct ieee80211_channel *
14rdev_freq_to_chan(struct cfg80211_registered_device *rdev, 15rdev_freq_to_chan(struct cfg80211_registered_device *rdev,
@@ -52,6 +53,8 @@ bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
52 struct ieee80211_channel *sec_chan; 53 struct ieee80211_channel *sec_chan;
53 int diff; 54 int diff;
54 55
56 trace_cfg80211_can_beacon_sec_chan(wiphy, chan, channel_type);
57
55 switch (channel_type) { 58 switch (channel_type) {
56 case NL80211_CHAN_HT40PLUS: 59 case NL80211_CHAN_HT40PLUS:
57 diff = 20; 60 diff = 20;
@@ -60,20 +63,25 @@ bool cfg80211_can_beacon_sec_chan(struct wiphy *wiphy,
60 diff = -20; 63 diff = -20;
61 break; 64 break;
62 default: 65 default:
66 trace_cfg80211_return_bool(true);
63 return true; 67 return true;
64 } 68 }
65 69
66 sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff); 70 sec_chan = ieee80211_get_channel(wiphy, chan->center_freq + diff);
67 if (!sec_chan) 71 if (!sec_chan) {
72 trace_cfg80211_return_bool(false);
68 return false; 73 return false;
74 }
69 75
70 /* we'll need a DFS capability later */ 76 /* we'll need a DFS capability later */
71 if (sec_chan->flags & (IEEE80211_CHAN_DISABLED | 77 if (sec_chan->flags & (IEEE80211_CHAN_DISABLED |
72 IEEE80211_CHAN_PASSIVE_SCAN | 78 IEEE80211_CHAN_PASSIVE_SCAN |
73 IEEE80211_CHAN_NO_IBSS | 79 IEEE80211_CHAN_NO_IBSS |
74 IEEE80211_CHAN_RADAR)) 80 IEEE80211_CHAN_RADAR)) {
81 trace_cfg80211_return_bool(false);
75 return false; 82 return false;
76 83 }
84 trace_cfg80211_return_bool(true);
77 return true; 85 return true;
78} 86}
79EXPORT_SYMBOL(cfg80211_can_beacon_sec_chan); 87EXPORT_SYMBOL(cfg80211_can_beacon_sec_chan);
@@ -92,7 +100,7 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
92 if (!chan) 100 if (!chan)
93 return -EINVAL; 101 return -EINVAL;
94 102
95 return rdev->ops->set_monitor_channel(&rdev->wiphy, chan, chantype); 103 return rdev_set_monitor_channel(rdev, chan, chantype);
96} 104}
97 105
98void 106void
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 3f7253052088..26711f46a3be 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -26,6 +26,7 @@
26#include "debugfs.h" 26#include "debugfs.h"
27#include "wext-compat.h" 27#include "wext-compat.h"
28#include "ethtool.h" 28#include "ethtool.h"
29#include "rdev-ops.h"
29 30
30/* name for sysfs, %d is appended */ 31/* name for sysfs, %d is appended */
31#define PHY_NAME "phy" 32#define PHY_NAME "phy"
@@ -216,7 +217,7 @@ static void cfg80211_rfkill_poll(struct rfkill *rfkill, void *data)
216{ 217{
217 struct cfg80211_registered_device *rdev = data; 218 struct cfg80211_registered_device *rdev = data;
218 219
219 rdev->ops->rfkill_poll(&rdev->wiphy); 220 rdev_rfkill_poll(rdev);
220} 221}
221 222
222static int cfg80211_rfkill_set_block(void *data, bool blocked) 223static int cfg80211_rfkill_set_block(void *data, bool blocked)
@@ -240,7 +241,7 @@ static int cfg80211_rfkill_set_block(void *data, bool blocked)
240 case NL80211_IFTYPE_P2P_DEVICE: 241 case NL80211_IFTYPE_P2P_DEVICE:
241 if (!wdev->p2p_started) 242 if (!wdev->p2p_started)
242 break; 243 break;
243 rdev->ops->stop_p2p_device(&rdev->wiphy, wdev); 244 rdev_stop_p2p_device(rdev, wdev);
244 wdev->p2p_started = false; 245 wdev->p2p_started = false;
245 rdev->opencount--; 246 rdev->opencount--;
246 break; 247 break;
@@ -370,6 +371,8 @@ struct wiphy *wiphy_new(const struct cfg80211_ops *ops, int sizeof_priv)
370 rdev->wiphy.rts_threshold = (u32) -1; 371 rdev->wiphy.rts_threshold = (u32) -1;
371 rdev->wiphy.coverage_class = 0; 372 rdev->wiphy.coverage_class = 0;
372 373
374 rdev->wiphy.features = NL80211_FEATURE_SCAN_FLUSH;
375
373 return &rdev->wiphy; 376 return &rdev->wiphy;
374} 377}
375EXPORT_SYMBOL(wiphy_new); 378EXPORT_SYMBOL(wiphy_new);
@@ -687,7 +690,7 @@ void wiphy_unregister(struct wiphy *wiphy)
687 flush_work(&rdev->event_work); 690 flush_work(&rdev->event_work);
688 691
689 if (rdev->wowlan && rdev->ops->set_wakeup) 692 if (rdev->wowlan && rdev->ops->set_wakeup)
690 rdev->ops->set_wakeup(&rdev->wiphy, false); 693 rdev_set_wakeup(rdev, false);
691 cfg80211_rdev_free_wowlan(rdev); 694 cfg80211_rdev_free_wowlan(rdev);
692} 695}
693EXPORT_SYMBOL(wiphy_unregister); 696EXPORT_SYMBOL(wiphy_unregister);
@@ -770,7 +773,7 @@ void cfg80211_unregister_wdev(struct wireless_dev *wdev)
770 case NL80211_IFTYPE_P2P_DEVICE: 773 case NL80211_IFTYPE_P2P_DEVICE:
771 if (!wdev->p2p_started) 774 if (!wdev->p2p_started)
772 break; 775 break;
773 rdev->ops->stop_p2p_device(&rdev->wiphy, wdev); 776 rdev_stop_p2p_device(rdev, wdev);
774 wdev->p2p_started = false; 777 wdev->p2p_started = false;
775 rdev->opencount--; 778 rdev->opencount--;
776 break; 779 break;
@@ -961,9 +964,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
961 if ((wdev->iftype == NL80211_IFTYPE_STATION || 964 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
962 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) && 965 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
963 rdev->ops->set_power_mgmt) 966 rdev->ops->set_power_mgmt)
964 if (rdev->ops->set_power_mgmt(wdev->wiphy, dev, 967 if (rdev_set_power_mgmt(rdev, dev, wdev->ps,
965 wdev->ps, 968 wdev->ps_timeout)) {
966 wdev->ps_timeout)) {
967 /* assume this means it's off */ 969 /* assume this means it's off */
968 wdev->ps = false; 970 wdev->ps = false;
969 } 971 }
diff --git a/net/wireless/core.h b/net/wireless/core.h
index a343be4a52bd..b8eb743fe7da 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -320,13 +320,15 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
320 const u8 *bssid, 320 const u8 *bssid,
321 const u8 *ssid, int ssid_len, 321 const u8 *ssid, int ssid_len,
322 const u8 *ie, int ie_len, 322 const u8 *ie, int ie_len,
323 const u8 *key, int key_len, int key_idx); 323 const u8 *key, int key_len, int key_idx,
324 const u8 *sae_data, int sae_data_len);
324int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev, 325int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
325 struct net_device *dev, struct ieee80211_channel *chan, 326 struct net_device *dev, struct ieee80211_channel *chan,
326 enum nl80211_auth_type auth_type, const u8 *bssid, 327 enum nl80211_auth_type auth_type, const u8 *bssid,
327 const u8 *ssid, int ssid_len, 328 const u8 *ssid, int ssid_len,
328 const u8 *ie, int ie_len, 329 const u8 *ie, int ie_len,
329 const u8 *key, int key_len, int key_idx); 330 const u8 *key, int key_len, int key_idx,
331 const u8 *sae_data, int sae_data_len);
330int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev, 332int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
331 struct net_device *dev, 333 struct net_device *dev,
332 struct ieee80211_channel *chan, 334 struct ieee80211_channel *chan,
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
index 7eecdf40cf80..48c48ffafa1d 100644
--- a/net/wireless/ethtool.c
+++ b/net/wireless/ethtool.c
@@ -2,6 +2,7 @@
2#include <net/cfg80211.h> 2#include <net/cfg80211.h>
3#include "core.h" 3#include "core.h"
4#include "ethtool.h" 4#include "ethtool.h"
5#include "rdev-ops.h"
5 6
6static void cfg80211_get_drvinfo(struct net_device *dev, 7static void cfg80211_get_drvinfo(struct net_device *dev,
7 struct ethtool_drvinfo *info) 8 struct ethtool_drvinfo *info)
@@ -47,9 +48,8 @@ static void cfg80211_get_ringparam(struct net_device *dev,
47 memset(rp, 0, sizeof(*rp)); 48 memset(rp, 0, sizeof(*rp));
48 49
49 if (rdev->ops->get_ringparam) 50 if (rdev->ops->get_ringparam)
50 rdev->ops->get_ringparam(wdev->wiphy, 51 rdev_get_ringparam(rdev, &rp->tx_pending, &rp->tx_max_pending,
51 &rp->tx_pending, &rp->tx_max_pending, 52 &rp->rx_pending, &rp->rx_max_pending);
52 &rp->rx_pending, &rp->rx_max_pending);
53} 53}
54 54
55static int cfg80211_set_ringparam(struct net_device *dev, 55static int cfg80211_set_ringparam(struct net_device *dev,
@@ -62,8 +62,7 @@ static int cfg80211_set_ringparam(struct net_device *dev,
62 return -EINVAL; 62 return -EINVAL;
63 63
64 if (rdev->ops->set_ringparam) 64 if (rdev->ops->set_ringparam)
65 return rdev->ops->set_ringparam(wdev->wiphy, 65 return rdev_set_ringparam(rdev, rp->tx_pending, rp->rx_pending);
66 rp->tx_pending, rp->rx_pending);
67 66
68 return -ENOTSUPP; 67 return -ENOTSUPP;
69} 68}
@@ -73,7 +72,7 @@ static int cfg80211_get_sset_count(struct net_device *dev, int sset)
73 struct wireless_dev *wdev = dev->ieee80211_ptr; 72 struct wireless_dev *wdev = dev->ieee80211_ptr;
74 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 73 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
75 if (rdev->ops->get_et_sset_count) 74 if (rdev->ops->get_et_sset_count)
76 return rdev->ops->get_et_sset_count(wdev->wiphy, dev, sset); 75 return rdev_get_et_sset_count(rdev, dev, sset);
77 return -EOPNOTSUPP; 76 return -EOPNOTSUPP;
78} 77}
79 78
@@ -83,7 +82,7 @@ static void cfg80211_get_stats(struct net_device *dev,
83 struct wireless_dev *wdev = dev->ieee80211_ptr; 82 struct wireless_dev *wdev = dev->ieee80211_ptr;
84 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 83 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
85 if (rdev->ops->get_et_stats) 84 if (rdev->ops->get_et_stats)
86 rdev->ops->get_et_stats(wdev->wiphy, dev, stats, data); 85 rdev_get_et_stats(rdev, dev, stats, data);
87} 86}
88 87
89static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data) 88static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
@@ -91,7 +90,7 @@ static void cfg80211_get_strings(struct net_device *dev, u32 sset, u8 *data)
91 struct wireless_dev *wdev = dev->ieee80211_ptr; 90 struct wireless_dev *wdev = dev->ieee80211_ptr;
92 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 91 struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy);
93 if (rdev->ops->get_et_strings) 92 if (rdev->ops->get_et_strings)
94 rdev->ops->get_et_strings(wdev->wiphy, dev, sset, data); 93 rdev_get_et_strings(rdev, dev, sset, data);
95} 94}
96 95
97const struct ethtool_ops cfg80211_ethtool_ops = { 96const struct ethtool_ops cfg80211_ethtool_ops = {
diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index ca5672f6ee2f..27941d5db72b 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -11,6 +11,7 @@
11#include <net/cfg80211.h> 11#include <net/cfg80211.h>
12#include "wext-compat.h" 12#include "wext-compat.h"
13#include "nl80211.h" 13#include "nl80211.h"
14#include "rdev-ops.h"
14 15
15 16
16void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid) 17void __cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid)
@@ -61,6 +62,8 @@ void cfg80211_ibss_joined(struct net_device *dev, const u8 *bssid, gfp_t gfp)
61 struct cfg80211_event *ev; 62 struct cfg80211_event *ev;
62 unsigned long flags; 63 unsigned long flags;
63 64
65 trace_cfg80211_ibss_joined(dev, bssid);
66
64 CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTING); 67 CFG80211_DEV_WARN_ON(wdev->sme_state != CFG80211_SME_CONNECTING);
65 68
66 ev = kzalloc(sizeof(*ev), gfp); 69 ev = kzalloc(sizeof(*ev), gfp);
@@ -128,7 +131,7 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
128 return err; 131 return err;
129 } 132 }
130 133
131 err = rdev->ops->join_ibss(&rdev->wiphy, dev, params); 134 err = rdev_join_ibss(rdev, dev, params);
132 if (err) { 135 if (err) {
133 wdev->connect_keys = NULL; 136 wdev->connect_keys = NULL;
134 wdev->sme_state = CFG80211_SME_IDLE; 137 wdev->sme_state = CFG80211_SME_IDLE;
@@ -175,7 +178,7 @@ static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext)
175 */ 178 */
176 if (rdev->ops->del_key) 179 if (rdev->ops->del_key)
177 for (i = 0; i < 6; i++) 180 for (i = 0; i < 6; i++)
178 rdev->ops->del_key(wdev->wiphy, dev, i, false, NULL); 181 rdev_del_key(rdev, dev, i, false, NULL);
179 182
180 if (wdev->current_bss) { 183 if (wdev->current_bss) {
181 cfg80211_unhold_bss(wdev->current_bss); 184 cfg80211_unhold_bss(wdev->current_bss);
@@ -211,7 +214,7 @@ int __cfg80211_leave_ibss(struct cfg80211_registered_device *rdev,
211 if (!wdev->ssid_len) 214 if (!wdev->ssid_len)
212 return -ENOLINK; 215 return -ENOLINK;
213 216
214 err = rdev->ops->leave_ibss(&rdev->wiphy, dev); 217 err = rdev_leave_ibss(rdev, dev);
215 218
216 if (err) 219 if (err)
217 return err; 220 return err;
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index c384e77ff77a..966cfc4cd79d 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -3,6 +3,7 @@
3#include <net/cfg80211.h> 3#include <net/cfg80211.h>
4#include "nl80211.h" 4#include "nl80211.h"
5#include "core.h" 5#include "core.h"
6#include "rdev-ops.h"
6 7
7/* Default values, timeouts in ms */ 8/* Default values, timeouts in ms */
8#define MESH_TTL 31 9#define MESH_TTL 31
@@ -160,7 +161,7 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
160 if (err) 161 if (err)
161 return err; 162 return err;
162 163
163 err = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup); 164 err = rdev_join_mesh(rdev, dev, conf, setup);
164 if (!err) { 165 if (!err) {
165 memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len); 166 memcpy(wdev->ssid, setup->mesh_id, setup->mesh_id_len);
166 wdev->mesh_id_len = setup->mesh_id_len; 167 wdev->mesh_id_len = setup->mesh_id_len;
@@ -220,9 +221,8 @@ int cfg80211_set_mesh_freq(struct cfg80211_registered_device *rdev,
220 if (err) 221 if (err)
221 return err; 222 return err;
222 223
223 err = rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, 224 err = rdev_libertas_set_mesh_channel(rdev, wdev->netdev,
224 wdev->netdev, 225 channel);
225 channel);
226 if (!err) 226 if (!err)
227 wdev->channel = channel; 227 wdev->channel = channel;
228 228
@@ -242,6 +242,7 @@ void cfg80211_notify_new_peer_candidate(struct net_device *dev,
242{ 242{
243 struct wireless_dev *wdev = dev->ieee80211_ptr; 243 struct wireless_dev *wdev = dev->ieee80211_ptr;
244 244
245 trace_cfg80211_notify_new_peer_candidate(dev, macaddr);
245 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_MESH_POINT)) 246 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_MESH_POINT))
246 return; 247 return;
247 248
@@ -267,7 +268,7 @@ static int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
267 if (!wdev->mesh_id_len) 268 if (!wdev->mesh_id_len)
268 return -ENOTCONN; 269 return -ENOTCONN;
269 270
270 err = rdev->ops->leave_mesh(&rdev->wiphy, dev); 271 err = rdev_leave_mesh(rdev, dev);
271 if (!err) { 272 if (!err) {
272 wdev->mesh_id_len = 0; 273 wdev->mesh_id_len = 0;
273 wdev->channel = NULL; 274 wdev->channel = NULL;
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 904a7f368325..4bfd14f7c592 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -15,6 +15,8 @@
15#include <net/iw_handler.h> 15#include <net/iw_handler.h>
16#include "core.h" 16#include "core.h"
17#include "nl80211.h" 17#include "nl80211.h"
18#include "rdev-ops.h"
19
18 20
19void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len) 21void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len)
20{ 22{
@@ -22,6 +24,7 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len)
22 struct wiphy *wiphy = wdev->wiphy; 24 struct wiphy *wiphy = wdev->wiphy;
23 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 25 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
24 26
27 trace_cfg80211_send_rx_auth(dev);
25 wdev_lock(wdev); 28 wdev_lock(wdev);
26 29
27 nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL); 30 nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
@@ -42,6 +45,7 @@ void cfg80211_send_rx_assoc(struct net_device *dev, struct cfg80211_bss *bss,
42 u8 *ie = mgmt->u.assoc_resp.variable; 45 u8 *ie = mgmt->u.assoc_resp.variable;
43 int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); 46 int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable);
44 47
48 trace_cfg80211_send_rx_assoc(dev, bss);
45 wdev_lock(wdev); 49 wdev_lock(wdev);
46 50
47 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code); 51 status_code = le16_to_cpu(mgmt->u.assoc_resp.status_code);
@@ -98,6 +102,7 @@ void __cfg80211_send_deauth(struct net_device *dev,
98 const u8 *bssid = mgmt->bssid; 102 const u8 *bssid = mgmt->bssid;
99 bool was_current = false; 103 bool was_current = false;
100 104
105 trace___cfg80211_send_deauth(dev);
101 ASSERT_WDEV_LOCK(wdev); 106 ASSERT_WDEV_LOCK(wdev);
102 107
103 if (wdev->current_bss && 108 if (wdev->current_bss &&
@@ -147,6 +152,7 @@ void __cfg80211_send_disassoc(struct net_device *dev,
147 u16 reason_code; 152 u16 reason_code;
148 bool from_ap; 153 bool from_ap;
149 154
155 trace___cfg80211_send_disassoc(dev);
150 ASSERT_WDEV_LOCK(wdev); 156 ASSERT_WDEV_LOCK(wdev);
151 157
152 nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL); 158 nl80211_send_disassoc(rdev, dev, buf, len, GFP_KERNEL);
@@ -188,6 +194,7 @@ void cfg80211_send_unprot_deauth(struct net_device *dev, const u8 *buf,
188 struct wiphy *wiphy = wdev->wiphy; 194 struct wiphy *wiphy = wdev->wiphy;
189 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 195 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
190 196
197 trace_cfg80211_send_unprot_deauth(dev);
191 nl80211_send_unprot_deauth(rdev, dev, buf, len, GFP_ATOMIC); 198 nl80211_send_unprot_deauth(rdev, dev, buf, len, GFP_ATOMIC);
192} 199}
193EXPORT_SYMBOL(cfg80211_send_unprot_deauth); 200EXPORT_SYMBOL(cfg80211_send_unprot_deauth);
@@ -199,6 +206,7 @@ void cfg80211_send_unprot_disassoc(struct net_device *dev, const u8 *buf,
199 struct wiphy *wiphy = wdev->wiphy; 206 struct wiphy *wiphy = wdev->wiphy;
200 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 207 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
201 208
209 trace_cfg80211_send_unprot_disassoc(dev);
202 nl80211_send_unprot_disassoc(rdev, dev, buf, len, GFP_ATOMIC); 210 nl80211_send_unprot_disassoc(rdev, dev, buf, len, GFP_ATOMIC);
203} 211}
204EXPORT_SYMBOL(cfg80211_send_unprot_disassoc); 212EXPORT_SYMBOL(cfg80211_send_unprot_disassoc);
@@ -209,6 +217,7 @@ void cfg80211_send_auth_timeout(struct net_device *dev, const u8 *addr)
209 struct wiphy *wiphy = wdev->wiphy; 217 struct wiphy *wiphy = wdev->wiphy;
210 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 218 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
211 219
220 trace_cfg80211_send_auth_timeout(dev, addr);
212 wdev_lock(wdev); 221 wdev_lock(wdev);
213 222
214 nl80211_send_auth_timeout(rdev, dev, addr, GFP_KERNEL); 223 nl80211_send_auth_timeout(rdev, dev, addr, GFP_KERNEL);
@@ -227,6 +236,7 @@ void cfg80211_send_assoc_timeout(struct net_device *dev, const u8 *addr)
227 struct wiphy *wiphy = wdev->wiphy; 236 struct wiphy *wiphy = wdev->wiphy;
228 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 237 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
229 238
239 trace_cfg80211_send_assoc_timeout(dev, addr);
230 wdev_lock(wdev); 240 wdev_lock(wdev);
231 241
232 nl80211_send_assoc_timeout(rdev, dev, addr, GFP_KERNEL); 242 nl80211_send_assoc_timeout(rdev, dev, addr, GFP_KERNEL);
@@ -261,6 +271,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
261 } 271 }
262#endif 272#endif
263 273
274 trace_cfg80211_michael_mic_failure(dev, addr, key_type, key_id, tsc);
264 nl80211_michael_mic_failure(rdev, dev, addr, key_type, key_id, tsc, gfp); 275 nl80211_michael_mic_failure(rdev, dev, addr, key_type, key_id, tsc, gfp);
265} 276}
266EXPORT_SYMBOL(cfg80211_michael_mic_failure); 277EXPORT_SYMBOL(cfg80211_michael_mic_failure);
@@ -273,7 +284,8 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
273 const u8 *bssid, 284 const u8 *bssid,
274 const u8 *ssid, int ssid_len, 285 const u8 *ssid, int ssid_len,
275 const u8 *ie, int ie_len, 286 const u8 *ie, int ie_len,
276 const u8 *key, int key_len, int key_idx) 287 const u8 *key, int key_len, int key_idx,
288 const u8 *sae_data, int sae_data_len)
277{ 289{
278 struct wireless_dev *wdev = dev->ieee80211_ptr; 290 struct wireless_dev *wdev = dev->ieee80211_ptr;
279 struct cfg80211_auth_request req; 291 struct cfg80211_auth_request req;
@@ -293,6 +305,8 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
293 305
294 req.ie = ie; 306 req.ie = ie;
295 req.ie_len = ie_len; 307 req.ie_len = ie_len;
308 req.sae_data = sae_data;
309 req.sae_data_len = sae_data_len;
296 req.auth_type = auth_type; 310 req.auth_type = auth_type;
297 req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len, 311 req.bss = cfg80211_get_bss(&rdev->wiphy, chan, bssid, ssid, ssid_len,
298 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS); 312 WLAN_CAPABILITY_ESS, WLAN_CAPABILITY_ESS);
@@ -307,7 +321,7 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
307 if (err) 321 if (err)
308 goto out; 322 goto out;
309 323
310 err = rdev->ops->auth(&rdev->wiphy, dev, &req); 324 err = rdev_auth(rdev, dev, &req);
311 325
312out: 326out:
313 cfg80211_put_bss(req.bss); 327 cfg80211_put_bss(req.bss);
@@ -319,7 +333,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
319 enum nl80211_auth_type auth_type, const u8 *bssid, 333 enum nl80211_auth_type auth_type, const u8 *bssid,
320 const u8 *ssid, int ssid_len, 334 const u8 *ssid, int ssid_len,
321 const u8 *ie, int ie_len, 335 const u8 *ie, int ie_len,
322 const u8 *key, int key_len, int key_idx) 336 const u8 *key, int key_len, int key_idx,
337 const u8 *sae_data, int sae_data_len)
323{ 338{
324 int err; 339 int err;
325 340
@@ -327,7 +342,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
327 wdev_lock(dev->ieee80211_ptr); 342 wdev_lock(dev->ieee80211_ptr);
328 err = __cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid, 343 err = __cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
329 ssid, ssid_len, ie, ie_len, 344 ssid, ssid_len, ie, ie_len,
330 key, key_len, key_idx); 345 key, key_len, key_idx,
346 sae_data, sae_data_len);
331 wdev_unlock(dev->ieee80211_ptr); 347 wdev_unlock(dev->ieee80211_ptr);
332 mutex_unlock(&rdev->devlist_mtx); 348 mutex_unlock(&rdev->devlist_mtx);
333 349
@@ -410,7 +426,7 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
410 if (err) 426 if (err)
411 goto out; 427 goto out;
412 428
413 err = rdev->ops->assoc(&rdev->wiphy, dev, &req); 429 err = rdev_assoc(rdev, dev, &req);
414 430
415out: 431out:
416 if (err) { 432 if (err) {
@@ -466,7 +482,7 @@ int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
466 !ether_addr_equal(wdev->current_bss->pub.bssid, bssid))) 482 !ether_addr_equal(wdev->current_bss->pub.bssid, bssid)))
467 return 0; 483 return 0;
468 484
469 return rdev->ops->deauth(&rdev->wiphy, dev, &req); 485 return rdev_deauth(rdev, dev, &req);
470} 486}
471 487
472int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, 488int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
@@ -511,7 +527,7 @@ static int __cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
511 else 527 else
512 return -ENOTCONN; 528 return -ENOTCONN;
513 529
514 return rdev->ops->disassoc(&rdev->wiphy, dev, &req); 530 return rdev_disassoc(rdev, dev, &req);
515} 531}
516 532
517int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, 533int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
@@ -552,7 +568,7 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
552 568
553 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN); 569 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
554 req.bssid = bssid; 570 req.bssid = bssid;
555 rdev->ops->deauth(&rdev->wiphy, dev, &req); 571 rdev_deauth(rdev, dev, &req);
556 572
557 if (wdev->current_bss) { 573 if (wdev->current_bss) {
558 cfg80211_unhold_bss(wdev->current_bss); 574 cfg80211_unhold_bss(wdev->current_bss);
@@ -569,6 +585,8 @@ void cfg80211_ready_on_channel(struct wireless_dev *wdev, u64 cookie,
569 struct wiphy *wiphy = wdev->wiphy; 585 struct wiphy *wiphy = wdev->wiphy;
570 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 586 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
571 587
588 trace_cfg80211_ready_on_channel(wdev, cookie, chan, channel_type,
589 duration);
572 nl80211_send_remain_on_channel(rdev, wdev, cookie, chan, channel_type, 590 nl80211_send_remain_on_channel(rdev, wdev, cookie, chan, channel_type,
573 duration, gfp); 591 duration, gfp);
574} 592}
@@ -582,6 +600,8 @@ void cfg80211_remain_on_channel_expired(struct wireless_dev *wdev, u64 cookie,
582 struct wiphy *wiphy = wdev->wiphy; 600 struct wiphy *wiphy = wdev->wiphy;
583 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 601 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
584 602
603 trace_cfg80211_ready_on_channel_expired(wdev, cookie, chan,
604 channel_type);
585 nl80211_send_remain_on_channel_cancel(rdev, wdev, cookie, chan, 605 nl80211_send_remain_on_channel_cancel(rdev, wdev, cookie, chan,
586 channel_type, gfp); 606 channel_type, gfp);
587} 607}
@@ -593,6 +613,7 @@ void cfg80211_new_sta(struct net_device *dev, const u8 *mac_addr,
593 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; 613 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
594 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 614 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
595 615
616 trace_cfg80211_new_sta(dev, mac_addr, sinfo);
596 nl80211_send_sta_event(rdev, dev, mac_addr, sinfo, gfp); 617 nl80211_send_sta_event(rdev, dev, mac_addr, sinfo, gfp);
597} 618}
598EXPORT_SYMBOL(cfg80211_new_sta); 619EXPORT_SYMBOL(cfg80211_new_sta);
@@ -602,6 +623,7 @@ void cfg80211_del_sta(struct net_device *dev, const u8 *mac_addr, gfp_t gfp)
602 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; 623 struct wiphy *wiphy = dev->ieee80211_ptr->wiphy;
603 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 624 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
604 625
626 trace_cfg80211_del_sta(dev, mac_addr);
605 nl80211_send_sta_del_event(rdev, dev, mac_addr, gfp); 627 nl80211_send_sta_del_event(rdev, dev, mac_addr, gfp);
606} 628}
607EXPORT_SYMBOL(cfg80211_del_sta); 629EXPORT_SYMBOL(cfg80211_del_sta);
@@ -682,7 +704,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid,
682 list_add(&nreg->list, &wdev->mgmt_registrations); 704 list_add(&nreg->list, &wdev->mgmt_registrations);
683 705
684 if (rdev->ops->mgmt_frame_register) 706 if (rdev->ops->mgmt_frame_register)
685 rdev->ops->mgmt_frame_register(wiphy, wdev, frame_type, true); 707 rdev_mgmt_frame_register(rdev, wdev, frame_type, true);
686 708
687 out: 709 out:
688 spin_unlock_bh(&wdev->mgmt_registrations_lock); 710 spin_unlock_bh(&wdev->mgmt_registrations_lock);
@@ -705,8 +727,8 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid)
705 if (rdev->ops->mgmt_frame_register) { 727 if (rdev->ops->mgmt_frame_register) {
706 u16 frame_type = le16_to_cpu(reg->frame_type); 728 u16 frame_type = le16_to_cpu(reg->frame_type);
707 729
708 rdev->ops->mgmt_frame_register(wiphy, wdev, 730 rdev_mgmt_frame_register(rdev, wdev,
709 frame_type, false); 731 frame_type, false);
710 } 732 }
711 733
712 list_del(&reg->list); 734 list_del(&reg->list);
@@ -832,10 +854,10 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
832 return -EINVAL; 854 return -EINVAL;
833 855
834 /* Transmit the Action frame as requested by user space */ 856 /* Transmit the Action frame as requested by user space */
835 return rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan, 857 return rdev_mgmt_tx(rdev, wdev, chan, offchan,
836 channel_type, channel_type_valid, 858 channel_type, channel_type_valid,
837 wait, buf, len, no_cck, dont_wait_for_ack, 859 wait, buf, len, no_cck, dont_wait_for_ack,
838 cookie); 860 cookie);
839} 861}
840 862
841bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, 863bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
@@ -854,10 +876,13 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
854 cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE); 876 cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE);
855 u16 stype; 877 u16 stype;
856 878
879 trace_cfg80211_rx_mgmt(wdev, freq, sig_mbm);
857 stype = (le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE) >> 4; 880 stype = (le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE) >> 4;
858 881
859 if (!(stypes->rx & BIT(stype))) 882 if (!(stypes->rx & BIT(stype))) {
883 trace_cfg80211_return_bool(false);
860 return false; 884 return false;
885 }
861 886
862 data = buf + ieee80211_hdrlen(mgmt->frame_control); 887 data = buf + ieee80211_hdrlen(mgmt->frame_control);
863 data_len = len - ieee80211_hdrlen(mgmt->frame_control); 888 data_len = len - ieee80211_hdrlen(mgmt->frame_control);
@@ -888,6 +913,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
888 913
889 spin_unlock_bh(&wdev->mgmt_registrations_lock); 914 spin_unlock_bh(&wdev->mgmt_registrations_lock);
890 915
916 trace_cfg80211_return_bool(result);
891 return result; 917 return result;
892} 918}
893EXPORT_SYMBOL(cfg80211_rx_mgmt); 919EXPORT_SYMBOL(cfg80211_rx_mgmt);
@@ -898,6 +924,8 @@ void cfg80211_mgmt_tx_status(struct wireless_dev *wdev, u64 cookie,
898 struct wiphy *wiphy = wdev->wiphy; 924 struct wiphy *wiphy = wdev->wiphy;
899 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 925 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
900 926
927 trace_cfg80211_mgmt_tx_status(wdev, cookie, ack);
928
901 /* Indicate TX status of the Action frame to user space */ 929 /* Indicate TX status of the Action frame to user space */
902 nl80211_send_mgmt_tx_status(rdev, wdev, cookie, buf, len, ack, gfp); 930 nl80211_send_mgmt_tx_status(rdev, wdev, cookie, buf, len, ack, gfp);
903} 931}
@@ -911,6 +939,8 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
911 struct wiphy *wiphy = wdev->wiphy; 939 struct wiphy *wiphy = wdev->wiphy;
912 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 940 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
913 941
942 trace_cfg80211_cqm_rssi_notify(dev, rssi_event);
943
914 /* Indicate roaming trigger event to user space */ 944 /* Indicate roaming trigger event to user space */
915 nl80211_send_cqm_rssi_notify(rdev, dev, rssi_event, gfp); 945 nl80211_send_cqm_rssi_notify(rdev, dev, rssi_event, gfp);
916} 946}
@@ -923,6 +953,8 @@ void cfg80211_cqm_pktloss_notify(struct net_device *dev,
923 struct wiphy *wiphy = wdev->wiphy; 953 struct wiphy *wiphy = wdev->wiphy;
924 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 954 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
925 955
956 trace_cfg80211_cqm_pktloss_notify(dev, peer, num_packets);
957
926 /* Indicate roaming trigger event to user space */ 958 /* Indicate roaming trigger event to user space */
927 nl80211_send_cqm_pktloss_notify(rdev, dev, peer, num_packets, gfp); 959 nl80211_send_cqm_pktloss_notify(rdev, dev, peer, num_packets, gfp);
928} 960}
@@ -948,6 +980,7 @@ void cfg80211_gtk_rekey_notify(struct net_device *dev, const u8 *bssid,
948 struct wiphy *wiphy = wdev->wiphy; 980 struct wiphy *wiphy = wdev->wiphy;
949 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 981 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
950 982
983 trace_cfg80211_gtk_rekey_notify(dev, bssid);
951 nl80211_gtk_rekey_notify(rdev, dev, bssid, replay_ctr, gfp); 984 nl80211_gtk_rekey_notify(rdev, dev, bssid, replay_ctr, gfp);
952} 985}
953EXPORT_SYMBOL(cfg80211_gtk_rekey_notify); 986EXPORT_SYMBOL(cfg80211_gtk_rekey_notify);
@@ -959,6 +992,7 @@ void cfg80211_pmksa_candidate_notify(struct net_device *dev, int index,
959 struct wiphy *wiphy = wdev->wiphy; 992 struct wiphy *wiphy = wdev->wiphy;
960 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 993 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
961 994
995 trace_cfg80211_pmksa_candidate_notify(dev, index, bssid, preauth);
962 nl80211_pmksa_candidate_notify(rdev, dev, index, bssid, preauth, gfp); 996 nl80211_pmksa_candidate_notify(rdev, dev, index, bssid, preauth, gfp);
963} 997}
964EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify); 998EXPORT_SYMBOL(cfg80211_pmksa_candidate_notify);
@@ -971,6 +1005,8 @@ void cfg80211_ch_switch_notify(struct net_device *dev, int freq,
971 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 1005 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
972 struct ieee80211_channel *chan; 1006 struct ieee80211_channel *chan;
973 1007
1008 trace_cfg80211_ch_switch_notify(dev, freq, type);
1009
974 wdev_lock(wdev); 1010 wdev_lock(wdev);
975 1011
976 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP && 1012 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP &&
@@ -993,12 +1029,18 @@ bool cfg80211_rx_spurious_frame(struct net_device *dev,
993 const u8 *addr, gfp_t gfp) 1029 const u8 *addr, gfp_t gfp)
994{ 1030{
995 struct wireless_dev *wdev = dev->ieee80211_ptr; 1031 struct wireless_dev *wdev = dev->ieee80211_ptr;
1032 bool ret;
1033
1034 trace_cfg80211_rx_spurious_frame(dev, addr);
996 1035
997 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP && 1036 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP &&
998 wdev->iftype != NL80211_IFTYPE_P2P_GO)) 1037 wdev->iftype != NL80211_IFTYPE_P2P_GO)) {
1038 trace_cfg80211_return_bool(false);
999 return false; 1039 return false;
1000 1040 }
1001 return nl80211_unexpected_frame(dev, addr, gfp); 1041 ret = nl80211_unexpected_frame(dev, addr, gfp);
1042 trace_cfg80211_return_bool(ret);
1043 return ret;
1002} 1044}
1003EXPORT_SYMBOL(cfg80211_rx_spurious_frame); 1045EXPORT_SYMBOL(cfg80211_rx_spurious_frame);
1004 1046
@@ -1006,12 +1048,18 @@ bool cfg80211_rx_unexpected_4addr_frame(struct net_device *dev,
1006 const u8 *addr, gfp_t gfp) 1048 const u8 *addr, gfp_t gfp)
1007{ 1049{
1008 struct wireless_dev *wdev = dev->ieee80211_ptr; 1050 struct wireless_dev *wdev = dev->ieee80211_ptr;
1051 bool ret;
1052
1053 trace_cfg80211_rx_unexpected_4addr_frame(dev, addr);
1009 1054
1010 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP && 1055 if (WARN_ON(wdev->iftype != NL80211_IFTYPE_AP &&
1011 wdev->iftype != NL80211_IFTYPE_P2P_GO && 1056 wdev->iftype != NL80211_IFTYPE_P2P_GO &&
1012 wdev->iftype != NL80211_IFTYPE_AP_VLAN)) 1057 wdev->iftype != NL80211_IFTYPE_AP_VLAN)) {
1058 trace_cfg80211_return_bool(false);
1013 return false; 1059 return false;
1014 1060 }
1015 return nl80211_unexpected_4addr_frame(dev, addr, gfp); 1061 ret = nl80211_unexpected_4addr_frame(dev, addr, gfp);
1062 trace_cfg80211_return_bool(ret);
1063 return ret;
1016} 1064}
1017EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame); 1065EXPORT_SYMBOL(cfg80211_rx_unexpected_4addr_frame);
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 0418a6d5c1a6..8c0857815a90 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -22,8 +22,8 @@
22#include "core.h" 22#include "core.h"
23#include "nl80211.h" 23#include "nl80211.h"
24#include "reg.h" 24#include "reg.h"
25#include "rdev-ops.h"
25 26
26static bool nl80211_valid_auth_type(enum nl80211_auth_type auth_type);
27static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, 27static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
28 struct genl_info *info, 28 struct genl_info *info,
29 struct cfg80211_crypto_settings *settings, 29 struct cfg80211_crypto_settings *settings,
@@ -355,6 +355,9 @@ static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
355 [NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 }, 355 [NL80211_ATTR_BG_SCAN_PERIOD] = { .type = NLA_U16 },
356 [NL80211_ATTR_WDEV] = { .type = NLA_U64 }, 356 [NL80211_ATTR_WDEV] = { .type = NLA_U64 },
357 [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 }, 357 [NL80211_ATTR_USER_REG_HINT_TYPE] = { .type = NLA_U32 },
358 [NL80211_ATTR_SAE_DATA] = { .type = NLA_BINARY, },
359 [NL80211_ATTR_VHT_CAPABILITY] = { .len = NL80211_VHT_CAPABILITY_LEN },
360 [NL80211_ATTR_SCAN_FLAGS] = { .type = NLA_U32 },
358}; 361};
359 362
360/* policy for the key attributes */ 363/* policy for the key attributes */
@@ -690,7 +693,7 @@ static int nl80211_parse_key(struct genl_info *info, struct key_parse *k)
690 693
691static struct cfg80211_cached_keys * 694static struct cfg80211_cached_keys *
692nl80211_parse_connkeys(struct cfg80211_registered_device *rdev, 695nl80211_parse_connkeys(struct cfg80211_registered_device *rdev,
693 struct nlattr *keys) 696 struct nlattr *keys, bool *no_ht)
694{ 697{
695 struct key_parse parse; 698 struct key_parse parse;
696 struct nlattr *key; 699 struct nlattr *key;
@@ -733,6 +736,12 @@ nl80211_parse_connkeys(struct cfg80211_registered_device *rdev,
733 result->params[parse.idx].key_len = parse.p.key_len; 736 result->params[parse.idx].key_len = parse.p.key_len;
734 result->params[parse.idx].key = result->data[parse.idx]; 737 result->params[parse.idx].key = result->data[parse.idx];
735 memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len); 738 memcpy(result->data[parse.idx], parse.p.key, parse.p.key_len);
739
740 if (parse.p.cipher == WLAN_CIPHER_SUITE_WEP40 ||
741 parse.p.cipher == WLAN_CIPHER_SUITE_WEP104) {
742 if (no_ht)
743 *no_ht = true;
744 }
736 } 745 }
737 746
738 return result; 747 return result;
@@ -943,7 +952,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag
943 dev->wiphy.available_antennas_rx) && dev->ops->get_antenna) { 952 dev->wiphy.available_antennas_rx) && dev->ops->get_antenna) {
944 u32 tx_ant = 0, rx_ant = 0; 953 u32 tx_ant = 0, rx_ant = 0;
945 int res; 954 int res;
946 res = dev->ops->get_antenna(&dev->wiphy, &tx_ant, &rx_ant); 955 res = rdev_get_antenna(dev, &tx_ant, &rx_ant);
947 if (!res) { 956 if (!res) {
948 if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, 957 if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX,
949 tx_ant) || 958 tx_ant) ||
@@ -1457,7 +1466,7 @@ static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info)
1457 return -EOPNOTSUPP; 1466 return -EOPNOTSUPP;
1458 1467
1459 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); 1468 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
1460 return rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); 1469 return rdev_set_wds_peer(rdev, dev, bssid);
1461} 1470}
1462 1471
1463 1472
@@ -1562,9 +1571,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1562 if (result) 1571 if (result)
1563 goto bad_res; 1572 goto bad_res;
1564 1573
1565 result = rdev->ops->set_txq_params(&rdev->wiphy, 1574 result = rdev_set_txq_params(rdev, netdev,
1566 netdev, 1575 &txq_params);
1567 &txq_params);
1568 if (result) 1576 if (result)
1569 goto bad_res; 1577 goto bad_res;
1570 } 1578 }
@@ -1599,7 +1607,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1599 mbm = nla_get_u32(info->attrs[idx]); 1607 mbm = nla_get_u32(info->attrs[idx]);
1600 } 1608 }
1601 1609
1602 result = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm); 1610 result = rdev_set_tx_power(rdev, type, mbm);
1603 if (result) 1611 if (result)
1604 goto bad_res; 1612 goto bad_res;
1605 } 1613 }
@@ -1628,7 +1636,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1628 tx_ant = tx_ant & rdev->wiphy.available_antennas_tx; 1636 tx_ant = tx_ant & rdev->wiphy.available_antennas_tx;
1629 rx_ant = rx_ant & rdev->wiphy.available_antennas_rx; 1637 rx_ant = rx_ant & rdev->wiphy.available_antennas_rx;
1630 1638
1631 result = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant); 1639 result = rdev_set_antenna(rdev, tx_ant, rx_ant);
1632 if (result) 1640 if (result)
1633 goto bad_res; 1641 goto bad_res;
1634 } 1642 }
@@ -1713,7 +1721,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1713 if (changed & WIPHY_PARAM_COVERAGE_CLASS) 1721 if (changed & WIPHY_PARAM_COVERAGE_CLASS)
1714 rdev->wiphy.coverage_class = coverage_class; 1722 rdev->wiphy.coverage_class = coverage_class;
1715 1723
1716 result = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); 1724 result = rdev_set_wiphy_params(rdev, changed);
1717 if (result) { 1725 if (result) {
1718 rdev->wiphy.retry_short = old_retry_short; 1726 rdev->wiphy.retry_short = old_retry_short;
1719 rdev->wiphy.retry_long = old_retry_long; 1727 rdev->wiphy.retry_long = old_retry_long;
@@ -1765,8 +1773,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
1765 struct ieee80211_channel *chan; 1773 struct ieee80211_channel *chan;
1766 enum nl80211_channel_type channel_type; 1774 enum nl80211_channel_type channel_type;
1767 1775
1768 chan = rdev->ops->get_channel(&rdev->wiphy, wdev, 1776 chan = rdev_get_channel(rdev, wdev, &channel_type);
1769 &channel_type);
1770 if (chan && 1777 if (chan &&
1771 (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, 1778 (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
1772 chan->center_freq) || 1779 chan->center_freq) ||
@@ -2014,9 +2021,9 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
2014 err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? 2021 err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ?
2015 info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, 2022 info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL,
2016 &flags); 2023 &flags);
2017 wdev = rdev->ops->add_virtual_intf(&rdev->wiphy, 2024 wdev = rdev_add_virtual_intf(rdev,
2018 nla_data(info->attrs[NL80211_ATTR_IFNAME]), 2025 nla_data(info->attrs[NL80211_ATTR_IFNAME]),
2019 type, err ? NULL : &flags, &params); 2026 type, err ? NULL : &flags, &params);
2020 if (IS_ERR(wdev)) { 2027 if (IS_ERR(wdev)) {
2021 nlmsg_free(msg); 2028 nlmsg_free(msg);
2022 return PTR_ERR(wdev); 2029 return PTR_ERR(wdev);
@@ -2083,7 +2090,7 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
2083 if (!wdev->netdev) 2090 if (!wdev->netdev)
2084 info->user_ptr[1] = NULL; 2091 info->user_ptr[1] = NULL;
2085 2092
2086 return rdev->ops->del_virtual_intf(&rdev->wiphy, wdev); 2093 return rdev_del_virtual_intf(rdev, wdev);
2087} 2094}
2088 2095
2089static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info) 2096static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info)
@@ -2100,7 +2107,7 @@ static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info)
2100 2107
2101 noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]); 2108 noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]);
2102 2109
2103 return rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map); 2110 return rdev_set_noack_map(rdev, dev, noack_map);
2104} 2111}
2105 2112
2106struct get_key_cookie { 2113struct get_key_cookie {
@@ -2210,8 +2217,8 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
2210 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) 2217 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
2211 return -ENOENT; 2218 return -ENOENT;
2212 2219
2213 err = rdev->ops->get_key(&rdev->wiphy, dev, key_idx, pairwise, 2220 err = rdev_get_key(rdev, dev, key_idx, pairwise, mac_addr, &cookie,
2214 mac_addr, &cookie, get_key_callback); 2221 get_key_callback);
2215 2222
2216 if (err) 2223 if (err)
2217 goto free_msg; 2224 goto free_msg;
@@ -2259,7 +2266,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
2259 if (err) 2266 if (err)
2260 goto out; 2267 goto out;
2261 2268
2262 err = rdev->ops->set_default_key(&rdev->wiphy, dev, key.idx, 2269 err = rdev_set_default_key(rdev, dev, key.idx,
2263 key.def_uni, key.def_multi); 2270 key.def_uni, key.def_multi);
2264 2271
2265 if (err) 2272 if (err)
@@ -2283,8 +2290,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
2283 if (err) 2290 if (err)
2284 goto out; 2291 goto out;
2285 2292
2286 err = rdev->ops->set_default_mgmt_key(&rdev->wiphy, 2293 err = rdev_set_default_mgmt_key(rdev, dev, key.idx);
2287 dev, key.idx);
2288 if (err) 2294 if (err)
2289 goto out; 2295 goto out;
2290 2296
@@ -2340,9 +2346,9 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
2340 wdev_lock(dev->ieee80211_ptr); 2346 wdev_lock(dev->ieee80211_ptr);
2341 err = nl80211_key_allowed(dev->ieee80211_ptr); 2347 err = nl80211_key_allowed(dev->ieee80211_ptr);
2342 if (!err) 2348 if (!err)
2343 err = rdev->ops->add_key(&rdev->wiphy, dev, key.idx, 2349 err = rdev_add_key(rdev, dev, key.idx,
2344 key.type == NL80211_KEYTYPE_PAIRWISE, 2350 key.type == NL80211_KEYTYPE_PAIRWISE,
2345 mac_addr, &key.p); 2351 mac_addr, &key.p);
2346 wdev_unlock(dev->ieee80211_ptr); 2352 wdev_unlock(dev->ieee80211_ptr);
2347 2353
2348 return err; 2354 return err;
@@ -2386,9 +2392,9 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
2386 err = -ENOENT; 2392 err = -ENOENT;
2387 2393
2388 if (!err) 2394 if (!err)
2389 err = rdev->ops->del_key(&rdev->wiphy, dev, key.idx, 2395 err = rdev_del_key(rdev, dev, key.idx,
2390 key.type == NL80211_KEYTYPE_PAIRWISE, 2396 key.type == NL80211_KEYTYPE_PAIRWISE,
2391 mac_addr); 2397 mac_addr);
2392 2398
2393#ifdef CONFIG_CFG80211_WEXT 2399#ifdef CONFIG_CFG80211_WEXT
2394 if (!err) { 2400 if (!err) {
@@ -2490,6 +2496,30 @@ static bool nl80211_get_ap_channel(struct cfg80211_registered_device *rdev,
2490 return ret; 2496 return ret;
2491} 2497}
2492 2498
2499static bool nl80211_valid_auth_type(struct cfg80211_registered_device *rdev,
2500 enum nl80211_auth_type auth_type,
2501 enum nl80211_commands cmd)
2502{
2503 if (auth_type > NL80211_AUTHTYPE_MAX)
2504 return false;
2505
2506 switch (cmd) {
2507 case NL80211_CMD_AUTHENTICATE:
2508 if (!(rdev->wiphy.features & NL80211_FEATURE_SAE) &&
2509 auth_type == NL80211_AUTHTYPE_SAE)
2510 return false;
2511 return true;
2512 case NL80211_CMD_CONNECT:
2513 case NL80211_CMD_START_AP:
2514 /* SAE not supported yet */
2515 if (auth_type == NL80211_AUTHTYPE_SAE)
2516 return false;
2517 return true;
2518 default:
2519 return false;
2520 }
2521}
2522
2493static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) 2523static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
2494{ 2524{
2495 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 2525 struct cfg80211_registered_device *rdev = info->user_ptr[0];
@@ -2559,7 +2589,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
2559 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { 2589 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
2560 params.auth_type = nla_get_u32( 2590 params.auth_type = nla_get_u32(
2561 info->attrs[NL80211_ATTR_AUTH_TYPE]); 2591 info->attrs[NL80211_ATTR_AUTH_TYPE]);
2562 if (!nl80211_valid_auth_type(params.auth_type)) 2592 if (!nl80211_valid_auth_type(rdev, params.auth_type,
2593 NL80211_CMD_START_AP))
2563 return -EINVAL; 2594 return -EINVAL;
2564 } else 2595 } else
2565 params.auth_type = NL80211_AUTHTYPE_AUTOMATIC; 2596 params.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
@@ -2607,7 +2638,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
2607 if (err) 2638 if (err)
2608 return err; 2639 return err;
2609 2640
2610 err = rdev->ops->start_ap(&rdev->wiphy, dev, &params); 2641 err = rdev_start_ap(rdev, dev, &params);
2611 if (!err) { 2642 if (!err) {
2612 wdev->preset_chan = params.channel; 2643 wdev->preset_chan = params.channel;
2613 wdev->preset_chantype = params.channel_type; 2644 wdev->preset_chantype = params.channel_type;
@@ -2639,7 +2670,7 @@ static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info)
2639 if (err) 2670 if (err)
2640 return err; 2671 return err;
2641 2672
2642 return rdev->ops->change_beacon(&rdev->wiphy, dev, &params); 2673 return rdev_change_beacon(rdev, dev, &params);
2643} 2674}
2644 2675
2645static int nl80211_stop_ap(struct sk_buff *skb, struct genl_info *info) 2676static int nl80211_stop_ap(struct sk_buff *skb, struct genl_info *info)
@@ -2923,8 +2954,8 @@ static int nl80211_dump_station(struct sk_buff *skb,
2923 2954
2924 while (1) { 2955 while (1) {
2925 memset(&sinfo, 0, sizeof(sinfo)); 2956 memset(&sinfo, 0, sizeof(sinfo));
2926 err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx, 2957 err = rdev_dump_station(dev, netdev, sta_idx,
2927 mac_addr, &sinfo); 2958 mac_addr, &sinfo);
2928 if (err == -ENOENT) 2959 if (err == -ENOENT)
2929 break; 2960 break;
2930 if (err) 2961 if (err)
@@ -2969,7 +3000,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
2969 if (!rdev->ops->get_station) 3000 if (!rdev->ops->get_station)
2970 return -EOPNOTSUPP; 3001 return -EOPNOTSUPP;
2971 3002
2972 err = rdev->ops->get_station(&rdev->wiphy, dev, mac_addr, &sinfo); 3003 err = rdev_get_station(rdev, dev, mac_addr, &sinfo);
2973 if (err) 3004 if (err)
2974 return err; 3005 return err;
2975 3006
@@ -3146,7 +3177,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
3146 3177
3147 /* be aware of params.vlan when changing code here */ 3178 /* be aware of params.vlan when changing code here */
3148 3179
3149 err = rdev->ops->change_station(&rdev->wiphy, dev, mac_addr, &params); 3180 err = rdev_change_station(rdev, dev, mac_addr, &params);
3150 3181
3151 if (params.vlan) 3182 if (params.vlan)
3152 dev_put(params.vlan); 3183 dev_put(params.vlan);
@@ -3198,6 +3229,10 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
3198 params.ht_capa = 3229 params.ht_capa =
3199 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); 3230 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]);
3200 3231
3232 if (info->attrs[NL80211_ATTR_VHT_CAPABILITY])
3233 params.vht_capa =
3234 nla_data(info->attrs[NL80211_ATTR_VHT_CAPABILITY]);
3235
3201 if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) 3236 if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION])
3202 params.plink_action = 3237 params.plink_action =
3203 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]); 3238 nla_get_u8(info->attrs[NL80211_ATTR_STA_PLINK_ACTION]);
@@ -3275,7 +3310,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
3275 3310
3276 /* be aware of params.vlan when changing code here */ 3311 /* be aware of params.vlan when changing code here */
3277 3312
3278 err = rdev->ops->add_station(&rdev->wiphy, dev, mac_addr, &params); 3313 err = rdev_add_station(rdev, dev, mac_addr, &params);
3279 3314
3280 if (params.vlan) 3315 if (params.vlan)
3281 dev_put(params.vlan); 3316 dev_put(params.vlan);
@@ -3300,7 +3335,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
3300 if (!rdev->ops->del_station) 3335 if (!rdev->ops->del_station)
3301 return -EOPNOTSUPP; 3336 return -EOPNOTSUPP;
3302 3337
3303 return rdev->ops->del_station(&rdev->wiphy, dev, mac_addr); 3338 return rdev_del_station(rdev, dev, mac_addr);
3304} 3339}
3305 3340
3306static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq, 3341static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq,
@@ -3382,8 +3417,8 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
3382 } 3417 }
3383 3418
3384 while (1) { 3419 while (1) {
3385 err = dev->ops->dump_mpath(&dev->wiphy, netdev, path_idx, 3420 err = rdev_dump_mpath(dev, netdev, path_idx, dst, next_hop,
3386 dst, next_hop, &pinfo); 3421 &pinfo);
3387 if (err == -ENOENT) 3422 if (err == -ENOENT)
3388 break; 3423 break;
3389 if (err) 3424 if (err)
@@ -3430,7 +3465,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
3430 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 3465 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
3431 return -EOPNOTSUPP; 3466 return -EOPNOTSUPP;
3432 3467
3433 err = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, &pinfo); 3468 err = rdev_get_mpath(rdev, dev, dst, next_hop, &pinfo);
3434 if (err) 3469 if (err)
3435 return err; 3470 return err;
3436 3471
@@ -3469,7 +3504,7 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
3469 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 3504 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
3470 return -EOPNOTSUPP; 3505 return -EOPNOTSUPP;
3471 3506
3472 return rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop); 3507 return rdev_change_mpath(rdev, dev, dst, next_hop);
3473} 3508}
3474 3509
3475static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info) 3510static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
@@ -3494,7 +3529,7 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
3494 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 3529 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
3495 return -EOPNOTSUPP; 3530 return -EOPNOTSUPP;
3496 3531
3497 return rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop); 3532 return rdev_add_mpath(rdev, dev, dst, next_hop);
3498} 3533}
3499 3534
3500static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info) 3535static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
@@ -3509,7 +3544,7 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
3509 if (!rdev->ops->del_mpath) 3544 if (!rdev->ops->del_mpath)
3510 return -EOPNOTSUPP; 3545 return -EOPNOTSUPP;
3511 3546
3512 return rdev->ops->del_mpath(&rdev->wiphy, dev, dst); 3547 return rdev_del_mpath(rdev, dev, dst);
3513} 3548}
3514 3549
3515static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info) 3550static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
@@ -3554,7 +3589,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
3554 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 3589 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
3555 return -EOPNOTSUPP; 3590 return -EOPNOTSUPP;
3556 3591
3557 return rdev->ops->change_bss(&rdev->wiphy, dev, &params); 3592 return rdev_change_bss(rdev, dev, &params);
3558} 3593}
3559 3594
3560static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = { 3595static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = {
@@ -3668,8 +3703,7 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
3668 if (!wdev->mesh_id_len) 3703 if (!wdev->mesh_id_len)
3669 memcpy(&cur_params, &default_mesh_config, sizeof(cur_params)); 3704 memcpy(&cur_params, &default_mesh_config, sizeof(cur_params));
3670 else 3705 else
3671 err = rdev->ops->get_mesh_config(&rdev->wiphy, dev, 3706 err = rdev_get_mesh_config(rdev, dev, &cur_params);
3672 &cur_params);
3673 wdev_unlock(wdev); 3707 wdev_unlock(wdev);
3674 3708
3675 if (err) 3709 if (err)
@@ -3971,8 +4005,7 @@ static int nl80211_update_mesh_config(struct sk_buff *skb,
3971 err = -ENOLINK; 4005 err = -ENOLINK;
3972 4006
3973 if (!err) 4007 if (!err)
3974 err = rdev->ops->update_mesh_config(&rdev->wiphy, dev, 4008 err = rdev_update_mesh_config(rdev, dev, mask, &cfg);
3975 mask, &cfg);
3976 4009
3977 wdev_unlock(wdev); 4010 wdev_unlock(wdev);
3978 4011
@@ -4337,14 +4370,27 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4337 } 4370 }
4338 } 4371 }
4339 4372
4373 if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) {
4374 request->flags = nla_get_u32(
4375 info->attrs[NL80211_ATTR_SCAN_FLAGS]);
4376 if (((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
4377 !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) ||
4378 ((request->flags & NL80211_SCAN_FLAG_FLUSH) &&
4379 !(wiphy->features & NL80211_FEATURE_SCAN_FLUSH))) {
4380 err = -EOPNOTSUPP;
4381 goto out_free;
4382 }
4383 }
4384
4340 request->no_cck = 4385 request->no_cck =
4341 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); 4386 nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]);
4342 4387
4343 request->wdev = wdev; 4388 request->wdev = wdev;
4344 request->wiphy = &rdev->wiphy; 4389 request->wiphy = &rdev->wiphy;
4390 request->scan_start = jiffies;
4345 4391
4346 rdev->scan_req = request; 4392 rdev->scan_req = request;
4347 err = rdev->ops->scan(&rdev->wiphy, request); 4393 err = rdev_scan(rdev, request);
4348 4394
4349 if (!err) { 4395 if (!err) {
4350 nl80211_send_scan_start(rdev, wdev); 4396 nl80211_send_scan_start(rdev, wdev);
@@ -4568,11 +4614,24 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
4568 request->ie_len); 4614 request->ie_len);
4569 } 4615 }
4570 4616
4617 if (info->attrs[NL80211_ATTR_SCAN_FLAGS]) {
4618 request->flags = nla_get_u32(
4619 info->attrs[NL80211_ATTR_SCAN_FLAGS]);
4620 if (((request->flags & NL80211_SCAN_FLAG_LOW_PRIORITY) &&
4621 !(wiphy->features & NL80211_FEATURE_LOW_PRIORITY_SCAN)) ||
4622 ((request->flags & NL80211_SCAN_FLAG_FLUSH) &&
4623 !(wiphy->features & NL80211_FEATURE_SCAN_FLUSH))) {
4624 err = -EOPNOTSUPP;
4625 goto out_free;
4626 }
4627 }
4628
4571 request->dev = dev; 4629 request->dev = dev;
4572 request->wiphy = &rdev->wiphy; 4630 request->wiphy = &rdev->wiphy;
4573 request->interval = interval; 4631 request->interval = interval;
4632 request->scan_start = jiffies;
4574 4633
4575 err = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request); 4634 err = rdev_sched_scan_start(rdev, dev, request);
4576 if (!err) { 4635 if (!err) {
4577 rdev->sched_scan_req = request; 4636 rdev->sched_scan_req = request;
4578 nl80211_send_sched_scan(rdev, dev, 4637 nl80211_send_sched_scan(rdev, dev,
@@ -4815,8 +4874,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
4815 while (1) { 4874 while (1) {
4816 struct ieee80211_channel *chan; 4875 struct ieee80211_channel *chan;
4817 4876
4818 res = dev->ops->dump_survey(&dev->wiphy, netdev, survey_idx, 4877 res = rdev_dump_survey(dev, netdev, survey_idx, &survey);
4819 &survey);
4820 if (res == -ENOENT) 4878 if (res == -ENOENT)
4821 break; 4879 break;
4822 if (res) 4880 if (res)
@@ -4852,11 +4910,6 @@ static int nl80211_dump_survey(struct sk_buff *skb,
4852 return res; 4910 return res;
4853} 4911}
4854 4912
4855static bool nl80211_valid_auth_type(enum nl80211_auth_type auth_type)
4856{
4857 return auth_type <= NL80211_AUTHTYPE_MAX;
4858}
4859
4860static bool nl80211_valid_wpa_versions(u32 wpa_versions) 4913static bool nl80211_valid_wpa_versions(u32 wpa_versions)
4861{ 4914{
4862 return !(wpa_versions & ~(NL80211_WPA_VERSION_1 | 4915 return !(wpa_versions & ~(NL80211_WPA_VERSION_1 |
@@ -4868,8 +4921,8 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
4868 struct cfg80211_registered_device *rdev = info->user_ptr[0]; 4921 struct cfg80211_registered_device *rdev = info->user_ptr[0];
4869 struct net_device *dev = info->user_ptr[1]; 4922 struct net_device *dev = info->user_ptr[1];
4870 struct ieee80211_channel *chan; 4923 struct ieee80211_channel *chan;
4871 const u8 *bssid, *ssid, *ie = NULL; 4924 const u8 *bssid, *ssid, *ie = NULL, *sae_data = NULL;
4872 int err, ssid_len, ie_len = 0; 4925 int err, ssid_len, ie_len = 0, sae_data_len = 0;
4873 enum nl80211_auth_type auth_type; 4926 enum nl80211_auth_type auth_type;
4874 struct key_parse key; 4927 struct key_parse key;
4875 bool local_state_change; 4928 bool local_state_change;
@@ -4945,9 +4998,23 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
4945 } 4998 }
4946 4999
4947 auth_type = nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); 5000 auth_type = nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]);
4948 if (!nl80211_valid_auth_type(auth_type)) 5001 if (!nl80211_valid_auth_type(rdev, auth_type, NL80211_CMD_AUTHENTICATE))
4949 return -EINVAL; 5002 return -EINVAL;
4950 5003
5004 if (auth_type == NL80211_AUTHTYPE_SAE &&
5005 !info->attrs[NL80211_ATTR_SAE_DATA])
5006 return -EINVAL;
5007
5008 if (info->attrs[NL80211_ATTR_SAE_DATA]) {
5009 if (auth_type != NL80211_AUTHTYPE_SAE)
5010 return -EINVAL;
5011 sae_data = nla_data(info->attrs[NL80211_ATTR_SAE_DATA]);
5012 sae_data_len = nla_len(info->attrs[NL80211_ATTR_SAE_DATA]);
5013 /* need to include at least Auth Transaction and Status Code */
5014 if (sae_data_len < 4)
5015 return -EINVAL;
5016 }
5017
4951 local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE]; 5018 local_state_change = !!info->attrs[NL80211_ATTR_LOCAL_STATE_CHANGE];
4952 5019
4953 /* 5020 /*
@@ -4959,7 +5026,8 @@ static int nl80211_authenticate(struct sk_buff *skb, struct genl_info *info)
4959 5026
4960 return cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid, 5027 return cfg80211_mlme_auth(rdev, dev, chan, auth_type, bssid,
4961 ssid, ssid_len, ie, ie_len, 5028 ssid, ssid_len, ie, ie_len,
4962 key.p.key, key.p.key_len, key.idx); 5029 key.p.key, key.p.key_len, key.idx,
5030 sae_data, sae_data_len);
4963} 5031}
4964 5032
4965static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, 5033static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
@@ -5339,10 +5407,18 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info)
5339 return -EINVAL; 5407 return -EINVAL;
5340 5408
5341 if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) { 5409 if (ibss.privacy && info->attrs[NL80211_ATTR_KEYS]) {
5410 bool no_ht = false;
5411
5342 connkeys = nl80211_parse_connkeys(rdev, 5412 connkeys = nl80211_parse_connkeys(rdev,
5343 info->attrs[NL80211_ATTR_KEYS]); 5413 info->attrs[NL80211_ATTR_KEYS],
5414 &no_ht);
5344 if (IS_ERR(connkeys)) 5415 if (IS_ERR(connkeys))
5345 return PTR_ERR(connkeys); 5416 return PTR_ERR(connkeys);
5417
5418 if ((ibss.channel_type != NL80211_CHAN_NO_HT) && no_ht) {
5419 kfree(connkeys);
5420 return -EINVAL;
5421 }
5346 } 5422 }
5347 5423
5348 ibss.control_port = 5424 ibss.control_port =
@@ -5384,7 +5460,7 @@ static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info)
5384 err = -EOPNOTSUPP; 5460 err = -EOPNOTSUPP;
5385 if (rdev->ops->testmode_cmd) { 5461 if (rdev->ops->testmode_cmd) {
5386 rdev->testmode_info = info; 5462 rdev->testmode_info = info;
5387 err = rdev->ops->testmode_cmd(&rdev->wiphy, 5463 err = rdev_testmode_cmd(rdev,
5388 nla_data(info->attrs[NL80211_ATTR_TESTDATA]), 5464 nla_data(info->attrs[NL80211_ATTR_TESTDATA]),
5389 nla_len(info->attrs[NL80211_ATTR_TESTDATA])); 5465 nla_len(info->attrs[NL80211_ATTR_TESTDATA]));
5390 rdev->testmode_info = NULL; 5466 rdev->testmode_info = NULL;
@@ -5466,8 +5542,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
5466 genlmsg_cancel(skb, hdr); 5542 genlmsg_cancel(skb, hdr);
5467 break; 5543 break;
5468 } 5544 }
5469 err = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, 5545 err = rdev_testmode_dump(rdev, skb, cb, data, data_len);
5470 data, data_len);
5471 nla_nest_end(skb, tmdata); 5546 nla_nest_end(skb, tmdata);
5472 5547
5473 if (err == -ENOBUFS || err == -ENOENT) { 5548 if (err == -ENOBUFS || err == -ENOENT) {
@@ -5596,7 +5671,8 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
5596 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) { 5671 if (info->attrs[NL80211_ATTR_AUTH_TYPE]) {
5597 connect.auth_type = 5672 connect.auth_type =
5598 nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]); 5673 nla_get_u32(info->attrs[NL80211_ATTR_AUTH_TYPE]);
5599 if (!nl80211_valid_auth_type(connect.auth_type)) 5674 if (!nl80211_valid_auth_type(rdev, connect.auth_type,
5675 NL80211_CMD_CONNECT))
5600 return -EINVAL; 5676 return -EINVAL;
5601 } else 5677 } else
5602 connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; 5678 connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
@@ -5642,7 +5718,7 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
5642 5718
5643 if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) { 5719 if (connect.privacy && info->attrs[NL80211_ATTR_KEYS]) {
5644 connkeys = nl80211_parse_connkeys(rdev, 5720 connkeys = nl80211_parse_connkeys(rdev,
5645 info->attrs[NL80211_ATTR_KEYS]); 5721 info->attrs[NL80211_ATTR_KEYS], NULL);
5646 if (IS_ERR(connkeys)) 5722 if (IS_ERR(connkeys))
5647 return PTR_ERR(connkeys); 5723 return PTR_ERR(connkeys);
5648 } 5724 }
@@ -5771,7 +5847,7 @@ static int nl80211_flush_pmksa(struct sk_buff *skb, struct genl_info *info)
5771 if (!rdev->ops->flush_pmksa) 5847 if (!rdev->ops->flush_pmksa)
5772 return -EOPNOTSUPP; 5848 return -EOPNOTSUPP;
5773 5849
5774 return rdev->ops->flush_pmksa(&rdev->wiphy, dev); 5850 return rdev_flush_pmksa(rdev, dev);
5775} 5851}
5776 5852
5777static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info) 5853static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
@@ -5798,10 +5874,10 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
5798 status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); 5874 status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]);
5799 dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]); 5875 dialog_token = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_DIALOG_TOKEN]);
5800 5876
5801 return rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code, 5877 return rdev_tdls_mgmt(rdev, dev, peer, action_code,
5802 dialog_token, status_code, 5878 dialog_token, status_code,
5803 nla_data(info->attrs[NL80211_ATTR_IE]), 5879 nla_data(info->attrs[NL80211_ATTR_IE]),
5804 nla_len(info->attrs[NL80211_ATTR_IE])); 5880 nla_len(info->attrs[NL80211_ATTR_IE]));
5805} 5881}
5806 5882
5807static int nl80211_tdls_oper(struct sk_buff *skb, struct genl_info *info) 5883static int nl80211_tdls_oper(struct sk_buff *skb, struct genl_info *info)
@@ -5822,7 +5898,7 @@ static int nl80211_tdls_oper(struct sk_buff *skb, struct genl_info *info)
5822 operation = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_OPERATION]); 5898 operation = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_OPERATION]);
5823 peer = nla_data(info->attrs[NL80211_ATTR_MAC]); 5899 peer = nla_data(info->attrs[NL80211_ATTR_MAC]);
5824 5900
5825 return rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, operation); 5901 return rdev_tdls_oper(rdev, dev, peer, operation);
5826} 5902}
5827 5903
5828static int nl80211_remain_on_channel(struct sk_buff *skb, 5904static int nl80211_remain_on_channel(struct sk_buff *skb,
@@ -5877,8 +5953,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5877 goto free_msg; 5953 goto free_msg;
5878 } 5954 }
5879 5955
5880 err = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan, 5956 err = rdev_remain_on_channel(rdev, wdev, chan, channel_type, duration,
5881 channel_type, duration, &cookie); 5957 &cookie);
5882 5958
5883 if (err) 5959 if (err)
5884 goto free_msg; 5960 goto free_msg;
@@ -5912,7 +5988,7 @@ static int nl80211_cancel_remain_on_channel(struct sk_buff *skb,
5912 5988
5913 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); 5989 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
5914 5990
5915 return rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie); 5991 return rdev_cancel_remain_on_channel(rdev, wdev, cookie);
5916} 5992}
5917 5993
5918static u32 rateset_to_mask(struct ieee80211_supported_band *sband, 5994static u32 rateset_to_mask(struct ieee80211_supported_band *sband,
@@ -6055,7 +6131,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
6055 } 6131 }
6056 } 6132 }
6057 6133
6058 return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, NULL, &mask); 6134 return rdev_set_bitrate_mask(rdev, dev, NULL, &mask);
6059} 6135}
6060 6136
6061static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) 6137static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
@@ -6230,7 +6306,7 @@ static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *in
6230 6306
6231 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); 6307 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
6232 6308
6233 return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie); 6309 return rdev_mgmt_tx_cancel_wait(rdev, wdev, cookie);
6234} 6310}
6235 6311
6236static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info) 6312static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info)
@@ -6260,8 +6336,7 @@ static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info)
6260 if (state == wdev->ps) 6336 if (state == wdev->ps)
6261 return 0; 6337 return 0;
6262 6338
6263 err = rdev->ops->set_power_mgmt(wdev->wiphy, dev, state, 6339 err = rdev_set_power_mgmt(rdev, dev, state, wdev->ps_timeout);
6264 wdev->ps_timeout);
6265 if (!err) 6340 if (!err)
6266 wdev->ps = state; 6341 wdev->ps = state;
6267 return err; 6342 return err;
@@ -6341,8 +6416,7 @@ static int nl80211_set_cqm_txe(struct genl_info *info,
6341 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) 6416 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
6342 return -EOPNOTSUPP; 6417 return -EOPNOTSUPP;
6343 6418
6344 return rdev->ops->set_cqm_txe_config(wdev->wiphy, dev, 6419 return rdev_set_cqm_txe_config(rdev, dev, rate, pkts, intvl);
6345 rate, pkts, intvl);
6346} 6420}
6347 6421
6348static int nl80211_set_cqm_rssi(struct genl_info *info, 6422static int nl80211_set_cqm_rssi(struct genl_info *info,
@@ -6364,8 +6438,7 @@ static int nl80211_set_cqm_rssi(struct genl_info *info,
6364 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) 6438 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
6365 return -EOPNOTSUPP; 6439 return -EOPNOTSUPP;
6366 6440
6367 return rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, 6441 return rdev_set_cqm_rssi_config(rdev, dev, threshold, hysteresis);
6368 threshold, hysteresis);
6369} 6442}
6370 6443
6371static int nl80211_set_cqm(struct sk_buff *skb, struct genl_info *info) 6444static int nl80211_set_cqm(struct sk_buff *skb, struct genl_info *info)
@@ -6690,7 +6763,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
6690 6763
6691 set_wakeup: 6764 set_wakeup:
6692 if (rdev->ops->set_wakeup && prev_enabled != !!rdev->wowlan) 6765 if (rdev->ops->set_wakeup && prev_enabled != !!rdev->wowlan)
6693 rdev->ops->set_wakeup(&rdev->wiphy, rdev->wowlan); 6766 rdev_set_wakeup(rdev, rdev->wowlan);
6694 6767
6695 return 0; 6768 return 0;
6696 error: 6769 error:
@@ -6746,7 +6819,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
6746 goto out; 6819 goto out;
6747 } 6820 }
6748 6821
6749 err = rdev->ops->set_rekey_data(&rdev->wiphy, dev, &rekey_data); 6822 err = rdev_set_rekey_data(rdev, dev, &rekey_data);
6750 out: 6823 out:
6751 wdev_unlock(wdev); 6824 wdev_unlock(wdev);
6752 return err; 6825 return err;
@@ -6805,7 +6878,7 @@ static int nl80211_probe_client(struct sk_buff *skb,
6805 6878
6806 addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 6879 addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
6807 6880
6808 err = rdev->ops->probe_client(&rdev->wiphy, dev, addr, &cookie); 6881 err = rdev_probe_client(rdev, dev, addr, &cookie);
6809 if (err) 6882 if (err)
6810 goto free_msg; 6883 goto free_msg;
6811 6884
@@ -6859,7 +6932,7 @@ static int nl80211_start_p2p_device(struct sk_buff *skb, struct genl_info *info)
6859 if (err) 6932 if (err)
6860 return err; 6933 return err;
6861 6934
6862 err = rdev->ops->start_p2p_device(&rdev->wiphy, wdev); 6935 err = rdev_start_p2p_device(rdev, wdev);
6863 if (err) 6936 if (err)
6864 return err; 6937 return err;
6865 6938
@@ -6885,7 +6958,7 @@ static int nl80211_stop_p2p_device(struct sk_buff *skb, struct genl_info *info)
6885 if (!wdev->p2p_started) 6958 if (!wdev->p2p_started)
6886 return 0; 6959 return 0;
6887 6960
6888 rdev->ops->stop_p2p_device(&rdev->wiphy, wdev); 6961 rdev_stop_p2p_device(rdev, wdev);
6889 wdev->p2p_started = false; 6962 wdev->p2p_started = false;
6890 6963
6891 mutex_lock(&rdev->devlist_mtx); 6964 mutex_lock(&rdev->devlist_mtx);
@@ -7622,6 +7695,9 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
7622 nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie)) 7695 nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie))
7623 goto nla_put_failure; 7696 goto nla_put_failure;
7624 7697
7698 if (req->flags)
7699 nla_put_u32(msg, NL80211_ATTR_SCAN_FLAGS, req->flags);
7700
7625 return 0; 7701 return 0;
7626 nla_put_failure: 7702 nla_put_failure:
7627 return -ENOBUFS; 7703 return -ENOBUFS;
@@ -8800,7 +8876,10 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
8800 void *hdr; 8876 void *hdr;
8801 int err; 8877 int err;
8802 8878
8879 trace_cfg80211_probe_status(dev, addr, cookie, acked);
8880
8803 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp); 8881 msg = nlmsg_new(NLMSG_DEFAULT_SIZE, gfp);
8882
8804 if (!msg) 8883 if (!msg)
8805 return; 8884 return;
8806 8885
@@ -8842,6 +8921,8 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
8842 void *hdr; 8921 void *hdr;
8843 u32 nlportid = ACCESS_ONCE(rdev->ap_beacons_nlportid); 8922 u32 nlportid = ACCESS_ONCE(rdev->ap_beacons_nlportid);
8844 8923
8924 trace_cfg80211_report_obss_beacon(wiphy, frame, len, freq, sig_dbm);
8925
8845 if (!nlportid) 8926 if (!nlportid)
8846 return; 8927 return;
8847 8928
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
new file mode 100644
index 000000000000..eb5f8974e148
--- /dev/null
+++ b/net/wireless/rdev-ops.h
@@ -0,0 +1,879 @@
1#ifndef __CFG80211_RDEV_OPS
2#define __CFG80211_RDEV_OPS
3
4#include <linux/rtnetlink.h>
5#include <net/cfg80211.h>
6#include "core.h"
7#include "trace.h"
8
9static inline int rdev_suspend(struct cfg80211_registered_device *rdev)
10{
11 int ret;
12 trace_rdev_suspend(&rdev->wiphy, rdev->wowlan);
13 ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
14 trace_rdev_return_int(&rdev->wiphy, ret);
15 return ret;
16}
17
18static inline int rdev_resume(struct cfg80211_registered_device *rdev)
19{
20 int ret;
21 trace_rdev_resume(&rdev->wiphy);
22 ret = rdev->ops->resume(&rdev->wiphy);
23 trace_rdev_return_int(&rdev->wiphy, ret);
24 return ret;
25}
26
27static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
28 bool enabled)
29{
30 trace_rdev_set_wakeup(&rdev->wiphy, enabled);
31 rdev->ops->set_wakeup(&rdev->wiphy, enabled);
32 trace_rdev_return_void(&rdev->wiphy);
33}
34
35static inline struct wireless_dev
36*rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
37 enum nl80211_iftype type, u32 *flags,
38 struct vif_params *params)
39{
40 struct wireless_dev *ret;
41 trace_rdev_add_virtual_intf(&rdev->wiphy, name, type);
42 ret = rdev->ops->add_virtual_intf(&rdev->wiphy, name, type, flags,
43 params);
44 trace_rdev_return_wdev(&rdev->wiphy, ret);
45 return ret;
46}
47
48static inline int
49rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
50 struct wireless_dev *wdev)
51{
52 int ret;
53 trace_rdev_del_virtual_intf(&rdev->wiphy, wdev);
54 ret = rdev->ops->del_virtual_intf(&rdev->wiphy, wdev);
55 trace_rdev_return_int(&rdev->wiphy, ret);
56 return ret;
57}
58
59static inline int
60rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
61 struct net_device *dev, enum nl80211_iftype type,
62 u32 *flags, struct vif_params *params)
63{
64 int ret;
65 trace_rdev_change_virtual_intf(&rdev->wiphy, dev, type);
66 ret = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, flags,
67 params);
68 trace_rdev_return_int(&rdev->wiphy, ret);
69 return ret;
70}
71
72static inline int rdev_add_key(struct cfg80211_registered_device *rdev,
73 struct net_device *netdev, u8 key_index,
74 bool pairwise, const u8 *mac_addr,
75 struct key_params *params)
76{
77 int ret;
78 trace_rdev_add_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
79 ret = rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
80 mac_addr, params);
81 trace_rdev_return_int(&rdev->wiphy, ret);
82 return ret;
83}
84
85static inline int
86rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
87 u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
88 void (*callback)(void *cookie, struct key_params*))
89{
90 int ret;
91 trace_rdev_get_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
92 ret = rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
93 mac_addr, cookie, callback);
94 trace_rdev_return_int(&rdev->wiphy, ret);
95 return ret;
96}
97
98static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
99 struct net_device *netdev, u8 key_index,
100 bool pairwise, const u8 *mac_addr)
101{
102 int ret;
103 trace_rdev_del_key(&rdev->wiphy, netdev, key_index, pairwise, mac_addr);
104 ret = rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
105 mac_addr);
106 trace_rdev_return_int(&rdev->wiphy, ret);
107 return ret;
108}
109
110static inline int
111rdev_set_default_key(struct cfg80211_registered_device *rdev,
112 struct net_device *netdev, u8 key_index, bool unicast,
113 bool multicast)
114{
115 int ret;
116 trace_rdev_set_default_key(&rdev->wiphy, netdev, key_index,
117 unicast, multicast);
118 ret = rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
119 unicast, multicast);
120 trace_rdev_return_int(&rdev->wiphy, ret);
121 return ret;
122}
123
124static inline int
125rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
126 struct net_device *netdev, u8 key_index)
127{
128 int ret;
129 trace_rdev_set_default_mgmt_key(&rdev->wiphy, netdev, key_index);
130 ret = rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
131 key_index);
132 trace_rdev_return_int(&rdev->wiphy, ret);
133 return ret;
134}
135
136static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
137 struct net_device *dev,
138 struct cfg80211_ap_settings *settings)
139{
140 int ret;
141 trace_rdev_start_ap(&rdev->wiphy, dev, settings);
142 ret = rdev->ops->start_ap(&rdev->wiphy, dev, settings);
143 trace_rdev_return_int(&rdev->wiphy, ret);
144 return ret;
145}
146
147static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
148 struct net_device *dev,
149 struct cfg80211_beacon_data *info)
150{
151 int ret;
152 trace_rdev_change_beacon(&rdev->wiphy, dev, info);
153 ret = rdev->ops->change_beacon(&rdev->wiphy, dev, info);
154 trace_rdev_return_int(&rdev->wiphy, ret);
155 return ret;
156}
157
158static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
159 struct net_device *dev)
160{
161 int ret;
162 trace_rdev_stop_ap(&rdev->wiphy, dev);
163 ret = rdev->ops->stop_ap(&rdev->wiphy, dev);
164 trace_rdev_return_int(&rdev->wiphy, ret);
165 return ret;
166}
167
168static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
169 struct net_device *dev, u8 *mac,
170 struct station_parameters *params)
171{
172 int ret;
173 trace_rdev_add_station(&rdev->wiphy, dev, mac, params);
174 ret = rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
175 trace_rdev_return_int(&rdev->wiphy, ret);
176 return ret;
177}
178
179static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
180 struct net_device *dev, u8 *mac)
181{
182 int ret;
183 trace_rdev_del_station(&rdev->wiphy, dev, mac);
184 ret = rdev->ops->del_station(&rdev->wiphy, dev, mac);
185 trace_rdev_return_int(&rdev->wiphy, ret);
186 return ret;
187}
188
189static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
190 struct net_device *dev, u8 *mac,
191 struct station_parameters *params)
192{
193 int ret;
194 trace_rdev_change_station(&rdev->wiphy, dev, mac, params);
195 ret = rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
196 trace_rdev_return_int(&rdev->wiphy, ret);
197 return ret;
198}
199
200static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
201 struct net_device *dev, u8 *mac,
202 struct station_info *sinfo)
203{
204 int ret;
205 trace_rdev_get_station(&rdev->wiphy, dev, mac);
206 ret = rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
207 trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
208 return ret;
209}
210
211static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
212 struct net_device *dev, int idx, u8 *mac,
213 struct station_info *sinfo)
214{
215 int ret;
216 trace_rdev_dump_station(&rdev->wiphy, dev, idx, mac);
217 ret = rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
218 trace_rdev_return_int_station_info(&rdev->wiphy, ret, sinfo);
219 return ret;
220}
221
222static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
223 struct net_device *dev, u8 *dst, u8 *next_hop)
224{
225 int ret;
226 trace_rdev_add_mpath(&rdev->wiphy, dev, dst, next_hop);
227 ret = rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
228 trace_rdev_return_int(&rdev->wiphy, ret);
229 return ret;
230}
231
232static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
233 struct net_device *dev, u8 *dst)
234{
235 int ret;
236 trace_rdev_del_mpath(&rdev->wiphy, dev, dst);
237 ret = rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
238 trace_rdev_return_int(&rdev->wiphy, ret);
239 return ret;
240}
241
242static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
243 struct net_device *dev, u8 *dst,
244 u8 *next_hop)
245{
246 int ret;
247 trace_rdev_change_mpath(&rdev->wiphy, dev, dst, next_hop);
248 ret = rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
249 trace_rdev_return_int(&rdev->wiphy, ret);
250 return ret;
251}
252
253static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
254 struct net_device *dev, u8 *dst, u8 *next_hop,
255 struct mpath_info *pinfo)
256{
257 int ret;
258 trace_rdev_get_mpath(&rdev->wiphy, dev, dst, next_hop);
259 ret = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
260 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
261 return ret;
262
263}
264
265static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
266 struct net_device *dev, int idx, u8 *dst,
267 u8 *next_hop, struct mpath_info *pinfo)
268
269{
270 int ret;
271 trace_rdev_dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop);
272 ret = rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
273 pinfo);
274 trace_rdev_return_int_mpath_info(&rdev->wiphy, ret, pinfo);
275 return ret;
276}
277
278static inline int
279rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
280 struct net_device *dev, struct mesh_config *conf)
281{
282 int ret;
283 trace_rdev_get_mesh_config(&rdev->wiphy, dev);
284 ret = rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
285 trace_rdev_return_int_mesh_config(&rdev->wiphy, ret, conf);
286 return ret;
287}
288
289static inline int
290rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
291 struct net_device *dev, u32 mask,
292 const struct mesh_config *nconf)
293{
294 int ret;
295 trace_rdev_update_mesh_config(&rdev->wiphy, dev, mask, nconf);
296 ret = rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
297 trace_rdev_return_int(&rdev->wiphy, ret);
298 return ret;
299}
300
301static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
302 struct net_device *dev,
303 const struct mesh_config *conf,
304 const struct mesh_setup *setup)
305{
306 int ret;
307 trace_rdev_join_mesh(&rdev->wiphy, dev, conf, setup);
308 ret = rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
309 trace_rdev_return_int(&rdev->wiphy, ret);
310 return ret;
311}
312
313
314static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
315 struct net_device *dev)
316{
317 int ret;
318 trace_rdev_leave_mesh(&rdev->wiphy, dev);
319 ret = rdev->ops->leave_mesh(&rdev->wiphy, dev);
320 trace_rdev_return_int(&rdev->wiphy, ret);
321 return ret;
322}
323
324static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
325 struct net_device *dev,
326 struct bss_parameters *params)
327
328{
329 int ret;
330 trace_rdev_change_bss(&rdev->wiphy, dev, params);
331 ret = rdev->ops->change_bss(&rdev->wiphy, dev, params);
332 trace_rdev_return_int(&rdev->wiphy, ret);
333 return ret;
334}
335
336static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
337 struct net_device *dev,
338 struct ieee80211_txq_params *params)
339
340{
341 int ret;
342 trace_rdev_set_txq_params(&rdev->wiphy, dev, params);
343 ret = rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
344 trace_rdev_return_int(&rdev->wiphy, ret);
345 return ret;
346}
347
348static inline int
349rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
350 struct net_device *dev,
351 struct ieee80211_channel *chan)
352{
353 int ret;
354 trace_rdev_libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
355 ret = rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
356 trace_rdev_return_int(&rdev->wiphy, ret);
357 return ret;
358}
359
360static inline int
361rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
362 struct ieee80211_channel *chan,
363 enum nl80211_channel_type channel_type)
364{
365 int ret;
366 trace_rdev_set_monitor_channel(&rdev->wiphy, chan, channel_type);
367 ret = rdev->ops->set_monitor_channel(&rdev->wiphy, chan, channel_type);
368 trace_rdev_return_int(&rdev->wiphy, ret);
369 return ret;
370}
371
372static inline int rdev_scan(struct cfg80211_registered_device *rdev,
373 struct cfg80211_scan_request *request)
374{
375 int ret;
376 trace_rdev_scan(&rdev->wiphy, request);
377 ret = rdev->ops->scan(&rdev->wiphy, request);
378 trace_rdev_return_int(&rdev->wiphy, ret);
379 return ret;
380}
381
382static inline int rdev_auth(struct cfg80211_registered_device *rdev,
383 struct net_device *dev,
384 struct cfg80211_auth_request *req)
385{
386 int ret;
387 trace_rdev_auth(&rdev->wiphy, dev, req);
388 ret = rdev->ops->auth(&rdev->wiphy, dev, req);
389 trace_rdev_return_int(&rdev->wiphy, ret);
390 return ret;
391}
392
393static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
394 struct net_device *dev,
395 struct cfg80211_assoc_request *req)
396{
397 int ret;
398 trace_rdev_assoc(&rdev->wiphy, dev, req);
399 ret = rdev->ops->assoc(&rdev->wiphy, dev, req);
400 trace_rdev_return_int(&rdev->wiphy, ret);
401 return ret;
402}
403
404static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
405 struct net_device *dev,
406 struct cfg80211_deauth_request *req)
407{
408 int ret;
409 trace_rdev_deauth(&rdev->wiphy, dev, req);
410 ret = rdev->ops->deauth(&rdev->wiphy, dev, req);
411 trace_rdev_return_int(&rdev->wiphy, ret);
412 return ret;
413}
414
415static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
416 struct net_device *dev,
417 struct cfg80211_disassoc_request *req)
418{
419 int ret;
420 trace_rdev_disassoc(&rdev->wiphy, dev, req);
421 ret = rdev->ops->disassoc(&rdev->wiphy, dev, req);
422 trace_rdev_return_int(&rdev->wiphy, ret);
423 return ret;
424}
425
426static inline int rdev_connect(struct cfg80211_registered_device *rdev,
427 struct net_device *dev,
428 struct cfg80211_connect_params *sme)
429{
430 int ret;
431 trace_rdev_connect(&rdev->wiphy, dev, sme);
432 ret = rdev->ops->connect(&rdev->wiphy, dev, sme);
433 trace_rdev_return_int(&rdev->wiphy, ret);
434 return ret;
435}
436
437static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
438 struct net_device *dev, u16 reason_code)
439{
440 int ret;
441 trace_rdev_disconnect(&rdev->wiphy, dev, reason_code);
442 ret = rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
443 trace_rdev_return_int(&rdev->wiphy, ret);
444 return ret;
445}
446
447static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
448 struct net_device *dev,
449 struct cfg80211_ibss_params *params)
450{
451 int ret;
452 trace_rdev_join_ibss(&rdev->wiphy, dev, params);
453 ret = rdev->ops->join_ibss(&rdev->wiphy, dev, params);
454 trace_rdev_return_int(&rdev->wiphy, ret);
455 return ret;
456}
457
458static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
459 struct net_device *dev)
460{
461 int ret;
462 trace_rdev_leave_ibss(&rdev->wiphy, dev);
463 ret = rdev->ops->leave_ibss(&rdev->wiphy, dev);
464 trace_rdev_return_int(&rdev->wiphy, ret);
465 return ret;
466}
467
468static inline int
469rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
470{
471 int ret;
472 trace_rdev_set_wiphy_params(&rdev->wiphy, changed);
473 ret = rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
474 trace_rdev_return_int(&rdev->wiphy, ret);
475 return ret;
476}
477
478static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
479 enum nl80211_tx_power_setting type, int mbm)
480{
481 int ret;
482 trace_rdev_set_tx_power(&rdev->wiphy, type, mbm);
483 ret = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm);
484 trace_rdev_return_int(&rdev->wiphy, ret);
485 return ret;
486}
487
488static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
489 int *dbm)
490{
491 int ret;
492 trace_rdev_get_tx_power(&rdev->wiphy);
493 ret = rdev->ops->get_tx_power(&rdev->wiphy, dbm);
494 trace_rdev_return_int_int(&rdev->wiphy, ret, *dbm);
495 return ret;
496}
497
498static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
499 struct net_device *dev, const u8 *addr)
500{
501 int ret;
502 trace_rdev_set_wds_peer(&rdev->wiphy, dev, addr);
503 ret = rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
504 trace_rdev_return_int(&rdev->wiphy, ret);
505 return ret;
506}
507
508static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
509{
510 trace_rdev_rfkill_poll(&rdev->wiphy);
511 rdev->ops->rfkill_poll(&rdev->wiphy);
512 trace_rdev_return_void(&rdev->wiphy);
513}
514
515
516#ifdef CONFIG_NL80211_TESTMODE
517static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
518 void *data, int len)
519{
520 int ret;
521 trace_rdev_testmode_cmd(&rdev->wiphy);
522 ret = rdev->ops->testmode_cmd(&rdev->wiphy, data, len);
523 trace_rdev_return_int(&rdev->wiphy, ret);
524 return ret;
525}
526
527static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
528 struct sk_buff *skb,
529 struct netlink_callback *cb, void *data,
530 int len)
531{
532 int ret;
533 trace_rdev_testmode_dump(&rdev->wiphy);
534 ret = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data, len);
535 trace_rdev_return_int(&rdev->wiphy, ret);
536 return ret;
537}
538#endif
539
540static inline int
541rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
542 struct net_device *dev, const u8 *peer,
543 const struct cfg80211_bitrate_mask *mask)
544{
545 int ret;
546 trace_rdev_set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
547 ret = rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
548 trace_rdev_return_int(&rdev->wiphy, ret);
549 return ret;
550}
551
552static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
553 struct net_device *netdev, int idx,
554 struct survey_info *info)
555{
556 int ret;
557 trace_rdev_dump_survey(&rdev->wiphy, netdev, idx);
558 ret = rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
559 if (ret < 0)
560 trace_rdev_return_int(&rdev->wiphy, ret);
561 else
562 trace_rdev_return_int_survey_info(&rdev->wiphy, ret, info);
563 return ret;
564}
565
566static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
567 struct net_device *netdev,
568 struct cfg80211_pmksa *pmksa)
569{
570 int ret;
571 trace_rdev_set_pmksa(&rdev->wiphy, netdev, pmksa);
572 ret = rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
573 trace_rdev_return_int(&rdev->wiphy, ret);
574 return ret;
575}
576
577static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
578 struct net_device *netdev,
579 struct cfg80211_pmksa *pmksa)
580{
581 int ret;
582 trace_rdev_del_pmksa(&rdev->wiphy, netdev, pmksa);
583 ret = rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
584 trace_rdev_return_int(&rdev->wiphy, ret);
585 return ret;
586}
587
588static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
589 struct net_device *netdev)
590{
591 int ret;
592 trace_rdev_flush_pmksa(&rdev->wiphy, netdev);
593 ret = rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
594 trace_rdev_return_int(&rdev->wiphy, ret);
595 return ret;
596}
597
598static inline int
599rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
600 struct wireless_dev *wdev,
601 struct ieee80211_channel *chan,
602 enum nl80211_channel_type channel_type,
603 unsigned int duration, u64 *cookie)
604{
605 int ret;
606 trace_rdev_remain_on_channel(&rdev->wiphy, wdev, chan, channel_type,
607 duration);
608 ret = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
609 channel_type, duration, cookie);
610 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
611 return ret;
612}
613
614static inline int
615rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
616 struct wireless_dev *wdev, u64 cookie)
617{
618 int ret;
619 trace_rdev_cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
620 ret = rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
621 trace_rdev_return_int(&rdev->wiphy, ret);
622 return ret;
623}
624
625static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
626 struct wireless_dev *wdev,
627 struct ieee80211_channel *chan, bool offchan,
628 enum nl80211_channel_type channel_type,
629 bool channel_type_valid, unsigned int wait,
630 const u8 *buf, size_t len, bool no_cck,
631 bool dont_wait_for_ack, u64 *cookie)
632{
633 int ret;
634 trace_rdev_mgmt_tx(&rdev->wiphy, wdev, chan, offchan, channel_type,
635 channel_type_valid, wait, no_cck, dont_wait_for_ack);
636 ret = rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
637 channel_type, channel_type_valid, wait, buf,
638 len, no_cck, dont_wait_for_ack, cookie);
639 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
640 return ret;
641}
642
643static inline int
644rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
645 struct wireless_dev *wdev, u64 cookie)
646{
647 int ret;
648 trace_rdev_mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
649 ret = rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
650 trace_rdev_return_int(&rdev->wiphy, ret);
651 return ret;
652}
653
654static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
655 struct net_device *dev, bool enabled,
656 int timeout)
657{
658 int ret;
659 trace_rdev_set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
660 ret = rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
661 trace_rdev_return_int(&rdev->wiphy, ret);
662 return ret;
663}
664
665static inline int
666rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
667 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
668{
669 int ret;
670 trace_rdev_set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
671 rssi_hyst);
672 ret = rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
673 rssi_hyst);
674 trace_rdev_return_int(&rdev->wiphy, ret);
675 return ret;
676}
677
678static inline int
679rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
680 struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
681{
682 int ret;
683 trace_rdev_set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts, intvl);
684 ret = rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
685 intvl);
686 trace_rdev_return_int(&rdev->wiphy, ret);
687 return ret;
688}
689
690static inline void
691rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
692 struct wireless_dev *wdev, u16 frame_type, bool reg)
693{
694 trace_rdev_mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
695 rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type, reg);
696 trace_rdev_return_void(&rdev->wiphy);
697}
698
699static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
700 u32 tx_ant, u32 rx_ant)
701{
702 int ret;
703 trace_rdev_set_antenna(&rdev->wiphy, tx_ant, rx_ant);
704 ret = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
705 trace_rdev_return_int(&rdev->wiphy, ret);
706 return ret;
707}
708
709static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
710 u32 *tx_ant, u32 *rx_ant)
711{
712 int ret;
713 trace_rdev_get_antenna(&rdev->wiphy);
714 ret = rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
715 if (ret)
716 trace_rdev_return_int(&rdev->wiphy, ret);
717 else
718 trace_rdev_return_int_tx_rx(&rdev->wiphy, ret, *tx_ant,
719 *rx_ant);
720 return ret;
721}
722
723static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
724 u32 tx, u32 rx)
725{
726 int ret;
727 trace_rdev_set_ringparam(&rdev->wiphy, tx, rx);
728 ret = rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
729 trace_rdev_return_int(&rdev->wiphy, ret);
730 return ret;
731}
732
733static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
734 u32 *tx, u32 *tx_max, u32 *rx,
735 u32 *rx_max)
736{
737 trace_rdev_get_ringparam(&rdev->wiphy);
738 rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
739 trace_rdev_return_void_tx_rx(&rdev->wiphy, *tx, *tx_max, *rx, *rx_max);
740}
741
742static inline int
743rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
744 struct net_device *dev,
745 struct cfg80211_sched_scan_request *request)
746{
747 int ret;
748 trace_rdev_sched_scan_start(&rdev->wiphy, dev, request);
749 ret = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
750 trace_rdev_return_int(&rdev->wiphy, ret);
751 return ret;
752}
753
754static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
755 struct net_device *dev)
756{
757 int ret;
758 trace_rdev_sched_scan_stop(&rdev->wiphy, dev);
759 ret = rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
760 trace_rdev_return_int(&rdev->wiphy, ret);
761 return ret;
762}
763
764static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
765 struct net_device *dev,
766 struct cfg80211_gtk_rekey_data *data)
767{
768 int ret;
769 trace_rdev_set_rekey_data(&rdev->wiphy, dev);
770 ret = rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
771 trace_rdev_return_int(&rdev->wiphy, ret);
772 return ret;
773}
774
775static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
776 struct net_device *dev, u8 *peer,
777 u8 action_code, u8 dialog_token,
778 u16 status_code, const u8 *buf, size_t len)
779{
780 int ret;
781 trace_rdev_tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
782 dialog_token, status_code, buf, len);
783 ret = rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
784 dialog_token, status_code, buf, len);
785 trace_rdev_return_int(&rdev->wiphy, ret);
786 return ret;
787}
788
789static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
790 struct net_device *dev, u8 *peer,
791 enum nl80211_tdls_operation oper)
792{
793 int ret;
794 trace_rdev_tdls_oper(&rdev->wiphy, dev, peer, oper);
795 ret = rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
796 trace_rdev_return_int(&rdev->wiphy, ret);
797 return ret;
798}
799
800static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
801 struct net_device *dev, const u8 *peer,
802 u64 *cookie)
803{
804 int ret;
805 trace_rdev_probe_client(&rdev->wiphy, dev, peer);
806 ret = rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
807 trace_rdev_return_int_cookie(&rdev->wiphy, ret, *cookie);
808 return ret;
809}
810
811static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
812 struct net_device *dev, u16 noack_map)
813{
814 int ret;
815 trace_rdev_set_noack_map(&rdev->wiphy, dev, noack_map);
816 ret = rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
817 trace_rdev_return_int(&rdev->wiphy, ret);
818 return ret;
819}
820
821static inline int
822rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
823 struct net_device *dev, int sset)
824{
825 int ret;
826 trace_rdev_get_et_sset_count(&rdev->wiphy, dev, sset);
827 ret = rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
828 trace_rdev_return_int(&rdev->wiphy, ret);
829 return ret;
830}
831
832static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
833 struct net_device *dev,
834 struct ethtool_stats *stats, u64 *data)
835{
836 trace_rdev_get_et_stats(&rdev->wiphy, dev);
837 rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
838 trace_rdev_return_void(&rdev->wiphy);
839}
840
841static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
842 struct net_device *dev, u32 sset,
843 u8 *data)
844{
845 trace_rdev_get_et_strings(&rdev->wiphy, dev, sset);
846 rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
847 trace_rdev_return_void(&rdev->wiphy);
848}
849
850static inline struct ieee80211_channel
851*rdev_get_channel(struct cfg80211_registered_device *rdev,
852 struct wireless_dev *wdev, enum nl80211_channel_type *type)
853{
854 struct ieee80211_channel *ret;
855 trace_rdev_get_channel(&rdev->wiphy, wdev);
856 ret = rdev->ops->get_channel(&rdev->wiphy, wdev, type);
857 trace_rdev_return_channel(&rdev->wiphy, ret, *type);
858 return ret;
859}
860
861static inline int rdev_start_p2p_device(struct cfg80211_registered_device *rdev,
862 struct wireless_dev *wdev)
863{
864 int ret;
865
866 trace_rdev_start_p2p_device(&rdev->wiphy, wdev);
867 ret = rdev->ops->start_p2p_device(&rdev->wiphy, wdev);
868 trace_rdev_return_int(&rdev->wiphy, ret);
869 return ret;
870}
871
872static inline void rdev_stop_p2p_device(struct cfg80211_registered_device *rdev,
873 struct wireless_dev *wdev)
874{
875 trace_rdev_stop_p2p_device(&rdev->wiphy, wdev);
876 rdev->ops->stop_p2p_device(&rdev->wiphy, wdev);
877 trace_rdev_return_void(&rdev->wiphy);
878}
879#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 9730c9862bdc..7f97a087f452 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -17,9 +17,58 @@
17#include "core.h" 17#include "core.h"
18#include "nl80211.h" 18#include "nl80211.h"
19#include "wext-compat.h" 19#include "wext-compat.h"
20#include "rdev-ops.h"
20 21
21#define IEEE80211_SCAN_RESULT_EXPIRE (30 * HZ) 22#define IEEE80211_SCAN_RESULT_EXPIRE (30 * HZ)
22 23
24static void bss_release(struct kref *ref)
25{
26 struct cfg80211_internal_bss *bss;
27
28 bss = container_of(ref, struct cfg80211_internal_bss, ref);
29 if (bss->pub.free_priv)
30 bss->pub.free_priv(&bss->pub);
31
32 if (bss->beacon_ies_allocated)
33 kfree(bss->pub.beacon_ies);
34 if (bss->proberesp_ies_allocated)
35 kfree(bss->pub.proberesp_ies);
36
37 BUG_ON(atomic_read(&bss->hold));
38
39 kfree(bss);
40}
41
42/* must hold dev->bss_lock! */
43static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
44 struct cfg80211_internal_bss *bss)
45{
46 list_del_init(&bss->list);
47 rb_erase(&bss->rbn, &dev->bss_tree);
48 kref_put(&bss->ref, bss_release);
49}
50
51/* must hold dev->bss_lock! */
52static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev,
53 unsigned long expire_time)
54{
55 struct cfg80211_internal_bss *bss, *tmp;
56 bool expired = false;
57
58 list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) {
59 if (atomic_read(&bss->hold))
60 continue;
61 if (!time_after(expire_time, bss->ts))
62 continue;
63
64 __cfg80211_unlink_bss(dev, bss);
65 expired = true;
66 }
67
68 if (expired)
69 dev->bss_generation++;
70}
71
23void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak) 72void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak)
24{ 73{
25 struct cfg80211_scan_request *request; 74 struct cfg80211_scan_request *request;
@@ -45,10 +94,17 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak)
45 if (wdev->netdev) 94 if (wdev->netdev)
46 cfg80211_sme_scan_done(wdev->netdev); 95 cfg80211_sme_scan_done(wdev->netdev);
47 96
48 if (request->aborted) 97 if (request->aborted) {
49 nl80211_send_scan_aborted(rdev, wdev); 98 nl80211_send_scan_aborted(rdev, wdev);
50 else 99 } else {
100 if (request->flags & NL80211_SCAN_FLAG_FLUSH) {
101 /* flush entries from previous scans */
102 spin_lock_bh(&rdev->bss_lock);
103 __cfg80211_bss_expire(rdev, request->scan_start);
104 spin_unlock_bh(&rdev->bss_lock);
105 }
51 nl80211_send_scan_done(rdev, wdev); 106 nl80211_send_scan_done(rdev, wdev);
107 }
52 108
53#ifdef CONFIG_CFG80211_WEXT 109#ifdef CONFIG_CFG80211_WEXT
54 if (wdev->netdev && !request->aborted) { 110 if (wdev->netdev && !request->aborted) {
@@ -89,6 +145,7 @@ void __cfg80211_scan_done(struct work_struct *wk)
89 145
90void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted) 146void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted)
91{ 147{
148 trace_cfg80211_scan_done(request, aborted);
92 WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req); 149 WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req);
93 150
94 request->aborted = aborted; 151 request->aborted = aborted;
@@ -99,22 +156,34 @@ EXPORT_SYMBOL(cfg80211_scan_done);
99void __cfg80211_sched_scan_results(struct work_struct *wk) 156void __cfg80211_sched_scan_results(struct work_struct *wk)
100{ 157{
101 struct cfg80211_registered_device *rdev; 158 struct cfg80211_registered_device *rdev;
159 struct cfg80211_sched_scan_request *request;
102 160
103 rdev = container_of(wk, struct cfg80211_registered_device, 161 rdev = container_of(wk, struct cfg80211_registered_device,
104 sched_scan_results_wk); 162 sched_scan_results_wk);
105 163
164 request = rdev->sched_scan_req;
165
106 mutex_lock(&rdev->sched_scan_mtx); 166 mutex_lock(&rdev->sched_scan_mtx);
107 167
108 /* we don't have sched_scan_req anymore if the scan is stopping */ 168 /* we don't have sched_scan_req anymore if the scan is stopping */
109 if (rdev->sched_scan_req) 169 if (request) {
110 nl80211_send_sched_scan_results(rdev, 170 if (request->flags & NL80211_SCAN_FLAG_FLUSH) {
111 rdev->sched_scan_req->dev); 171 /* flush entries from previous scans */
172 spin_lock_bh(&rdev->bss_lock);
173 __cfg80211_bss_expire(rdev, request->scan_start);
174 spin_unlock_bh(&rdev->bss_lock);
175 request->scan_start =
176 jiffies + msecs_to_jiffies(request->interval);
177 }
178 nl80211_send_sched_scan_results(rdev, request->dev);
179 }
112 180
113 mutex_unlock(&rdev->sched_scan_mtx); 181 mutex_unlock(&rdev->sched_scan_mtx);
114} 182}
115 183
116void cfg80211_sched_scan_results(struct wiphy *wiphy) 184void cfg80211_sched_scan_results(struct wiphy *wiphy)
117{ 185{
186 trace_cfg80211_sched_scan_results(wiphy);
118 /* ignore if we're not scanning */ 187 /* ignore if we're not scanning */
119 if (wiphy_to_dev(wiphy)->sched_scan_req) 188 if (wiphy_to_dev(wiphy)->sched_scan_req)
120 queue_work(cfg80211_wq, 189 queue_work(cfg80211_wq,
@@ -126,6 +195,8 @@ void cfg80211_sched_scan_stopped(struct wiphy *wiphy)
126{ 195{
127 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); 196 struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
128 197
198 trace_cfg80211_sched_scan_stopped(wiphy);
199
129 mutex_lock(&rdev->sched_scan_mtx); 200 mutex_lock(&rdev->sched_scan_mtx);
130 __cfg80211_stop_sched_scan(rdev, true); 201 __cfg80211_stop_sched_scan(rdev, true);
131 mutex_unlock(&rdev->sched_scan_mtx); 202 mutex_unlock(&rdev->sched_scan_mtx);
@@ -145,7 +216,7 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
145 dev = rdev->sched_scan_req->dev; 216 dev = rdev->sched_scan_req->dev;
146 217
147 if (!driver_initiated) { 218 if (!driver_initiated) {
148 int err = rdev->ops->sched_scan_stop(&rdev->wiphy, dev); 219 int err = rdev_sched_scan_stop(rdev, dev);
149 if (err) 220 if (err)
150 return err; 221 return err;
151 } 222 }
@@ -158,24 +229,6 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
158 return 0; 229 return 0;
159} 230}
160 231
161static void bss_release(struct kref *ref)
162{
163 struct cfg80211_internal_bss *bss;
164
165 bss = container_of(ref, struct cfg80211_internal_bss, ref);
166 if (bss->pub.free_priv)
167 bss->pub.free_priv(&bss->pub);
168
169 if (bss->beacon_ies_allocated)
170 kfree(bss->pub.beacon_ies);
171 if (bss->proberesp_ies_allocated)
172 kfree(bss->pub.proberesp_ies);
173
174 BUG_ON(atomic_read(&bss->hold));
175
176 kfree(bss);
177}
178
179/* must hold dev->bss_lock! */ 232/* must hold dev->bss_lock! */
180void cfg80211_bss_age(struct cfg80211_registered_device *dev, 233void cfg80211_bss_age(struct cfg80211_registered_device *dev,
181 unsigned long age_secs) 234 unsigned long age_secs)
@@ -188,32 +241,9 @@ void cfg80211_bss_age(struct cfg80211_registered_device *dev,
188 } 241 }
189} 242}
190 243
191/* must hold dev->bss_lock! */
192static void __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
193 struct cfg80211_internal_bss *bss)
194{
195 list_del_init(&bss->list);
196 rb_erase(&bss->rbn, &dev->bss_tree);
197 kref_put(&bss->ref, bss_release);
198}
199
200/* must hold dev->bss_lock! */
201void cfg80211_bss_expire(struct cfg80211_registered_device *dev) 244void cfg80211_bss_expire(struct cfg80211_registered_device *dev)
202{ 245{
203 struct cfg80211_internal_bss *bss, *tmp; 246 __cfg80211_bss_expire(dev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE);
204 bool expired = false;
205
206 list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) {
207 if (atomic_read(&bss->hold))
208 continue;
209 if (!time_after(jiffies, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE))
210 continue;
211 __cfg80211_unlink_bss(dev, bss);
212 expired = true;
213 }
214
215 if (expired)
216 dev->bss_generation++;
217} 247}
218 248
219const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) 249const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
@@ -459,6 +489,9 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
459 struct cfg80211_internal_bss *bss, *res = NULL; 489 struct cfg80211_internal_bss *bss, *res = NULL;
460 unsigned long now = jiffies; 490 unsigned long now = jiffies;
461 491
492 trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask,
493 capa_val);
494
462 spin_lock_bh(&dev->bss_lock); 495 spin_lock_bh(&dev->bss_lock);
463 496
464 list_for_each_entry(bss, &dev->bss_list, list) { 497 list_for_each_entry(bss, &dev->bss_list, list) {
@@ -480,6 +513,7 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
480 spin_unlock_bh(&dev->bss_lock); 513 spin_unlock_bh(&dev->bss_lock);
481 if (!res) 514 if (!res)
482 return NULL; 515 return NULL;
516 trace_cfg80211_return_bss(&res->pub);
483 return &res->pub; 517 return &res->pub;
484} 518}
485EXPORT_SYMBOL(cfg80211_get_bss); 519EXPORT_SYMBOL(cfg80211_get_bss);
@@ -792,6 +826,7 @@ cfg80211_inform_bss(struct wiphy *wiphy,
792 if (res->pub.capability & WLAN_CAPABILITY_ESS) 826 if (res->pub.capability & WLAN_CAPABILITY_ESS)
793 regulatory_hint_found_beacon(wiphy, channel, gfp); 827 regulatory_hint_found_beacon(wiphy, channel, gfp);
794 828
829 trace_cfg80211_return_bss(&res->pub);
795 /* cfg80211_bss_update gives us a referenced result */ 830 /* cfg80211_bss_update gives us a referenced result */
796 return &res->pub; 831 return &res->pub;
797} 832}
@@ -804,10 +839,13 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
804 s32 signal, gfp_t gfp) 839 s32 signal, gfp_t gfp)
805{ 840{
806 struct cfg80211_internal_bss *res; 841 struct cfg80211_internal_bss *res;
842
807 size_t ielen = len - offsetof(struct ieee80211_mgmt, 843 size_t ielen = len - offsetof(struct ieee80211_mgmt,
808 u.probe_resp.variable); 844 u.probe_resp.variable);
809 size_t privsz; 845 size_t privsz;
810 846
847 trace_cfg80211_inform_bss_frame(wiphy, channel, mgmt, len, signal);
848
811 if (WARN_ON(!mgmt)) 849 if (WARN_ON(!mgmt))
812 return NULL; 850 return NULL;
813 851
@@ -861,6 +899,7 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,
861 if (res->pub.capability & WLAN_CAPABILITY_ESS) 899 if (res->pub.capability & WLAN_CAPABILITY_ESS)
862 regulatory_hint_found_beacon(wiphy, channel, gfp); 900 regulatory_hint_found_beacon(wiphy, channel, gfp);
863 901
902 trace_cfg80211_return_bss(&res->pub);
864 /* cfg80211_bss_update gives us a referenced result */ 903 /* cfg80211_bss_update gives us a referenced result */
865 return &res->pub; 904 return &res->pub;
866} 905}
@@ -962,6 +1001,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
962 creq->ssids = (void *)&creq->channels[n_channels]; 1001 creq->ssids = (void *)&creq->channels[n_channels];
963 creq->n_channels = n_channels; 1002 creq->n_channels = n_channels;
964 creq->n_ssids = 1; 1003 creq->n_ssids = 1;
1004 creq->scan_start = jiffies;
965 1005
966 /* translate "Scan on frequencies" request */ 1006 /* translate "Scan on frequencies" request */
967 i = 0; 1007 i = 0;
@@ -1026,7 +1066,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
1026 creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; 1066 creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
1027 1067
1028 rdev->scan_req = creq; 1068 rdev->scan_req = creq;
1029 err = rdev->ops->scan(wiphy, creq); 1069 err = rdev_scan(rdev, creq);
1030 if (err) { 1070 if (err) {
1031 rdev->scan_req = NULL; 1071 rdev->scan_req = NULL;
1032 /* creq will be freed below */ 1072 /* creq will be freed below */
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 6f39cb808302..c7490027237d 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -16,6 +16,7 @@
16#include <net/rtnetlink.h> 16#include <net/rtnetlink.h>
17#include "nl80211.h" 17#include "nl80211.h"
18#include "reg.h" 18#include "reg.h"
19#include "rdev-ops.h"
19 20
20struct cfg80211_conn { 21struct cfg80211_conn {
21 struct cfg80211_connect_params params; 22 struct cfg80211_connect_params params;
@@ -138,10 +139,11 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
138 139
139 request->wdev = wdev; 140 request->wdev = wdev;
140 request->wiphy = &rdev->wiphy; 141 request->wiphy = &rdev->wiphy;
142 request->scan_start = jiffies;
141 143
142 rdev->scan_req = request; 144 rdev->scan_req = request;
143 145
144 err = rdev->ops->scan(wdev->wiphy, request); 146 err = rdev_scan(rdev, request);
145 if (!err) { 147 if (!err) {
146 wdev->conn->state = CFG80211_CONN_SCANNING; 148 wdev->conn->state = CFG80211_CONN_SCANNING;
147 nl80211_send_scan_start(rdev, wdev); 149 nl80211_send_scan_start(rdev, wdev);
@@ -179,7 +181,7 @@ static int cfg80211_conn_do_work(struct wireless_dev *wdev)
179 params->ssid, params->ssid_len, 181 params->ssid, params->ssid_len,
180 NULL, 0, 182 NULL, 0,
181 params->key, params->key_len, 183 params->key, params->key_len,
182 params->key_idx); 184 params->key_idx, NULL, 0);
183 case CFG80211_CONN_ASSOCIATE_NEXT: 185 case CFG80211_CONN_ASSOCIATE_NEXT:
184 BUG_ON(!rdev->ops->assoc); 186 BUG_ON(!rdev->ops->assoc);
185 wdev->conn->state = CFG80211_CONN_ASSOCIATING; 187 wdev->conn->state = CFG80211_CONN_ASSOCIATING;
@@ -716,7 +718,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
716 */ 718 */
717 if (rdev->ops->del_key) 719 if (rdev->ops->del_key)
718 for (i = 0; i < 6; i++) 720 for (i = 0; i < 6; i++)
719 rdev->ops->del_key(wdev->wiphy, dev, i, false, NULL); 721 rdev_del_key(rdev, dev, i, false, NULL);
720 722
721#ifdef CONFIG_CFG80211_WEXT 723#ifdef CONFIG_CFG80211_WEXT
722 memset(&wrqu, 0, sizeof(wrqu)); 724 memset(&wrqu, 0, sizeof(wrqu));
@@ -892,7 +894,7 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
892 } else { 894 } else {
893 wdev->sme_state = CFG80211_SME_CONNECTING; 895 wdev->sme_state = CFG80211_SME_CONNECTING;
894 wdev->connect_keys = connkeys; 896 wdev->connect_keys = connkeys;
895 err = rdev->ops->connect(&rdev->wiphy, dev, connect); 897 err = rdev_connect(rdev, dev, connect);
896 if (err) { 898 if (err) {
897 wdev->connect_keys = NULL; 899 wdev->connect_keys = NULL;
898 wdev->sme_state = CFG80211_SME_IDLE; 900 wdev->sme_state = CFG80211_SME_IDLE;
@@ -964,7 +966,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
964 if (err) 966 if (err)
965 return err; 967 return err;
966 } else { 968 } else {
967 err = rdev->ops->disconnect(&rdev->wiphy, dev, reason); 969 err = rdev_disconnect(rdev, dev, reason);
968 if (err) 970 if (err)
969 return err; 971 return err;
970 } 972 }
diff --git a/net/wireless/sysfs.c b/net/wireless/sysfs.c
index ff574597a854..9bf6d5e32166 100644
--- a/net/wireless/sysfs.c
+++ b/net/wireless/sysfs.c
@@ -16,6 +16,7 @@
16#include <net/cfg80211.h> 16#include <net/cfg80211.h>
17#include "sysfs.h" 17#include "sysfs.h"
18#include "core.h" 18#include "core.h"
19#include "rdev-ops.h"
19 20
20static inline struct cfg80211_registered_device *dev_to_rdev( 21static inline struct cfg80211_registered_device *dev_to_rdev(
21 struct device *dev) 22 struct device *dev)
@@ -94,7 +95,7 @@ static int wiphy_suspend(struct device *dev, pm_message_t state)
94 if (rdev->ops->suspend) { 95 if (rdev->ops->suspend) {
95 rtnl_lock(); 96 rtnl_lock();
96 if (rdev->wiphy.registered) 97 if (rdev->wiphy.registered)
97 ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan); 98 ret = rdev_suspend(rdev);
98 rtnl_unlock(); 99 rtnl_unlock();
99 } 100 }
100 101
@@ -114,7 +115,7 @@ static int wiphy_resume(struct device *dev)
114 if (rdev->ops->resume) { 115 if (rdev->ops->resume) {
115 rtnl_lock(); 116 rtnl_lock();
116 if (rdev->wiphy.registered) 117 if (rdev->wiphy.registered)
117 ret = rdev->ops->resume(&rdev->wiphy); 118 ret = rdev_resume(rdev);
118 rtnl_unlock(); 119 rtnl_unlock();
119 } 120 }
120 121
diff --git a/net/wireless/trace.c b/net/wireless/trace.c
new file mode 100644
index 000000000000..95f997fad755
--- /dev/null
+++ b/net/wireless/trace.c
@@ -0,0 +1,7 @@
1#include <linux/module.h>
2
3#ifndef __CHECKER__
4#define CREATE_TRACE_POINTS
5#include "trace.h"
6
7#endif
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
new file mode 100644
index 000000000000..0ca71caf85fb
--- /dev/null
+++ b/net/wireless/trace.h
@@ -0,0 +1,2296 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM cfg80211
3
4#if !defined(__RDEV_OPS_TRACE) || defined(TRACE_HEADER_MULTI_READ)
5#define __RDEV_OPS_TRACE
6
7#include <linux/tracepoint.h>
8
9#include <linux/rtnetlink.h>
10#include <net/cfg80211.h>
11#include "core.h"
12
13#define MAC_ENTRY(entry_mac) __array(u8, entry_mac, ETH_ALEN)
14#define MAC_ASSIGN(entry_mac, given_mac) do { \
15 if (given_mac) \
16 memcpy(__entry->entry_mac, given_mac, ETH_ALEN); \
17 else \
18 memset(__entry->entry_mac, 0, ETH_ALEN); \
19 } while (0)
20#define MAC_PR_FMT "%pM"
21#define MAC_PR_ARG(entry_mac) (__entry->entry_mac)
22
23#define WIPHY_ENTRY MAC_ENTRY(wiphy_mac)
24#define WIPHY_ASSIGN MAC_ASSIGN(wiphy_mac, wiphy->perm_addr)
25#define WIPHY_PR_FMT "wiphy " MAC_PR_FMT
26#define WIPHY_PR_ARG MAC_PR_ARG(wiphy_mac)
27
28#define WDEV_ENTRY __field(u32, id)
29#define WDEV_ASSIGN (__entry->id) = (wdev->identifier)
30#define WDEV_PR_FMT ", wdev id: %u"
31#define WDEV_PR_ARG (__entry->id)
32
33#define NETDEV_ENTRY __array(char, name, IFNAMSIZ) \
34 MAC_ENTRY(netdev_addr) \
35 __field(int, ifindex)
36#define NETDEV_ASSIGN \
37 do { \
38 memcpy(__entry->name, netdev->name, IFNAMSIZ); \
39 MAC_ASSIGN(netdev_addr, netdev->dev_addr); \
40 (__entry->ifindex) = (netdev->ifindex); \
41 } while (0)
42#define NETDEV_PR_FMT ", netdev - name: %s, addr: " MAC_PR_FMT \
43 ", intf index: %d"
44#define NETDEV_PR_ARG (__entry->name), MAC_PR_ARG(netdev_addr), \
45 (__entry->ifindex)
46
47#define MESH_CFG_ENTRY __field(u16, dot11MeshRetryTimeout) \
48 __field(u16, dot11MeshConfirmTimeout) \
49 __field(u16, dot11MeshHoldingTimeout) \
50 __field(u16, dot11MeshMaxPeerLinks) \
51 __field(u8, dot11MeshMaxRetries) \
52 __field(u8, dot11MeshTTL) \
53 __field(u8, element_ttl) \
54 __field(bool, auto_open_plinks) \
55 __field(u32, dot11MeshNbrOffsetMaxNeighbor) \
56 __field(u8, dot11MeshHWMPmaxPREQretries) \
57 __field(u32, path_refresh_time) \
58 __field(u32, dot11MeshHWMPactivePathTimeout) \
59 __field(u16, min_discovery_timeout) \
60 __field(u16, dot11MeshHWMPpreqMinInterval) \
61 __field(u16, dot11MeshHWMPperrMinInterval) \
62 __field(u16, dot11MeshHWMPnetDiameterTraversalTime) \
63 __field(u8, dot11MeshHWMPRootMode) \
64 __field(u16, dot11MeshHWMPRannInterval) \
65 __field(bool, dot11MeshGateAnnouncementProtocol) \
66 __field(bool, dot11MeshForwarding) \
67 __field(s32, rssi_threshold) \
68 __field(u16, ht_opmode) \
69 __field(u32, dot11MeshHWMPactivePathToRootTimeout) \
70 __field(u16, dot11MeshHWMProotInterval) \
71 __field(u16, dot11MeshHWMPconfirmationInterval)
72#define MESH_CFG_ASSIGN \
73 do { \
74 __entry->dot11MeshRetryTimeout = conf->dot11MeshRetryTimeout; \
75 __entry->dot11MeshConfirmTimeout = \
76 conf->dot11MeshConfirmTimeout; \
77 __entry->dot11MeshHoldingTimeout = \
78 conf->dot11MeshHoldingTimeout; \
79 __entry->dot11MeshMaxPeerLinks = conf->dot11MeshMaxPeerLinks; \
80 __entry->dot11MeshMaxRetries = conf->dot11MeshMaxRetries; \
81 __entry->dot11MeshTTL = conf->dot11MeshTTL; \
82 __entry->element_ttl = conf->element_ttl; \
83 __entry->auto_open_plinks = conf->auto_open_plinks; \
84 __entry->dot11MeshNbrOffsetMaxNeighbor = \
85 conf->dot11MeshNbrOffsetMaxNeighbor; \
86 __entry->dot11MeshHWMPmaxPREQretries = \
87 conf->dot11MeshHWMPmaxPREQretries; \
88 __entry->path_refresh_time = conf->path_refresh_time; \
89 __entry->dot11MeshHWMPactivePathTimeout = \
90 conf->dot11MeshHWMPactivePathTimeout; \
91 __entry->min_discovery_timeout = conf->min_discovery_timeout; \
92 __entry->dot11MeshHWMPpreqMinInterval = \
93 conf->dot11MeshHWMPpreqMinInterval; \
94 __entry->dot11MeshHWMPperrMinInterval = \
95 conf->dot11MeshHWMPperrMinInterval; \
96 __entry->dot11MeshHWMPnetDiameterTraversalTime = \
97 conf->dot11MeshHWMPnetDiameterTraversalTime; \
98 __entry->dot11MeshHWMPRootMode = conf->dot11MeshHWMPRootMode; \
99 __entry->dot11MeshHWMPRannInterval = \
100 conf->dot11MeshHWMPRannInterval; \
101 __entry->dot11MeshGateAnnouncementProtocol = \
102 conf->dot11MeshGateAnnouncementProtocol; \
103 __entry->dot11MeshForwarding = conf->dot11MeshForwarding; \
104 __entry->rssi_threshold = conf->rssi_threshold; \
105 __entry->ht_opmode = conf->ht_opmode; \
106 __entry->dot11MeshHWMPactivePathToRootTimeout = \
107 conf->dot11MeshHWMPactivePathToRootTimeout; \
108 __entry->dot11MeshHWMProotInterval = \
109 conf->dot11MeshHWMProotInterval; \
110 __entry->dot11MeshHWMPconfirmationInterval = \
111 conf->dot11MeshHWMPconfirmationInterval; \
112 } while (0)
113
114#define CHAN_ENTRY __field(enum ieee80211_band, band) \
115 __field(u16, center_freq)
116#define CHAN_ASSIGN(chan) \
117 do { \
118 if (chan) { \
119 __entry->band = chan->band; \
120 __entry->center_freq = chan->center_freq; \
121 } else { \
122 __entry->band = 0; \
123 __entry->center_freq = 0; \
124 } \
125 } while (0)
126#define CHAN_PR_FMT ", band: %d, freq: %u"
127#define CHAN_PR_ARG __entry->band, __entry->center_freq
128
129#define SINFO_ENTRY __field(int, generation) \
130 __field(u32, connected_time) \
131 __field(u32, inactive_time) \
132 __field(u32, rx_bytes) \
133 __field(u32, tx_bytes) \
134 __field(u32, rx_packets) \
135 __field(u32, tx_packets) \
136 __field(u32, tx_retries) \
137 __field(u32, tx_failed) \
138 __field(u32, rx_dropped_misc) \
139 __field(u32, beacon_loss_count) \
140 __field(u16, llid) \
141 __field(u16, plid) \
142 __field(u8, plink_state)
143#define SINFO_ASSIGN \
144 do { \
145 __entry->generation = sinfo->generation; \
146 __entry->connected_time = sinfo->connected_time; \
147 __entry->inactive_time = sinfo->inactive_time; \
148 __entry->rx_bytes = sinfo->rx_bytes; \
149 __entry->tx_bytes = sinfo->tx_bytes; \
150 __entry->rx_packets = sinfo->rx_packets; \
151 __entry->tx_packets = sinfo->tx_packets; \
152 __entry->tx_retries = sinfo->tx_retries; \
153 __entry->tx_failed = sinfo->tx_failed; \
154 __entry->rx_dropped_misc = sinfo->rx_dropped_misc; \
155 __entry->beacon_loss_count = sinfo->beacon_loss_count; \
156 __entry->llid = sinfo->llid; \
157 __entry->plid = sinfo->plid; \
158 __entry->plink_state = sinfo->plink_state; \
159 } while (0)
160
161#define BOOL_TO_STR(bo) (bo) ? "true" : "false"
162
163/*************************************************************
164 * rdev->ops traces *
165 *************************************************************/
166
167TRACE_EVENT(rdev_suspend,
168 TP_PROTO(struct wiphy *wiphy, struct cfg80211_wowlan *wow),
169 TP_ARGS(wiphy, wow),
170 TP_STRUCT__entry(
171 WIPHY_ENTRY
172 __field(bool, any)
173 __field(bool, disconnect)
174 __field(bool, magic_pkt)
175 __field(bool, gtk_rekey_failure)
176 __field(bool, eap_identity_req)
177 __field(bool, four_way_handshake)
178 __field(bool, rfkill_release)
179 __field(bool, valid_wow)
180 ),
181 TP_fast_assign(
182 WIPHY_ASSIGN;
183 if (wow) {
184 __entry->any = wow->any;
185 __entry->disconnect = wow->disconnect;
186 __entry->magic_pkt = wow->magic_pkt;
187 __entry->gtk_rekey_failure = wow->gtk_rekey_failure;
188 __entry->eap_identity_req = wow->eap_identity_req;
189 __entry->four_way_handshake = wow->four_way_handshake;
190 __entry->rfkill_release = wow->rfkill_release;
191 __entry->valid_wow = true;
192 } else {
193 __entry->valid_wow = false;
194 }
195 ),
196 TP_printk(WIPHY_PR_FMT ", wow%s - any: %d, disconnect: %d, "
197 "magic pkt: %d, gtk rekey failure: %d, eap identify req: %d, "
198 "four way handshake: %d, rfkill release: %d.",
199 WIPHY_PR_ARG, __entry->valid_wow ? "" : "(Not configured!)",
200 __entry->any, __entry->disconnect, __entry->magic_pkt,
201 __entry->gtk_rekey_failure, __entry->eap_identity_req,
202 __entry->four_way_handshake, __entry->rfkill_release)
203);
204
205TRACE_EVENT(rdev_return_int,
206 TP_PROTO(struct wiphy *wiphy, int ret),
207 TP_ARGS(wiphy, ret),
208 TP_STRUCT__entry(
209 WIPHY_ENTRY
210 __field(int, ret)
211 ),
212 TP_fast_assign(
213 WIPHY_ASSIGN;
214 __entry->ret = ret;
215 ),
216 TP_printk(WIPHY_PR_FMT ", returned: %d", WIPHY_PR_ARG, __entry->ret)
217);
218
219TRACE_EVENT(rdev_scan,
220 TP_PROTO(struct wiphy *wiphy, struct cfg80211_scan_request *request),
221 TP_ARGS(wiphy, request),
222 TP_STRUCT__entry(
223 WIPHY_ENTRY
224 ),
225 TP_fast_assign(
226 WIPHY_ASSIGN;
227 ),
228 TP_printk(WIPHY_PR_FMT, WIPHY_PR_ARG)
229);
230
231DECLARE_EVENT_CLASS(wiphy_only_evt,
232 TP_PROTO(struct wiphy *wiphy),
233 TP_ARGS(wiphy),
234 TP_STRUCT__entry(
235 WIPHY_ENTRY
236 ),
237 TP_fast_assign(
238 WIPHY_ASSIGN;
239 ),
240 TP_printk(WIPHY_PR_FMT, WIPHY_PR_ARG)
241);
242
243DEFINE_EVENT(wiphy_only_evt, rdev_resume,
244 TP_PROTO(struct wiphy *wiphy),
245 TP_ARGS(wiphy)
246);
247
248DEFINE_EVENT(wiphy_only_evt, rdev_return_void,
249 TP_PROTO(struct wiphy *wiphy),
250 TP_ARGS(wiphy)
251);
252
253DEFINE_EVENT(wiphy_only_evt, rdev_get_ringparam,
254 TP_PROTO(struct wiphy *wiphy),
255 TP_ARGS(wiphy)
256);
257
258DEFINE_EVENT(wiphy_only_evt, rdev_get_antenna,
259 TP_PROTO(struct wiphy *wiphy),
260 TP_ARGS(wiphy)
261);
262
263DEFINE_EVENT(wiphy_only_evt, rdev_get_tx_power,
264 TP_PROTO(struct wiphy *wiphy),
265 TP_ARGS(wiphy)
266);
267
268DEFINE_EVENT(wiphy_only_evt, rdev_rfkill_poll,
269 TP_PROTO(struct wiphy *wiphy),
270 TP_ARGS(wiphy)
271);
272
273DECLARE_EVENT_CLASS(wiphy_enabled_evt,
274 TP_PROTO(struct wiphy *wiphy, bool enabled),
275 TP_ARGS(wiphy, enabled),
276 TP_STRUCT__entry(
277 WIPHY_ENTRY
278 __field(bool, enabled)
279 ),
280 TP_fast_assign(
281 WIPHY_ASSIGN;
282 __entry->enabled = enabled;
283 ),
284 TP_printk(WIPHY_PR_FMT ", %senabled ",
285 WIPHY_PR_ARG, __entry->enabled ? "" : "not ")
286);
287
288DEFINE_EVENT(wiphy_enabled_evt, rdev_set_wakeup,
289 TP_PROTO(struct wiphy *wiphy, bool enabled),
290 TP_ARGS(wiphy, enabled)
291);
292
293TRACE_EVENT(rdev_add_virtual_intf,
294 TP_PROTO(struct wiphy *wiphy, char *name, enum nl80211_iftype type),
295 TP_ARGS(wiphy, name, type),
296 TP_STRUCT__entry(
297 WIPHY_ENTRY
298 __string(vir_intf_name, name ? name : "<noname>")
299 __field(enum nl80211_iftype, type)
300 ),
301 TP_fast_assign(
302 WIPHY_ASSIGN;
303 __assign_str(vir_intf_name, name ? name : "<noname>");
304 __entry->type = type;
305 ),
306 TP_printk(WIPHY_PR_FMT ", virtual intf name: %s, type: %d",
307 WIPHY_PR_ARG, __get_str(vir_intf_name), __entry->type)
308);
309
310DECLARE_EVENT_CLASS(wiphy_wdev_evt,
311 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
312 TP_ARGS(wiphy, wdev),
313 TP_STRUCT__entry(
314 WIPHY_ENTRY
315 WDEV_ENTRY
316 ),
317 TP_fast_assign(
318 WIPHY_ASSIGN;
319 WDEV_ASSIGN;
320 ),
321 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT, WIPHY_PR_ARG, WDEV_PR_ARG)
322);
323
324DEFINE_EVENT(wiphy_wdev_evt, rdev_return_wdev,
325 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
326 TP_ARGS(wiphy, wdev)
327);
328
329DEFINE_EVENT(wiphy_wdev_evt, rdev_del_virtual_intf,
330 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
331 TP_ARGS(wiphy, wdev)
332);
333
334TRACE_EVENT(rdev_change_virtual_intf,
335 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
336 enum nl80211_iftype type),
337 TP_ARGS(wiphy, netdev, type),
338 TP_STRUCT__entry(
339 WIPHY_ENTRY
340 NETDEV_ENTRY
341 __field(enum nl80211_iftype, type)
342 ),
343 TP_fast_assign(
344 WIPHY_ASSIGN;
345 NETDEV_ASSIGN;
346 __entry->type = type;
347 ),
348 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", type: %d",
349 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->type)
350);
351
352DECLARE_EVENT_CLASS(key_handle,
353 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
354 bool pairwise, const u8 *mac_addr),
355 TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr),
356 TP_STRUCT__entry(
357 WIPHY_ENTRY
358 NETDEV_ENTRY
359 MAC_ENTRY(mac_addr)
360 __field(u8, key_index)
361 __field(bool, pairwise)
362 ),
363 TP_fast_assign(
364 WIPHY_ASSIGN;
365 NETDEV_ASSIGN;
366 MAC_ASSIGN(mac_addr, mac_addr);
367 __entry->key_index = key_index;
368 __entry->pairwise = pairwise;
369 ),
370 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", key_index: %u, pairwise: %s, mac addr: " MAC_PR_FMT,
371 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index,
372 BOOL_TO_STR(__entry->pairwise), MAC_PR_ARG(mac_addr))
373);
374
375DEFINE_EVENT(key_handle, rdev_add_key,
376 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
377 bool pairwise, const u8 *mac_addr),
378 TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr)
379);
380
381DEFINE_EVENT(key_handle, rdev_get_key,
382 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
383 bool pairwise, const u8 *mac_addr),
384 TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr)
385);
386
387DEFINE_EVENT(key_handle, rdev_del_key,
388 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
389 bool pairwise, const u8 *mac_addr),
390 TP_ARGS(wiphy, netdev, key_index, pairwise, mac_addr)
391);
392
393TRACE_EVENT(rdev_set_default_key,
394 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index,
395 bool unicast, bool multicast),
396 TP_ARGS(wiphy, netdev, key_index, unicast, multicast),
397 TP_STRUCT__entry(
398 WIPHY_ENTRY
399 NETDEV_ENTRY
400 __field(u8, key_index)
401 __field(bool, unicast)
402 __field(bool, multicast)
403 ),
404 TP_fast_assign(
405 WIPHY_ASSIGN;
406 NETDEV_ASSIGN;
407 __entry->key_index = key_index;
408 __entry->unicast = unicast;
409 __entry->multicast = multicast;
410 ),
411 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", key index: %u, unicast: %s, multicast: %s",
412 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index,
413 BOOL_TO_STR(__entry->unicast),
414 BOOL_TO_STR(__entry->multicast))
415);
416
417TRACE_EVENT(rdev_set_default_mgmt_key,
418 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 key_index),
419 TP_ARGS(wiphy, netdev, key_index),
420 TP_STRUCT__entry(
421 WIPHY_ENTRY
422 NETDEV_ENTRY
423 __field(u8, key_index)
424 ),
425 TP_fast_assign(
426 WIPHY_ASSIGN;
427 NETDEV_ASSIGN;
428 __entry->key_index = key_index;
429 ),
430 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", key index: %u",
431 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->key_index)
432);
433
434TRACE_EVENT(rdev_start_ap,
435 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
436 struct cfg80211_ap_settings *settings),
437 TP_ARGS(wiphy, netdev, settings),
438 TP_STRUCT__entry(
439 WIPHY_ENTRY
440 NETDEV_ENTRY
441 CHAN_ENTRY
442 __field(int, beacon_interval)
443 __field(int, dtim_period)
444 __array(char, ssid, IEEE80211_MAX_SSID_LEN + 1)
445 __field(enum nl80211_hidden_ssid, hidden_ssid)
446 __field(u32, wpa_ver)
447 __field(bool, privacy)
448 __field(enum nl80211_auth_type, auth_type)
449 __field(int, inactivity_timeout)
450 ),
451 TP_fast_assign(
452 WIPHY_ASSIGN;
453 NETDEV_ASSIGN;
454 CHAN_ASSIGN(settings->channel);
455 __entry->beacon_interval = settings->beacon_interval;
456 __entry->dtim_period = settings->dtim_period;
457 __entry->hidden_ssid = settings->hidden_ssid;
458 __entry->wpa_ver = settings->crypto.wpa_versions;
459 __entry->privacy = settings->privacy;
460 __entry->auth_type = settings->auth_type;
461 __entry->inactivity_timeout = settings->inactivity_timeout;
462 memset(__entry->ssid, 0, IEEE80211_MAX_SSID_LEN + 1);
463 memcpy(__entry->ssid, settings->ssid, settings->ssid_len);
464 ),
465 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", AP settings - ssid: %s, "
466 CHAN_PR_FMT ", beacon interval: %d, dtim period: %d, "
467 "hidden ssid: %d, wpa versions: %u, privacy: %s, "
468 "auth type: %d, inactivity timeout: %d",
469 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->ssid, CHAN_PR_ARG,
470 __entry->beacon_interval, __entry->dtim_period,
471 __entry->hidden_ssid, __entry->wpa_ver,
472 BOOL_TO_STR(__entry->privacy), __entry->auth_type,
473 __entry->inactivity_timeout)
474);
475
476TRACE_EVENT(rdev_change_beacon,
477 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
478 struct cfg80211_beacon_data *info),
479 TP_ARGS(wiphy, netdev, info),
480 TP_STRUCT__entry(
481 WIPHY_ENTRY
482 NETDEV_ENTRY
483 __dynamic_array(u8, head, info ? info->head_len : 0)
484 __dynamic_array(u8, tail, info ? info->tail_len : 0)
485 __dynamic_array(u8, beacon_ies, info ? info->beacon_ies_len : 0)
486 __dynamic_array(u8, proberesp_ies,
487 info ? info->proberesp_ies_len : 0)
488 __dynamic_array(u8, assocresp_ies,
489 info ? info->assocresp_ies_len : 0)
490 __dynamic_array(u8, probe_resp, info ? info->probe_resp_len : 0)
491 ),
492 TP_fast_assign(
493 WIPHY_ASSIGN;
494 NETDEV_ASSIGN;
495 if (info) {
496 if (info->head)
497 memcpy(__get_dynamic_array(head), info->head,
498 info->head_len);
499 if (info->tail)
500 memcpy(__get_dynamic_array(tail), info->tail,
501 info->tail_len);
502 if (info->beacon_ies)
503 memcpy(__get_dynamic_array(beacon_ies),
504 info->beacon_ies, info->beacon_ies_len);
505 if (info->proberesp_ies)
506 memcpy(__get_dynamic_array(proberesp_ies),
507 info->proberesp_ies,
508 info->proberesp_ies_len);
509 if (info->assocresp_ies)
510 memcpy(__get_dynamic_array(assocresp_ies),
511 info->assocresp_ies,
512 info->assocresp_ies_len);
513 if (info->probe_resp)
514 memcpy(__get_dynamic_array(probe_resp),
515 info->probe_resp, info->probe_resp_len);
516 }
517 ),
518 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG)
519);
520
521DECLARE_EVENT_CLASS(wiphy_netdev_evt,
522 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
523 TP_ARGS(wiphy, netdev),
524 TP_STRUCT__entry(
525 WIPHY_ENTRY
526 NETDEV_ENTRY
527 ),
528 TP_fast_assign(
529 WIPHY_ASSIGN;
530 NETDEV_ASSIGN;
531 ),
532 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT, WIPHY_PR_ARG, NETDEV_PR_ARG)
533);
534
535DEFINE_EVENT(wiphy_netdev_evt, rdev_stop_ap,
536 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
537 TP_ARGS(wiphy, netdev)
538);
539
540DEFINE_EVENT(wiphy_netdev_evt, rdev_get_et_stats,
541 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
542 TP_ARGS(wiphy, netdev)
543);
544
545DEFINE_EVENT(wiphy_netdev_evt, rdev_sched_scan_stop,
546 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
547 TP_ARGS(wiphy, netdev)
548);
549
550DEFINE_EVENT(wiphy_netdev_evt, rdev_set_rekey_data,
551 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
552 TP_ARGS(wiphy, netdev)
553);
554
555DEFINE_EVENT(wiphy_netdev_evt, rdev_get_mesh_config,
556 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
557 TP_ARGS(wiphy, netdev)
558);
559
560DEFINE_EVENT(wiphy_netdev_evt, rdev_leave_mesh,
561 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
562 TP_ARGS(wiphy, netdev)
563);
564
565DEFINE_EVENT(wiphy_netdev_evt, rdev_leave_ibss,
566 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
567 TP_ARGS(wiphy, netdev)
568);
569
570DEFINE_EVENT(wiphy_netdev_evt, rdev_flush_pmksa,
571 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev),
572 TP_ARGS(wiphy, netdev)
573);
574
575DECLARE_EVENT_CLASS(station_add_change,
576 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *mac,
577 struct station_parameters *params),
578 TP_ARGS(wiphy, netdev, mac, params),
579 TP_STRUCT__entry(
580 WIPHY_ENTRY
581 NETDEV_ENTRY
582 MAC_ENTRY(sta_mac)
583 __field(u32, sta_flags_mask)
584 __field(u32, sta_flags_set)
585 __field(u32, sta_modify_mask)
586 __field(int, listen_interval)
587 __field(u16, aid)
588 __field(u8, plink_action)
589 __field(u8, plink_state)
590 __field(u8, uapsd_queues)
591 __array(u8, ht_capa, (int)sizeof(struct ieee80211_ht_cap))
592 ),
593 TP_fast_assign(
594 WIPHY_ASSIGN;
595 NETDEV_ASSIGN;
596 MAC_ASSIGN(sta_mac, mac);
597 __entry->sta_flags_mask = params->sta_flags_mask;
598 __entry->sta_flags_set = params->sta_flags_set;
599 __entry->sta_modify_mask = params->sta_modify_mask;
600 __entry->listen_interval = params->listen_interval;
601 __entry->aid = params->aid;
602 __entry->plink_action = params->plink_action;
603 __entry->plink_state = params->plink_state;
604 __entry->uapsd_queues = params->uapsd_queues;
605 memset(__entry->ht_capa, 0, sizeof(struct ieee80211_ht_cap));
606 if (params->ht_capa)
607 memcpy(__entry->ht_capa, params->ht_capa,
608 sizeof(struct ieee80211_ht_cap));
609 ),
610 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", station mac: " MAC_PR_FMT
611 ", station flags mask: %u, station flags set: %u, "
612 "station modify mask: %u, listen interval: %d, aid: %u, "
613 "plink action: %u, plink state: %u, uapsd queues: %u",
614 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac),
615 __entry->sta_flags_mask, __entry->sta_flags_set,
616 __entry->sta_modify_mask, __entry->listen_interval,
617 __entry->aid, __entry->plink_action, __entry->plink_state,
618 __entry->uapsd_queues)
619);
620
621DEFINE_EVENT(station_add_change, rdev_add_station,
622 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *mac,
623 struct station_parameters *params),
624 TP_ARGS(wiphy, netdev, mac, params)
625);
626
627DEFINE_EVENT(station_add_change, rdev_change_station,
628 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *mac,
629 struct station_parameters *params),
630 TP_ARGS(wiphy, netdev, mac, params)
631);
632
633DECLARE_EVENT_CLASS(wiphy_netdev_mac_evt,
634 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *mac),
635 TP_ARGS(wiphy, netdev, mac),
636 TP_STRUCT__entry(
637 WIPHY_ENTRY
638 NETDEV_ENTRY
639 MAC_ENTRY(sta_mac)
640 ),
641 TP_fast_assign(
642 WIPHY_ASSIGN;
643 NETDEV_ASSIGN;
644 MAC_ASSIGN(sta_mac, mac);
645 ),
646 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", mac: " MAC_PR_FMT,
647 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac))
648);
649
650DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_del_station,
651 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *mac),
652 TP_ARGS(wiphy, netdev, mac)
653);
654
655DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_get_station,
656 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *mac),
657 TP_ARGS(wiphy, netdev, mac)
658);
659
660DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_del_mpath,
661 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *mac),
662 TP_ARGS(wiphy, netdev, mac)
663);
664
665DEFINE_EVENT(wiphy_netdev_mac_evt, rdev_set_wds_peer,
666 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, const u8 *mac),
667 TP_ARGS(wiphy, netdev, mac)
668);
669
670TRACE_EVENT(rdev_dump_station,
671 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int idx,
672 u8 *mac),
673 TP_ARGS(wiphy, netdev, idx, mac),
674 TP_STRUCT__entry(
675 WIPHY_ENTRY
676 NETDEV_ENTRY
677 MAC_ENTRY(sta_mac)
678 __field(int, idx)
679 ),
680 TP_fast_assign(
681 WIPHY_ASSIGN;
682 NETDEV_ASSIGN;
683 MAC_ASSIGN(sta_mac, mac);
684 __entry->idx = idx;
685 ),
686 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", station mac: " MAC_PR_FMT ", idx: %d",
687 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(sta_mac),
688 __entry->idx)
689);
690
691TRACE_EVENT(rdev_return_int_station_info,
692 TP_PROTO(struct wiphy *wiphy, int ret, struct station_info *sinfo),
693 TP_ARGS(wiphy, ret, sinfo),
694 TP_STRUCT__entry(
695 WIPHY_ENTRY
696 __field(int, ret)
697 SINFO_ENTRY
698 ),
699 TP_fast_assign(
700 WIPHY_ASSIGN;
701 __entry->ret = ret;
702 SINFO_ASSIGN;
703 ),
704 TP_printk(WIPHY_PR_FMT ", returned %d" ,
705 WIPHY_PR_ARG, __entry->ret)
706);
707
708DECLARE_EVENT_CLASS(mpath_evt,
709 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *dst,
710 u8 *next_hop),
711 TP_ARGS(wiphy, netdev, dst, next_hop),
712 TP_STRUCT__entry(
713 WIPHY_ENTRY
714 NETDEV_ENTRY
715 MAC_ENTRY(dst)
716 MAC_ENTRY(next_hop)
717 ),
718 TP_fast_assign(
719 WIPHY_ASSIGN;
720 NETDEV_ASSIGN;
721 MAC_ASSIGN(dst, dst);
722 MAC_ASSIGN(next_hop, next_hop);
723 ),
724 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", destination: " MAC_PR_FMT ", next hop: " MAC_PR_FMT,
725 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(dst),
726 MAC_PR_ARG(next_hop))
727);
728
729DEFINE_EVENT(mpath_evt, rdev_add_mpath,
730 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *dst,
731 u8 *next_hop),
732 TP_ARGS(wiphy, netdev, dst, next_hop)
733);
734
735DEFINE_EVENT(mpath_evt, rdev_change_mpath,
736 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *dst,
737 u8 *next_hop),
738 TP_ARGS(wiphy, netdev, dst, next_hop)
739);
740
741DEFINE_EVENT(mpath_evt, rdev_get_mpath,
742 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u8 *dst,
743 u8 *next_hop),
744 TP_ARGS(wiphy, netdev, dst, next_hop)
745);
746
747TRACE_EVENT(rdev_dump_mpath,
748 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int idx,
749 u8 *dst, u8 *next_hop),
750 TP_ARGS(wiphy, netdev, idx, dst, next_hop),
751 TP_STRUCT__entry(
752 WIPHY_ENTRY
753 NETDEV_ENTRY
754 MAC_ENTRY(dst)
755 MAC_ENTRY(next_hop)
756 __field(int, idx)
757 ),
758 TP_fast_assign(
759 WIPHY_ASSIGN;
760 NETDEV_ASSIGN;
761 MAC_ASSIGN(dst, dst);
762 MAC_ASSIGN(next_hop, next_hop);
763 __entry->idx = idx;
764 ),
765 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", index: %d, destination: "
766 MAC_PR_FMT ", next hop: " MAC_PR_FMT,
767 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->idx, MAC_PR_ARG(dst),
768 MAC_PR_ARG(next_hop))
769);
770
771TRACE_EVENT(rdev_return_int_mpath_info,
772 TP_PROTO(struct wiphy *wiphy, int ret, struct mpath_info *pinfo),
773 TP_ARGS(wiphy, ret, pinfo),
774 TP_STRUCT__entry(
775 WIPHY_ENTRY
776 __field(int, ret)
777 __field(int, generation)
778 __field(u32, filled)
779 __field(u32, frame_qlen)
780 __field(u32, sn)
781 __field(u32, metric)
782 __field(u32, exptime)
783 __field(u32, discovery_timeout)
784 __field(u8, discovery_retries)
785 __field(u8, flags)
786 ),
787 TP_fast_assign(
788 WIPHY_ASSIGN;
789 __entry->ret = ret;
790 __entry->generation = pinfo->generation;
791 __entry->filled = pinfo->filled;
792 __entry->frame_qlen = pinfo->frame_qlen;
793 __entry->sn = pinfo->sn;
794 __entry->metric = pinfo->metric;
795 __entry->exptime = pinfo->exptime;
796 __entry->discovery_timeout = pinfo->discovery_timeout;
797 __entry->discovery_retries = pinfo->discovery_retries;
798 __entry->flags = pinfo->flags;
799 ),
800 TP_printk(WIPHY_PR_FMT ", returned %d. mpath info - generation: %d, "
801 "filled: %u, frame qlen: %u, sn: %u, metric: %u, exptime: %u,"
802 " discovery timeout: %u, discovery retries: %u, flags: %u",
803 WIPHY_PR_ARG, __entry->ret, __entry->generation,
804 __entry->filled, __entry->frame_qlen, __entry->sn,
805 __entry->metric, __entry->exptime, __entry->discovery_timeout,
806 __entry->discovery_retries, __entry->flags)
807);
808
809TRACE_EVENT(rdev_return_int_mesh_config,
810 TP_PROTO(struct wiphy *wiphy, int ret, struct mesh_config *conf),
811 TP_ARGS(wiphy, ret, conf),
812 TP_STRUCT__entry(
813 WIPHY_ENTRY
814 MESH_CFG_ENTRY
815 __field(int, ret)
816 ),
817 TP_fast_assign(
818 WIPHY_ASSIGN;
819 MESH_CFG_ASSIGN;
820 __entry->ret = ret;
821 ),
822 TP_printk(WIPHY_PR_FMT ", returned: %d",
823 WIPHY_PR_ARG, __entry->ret)
824);
825
826TRACE_EVENT(rdev_update_mesh_config,
827 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 mask,
828 const struct mesh_config *conf),
829 TP_ARGS(wiphy, netdev, mask, conf),
830 TP_STRUCT__entry(
831 WIPHY_ENTRY
832 NETDEV_ENTRY
833 MESH_CFG_ENTRY
834 __field(u32, mask)
835 ),
836 TP_fast_assign(
837 WIPHY_ASSIGN;
838 NETDEV_ASSIGN;
839 MESH_CFG_ASSIGN;
840 __entry->mask = mask;
841 ),
842 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", mask: %u",
843 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->mask)
844);
845
846TRACE_EVENT(rdev_join_mesh,
847 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
848 const struct mesh_config *conf,
849 const struct mesh_setup *setup),
850 TP_ARGS(wiphy, netdev, conf, setup),
851 TP_STRUCT__entry(
852 WIPHY_ENTRY
853 NETDEV_ENTRY
854 MESH_CFG_ENTRY
855 ),
856 TP_fast_assign(
857 WIPHY_ASSIGN;
858 NETDEV_ASSIGN;
859 MESH_CFG_ASSIGN;
860 ),
861 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT,
862 WIPHY_PR_ARG, NETDEV_PR_ARG)
863);
864
865TRACE_EVENT(rdev_change_bss,
866 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
867 struct bss_parameters *params),
868 TP_ARGS(wiphy, netdev, params),
869 TP_STRUCT__entry(
870 WIPHY_ENTRY
871 NETDEV_ENTRY
872 __field(int, use_cts_prot)
873 __field(int, use_short_preamble)
874 __field(int, use_short_slot_time)
875 __field(int, ap_isolate)
876 __field(int, ht_opmode)
877 ),
878 TP_fast_assign(
879 WIPHY_ASSIGN;
880 NETDEV_ASSIGN;
881 __entry->use_cts_prot = params->use_cts_prot;
882 __entry->use_short_preamble = params->use_short_preamble;
883 __entry->use_short_slot_time = params->use_short_slot_time;
884 __entry->ap_isolate = params->ap_isolate;
885 __entry->ht_opmode = params->ht_opmode;
886 ),
887 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", use cts prot: %d, "
888 "use short preamble: %d, use short slot time: %d, "
889 "ap isolate: %d, ht opmode: %d",
890 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->use_cts_prot,
891 __entry->use_short_preamble, __entry->use_short_slot_time,
892 __entry->ap_isolate, __entry->ht_opmode)
893);
894
895TRACE_EVENT(rdev_set_txq_params,
896 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
897 struct ieee80211_txq_params *params),
898 TP_ARGS(wiphy, netdev, params),
899 TP_STRUCT__entry(
900 WIPHY_ENTRY
901 NETDEV_ENTRY
902 __field(enum nl80211_ac, ac)
903 __field(u16, txop)
904 __field(u16, cwmin)
905 __field(u16, cwmax)
906 __field(u8, aifs)
907 ),
908 TP_fast_assign(
909 WIPHY_ASSIGN;
910 NETDEV_ASSIGN;
911 __entry->ac = params->ac;
912 __entry->txop = params->txop;
913 __entry->cwmin = params->cwmin;
914 __entry->cwmax = params->cwmax;
915 __entry->aifs = params->aifs;
916 ),
917 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", ac: %d, txop: %u, cwmin: %u, cwmax: %u, aifs: %u",
918 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->ac, __entry->txop,
919 __entry->cwmin, __entry->cwmax, __entry->aifs)
920);
921
922TRACE_EVENT(rdev_libertas_set_mesh_channel,
923 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
924 struct ieee80211_channel *chan),
925 TP_ARGS(wiphy, netdev, chan),
926 TP_STRUCT__entry(
927 WIPHY_ENTRY
928 NETDEV_ENTRY
929 CHAN_ENTRY
930 ),
931 TP_fast_assign(
932 WIPHY_ASSIGN;
933 NETDEV_ASSIGN;
934 CHAN_ASSIGN(chan);
935 ),
936 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT CHAN_PR_FMT, WIPHY_PR_ARG,
937 NETDEV_PR_ARG, CHAN_PR_ARG)
938);
939
940TRACE_EVENT(rdev_set_monitor_channel,
941 TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *chan,
942 enum nl80211_channel_type chan_type),
943 TP_ARGS(wiphy, chan, chan_type),
944 TP_STRUCT__entry(
945 WIPHY_ENTRY
946 CHAN_ENTRY
947 __field(enum nl80211_channel_type, chan_type)
948 ),
949 TP_fast_assign(
950 WIPHY_ASSIGN;
951 CHAN_ASSIGN(chan);
952 __entry->chan_type = chan_type;
953 ),
954 TP_printk(WIPHY_PR_FMT CHAN_PR_FMT ", channel type : %d",
955 WIPHY_PR_ARG, CHAN_PR_ARG, __entry->chan_type)
956);
957
958TRACE_EVENT(rdev_auth,
959 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
960 struct cfg80211_auth_request *req),
961 TP_ARGS(wiphy, netdev, req),
962 TP_STRUCT__entry(
963 WIPHY_ENTRY
964 NETDEV_ENTRY
965 MAC_ENTRY(bssid)
966 __field(enum nl80211_auth_type, auth_type)
967 ),
968 TP_fast_assign(
969 WIPHY_ASSIGN;
970 NETDEV_ASSIGN;
971 if (req->bss)
972 MAC_ASSIGN(bssid, req->bss->bssid);
973 else
974 memset(__entry->bssid, 0, ETH_ALEN);
975 __entry->auth_type = req->auth_type;
976 ),
977 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", auth type: %d, bssid: " MAC_PR_FMT,
978 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->auth_type,
979 MAC_PR_ARG(bssid))
980);
981
982TRACE_EVENT(rdev_assoc,
983 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
984 struct cfg80211_assoc_request *req),
985 TP_ARGS(wiphy, netdev, req),
986 TP_STRUCT__entry(
987 WIPHY_ENTRY
988 NETDEV_ENTRY
989 MAC_ENTRY(bssid)
990 MAC_ENTRY(prev_bssid)
991 __field(bool, use_mfp)
992 __field(u32, flags)
993 ),
994 TP_fast_assign(
995 WIPHY_ASSIGN;
996 NETDEV_ASSIGN;
997 if (req->bss)
998 MAC_ASSIGN(bssid, req->bss->bssid);
999 else
1000 memset(__entry->bssid, 0, ETH_ALEN);
1001 MAC_ASSIGN(prev_bssid, req->prev_bssid);
1002 __entry->use_mfp = req->use_mfp;
1003 __entry->flags = req->flags;
1004 ),
1005 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT
1006 ", previous bssid: " MAC_PR_FMT ", use mfp: %s, flags: %u",
1007 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid),
1008 MAC_PR_ARG(prev_bssid), BOOL_TO_STR(__entry->use_mfp),
1009 __entry->flags)
1010);
1011
1012TRACE_EVENT(rdev_deauth,
1013 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1014 struct cfg80211_deauth_request *req),
1015 TP_ARGS(wiphy, netdev, req),
1016 TP_STRUCT__entry(
1017 WIPHY_ENTRY
1018 NETDEV_ENTRY
1019 MAC_ENTRY(bssid)
1020 __field(u16, reason_code)
1021 ),
1022 TP_fast_assign(
1023 WIPHY_ASSIGN;
1024 NETDEV_ASSIGN;
1025 MAC_ASSIGN(bssid, req->bssid);
1026 __entry->reason_code = req->reason_code;
1027 ),
1028 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT ", reason: %u",
1029 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid),
1030 __entry->reason_code)
1031);
1032
1033TRACE_EVENT(rdev_disassoc,
1034 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1035 struct cfg80211_disassoc_request *req),
1036 TP_ARGS(wiphy, netdev, req),
1037 TP_STRUCT__entry(
1038 WIPHY_ENTRY
1039 NETDEV_ENTRY
1040 MAC_ENTRY(bssid)
1041 __field(u16, reason_code)
1042 __field(bool, local_state_change)
1043 ),
1044 TP_fast_assign(
1045 WIPHY_ASSIGN;
1046 NETDEV_ASSIGN;
1047 if (req->bss)
1048 MAC_ASSIGN(bssid, req->bss->bssid);
1049 else
1050 memset(__entry->bssid, 0, ETH_ALEN);
1051 __entry->reason_code = req->reason_code;
1052 __entry->local_state_change = req->local_state_change;
1053 ),
1054 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT
1055 ", reason: %u, local state change: %s",
1056 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid),
1057 __entry->reason_code,
1058 BOOL_TO_STR(__entry->local_state_change))
1059);
1060
1061TRACE_EVENT(rdev_mgmt_tx_cancel_wait,
1062 TP_PROTO(struct wiphy *wiphy,
1063 struct wireless_dev *wdev, u64 cookie),
1064 TP_ARGS(wiphy, wdev, cookie),
1065 TP_STRUCT__entry(
1066 WIPHY_ENTRY
1067 WDEV_ENTRY
1068 __field(u64, cookie)
1069 ),
1070 TP_fast_assign(
1071 WIPHY_ASSIGN;
1072 WDEV_ASSIGN;
1073 __entry->cookie = cookie;
1074 ),
1075 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT ", cookie: %llu ",
1076 WIPHY_PR_ARG, WDEV_PR_ARG, __entry->cookie)
1077);
1078
1079TRACE_EVENT(rdev_set_power_mgmt,
1080 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1081 bool enabled, int timeout),
1082 TP_ARGS(wiphy, netdev, enabled, timeout),
1083 TP_STRUCT__entry(
1084 WIPHY_ENTRY
1085 NETDEV_ENTRY
1086 __field(bool, enabled)
1087 __field(int, timeout)
1088 ),
1089 TP_fast_assign(
1090 WIPHY_ASSIGN;
1091 NETDEV_ASSIGN;
1092 __entry->enabled = enabled;
1093 __entry->timeout = timeout;
1094 ),
1095 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", %senabled, timeout: %d ",
1096 WIPHY_PR_ARG, NETDEV_PR_ARG,
1097 __entry->enabled ? "" : "not ", __entry->timeout)
1098);
1099
1100TRACE_EVENT(rdev_connect,
1101 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1102 struct cfg80211_connect_params *sme),
1103 TP_ARGS(wiphy, netdev, sme),
1104 TP_STRUCT__entry(
1105 WIPHY_ENTRY
1106 NETDEV_ENTRY
1107 MAC_ENTRY(bssid)
1108 __array(char, ssid, IEEE80211_MAX_SSID_LEN + 1)
1109 __field(enum nl80211_auth_type, auth_type)
1110 __field(bool, privacy)
1111 __field(u32, wpa_versions)
1112 __field(u32, flags)
1113 ),
1114 TP_fast_assign(
1115 WIPHY_ASSIGN;
1116 NETDEV_ASSIGN;
1117 MAC_ASSIGN(bssid, sme->bssid);
1118 memset(__entry->ssid, 0, IEEE80211_MAX_SSID_LEN + 1);
1119 memcpy(__entry->ssid, sme->ssid, sme->ssid_len);
1120 __entry->auth_type = sme->auth_type;
1121 __entry->privacy = sme->privacy;
1122 __entry->wpa_versions = sme->crypto.wpa_versions;
1123 __entry->flags = sme->flags;
1124 ),
1125 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT
1126 ", ssid: %s, auth type: %d, privacy: %s, wpa versions: %u, "
1127 "flags: %u",
1128 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->ssid,
1129 __entry->auth_type, BOOL_TO_STR(__entry->privacy),
1130 __entry->wpa_versions, __entry->flags)
1131);
1132
1133TRACE_EVENT(rdev_set_cqm_rssi_config,
1134 TP_PROTO(struct wiphy *wiphy,
1135 struct net_device *netdev, s32 rssi_thold,
1136 u32 rssi_hyst),
1137 TP_ARGS(wiphy, netdev, rssi_thold, rssi_hyst),
1138 TP_STRUCT__entry(
1139 WIPHY_ENTRY
1140 NETDEV_ENTRY
1141 __field(s32, rssi_thold)
1142 __field(u32, rssi_hyst)
1143 ),
1144 TP_fast_assign(
1145 WIPHY_ASSIGN;
1146 NETDEV_ASSIGN;
1147 __entry->rssi_thold = rssi_thold;
1148 __entry->rssi_hyst = rssi_hyst;
1149 ),
1150 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT
1151 ", rssi_thold: %d, rssi_hyst: %u ",
1152 WIPHY_PR_ARG, NETDEV_PR_ARG,
1153 __entry->rssi_thold, __entry->rssi_hyst)
1154);
1155
1156TRACE_EVENT(rdev_set_cqm_txe_config,
1157 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 rate,
1158 u32 pkts, u32 intvl),
1159 TP_ARGS(wiphy, netdev, rate, pkts, intvl),
1160 TP_STRUCT__entry(
1161 WIPHY_ENTRY
1162 NETDEV_ENTRY
1163 __field(u32, rate)
1164 __field(u32, pkts)
1165 __field(u32, intvl)
1166 ),
1167 TP_fast_assign(
1168 WIPHY_ASSIGN;
1169 NETDEV_ASSIGN;
1170 __entry->rate = rate;
1171 __entry->pkts = pkts;
1172 __entry->intvl = intvl;
1173 ),
1174 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", rate: %u, packets: %u, interval: %u",
1175 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->rate, __entry->pkts,
1176 __entry->intvl)
1177);
1178
1179TRACE_EVENT(rdev_disconnect,
1180 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1181 u16 reason_code),
1182 TP_ARGS(wiphy, netdev, reason_code),
1183 TP_STRUCT__entry(
1184 WIPHY_ENTRY
1185 NETDEV_ENTRY
1186 __field(u16, reason_code)
1187 ),
1188 TP_fast_assign(
1189 WIPHY_ASSIGN;
1190 NETDEV_ASSIGN;
1191 __entry->reason_code = reason_code;
1192 ),
1193 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", reason code: %u", WIPHY_PR_ARG,
1194 NETDEV_PR_ARG, __entry->reason_code)
1195);
1196
1197TRACE_EVENT(rdev_join_ibss,
1198 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1199 struct cfg80211_ibss_params *params),
1200 TP_ARGS(wiphy, netdev, params),
1201 TP_STRUCT__entry(
1202 WIPHY_ENTRY
1203 NETDEV_ENTRY
1204 MAC_ENTRY(bssid)
1205 __array(char, ssid, IEEE80211_MAX_SSID_LEN + 1)
1206 ),
1207 TP_fast_assign(
1208 WIPHY_ASSIGN;
1209 NETDEV_ASSIGN;
1210 MAC_ASSIGN(bssid, params->bssid);
1211 memset(__entry->ssid, 0, IEEE80211_MAX_SSID_LEN + 1);
1212 memcpy(__entry->ssid, params->ssid, params->ssid_len);
1213 ),
1214 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT ", ssid: %s",
1215 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid), __entry->ssid)
1216);
1217
1218TRACE_EVENT(rdev_set_wiphy_params,
1219 TP_PROTO(struct wiphy *wiphy, u32 changed),
1220 TP_ARGS(wiphy, changed),
1221 TP_STRUCT__entry(
1222 WIPHY_ENTRY
1223 __field(u32, changed)
1224 ),
1225 TP_fast_assign(
1226 WIPHY_ASSIGN;
1227 __entry->changed = changed;
1228 ),
1229 TP_printk(WIPHY_PR_FMT ", changed: %u",
1230 WIPHY_PR_ARG, __entry->changed)
1231);
1232
1233TRACE_EVENT(rdev_set_tx_power,
1234 TP_PROTO(struct wiphy *wiphy, enum nl80211_tx_power_setting type,
1235 int mbm),
1236 TP_ARGS(wiphy, type, mbm),
1237 TP_STRUCT__entry(
1238 WIPHY_ENTRY
1239 __field(enum nl80211_tx_power_setting, type)
1240 __field(int, mbm)
1241 ),
1242 TP_fast_assign(
1243 WIPHY_ASSIGN;
1244 __entry->type = type;
1245 __entry->mbm = mbm;
1246 ),
1247 TP_printk(WIPHY_PR_FMT ", type: %d, mbm: %d",
1248 WIPHY_PR_ARG, __entry->type, __entry->mbm)
1249);
1250
1251TRACE_EVENT(rdev_return_int_int,
1252 TP_PROTO(struct wiphy *wiphy, int func_ret, int func_fill),
1253 TP_ARGS(wiphy, func_ret, func_fill),
1254 TP_STRUCT__entry(
1255 WIPHY_ENTRY
1256 __field(int, func_ret)
1257 __field(int, func_fill)
1258 ),
1259 TP_fast_assign(
1260 WIPHY_ASSIGN;
1261 __entry->func_ret = func_ret;
1262 __entry->func_fill = func_fill;
1263 ),
1264 TP_printk(WIPHY_PR_FMT ", function returns: %d, function filled: %d",
1265 WIPHY_PR_ARG, __entry->func_ret, __entry->func_fill)
1266);
1267
1268#ifdef CONFIG_NL80211_TESTMODE
1269TRACE_EVENT(rdev_testmode_cmd,
1270 TP_PROTO(struct wiphy *wiphy),
1271 TP_ARGS(wiphy),
1272 TP_STRUCT__entry(
1273 WIPHY_ENTRY
1274 ),
1275 TP_fast_assign(
1276 WIPHY_ASSIGN;
1277 ),
1278 TP_printk(WIPHY_PR_FMT, WIPHY_PR_ARG)
1279);
1280
1281TRACE_EVENT(rdev_testmode_dump,
1282 TP_PROTO(struct wiphy *wiphy),
1283 TP_ARGS(wiphy),
1284 TP_STRUCT__entry(
1285 WIPHY_ENTRY
1286 ),
1287 TP_fast_assign(
1288 WIPHY_ASSIGN;
1289 ),
1290 TP_printk(WIPHY_PR_FMT, WIPHY_PR_ARG)
1291);
1292#endif /* CONFIG_NL80211_TESTMODE */
1293
1294TRACE_EVENT(rdev_set_bitrate_mask,
1295 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1296 const u8 *peer, const struct cfg80211_bitrate_mask *mask),
1297 TP_ARGS(wiphy, netdev, peer, mask),
1298 TP_STRUCT__entry(
1299 WIPHY_ENTRY
1300 NETDEV_ENTRY
1301 MAC_ENTRY(peer)
1302 ),
1303 TP_fast_assign(
1304 WIPHY_ASSIGN;
1305 NETDEV_ASSIGN;
1306 MAC_ASSIGN(peer, peer);
1307 ),
1308 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", peer: " MAC_PR_FMT,
1309 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer))
1310);
1311
1312TRACE_EVENT(rdev_mgmt_frame_register,
1313 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
1314 u16 frame_type, bool reg),
1315 TP_ARGS(wiphy, wdev, frame_type, reg),
1316 TP_STRUCT__entry(
1317 WIPHY_ENTRY
1318 WDEV_ENTRY
1319 __field(u16, frame_type)
1320 __field(bool, reg)
1321 ),
1322 TP_fast_assign(
1323 WIPHY_ASSIGN;
1324 WDEV_ASSIGN;
1325 __entry->frame_type = frame_type;
1326 __entry->reg = reg;
1327 ),
1328 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT ", frame_type: %u, reg: %s ",
1329 WIPHY_PR_ARG, WDEV_PR_ARG, __entry->frame_type,
1330 __entry->reg ? "true" : "false")
1331);
1332
1333TRACE_EVENT(rdev_return_int_tx_rx,
1334 TP_PROTO(struct wiphy *wiphy, int ret, u32 tx, u32 rx),
1335 TP_ARGS(wiphy, ret, tx, rx),
1336 TP_STRUCT__entry(
1337 WIPHY_ENTRY
1338 __field(int, ret)
1339 __field(u32, tx)
1340 __field(u32, rx)
1341 ),
1342 TP_fast_assign(
1343 WIPHY_ASSIGN;
1344 __entry->ret = ret;
1345 __entry->tx = tx;
1346 __entry->rx = rx;
1347 ),
1348 TP_printk(WIPHY_PR_FMT ", returned %d, tx: %u, rx: %u",
1349 WIPHY_PR_ARG, __entry->ret, __entry->tx, __entry->rx)
1350);
1351
1352TRACE_EVENT(rdev_return_void_tx_rx,
1353 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 tx_max,
1354 u32 rx, u32 rx_max),
1355 TP_ARGS(wiphy, tx, tx_max, rx, rx_max),
1356 TP_STRUCT__entry(
1357 WIPHY_ENTRY
1358 __field(u32, tx)
1359 __field(u32, tx_max)
1360 __field(u32, rx)
1361 __field(u32, rx_max)
1362 ),
1363 TP_fast_assign(
1364 WIPHY_ASSIGN;
1365 __entry->tx = tx;
1366 __entry->tx_max = tx_max;
1367 __entry->rx = rx;
1368 __entry->rx_max = rx_max;
1369 ),
1370 TP_printk(WIPHY_PR_FMT ", tx: %u, tx_max: %u, rx: %u, rx_max: %u ",
1371 WIPHY_PR_ARG, __entry->tx, __entry->tx_max, __entry->rx,
1372 __entry->rx_max)
1373);
1374
1375DECLARE_EVENT_CLASS(tx_rx_evt,
1376 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
1377 TP_ARGS(wiphy, rx, tx),
1378 TP_STRUCT__entry(
1379 WIPHY_ENTRY
1380 __field(u32, tx)
1381 __field(u32, rx)
1382 ),
1383 TP_fast_assign(
1384 WIPHY_ASSIGN;
1385 __entry->tx = tx;
1386 __entry->rx = rx;
1387 ),
1388 TP_printk(WIPHY_PR_FMT ", tx: %u, rx: %u ",
1389 WIPHY_PR_ARG, __entry->tx, __entry->rx)
1390);
1391
1392DEFINE_EVENT(tx_rx_evt, rdev_set_ringparam,
1393 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
1394 TP_ARGS(wiphy, rx, tx)
1395);
1396
1397DEFINE_EVENT(tx_rx_evt, rdev_set_antenna,
1398 TP_PROTO(struct wiphy *wiphy, u32 tx, u32 rx),
1399 TP_ARGS(wiphy, rx, tx)
1400);
1401
1402TRACE_EVENT(rdev_sched_scan_start,
1403 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1404 struct cfg80211_sched_scan_request *request),
1405 TP_ARGS(wiphy, netdev, request),
1406 TP_STRUCT__entry(
1407 WIPHY_ENTRY
1408 NETDEV_ENTRY
1409 ),
1410 TP_fast_assign(
1411 WIPHY_ASSIGN;
1412 NETDEV_ASSIGN;
1413 ),
1414 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT,
1415 WIPHY_PR_ARG, NETDEV_PR_ARG)
1416);
1417
1418TRACE_EVENT(rdev_tdls_mgmt,
1419 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1420 u8 *peer, u8 action_code, u8 dialog_token,
1421 u16 status_code, const u8 *buf, size_t len),
1422 TP_ARGS(wiphy, netdev, peer, action_code, dialog_token, status_code,
1423 buf, len),
1424 TP_STRUCT__entry(
1425 WIPHY_ENTRY
1426 NETDEV_ENTRY
1427 MAC_ENTRY(peer)
1428 __field(u8, action_code)
1429 __field(u8, dialog_token)
1430 __field(u16, status_code)
1431 __dynamic_array(u8, buf, len)
1432 ),
1433 TP_fast_assign(
1434 WIPHY_ASSIGN;
1435 NETDEV_ASSIGN;
1436 MAC_ASSIGN(peer, peer);
1437 __entry->action_code = action_code;
1438 __entry->dialog_token = dialog_token;
1439 __entry->status_code = status_code;
1440 memcpy(__get_dynamic_array(buf), buf, len);
1441 ),
1442 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT MAC_PR_FMT ", action_code: %u, "
1443 "dialog_token: %u, status_code: %u, buf: %#.2x ",
1444 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer),
1445 __entry->action_code, __entry->dialog_token,
1446 __entry->status_code, ((u8 *)__get_dynamic_array(buf))[0])
1447);
1448
1449TRACE_EVENT(rdev_dump_survey,
1450 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int idx),
1451 TP_ARGS(wiphy, netdev, idx),
1452 TP_STRUCT__entry(
1453 WIPHY_ENTRY
1454 NETDEV_ENTRY
1455 __field(int, idx)
1456 ),
1457 TP_fast_assign(
1458 WIPHY_ASSIGN;
1459 NETDEV_ASSIGN;
1460 __entry->idx = idx;
1461 ),
1462 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", index: %d",
1463 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->idx)
1464);
1465
1466TRACE_EVENT(rdev_return_int_survey_info,
1467 TP_PROTO(struct wiphy *wiphy, int ret, struct survey_info *info),
1468 TP_ARGS(wiphy, ret, info),
1469 TP_STRUCT__entry(
1470 WIPHY_ENTRY
1471 CHAN_ENTRY
1472 __field(int, ret)
1473 __field(u64, channel_time)
1474 __field(u64, channel_time_busy)
1475 __field(u64, channel_time_ext_busy)
1476 __field(u64, channel_time_rx)
1477 __field(u64, channel_time_tx)
1478 __field(u32, filled)
1479 __field(s8, noise)
1480 ),
1481 TP_fast_assign(
1482 WIPHY_ASSIGN;
1483 CHAN_ASSIGN(info->channel);
1484 __entry->ret = ret;
1485 __entry->channel_time = info->channel_time;
1486 __entry->channel_time_busy = info->channel_time_busy;
1487 __entry->channel_time_ext_busy = info->channel_time_ext_busy;
1488 __entry->channel_time_rx = info->channel_time_rx;
1489 __entry->channel_time_tx = info->channel_time_tx;
1490 __entry->filled = info->filled;
1491 __entry->noise = info->noise;
1492 ),
1493 TP_printk(WIPHY_PR_FMT ", returned: %d, " CHAN_PR_FMT
1494 ", channel time: %llu, channel time busy: %llu, "
1495 "channel time extension busy: %llu, channel time rx: %llu, "
1496 "channel time tx: %llu, filled: %u, noise: %d",
1497 WIPHY_PR_ARG, __entry->ret, CHAN_PR_ARG,
1498 __entry->channel_time, __entry->channel_time_busy,
1499 __entry->channel_time_ext_busy, __entry->channel_time_rx,
1500 __entry->channel_time_tx, __entry->filled, __entry->noise)
1501);
1502
1503TRACE_EVENT(rdev_tdls_oper,
1504 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1505 u8 *peer, enum nl80211_tdls_operation oper),
1506 TP_ARGS(wiphy, netdev, peer, oper),
1507 TP_STRUCT__entry(
1508 WIPHY_ENTRY
1509 NETDEV_ENTRY
1510 MAC_ENTRY(peer)
1511 __field(enum nl80211_tdls_operation, oper)
1512 ),
1513 TP_fast_assign(
1514 WIPHY_ASSIGN;
1515 NETDEV_ASSIGN;
1516 MAC_ASSIGN(peer, peer);
1517 __entry->oper = oper;
1518 ),
1519 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT MAC_PR_FMT ", oper: %d",
1520 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->oper)
1521);
1522
1523DECLARE_EVENT_CLASS(rdev_pmksa,
1524 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1525 struct cfg80211_pmksa *pmksa),
1526 TP_ARGS(wiphy, netdev, pmksa),
1527 TP_STRUCT__entry(
1528 WIPHY_ENTRY
1529 NETDEV_ENTRY
1530 MAC_ENTRY(bssid)
1531 ),
1532 TP_fast_assign(
1533 WIPHY_ASSIGN;
1534 NETDEV_ASSIGN;
1535 MAC_ASSIGN(bssid, pmksa->bssid);
1536 ),
1537 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", bssid: " MAC_PR_FMT,
1538 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(bssid))
1539);
1540
1541TRACE_EVENT(rdev_probe_client,
1542 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1543 const u8 *peer),
1544 TP_ARGS(wiphy, netdev, peer),
1545 TP_STRUCT__entry(
1546 WIPHY_ENTRY
1547 NETDEV_ENTRY
1548 MAC_ENTRY(peer)
1549 ),
1550 TP_fast_assign(
1551 WIPHY_ASSIGN;
1552 NETDEV_ASSIGN;
1553 MAC_ASSIGN(peer, peer);
1554 ),
1555 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT MAC_PR_FMT,
1556 WIPHY_PR_ARG, NETDEV_PR_ARG, MAC_PR_ARG(peer))
1557);
1558
1559DEFINE_EVENT(rdev_pmksa, rdev_set_pmksa,
1560 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1561 struct cfg80211_pmksa *pmksa),
1562 TP_ARGS(wiphy, netdev, pmksa)
1563);
1564
1565DEFINE_EVENT(rdev_pmksa, rdev_del_pmksa,
1566 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1567 struct cfg80211_pmksa *pmksa),
1568 TP_ARGS(wiphy, netdev, pmksa)
1569);
1570
1571TRACE_EVENT(rdev_remain_on_channel,
1572 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
1573 struct ieee80211_channel *chan,
1574 enum nl80211_channel_type channel_type, unsigned int duration),
1575 TP_ARGS(wiphy, wdev, chan, channel_type, duration),
1576 TP_STRUCT__entry(
1577 WIPHY_ENTRY
1578 WDEV_ENTRY
1579 CHAN_ENTRY
1580 __field(enum nl80211_channel_type, channel_type)
1581 __field(unsigned int, duration)
1582 ),
1583 TP_fast_assign(
1584 WIPHY_ASSIGN;
1585 WDEV_ASSIGN;
1586 CHAN_ASSIGN(chan);
1587 __entry->channel_type = channel_type;
1588 __entry->duration = duration;
1589 ),
1590 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", channel type: %d, duration: %u",
1591 WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG, __entry->channel_type,
1592 __entry->duration)
1593);
1594
1595TRACE_EVENT(rdev_return_int_cookie,
1596 TP_PROTO(struct wiphy *wiphy, int ret, u64 cookie),
1597 TP_ARGS(wiphy, ret, cookie),
1598 TP_STRUCT__entry(
1599 WIPHY_ENTRY
1600 __field(int, ret)
1601 __field(u64, cookie)
1602 ),
1603 TP_fast_assign(
1604 WIPHY_ASSIGN;
1605 __entry->ret = ret;
1606 __entry->cookie = cookie;
1607 ),
1608 TP_printk(WIPHY_PR_FMT ", returned %d, cookie: %llu",
1609 WIPHY_PR_ARG, __entry->ret, __entry->cookie)
1610);
1611
1612TRACE_EVENT(rdev_cancel_remain_on_channel,
1613 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev, u64 cookie),
1614 TP_ARGS(wiphy, wdev, cookie),
1615 TP_STRUCT__entry(
1616 WIPHY_ENTRY
1617 WDEV_ENTRY
1618 __field(u64, cookie)
1619 ),
1620 TP_fast_assign(
1621 WIPHY_ASSIGN;
1622 WDEV_ASSIGN;
1623 __entry->cookie = cookie;
1624 ),
1625 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT ", cookie: %llu",
1626 WIPHY_PR_ARG, WDEV_PR_ARG, __entry->cookie)
1627);
1628
1629TRACE_EVENT(rdev_mgmt_tx,
1630 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev,
1631 struct ieee80211_channel *chan, bool offchan,
1632 enum nl80211_channel_type channel_type,
1633 bool channel_type_valid, unsigned int wait, bool no_cck,
1634 bool dont_wait_for_ack),
1635 TP_ARGS(wiphy, wdev, chan, offchan, channel_type, channel_type_valid,
1636 wait, no_cck, dont_wait_for_ack),
1637 TP_STRUCT__entry(
1638 WIPHY_ENTRY
1639 WDEV_ENTRY
1640 CHAN_ENTRY
1641 __field(bool, offchan)
1642 __field(enum nl80211_channel_type, channel_type)
1643 __field(bool, channel_type_valid)
1644 __field(unsigned int, wait)
1645 __field(bool, no_cck)
1646 __field(bool, dont_wait_for_ack)
1647 ),
1648 TP_fast_assign(
1649 WIPHY_ASSIGN;
1650 WDEV_ASSIGN;
1651 CHAN_ASSIGN(chan);
1652 __entry->offchan = offchan;
1653 __entry->channel_type = channel_type;
1654 __entry->channel_type_valid = channel_type_valid;
1655 __entry->wait = wait;
1656 __entry->no_cck = no_cck;
1657 __entry->dont_wait_for_ack = dont_wait_for_ack;
1658 ),
1659 TP_printk(WIPHY_PR_FMT WDEV_PR_FMT CHAN_PR_FMT ", offchan: %s, "
1660 "channel type: %d, channel type valid: %s, wait: %u, "
1661 "no cck: %s, dont wait for ack: %s",
1662 WIPHY_PR_ARG, WDEV_PR_ARG, CHAN_PR_ARG,
1663 BOOL_TO_STR(__entry->offchan), __entry->channel_type,
1664 BOOL_TO_STR(__entry->channel_type_valid), __entry->wait,
1665 BOOL_TO_STR(__entry->no_cck),
1666 BOOL_TO_STR(__entry->dont_wait_for_ack))
1667);
1668
1669TRACE_EVENT(rdev_set_noack_map,
1670 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev,
1671 u16 noack_map),
1672 TP_ARGS(wiphy, netdev, noack_map),
1673 TP_STRUCT__entry(
1674 WIPHY_ENTRY
1675 NETDEV_ENTRY
1676 __field(u16, noack_map)
1677 ),
1678 TP_fast_assign(
1679 WIPHY_ASSIGN;
1680 NETDEV_ASSIGN;
1681 __entry->noack_map = noack_map;
1682 ),
1683 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", noack_map: %u",
1684 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->noack_map)
1685);
1686
1687TRACE_EVENT(rdev_get_et_sset_count,
1688 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, int sset),
1689 TP_ARGS(wiphy, netdev, sset),
1690 TP_STRUCT__entry(
1691 WIPHY_ENTRY
1692 NETDEV_ENTRY
1693 __field(int, sset)
1694 ),
1695 TP_fast_assign(
1696 WIPHY_ASSIGN;
1697 NETDEV_ASSIGN;
1698 __entry->sset = sset;
1699 ),
1700 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", sset: %d",
1701 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
1702);
1703
1704TRACE_EVENT(rdev_get_et_strings,
1705 TP_PROTO(struct wiphy *wiphy, struct net_device *netdev, u32 sset),
1706 TP_ARGS(wiphy, netdev, sset),
1707 TP_STRUCT__entry(
1708 WIPHY_ENTRY
1709 NETDEV_ENTRY
1710 __field(u32, sset)
1711 ),
1712 TP_fast_assign(
1713 WIPHY_ASSIGN;
1714 NETDEV_ASSIGN;
1715 __entry->sset = sset;
1716 ),
1717 TP_printk(WIPHY_PR_FMT NETDEV_PR_FMT ", sset: %u",
1718 WIPHY_PR_ARG, NETDEV_PR_ARG, __entry->sset)
1719);
1720
1721DEFINE_EVENT(wiphy_wdev_evt, rdev_get_channel,
1722 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
1723 TP_ARGS(wiphy, wdev)
1724);
1725
1726TRACE_EVENT(rdev_return_channel,
1727 TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *chan,
1728 enum nl80211_channel_type type),
1729 TP_ARGS(wiphy, chan, type),
1730 TP_STRUCT__entry(
1731 WIPHY_ENTRY
1732 CHAN_ENTRY
1733 __field(enum nl80211_channel_type, type)
1734 ),
1735 TP_fast_assign(
1736 WIPHY_ASSIGN;
1737 CHAN_ASSIGN(chan);
1738 __entry->type = type;
1739 ),
1740 TP_printk(WIPHY_PR_FMT CHAN_PR_FMT ", channel type: %d",
1741 WIPHY_PR_ARG, CHAN_PR_ARG, __entry->type)
1742);
1743
1744DEFINE_EVENT(wiphy_wdev_evt, rdev_start_p2p_device,
1745 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
1746 TP_ARGS(wiphy, wdev)
1747);
1748
1749DEFINE_EVENT(wiphy_wdev_evt, rdev_stop_p2p_device,
1750 TP_PROTO(struct wiphy *wiphy, struct wireless_dev *wdev),
1751 TP_ARGS(wiphy, wdev)
1752);
1753
1754/*************************************************************
1755 * cfg80211 exported functions traces *
1756 *************************************************************/
1757
1758TRACE_EVENT(cfg80211_return_bool,
1759 TP_PROTO(bool ret),
1760 TP_ARGS(ret),
1761 TP_STRUCT__entry(
1762 __field(bool, ret)
1763 ),
1764 TP_fast_assign(
1765 __entry->ret = ret;
1766 ),
1767 TP_printk("returned %s", BOOL_TO_STR(__entry->ret))
1768);
1769
1770DECLARE_EVENT_CLASS(cfg80211_netdev_mac_evt,
1771 TP_PROTO(struct net_device *netdev, const u8 *macaddr),
1772 TP_ARGS(netdev, macaddr),
1773 TP_STRUCT__entry(
1774 NETDEV_ENTRY
1775 MAC_ENTRY(macaddr)
1776 ),
1777 TP_fast_assign(
1778 NETDEV_ASSIGN;
1779 MAC_ASSIGN(macaddr, macaddr);
1780 ),
1781 TP_printk(NETDEV_PR_FMT ", mac: " MAC_PR_FMT,
1782 NETDEV_PR_ARG, MAC_PR_ARG(macaddr))
1783);
1784
1785DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_notify_new_peer_candidate,
1786 TP_PROTO(struct net_device *netdev, const u8 *macaddr),
1787 TP_ARGS(netdev, macaddr)
1788);
1789
1790DECLARE_EVENT_CLASS(netdev_evt_only,
1791 TP_PROTO(struct net_device *netdev),
1792 TP_ARGS(netdev),
1793 TP_STRUCT__entry(
1794 NETDEV_ENTRY
1795 ),
1796 TP_fast_assign(
1797 NETDEV_ASSIGN;
1798 ),
1799 TP_printk(NETDEV_PR_FMT , NETDEV_PR_ARG)
1800);
1801
1802DEFINE_EVENT(netdev_evt_only, cfg80211_send_rx_auth,
1803 TP_PROTO(struct net_device *netdev),
1804 TP_ARGS(netdev)
1805);
1806
1807TRACE_EVENT(cfg80211_send_rx_assoc,
1808 TP_PROTO(struct net_device *netdev, struct cfg80211_bss *bss),
1809 TP_ARGS(netdev, bss),
1810 TP_STRUCT__entry(
1811 NETDEV_ENTRY
1812 MAC_ENTRY(bssid)
1813 CHAN_ENTRY
1814 ),
1815 TP_fast_assign(
1816 NETDEV_ASSIGN;
1817 MAC_ASSIGN(bssid, bss->bssid);
1818 CHAN_ASSIGN(bss->channel);
1819 ),
1820 TP_printk(NETDEV_PR_FMT MAC_PR_FMT CHAN_PR_FMT,
1821 NETDEV_PR_ARG, MAC_PR_ARG(bssid), CHAN_PR_ARG)
1822);
1823
1824DEFINE_EVENT(netdev_evt_only, __cfg80211_send_deauth,
1825 TP_PROTO(struct net_device *netdev),
1826 TP_ARGS(netdev)
1827);
1828
1829DEFINE_EVENT(netdev_evt_only, __cfg80211_send_disassoc,
1830 TP_PROTO(struct net_device *netdev),
1831 TP_ARGS(netdev)
1832);
1833
1834DEFINE_EVENT(netdev_evt_only, cfg80211_send_unprot_deauth,
1835 TP_PROTO(struct net_device *netdev),
1836 TP_ARGS(netdev)
1837);
1838
1839DEFINE_EVENT(netdev_evt_only, cfg80211_send_unprot_disassoc,
1840 TP_PROTO(struct net_device *netdev),
1841 TP_ARGS(netdev)
1842);
1843
1844DECLARE_EVENT_CLASS(netdev_mac_evt,
1845 TP_PROTO(struct net_device *netdev, const u8 *mac),
1846 TP_ARGS(netdev, mac),
1847 TP_STRUCT__entry(
1848 NETDEV_ENTRY
1849 MAC_ENTRY(mac)
1850 ),
1851 TP_fast_assign(
1852 NETDEV_ASSIGN;
1853 MAC_ASSIGN(mac, mac)
1854 ),
1855 TP_printk(NETDEV_PR_FMT ", mac: " MAC_PR_FMT,
1856 NETDEV_PR_ARG, MAC_PR_ARG(mac))
1857);
1858
1859DEFINE_EVENT(netdev_mac_evt, cfg80211_send_auth_timeout,
1860 TP_PROTO(struct net_device *netdev, const u8 *mac),
1861 TP_ARGS(netdev, mac)
1862);
1863
1864DEFINE_EVENT(netdev_mac_evt, cfg80211_send_assoc_timeout,
1865 TP_PROTO(struct net_device *netdev, const u8 *mac),
1866 TP_ARGS(netdev, mac)
1867);
1868
1869TRACE_EVENT(cfg80211_michael_mic_failure,
1870 TP_PROTO(struct net_device *netdev, const u8 *addr,
1871 enum nl80211_key_type key_type, int key_id, const u8 *tsc),
1872 TP_ARGS(netdev, addr, key_type, key_id, tsc),
1873 TP_STRUCT__entry(
1874 NETDEV_ENTRY
1875 MAC_ENTRY(addr)
1876 __field(enum nl80211_key_type, key_type)
1877 __field(int, key_id)
1878 __array(u8, tsc, 6)
1879 ),
1880 TP_fast_assign(
1881 NETDEV_ASSIGN;
1882 MAC_ASSIGN(addr, addr);
1883 __entry->key_type = key_type;
1884 __entry->key_id = key_id;
1885 memcpy(__entry->tsc, tsc, 6);
1886 ),
1887 TP_printk(NETDEV_PR_FMT MAC_PR_FMT ", key type: %d, key id: %d, tsc: %pm",
1888 NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->key_type,
1889 __entry->key_id, __entry->tsc)
1890);
1891
1892TRACE_EVENT(cfg80211_ready_on_channel,
1893 TP_PROTO(struct wireless_dev *wdev, u64 cookie,
1894 struct ieee80211_channel *chan,
1895 enum nl80211_channel_type channel_type, unsigned int duration),
1896 TP_ARGS(wdev, cookie, chan, channel_type, duration),
1897 TP_STRUCT__entry(
1898 WDEV_ENTRY
1899 __field(u64, cookie)
1900 CHAN_ENTRY
1901 __field(enum nl80211_channel_type, channel_type)
1902 __field(unsigned int, duration)
1903 ),
1904 TP_fast_assign(
1905 WDEV_ASSIGN;
1906 __entry->cookie = cookie;
1907 CHAN_ASSIGN(chan);
1908 __entry->channel_type = channel_type;
1909 __entry->duration = duration;
1910 ),
1911 TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", channel type: %d, duration: %u",
1912 WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG,
1913 __entry->channel_type, __entry->duration)
1914);
1915
1916TRACE_EVENT(cfg80211_ready_on_channel_expired,
1917 TP_PROTO(struct wireless_dev *wdev, u64 cookie,
1918 struct ieee80211_channel *chan,
1919 enum nl80211_channel_type channel_type),
1920 TP_ARGS(wdev, cookie, chan, channel_type),
1921 TP_STRUCT__entry(
1922 WDEV_ENTRY
1923 __field(u64, cookie)
1924 CHAN_ENTRY
1925 __field(enum nl80211_channel_type, channel_type)
1926 ),
1927 TP_fast_assign(
1928 WDEV_ASSIGN;
1929 __entry->cookie = cookie;
1930 CHAN_ASSIGN(chan);
1931 __entry->channel_type = channel_type;
1932 ),
1933 TP_printk(WDEV_PR_FMT ", cookie: %llu, " CHAN_PR_FMT ", channel type: %d",
1934 WDEV_PR_ARG, __entry->cookie, CHAN_PR_ARG,
1935 __entry->channel_type)
1936);
1937
1938TRACE_EVENT(cfg80211_new_sta,
1939 TP_PROTO(struct net_device *netdev, const u8 *mac_addr,
1940 struct station_info *sinfo),
1941 TP_ARGS(netdev, mac_addr, sinfo),
1942 TP_STRUCT__entry(
1943 NETDEV_ENTRY
1944 MAC_ENTRY(mac_addr)
1945 SINFO_ENTRY
1946 ),
1947 TP_fast_assign(
1948 NETDEV_ASSIGN;
1949 MAC_ASSIGN(mac_addr, mac_addr);
1950 SINFO_ASSIGN;
1951 ),
1952 TP_printk(NETDEV_PR_FMT MAC_PR_FMT,
1953 NETDEV_PR_ARG, MAC_PR_ARG(mac_addr))
1954);
1955
1956DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_del_sta,
1957 TP_PROTO(struct net_device *netdev, const u8 *macaddr),
1958 TP_ARGS(netdev, macaddr)
1959);
1960
1961TRACE_EVENT(cfg80211_rx_mgmt,
1962 TP_PROTO(struct wireless_dev *wdev, int freq, int sig_mbm),
1963 TP_ARGS(wdev, freq, sig_mbm),
1964 TP_STRUCT__entry(
1965 WDEV_ENTRY
1966 __field(int, freq)
1967 __field(int, sig_mbm)
1968 ),
1969 TP_fast_assign(
1970 WDEV_ASSIGN;
1971 __entry->freq = freq;
1972 __entry->sig_mbm = sig_mbm;
1973 ),
1974 TP_printk(WDEV_PR_FMT ", freq: %d, sig mbm: %d",
1975 WDEV_PR_ARG, __entry->freq, __entry->sig_mbm)
1976);
1977
1978TRACE_EVENT(cfg80211_mgmt_tx_status,
1979 TP_PROTO(struct wireless_dev *wdev, u64 cookie, bool ack),
1980 TP_ARGS(wdev, cookie, ack),
1981 TP_STRUCT__entry(
1982 WDEV_ENTRY
1983 __field(u64, cookie)
1984 __field(bool, ack)
1985 ),
1986 TP_fast_assign(
1987 WDEV_ASSIGN;
1988 __entry->cookie = cookie;
1989 __entry->ack = ack;
1990 ),
1991 TP_printk(WDEV_PR_FMT", cookie: %llu, ack: %s",
1992 WDEV_PR_ARG, __entry->cookie, BOOL_TO_STR(__entry->ack))
1993);
1994
1995TRACE_EVENT(cfg80211_cqm_rssi_notify,
1996 TP_PROTO(struct net_device *netdev,
1997 enum nl80211_cqm_rssi_threshold_event rssi_event),
1998 TP_ARGS(netdev, rssi_event),
1999 TP_STRUCT__entry(
2000 NETDEV_ENTRY
2001 __field(enum nl80211_cqm_rssi_threshold_event, rssi_event)
2002 ),
2003 TP_fast_assign(
2004 NETDEV_ASSIGN;
2005 __entry->rssi_event = rssi_event;
2006 ),
2007 TP_printk(NETDEV_PR_FMT ", rssi event: %d",
2008 NETDEV_PR_ARG, __entry->rssi_event)
2009);
2010
2011TRACE_EVENT(cfg80211_can_beacon_sec_chan,
2012 TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *channel,
2013 enum nl80211_channel_type channel_type),
2014 TP_ARGS(wiphy, channel, channel_type),
2015 TP_STRUCT__entry(
2016 WIPHY_ENTRY
2017 CHAN_ENTRY
2018 __field(enum nl80211_channel_type, channel_type)
2019 ),
2020 TP_fast_assign(
2021 WIPHY_ASSIGN;
2022 CHAN_ASSIGN(channel);
2023 __entry->channel_type = channel_type;
2024 ),
2025 TP_printk(WIPHY_PR_FMT CHAN_PR_FMT ", channel_type: %d",
2026 WIPHY_PR_ARG, CHAN_PR_ARG, __entry->channel_type)
2027);
2028
2029TRACE_EVENT(cfg80211_ch_switch_notify,
2030 TP_PROTO(struct net_device *netdev, int freq,
2031 enum nl80211_channel_type type),
2032 TP_ARGS(netdev, freq, type),
2033 TP_STRUCT__entry(
2034 NETDEV_ENTRY
2035 __field(int, freq)
2036 __field(enum nl80211_channel_type, type)
2037 ),
2038 TP_fast_assign(
2039 NETDEV_ASSIGN;
2040 __entry->freq = freq;
2041 __entry->type = type;
2042 ),
2043 TP_printk(NETDEV_PR_FMT ", freq: %d, type: %d", NETDEV_PR_ARG,
2044 __entry->freq, __entry->type)
2045);
2046
2047DECLARE_EVENT_CLASS(cfg80211_rx_evt,
2048 TP_PROTO(struct net_device *netdev, const u8 *addr),
2049 TP_ARGS(netdev, addr),
2050 TP_STRUCT__entry(
2051 NETDEV_ENTRY
2052 MAC_ENTRY(addr)
2053 ),
2054 TP_fast_assign(
2055 NETDEV_ASSIGN;
2056 MAC_ASSIGN(addr, addr);
2057 ),
2058 TP_printk(NETDEV_PR_FMT MAC_PR_FMT, NETDEV_PR_ARG, MAC_PR_ARG(addr))
2059);
2060
2061DEFINE_EVENT(cfg80211_rx_evt, cfg80211_ibss_joined,
2062 TP_PROTO(struct net_device *netdev, const u8 *addr),
2063 TP_ARGS(netdev, addr)
2064);
2065
2066DEFINE_EVENT(cfg80211_rx_evt, cfg80211_rx_spurious_frame,
2067 TP_PROTO(struct net_device *netdev, const u8 *addr),
2068 TP_ARGS(netdev, addr)
2069);
2070
2071DEFINE_EVENT(cfg80211_rx_evt, cfg80211_rx_unexpected_4addr_frame,
2072 TP_PROTO(struct net_device *netdev, const u8 *addr),
2073 TP_ARGS(netdev, addr)
2074);
2075
2076TRACE_EVENT(cfg80211_probe_status,
2077 TP_PROTO(struct net_device *netdev, const u8 *addr, u64 cookie,
2078 bool acked),
2079 TP_ARGS(netdev, addr, cookie, acked),
2080 TP_STRUCT__entry(
2081 NETDEV_ENTRY
2082 MAC_ENTRY(addr)
2083 __field(u64, cookie)
2084 __field(bool, acked)
2085 ),
2086 TP_fast_assign(
2087 NETDEV_ASSIGN;
2088 MAC_ASSIGN(addr, addr);
2089 __entry->cookie = cookie;
2090 __entry->acked = acked;
2091 ),
2092 TP_printk(NETDEV_PR_FMT MAC_PR_FMT ", cookie: %llu, acked: %s",
2093 NETDEV_PR_ARG, MAC_PR_ARG(addr), __entry->cookie,
2094 BOOL_TO_STR(__entry->acked))
2095);
2096
2097TRACE_EVENT(cfg80211_cqm_pktloss_notify,
2098 TP_PROTO(struct net_device *netdev, const u8 *peer, u32 num_packets),
2099 TP_ARGS(netdev, peer, num_packets),
2100 TP_STRUCT__entry(
2101 NETDEV_ENTRY
2102 MAC_ENTRY(peer)
2103 __field(u32, num_packets)
2104 ),
2105 TP_fast_assign(
2106 NETDEV_ASSIGN;
2107 MAC_ASSIGN(peer, peer);
2108 __entry->num_packets = num_packets;
2109 ),
2110 TP_printk(NETDEV_PR_FMT ", peer: " MAC_PR_FMT ", num of lost packets: %u",
2111 NETDEV_PR_ARG, MAC_PR_ARG(peer), __entry->num_packets)
2112);
2113
2114DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_gtk_rekey_notify,
2115 TP_PROTO(struct net_device *netdev, const u8 *macaddr),
2116 TP_ARGS(netdev, macaddr)
2117);
2118
2119TRACE_EVENT(cfg80211_pmksa_candidate_notify,
2120 TP_PROTO(struct net_device *netdev, int index, const u8 *bssid,
2121 bool preauth),
2122 TP_ARGS(netdev, index, bssid, preauth),
2123 TP_STRUCT__entry(
2124 NETDEV_ENTRY
2125 __field(int, index)
2126 MAC_ENTRY(bssid)
2127 __field(bool, preauth)
2128 ),
2129 TP_fast_assign(
2130 NETDEV_ASSIGN;
2131 __entry->index = index;
2132 MAC_ASSIGN(bssid, bssid);
2133 __entry->preauth = preauth;
2134 ),
2135 TP_printk(NETDEV_PR_FMT ", index:%d, bssid: " MAC_PR_FMT ", pre auth: %s",
2136 NETDEV_PR_ARG, __entry->index, MAC_PR_ARG(bssid),
2137 BOOL_TO_STR(__entry->preauth))
2138);
2139
2140TRACE_EVENT(cfg80211_report_obss_beacon,
2141 TP_PROTO(struct wiphy *wiphy, const u8 *frame, size_t len,
2142 int freq, int sig_dbm),
2143 TP_ARGS(wiphy, frame, len, freq, sig_dbm),
2144 TP_STRUCT__entry(
2145 WIPHY_ENTRY
2146 __field(int, freq)
2147 __field(int, sig_dbm)
2148 ),
2149 TP_fast_assign(
2150 WIPHY_ASSIGN;
2151 __entry->freq = freq;
2152 __entry->sig_dbm = sig_dbm;
2153 ),
2154 TP_printk(WIPHY_PR_FMT ", freq: %d, sig_dbm: %d",
2155 WIPHY_PR_ARG, __entry->freq, __entry->sig_dbm)
2156);
2157
2158TRACE_EVENT(cfg80211_scan_done,
2159 TP_PROTO(struct cfg80211_scan_request *request, bool aborted),
2160 TP_ARGS(request, aborted),
2161 TP_STRUCT__entry(
2162 __field(u32, n_channels)
2163 __dynamic_array(u8, ie, request ? request->ie_len : 0)
2164 __array(u32, rates, IEEE80211_NUM_BANDS)
2165 __field(u32, wdev_id)
2166 MAC_ENTRY(wiphy_mac)
2167 __field(bool, no_cck)
2168 __field(bool, aborted)
2169 ),
2170 TP_fast_assign(
2171 if (request) {
2172 memcpy(__get_dynamic_array(ie), request->ie,
2173 request->ie_len);
2174 memcpy(__entry->rates, request->rates,
2175 IEEE80211_NUM_BANDS);
2176 __entry->wdev_id = request->wdev ?
2177 request->wdev->identifier : 0;
2178 if (request->wiphy)
2179 MAC_ASSIGN(wiphy_mac,
2180 request->wiphy->perm_addr);
2181 __entry->no_cck = request->no_cck;
2182 }
2183 __entry->aborted = aborted;
2184 ),
2185 TP_printk("aborted: %s", BOOL_TO_STR(__entry->aborted))
2186);
2187
2188DEFINE_EVENT(wiphy_only_evt, cfg80211_sched_scan_results,
2189 TP_PROTO(struct wiphy *wiphy),
2190 TP_ARGS(wiphy)
2191);
2192
2193DEFINE_EVENT(wiphy_only_evt, cfg80211_sched_scan_stopped,
2194 TP_PROTO(struct wiphy *wiphy),
2195 TP_ARGS(wiphy)
2196);
2197
2198TRACE_EVENT(cfg80211_get_bss,
2199 TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *channel,
2200 const u8 *bssid, const u8 *ssid, size_t ssid_len,
2201 u16 capa_mask, u16 capa_val),
2202 TP_ARGS(wiphy, channel, bssid, ssid, ssid_len, capa_mask, capa_val),
2203 TP_STRUCT__entry(
2204 WIPHY_ENTRY
2205 CHAN_ENTRY
2206 MAC_ENTRY(bssid)
2207 __dynamic_array(u8, ssid, ssid_len)
2208 __field(u16, capa_mask)
2209 __field(u16, capa_val)
2210 ),
2211 TP_fast_assign(
2212 WIPHY_ASSIGN;
2213 CHAN_ASSIGN(channel);
2214 MAC_ASSIGN(bssid, bssid);
2215 memcpy(__get_dynamic_array(ssid), ssid, ssid_len);
2216 __entry->capa_mask = capa_mask;
2217 __entry->capa_val = capa_val;
2218 ),
2219 TP_printk(WIPHY_PR_FMT CHAN_PR_FMT MAC_PR_FMT ", buf: %#.2x, "
2220 "capa_mask: %d, capa_val: %u", WIPHY_PR_ARG, CHAN_PR_ARG,
2221 MAC_PR_ARG(bssid), ((u8 *)__get_dynamic_array(ssid))[0],
2222 __entry->capa_mask, __entry->capa_val)
2223);
2224
2225TRACE_EVENT(cfg80211_inform_bss_frame,
2226 TP_PROTO(struct wiphy *wiphy, struct ieee80211_channel *channel,
2227 struct ieee80211_mgmt *mgmt, size_t len,
2228 s32 signal),
2229 TP_ARGS(wiphy, channel, mgmt, len, signal),
2230 TP_STRUCT__entry(
2231 WIPHY_ENTRY
2232 CHAN_ENTRY
2233 __dynamic_array(u8, mgmt, len)
2234 __field(s32, signal)
2235 ),
2236 TP_fast_assign(
2237 WIPHY_ASSIGN;
2238 CHAN_ASSIGN(channel);
2239 if (mgmt)
2240 memcpy(__get_dynamic_array(mgmt), mgmt, len);
2241 __entry->signal = signal;
2242 ),
2243 TP_printk(WIPHY_PR_FMT CHAN_PR_FMT "signal: %d",
2244 WIPHY_PR_ARG, CHAN_PR_ARG, __entry->signal)
2245);
2246
2247DECLARE_EVENT_CLASS(cfg80211_bss_evt,
2248 TP_PROTO(struct cfg80211_bss *pub),
2249 TP_ARGS(pub),
2250 TP_STRUCT__entry(
2251 MAC_ENTRY(bssid)
2252 CHAN_ENTRY
2253 ),
2254 TP_fast_assign(
2255 MAC_ASSIGN(bssid, pub->bssid);
2256 CHAN_ASSIGN(pub->channel);
2257 ),
2258 TP_printk(MAC_PR_FMT CHAN_PR_FMT, MAC_PR_ARG(bssid), CHAN_PR_ARG)
2259);
2260
2261DEFINE_EVENT(cfg80211_bss_evt, cfg80211_return_bss,
2262 TP_PROTO(struct cfg80211_bss *pub),
2263 TP_ARGS(pub)
2264);
2265
2266TRACE_EVENT(cfg80211_return_uint,
2267 TP_PROTO(unsigned int ret),
2268 TP_ARGS(ret),
2269 TP_STRUCT__entry(
2270 __field(unsigned int, ret)
2271 ),
2272 TP_fast_assign(
2273 __entry->ret = ret;
2274 ),
2275 TP_printk("ret: %d", __entry->ret)
2276);
2277
2278TRACE_EVENT(cfg80211_return_u32,
2279 TP_PROTO(u32 ret),
2280 TP_ARGS(ret),
2281 TP_STRUCT__entry(
2282 __field(u32, ret)
2283 ),
2284 TP_fast_assign(
2285 __entry->ret = ret;
2286 ),
2287 TP_printk("ret: %u", __entry->ret)
2288);
2289
2290#endif /* !__RDEV_OPS_TRACE || TRACE_HEADER_MULTI_READ */
2291
2292#undef TRACE_INCLUDE_PATH
2293#define TRACE_INCLUDE_PATH .
2294#undef TRACE_INCLUDE_FILE
2295#define TRACE_INCLUDE_FILE trace
2296#include <trace/define_trace.h>
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 2762e8329986..5b6c1df72f31 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -11,6 +11,8 @@
11#include <net/ip.h> 11#include <net/ip.h>
12#include <net/dsfield.h> 12#include <net/dsfield.h>
13#include "core.h" 13#include "core.h"
14#include "rdev-ops.h"
15
14 16
15struct ieee80211_rate * 17struct ieee80211_rate *
16ieee80211_get_response_rate(struct ieee80211_supported_band *sband, 18ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
@@ -705,19 +707,18 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
705 for (i = 0; i < 6; i++) { 707 for (i = 0; i < 6; i++) {
706 if (!wdev->connect_keys->params[i].cipher) 708 if (!wdev->connect_keys->params[i].cipher)
707 continue; 709 continue;
708 if (rdev->ops->add_key(wdev->wiphy, dev, i, false, NULL, 710 if (rdev_add_key(rdev, dev, i, false, NULL,
709 &wdev->connect_keys->params[i])) { 711 &wdev->connect_keys->params[i])) {
710 netdev_err(dev, "failed to set key %d\n", i); 712 netdev_err(dev, "failed to set key %d\n", i);
711 continue; 713 continue;
712 } 714 }
713 if (wdev->connect_keys->def == i) 715 if (wdev->connect_keys->def == i)
714 if (rdev->ops->set_default_key(wdev->wiphy, dev, 716 if (rdev_set_default_key(rdev, dev, i, true, true)) {
715 i, true, true)) {
716 netdev_err(dev, "failed to set defkey %d\n", i); 717 netdev_err(dev, "failed to set defkey %d\n", i);
717 continue; 718 continue;
718 } 719 }
719 if (wdev->connect_keys->defmgmt == i) 720 if (wdev->connect_keys->defmgmt == i)
720 if (rdev->ops->set_default_mgmt_key(wdev->wiphy, dev, i)) 721 if (rdev_set_default_mgmt_key(rdev, dev, i))
721 netdev_err(dev, "failed to set mgtdef %d\n", i); 722 netdev_err(dev, "failed to set mgtdef %d\n", i);
722 } 723 }
723 724
@@ -850,8 +851,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
850 cfg80211_process_rdev_events(rdev); 851 cfg80211_process_rdev_events(rdev);
851 } 852 }
852 853
853 err = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, 854 err = rdev_change_virtual_intf(rdev, dev, ntype, flags, params);
854 ntype, flags, params);
855 855
856 WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype); 856 WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype);
857 857
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 494379eb464f..6488d2dbc1d7 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -19,6 +19,7 @@
19#include <net/cfg80211-wext.h> 19#include <net/cfg80211-wext.h>
20#include "wext-compat.h" 20#include "wext-compat.h"
21#include "core.h" 21#include "core.h"
22#include "rdev-ops.h"
22 23
23int cfg80211_wext_giwname(struct net_device *dev, 24int cfg80211_wext_giwname(struct net_device *dev,
24 struct iw_request_info *info, 25 struct iw_request_info *info,
@@ -301,8 +302,7 @@ int cfg80211_wext_siwrts(struct net_device *dev,
301 else 302 else
302 wdev->wiphy->rts_threshold = rts->value; 303 wdev->wiphy->rts_threshold = rts->value;
303 304
304 err = rdev->ops->set_wiphy_params(wdev->wiphy, 305 err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_RTS_THRESHOLD);
305 WIPHY_PARAM_RTS_THRESHOLD);
306 if (err) 306 if (err)
307 wdev->wiphy->rts_threshold = orts; 307 wdev->wiphy->rts_threshold = orts;
308 308
@@ -342,8 +342,7 @@ int cfg80211_wext_siwfrag(struct net_device *dev,
342 wdev->wiphy->frag_threshold = frag->value & ~0x1; 342 wdev->wiphy->frag_threshold = frag->value & ~0x1;
343 } 343 }
344 344
345 err = rdev->ops->set_wiphy_params(wdev->wiphy, 345 err = rdev_set_wiphy_params(rdev, WIPHY_PARAM_FRAG_THRESHOLD);
346 WIPHY_PARAM_FRAG_THRESHOLD);
347 if (err) 346 if (err)
348 wdev->wiphy->frag_threshold = ofrag; 347 wdev->wiphy->frag_threshold = ofrag;
349 348
@@ -396,7 +395,7 @@ static int cfg80211_wext_siwretry(struct net_device *dev,
396 if (!changed) 395 if (!changed)
397 return 0; 396 return 0;
398 397
399 err = rdev->ops->set_wiphy_params(wdev->wiphy, changed); 398 err = rdev_set_wiphy_params(rdev, changed);
400 if (err) { 399 if (err) {
401 wdev->wiphy->retry_short = oshort; 400 wdev->wiphy->retry_short = oshort;
402 wdev->wiphy->retry_long = olong; 401 wdev->wiphy->retry_long = olong;
@@ -490,8 +489,8 @@ static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
490 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) 489 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
491 err = -ENOENT; 490 err = -ENOENT;
492 else 491 else
493 err = rdev->ops->del_key(&rdev->wiphy, dev, idx, 492 err = rdev_del_key(rdev, dev, idx, pairwise,
494 pairwise, addr); 493 addr);
495 } 494 }
496 wdev->wext.connect.privacy = false; 495 wdev->wext.connect.privacy = false;
497 /* 496 /*
@@ -525,8 +524,7 @@ static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
525 524
526 err = 0; 525 err = 0;
527 if (wdev->current_bss) 526 if (wdev->current_bss)
528 err = rdev->ops->add_key(&rdev->wiphy, dev, idx, 527 err = rdev_add_key(rdev, dev, idx, pairwise, addr, params);
529 pairwise, addr, params);
530 if (err) 528 if (err)
531 return err; 529 return err;
532 530
@@ -552,8 +550,7 @@ static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
552 __cfg80211_leave_ibss(rdev, wdev->netdev, true); 550 __cfg80211_leave_ibss(rdev, wdev->netdev, true);
553 rejoin = true; 551 rejoin = true;
554 } 552 }
555 err = rdev->ops->set_default_key(&rdev->wiphy, dev, 553 err = rdev_set_default_key(rdev, dev, idx, true, true);
556 idx, true, true);
557 } 554 }
558 if (!err) { 555 if (!err) {
559 wdev->wext.default_key = idx; 556 wdev->wext.default_key = idx;
@@ -566,8 +563,7 @@ static int __cfg80211_set_encryption(struct cfg80211_registered_device *rdev,
566 if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC && 563 if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC &&
567 (tx_key || (!addr && wdev->wext.default_mgmt_key == -1))) { 564 (tx_key || (!addr && wdev->wext.default_mgmt_key == -1))) {
568 if (wdev->current_bss) 565 if (wdev->current_bss)
569 err = rdev->ops->set_default_mgmt_key(&rdev->wiphy, 566 err = rdev_set_default_mgmt_key(rdev, dev, idx);
570 dev, idx);
571 if (!err) 567 if (!err)
572 wdev->wext.default_mgmt_key = idx; 568 wdev->wext.default_mgmt_key = idx;
573 return err; 569 return err;
@@ -631,8 +627,8 @@ static int cfg80211_wext_siwencode(struct net_device *dev,
631 err = 0; 627 err = 0;
632 wdev_lock(wdev); 628 wdev_lock(wdev);
633 if (wdev->current_bss) 629 if (wdev->current_bss)
634 err = rdev->ops->set_default_key(&rdev->wiphy, dev, 630 err = rdev_set_default_key(rdev, dev, idx, true,
635 idx, true, true); 631 true);
636 if (!err) 632 if (!err)
637 wdev->wext.default_key = idx; 633 wdev->wext.default_key = idx;
638 wdev_unlock(wdev); 634 wdev_unlock(wdev);
@@ -839,7 +835,7 @@ static int cfg80211_wext_giwfreq(struct net_device *dev,
839 if (!rdev->ops->get_channel) 835 if (!rdev->ops->get_channel)
840 return -EINVAL; 836 return -EINVAL;
841 837
842 chan = rdev->ops->get_channel(wdev->wiphy, wdev, &channel_type); 838 chan = rdev_get_channel(rdev, wdev, &channel_type);
843 if (!chan) 839 if (!chan)
844 return -EINVAL; 840 return -EINVAL;
845 freq->m = chan->center_freq; 841 freq->m = chan->center_freq;
@@ -899,7 +895,7 @@ static int cfg80211_wext_siwtxpower(struct net_device *dev,
899 return 0; 895 return 0;
900 } 896 }
901 897
902 return rdev->ops->set_tx_power(wdev->wiphy, type, DBM_TO_MBM(dbm)); 898 return rdev_set_tx_power(rdev, type, DBM_TO_MBM(dbm));
903} 899}
904 900
905static int cfg80211_wext_giwtxpower(struct net_device *dev, 901static int cfg80211_wext_giwtxpower(struct net_device *dev,
@@ -918,7 +914,7 @@ static int cfg80211_wext_giwtxpower(struct net_device *dev,
918 if (!rdev->ops->get_tx_power) 914 if (!rdev->ops->get_tx_power)
919 return -EOPNOTSUPP; 915 return -EOPNOTSUPP;
920 916
921 err = rdev->ops->get_tx_power(wdev->wiphy, &val); 917 err = rdev_get_tx_power(rdev, &val);
922 if (err) 918 if (err)
923 return err; 919 return err;
924 920
@@ -1158,7 +1154,7 @@ static int cfg80211_wext_siwpower(struct net_device *dev,
1158 timeout = wrq->value / 1000; 1154 timeout = wrq->value / 1000;
1159 } 1155 }
1160 1156
1161 err = rdev->ops->set_power_mgmt(wdev->wiphy, dev, ps, timeout); 1157 err = rdev_set_power_mgmt(rdev, dev, ps, timeout);
1162 if (err) 1158 if (err)
1163 return err; 1159 return err;
1164 1160
@@ -1200,7 +1196,7 @@ static int cfg80211_wds_wext_siwap(struct net_device *dev,
1200 if (!rdev->ops->set_wds_peer) 1196 if (!rdev->ops->set_wds_peer)
1201 return -EOPNOTSUPP; 1197 return -EOPNOTSUPP;
1202 1198
1203 err = rdev->ops->set_wds_peer(wdev->wiphy, dev, (u8 *) &addr->sa_data); 1199 err = rdev_set_wds_peer(rdev, dev, (u8 *)&addr->sa_data);
1204 if (err) 1200 if (err)
1205 return err; 1201 return err;
1206 1202
@@ -1272,7 +1268,7 @@ static int cfg80211_wext_siwrate(struct net_device *dev,
1272 if (!match) 1268 if (!match)
1273 return -EINVAL; 1269 return -EINVAL;
1274 1270
1275 return rdev->ops->set_bitrate_mask(wdev->wiphy, dev, NULL, &mask); 1271 return rdev_set_bitrate_mask(rdev, dev, NULL, &mask);
1276} 1272}
1277 1273
1278static int cfg80211_wext_giwrate(struct net_device *dev, 1274static int cfg80211_wext_giwrate(struct net_device *dev,
@@ -1302,7 +1298,7 @@ static int cfg80211_wext_giwrate(struct net_device *dev,
1302 if (err) 1298 if (err)
1303 return err; 1299 return err;
1304 1300
1305 err = rdev->ops->get_station(&rdev->wiphy, dev, addr, &sinfo); 1301 err = rdev_get_station(rdev, dev, addr, &sinfo);
1306 if (err) 1302 if (err)
1307 return err; 1303 return err;
1308 1304
@@ -1339,7 +1335,7 @@ static struct iw_statistics *cfg80211_wireless_stats(struct net_device *dev)
1339 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN); 1335 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
1340 wdev_unlock(wdev); 1336 wdev_unlock(wdev);
1341 1337
1342 if (rdev->ops->get_station(&rdev->wiphy, dev, bssid, &sinfo)) 1338 if (rdev_get_station(rdev, dev, bssid, &sinfo))
1343 return NULL; 1339 return NULL;
1344 1340
1345 memset(&wstats, 0, sizeof(wstats)); 1341 memset(&wstats, 0, sizeof(wstats));
@@ -1474,19 +1470,19 @@ static int cfg80211_wext_siwpmksa(struct net_device *dev,
1474 if (!rdev->ops->set_pmksa) 1470 if (!rdev->ops->set_pmksa)
1475 return -EOPNOTSUPP; 1471 return -EOPNOTSUPP;
1476 1472
1477 return rdev->ops->set_pmksa(&rdev->wiphy, dev, &cfg_pmksa); 1473 return rdev_set_pmksa(rdev, dev, &cfg_pmksa);
1478 1474
1479 case IW_PMKSA_REMOVE: 1475 case IW_PMKSA_REMOVE:
1480 if (!rdev->ops->del_pmksa) 1476 if (!rdev->ops->del_pmksa)
1481 return -EOPNOTSUPP; 1477 return -EOPNOTSUPP;
1482 1478
1483 return rdev->ops->del_pmksa(&rdev->wiphy, dev, &cfg_pmksa); 1479 return rdev_del_pmksa(rdev, dev, &cfg_pmksa);
1484 1480
1485 case IW_PMKSA_FLUSH: 1481 case IW_PMKSA_FLUSH:
1486 if (!rdev->ops->flush_pmksa) 1482 if (!rdev->ops->flush_pmksa)
1487 return -EOPNOTSUPP; 1483 return -EOPNOTSUPP;
1488 1484
1489 return rdev->ops->flush_pmksa(&rdev->wiphy, dev); 1485 return rdev_flush_pmksa(rdev, dev);
1490 1486
1491 default: 1487 default:
1492 return -EOPNOTSUPP; 1488 return -EOPNOTSUPP;