[2/3] mt76: mt7615: add missing code for providing aid info to the mcu
diff mbox series

Message ID 0292e088e934199434f0ea06598274f57a24f3d9.1587445885.git.sean.wang@mediatek.com
State New
Headers show
Series
  • [1/3] mt76: mt7615: Fix up WMM setting for STA mode
Related show

Commit Message

Sean Wang April 21, 2020, 5:20 a.m. UTC
From: Sean Wang <sean.wang@mediatek.com>

Parameters in station record should be kept as up to date as BSS being
updated.

Fixes: a90b4ba1f134 ("mt76: mt7615: provide aid info to the mcu")
Suggested-by: YF Luo <Yf.Luo@mediatek.com>
Suggested-by: Lucy Hsu <Lucy.Hsu@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7615/main.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

Comments

Ryder Lee April 21, 2020, 5:57 a.m. UTC | #1
On Tue, 2020-04-21 at 13:20 +0800, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Parameters in station record should be kept as up to date as BSS being
> updated.
> 
> Fixes: a90b4ba1f134 ("mt76: mt7615: provide aid info to the mcu")
> Suggested-by: YF Luo <Yf.Luo@mediatek.com>
> Suggested-by: Lucy Hsu <Lucy.Hsu@mediatek.com>
> Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
> Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
> Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/main.c | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> index cdc8babca85a..e5012ad680bb 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> @@ -497,9 +497,19 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
>  
>  	mutex_lock(&dev->mt76.mutex);
>  
> -	if (changed & BSS_CHANGED_ASSOC)
> +	if (changed & BSS_CHANGED_ASSOC) {
> +		struct ieee80211_sta *sta;
> +
>  		mt7615_mcu_add_bss_info(phy, vif, info->assoc);
>  
> +		rcu_read_lock();
> +		sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
> +		rcu_read_unlock();
> +
> +		if (sta)
> +			mt7615_mcu_sta_add(dev, vif, sta, info->assoc);
> +	}
> +
how about this -
https://github.com/ryderlee1110/wireless/blob/mt76/drivers/net/wireless/mediatek/mt76/mt7915/main.c#L434

>  	if (changed & BSS_CHANGED_ERP_SLOT) {
>  		int slottime = info->use_short_slot ? 9 : 20;
>  
> @@ -557,7 +567,8 @@ int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
>  	mt7615_mac_wtbl_update(dev, idx,
>  			       MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
>  
> -	mt7615_mcu_sta_add(dev, vif, sta, true);
> +	if (vif->type != NL80211_IFTYPE_STATION)
> +		mt7615_mcu_sta_add(dev, vif, sta, true);
>  
>  	return 0;
>  }
Felix Fietkau April 21, 2020, 7:23 a.m. UTC | #2
On 2020-04-21 07:20, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Parameters in station record should be kept as up to date as BSS being
> updated.
Why do we need this change? Johannes posted a mac80211 change that makes
the aid available at the time the station entry is created.

- Felix

Patch
diff mbox series

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index cdc8babca85a..e5012ad680bb 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -497,9 +497,19 @@  static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
 
 	mutex_lock(&dev->mt76.mutex);
 
-	if (changed & BSS_CHANGED_ASSOC)
+	if (changed & BSS_CHANGED_ASSOC) {
+		struct ieee80211_sta *sta;
+
 		mt7615_mcu_add_bss_info(phy, vif, info->assoc);
 
+		rcu_read_lock();
+		sta = ieee80211_find_sta(vif, vif->bss_conf.bssid);
+		rcu_read_unlock();
+
+		if (sta)
+			mt7615_mcu_sta_add(dev, vif, sta, info->assoc);
+	}
+
 	if (changed & BSS_CHANGED_ERP_SLOT) {
 		int slottime = info->use_short_slot ? 9 : 20;
 
@@ -557,7 +567,8 @@  int mt7615_mac_sta_add(struct mt76_dev *mdev, struct ieee80211_vif *vif,
 	mt7615_mac_wtbl_update(dev, idx,
 			       MT_WTBL_UPDATE_ADM_COUNT_CLEAR);
 
-	mt7615_mcu_sta_add(dev, vif, sta, true);
+	if (vif->type != NL80211_IFTYPE_STATION)
+		mt7615_mcu_sta_add(dev, vif, sta, true);
 
 	return 0;
 }