diff options
author | Johannes Berg <johannes.berg@intel.com> | 2012-06-18 13:17:03 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2012-07-12 06:10:41 -0400 |
commit | fd0142844efa85d89017c89227a0f03de1eee327 (patch) | |
tree | 2b9977f712df0caa3ecda6dd59fe5b34932e2ab6 /net/wireless | |
parent | 1c90f9d404a45a1677c1e5791f5a2a8aaee0370a (diff) |
nl80211: move scan API to wdev
The new P2P Device will have to be able to scan for
P2P search, so move scanning to use struct wireless_dev
instead of struct net_device.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/core.c | 2 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 31 | ||||
-rw-r--r-- | net/wireless/nl80211.h | 6 | ||||
-rw-r--r-- | net/wireless/scan.c | 24 | ||||
-rw-r--r-- | net/wireless/sme.c | 6 |
5 files changed, 37 insertions, 32 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index 2781a411cecc..0557bb159025 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -708,7 +708,7 @@ static void wdev_cleanup_work(struct work_struct *work) | |||
708 | 708 | ||
709 | cfg80211_lock_rdev(rdev); | 709 | cfg80211_lock_rdev(rdev); |
710 | 710 | ||
711 | if (WARN_ON(rdev->scan_req && rdev->scan_req->dev == wdev->netdev)) { | 711 | if (WARN_ON(rdev->scan_req && rdev->scan_req->wdev == wdev)) { |
712 | rdev->scan_req->aborted = true; | 712 | rdev->scan_req->aborted = true; |
713 | ___cfg80211_scan_done(rdev, true); | 713 | ___cfg80211_scan_done(rdev, true); |
714 | } | 714 | } |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 6a9a1d7f51d1..6472c7f928dc 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -4130,7 +4130,7 @@ static int validate_scan_freqs(struct nlattr *freqs) | |||
4130 | static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | 4130 | static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) |
4131 | { | 4131 | { |
4132 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 4132 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
4133 | struct net_device *dev = info->user_ptr[1]; | 4133 | struct wireless_dev *wdev = info->user_ptr[1]; |
4134 | struct cfg80211_scan_request *request; | 4134 | struct cfg80211_scan_request *request; |
4135 | struct nlattr *attr; | 4135 | struct nlattr *attr; |
4136 | struct wiphy *wiphy; | 4136 | struct wiphy *wiphy; |
@@ -4290,15 +4290,16 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info) | |||
4290 | request->no_cck = | 4290 | request->no_cck = |
4291 | nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); | 4291 | nla_get_flag(info->attrs[NL80211_ATTR_TX_NO_CCK_RATE]); |
4292 | 4292 | ||
4293 | request->dev = dev; | 4293 | request->wdev = wdev; |
4294 | request->wiphy = &rdev->wiphy; | 4294 | request->wiphy = &rdev->wiphy; |
4295 | 4295 | ||
4296 | rdev->scan_req = request; | 4296 | rdev->scan_req = request; |
4297 | err = rdev->ops->scan(&rdev->wiphy, dev, request); | 4297 | err = rdev->ops->scan(&rdev->wiphy, request); |
4298 | 4298 | ||
4299 | if (!err) { | 4299 | if (!err) { |
4300 | nl80211_send_scan_start(rdev, dev); | 4300 | nl80211_send_scan_start(rdev, wdev); |
4301 | dev_hold(dev); | 4301 | if (wdev->netdev) |
4302 | dev_hold(wdev->netdev); | ||
4302 | } else { | 4303 | } else { |
4303 | out_free: | 4304 | out_free: |
4304 | rdev->scan_req = NULL; | 4305 | rdev->scan_req = NULL; |
@@ -7066,7 +7067,7 @@ static struct genl_ops nl80211_ops[] = { | |||
7066 | .doit = nl80211_trigger_scan, | 7067 | .doit = nl80211_trigger_scan, |
7067 | .policy = nl80211_policy, | 7068 | .policy = nl80211_policy, |
7068 | .flags = GENL_ADMIN_PERM, | 7069 | .flags = GENL_ADMIN_PERM, |
7069 | .internal_flags = NL80211_FLAG_NEED_NETDEV_UP | | 7070 | .internal_flags = NL80211_FLAG_NEED_WDEV_UP | |
7070 | NL80211_FLAG_NEED_RTNL, | 7071 | NL80211_FLAG_NEED_RTNL, |
7071 | }, | 7072 | }, |
7072 | { | 7073 | { |
@@ -7458,7 +7459,7 @@ static int nl80211_add_scan_req(struct sk_buff *msg, | |||
7458 | 7459 | ||
7459 | static int nl80211_send_scan_msg(struct sk_buff *msg, | 7460 | static int nl80211_send_scan_msg(struct sk_buff *msg, |
7460 | struct cfg80211_registered_device *rdev, | 7461 | struct cfg80211_registered_device *rdev, |
7461 | struct net_device *netdev, | 7462 | struct wireless_dev *wdev, |
7462 | u32 pid, u32 seq, int flags, | 7463 | u32 pid, u32 seq, int flags, |
7463 | u32 cmd) | 7464 | u32 cmd) |
7464 | { | 7465 | { |
@@ -7469,7 +7470,9 @@ static int nl80211_send_scan_msg(struct sk_buff *msg, | |||
7469 | return -1; | 7470 | return -1; |
7470 | 7471 | ||
7471 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || | 7472 | if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) || |
7472 | nla_put_u32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex)) | 7473 | (wdev->netdev && nla_put_u32(msg, NL80211_ATTR_IFINDEX, |
7474 | wdev->netdev->ifindex)) || | ||
7475 | nla_put_u64(msg, NL80211_ATTR_WDEV, wdev_id(wdev))) | ||
7473 | goto nla_put_failure; | 7476 | goto nla_put_failure; |
7474 | 7477 | ||
7475 | /* ignore errors and send incomplete event anyway */ | 7478 | /* ignore errors and send incomplete event anyway */ |
@@ -7506,7 +7509,7 @@ nl80211_send_sched_scan_msg(struct sk_buff *msg, | |||
7506 | } | 7509 | } |
7507 | 7510 | ||
7508 | void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, | 7511 | void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, |
7509 | struct net_device *netdev) | 7512 | struct wireless_dev *wdev) |
7510 | { | 7513 | { |
7511 | struct sk_buff *msg; | 7514 | struct sk_buff *msg; |
7512 | 7515 | ||
@@ -7514,7 +7517,7 @@ void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, | |||
7514 | if (!msg) | 7517 | if (!msg) |
7515 | return; | 7518 | return; |
7516 | 7519 | ||
7517 | if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, | 7520 | if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0, |
7518 | NL80211_CMD_TRIGGER_SCAN) < 0) { | 7521 | NL80211_CMD_TRIGGER_SCAN) < 0) { |
7519 | nlmsg_free(msg); | 7522 | nlmsg_free(msg); |
7520 | return; | 7523 | return; |
@@ -7525,7 +7528,7 @@ void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, | |||
7525 | } | 7528 | } |
7526 | 7529 | ||
7527 | void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, | 7530 | void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, |
7528 | struct net_device *netdev) | 7531 | struct wireless_dev *wdev) |
7529 | { | 7532 | { |
7530 | struct sk_buff *msg; | 7533 | struct sk_buff *msg; |
7531 | 7534 | ||
@@ -7533,7 +7536,7 @@ void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, | |||
7533 | if (!msg) | 7536 | if (!msg) |
7534 | return; | 7537 | return; |
7535 | 7538 | ||
7536 | if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, | 7539 | if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0, |
7537 | NL80211_CMD_NEW_SCAN_RESULTS) < 0) { | 7540 | NL80211_CMD_NEW_SCAN_RESULTS) < 0) { |
7538 | nlmsg_free(msg); | 7541 | nlmsg_free(msg); |
7539 | return; | 7542 | return; |
@@ -7544,7 +7547,7 @@ void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, | |||
7544 | } | 7547 | } |
7545 | 7548 | ||
7546 | void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, | 7549 | void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, |
7547 | struct net_device *netdev) | 7550 | struct wireless_dev *wdev) |
7548 | { | 7551 | { |
7549 | struct sk_buff *msg; | 7552 | struct sk_buff *msg; |
7550 | 7553 | ||
@@ -7552,7 +7555,7 @@ void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, | |||
7552 | if (!msg) | 7555 | if (!msg) |
7553 | return; | 7556 | return; |
7554 | 7557 | ||
7555 | if (nl80211_send_scan_msg(msg, rdev, netdev, 0, 0, 0, | 7558 | if (nl80211_send_scan_msg(msg, rdev, wdev, 0, 0, 0, |
7556 | NL80211_CMD_SCAN_ABORTED) < 0) { | 7559 | NL80211_CMD_SCAN_ABORTED) < 0) { |
7557 | nlmsg_free(msg); | 7560 | nlmsg_free(msg); |
7558 | return; | 7561 | return; |
diff --git a/net/wireless/nl80211.h b/net/wireless/nl80211.h index 0469303b5c3c..89ce99675e61 100644 --- a/net/wireless/nl80211.h +++ b/net/wireless/nl80211.h | |||
@@ -7,11 +7,11 @@ int nl80211_init(void); | |||
7 | void nl80211_exit(void); | 7 | void nl80211_exit(void); |
8 | void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev); | 8 | void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev); |
9 | void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, | 9 | void nl80211_send_scan_start(struct cfg80211_registered_device *rdev, |
10 | struct net_device *netdev); | 10 | struct wireless_dev *wdev); |
11 | void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, | 11 | void nl80211_send_scan_done(struct cfg80211_registered_device *rdev, |
12 | struct net_device *netdev); | 12 | struct wireless_dev *wdev); |
13 | void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, | 13 | void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev, |
14 | struct net_device *netdev); | 14 | struct wireless_dev *wdev); |
15 | void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev, | 15 | void nl80211_send_sched_scan(struct cfg80211_registered_device *rdev, |
16 | struct net_device *netdev, u32 cmd); | 16 | struct net_device *netdev, u32 cmd); |
17 | void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev, | 17 | void nl80211_send_sched_scan_results(struct cfg80211_registered_device *rdev, |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index af2b1caa37fa..848523a2b22f 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -23,7 +23,7 @@ | |||
23 | void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak) | 23 | void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak) |
24 | { | 24 | { |
25 | struct cfg80211_scan_request *request; | 25 | struct cfg80211_scan_request *request; |
26 | struct net_device *dev; | 26 | struct wireless_dev *wdev; |
27 | #ifdef CONFIG_CFG80211_WEXT | 27 | #ifdef CONFIG_CFG80211_WEXT |
28 | union iwreq_data wrqu; | 28 | union iwreq_data wrqu; |
29 | #endif | 29 | #endif |
@@ -35,29 +35,31 @@ void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, bool leak) | |||
35 | if (!request) | 35 | if (!request) |
36 | return; | 36 | return; |
37 | 37 | ||
38 | dev = request->dev; | 38 | wdev = request->wdev; |
39 | 39 | ||
40 | /* | 40 | /* |
41 | * This must be before sending the other events! | 41 | * This must be before sending the other events! |
42 | * Otherwise, wpa_supplicant gets completely confused with | 42 | * Otherwise, wpa_supplicant gets completely confused with |
43 | * wext events. | 43 | * wext events. |
44 | */ | 44 | */ |
45 | cfg80211_sme_scan_done(dev); | 45 | if (wdev->netdev) |
46 | cfg80211_sme_scan_done(wdev->netdev); | ||
46 | 47 | ||
47 | if (request->aborted) | 48 | if (request->aborted) |
48 | nl80211_send_scan_aborted(rdev, dev); | 49 | nl80211_send_scan_aborted(rdev, wdev); |
49 | else | 50 | else |
50 | nl80211_send_scan_done(rdev, dev); | 51 | nl80211_send_scan_done(rdev, wdev); |
51 | 52 | ||
52 | #ifdef CONFIG_CFG80211_WEXT | 53 | #ifdef CONFIG_CFG80211_WEXT |
53 | if (!request->aborted) { | 54 | if (wdev->netdev && !request->aborted) { |
54 | memset(&wrqu, 0, sizeof(wrqu)); | 55 | memset(&wrqu, 0, sizeof(wrqu)); |
55 | 56 | ||
56 | wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL); | 57 | wireless_send_event(wdev->netdev, SIOCGIWSCAN, &wrqu, NULL); |
57 | } | 58 | } |
58 | #endif | 59 | #endif |
59 | 60 | ||
60 | dev_put(dev); | 61 | if (wdev->netdev) |
62 | dev_put(wdev->netdev); | ||
61 | 63 | ||
62 | rdev->scan_req = NULL; | 64 | rdev->scan_req = NULL; |
63 | 65 | ||
@@ -955,7 +957,7 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
955 | } | 957 | } |
956 | 958 | ||
957 | creq->wiphy = wiphy; | 959 | creq->wiphy = wiphy; |
958 | creq->dev = dev; | 960 | creq->wdev = dev->ieee80211_ptr; |
959 | /* SSIDs come after channels */ | 961 | /* SSIDs come after channels */ |
960 | creq->ssids = (void *)&creq->channels[n_channels]; | 962 | creq->ssids = (void *)&creq->channels[n_channels]; |
961 | creq->n_channels = n_channels; | 963 | creq->n_channels = n_channels; |
@@ -1024,12 +1026,12 @@ int cfg80211_wext_siwscan(struct net_device *dev, | |||
1024 | creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; | 1026 | creq->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1; |
1025 | 1027 | ||
1026 | rdev->scan_req = creq; | 1028 | rdev->scan_req = creq; |
1027 | err = rdev->ops->scan(wiphy, dev, creq); | 1029 | err = rdev->ops->scan(wiphy, creq); |
1028 | if (err) { | 1030 | if (err) { |
1029 | rdev->scan_req = NULL; | 1031 | rdev->scan_req = NULL; |
1030 | /* creq will be freed below */ | 1032 | /* creq will be freed below */ |
1031 | } else { | 1033 | } else { |
1032 | nl80211_send_scan_start(rdev, dev); | 1034 | nl80211_send_scan_start(rdev, dev->ieee80211_ptr); |
1033 | /* creq now owned by driver */ | 1035 | /* creq now owned by driver */ |
1034 | creq = NULL; | 1036 | creq = NULL; |
1035 | dev_hold(dev); | 1037 | dev_hold(dev); |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index dec97981e689..6f39cb808302 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -136,15 +136,15 @@ static int cfg80211_conn_scan(struct wireless_dev *wdev) | |||
136 | wdev->conn->params.ssid_len); | 136 | wdev->conn->params.ssid_len); |
137 | request->ssids[0].ssid_len = wdev->conn->params.ssid_len; | 137 | request->ssids[0].ssid_len = wdev->conn->params.ssid_len; |
138 | 138 | ||
139 | request->dev = wdev->netdev; | 139 | request->wdev = wdev; |
140 | request->wiphy = &rdev->wiphy; | 140 | request->wiphy = &rdev->wiphy; |
141 | 141 | ||
142 | rdev->scan_req = request; | 142 | rdev->scan_req = request; |
143 | 143 | ||
144 | err = rdev->ops->scan(wdev->wiphy, wdev->netdev, request); | 144 | err = rdev->ops->scan(wdev->wiphy, request); |
145 | if (!err) { | 145 | if (!err) { |
146 | wdev->conn->state = CFG80211_CONN_SCANNING; | 146 | wdev->conn->state = CFG80211_CONN_SCANNING; |
147 | nl80211_send_scan_start(rdev, wdev->netdev); | 147 | nl80211_send_scan_start(rdev, wdev); |
148 | dev_hold(wdev->netdev); | 148 | dev_hold(wdev->netdev); |
149 | } else { | 149 | } else { |
150 | rdev->scan_req = NULL; | 150 | rdev->scan_req = NULL; |