linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mac80211: mlme: remove duplicate AID bookkeeping
@ 2020-04-17 10:38 Johannes Berg
  2020-04-17 11:03 ` Lorenzo Bianconi
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Berg @ 2020-04-17 10:38 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Felix Fietkau

From: Johannes Berg <johannes.berg@intel.com>

Maintain the connection AID only in sdata->vif.bss_conf.aid, not
also in sdata->u.mgd.aid.

Keep setting that where we set ifmgd->aid before, which has the
side effect of exposing the AID to the driver before the station
entry (AP) is marked associated, in case it needs it then.

Requested-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
 net/mac80211/debugfs_netdev.c | 2 +-
 net/mac80211/ieee80211_i.h    | 2 --
 net/mac80211/mlme.c           | 7 +++----
 net/mac80211/tdls.c           | 3 +--
 net/mac80211/tx.c             | 2 +-
 5 files changed, 6 insertions(+), 10 deletions(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 3dbe7c5cefd1..d7e955127d5c 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -236,7 +236,7 @@ IEEE80211_IF_FILE_R(hw_queues);
 
 /* STA attributes */
 IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
-IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
+IEEE80211_IF_FILE(aid, vif.bss_conf.aid, DEC);
 IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS);
 
 static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f8ed4f621f7f..934a91bef575 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -450,8 +450,6 @@ struct ieee80211_if_managed {
 
 	u8 bssid[ETH_ALEN] __aligned(2);
 
-	u16 aid;
-
 	bool powersave; /* powersave requested for this iface */
 	bool broken_ap; /* AP is broken -- turn off powersave */
 	bool have_beacon;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 16d75da0996a..7139335f29c0 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3249,7 +3249,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 		return false;
 	}
 
-	ifmgd->aid = aid;
+	sdata->vif.bss_conf.aid = aid;
 	ifmgd->tdls_chan_switch_prohibited =
 		elems->ext_capab && elems->ext_capab_len >= 5 &&
 		(elems->ext_capab[4] & WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED);
@@ -3521,9 +3521,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
 		bss_conf->protected_keep_alive = false;
 	}
 
-	/* set AID and assoc capability,
+	/* set assoc capability (AID was already set earlier),
 	 * ieee80211_set_associated() will tell the driver */
-	bss_conf->aid = aid;
 	bss_conf->assoc_capability = capab_info;
 	ieee80211_set_associated(sdata, cbss, changed);
 
@@ -3948,7 +3947,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 					  mgmt->bssid, bssid);
 
 	if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) &&
-	    ieee80211_check_tim(elems.tim, elems.tim_len, ifmgd->aid)) {
+	    ieee80211_check_tim(elems.tim, elems.tim_len, bss_conf->aid)) {
 		if (local->hw.conf.dynamic_ps_timeout > 0) {
 			if (local->hw.conf.flags & IEEE80211_CONF_PS) {
 				local->hw.conf.flags &= ~IEEE80211_CONF_PS;
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index fca1f5477396..7ff22f9d6e80 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -226,12 +226,11 @@ static void ieee80211_tdls_add_link_ie(struct ieee80211_sub_if_data *sdata,
 static void
 ieee80211_tdls_add_aid(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
 {
-	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 	u8 *pos = skb_put(skb, 4);
 
 	*pos++ = WLAN_EID_AID;
 	*pos++ = 2; /* len */
-	put_unaligned_le16(ifmgd->aid, pos);
+	put_unaligned_le16(sdata->vif.bss_conf.aid, pos);
 }
 
 /* translate numbering in the WMM parameter IE to the mac80211 notation */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 82846aca86d9..3dc1990e15c5 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -5006,7 +5006,7 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
 	pspoll = skb_put_zero(skb, sizeof(*pspoll));
 	pspoll->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL |
 					    IEEE80211_STYPE_PSPOLL);
-	pspoll->aid = cpu_to_le16(ifmgd->aid);
+	pspoll->aid = cpu_to_le16(sdata->vif.bss_conf.aid);
 
 	/* aid in PS-Poll has its two MSBs each set to 1 */
 	pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mac80211: mlme: remove duplicate AID bookkeeping
  2020-04-17 10:38 [PATCH v2] mac80211: mlme: remove duplicate AID bookkeeping Johannes Berg
@ 2020-04-17 11:03 ` Lorenzo Bianconi
  0 siblings, 0 replies; 2+ messages in thread
From: Lorenzo Bianconi @ 2020-04-17 11:03 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless, Johannes Berg, Felix Fietkau

[-- Attachment #1: Type: text/plain, Size: 4605 bytes --]

> From: Johannes Berg <johannes.berg@intel.com>
> 
> Maintain the connection AID only in sdata->vif.bss_conf.aid, not
> also in sdata->u.mgd.aid.
> 
> Keep setting that where we set ifmgd->aid before, which has the
> side effect of exposing the AID to the driver before the station
> entry (AP) is marked associated, in case it needs it then.
> 

Tested-by: Lorenzo Bianconi <lorenzo@kernel.org>

> Requested-by: Felix Fietkau <nbd@nbd.name>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>  net/mac80211/debugfs_netdev.c | 2 +-
>  net/mac80211/ieee80211_i.h    | 2 --
>  net/mac80211/mlme.c           | 7 +++----
>  net/mac80211/tdls.c           | 3 +--
>  net/mac80211/tx.c             | 2 +-
>  5 files changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
> index 3dbe7c5cefd1..d7e955127d5c 100644
> --- a/net/mac80211/debugfs_netdev.c
> +++ b/net/mac80211/debugfs_netdev.c
> @@ -236,7 +236,7 @@ IEEE80211_IF_FILE_R(hw_queues);
>  
>  /* STA attributes */
>  IEEE80211_IF_FILE(bssid, u.mgd.bssid, MAC);
> -IEEE80211_IF_FILE(aid, u.mgd.aid, DEC);
> +IEEE80211_IF_FILE(aid, vif.bss_conf.aid, DEC);
>  IEEE80211_IF_FILE(beacon_timeout, u.mgd.beacon_timeout, JIFFIES_TO_MS);
>  
>  static int ieee80211_set_smps(struct ieee80211_sub_if_data *sdata,
> diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
> index f8ed4f621f7f..934a91bef575 100644
> --- a/net/mac80211/ieee80211_i.h
> +++ b/net/mac80211/ieee80211_i.h
> @@ -450,8 +450,6 @@ struct ieee80211_if_managed {
>  
>  	u8 bssid[ETH_ALEN] __aligned(2);
>  
> -	u16 aid;
> -
>  	bool powersave; /* powersave requested for this iface */
>  	bool broken_ap; /* AP is broken -- turn off powersave */
>  	bool have_beacon;
> diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
> index 16d75da0996a..7139335f29c0 100644
> --- a/net/mac80211/mlme.c
> +++ b/net/mac80211/mlme.c
> @@ -3249,7 +3249,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
>  		return false;
>  	}
>  
> -	ifmgd->aid = aid;
> +	sdata->vif.bss_conf.aid = aid;
>  	ifmgd->tdls_chan_switch_prohibited =
>  		elems->ext_capab && elems->ext_capab_len >= 5 &&
>  		(elems->ext_capab[4] & WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED);
> @@ -3521,9 +3521,8 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
>  		bss_conf->protected_keep_alive = false;
>  	}
>  
> -	/* set AID and assoc capability,
> +	/* set assoc capability (AID was already set earlier),
>  	 * ieee80211_set_associated() will tell the driver */
> -	bss_conf->aid = aid;
>  	bss_conf->assoc_capability = capab_info;
>  	ieee80211_set_associated(sdata, cbss, changed);
>  
> @@ -3948,7 +3947,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
>  					  mgmt->bssid, bssid);
>  
>  	if (ieee80211_hw_check(&local->hw, PS_NULLFUNC_STACK) &&
> -	    ieee80211_check_tim(elems.tim, elems.tim_len, ifmgd->aid)) {
> +	    ieee80211_check_tim(elems.tim, elems.tim_len, bss_conf->aid)) {
>  		if (local->hw.conf.dynamic_ps_timeout > 0) {
>  			if (local->hw.conf.flags & IEEE80211_CONF_PS) {
>  				local->hw.conf.flags &= ~IEEE80211_CONF_PS;
> diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
> index fca1f5477396..7ff22f9d6e80 100644
> --- a/net/mac80211/tdls.c
> +++ b/net/mac80211/tdls.c
> @@ -226,12 +226,11 @@ static void ieee80211_tdls_add_link_ie(struct ieee80211_sub_if_data *sdata,
>  static void
>  ieee80211_tdls_add_aid(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
>  {
> -	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
>  	u8 *pos = skb_put(skb, 4);
>  
>  	*pos++ = WLAN_EID_AID;
>  	*pos++ = 2; /* len */
> -	put_unaligned_le16(ifmgd->aid, pos);
> +	put_unaligned_le16(sdata->vif.bss_conf.aid, pos);
>  }
>  
>  /* translate numbering in the WMM parameter IE to the mac80211 notation */
> diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
> index 82846aca86d9..3dc1990e15c5 100644
> --- a/net/mac80211/tx.c
> +++ b/net/mac80211/tx.c
> @@ -5006,7 +5006,7 @@ struct sk_buff *ieee80211_pspoll_get(struct ieee80211_hw *hw,
>  	pspoll = skb_put_zero(skb, sizeof(*pspoll));
>  	pspoll->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL |
>  					    IEEE80211_STYPE_PSPOLL);
> -	pspoll->aid = cpu_to_le16(ifmgd->aid);
> +	pspoll->aid = cpu_to_le16(sdata->vif.bss_conf.aid);
>  
>  	/* aid in PS-Poll has its two MSBs each set to 1 */
>  	pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14);
> -- 
> 2.25.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-17 11:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17 10:38 [PATCH v2] mac80211: mlme: remove duplicate AID bookkeeping Johannes Berg
2020-04-17 11:03 ` Lorenzo Bianconi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).