[PATCH v3 6/7] wifi: mt76: mt7921: introduce remain_on_channel support

Felix Fietkau nbd at nbd.name
Fri Nov 11 03:52:16 PST 2022


On 10.11.22 22:23, sean.wang at mediatek.com wrote:
> From: Sean Wang <sean.wang at mediatek.com>
> 
> Introduce remain_on_channel support. Additionally, we add
> mt7921_check_offload_capability to disable .remain_on_channel and
> .cancel_remain_on_channel and related configuration because those
> operations would rely on the fundamental MCU commands that will be only
> supported with newer firmware.
> 
> Co-developed-by: Deren Wu <deren.wu at mediatek.com>
> Signed-off-by: Deren Wu <deren.wu at mediatek.com>
> Signed-off-by: Sean Wang <sean.wang at mediatek.com>
> ---
>   .../net/wireless/mediatek/mt76/mt7921/init.c  |  63 +++++++
>   .../net/wireless/mediatek/mt76/mt7921/main.c  | 165 ++++++++++++++++++
>   .../net/wireless/mediatek/mt76/mt7921/mcu.c   |  24 +++
>   .../wireless/mediatek/mt76/mt7921/mt7921.h    |  49 ++++++
>   .../net/wireless/mediatek/mt76/mt7921/pci.c   |  26 ++-
>   .../net/wireless/mediatek/mt76/mt7921/sdio.c  |  17 +-
>   .../net/wireless/mediatek/mt76/mt7921/usb.c   |  16 +-
>   7 files changed, 346 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> index 82df5fa4fbc7..82837ccc104d 100644
> --- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> +++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c
> @@ -1573,6 +1683,61 @@ mt7921_stop_ap(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
>   	mt7921_mutex_release(dev);
>   }
>   
> +const struct ieee80211_ops mt7921_ops_chanctx = {
> +	.tx = mt7921_tx,
> +	.start = mt7921_start,
> +	.stop = mt7921_stop,
> +	.add_interface = mt7921_add_interface,
> +	.remove_interface = mt7921_remove_interface,
> +	.config = mt7921_config,
> +	.conf_tx = mt7921_conf_tx,
> +	.configure_filter = mt7921_configure_filter,
> +	.bss_info_changed = mt7921_bss_info_changed,
> +	.start_ap = mt7921_start_ap,
> +	.stop_ap = mt7921_stop_ap,
> +	.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,
> +#if IS_ENABLED(CONFIG_IPV6)
> +	.ipv6_addr_change = mt7921_ipv6_addr_change,
> +#endif /* CONFIG_IPV6 */
> +	.ampdu_action = mt7921_ampdu_action,
> +	.set_rts_threshold = mt7921_set_rts_threshold,
> +	.wake_tx_queue = mt76_wake_tx_queue,
> +	.release_buffered_frames = mt76_release_buffered_frames,
> +	.channel_switch_beacon = mt7921_channel_switch_beacon,
> +	.get_txpower = mt76_get_txpower,
> +	.get_stats = mt7921_get_stats,
> +	.get_et_sset_count = mt7921_get_et_sset_count,
> +	.get_et_strings = mt7921_get_et_strings,
> +	.get_et_stats = mt7921_get_et_stats,
> +	.get_tsf = mt7921_get_tsf,
> +	.set_tsf = mt7921_set_tsf,
> +	.get_survey = mt76_get_survey,
> +	.get_antenna = mt76_get_antenna,
> +	.set_antenna = mt7921_set_antenna,
> +	.set_coverage_class = mt7921_set_coverage_class,
> +	.hw_scan = mt7921_hw_scan,
> +	.cancel_hw_scan = mt7921_cancel_hw_scan,
> +	.sta_statistics = mt7921_sta_statistics,
> +	.sched_scan_start = mt7921_start_sched_scan,
> +	.sched_scan_stop = mt7921_stop_sched_scan,
> +	CFG80211_TESTMODE_CMD(mt7921_testmode_cmd)
> +	CFG80211_TESTMODE_DUMP(mt7921_testmode_dump)
> +#ifdef CONFIG_PM
> +	.suspend = mt7921_suspend,
> +	.resume = mt7921_resume,
> +	.set_wakeup = mt7921_set_wakeup,
> +	.set_rekey_data = mt7921_set_rekey_data,
> +#endif /* CONFIG_PM */
> +	.flush = mt7921_flush,
> +	.set_sar_specs = mt7921_set_sar_specs,
> +	.remain_on_channel = mt7921_remain_on_channel,
> +	.cancel_remain_on_channel = mt7921_cancel_remain_on_channel,
> +};
> +EXPORT_SYMBOL_GPL(mt7921_ops_chanctx);
> +
>   const struct ieee80211_ops mt7921_ops = {
>   	.tx = mt7921_tx,
>   	.start = mt7921_start,
Please avoid creating a copy&paste ops struct, since that adds extra 
maintenance overhead.
For some devices we already use devm_kmemdup to duplicate and modify 
ops. Please use the same for chanctx. You could add a common function 
that fills in the remain_on_channel/chanctx part into the duplicated ops.

- Felix



More information about the Linux-mediatek mailing list