linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode
@ 2020-04-21  5:20 sean.wang
  2020-04-21  5:20 ` [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu sean.wang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: sean.wang @ 2020-04-21  5:20 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, ryder.lee, linux-wireless, linux-mediatek

From: Sean Wang <sean.wang@mediatek.com>

Have to perform WMM setup until BSS become active according to firmware
usage. Otherwise, the current usage would break WMM setting in STA mode.

Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Suggested-by: YF Luo <Yf.Luo@mediatek.com>
Suggested-by: Soul Huang <Soul.Huang@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 .../net/wireless/mediatek/mt76/mt7615/main.c  | 11 ++++++-
 .../net/wireless/mediatek/mt76/mt7615/mcu.c   | 32 ++++++++++++-------
 .../wireless/mediatek/mt76/mt7615/mt7615.h    | 10 ++++--
 3 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
index 417903a8e2ec..cdc8babca85a 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
@@ -424,7 +424,13 @@ mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
 
 	queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS;
 
-	return mt7615_mcu_set_wmm(dev, queue, params);
+	/* Have to set wmm up until BSS become active */
+	mvif->wmm[queue].cw_min = params->cw_min;
+	mvif->wmm[queue].cw_max = params->cw_max;
+	mvif->wmm[queue].aifs = params->aifs;
+	mvif->wmm[queue].txop = params->txop;
+
+	return 0;
 }
 
 static void mt7615_configure_filter(struct ieee80211_hw *hw,
@@ -503,6 +509,9 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
 		}
 	}
 
+	if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED))
+		mt7615_mcu_set_wmm(dev, vif);
+
 	if (changed & BSS_CHANGED_BEACON_ENABLED) {
 		mt7615_mcu_add_bss_info(phy, vif, info->enable_beacon);
 		mt7615_mcu_sta_add(dev, vif, NULL, info->enable_beacon);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 8b543e8dadb8..045bde7f554d 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -2269,8 +2269,7 @@ int mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val)
 				   &req, sizeof(req), true);
 }
 
-int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
-		       const struct ieee80211_tx_queue_params *params)
+int mt7615_mcu_set_wmm(struct mt7615_dev *dev, struct ieee80211_vif *vif)
 {
 #define WMM_AIFS_SET	BIT(0)
 #define WMM_CW_MIN_SET	BIT(1)
@@ -2289,21 +2288,30 @@ int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
 		__le16 txop;
 	} __packed req = {
 		.number = 1,
-		.queue = queue,
 		.valid = WMM_PARAM_SET,
-		.aifs = params->aifs,
 		.cw_min = 5,
 		.cw_max = cpu_to_le16(10),
-		.txop = cpu_to_le16(params->txop),
 	};
+	struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
+	int ac, err;
 
-	if (params->cw_min)
-		req.cw_min = fls(params->cw_min);
-	if (params->cw_max)
-		req.cw_max = cpu_to_le16(fls(params->cw_max));
+	for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
+		req.queue = ac + mvif->wmm_idx * MT7615_MAX_WMM_SETS;
+		req.aifs = mvif->wmm[ac].aifs;
+		req.txop = cpu_to_le16(mvif->wmm[ac].txop);
 
-	return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE,
-				   &req, sizeof(req), true);
+		if (mvif->wmm[ac].cw_min)
+			req.cw_min = fls(mvif->wmm[ac].cw_min);
+		if (mvif->wmm[ac].cw_max)
+			req.cw_max = cpu_to_le16(fls(mvif->wmm[ac].cw_max));
+
+		err = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE,
+					  &req, sizeof(req), true);
+		if (err < 0)
+			return err;
+	}
+
+	return 0;
 }
 
 int mt7615_mcu_set_dbdc(struct mt7615_dev *dev)
@@ -3353,7 +3361,7 @@ void mt7615_mcu_set_suspend_iter(void *priv, u8 *mac,
 	int i;
 
 	mt7615_mcu_set_bss_pm(phy->dev, vif, suspend);
-	
+
 	mt7615_mcu_set_gtk_rekey(phy->dev, vif, suspend);
 
 	mt7615_mcu_set_suspend_mode(phy->dev, vif, suspend, 1, true);
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
index 3e84c2dc0f93..ad37463a02d6 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
@@ -152,6 +152,13 @@ struct mt7615_vif {
 	u8 scan_seq_num;
 
 	struct mt7615_sta sta;
+
+	struct {
+		u16 cw_min;
+		u16 cw_max;
+		u16 txop;
+		u8 aifs;
+	} wmm[IEEE80211_NUM_ACS];
 };
 
 struct mib_stats {
@@ -386,8 +393,7 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
 			  struct ieee80211_tx_rate *rates);
 int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev);
 int mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd);
-int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
-		       const struct ieee80211_tx_queue_params *params);
+int mt7615_mcu_set_wmm(struct mt7615_dev *dev, struct ieee80211_vif *vif);
 void mt7615_mcu_rx_event(struct mt7615_dev *dev, struct sk_buff *skb);
 int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev,
 		       enum mt7615_rdd_cmd cmd, u8 index,
-- 
2.25.1

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

* [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu
  2020-04-21  5:20 [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode sean.wang
@ 2020-04-21  5:20 ` sean.wang
  2020-04-21  5:57   ` Ryder Lee
  2020-04-21  7:23   ` Felix Fietkau
  2020-04-21  5:20 ` [PATCH 3/3] mt76: mt7663: fix up BMC entry indicated to unicmd firmware sean.wang
  2020-04-21 12:31 ` [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode Lorenzo Bianconi
  2 siblings, 2 replies; 7+ messages in thread
From: sean.wang @ 2020-04-21  5:20 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, ryder.lee, linux-wireless, linux-mediatek, Soul Huang,
	Lorenzo Bianconi

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);
+	}
+
 	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;
 }
-- 
2.25.1

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

* [PATCH 3/3] mt76: mt7663: fix up BMC entry indicated to unicmd firmware
  2020-04-21  5:20 [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode sean.wang
  2020-04-21  5:20 ` [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu sean.wang
@ 2020-04-21  5:20 ` sean.wang
  2020-04-21  9:19   ` Felix Fietkau
  2020-04-21 12:31 ` [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode Lorenzo Bianconi
  2 siblings, 1 reply; 7+ messages in thread
From: sean.wang @ 2020-04-21  5:20 UTC (permalink / raw)
  To: nbd, lorenzo.bianconi
  Cc: sean.wang, ryder.lee, linux-wireless, linux-mediatek, Soul Huang

From: Sean Wang <sean.wang@mediatek.com>

BMC entry for MT7663 unicmd firmware should be a broadcast/multicast entry,
not a unicast entry, that is GTK rekey offload would rely on.

Fixes: 138860679b2a ("mt76: mt7615: add more uni mcu commands")
Cc: Soul Huang <Soul.Huang@mediatek.com>
Suggested-by: YF Luo <Yf.Luo@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
 drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
index 045bde7f554d..e8caa2c7981e 100644
--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
+++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
@@ -1339,7 +1339,7 @@ mt7615_mcu_uni_add_bss(struct mt7615_phy *phy,
 			.short_st = true,
 		},
 	};
-	u8 idx, tx_wlan_idx = 0;
+	u8 idx, tx_wlan_idx = mvif->sta.wcid.idx;
 	int err;
 
 	idx = mvif->omac_idx > EXT_BSSID_START ? HW_BSSID_0 : mvif->omac_idx;
@@ -1349,10 +1349,9 @@ mt7615_mcu_uni_add_bss(struct mt7615_phy *phy,
 	case NL80211_IFTYPE_MESH_POINT:
 	case NL80211_IFTYPE_AP:
 		basic_req.basic.conn_type = cpu_to_le32(CONNECTION_INFRA_AP);
-		tx_wlan_idx = mvif->sta.wcid.idx;
 		break;
 	case NL80211_IFTYPE_STATION:
-		if (enable) {
+		if (enable && !is_mt7663(&dev->mt76)) {
 			struct ieee80211_sta *sta;
 			struct mt7615_sta *msta;
 
-- 
2.25.1

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

* Re: [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu
  2020-04-21  5:20 ` [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu sean.wang
@ 2020-04-21  5:57   ` Ryder Lee
  2020-04-21  7:23   ` Felix Fietkau
  1 sibling, 0 replies; 7+ messages in thread
From: Ryder Lee @ 2020-04-21  5:57 UTC (permalink / raw)
  To: sean.wang
  Cc: nbd, lorenzo.bianconi, linux-wireless, linux-mediatek,
	Soul Huang, Lorenzo Bianconi

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;
>  }


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

* Re: [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu
  2020-04-21  5:20 ` [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu sean.wang
  2020-04-21  5:57   ` Ryder Lee
@ 2020-04-21  7:23   ` Felix Fietkau
  1 sibling, 0 replies; 7+ messages in thread
From: Felix Fietkau @ 2020-04-21  7:23 UTC (permalink / raw)
  To: sean.wang, lorenzo.bianconi
  Cc: ryder.lee, linux-wireless, linux-mediatek, Soul Huang, Lorenzo Bianconi

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

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

* Re: [PATCH 3/3] mt76: mt7663: fix up BMC entry indicated to unicmd firmware
  2020-04-21  5:20 ` [PATCH 3/3] mt76: mt7663: fix up BMC entry indicated to unicmd firmware sean.wang
@ 2020-04-21  9:19   ` Felix Fietkau
  0 siblings, 0 replies; 7+ messages in thread
From: Felix Fietkau @ 2020-04-21  9:19 UTC (permalink / raw)
  To: sean.wang, lorenzo.bianconi
  Cc: ryder.lee, linux-wireless, linux-mediatek, Soul Huang

On 2020-04-21 07:20, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> BMC entry for MT7663 unicmd firmware should be a broadcast/multicast entry,
> not a unicast entry, that is GTK rekey offload would rely on.
> 
> Fixes: 138860679b2a ("mt76: mt7615: add more uni mcu commands")
> Cc: Soul Huang <Soul.Huang@mediatek.com>
> Suggested-by: YF Luo <Yf.Luo@mediatek.com>
> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index 045bde7f554d..e8caa2c7981e 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -1339,7 +1339,7 @@ mt7615_mcu_uni_add_bss(struct mt7615_phy *phy,
>  			.short_st = true,
>  		},
>  	};
> -	u8 idx, tx_wlan_idx = 0;
> +	u8 idx, tx_wlan_idx = mvif->sta.wcid.idx;
>  	int err;
>  
>  	idx = mvif->omac_idx > EXT_BSSID_START ? HW_BSSID_0 : mvif->omac_idx;
> @@ -1349,10 +1349,9 @@ mt7615_mcu_uni_add_bss(struct mt7615_phy *phy,
>  	case NL80211_IFTYPE_MESH_POINT:
>  	case NL80211_IFTYPE_AP:
>  		basic_req.basic.conn_type = cpu_to_le32(CONNECTION_INFRA_AP);
> -		tx_wlan_idx = mvif->sta.wcid.idx;
>  		break;
>  	case NL80211_IFTYPE_STATION:
> -		if (enable) {
> +		if (enable && !is_mt7663(&dev->mt76)) {
mt7615_mcu_uni_add_bss is only called on mt7663 with offload firmware,
so you can simply delete the entire if (enable) { ... } code section.

- Felix

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

* Re: [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode
  2020-04-21  5:20 [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode sean.wang
  2020-04-21  5:20 ` [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu sean.wang
  2020-04-21  5:20 ` [PATCH 3/3] mt76: mt7663: fix up BMC entry indicated to unicmd firmware sean.wang
@ 2020-04-21 12:31 ` Lorenzo Bianconi
  2 siblings, 0 replies; 7+ messages in thread
From: Lorenzo Bianconi @ 2020-04-21 12:31 UTC (permalink / raw)
  To: sean.wang
  Cc: nbd, lorenzo.bianconi, ryder.lee, linux-wireless, linux-mediatek

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

> From: Sean Wang <sean.wang@mediatek.com>
> 
> Have to perform WMM setup until BSS become active according to firmware
> usage. Otherwise, the current usage would break WMM setting in STA mode.
> 
> Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
> Suggested-by: YF Luo <Yf.Luo@mediatek.com>
> Suggested-by: Soul Huang <Soul.Huang@mediatek.com>
> Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  .../net/wireless/mediatek/mt76/mt7615/main.c  | 11 ++++++-
>  .../net/wireless/mediatek/mt76/mt7615/mcu.c   | 32 ++++++++++++-------
>  .../wireless/mediatek/mt76/mt7615/mt7615.h    | 10 ++++--
>  3 files changed, 38 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/main.c b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> index 417903a8e2ec..cdc8babca85a 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/main.c
> @@ -424,7 +424,13 @@ mt7615_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 queue,
>  
>  	queue += mvif->wmm_idx * MT7615_MAX_WMM_SETS;
>  
> -	return mt7615_mcu_set_wmm(dev, queue, params);
> +	/* Have to set wmm up until BSS become active */
> +	mvif->wmm[queue].cw_min = params->cw_min;
> +	mvif->wmm[queue].cw_max = params->cw_max;
> +	mvif->wmm[queue].aifs = params->aifs;
> +	mvif->wmm[queue].txop = params->txop;

Hi Sean,

I think we can reuse ieee80211_tx_queue_params here since we are adding the
same fields.

> +
> +	return 0;
>  }
>  
>  static void mt7615_configure_filter(struct ieee80211_hw *hw,
> @@ -503,6 +509,9 @@ static void mt7615_bss_info_changed(struct ieee80211_hw *hw,
>  		}
>  	}
>  
> +	if (changed & (BSS_CHANGED_QOS | BSS_CHANGED_BEACON_ENABLED))
> +		mt7615_mcu_set_wmm(dev, vif);
> +
>  	if (changed & BSS_CHANGED_BEACON_ENABLED) {
>  		mt7615_mcu_add_bss_info(phy, vif, info->enable_beacon);
>  		mt7615_mcu_sta_add(dev, vif, NULL, info->enable_beacon);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> index 8b543e8dadb8..045bde7f554d 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
> @@ -2269,8 +2269,7 @@ int mt7615_mcu_set_rts_thresh(struct mt7615_phy *phy, u32 val)
>  				   &req, sizeof(req), true);
>  }
>  
> -int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
> -		       const struct ieee80211_tx_queue_params *params)
> +int mt7615_mcu_set_wmm(struct mt7615_dev *dev, struct ieee80211_vif *vif)

If we add someting like "mt7615_apply_wmm_parameters()" in main.c we can reuse the
current code

>  {
>  #define WMM_AIFS_SET	BIT(0)
>  #define WMM_CW_MIN_SET	BIT(1)
> @@ -2289,21 +2288,30 @@ int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
>  		__le16 txop;
>  	} __packed req = {
>  		.number = 1,
> -		.queue = queue,
>  		.valid = WMM_PARAM_SET,
> -		.aifs = params->aifs,
>  		.cw_min = 5,
>  		.cw_max = cpu_to_le16(10),
> -		.txop = cpu_to_le16(params->txop),
>  	};
> +	struct mt7615_vif *mvif = (struct mt7615_vif *)vif->drv_priv;
> +	int ac, err;
>  
> -	if (params->cw_min)
> -		req.cw_min = fls(params->cw_min);
> -	if (params->cw_max)
> -		req.cw_max = cpu_to_le16(fls(params->cw_max));
> +	for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
> +		req.queue = ac + mvif->wmm_idx * MT7615_MAX_WMM_SETS;
> +		req.aifs = mvif->wmm[ac].aifs;
> +		req.txop = cpu_to_le16(mvif->wmm[ac].txop);
>  
> -	return __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE,
> -				   &req, sizeof(req), true);
> +		if (mvif->wmm[ac].cw_min)
> +			req.cw_min = fls(mvif->wmm[ac].cw_min);
> +		if (mvif->wmm[ac].cw_max)
> +			req.cw_max = cpu_to_le16(fls(mvif->wmm[ac].cw_max));
> +
> +		err = __mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD_EDCA_UPDATE,
> +					  &req, sizeof(req), true);
> +		if (err < 0)
> +			return err;
> +	}
> +
> +	return 0;
>  }
>  
>  int mt7615_mcu_set_dbdc(struct mt7615_dev *dev)
> @@ -3353,7 +3361,7 @@ void mt7615_mcu_set_suspend_iter(void *priv, u8 *mac,
>  	int i;
>  
>  	mt7615_mcu_set_bss_pm(phy->dev, vif, suspend);
> -	
> +
>  	mt7615_mcu_set_gtk_rekey(phy->dev, vif, suspend);

I have not sent this patch yet :)

>  
>  	mt7615_mcu_set_suspend_mode(phy->dev, vif, suspend, 1, true);
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
> index 3e84c2dc0f93..ad37463a02d6 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h
> @@ -152,6 +152,13 @@ struct mt7615_vif {
>  	u8 scan_seq_num;
>  
>  	struct mt7615_sta sta;
> +
> +	struct {
> +		u16 cw_min;
> +		u16 cw_max;
> +		u16 txop;
> +		u8 aifs;
> +	} wmm[IEEE80211_NUM_ACS];

something like ieee80211_tx_queue_params wmm[IEEE80211_NUM_ACS]

>  };
>  
>  struct mib_stats {
> @@ -386,8 +393,7 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta,
>  			  struct ieee80211_tx_rate *rates);
>  int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev);
>  int mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd);
> -int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue,
> -		       const struct ieee80211_tx_queue_params *params);
> +int mt7615_mcu_set_wmm(struct mt7615_dev *dev, struct ieee80211_vif *vif);
>  void mt7615_mcu_rx_event(struct mt7615_dev *dev, struct sk_buff *skb);
>  int mt7615_mcu_rdd_cmd(struct mt7615_dev *dev,
>  		       enum mt7615_rdd_cmd cmd, u8 index,
> -- 
> 2.25.1

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

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

end of thread, other threads:[~2020-04-21 12:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-21  5:20 [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode sean.wang
2020-04-21  5:20 ` [PATCH 2/3] mt76: mt7615: add missing code for providing aid info to the mcu sean.wang
2020-04-21  5:57   ` Ryder Lee
2020-04-21  7:23   ` Felix Fietkau
2020-04-21  5:20 ` [PATCH 3/3] mt76: mt7663: fix up BMC entry indicated to unicmd firmware sean.wang
2020-04-21  9:19   ` Felix Fietkau
2020-04-21 12:31 ` [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode 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).