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/nl80211.c | |
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/nl80211.c')
-rw-r--r-- | net/wireless/nl80211.c | 31 |
1 files changed, 17 insertions, 14 deletions
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; |