aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorHila Gonen <hila.gonen@intel.com>2012-06-27 10:19:42 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-10-18 04:53:37 -0400
commite35e4d28b687d4e849573419fdcf90f1cce2a14c (patch)
tree981265aea6c76bc8288c6000c0e935c2bbdd7f90 /net/wireless
parentde7044ee85a9ba9e8529b0250f2882724407c977 (diff)
cfg80211: add wrappers for registered_device_ops
This will allow adding central tracing like in mac80211. Signed-off-by: Hila Gonen <hila.gonen@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/ap.c3
-rw-r--r--net/wireless/chan.c3
-rw-r--r--net/wireless/core.c10
-rw-r--r--net/wireless/ethtool.c15
-rw-r--r--net/wireless/ibss.c7
-rw-r--r--net/wireless/mesh.c10
-rw-r--r--net/wireless/mlme.c26
-rw-r--r--net/wireless/nl80211.c135
-rw-r--r--net/wireless/rdev-ops.h558
-rw-r--r--net/wireless/scan.c5
-rw-r--r--net/wireless/sme.c9
-rw-r--r--net/wireless/sysfs.c5
-rw-r--r--net/wireless/util.c14
-rw-r--r--net/wireless/wext-compat.c48
14 files changed, 700 insertions, 148 deletions
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..71c362587965 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,
@@ -92,7 +93,7 @@ int cfg80211_set_monitor_channel(struct cfg80211_registered_device *rdev,
92 if (!chan) 93 if (!chan)
93 return -EINVAL; 94 return -EINVAL;
94 95
95 return rdev->ops->set_monitor_channel(&rdev->wiphy, chan, chantype); 96 return rdev_set_monitor_channel(rdev, chan, chantype);
96} 97}
97 98
98void 99void
diff --git a/net/wireless/core.c b/net/wireless/core.c
index 48c2ea4712e9..f280f48fbd43 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)
@@ -690,7 +691,7 @@ void wiphy_unregister(struct wiphy *wiphy)
690 flush_work(&rdev->event_work); 691 flush_work(&rdev->event_work);
691 692
692 if (rdev->wowlan && rdev->ops->set_wakeup) 693 if (rdev->wowlan && rdev->ops->set_wakeup)
693 rdev->ops->set_wakeup(&rdev->wiphy, false); 694 rdev_set_wakeup(rdev, false);
694 cfg80211_rdev_free_wowlan(rdev); 695 cfg80211_rdev_free_wowlan(rdev);
695} 696}
696EXPORT_SYMBOL(wiphy_unregister); 697EXPORT_SYMBOL(wiphy_unregister);
@@ -964,9 +965,8 @@ static int cfg80211_netdev_notifier_call(struct notifier_block *nb,
964 if ((wdev->iftype == NL80211_IFTYPE_STATION || 965 if ((wdev->iftype == NL80211_IFTYPE_STATION ||
965 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) && 966 wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
966 rdev->ops->set_power_mgmt) 967 rdev->ops->set_power_mgmt)
967 if (rdev->ops->set_power_mgmt(wdev->wiphy, dev, 968 if (rdev_set_power_mgmt(rdev, dev, wdev->ps,
968 wdev->ps, 969 wdev->ps_timeout)) {
969 wdev->ps_timeout)) {
970 /* assume this means it's off */ 970 /* assume this means it's off */
971 wdev->ps = false; 971 wdev->ps = false;
972 } 972 }
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..7fda94fb1a3e 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)
@@ -128,7 +129,7 @@ int __cfg80211_join_ibss(struct cfg80211_registered_device *rdev,
128 return err; 129 return err;
129 } 130 }
130 131
131 err = rdev->ops->join_ibss(&rdev->wiphy, dev, params); 132 err = rdev_join_ibss(rdev, dev, params);
132 if (err) { 133 if (err) {
133 wdev->connect_keys = NULL; 134 wdev->connect_keys = NULL;
134 wdev->sme_state = CFG80211_SME_IDLE; 135 wdev->sme_state = CFG80211_SME_IDLE;
@@ -175,7 +176,7 @@ static void __cfg80211_clear_ibss(struct net_device *dev, bool nowext)
175 */ 176 */
176 if (rdev->ops->del_key) 177 if (rdev->ops->del_key)
177 for (i = 0; i < 6; i++) 178 for (i = 0; i < 6; i++)
178 rdev->ops->del_key(wdev->wiphy, dev, i, false, NULL); 179 rdev_del_key(rdev, dev, i, false, NULL);
179 180
180 if (wdev->current_bss) { 181 if (wdev->current_bss) {
181 cfg80211_unhold_bss(wdev->current_bss); 182 cfg80211_unhold_bss(wdev->current_bss);
@@ -211,7 +212,7 @@ int __cfg80211_leave_ibss(struct cfg80211_registered_device *rdev,
211 if (!wdev->ssid_len) 212 if (!wdev->ssid_len)
212 return -ENOLINK; 213 return -ENOLINK;
213 214
214 err = rdev->ops->leave_ibss(&rdev->wiphy, dev); 215 err = rdev_leave_ibss(rdev, dev);
215 216
216 if (err) 217 if (err)
217 return err; 218 return err;
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index c384e77ff77a..a18bb3417be5 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
@@ -267,7 +267,7 @@ static int __cfg80211_leave_mesh(struct cfg80211_registered_device *rdev,
267 if (!wdev->mesh_id_len) 267 if (!wdev->mesh_id_len)
268 return -ENOTCONN; 268 return -ENOTCONN;
269 269
270 err = rdev->ops->leave_mesh(&rdev->wiphy, dev); 270 err = rdev_leave_mesh(rdev, dev);
271 if (!err) { 271 if (!err) {
272 wdev->mesh_id_len = 0; 272 wdev->mesh_id_len = 0;
273 wdev->channel = NULL; 273 wdev->channel = NULL;
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 460d49325741..2a74395e6ab3 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{
@@ -310,7 +312,7 @@ int __cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,
310 if (err) 312 if (err)
311 goto out; 313 goto out;
312 314
313 err = rdev->ops->auth(&rdev->wiphy, dev, &req); 315 err = rdev_auth(rdev, dev, &req);
314 316
315out: 317out:
316 cfg80211_put_bss(req.bss); 318 cfg80211_put_bss(req.bss);
@@ -415,7 +417,7 @@ int __cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,
415 if (err) 417 if (err)
416 goto out; 418 goto out;
417 419
418 err = rdev->ops->assoc(&rdev->wiphy, dev, &req); 420 err = rdev_assoc(rdev, dev, &req);
419 421
420out: 422out:
421 if (err) { 423 if (err) {
@@ -477,7 +479,7 @@ int __cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
477 return 0; 479 return 0;
478 } 480 }
479 481
480 return rdev->ops->deauth(&rdev->wiphy, dev, &req); 482 return rdev_deauth(rdev, dev, &req);
481} 483}
482 484
483int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev, 485int cfg80211_mlme_deauth(struct cfg80211_registered_device *rdev,
@@ -522,7 +524,7 @@ static int __cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
522 else 524 else
523 return -ENOTCONN; 525 return -ENOTCONN;
524 526
525 return rdev->ops->disassoc(&rdev->wiphy, dev, &req); 527 return rdev_disassoc(rdev, dev, &req);
526} 528}
527 529
528int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev, 530int cfg80211_mlme_disassoc(struct cfg80211_registered_device *rdev,
@@ -563,7 +565,7 @@ void cfg80211_mlme_down(struct cfg80211_registered_device *rdev,
563 565
564 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN); 566 memcpy(bssid, wdev->current_bss->pub.bssid, ETH_ALEN);
565 req.bssid = bssid; 567 req.bssid = bssid;
566 rdev->ops->deauth(&rdev->wiphy, dev, &req); 568 rdev_deauth(rdev, dev, &req);
567 569
568 if (wdev->current_bss) { 570 if (wdev->current_bss) {
569 cfg80211_unhold_bss(wdev->current_bss); 571 cfg80211_unhold_bss(wdev->current_bss);
@@ -693,7 +695,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid,
693 list_add(&nreg->list, &wdev->mgmt_registrations); 695 list_add(&nreg->list, &wdev->mgmt_registrations);
694 696
695 if (rdev->ops->mgmt_frame_register) 697 if (rdev->ops->mgmt_frame_register)
696 rdev->ops->mgmt_frame_register(wiphy, wdev, frame_type, true); 698 rdev_mgmt_frame_register(rdev, wdev, frame_type, true);
697 699
698 out: 700 out:
699 spin_unlock_bh(&wdev->mgmt_registrations_lock); 701 spin_unlock_bh(&wdev->mgmt_registrations_lock);
@@ -716,8 +718,8 @@ void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid)
716 if (rdev->ops->mgmt_frame_register) { 718 if (rdev->ops->mgmt_frame_register) {
717 u16 frame_type = le16_to_cpu(reg->frame_type); 719 u16 frame_type = le16_to_cpu(reg->frame_type);
718 720
719 rdev->ops->mgmt_frame_register(wiphy, wdev, 721 rdev_mgmt_frame_register(rdev, wdev,
720 frame_type, false); 722 frame_type, false);
721 } 723 }
722 724
723 list_del(&reg->list); 725 list_del(&reg->list);
@@ -843,10 +845,10 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
843 return -EINVAL; 845 return -EINVAL;
844 846
845 /* Transmit the Action frame as requested by user space */ 847 /* Transmit the Action frame as requested by user space */
846 return rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan, 848 return rdev_mgmt_tx(rdev, wdev, chan, offchan,
847 channel_type, channel_type_valid, 849 channel_type, channel_type_valid,
848 wait, buf, len, no_cck, dont_wait_for_ack, 850 wait, buf, len, no_cck, dont_wait_for_ack,
849 cookie); 851 cookie);
850} 852}
851 853
852bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm, 854bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 48d754c9adb8..e26f7455538d 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -22,6 +22,7 @@
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 int nl80211_crypto_settings(struct cfg80211_registered_device *rdev, 27static int nl80211_crypto_settings(struct cfg80211_registered_device *rdev,
27 struct genl_info *info, 28 struct genl_info *info,
@@ -951,7 +952,7 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 portid, u32 seq, int flag
951 dev->wiphy.available_antennas_rx) && dev->ops->get_antenna) { 952 dev->wiphy.available_antennas_rx) && dev->ops->get_antenna) {
952 u32 tx_ant = 0, rx_ant = 0; 953 u32 tx_ant = 0, rx_ant = 0;
953 int res; 954 int res;
954 res = dev->ops->get_antenna(&dev->wiphy, &tx_ant, &rx_ant); 955 res = rdev_get_antenna(dev, &tx_ant, &rx_ant);
955 if (!res) { 956 if (!res) {
956 if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX, 957 if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_TX,
957 tx_ant) || 958 tx_ant) ||
@@ -1465,7 +1466,7 @@ static int nl80211_set_wds_peer(struct sk_buff *skb, struct genl_info *info)
1465 return -EOPNOTSUPP; 1466 return -EOPNOTSUPP;
1466 1467
1467 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]); 1468 bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
1468 return rdev->ops->set_wds_peer(wdev->wiphy, dev, bssid); 1469 return rdev_set_wds_peer(rdev, dev, bssid);
1469} 1470}
1470 1471
1471 1472
@@ -1570,9 +1571,8 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1570 if (result) 1571 if (result)
1571 goto bad_res; 1572 goto bad_res;
1572 1573
1573 result = rdev->ops->set_txq_params(&rdev->wiphy, 1574 result = rdev_set_txq_params(rdev, netdev,
1574 netdev, 1575 &txq_params);
1575 &txq_params);
1576 if (result) 1576 if (result)
1577 goto bad_res; 1577 goto bad_res;
1578 } 1578 }
@@ -1607,7 +1607,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1607 mbm = nla_get_u32(info->attrs[idx]); 1607 mbm = nla_get_u32(info->attrs[idx]);
1608 } 1608 }
1609 1609
1610 result = rdev->ops->set_tx_power(&rdev->wiphy, type, mbm); 1610 result = rdev_set_tx_power(rdev, type, mbm);
1611 if (result) 1611 if (result)
1612 goto bad_res; 1612 goto bad_res;
1613 } 1613 }
@@ -1636,7 +1636,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1636 tx_ant = tx_ant & rdev->wiphy.available_antennas_tx; 1636 tx_ant = tx_ant & rdev->wiphy.available_antennas_tx;
1637 rx_ant = rx_ant & rdev->wiphy.available_antennas_rx; 1637 rx_ant = rx_ant & rdev->wiphy.available_antennas_rx;
1638 1638
1639 result = rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant); 1639 result = rdev_set_antenna(rdev, tx_ant, rx_ant);
1640 if (result) 1640 if (result)
1641 goto bad_res; 1641 goto bad_res;
1642 } 1642 }
@@ -1721,7 +1721,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
1721 if (changed & WIPHY_PARAM_COVERAGE_CLASS) 1721 if (changed & WIPHY_PARAM_COVERAGE_CLASS)
1722 rdev->wiphy.coverage_class = coverage_class; 1722 rdev->wiphy.coverage_class = coverage_class;
1723 1723
1724 result = rdev->ops->set_wiphy_params(&rdev->wiphy, changed); 1724 result = rdev_set_wiphy_params(rdev, changed);
1725 if (result) { 1725 if (result) {
1726 rdev->wiphy.retry_short = old_retry_short; 1726 rdev->wiphy.retry_short = old_retry_short;
1727 rdev->wiphy.retry_long = old_retry_long; 1727 rdev->wiphy.retry_long = old_retry_long;
@@ -1773,8 +1773,7 @@ static int nl80211_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flag
1773 struct ieee80211_channel *chan; 1773 struct ieee80211_channel *chan;
1774 enum nl80211_channel_type channel_type; 1774 enum nl80211_channel_type channel_type;
1775 1775
1776 chan = rdev->ops->get_channel(&rdev->wiphy, wdev, 1776 chan = rdev_get_channel(rdev, wdev, &channel_type);
1777 &channel_type);
1778 if (chan && 1777 if (chan &&
1779 (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, 1778 (nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
1780 chan->center_freq) || 1779 chan->center_freq) ||
@@ -2022,9 +2021,9 @@ static int nl80211_new_interface(struct sk_buff *skb, struct genl_info *info)
2022 err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ? 2021 err = parse_monitor_flags(type == NL80211_IFTYPE_MONITOR ?
2023 info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL, 2022 info->attrs[NL80211_ATTR_MNTR_FLAGS] : NULL,
2024 &flags); 2023 &flags);
2025 wdev = rdev->ops->add_virtual_intf(&rdev->wiphy, 2024 wdev = rdev_add_virtual_intf(rdev,
2026 nla_data(info->attrs[NL80211_ATTR_IFNAME]), 2025 nla_data(info->attrs[NL80211_ATTR_IFNAME]),
2027 type, err ? NULL : &flags, &params); 2026 type, err ? NULL : &flags, &params);
2028 if (IS_ERR(wdev)) { 2027 if (IS_ERR(wdev)) {
2029 nlmsg_free(msg); 2028 nlmsg_free(msg);
2030 return PTR_ERR(wdev); 2029 return PTR_ERR(wdev);
@@ -2091,7 +2090,7 @@ static int nl80211_del_interface(struct sk_buff *skb, struct genl_info *info)
2091 if (!wdev->netdev) 2090 if (!wdev->netdev)
2092 info->user_ptr[1] = NULL; 2091 info->user_ptr[1] = NULL;
2093 2092
2094 return rdev->ops->del_virtual_intf(&rdev->wiphy, wdev); 2093 return rdev_del_virtual_intf(rdev, wdev);
2095} 2094}
2096 2095
2097static 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)
@@ -2108,7 +2107,7 @@ static int nl80211_set_noack_map(struct sk_buff *skb, struct genl_info *info)
2108 2107
2109 noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]); 2108 noack_map = nla_get_u16(info->attrs[NL80211_ATTR_NOACK_MAP]);
2110 2109
2111 return rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map); 2110 return rdev_set_noack_map(rdev, dev, noack_map);
2112} 2111}
2113 2112
2114struct get_key_cookie { 2113struct get_key_cookie {
@@ -2218,8 +2217,8 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
2218 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN)) 2217 !(rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN))
2219 return -ENOENT; 2218 return -ENOENT;
2220 2219
2221 err = rdev->ops->get_key(&rdev->wiphy, dev, key_idx, pairwise, 2220 err = rdev_get_key(rdev, dev, key_idx, pairwise, mac_addr, &cookie,
2222 mac_addr, &cookie, get_key_callback); 2221 get_key_callback);
2223 2222
2224 if (err) 2223 if (err)
2225 goto free_msg; 2224 goto free_msg;
@@ -2267,7 +2266,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
2267 if (err) 2266 if (err)
2268 goto out; 2267 goto out;
2269 2268
2270 err = rdev->ops->set_default_key(&rdev->wiphy, dev, key.idx, 2269 err = rdev_set_default_key(rdev, dev, key.idx,
2271 key.def_uni, key.def_multi); 2270 key.def_uni, key.def_multi);
2272 2271
2273 if (err) 2272 if (err)
@@ -2291,8 +2290,7 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
2291 if (err) 2290 if (err)
2292 goto out; 2291 goto out;
2293 2292
2294 err = rdev->ops->set_default_mgmt_key(&rdev->wiphy, 2293 err = rdev_set_default_mgmt_key(rdev, dev, key.idx);
2295 dev, key.idx);
2296 if (err) 2294 if (err)
2297 goto out; 2295 goto out;
2298 2296
@@ -2348,9 +2346,9 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
2348 wdev_lock(dev->ieee80211_ptr); 2346 wdev_lock(dev->ieee80211_ptr);
2349 err = nl80211_key_allowed(dev->ieee80211_ptr); 2347 err = nl80211_key_allowed(dev->ieee80211_ptr);
2350 if (!err) 2348 if (!err)
2351 err = rdev->ops->add_key(&rdev->wiphy, dev, key.idx, 2349 err = rdev_add_key(rdev, dev, key.idx,
2352 key.type == NL80211_KEYTYPE_PAIRWISE, 2350 key.type == NL80211_KEYTYPE_PAIRWISE,
2353 mac_addr, &key.p); 2351 mac_addr, &key.p);
2354 wdev_unlock(dev->ieee80211_ptr); 2352 wdev_unlock(dev->ieee80211_ptr);
2355 2353
2356 return err; 2354 return err;
@@ -2394,9 +2392,9 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
2394 err = -ENOENT; 2392 err = -ENOENT;
2395 2393
2396 if (!err) 2394 if (!err)
2397 err = rdev->ops->del_key(&rdev->wiphy, dev, key.idx, 2395 err = rdev_del_key(rdev, dev, key.idx,
2398 key.type == NL80211_KEYTYPE_PAIRWISE, 2396 key.type == NL80211_KEYTYPE_PAIRWISE,
2399 mac_addr); 2397 mac_addr);
2400 2398
2401#ifdef CONFIG_CFG80211_WEXT 2399#ifdef CONFIG_CFG80211_WEXT
2402 if (!err) { 2400 if (!err) {
@@ -2640,7 +2638,7 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info)
2640 if (err) 2638 if (err)
2641 return err; 2639 return err;
2642 2640
2643 err = rdev->ops->start_ap(&rdev->wiphy, dev, &params); 2641 err = rdev_start_ap(rdev, dev, &params);
2644 if (!err) { 2642 if (!err) {
2645 wdev->preset_chan = params.channel; 2643 wdev->preset_chan = params.channel;
2646 wdev->preset_chantype = params.channel_type; 2644 wdev->preset_chantype = params.channel_type;
@@ -2672,7 +2670,7 @@ static int nl80211_set_beacon(struct sk_buff *skb, struct genl_info *info)
2672 if (err) 2670 if (err)
2673 return err; 2671 return err;
2674 2672
2675 return rdev->ops->change_beacon(&rdev->wiphy, dev, &params); 2673 return rdev_change_beacon(rdev, dev, &params);
2676} 2674}
2677 2675
2678static 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)
@@ -2956,8 +2954,8 @@ static int nl80211_dump_station(struct sk_buff *skb,
2956 2954
2957 while (1) { 2955 while (1) {
2958 memset(&sinfo, 0, sizeof(sinfo)); 2956 memset(&sinfo, 0, sizeof(sinfo));
2959 err = dev->ops->dump_station(&dev->wiphy, netdev, sta_idx, 2957 err = rdev_dump_station(dev, netdev, sta_idx,
2960 mac_addr, &sinfo); 2958 mac_addr, &sinfo);
2961 if (err == -ENOENT) 2959 if (err == -ENOENT)
2962 break; 2960 break;
2963 if (err) 2961 if (err)
@@ -3002,7 +3000,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
3002 if (!rdev->ops->get_station) 3000 if (!rdev->ops->get_station)
3003 return -EOPNOTSUPP; 3001 return -EOPNOTSUPP;
3004 3002
3005 err = rdev->ops->get_station(&rdev->wiphy, dev, mac_addr, &sinfo); 3003 err = rdev_get_station(rdev, dev, mac_addr, &sinfo);
3006 if (err) 3004 if (err)
3007 return err; 3005 return err;
3008 3006
@@ -3179,7 +3177,7 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
3179 3177
3180 /* be aware of params.vlan when changing code here */ 3178 /* be aware of params.vlan when changing code here */
3181 3179
3182 err = rdev->ops->change_station(&rdev->wiphy, dev, mac_addr, &params); 3180 err = rdev_change_station(rdev, dev, mac_addr, &params);
3183 3181
3184 if (params.vlan) 3182 if (params.vlan)
3185 dev_put(params.vlan); 3183 dev_put(params.vlan);
@@ -3312,7 +3310,7 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
3312 3310
3313 /* be aware of params.vlan when changing code here */ 3311 /* be aware of params.vlan when changing code here */
3314 3312
3315 err = rdev->ops->add_station(&rdev->wiphy, dev, mac_addr, &params); 3313 err = rdev_add_station(rdev, dev, mac_addr, &params);
3316 3314
3317 if (params.vlan) 3315 if (params.vlan)
3318 dev_put(params.vlan); 3316 dev_put(params.vlan);
@@ -3337,7 +3335,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
3337 if (!rdev->ops->del_station) 3335 if (!rdev->ops->del_station)
3338 return -EOPNOTSUPP; 3336 return -EOPNOTSUPP;
3339 3337
3340 return rdev->ops->del_station(&rdev->wiphy, dev, mac_addr); 3338 return rdev_del_station(rdev, dev, mac_addr);
3341} 3339}
3342 3340
3343static 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,
@@ -3419,8 +3417,8 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
3419 } 3417 }
3420 3418
3421 while (1) { 3419 while (1) {
3422 err = dev->ops->dump_mpath(&dev->wiphy, netdev, path_idx, 3420 err = rdev_dump_mpath(dev, netdev, path_idx, dst, next_hop,
3423 dst, next_hop, &pinfo); 3421 &pinfo);
3424 if (err == -ENOENT) 3422 if (err == -ENOENT)
3425 break; 3423 break;
3426 if (err) 3424 if (err)
@@ -3467,7 +3465,7 @@ static int nl80211_get_mpath(struct sk_buff *skb, struct genl_info *info)
3467 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 3465 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
3468 return -EOPNOTSUPP; 3466 return -EOPNOTSUPP;
3469 3467
3470 err = rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, &pinfo); 3468 err = rdev_get_mpath(rdev, dev, dst, next_hop, &pinfo);
3471 if (err) 3469 if (err)
3472 return err; 3470 return err;
3473 3471
@@ -3506,7 +3504,7 @@ static int nl80211_set_mpath(struct sk_buff *skb, struct genl_info *info)
3506 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 3504 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
3507 return -EOPNOTSUPP; 3505 return -EOPNOTSUPP;
3508 3506
3509 return rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop); 3507 return rdev_change_mpath(rdev, dev, dst, next_hop);
3510} 3508}
3511 3509
3512static 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)
@@ -3531,7 +3529,7 @@ static int nl80211_new_mpath(struct sk_buff *skb, struct genl_info *info)
3531 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) 3529 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT)
3532 return -EOPNOTSUPP; 3530 return -EOPNOTSUPP;
3533 3531
3534 return rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop); 3532 return rdev_add_mpath(rdev, dev, dst, next_hop);
3535} 3533}
3536 3534
3537static 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)
@@ -3546,7 +3544,7 @@ static int nl80211_del_mpath(struct sk_buff *skb, struct genl_info *info)
3546 if (!rdev->ops->del_mpath) 3544 if (!rdev->ops->del_mpath)
3547 return -EOPNOTSUPP; 3545 return -EOPNOTSUPP;
3548 3546
3549 return rdev->ops->del_mpath(&rdev->wiphy, dev, dst); 3547 return rdev_del_mpath(rdev, dev, dst);
3550} 3548}
3551 3549
3552static 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)
@@ -3591,7 +3589,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
3591 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) 3589 dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO)
3592 return -EOPNOTSUPP; 3590 return -EOPNOTSUPP;
3593 3591
3594 return rdev->ops->change_bss(&rdev->wiphy, dev, &params); 3592 return rdev_change_bss(rdev, dev, &params);
3595} 3593}
3596 3594
3597static 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] = {
@@ -3705,8 +3703,7 @@ static int nl80211_get_mesh_config(struct sk_buff *skb,
3705 if (!wdev->mesh_id_len) 3703 if (!wdev->mesh_id_len)
3706 memcpy(&cur_params, &default_mesh_config, sizeof(cur_params)); 3704 memcpy(&cur_params, &default_mesh_config, sizeof(cur_params));
3707 else 3705 else
3708 err = rdev->ops->get_mesh_config(&rdev->wiphy, dev, 3706 err = rdev_get_mesh_config(rdev, dev, &cur_params);
3709 &cur_params);
3710 wdev_unlock(wdev); 3707 wdev_unlock(wdev);
3711 3708
3712 if (err) 3709 if (err)
@@ -4008,8 +4005,7 @@ static int nl80211_update_mesh_config(struct sk_buff *skb,
4008 err = -ENOLINK; 4005 err = -ENOLINK;
4009 4006
4010 if (!err) 4007 if (!err)
4011 err = rdev->ops->update_mesh_config(&rdev->wiphy, dev, 4008 err = rdev_update_mesh_config(rdev, dev, mask, &cfg);
4012 mask, &cfg);
4013 4009
4014 wdev_unlock(wdev); 4010 wdev_unlock(wdev);
4015 4011
@@ -4394,7 +4390,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
4394 request->scan_start = jiffies; 4390 request->scan_start = jiffies;
4395 4391
4396 rdev->scan_req = request; 4392 rdev->scan_req = request;
4397 err = rdev->ops->scan(&rdev->wiphy, request); 4393 err = rdev_scan(rdev, request);
4398 4394
4399 if (!err) { 4395 if (!err) {
4400 nl80211_send_scan_start(rdev, wdev); 4396 nl80211_send_scan_start(rdev, wdev);
@@ -4635,7 +4631,7 @@ static int nl80211_start_sched_scan(struct sk_buff *skb,
4635 request->interval = interval; 4631 request->interval = interval;
4636 request->scan_start = jiffies; 4632 request->scan_start = jiffies;
4637 4633
4638 err = rdev->ops->sched_scan_start(&rdev->wiphy, dev, request); 4634 err = rdev_sched_scan_start(rdev, dev, request);
4639 if (!err) { 4635 if (!err) {
4640 rdev->sched_scan_req = request; 4636 rdev->sched_scan_req = request;
4641 nl80211_send_sched_scan(rdev, dev, 4637 nl80211_send_sched_scan(rdev, dev,
@@ -4878,8 +4874,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
4878 while (1) { 4874 while (1) {
4879 struct ieee80211_channel *chan; 4875 struct ieee80211_channel *chan;
4880 4876
4881 res = dev->ops->dump_survey(&dev->wiphy, netdev, survey_idx, 4877 res = rdev_dump_survey(dev, netdev, survey_idx, &survey);
4882 &survey);
4883 if (res == -ENOENT) 4878 if (res == -ENOENT)
4884 break; 4879 break;
4885 if (res) 4880 if (res)
@@ -5465,7 +5460,7 @@ static int nl80211_testmode_do(struct sk_buff *skb, struct genl_info *info)
5465 err = -EOPNOTSUPP; 5460 err = -EOPNOTSUPP;
5466 if (rdev->ops->testmode_cmd) { 5461 if (rdev->ops->testmode_cmd) {
5467 rdev->testmode_info = info; 5462 rdev->testmode_info = info;
5468 err = rdev->ops->testmode_cmd(&rdev->wiphy, 5463 err = rdev_testmode_cmd(rdev,
5469 nla_data(info->attrs[NL80211_ATTR_TESTDATA]), 5464 nla_data(info->attrs[NL80211_ATTR_TESTDATA]),
5470 nla_len(info->attrs[NL80211_ATTR_TESTDATA])); 5465 nla_len(info->attrs[NL80211_ATTR_TESTDATA]));
5471 rdev->testmode_info = NULL; 5466 rdev->testmode_info = NULL;
@@ -5547,8 +5542,7 @@ static int nl80211_testmode_dump(struct sk_buff *skb,
5547 genlmsg_cancel(skb, hdr); 5542 genlmsg_cancel(skb, hdr);
5548 break; 5543 break;
5549 } 5544 }
5550 err = rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, 5545 err = rdev_testmode_dump(rdev, skb, cb, data, data_len);
5551 data, data_len);
5552 nla_nest_end(skb, tmdata); 5546 nla_nest_end(skb, tmdata);
5553 5547
5554 if (err == -ENOBUFS || err == -ENOENT) { 5548 if (err == -ENOBUFS || err == -ENOENT) {
@@ -5853,7 +5847,7 @@ static int nl80211_flush_pmksa(struct sk_buff *skb, struct genl_info *info)
5853 if (!rdev->ops->flush_pmksa) 5847 if (!rdev->ops->flush_pmksa)
5854 return -EOPNOTSUPP; 5848 return -EOPNOTSUPP;
5855 5849
5856 return rdev->ops->flush_pmksa(&rdev->wiphy, dev); 5850 return rdev_flush_pmksa(rdev, dev);
5857} 5851}
5858 5852
5859static 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)
@@ -5880,10 +5874,10 @@ static int nl80211_tdls_mgmt(struct sk_buff *skb, struct genl_info *info)
5880 status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]); 5874 status_code = nla_get_u16(info->attrs[NL80211_ATTR_STATUS_CODE]);
5881 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]);
5882 5876
5883 return rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code, 5877 return rdev_tdls_mgmt(rdev, dev, peer, action_code,
5884 dialog_token, status_code, 5878 dialog_token, status_code,
5885 nla_data(info->attrs[NL80211_ATTR_IE]), 5879 nla_data(info->attrs[NL80211_ATTR_IE]),
5886 nla_len(info->attrs[NL80211_ATTR_IE])); 5880 nla_len(info->attrs[NL80211_ATTR_IE]));
5887} 5881}
5888 5882
5889static 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)
@@ -5904,7 +5898,7 @@ static int nl80211_tdls_oper(struct sk_buff *skb, struct genl_info *info)
5904 operation = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_OPERATION]); 5898 operation = nla_get_u8(info->attrs[NL80211_ATTR_TDLS_OPERATION]);
5905 peer = nla_data(info->attrs[NL80211_ATTR_MAC]); 5899 peer = nla_data(info->attrs[NL80211_ATTR_MAC]);
5906 5900
5907 return rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, operation); 5901 return rdev_tdls_oper(rdev, dev, peer, operation);
5908} 5902}
5909 5903
5910static int nl80211_remain_on_channel(struct sk_buff *skb, 5904static int nl80211_remain_on_channel(struct sk_buff *skb,
@@ -5959,8 +5953,8 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
5959 goto free_msg; 5953 goto free_msg;
5960 } 5954 }
5961 5955
5962 err = rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan, 5956 err = rdev_remain_on_channel(rdev, wdev, chan, channel_type, duration,
5963 channel_type, duration, &cookie); 5957 &cookie);
5964 5958
5965 if (err) 5959 if (err)
5966 goto free_msg; 5960 goto free_msg;
@@ -5994,7 +5988,7 @@ static int nl80211_cancel_remain_on_channel(struct sk_buff *skb,
5994 5988
5995 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); 5989 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
5996 5990
5997 return rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie); 5991 return rdev_cancel_remain_on_channel(rdev, wdev, cookie);
5998} 5992}
5999 5993
6000static u32 rateset_to_mask(struct ieee80211_supported_band *sband, 5994static u32 rateset_to_mask(struct ieee80211_supported_band *sband,
@@ -6137,7 +6131,7 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
6137 } 6131 }
6138 } 6132 }
6139 6133
6140 return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, NULL, &mask); 6134 return rdev_set_bitrate_mask(rdev, dev, NULL, &mask);
6141} 6135}
6142 6136
6143static 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)
@@ -6312,7 +6306,7 @@ static int nl80211_tx_mgmt_cancel_wait(struct sk_buff *skb, struct genl_info *in
6312 6306
6313 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]); 6307 cookie = nla_get_u64(info->attrs[NL80211_ATTR_COOKIE]);
6314 6308
6315 return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie); 6309 return rdev_mgmt_tx_cancel_wait(rdev, wdev, cookie);
6316} 6310}
6317 6311
6318static 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)
@@ -6342,8 +6336,7 @@ static int nl80211_set_power_save(struct sk_buff *skb, struct genl_info *info)
6342 if (state == wdev->ps) 6336 if (state == wdev->ps)
6343 return 0; 6337 return 0;
6344 6338
6345 err = rdev->ops->set_power_mgmt(wdev->wiphy, dev, state, 6339 err = rdev_set_power_mgmt(rdev, dev, state, wdev->ps_timeout);
6346 wdev->ps_timeout);
6347 if (!err) 6340 if (!err)
6348 wdev->ps = state; 6341 wdev->ps = state;
6349 return err; 6342 return err;
@@ -6423,8 +6416,7 @@ static int nl80211_set_cqm_txe(struct genl_info *info,
6423 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) 6416 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
6424 return -EOPNOTSUPP; 6417 return -EOPNOTSUPP;
6425 6418
6426 return rdev->ops->set_cqm_txe_config(wdev->wiphy, dev, 6419 return rdev_set_cqm_txe_config(rdev, dev, rate, pkts, intvl);
6427 rate, pkts, intvl);
6428} 6420}
6429 6421
6430static int nl80211_set_cqm_rssi(struct genl_info *info, 6422static int nl80211_set_cqm_rssi(struct genl_info *info,
@@ -6446,8 +6438,7 @@ static int nl80211_set_cqm_rssi(struct genl_info *info,
6446 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) 6438 wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)
6447 return -EOPNOTSUPP; 6439 return -EOPNOTSUPP;
6448 6440
6449 return rdev->ops->set_cqm_rssi_config(wdev->wiphy, dev, 6441 return rdev_set_cqm_rssi_config(rdev, dev, threshold, hysteresis);
6450 threshold, hysteresis);
6451} 6442}
6452 6443
6453static 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)
@@ -6772,7 +6763,7 @@ static int nl80211_set_wowlan(struct sk_buff *skb, struct genl_info *info)
6772 6763
6773 set_wakeup: 6764 set_wakeup:
6774 if (rdev->ops->set_wakeup && prev_enabled != !!rdev->wowlan) 6765 if (rdev->ops->set_wakeup && prev_enabled != !!rdev->wowlan)
6775 rdev->ops->set_wakeup(&rdev->wiphy, rdev->wowlan); 6766 rdev_set_wakeup(rdev, rdev->wowlan);
6776 6767
6777 return 0; 6768 return 0;
6778 error: 6769 error:
@@ -6828,7 +6819,7 @@ static int nl80211_set_rekey_data(struct sk_buff *skb, struct genl_info *info)
6828 goto out; 6819 goto out;
6829 } 6820 }
6830 6821
6831 err = rdev->ops->set_rekey_data(&rdev->wiphy, dev, &rekey_data); 6822 err = rdev_set_rekey_data(rdev, dev, &rekey_data);
6832 out: 6823 out:
6833 wdev_unlock(wdev); 6824 wdev_unlock(wdev);
6834 return err; 6825 return err;
@@ -6887,7 +6878,7 @@ static int nl80211_probe_client(struct sk_buff *skb,
6887 6878
6888 addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 6879 addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
6889 6880
6890 err = rdev->ops->probe_client(&rdev->wiphy, dev, addr, &cookie); 6881 err = rdev_probe_client(rdev, dev, addr, &cookie);
6891 if (err) 6882 if (err)
6892 goto free_msg; 6883 goto free_msg;
6893 6884
diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
new file mode 100644
index 000000000000..b6fad29d656b
--- /dev/null
+++ b/net/wireless/rdev-ops.h
@@ -0,0 +1,558 @@
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
8static inline int rdev_suspend(struct cfg80211_registered_device *rdev)
9{
10 return rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
11}
12
13static inline int rdev_resume(struct cfg80211_registered_device *rdev)
14{
15 return rdev->ops->resume(&rdev->wiphy);
16}
17
18static inline void rdev_set_wakeup(struct cfg80211_registered_device *rdev,
19 bool enabled)
20{
21 rdev->ops->set_wakeup(&rdev->wiphy, enabled);
22}
23
24static inline struct wireless_dev
25*rdev_add_virtual_intf(struct cfg80211_registered_device *rdev, char *name,
26 enum nl80211_iftype type, u32 *flags,
27 struct vif_params *params)
28{
29 return rdev->ops->add_virtual_intf(&rdev->wiphy, name, type, flags,
30 params);
31}
32
33static inline int
34rdev_del_virtual_intf(struct cfg80211_registered_device *rdev,
35 struct wireless_dev *wdev)
36{
37 return rdev->ops->del_virtual_intf(&rdev->wiphy, wdev);
38}
39
40static inline int
41rdev_change_virtual_intf(struct cfg80211_registered_device *rdev,
42 struct net_device *dev, enum nl80211_iftype type,
43 u32 *flags, struct vif_params *params)
44{
45 return rdev->ops->change_virtual_intf(&rdev->wiphy, dev, type, flags,
46 params);
47}
48
49static inline int rdev_add_key(struct cfg80211_registered_device *rdev,
50 struct net_device *netdev, u8 key_index,
51 bool pairwise, const u8 *mac_addr,
52 struct key_params *params)
53{
54 return rdev->ops->add_key(&rdev->wiphy, netdev, key_index, pairwise,
55 mac_addr, params);
56}
57
58static inline int
59rdev_get_key(struct cfg80211_registered_device *rdev, struct net_device *netdev,
60 u8 key_index, bool pairwise, const u8 *mac_addr, void *cookie,
61 void (*callback)(void *cookie, struct key_params*))
62{
63 return rdev->ops->get_key(&rdev->wiphy, netdev, key_index, pairwise,
64 mac_addr, cookie, callback);
65}
66
67static inline int rdev_del_key(struct cfg80211_registered_device *rdev,
68 struct net_device *netdev, u8 key_index,
69 bool pairwise, const u8 *mac_addr)
70{
71 return rdev->ops->del_key(&rdev->wiphy, netdev, key_index, pairwise,
72 mac_addr);
73}
74
75static inline int
76rdev_set_default_key(struct cfg80211_registered_device *rdev,
77 struct net_device *netdev, u8 key_index, bool unicast,
78 bool multicast)
79{
80 return rdev->ops->set_default_key(&rdev->wiphy, netdev, key_index,
81 unicast, multicast);
82}
83
84static inline int
85rdev_set_default_mgmt_key(struct cfg80211_registered_device *rdev,
86 struct net_device *netdev, u8 key_index)
87{
88 return rdev->ops->set_default_mgmt_key(&rdev->wiphy, netdev,
89 key_index);
90}
91
92static inline int rdev_start_ap(struct cfg80211_registered_device *rdev,
93 struct net_device *dev,
94 struct cfg80211_ap_settings *settings)
95{
96 return rdev->ops->start_ap(&rdev->wiphy, dev, settings);
97}
98
99static inline int rdev_change_beacon(struct cfg80211_registered_device *rdev,
100 struct net_device *dev,
101 struct cfg80211_beacon_data *info)
102{
103 return rdev->ops->change_beacon(&rdev->wiphy, dev, info);
104}
105
106static inline int rdev_stop_ap(struct cfg80211_registered_device *rdev,
107 struct net_device *dev)
108{
109 return rdev->ops->stop_ap(&rdev->wiphy, dev);
110}
111
112static inline int rdev_add_station(struct cfg80211_registered_device *rdev,
113 struct net_device *dev, u8 *mac,
114 struct station_parameters *params)
115{
116 return rdev->ops->add_station(&rdev->wiphy, dev, mac, params);
117}
118
119static inline int rdev_del_station(struct cfg80211_registered_device *rdev,
120 struct net_device *dev, u8 *mac)
121{
122 return rdev->ops->del_station(&rdev->wiphy, dev, mac);
123}
124
125static inline int rdev_change_station(struct cfg80211_registered_device *rdev,
126 struct net_device *dev, u8 *mac,
127 struct station_parameters *params)
128{
129 return rdev->ops->change_station(&rdev->wiphy, dev, mac, params);
130}
131
132static inline int rdev_get_station(struct cfg80211_registered_device *rdev,
133 struct net_device *dev, u8 *mac,
134 struct station_info *sinfo)
135{
136 return rdev->ops->get_station(&rdev->wiphy, dev, mac, sinfo);
137}
138
139static inline int rdev_dump_station(struct cfg80211_registered_device *rdev,
140 struct net_device *dev, int idx, u8 *mac,
141 struct station_info *sinfo)
142{
143 return rdev->ops->dump_station(&rdev->wiphy, dev, idx, mac, sinfo);
144}
145
146static inline int rdev_add_mpath(struct cfg80211_registered_device *rdev,
147 struct net_device *dev, u8 *dst, u8 *next_hop)
148{
149 return rdev->ops->add_mpath(&rdev->wiphy, dev, dst, next_hop);
150}
151
152static inline int rdev_del_mpath(struct cfg80211_registered_device *rdev,
153 struct net_device *dev, u8 *dst)
154{
155 return rdev->ops->del_mpath(&rdev->wiphy, dev, dst);
156}
157
158static inline int rdev_change_mpath(struct cfg80211_registered_device *rdev,
159 struct net_device *dev, u8 *dst,
160 u8 *next_hop)
161{
162 return rdev->ops->change_mpath(&rdev->wiphy, dev, dst, next_hop);
163}
164
165static inline int rdev_get_mpath(struct cfg80211_registered_device *rdev,
166 struct net_device *dev, u8 *dst, u8 *next_hop,
167 struct mpath_info *pinfo)
168{
169 return rdev->ops->get_mpath(&rdev->wiphy, dev, dst, next_hop, pinfo);
170}
171
172static inline int rdev_dump_mpath(struct cfg80211_registered_device *rdev,
173 struct net_device *dev, int idx, u8 *dst,
174 u8 *next_hop, struct mpath_info *pinfo)
175
176{
177 return rdev->ops->dump_mpath(&rdev->wiphy, dev, idx, dst, next_hop,
178 pinfo);
179}
180
181static inline int
182rdev_get_mesh_config(struct cfg80211_registered_device *rdev,
183 struct net_device *dev, struct mesh_config *conf)
184{
185 return rdev->ops->get_mesh_config(&rdev->wiphy, dev, conf);
186}
187
188static inline int
189rdev_update_mesh_config(struct cfg80211_registered_device *rdev,
190 struct net_device *dev, u32 mask,
191 const struct mesh_config *nconf)
192{
193 return rdev->ops->update_mesh_config(&rdev->wiphy, dev, mask, nconf);
194}
195
196static inline int rdev_join_mesh(struct cfg80211_registered_device *rdev,
197 struct net_device *dev,
198 const struct mesh_config *conf,
199 const struct mesh_setup *setup)
200{
201 return rdev->ops->join_mesh(&rdev->wiphy, dev, conf, setup);
202}
203
204
205static inline int rdev_leave_mesh(struct cfg80211_registered_device *rdev,
206 struct net_device *dev)
207{
208 return rdev->ops->leave_mesh(&rdev->wiphy, dev);
209}
210
211static inline int rdev_change_bss(struct cfg80211_registered_device *rdev,
212 struct net_device *dev,
213 struct bss_parameters *params)
214
215{
216 return rdev->ops->change_bss(&rdev->wiphy, dev, params);
217}
218
219static inline int rdev_set_txq_params(struct cfg80211_registered_device *rdev,
220 struct net_device *dev,
221 struct ieee80211_txq_params *params)
222
223{
224 return rdev->ops->set_txq_params(&rdev->wiphy, dev, params);
225}
226
227static inline int
228rdev_libertas_set_mesh_channel(struct cfg80211_registered_device *rdev,
229 struct net_device *dev,
230 struct ieee80211_channel *chan)
231{
232 return rdev->ops->libertas_set_mesh_channel(&rdev->wiphy, dev, chan);
233}
234
235static inline int
236rdev_set_monitor_channel(struct cfg80211_registered_device *rdev,
237 struct ieee80211_channel *chan,
238 enum nl80211_channel_type channel_type)
239{
240 return rdev->ops->set_monitor_channel(&rdev->wiphy, chan,
241 channel_type);
242}
243
244static inline int rdev_scan(struct cfg80211_registered_device *rdev,
245 struct cfg80211_scan_request *request)
246{
247 return rdev->ops->scan(&rdev->wiphy, request);
248}
249
250static inline int rdev_auth(struct cfg80211_registered_device *rdev,
251 struct net_device *dev,
252 struct cfg80211_auth_request *req)
253{
254 return rdev->ops->auth(&rdev->wiphy, dev, req);
255}
256
257static inline int rdev_assoc(struct cfg80211_registered_device *rdev,
258 struct net_device *dev,
259 struct cfg80211_assoc_request *req)
260{
261 return rdev->ops->assoc(&rdev->wiphy, dev, req);
262}
263
264static inline int rdev_deauth(struct cfg80211_registered_device *rdev,
265 struct net_device *dev,
266 struct cfg80211_deauth_request *req)
267{
268 return rdev->ops->deauth(&rdev->wiphy, dev, req);
269}
270
271static inline int rdev_disassoc(struct cfg80211_registered_device *rdev,
272 struct net_device *dev,
273 struct cfg80211_disassoc_request *req)
274{
275 return rdev->ops->disassoc(&rdev->wiphy, dev, req);
276}
277
278static inline int rdev_connect(struct cfg80211_registered_device *rdev,
279 struct net_device *dev,
280 struct cfg80211_connect_params *sme)
281{
282 return rdev->ops->connect(&rdev->wiphy, dev, sme);
283}
284
285static inline int rdev_disconnect(struct cfg80211_registered_device *rdev,
286 struct net_device *dev, u16 reason_code)
287{
288 return rdev->ops->disconnect(&rdev->wiphy, dev, reason_code);
289}
290
291static inline int rdev_join_ibss(struct cfg80211_registered_device *rdev,
292 struct net_device *dev,
293 struct cfg80211_ibss_params *params)
294{
295 return rdev->ops->join_ibss(&rdev->wiphy, dev, params);
296}
297
298static inline int rdev_leave_ibss(struct cfg80211_registered_device *rdev,
299 struct net_device *dev)
300{
301 return rdev->ops->leave_ibss(&rdev->wiphy, dev);
302}
303
304static inline int
305rdev_set_wiphy_params(struct cfg80211_registered_device *rdev, u32 changed)
306{
307 return rdev->ops->set_wiphy_params(&rdev->wiphy, changed);
308}
309
310static inline int rdev_set_tx_power(struct cfg80211_registered_device *rdev,
311 enum nl80211_tx_power_setting type, int mbm)
312{
313 return rdev->ops->set_tx_power(&rdev->wiphy, type, mbm);
314}
315
316static inline int rdev_get_tx_power(struct cfg80211_registered_device *rdev,
317 int *dbm)
318{
319 return rdev->ops->get_tx_power(&rdev->wiphy, dbm);
320}
321
322static inline int rdev_set_wds_peer(struct cfg80211_registered_device *rdev,
323 struct net_device *dev, const u8 *addr)
324{
325 return rdev->ops->set_wds_peer(&rdev->wiphy, dev, addr);
326}
327
328static inline void rdev_rfkill_poll(struct cfg80211_registered_device *rdev)
329{
330 rdev->ops->rfkill_poll(&rdev->wiphy);
331}
332
333
334#ifdef CONFIG_NL80211_TESTMODE
335static inline int rdev_testmode_cmd(struct cfg80211_registered_device *rdev,
336 void *data, int len)
337{
338 return rdev->ops->testmode_cmd(&rdev->wiphy, data, len);
339}
340
341static inline int rdev_testmode_dump(struct cfg80211_registered_device *rdev,
342 struct sk_buff *skb,
343 struct netlink_callback *cb, void *data,
344 int len)
345{
346 return rdev->ops->testmode_dump(&rdev->wiphy, skb, cb, data,
347 len);
348}
349#endif
350
351static inline int
352rdev_set_bitrate_mask(struct cfg80211_registered_device *rdev,
353 struct net_device *dev, const u8 *peer,
354 const struct cfg80211_bitrate_mask *mask)
355{
356 return rdev->ops->set_bitrate_mask(&rdev->wiphy, dev, peer, mask);
357}
358
359static inline int rdev_dump_survey(struct cfg80211_registered_device *rdev,
360 struct net_device *netdev, int idx,
361 struct survey_info *info)
362{
363 return rdev->ops->dump_survey(&rdev->wiphy, netdev, idx, info);
364}
365
366static inline int rdev_set_pmksa(struct cfg80211_registered_device *rdev,
367 struct net_device *netdev,
368 struct cfg80211_pmksa *pmksa)
369{
370 return rdev->ops->set_pmksa(&rdev->wiphy, netdev, pmksa);
371}
372
373static inline int rdev_del_pmksa(struct cfg80211_registered_device *rdev,
374 struct net_device *netdev,
375 struct cfg80211_pmksa *pmksa)
376{
377 return rdev->ops->del_pmksa(&rdev->wiphy, netdev, pmksa);
378}
379
380static inline int rdev_flush_pmksa(struct cfg80211_registered_device *rdev,
381 struct net_device *netdev)
382{
383 return rdev->ops->flush_pmksa(&rdev->wiphy, netdev);
384}
385
386static inline int
387rdev_remain_on_channel(struct cfg80211_registered_device *rdev,
388 struct wireless_dev *wdev,
389 struct ieee80211_channel *chan,
390 enum nl80211_channel_type channel_type,
391 unsigned int duration, u64 *cookie)
392{
393 return rdev->ops->remain_on_channel(&rdev->wiphy, wdev, chan,
394 channel_type, duration, cookie);
395}
396
397static inline int
398rdev_cancel_remain_on_channel(struct cfg80211_registered_device *rdev,
399 struct wireless_dev *wdev, u64 cookie)
400{
401 return rdev->ops->cancel_remain_on_channel(&rdev->wiphy, wdev, cookie);
402}
403
404static inline int rdev_mgmt_tx(struct cfg80211_registered_device *rdev,
405 struct wireless_dev *wdev,
406 struct ieee80211_channel *chan, bool offchan,
407 enum nl80211_channel_type channel_type,
408 bool channel_type_valid, unsigned int wait,
409 const u8 *buf, size_t len, bool no_cck,
410 bool dont_wait_for_ack, u64 *cookie)
411{
412 return rdev->ops->mgmt_tx(&rdev->wiphy, wdev, chan, offchan,
413 channel_type, channel_type_valid, wait, buf,
414 len, no_cck, dont_wait_for_ack, cookie);
415}
416
417static inline int
418rdev_mgmt_tx_cancel_wait(struct cfg80211_registered_device *rdev,
419 struct wireless_dev *wdev, u64 cookie)
420{
421 return rdev->ops->mgmt_tx_cancel_wait(&rdev->wiphy, wdev, cookie);
422}
423
424static inline int rdev_set_power_mgmt(struct cfg80211_registered_device *rdev,
425 struct net_device *dev, bool enabled,
426 int timeout)
427{
428 return rdev->ops->set_power_mgmt(&rdev->wiphy, dev, enabled, timeout);
429}
430
431static inline int
432rdev_set_cqm_rssi_config(struct cfg80211_registered_device *rdev,
433 struct net_device *dev, s32 rssi_thold, u32 rssi_hyst)
434{
435 return rdev->ops->set_cqm_rssi_config(&rdev->wiphy, dev, rssi_thold,
436 rssi_hyst);
437}
438
439static inline int
440rdev_set_cqm_txe_config(struct cfg80211_registered_device *rdev,
441 struct net_device *dev, u32 rate, u32 pkts, u32 intvl)
442{
443 return rdev->ops->set_cqm_txe_config(&rdev->wiphy, dev, rate, pkts,
444 intvl);
445}
446
447static inline void
448rdev_mgmt_frame_register(struct cfg80211_registered_device *rdev,
449 struct wireless_dev *wdev, u16 frame_type, bool reg)
450{
451 rdev->ops->mgmt_frame_register(&rdev->wiphy, wdev , frame_type,
452 reg);
453}
454
455static inline int rdev_set_antenna(struct cfg80211_registered_device *rdev,
456 u32 tx_ant, u32 rx_ant)
457{
458 return rdev->ops->set_antenna(&rdev->wiphy, tx_ant, rx_ant);
459}
460
461static inline int rdev_get_antenna(struct cfg80211_registered_device *rdev,
462 u32 *tx_ant, u32 *rx_ant)
463{
464 return rdev->ops->get_antenna(&rdev->wiphy, tx_ant, rx_ant);
465}
466
467static inline int rdev_set_ringparam(struct cfg80211_registered_device *rdev,
468 u32 tx, u32 rx)
469{
470 return rdev->ops->set_ringparam(&rdev->wiphy, tx, rx);
471}
472
473static inline void rdev_get_ringparam(struct cfg80211_registered_device *rdev,
474 u32 *tx, u32 *tx_max, u32 *rx,
475 u32 *rx_max)
476{
477 rdev->ops->get_ringparam(&rdev->wiphy, tx, tx_max, rx, rx_max);
478}
479
480static inline int
481rdev_sched_scan_start(struct cfg80211_registered_device *rdev,
482 struct net_device *dev,
483 struct cfg80211_sched_scan_request *request)
484{
485 return rdev->ops->sched_scan_start(&rdev->wiphy, dev, request);
486}
487
488static inline int rdev_sched_scan_stop(struct cfg80211_registered_device *rdev,
489 struct net_device *dev)
490{
491 return rdev->ops->sched_scan_stop(&rdev->wiphy, dev);
492}
493
494static inline int rdev_set_rekey_data(struct cfg80211_registered_device *rdev,
495 struct net_device *dev,
496 struct cfg80211_gtk_rekey_data *data)
497{
498 return rdev->ops->set_rekey_data(&rdev->wiphy, dev, data);
499}
500
501static inline int rdev_tdls_mgmt(struct cfg80211_registered_device *rdev,
502 struct net_device *dev, u8 *peer,
503 u8 action_code, u8 dialog_token,
504 u16 status_code, const u8 *buf, size_t len)
505{
506 return rdev->ops->tdls_mgmt(&rdev->wiphy, dev, peer, action_code,
507 dialog_token, status_code, buf, len);
508}
509
510static inline int rdev_tdls_oper(struct cfg80211_registered_device *rdev,
511 struct net_device *dev, u8 *peer,
512 enum nl80211_tdls_operation oper)
513{
514 return rdev->ops->tdls_oper(&rdev->wiphy, dev, peer, oper);
515}
516
517static inline int rdev_probe_client(struct cfg80211_registered_device *rdev,
518 struct net_device *dev, const u8 *peer,
519 u64 *cookie)
520{
521 return rdev->ops->probe_client(&rdev->wiphy, dev, peer, cookie);
522}
523
524static inline int rdev_set_noack_map(struct cfg80211_registered_device *rdev,
525 struct net_device *dev, u16 noack_map)
526{
527 return rdev->ops->set_noack_map(&rdev->wiphy, dev, noack_map);
528}
529
530static inline int
531rdev_get_et_sset_count(struct cfg80211_registered_device *rdev,
532 struct net_device *dev, int sset)
533{
534 return rdev->ops->get_et_sset_count(&rdev->wiphy, dev, sset);
535}
536
537static inline void rdev_get_et_stats(struct cfg80211_registered_device *rdev,
538 struct net_device *dev,
539 struct ethtool_stats *stats, u64 *data)
540{
541 rdev->ops->get_et_stats(&rdev->wiphy, dev, stats, data);
542}
543
544static inline void rdev_get_et_strings(struct cfg80211_registered_device *rdev,
545 struct net_device *dev, u32 sset,
546 u8 *data)
547{
548 rdev->ops->get_et_strings(&rdev->wiphy, dev, sset, data);
549}
550
551static inline struct ieee80211_channel
552*rdev_get_channel(struct cfg80211_registered_device *rdev,
553 struct wireless_dev *wdev, enum nl80211_channel_type *type)
554{
555 return rdev->ops->get_channel(&rdev->wiphy, wdev, type);
556}
557
558#endif /* __CFG80211_RDEV_OPS */
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index a8d5a9a07e49..a957077dd961 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -17,6 +17,7 @@
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
@@ -211,7 +212,7 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
211 dev = rdev->sched_scan_req->dev; 212 dev = rdev->sched_scan_req->dev;
212 213
213 if (!driver_initiated) { 214 if (!driver_initiated) {
214 int err = rdev->ops->sched_scan_stop(&rdev->wiphy, dev); 215 int err = rdev_sched_scan_stop(rdev, dev);
215 if (err) 216 if (err)
216 return err; 217 return err;
217 } 218 }
@@ -1052,7 +1053,7 @@ int cfg80211_wext_siwscan(struct net_device *dev,
1052 creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; 1053 creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
1053 1054
1054 rdev->scan_req = creq; 1055 rdev->scan_req = creq;
1055 err = rdev->ops->scan(wiphy, creq); 1056 err = rdev_scan(rdev, creq);
1056 if (err) { 1057 if (err) {
1057 rdev->scan_req = NULL; 1058 rdev->scan_req = NULL;
1058 /* creq will be freed below */ 1059 /* creq will be freed below */
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 07d717eb9e2a..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;
@@ -142,7 +143,7 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev)
142 143
143 rdev->scan_req = request; 144 rdev->scan_req = request;
144 145
145 err = rdev->ops->scan(wdev->wiphy, request); 146 err = rdev_scan(rdev, request);
146 if (!err) { 147 if (!err) {
147 wdev->conn->state = CFG80211_CONN_SCANNING; 148 wdev->conn->state = CFG80211_CONN_SCANNING;
148 nl80211_send_scan_start(rdev, wdev); 149 nl80211_send_scan_start(rdev, wdev);
@@ -717,7 +718,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
717 */ 718 */
718 if (rdev->ops->del_key) 719 if (rdev->ops->del_key)
719 for (i = 0; i < 6; i++) 720 for (i = 0; i < 6; i++)
720 rdev->ops->del_key(wdev->wiphy, dev, i, false, NULL); 721 rdev_del_key(rdev, dev, i, false, NULL);
721 722
722#ifdef CONFIG_CFG80211_WEXT 723#ifdef CONFIG_CFG80211_WEXT
723 memset(&wrqu, 0, sizeof(wrqu)); 724 memset(&wrqu, 0, sizeof(wrqu));
@@ -893,7 +894,7 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
893 } else { 894 } else {
894 wdev->sme_state = CFG80211_SME_CONNECTING; 895 wdev->sme_state = CFG80211_SME_CONNECTING;
895 wdev->connect_keys = connkeys; 896 wdev->connect_keys = connkeys;
896 err = rdev->ops->connect(&rdev->wiphy, dev, connect); 897 err = rdev_connect(rdev, dev, connect);
897 if (err) { 898 if (err) {
898 wdev->connect_keys = NULL; 899 wdev->connect_keys = NULL;
899 wdev->sme_state = CFG80211_SME_IDLE; 900 wdev->sme_state = CFG80211_SME_IDLE;
@@ -965,7 +966,7 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
965 if (err) 966 if (err)
966 return err; 967 return err;
967 } else { 968 } else {
968 err = rdev->ops->disconnect(&rdev->wiphy, dev, reason); 969 err = rdev_disconnect(rdev, dev, reason);
969 if (err) 970 if (err)
970 return err; 971 return err;
971 } 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/util.c b/net/wireless/util.c
index ef35f4ef2aa6..343f13c1d31d 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,
@@ -703,19 +705,18 @@ void cfg80211_upload_connect_keys(struct wireless_dev *wdev)
703 for (i = 0; i < 6; i++) { 705 for (i = 0; i < 6; i++) {
704 if (!wdev->connect_keys->params[i].cipher) 706 if (!wdev->connect_keys->params[i].cipher)
705 continue; 707 continue;
706 if (rdev->ops->add_key(wdev->wiphy, dev, i, false, NULL, 708 if (rdev_add_key(rdev, dev, i, false, NULL,
707 &wdev->connect_keys->params[i])) { 709 &wdev->connect_keys->params[i])) {
708 netdev_err(dev, "failed to set key %d\n", i); 710 netdev_err(dev, "failed to set key %d\n", i);
709 continue; 711 continue;
710 } 712 }
711 if (wdev->connect_keys->def == i) 713 if (wdev->connect_keys->def == i)
712 if (rdev->ops->set_default_key(wdev->wiphy, dev, 714 if (rdev_set_default_key(rdev, dev, i, true, true)) {
713 i, true, true)) {
714 netdev_err(dev, "failed to set defkey %d\n", i); 715 netdev_err(dev, "failed to set defkey %d\n", i);
715 continue; 716 continue;
716 } 717 }
717 if (wdev->connect_keys->defmgmt == i) 718 if (wdev->connect_keys->defmgmt == i)
718 if (rdev->ops->set_default_mgmt_key(wdev->wiphy, dev, i)) 719 if (rdev_set_default_mgmt_key(rdev, dev, i))
719 netdev_err(dev, "failed to set mgtdef %d\n", i); 720 netdev_err(dev, "failed to set mgtdef %d\n", i);
720 } 721 }
721 722
@@ -848,8 +849,7 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
848 cfg80211_process_rdev_events(rdev); 849 cfg80211_process_rdev_events(rdev);
849 } 850 }
850 851
851 err = rdev->ops->change_virtual_intf(&rdev->wiphy, dev, 852 err = rdev_change_virtual_intf(rdev, dev, ntype, flags, params);
852 ntype, flags, params);
853 853
854 WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype); 854 WARN_ON(!err && dev->ieee80211_ptr->iftype != ntype);
855 855
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;