public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: sean.wang@mediatek.com
Cc: linux-mediatek@lists.infradead.org, lorenzo.bianconi@redhat.com,
	ryder.lee@mediatek.com, linux-wireless@vger.kernel.org,
	nbd@nbd.name
Subject: Re: [PATCH 1/3] mt76: mt7615: Fix up WMM setting for STA mode
Date: Tue, 21 Apr 2020 14:31:33 +0200	[thread overview]
Message-ID: <20200421123133.GA44668@lore-desk-wlan> (raw)
In-Reply-To: <1467d47fd111b5711fa74410833153bdc9e01b72.1587445885.git.sean.wang@mediatek.com>


[-- Attachment #1.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 #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

      parent reply	other threads:[~2020-04-21 12:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Lorenzo Bianconi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200421123133.GA44668@lore-desk-wlan \
    --to=lorenzo@kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox