diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-05-15 11:44:01 -0400 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-05-24 18:02:22 -0400 |
commit | 83739b03de97049181d711c95200b94a14d3f693 (patch) | |
tree | 8a787da34dd5fcaea9da9e7bfb54f72fbe686f9e /net/wireless | |
parent | 91bf9b26fc95c505846bc2f744a73b51f2aaee1d (diff) |
cfg80211: remove some locked wrappers from sme API
By making all the API functions require wdev locking we
can clean up the API a bit, getting rid of the locking
version of each function. This also decreases the size
of cfg80211 by a small amount.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless')
-rw-r--r-- | net/wireless/core.c | 4 | ||||
-rw-r--r-- | net/wireless/core.h | 11 | ||||
-rw-r--r-- | net/wireless/nl80211.c | 10 | ||||
-rw-r--r-- | net/wireless/sme.c | 41 | ||||
-rw-r--r-- | net/wireless/util.c | 2 | ||||
-rw-r--r-- | net/wireless/wext-sme.c | 23 |
6 files changed, 32 insertions, 59 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index afcb9ec70adb..ee422871fe9e 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c | |||
@@ -755,8 +755,8 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev, | |||
755 | wdev->wext.ie_len = 0; | 755 | wdev->wext.ie_len = 0; |
756 | wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; | 756 | wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC; |
757 | #endif | 757 | #endif |
758 | __cfg80211_disconnect(rdev, dev, | 758 | cfg80211_disconnect(rdev, dev, |
759 | WLAN_REASON_DEAUTH_LEAVING, true); | 759 | WLAN_REASON_DEAUTH_LEAVING, true); |
760 | wdev_unlock(wdev); | 760 | wdev_unlock(wdev); |
761 | break; | 761 | break; |
762 | case NL80211_IFTYPE_MESH_POINT: | 762 | case NL80211_IFTYPE_MESH_POINT: |
diff --git a/net/wireless/core.h b/net/wireless/core.h index c8f87dfd50d3..b4b4a566626b 100644 --- a/net/wireless/core.h +++ b/net/wireless/core.h | |||
@@ -328,18 +328,11 @@ void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa, | |||
328 | const struct ieee80211_vht_cap *vht_capa_mask); | 328 | const struct ieee80211_vht_cap *vht_capa_mask); |
329 | 329 | ||
330 | /* SME */ | 330 | /* SME */ |
331 | int __cfg80211_connect(struct cfg80211_registered_device *rdev, | ||
332 | struct net_device *dev, | ||
333 | struct cfg80211_connect_params *connect, | ||
334 | struct cfg80211_cached_keys *connkeys, | ||
335 | const u8 *prev_bssid); | ||
336 | int cfg80211_connect(struct cfg80211_registered_device *rdev, | 331 | int cfg80211_connect(struct cfg80211_registered_device *rdev, |
337 | struct net_device *dev, | 332 | struct net_device *dev, |
338 | struct cfg80211_connect_params *connect, | 333 | struct cfg80211_connect_params *connect, |
339 | struct cfg80211_cached_keys *connkeys); | 334 | struct cfg80211_cached_keys *connkeys, |
340 | int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, | 335 | const u8 *prev_bssid); |
341 | struct net_device *dev, u16 reason, | ||
342 | bool wextev); | ||
343 | int cfg80211_disconnect(struct cfg80211_registered_device *rdev, | 336 | int cfg80211_disconnect(struct cfg80211_registered_device *rdev, |
344 | struct net_device *dev, u16 reason, | 337 | struct net_device *dev, u16 reason, |
345 | bool wextev); | 338 | bool wextev); |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 49c2f2f511dc..a09f36bb957c 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -6683,7 +6683,9 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info) | |||
6683 | sizeof(connect.vht_capa)); | 6683 | sizeof(connect.vht_capa)); |
6684 | } | 6684 | } |
6685 | 6685 | ||
6686 | err = cfg80211_connect(rdev, dev, &connect, connkeys); | 6686 | wdev_lock(dev->ieee80211_ptr); |
6687 | err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL); | ||
6688 | wdev_unlock(dev->ieee80211_ptr); | ||
6687 | if (err) | 6689 | if (err) |
6688 | kfree(connkeys); | 6690 | kfree(connkeys); |
6689 | return err; | 6691 | return err; |
@@ -6694,6 +6696,7 @@ static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info) | |||
6694 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; | 6696 | struct cfg80211_registered_device *rdev = info->user_ptr[0]; |
6695 | struct net_device *dev = info->user_ptr[1]; | 6697 | struct net_device *dev = info->user_ptr[1]; |
6696 | u16 reason; | 6698 | u16 reason; |
6699 | int ret; | ||
6697 | 6700 | ||
6698 | if (!info->attrs[NL80211_ATTR_REASON_CODE]) | 6701 | if (!info->attrs[NL80211_ATTR_REASON_CODE]) |
6699 | reason = WLAN_REASON_DEAUTH_LEAVING; | 6702 | reason = WLAN_REASON_DEAUTH_LEAVING; |
@@ -6707,7 +6710,10 @@ static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info) | |||
6707 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) | 6710 | dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) |
6708 | return -EOPNOTSUPP; | 6711 | return -EOPNOTSUPP; |
6709 | 6712 | ||
6710 | return cfg80211_disconnect(rdev, dev, reason, true); | 6713 | wdev_lock(dev->ieee80211_ptr); |
6714 | ret = cfg80211_disconnect(rdev, dev, reason, true); | ||
6715 | wdev_unlock(dev->ieee80211_ptr); | ||
6716 | return ret; | ||
6711 | } | 6717 | } |
6712 | 6718 | ||
6713 | static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info) | 6719 | static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info) |
diff --git a/net/wireless/sme.c b/net/wireless/sme.c index 31d67add7424..81be95f3be74 100644 --- a/net/wireless/sme.c +++ b/net/wireless/sme.c | |||
@@ -760,11 +760,11 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason, | |||
760 | } | 760 | } |
761 | EXPORT_SYMBOL(cfg80211_disconnected); | 761 | EXPORT_SYMBOL(cfg80211_disconnected); |
762 | 762 | ||
763 | int __cfg80211_connect(struct cfg80211_registered_device *rdev, | 763 | int cfg80211_connect(struct cfg80211_registered_device *rdev, |
764 | struct net_device *dev, | 764 | struct net_device *dev, |
765 | struct cfg80211_connect_params *connect, | 765 | struct cfg80211_connect_params *connect, |
766 | struct cfg80211_cached_keys *connkeys, | 766 | struct cfg80211_cached_keys *connkeys, |
767 | const u8 *prev_bssid) | 767 | const u8 *prev_bssid) |
768 | { | 768 | { |
769 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 769 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
770 | struct cfg80211_bss *bss = NULL; | 770 | struct cfg80211_bss *bss = NULL; |
@@ -911,22 +911,8 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev, | |||
911 | } | 911 | } |
912 | } | 912 | } |
913 | 913 | ||
914 | int cfg80211_connect(struct cfg80211_registered_device *rdev, | 914 | int cfg80211_disconnect(struct cfg80211_registered_device *rdev, |
915 | struct net_device *dev, | 915 | struct net_device *dev, u16 reason, bool wextev) |
916 | struct cfg80211_connect_params *connect, | ||
917 | struct cfg80211_cached_keys *connkeys) | ||
918 | { | ||
919 | int err; | ||
920 | |||
921 | wdev_lock(dev->ieee80211_ptr); | ||
922 | err = __cfg80211_connect(rdev, dev, connect, connkeys, NULL); | ||
923 | wdev_unlock(dev->ieee80211_ptr); | ||
924 | |||
925 | return err; | ||
926 | } | ||
927 | |||
928 | int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, | ||
929 | struct net_device *dev, u16 reason, bool wextev) | ||
930 | { | 916 | { |
931 | struct wireless_dev *wdev = dev->ieee80211_ptr; | 917 | struct wireless_dev *wdev = dev->ieee80211_ptr; |
932 | int err; | 918 | int err; |
@@ -983,19 +969,6 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev, | |||
983 | return 0; | 969 | return 0; |
984 | } | 970 | } |
985 | 971 | ||
986 | int cfg80211_disconnect(struct cfg80211_registered_device *rdev, | ||
987 | struct net_device *dev, | ||
988 | u16 reason, bool wextev) | ||
989 | { | ||
990 | int err; | ||
991 | |||
992 | wdev_lock(dev->ieee80211_ptr); | ||
993 | err = __cfg80211_disconnect(rdev, dev, reason, wextev); | ||
994 | wdev_unlock(dev->ieee80211_ptr); | ||
995 | |||
996 | return err; | ||
997 | } | ||
998 | |||
999 | void cfg80211_sme_disassoc(struct net_device *dev, | 972 | void cfg80211_sme_disassoc(struct net_device *dev, |
1000 | struct cfg80211_internal_bss *bss) | 973 | struct cfg80211_internal_bss *bss) |
1001 | { | 974 | { |
diff --git a/net/wireless/util.c b/net/wireless/util.c index 501724257af5..74458b7f61eb 100644 --- a/net/wireless/util.c +++ b/net/wireless/util.c | |||
@@ -858,8 +858,10 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev, | |||
858 | break; | 858 | break; |
859 | case NL80211_IFTYPE_STATION: | 859 | case NL80211_IFTYPE_STATION: |
860 | case NL80211_IFTYPE_P2P_CLIENT: | 860 | case NL80211_IFTYPE_P2P_CLIENT: |
861 | wdev_lock(dev->ieee80211_ptr); | ||
861 | cfg80211_disconnect(rdev, dev, | 862 | cfg80211_disconnect(rdev, dev, |
862 | WLAN_REASON_DEAUTH_LEAVING, true); | 863 | WLAN_REASON_DEAUTH_LEAVING, true); |
864 | wdev_unlock(dev->ieee80211_ptr); | ||
863 | break; | 865 | break; |
864 | case NL80211_IFTYPE_MESH_POINT: | 866 | case NL80211_IFTYPE_MESH_POINT: |
865 | /* mesh should be handled? */ | 867 | /* mesh should be handled? */ |
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c index aeefd6817189..a53f8404f451 100644 --- a/net/wireless/wext-sme.c +++ b/net/wireless/wext-sme.c | |||
@@ -54,8 +54,8 @@ int cfg80211_mgd_wext_connect(struct cfg80211_registered_device *rdev, | |||
54 | if (wdev->wext.prev_bssid_valid) | 54 | if (wdev->wext.prev_bssid_valid) |
55 | prev_bssid = wdev->wext.prev_bssid; | 55 | prev_bssid = wdev->wext.prev_bssid; |
56 | 56 | ||
57 | err = __cfg80211_connect(rdev, wdev->netdev, | 57 | err = cfg80211_connect(rdev, wdev->netdev, |
58 | &wdev->wext.connect, ck, prev_bssid); | 58 | &wdev->wext.connect, ck, prev_bssid); |
59 | if (err) | 59 | if (err) |
60 | kfree(ck); | 60 | kfree(ck); |
61 | 61 | ||
@@ -100,8 +100,8 @@ int cfg80211_mgd_wext_siwfreq(struct net_device *dev, | |||
100 | /* if SSID set, we'll try right again, avoid event */ | 100 | /* if SSID set, we'll try right again, avoid event */ |
101 | if (wdev->wext.connect.ssid_len) | 101 | if (wdev->wext.connect.ssid_len) |
102 | event = false; | 102 | event = false; |
103 | err = __cfg80211_disconnect(rdev, dev, | 103 | err = cfg80211_disconnect(rdev, dev, |
104 | WLAN_REASON_DEAUTH_LEAVING, event); | 104 | WLAN_REASON_DEAUTH_LEAVING, event); |
105 | if (err) | 105 | if (err) |
106 | goto out; | 106 | goto out; |
107 | } | 107 | } |
@@ -199,8 +199,8 @@ int cfg80211_mgd_wext_siwessid(struct net_device *dev, | |||
199 | /* if SSID set now, we'll try to connect, avoid event */ | 199 | /* if SSID set now, we'll try to connect, avoid event */ |
200 | if (len) | 200 | if (len) |
201 | event = false; | 201 | event = false; |
202 | err = __cfg80211_disconnect(rdev, dev, | 202 | err = cfg80211_disconnect(rdev, dev, |
203 | WLAN_REASON_DEAUTH_LEAVING, event); | 203 | WLAN_REASON_DEAUTH_LEAVING, event); |
204 | if (err) | 204 | if (err) |
205 | goto out; | 205 | goto out; |
206 | } | 206 | } |
@@ -288,8 +288,8 @@ int cfg80211_mgd_wext_siwap(struct net_device *dev, | |||
288 | ether_addr_equal(bssid, wdev->wext.connect.bssid)) | 288 | ether_addr_equal(bssid, wdev->wext.connect.bssid)) |
289 | goto out; | 289 | goto out; |
290 | 290 | ||
291 | err = __cfg80211_disconnect(rdev, dev, | 291 | err = cfg80211_disconnect(rdev, dev, |
292 | WLAN_REASON_DEAUTH_LEAVING, false); | 292 | WLAN_REASON_DEAUTH_LEAVING, false); |
293 | if (err) | 293 | if (err) |
294 | goto out; | 294 | goto out; |
295 | } | 295 | } |
@@ -365,8 +365,8 @@ int cfg80211_wext_siwgenie(struct net_device *dev, | |||
365 | wdev->wext.ie_len = ie_len; | 365 | wdev->wext.ie_len = ie_len; |
366 | 366 | ||
367 | if (wdev->sme_state != CFG80211_SME_IDLE) { | 367 | if (wdev->sme_state != CFG80211_SME_IDLE) { |
368 | err = __cfg80211_disconnect(rdev, dev, | 368 | err = cfg80211_disconnect(rdev, dev, |
369 | WLAN_REASON_DEAUTH_LEAVING, false); | 369 | WLAN_REASON_DEAUTH_LEAVING, false); |
370 | if (err) | 370 | if (err) |
371 | goto out; | 371 | goto out; |
372 | } | 372 | } |
@@ -402,8 +402,7 @@ int cfg80211_wext_siwmlme(struct net_device *dev, | |||
402 | switch (mlme->cmd) { | 402 | switch (mlme->cmd) { |
403 | case IW_MLME_DEAUTH: | 403 | case IW_MLME_DEAUTH: |
404 | case IW_MLME_DISASSOC: | 404 | case IW_MLME_DISASSOC: |
405 | err = __cfg80211_disconnect(rdev, dev, mlme->reason_code, | 405 | err = cfg80211_disconnect(rdev, dev, mlme->reason_code, true); |
406 | true); | ||
407 | break; | 406 | break; |
408 | default: | 407 | default: |
409 | err = -EOPNOTSUPP; | 408 | err = -EOPNOTSUPP; |