Search Linux Wireless

Re: [PATCH 4/9] mt76: mt7921: enable deep sleep at runtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sean,

On 2021-05-10 17:14, sean.wang@xxxxxxxxxxxx wrote:
> From: Sean Wang <sean.wang@xxxxxxxxxxxx>
> 
> 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@xxxxxxxxxx>
> Signed-off-by: Sean Wang <sean.wang@xxxxxxxxxxxx>
> ---
>  .../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



[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux