Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 83739b03 authored by Johannes Berg's avatar Johannes Berg
Browse files

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: default avatarJohannes Berg <johannes.berg@intel.com>
parent 91bf9b26
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -755,7 +755,7 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev,
		wdev->wext.ie_len = 0;
		wdev->wext.ie_len = 0;
		wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
		wdev->wext.connect.auth_type = NL80211_AUTHTYPE_AUTOMATIC;
#endif
#endif
		__cfg80211_disconnect(rdev, dev,
		cfg80211_disconnect(rdev, dev,
				    WLAN_REASON_DEAUTH_LEAVING, true);
				    WLAN_REASON_DEAUTH_LEAVING, true);
		wdev_unlock(wdev);
		wdev_unlock(wdev);
		break;
		break;
+2 −9
Original line number Original line Diff line number Diff line
@@ -328,18 +328,11 @@ void cfg80211_oper_and_vht_capa(struct ieee80211_vht_cap *vht_capa,
				const struct ieee80211_vht_cap *vht_capa_mask);
				const struct ieee80211_vht_cap *vht_capa_mask);


/* SME */
/* SME */
int __cfg80211_connect(struct cfg80211_registered_device *rdev,
int cfg80211_connect(struct cfg80211_registered_device *rdev,
		     struct net_device *dev,
		     struct net_device *dev,
		     struct cfg80211_connect_params *connect,
		     struct cfg80211_connect_params *connect,
		     struct cfg80211_cached_keys *connkeys,
		     struct cfg80211_cached_keys *connkeys,
		     const u8 *prev_bssid);
		     const u8 *prev_bssid);
int cfg80211_connect(struct cfg80211_registered_device *rdev,
		     struct net_device *dev,
		     struct cfg80211_connect_params *connect,
		     struct cfg80211_cached_keys *connkeys);
int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
			  struct net_device *dev, u16 reason,
			  bool wextev);
int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
			struct net_device *dev, u16 reason,
			struct net_device *dev, u16 reason,
			bool wextev);
			bool wextev);
+8 −2
Original line number Original line Diff line number Diff line
@@ -6683,7 +6683,9 @@ static int nl80211_connect(struct sk_buff *skb, struct genl_info *info)
		       sizeof(connect.vht_capa));
		       sizeof(connect.vht_capa));
	}
	}


	err = cfg80211_connect(rdev, dev, &connect, connkeys);
	wdev_lock(dev->ieee80211_ptr);
	err = cfg80211_connect(rdev, dev, &connect, connkeys, NULL);
	wdev_unlock(dev->ieee80211_ptr);
	if (err)
	if (err)
		kfree(connkeys);
		kfree(connkeys);
	return err;
	return err;
@@ -6694,6 +6696,7 @@ static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info)
	struct cfg80211_registered_device *rdev = info->user_ptr[0];
	struct cfg80211_registered_device *rdev = info->user_ptr[0];
	struct net_device *dev = info->user_ptr[1];
	struct net_device *dev = info->user_ptr[1];
	u16 reason;
	u16 reason;
	int ret;


	if (!info->attrs[NL80211_ATTR_REASON_CODE])
	if (!info->attrs[NL80211_ATTR_REASON_CODE])
		reason = WLAN_REASON_DEAUTH_LEAVING;
		reason = WLAN_REASON_DEAUTH_LEAVING;
@@ -6707,7 +6710,10 @@ static int nl80211_disconnect(struct sk_buff *skb, struct genl_info *info)
	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT)
	    dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT)
		return -EOPNOTSUPP;
		return -EOPNOTSUPP;


	return cfg80211_disconnect(rdev, dev, reason, true);
	wdev_lock(dev->ieee80211_ptr);
	ret = cfg80211_disconnect(rdev, dev, reason, true);
	wdev_unlock(dev->ieee80211_ptr);
	return ret;
}
}


static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info)
static int nl80211_wiphy_netns(struct sk_buff *skb, struct genl_info *info)
+7 −34
Original line number Original line Diff line number Diff line
@@ -760,7 +760,7 @@ void cfg80211_disconnected(struct net_device *dev, u16 reason,
}
}
EXPORT_SYMBOL(cfg80211_disconnected);
EXPORT_SYMBOL(cfg80211_disconnected);


int __cfg80211_connect(struct cfg80211_registered_device *rdev,
int cfg80211_connect(struct cfg80211_registered_device *rdev,
		     struct net_device *dev,
		     struct net_device *dev,
		     struct cfg80211_connect_params *connect,
		     struct cfg80211_connect_params *connect,
		     struct cfg80211_cached_keys *connkeys,
		     struct cfg80211_cached_keys *connkeys,
@@ -911,21 +911,7 @@ int __cfg80211_connect(struct cfg80211_registered_device *rdev,
	}
	}
}
}


int cfg80211_connect(struct cfg80211_registered_device *rdev,
int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
		     struct net_device *dev,
		     struct cfg80211_connect_params *connect,
		     struct cfg80211_cached_keys *connkeys)
{
	int err;

	wdev_lock(dev->ieee80211_ptr);
	err = __cfg80211_connect(rdev, dev, connect, connkeys, NULL);
	wdev_unlock(dev->ieee80211_ptr);

	return err;
}

int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
			struct net_device *dev, u16 reason, bool wextev)
			struct net_device *dev, u16 reason, bool wextev)
{
{
	struct wireless_dev *wdev = dev->ieee80211_ptr;
	struct wireless_dev *wdev = dev->ieee80211_ptr;
@@ -983,19 +969,6 @@ int __cfg80211_disconnect(struct cfg80211_registered_device *rdev,
	return 0;
	return 0;
}
}


int cfg80211_disconnect(struct cfg80211_registered_device *rdev,
			struct net_device *dev,
			u16 reason, bool wextev)
{
	int err;

	wdev_lock(dev->ieee80211_ptr);
	err = __cfg80211_disconnect(rdev, dev, reason, wextev);
	wdev_unlock(dev->ieee80211_ptr);

	return err;
}

void cfg80211_sme_disassoc(struct net_device *dev,
void cfg80211_sme_disassoc(struct net_device *dev,
			   struct cfg80211_internal_bss *bss)
			   struct cfg80211_internal_bss *bss)
{
{
+2 −0
Original line number Original line Diff line number Diff line
@@ -858,8 +858,10 @@ int cfg80211_change_iface(struct cfg80211_registered_device *rdev,
			break;
			break;
		case NL80211_IFTYPE_STATION:
		case NL80211_IFTYPE_STATION:
		case NL80211_IFTYPE_P2P_CLIENT:
		case NL80211_IFTYPE_P2P_CLIENT:
			wdev_lock(dev->ieee80211_ptr);
			cfg80211_disconnect(rdev, dev,
			cfg80211_disconnect(rdev, dev,
					    WLAN_REASON_DEAUTH_LEAVING, true);
					    WLAN_REASON_DEAUTH_LEAVING, true);
			wdev_unlock(dev->ieee80211_ptr);
			break;
			break;
		case NL80211_IFTYPE_MESH_POINT:
		case NL80211_IFTYPE_MESH_POINT:
			/* mesh should be handled? */
			/* mesh should be handled? */
Loading