diff options
Diffstat (limited to 'net/wireless/mlme.c')
| -rw-r--r-- | net/wireless/mlme.c | 68 | 
1 files changed, 26 insertions, 42 deletions
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c index 8d49c1ce3de..266766b8d80 100644 --- a/net/wireless/mlme.c +++ b/net/wireless/mlme.c @@ -23,7 +23,7 @@ void cfg80211_rx_assoc_resp(struct net_device *dev, struct cfg80211_bss *bss,  {  	struct wireless_dev *wdev = dev->ieee80211_ptr;  	struct wiphy *wiphy = wdev->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;  	u8 *ie = mgmt->u.assoc_resp.variable;  	int ieoffs = offsetof(struct ieee80211_mgmt, u.assoc_resp.variable); @@ -54,7 +54,7 @@ EXPORT_SYMBOL(cfg80211_rx_assoc_resp);  static void cfg80211_process_auth(struct wireless_dev *wdev,  				  const u8 *buf, size_t len)  { -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);  	nl80211_send_rx_auth(rdev, wdev->netdev, buf, len, GFP_KERNEL);  	cfg80211_sme_rx_auth(wdev, buf, len); @@ -63,7 +63,7 @@ static void cfg80211_process_auth(struct wireless_dev *wdev,  static void cfg80211_process_deauth(struct wireless_dev *wdev,  				    const u8 *buf, size_t len)  { -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);  	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;  	const u8 *bssid = mgmt->bssid;  	u16 reason_code = le16_to_cpu(mgmt->u.deauth.reason_code); @@ -82,7 +82,7 @@ static void cfg80211_process_deauth(struct wireless_dev *wdev,  static void cfg80211_process_disassoc(struct wireless_dev *wdev,  				      const u8 *buf, size_t len)  { -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wdev->wiphy);  	struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *)buf;  	const u8 *bssid = mgmt->bssid;  	u16 reason_code = le16_to_cpu(mgmt->u.disassoc.reason_code); @@ -123,7 +123,7 @@ void cfg80211_auth_timeout(struct net_device *dev, const u8 *addr)  {  	struct wireless_dev *wdev = dev->ieee80211_ptr;  	struct wiphy *wiphy = wdev->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	trace_cfg80211_send_auth_timeout(dev, addr); @@ -136,7 +136,7 @@ void cfg80211_assoc_timeout(struct net_device *dev, struct cfg80211_bss *bss)  {  	struct wireless_dev *wdev = dev->ieee80211_ptr;  	struct wiphy *wiphy = wdev->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	trace_cfg80211_send_assoc_timeout(dev, bss->bssid); @@ -172,7 +172,7 @@ void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,  				  const u8 *tsc, gfp_t gfp)  {  	struct wiphy *wiphy = dev->ieee80211_ptr->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  #ifdef CONFIG_CFG80211_WEXT  	union iwreq_data wrqu;  	char *buf = kmalloc(128, gfp); @@ -233,14 +233,8 @@ int cfg80211_mlme_auth(struct cfg80211_registered_device *rdev,  	if (!req.bss)  		return -ENOENT; -	err = cfg80211_can_use_chan(rdev, wdev, req.bss->channel, -				    CHAN_MODE_SHARED); -	if (err) -		goto out; -  	err = rdev_auth(rdev, dev, &req); -out:  	cfg80211_put_bss(&rdev->wiphy, req.bss);  	return err;  } @@ -306,16 +300,10 @@ int cfg80211_mlme_assoc(struct cfg80211_registered_device *rdev,  	if (!req->bss)  		return -ENOENT; -	err = cfg80211_can_use_chan(rdev, wdev, chan, CHAN_MODE_SHARED); -	if (err) -		goto out; -  	err = rdev_assoc(rdev, dev, req);  	if (!err)  		cfg80211_hold_bss(bss_from_pub(req->bss)); - -out: -	if (err) +	else  		cfg80211_put_bss(&rdev->wiphy, req->bss);  	return err; @@ -414,7 +402,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid,  				int match_len)  {  	struct wiphy *wiphy = wdev->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	struct cfg80211_mgmt_registration *reg, *nreg;  	int err = 0;  	u16 mgmt_type; @@ -473,7 +461,7 @@ int cfg80211_mlme_register_mgmt(struct wireless_dev *wdev, u32 snd_portid,  void cfg80211_mlme_unregister_socket(struct wireless_dev *wdev, u32 nlportid)  {  	struct wiphy *wiphy = wdev->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	struct cfg80211_mgmt_registration *reg, *tmp;  	spin_lock_bh(&wdev->mgmt_registrations_lock); @@ -520,9 +508,7 @@ void cfg80211_mlme_purge_registrations(struct wireless_dev *wdev)  int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,  			  struct wireless_dev *wdev, -			  struct ieee80211_channel *chan, bool offchan, -			  unsigned int wait, const u8 *buf, size_t len, -			  bool no_cck, bool dont_wait_for_ack, u64 *cookie) +			  struct cfg80211_mgmt_tx_params *params, u64 *cookie)  {  	const struct ieee80211_mgmt *mgmt;  	u16 stype; @@ -533,10 +519,10 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,  	if (!rdev->ops->mgmt_tx)  		return -EOPNOTSUPP; -	if (len < 24 + 1) +	if (params->len < 24 + 1)  		return -EINVAL; -	mgmt = (const struct ieee80211_mgmt *) buf; +	mgmt = (const struct ieee80211_mgmt *)params->buf;  	if (!ieee80211_is_mgmt(mgmt->frame_control))  		return -EINVAL; @@ -615,16 +601,14 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,  		return -EINVAL;  	/* Transmit the Action frame as requested by user space */ -	return rdev_mgmt_tx(rdev, wdev, chan, offchan, -			    wait, buf, len, no_cck, dont_wait_for_ack, -			    cookie); +	return rdev_mgmt_tx(rdev, wdev, params, cookie);  }  bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,  		      const u8 *buf, size_t len, u32 flags, gfp_t gfp)  {  	struct wiphy *wiphy = wdev->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	struct cfg80211_mgmt_registration *reg;  	const struct ieee80211_txrx_stypes *stypes =  		&wiphy->mgmt_stypes[wdev->iftype]; @@ -707,11 +691,13 @@ void cfg80211_dfs_channels_update_work(struct work_struct *work)  			if (c->dfs_state != NL80211_DFS_UNAVAILABLE)  				continue; -			timeout = c->dfs_state_entered + -				  IEEE80211_DFS_MIN_NOP_TIME_MS; +			timeout = c->dfs_state_entered + msecs_to_jiffies( +					IEEE80211_DFS_MIN_NOP_TIME_MS);  			if (time_after_eq(jiffies, timeout)) {  				c->dfs_state = NL80211_DFS_USABLE; +				c->dfs_state_entered = jiffies; +  				cfg80211_chandef_create(&chandef, c,  							NL80211_CHAN_NO_HT); @@ -741,7 +727,7 @@ void cfg80211_radar_event(struct wiphy *wiphy,  			  struct cfg80211_chan_def *chandef,  			  gfp_t gfp)  { -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	unsigned long timeout;  	trace_cfg80211_radar_event(wiphy, chandef); @@ -761,12 +747,12 @@ void cfg80211_radar_event(struct wiphy *wiphy,  EXPORT_SYMBOL(cfg80211_radar_event);  void cfg80211_cac_event(struct net_device *netdev, +			const struct cfg80211_chan_def *chandef,  			enum nl80211_radar_event event, gfp_t gfp)  {  	struct wireless_dev *wdev = netdev->ieee80211_ptr;  	struct wiphy *wiphy = wdev->wiphy; -	struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy); -	struct cfg80211_chan_def chandef; +	struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);  	unsigned long timeout;  	trace_cfg80211_cac_event(netdev, event); @@ -774,17 +760,15 @@ void cfg80211_cac_event(struct net_device *netdev,  	if (WARN_ON(!wdev->cac_started))  		return; -	if (WARN_ON(!wdev->channel)) +	if (WARN_ON(!wdev->chandef.chan))  		return; -	cfg80211_chandef_create(&chandef, wdev->channel, NL80211_CHAN_NO_HT); -  	switch (event) {  	case NL80211_RADAR_CAC_FINISHED:  		timeout = wdev->cac_start_time + -			  msecs_to_jiffies(IEEE80211_DFS_MIN_CAC_TIME_MS); +			  msecs_to_jiffies(wdev->cac_time_ms);  		WARN_ON(!time_after_eq(jiffies, timeout)); -		cfg80211_set_dfs_state(wiphy, &chandef, NL80211_DFS_AVAILABLE); +		cfg80211_set_dfs_state(wiphy, chandef, NL80211_DFS_AVAILABLE);  		break;  	case NL80211_RADAR_CAC_ABORTED:  		break; @@ -794,6 +778,6 @@ void cfg80211_cac_event(struct net_device *netdev,  	}  	wdev->cac_started = false; -	nl80211_radar_notify(rdev, &chandef, event, netdev, gfp); +	nl80211_radar_notify(rdev, chandef, event, netdev, gfp);  }  EXPORT_SYMBOL(cfg80211_cac_event);  | 
