Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Felix Fietkau <nbd@nbd.name>
To: sean.wang@mediatek.com, lorenzo.bianconi@redhat.com
Cc: Soul.Huang@mediatek.com, YN.Chen@mediatek.com,
	Leon.Yen@mediatek.com, Eric-SY.Chang@mediatek.com,
	Deren.Wu@mediatek.com, km.lin@mediatek.com,
	robin.chiu@mediatek.com, ch.yeh@mediatek.com,
	posh.sun@mediatek.com, Eric.Liang@mediatek.com,
	Stella.Chang@mediatek.com, jemele@google.com,
	yenlinlai@google.com, linux-wireless@vger.kernel.org,
	linux-mediatek@lists.infradead.org
Subject: Re: [PATCH 4/9] mt76: mt7921: enable deep sleep at runtime
Date: Fri, 28 May 2021 14:51:21 +0200	[thread overview]
Message-ID: <6020930d-14dd-4150-3d91-454128bb9fc7@nbd.name> (raw)
In-Reply-To: <1620659697-12048-4-git-send-email-sean.wang@mediatek.com>


Hi Sean,

On 2021-05-10 17:14, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
> 
> Enable the deep sleep mode with that firmware is able to trap into
> the doze state at runtime to reduce the power consumption further.
> 
> The deep sleep mode is not allowed in the STA state transition with
> the firmware to have the fast connection experience as we've done in
> the full power mode
> 
> Reviewed-by: Lorenzo Bianconi <lorenzo@kernel.org>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> ---
>  .../wireless/mediatek/mt76/mt76_connac_mcu.c  | 20 +++++++++++++
>  .../wireless/mediatek/mt76/mt76_connac_mcu.h  |  3 ++
>  .../net/wireless/mediatek/mt76/mt7921/init.c  |  6 +++-
>  .../net/wireless/mediatek/mt76/mt7921/main.c  | 28 +++++++++++++++++--
>  4 files changed, 54 insertions(+), 3 deletions(-)
> 
>  void mt7921_unregister_device(struct mt7921_dev *dev)
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 39b3e769925e..5dbccbefe047 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -848,6 +848,31 @@ mt7921_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>  			      IEEE80211_STA_NOTEXIST);
>  }
>  
> +static int mt7921_sta_state(struct ieee80211_hw *hw,
> +			    struct ieee80211_vif *vif,
> +			    struct ieee80211_sta *sta,
> +			    enum ieee80211_sta_state old_state,
> +			    enum ieee80211_sta_state new_state)
> +{
> +	struct mt7921_dev *dev = mt7921_hw_dev(hw);
> +
> +	if (dev->pm.enable) {
> +		mt7921_mutex_acquire(dev);
> +		mt76_connac_sta_state_dp(&dev->mt76, old_state, new_state);
> +		mt7921_mutex_release(dev);
> +	}
> +
> +	if (old_state == IEEE80211_STA_AUTH &&
> +	    new_state == IEEE80211_STA_ASSOC) {
> +		return mt7921_sta_add(hw, vif, sta);
> +	} else if (old_state == IEEE80211_STA_ASSOC &&
> +		   new_state == IEEE80211_STA_AUTH) {
> +		return mt7921_sta_remove(hw, vif, sta);
> +	}
> +
> +	return 0;
> +}
> +
>  static int
>  mt7921_get_stats(struct ieee80211_hw *hw,
>  		 struct ieee80211_low_level_stats *stats)
> @@ -1191,8 +1216,7 @@ const struct ieee80211_ops mt7921_ops = {
>  	.conf_tx = mt7921_conf_tx,
>  	.configure_filter = mt7921_configure_filter,
>  	.bss_info_changed = mt7921_bss_info_changed,
> -	.sta_add = mt7921_sta_add,
> -	.sta_remove = mt7921_sta_remove,
> +	.sta_state = mt7921_sta_state,
>  	.sta_pre_rcu_remove = mt76_sta_pre_rcu_remove,
>  	.set_key = mt7921_set_key,
>  	.sta_set_decap_offload = mt7921_sta_set_decap_offload,
Unfortunately, we can't switch from sta_add/remove to .sta_state here.
When .sta_state is implemented, mac80211 assumes that the station entry
is usable after the NOTEXIST->NONE transition, while the driver state is
only created after the AUTH->ASSOC transition.

Can you please send a fix, or a replacement patch?

Thanks,

- Felix

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

  reply	other threads:[~2021-05-28 13:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10 15:14 [PATCH 1/9] mt76: mt7921: fix mt7921_wfsys_reset sequence sean.wang
2021-05-10 15:14 ` [PATCH 2/9] mt76: mt7921: Don't alter Rx path classifier sean.wang
2021-05-10 15:14 ` [PATCH 3/9] mt76: connac: fw_own rely on all packet memory all being free sean.wang
2021-05-10 15:14 ` [PATCH 4/9] mt76: mt7921: enable deep sleep at runtime sean.wang
2021-05-28 12:51   ` Felix Fietkau [this message]
2021-05-10 15:14 ` [PATCH 5/9] mt76: mt7921: add deep sleep control to runtime-pm knob sean.wang
2021-05-10 15:14 ` [PATCH 6/9] mt76: connac: fix WoW with disconnetion and bitmap pattern sean.wang
2021-05-10 15:14 ` [PATCH 7/9] mt76: mt7921: consider the invalid value for to_rssi sean.wang
2021-05-10 15:14 ` [PATCH 8/9] mt76: connac: add bss color support for sta mode sean.wang
2021-05-10 15:14 ` [PATCH 9/9] mt76: mt7921: add back connection monitor support sean.wang
2021-05-13  7:45   ` Felix Fietkau

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=6020930d-14dd-4150-3d91-454128bb9fc7@nbd.name \
    --to=nbd@nbd.name \
    --cc=Deren.Wu@mediatek.com \
    --cc=Eric-SY.Chang@mediatek.com \
    --cc=Eric.Liang@mediatek.com \
    --cc=Leon.Yen@mediatek.com \
    --cc=Soul.Huang@mediatek.com \
    --cc=Stella.Chang@mediatek.com \
    --cc=YN.Chen@mediatek.com \
    --cc=ch.yeh@mediatek.com \
    --cc=jemele@google.com \
    --cc=km.lin@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=posh.sun@mediatek.com \
    --cc=robin.chiu@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=yenlinlai@google.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