History log of /linux-master/drivers/net/wireless/mediatek/mt76/mt7615/main.c
Revision Date Author Comments
# f3f8f050 30-Jan-2024 Breno Leitao <leitao@debian.org>

wifi: fill in MODULE_DESCRIPTION()s for mt76 drivers

W=1 builds now warn if module is built without a MODULE_DESCRIPTION().
Add descriptions to the MediaTek mt76 drivers.

Here is a sorted list of descriptions. It might make the reviewing
process easier.

MODULE_DESCRIPTION("MediaTek MT7603E and MT76x8 wireless driver");
MODULE_DESCRIPTION("MediaTek MT7615E and MT7663E wireless driver");
MODULE_DESCRIPTION("MediaTek MT7615E MMIO helpers");
MODULE_DESCRIPTION("MediaTek MT7663 SDIO/USB helpers");
MODULE_DESCRIPTION("MediaTek MT7663S (SDIO) wireless driver");
MODULE_DESCRIPTION("MediaTek MT7663U (USB) wireless driver");
MODULE_DESCRIPTION("MediaTek MT76x02 helpers");
MODULE_DESCRIPTION("MediaTek MT76x02 MCU helpers");
MODULE_DESCRIPTION("MediaTek MT76x0E (PCIe) wireless driver");
MODULE_DESCRIPTION("MediaTek MT76x0U (USB) wireless driver");
MODULE_DESCRIPTION("MediaTek MT76x2 EEPROM helpers");
MODULE_DESCRIPTION("MediaTek MT76x2E (PCIe) wireless driver");
MODULE_DESCRIPTION("MediaTek MT76x2U (USB) wireless driver");
MODULE_DESCRIPTION("MediaTek MT76x connac layer helpers");
MODULE_DESCRIPTION("MediaTek MT76x EEPROM helpers");
MODULE_DESCRIPTION("MediaTek MT76x helpers");
MODULE_DESCRIPTION("MediaTek MT76x SDIO helpers");
MODULE_DESCRIPTION("MediaTek MT76x USB helpers");
MODULE_DESCRIPTION("MediaTek MT7915E MMIO helpers");
MODULE_DESCRIPTION("MediaTek MT7921 core driver");
MODULE_DESCRIPTION("MediaTek MT7921E (PCIe) wireless driver");
MODULE_DESCRIPTION("MediaTek MT7921S (SDIO) wireless driver");
MODULE_DESCRIPTION("MediaTek MT7921U (USB) wireless driver");
MODULE_DESCRIPTION("MediaTek MT7925 core driver");
MODULE_DESCRIPTION("MediaTek MT7925E (PCIe) wireless driver");
MODULE_DESCRIPTION("MediaTek MT7925U (USB) wireless driver");
MODULE_DESCRIPTION("MediaTek MT792x core driver");
MODULE_DESCRIPTION("MediaTek MT792x USB helpers");
MODULE_DESCRIPTION("MediaTek MT7996 MMIO helpers");

Signed-off-by: Breno Leitao <leitao@debian.org>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240130104243.3025393-10-leitao@debian.org


# 0335c034 29-Aug-2023 Felix Fietkau <nbd@nbd.name>

wifi: mt76: fix race condition related to checking tx queue fill status

When drv_tx calls race against local tx scheduling, the queue fill status checks
can potentially race, leading to dma queue entries being overwritten.
Fix this by deferring packets from drv_tx calls to the tx worker, in order to
ensure that all regular queue tx comes from the same context.

Reported-by: Ryder Lee <Ryder.Lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9d599f2d 22-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7615: rely on shared poll_list field

Rely on poll_list field in mt76_wcid structure and get rid of
private copy.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 57a3fac6 22-Jun-2023 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7615: rely on shared sta_poll_list and sta_poll_lock

Rely on sta_poll_list and sta_poll_lock fields in mt76_dev structure
and get rid of private copies.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 905a0a6a 01-May-2023 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: mt7615: enable BSS_CHANGED_MU_GROUPS support

The Group ID Management frame is an Action frame of category VHT.
It is transmitted by the AP to assign or change the user position
of a STA for one or more group IDs.

Also, sniffer can use a given group id to monitor STA that belongs
to that group.

Notify underlying driver of changes via BSS_CHANGED_MU_GROUPS.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e6db67fa 30-Mar-2023 Felix Fietkau <nbd@nbd.name>

wifi: mt76: ignore key disable commands

This helps avoid cleartext leakage of already queued or powersave buffered
packets, when a reassoc triggers the key deletion.

Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20230330091259.61378-1-nbd@nbd.name


# 1b9ba30e 02-Nov-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7615: rely on mt7615_phy in mt7615_mac_reset_counters

This is a preliminary patch to move aggr_stats array in mt76_phy
structure.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e34235cc 24-Oct-2022 Ryder Lee <ryder.lee@mediatek.com>

wifi: mt76: mt7615: enable use_cts_prot support

This adds selectable RTC/CTS enablement for each interface.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 765c69d4 25-Jul-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: mt7615: add mt7615_mutex_acquire/release in mt7615_sta_set_decap_offload

Similar to mt7921 driver, introduce mt7615_mutex_acquire/release in
mt7615_sta_set_decap_offload in order to avoid sending mcu commands
while the device is in low-power state.

Fixes: d4b98c63d7a77 ("mt76: mt7615: add support for rx decapsulation offload")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b3e2130b 24-Jun-2022 Johannes Berg <johannes.berg@intel.com>

wifi: mac80211: change QoS settings API to take link into account

Take the link into account in the QoS settings (EDCA parameters)
APIs.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# a1a99d7b 04-Jul-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: add phy_idx to mt76_wcid

Introduce phy_idx to mt76_wcid structure instead of ext_phy.
This is a preliminary patch to add newer chipset support.

Co-developed-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# aac86ceb 24-Jun-2022 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: fix throughput regression on DFS channels

For some reason, mt7615 reacts badly to repeatedly enabling/disabling the radar
detector without also switching the channel.
This results in very bad throughput on DFS channels, because
hw->conf.radar_enabled can get toggled a few times after CAC ends.
Fix this by always leaving the DFS detector enabled on DFS channels and instead
suppress unwanted detection events.

Fixes: 2c86f6752046 ("mt76: mt7615: fix/rewrite the dfs state handling logic")
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7b7090b4 24-May-2022 Johannes Berg <johannes.berg@intel.com>

wifi: mac80211: split bss_info_changed method

Split the bss_info_changed method to vif_cfg_changed and
link_info_changed, with the latter getting a link ID.
Also change the 'changed' parameter to u64 already, we
know we need that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# f276e20b 10-May-2022 Johannes Berg <johannes.berg@intel.com>

wifi: mac80211: move interface config to new struct

We'll use bss_conf for per-link configuration later, so
move out all the non-link-specific data out into a new
struct ieee80211_vif_cfg used in the vif.

Some adjustments were done with the following spatch:

@@
expression sdata;
struct ieee80211_vif *vifp;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
(
-sdata->vif.bss_conf.var
+sdata->vif.cfg.var
|
-vifp->bss_conf.var
+vifp->cfg.var
)

@bss_conf@
struct ieee80211_bss_conf *bss_conf;
identifier var = { assoc, ibss_joined, aid, arp_addr_list, arp_addr_cnt, ssid, ssid_len, s1g, ibss_creator };
@@
-bss_conf->var
+vif_cfg->var

(though more manual fixups were needed, e.g. replacing
"vif_cfg->" by "vif->cfg." in many files.)

Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# b619e013 17-Mar-2022 Evelyn Tsai <evelyn.tsai@mediatek.com>

mt76: fix MBSS index condition in DBDC mode

MT7915_MAX_INTERFACES is per-band declaration in MT7915/MT7986/MT7916.
Enlarge vif_mask to 64 bits wide, including the bit operation.

Reviewed-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Evelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: Bo Jiao <bo.jiao@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 51fb1278 25-Mar-2022 Felix Fietkau <nbd@nbd.name>

mt76: fix use-after-free by removing a non-RCU wcid pointer

Fixes an issue caught by KASAN about use-after-free in mt76_txq_schedule
by protecting mtxq->wcid with rcu_lock between mt76_txq_schedule and
sta_info_[alloc, free].

[18853.876689] ==================================================================
[18853.876751] BUG: KASAN: use-after-free in mt76_txq_schedule+0x204/0xaf8 [mt76]
[18853.876773] Read of size 8 at addr ffffffaf989a2138 by task mt76-tx phy0/883
[18853.876786]
[18853.876810] CPU: 5 PID: 883 Comm: mt76-tx phy0 Not tainted 5.10.100-fix-510-56778d365941-kasan #5 0b01fbbcf41a530f52043508fec2e31a4215

[18853.876840] Call trace:
[18853.876861] dump_backtrace+0x0/0x3ec
[18853.876878] show_stack+0x20/0x2c
[18853.876899] dump_stack+0x11c/0x1ac
[18853.876918] print_address_description+0x74/0x514
[18853.876934] kasan_report+0x134/0x174
[18853.876948] __asan_report_load8_noabort+0x44/0x50
[18853.876976] mt76_txq_schedule+0x204/0xaf8 [mt76 074e03e4640e97fe7405ee1fab547b81c4fa45d2]
[18853.877002] mt76_txq_schedule_all+0x2c/0x48 [mt76 074e03e4640e97fe7405ee1fab547b81c4fa45d2]
[18853.877030] mt7921_tx_worker+0xa0/0x1cc [mt7921_common f0875ebac9d7b4754e1010549e7db50fbd90a047]
[18853.877054] __mt76_worker_fn+0x190/0x22c [mt76 074e03e4640e97fe7405ee1fab547b81c4fa45d2]
[18853.877071] kthread+0x2f8/0x3b8
[18853.877087] ret_from_fork+0x10/0x30
[18853.877098]
[18853.877112] Allocated by task 941:
[18853.877131] kasan_save_stack+0x38/0x68
[18853.877147] __kasan_kmalloc+0xd4/0xfc
[18853.877163] kasan_kmalloc+0x10/0x1c
[18853.877177] __kmalloc+0x264/0x3c4
[18853.877294] sta_info_alloc+0x460/0xf88 [mac80211]
[18853.877410] ieee80211_prep_connection+0x204/0x1ee0 [mac80211]
[18853.877523] ieee80211_mgd_auth+0x6c4/0xa4c [mac80211]
[18853.877635] ieee80211_auth+0x20/0x2c [mac80211]
[18853.877733] rdev_auth+0x7c/0x438 [cfg80211]
[18853.877826] cfg80211_mlme_auth+0x26c/0x390 [cfg80211]
[18853.877919] nl80211_authenticate+0x6d4/0x904 [cfg80211]
[18853.877938] genl_rcv_msg+0x748/0x93c
[18853.877954] netlink_rcv_skb+0x160/0x2a8
[18853.877969] genl_rcv+0x3c/0x54
[18853.877985] netlink_unicast_kernel+0x104/0x1ec
[18853.877999] netlink_unicast+0x178/0x268
[18853.878015] netlink_sendmsg+0x3cc/0x5f0
[18853.878030] sock_sendmsg+0xb4/0xd8
[18853.878043] ____sys_sendmsg+0x2f8/0x53c
[18853.878058] ___sys_sendmsg+0xe8/0x150
[18853.878071] __sys_sendmsg+0xc4/0x1f4
[18853.878087] __arm64_compat_sys_sendmsg+0x88/0x9c
[18853.878101] el0_svc_common+0x1b4/0x390
[18853.878115] do_el0_svc_compat+0x8c/0xdc
[18853.878131] el0_svc_compat+0x10/0x1c
[18853.878146] el0_sync_compat_handler+0xa8/0xcc
[18853.878161] el0_sync_compat+0x188/0x1c0
[18853.878171]
[18853.878183] Freed by task 10927:
[18853.878200] kasan_save_stack+0x38/0x68
[18853.878215] kasan_set_track+0x28/0x3c
[18853.878228] kasan_set_free_info+0x24/0x48
[18853.878244] __kasan_slab_free+0x11c/0x154
[18853.878259] kasan_slab_free+0x14/0x24
[18853.878273] slab_free_freelist_hook+0xac/0x1b0
[18853.878287] kfree+0x104/0x390
[18853.878402] sta_info_free+0x198/0x210 [mac80211]
[18853.878515] __sta_info_destroy_part2+0x230/0x2d4 [mac80211]
[18853.878628] __sta_info_flush+0x300/0x37c [mac80211]
[18853.878740] ieee80211_set_disassoc+0x2cc/0xa7c [mac80211]
[18853.878851] ieee80211_mgd_deauth+0x4a4/0x10a0 [mac80211]
[18853.878962] ieee80211_deauth+0x20/0x2c [mac80211]
[18853.879057] rdev_deauth+0x7c/0x438 [cfg80211]
[18853.879150] cfg80211_mlme_deauth+0x274/0x414 [cfg80211]
[18853.879243] cfg80211_mlme_down+0xe4/0x118 [cfg80211]
[18853.879335] cfg80211_disconnect+0x218/0x2d8 [cfg80211]
[18853.879427] __cfg80211_leave+0x17c/0x240 [cfg80211]
[18853.879519] cfg80211_leave+0x3c/0x58 [cfg80211]
[18853.879611] wiphy_suspend+0xdc/0x200 [cfg80211]
[18853.879628] dpm_run_callback+0x58/0x408
[18853.879642] __device_suspend+0x4cc/0x864
[18853.879658] async_suspend+0x34/0xf4
[18853.879673] async_run_entry_fn+0xe0/0x37c
[18853.879689] process_one_work+0x508/0xb98
[18853.879702] worker_thread+0x7f4/0xcd4
[18853.879717] kthread+0x2f8/0x3b8
[18853.879731] ret_from_fork+0x10/0x30
[18853.879741]
[18853.879757] The buggy address belongs to the object at ffffffaf989a2000
[18853.879757] which belongs to the cache kmalloc-8k of size 8192
[18853.879774] The buggy address is located 312 bytes inside of
[18853.879774] 8192-byte region [ffffffaf989a2000, ffffffaf989a4000)
[18853.879787] The buggy address belongs to the page:
[18853.879807] page:000000004bda2a59 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1d89a0
[18853.879823] head:000000004bda2a59 order:3 compound_mapcount:0 compound_pincount:0
[18853.879839] flags: 0x8000000000010200(slab|head)
[18853.879857] raw: 8000000000010200 ffffffffbc89e208 ffffffffb7fb5208 ffffffaec000cc80
[18853.879873] raw: 0000000000000000 0000000000010001 00000001ffffffff 0000000000000000
[18853.879885] page dumped because: kasan: bad access detected
[18853.879896]
[18853.879907] Memory state around the buggy address:
[18853.879922] ffffffaf989a2000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[18853.879935] ffffffaf989a2080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[18853.879948] >ffffffaf989a2100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[18853.879961] ^
[18853.879973] ffffffaf989a2180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[18853.879986] ffffffaf989a2200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
[18853.879998] ==================================================================

Cc: stable@vger.kernel.org
Reported-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 148950e5 04-Feb-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce SAR support

Add SAR spec support to mt7615 driver to allow configuring SAR power
limitations on the frequency ranges from the userland.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4e58ef4b 23-Jan-2022 Xing Song <xing.song@mediatek.com>

mt76: stop the radar detector after leaving dfs channel

The radar detctor is used for dfs channel. So it will start after switching
to dfs channel and will stop after leaving. The TX will be blocked if radar
detctor isn't stopped in non-dfs channel.

This patch resets the dfs state to indicate the radar detector needs to be
stopped.

Signed-off-by: Xing Song <xing.song@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6a6f457e 22-Jan-2022 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: check sta_rates pointer in mt7615_sta_rate_tbl_update

Check sta_rates pointer value in mt7615_sta_rate_tbl_update routine
since minstrel_ht_update_rates can fail allocating rates array.

Fixes: 04b8e65922f63 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e814a68a 28-Dec-2021 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: update bss_info with cipher after setting the group key

In some cases, the WA firmware needs to know if encryption is used, in order
to set the protection bit of packets

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e6d2070d 09-Dec-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: introduce MCU_EXT macros

Introduce MCU_EXT_CMD and MCU_EXT_QUERY macros in mt76_connac module.
This is a preliminary patch to reuse mt76_connac module in mt7915
driver.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 70fb0287 25-Nov-2021 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: improve wmm index allocation

Typically all AP interfaces on a PHY will share the same WMM settings, while
sta/mesh interfaces will usually inherit the settings from a remote device.
In order minimize the likelihood of conflicting WMM settings, make all AP
interfaces share one slot, and all non-AP interfaces another one.

This also fixes running multiple AP interfaces on MT7613, which only has 3
WMM slots.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e4fce22b 18-Nov-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: remove dead code in get_omac_idx

Remove always false if condition in get_omac_idx for sta type

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 753453af 07-Oct-2021 Nick Hainke <vincent@systemli.org>

mt76: mt7615: mt7622: fix ibss and meshpoint

commit 7f4b7920318b ("mt76: mt7615: add ibss support") introduced IBSS
and commit f4ec7fdf7f83 ("mt76: mt7615: enable support for mesh")
meshpoint support.

Both used in the "get_omac_idx"-function:

if (~mask & BIT(HW_BSSID_0))
return HW_BSSID_0;

With commit d8d59f66d136 ("mt76: mt7615: support 16 interfaces") the
ibss and meshpoint mode should "prefer hw bssid slot 1-3". However,
with that change the ibss or meshpoint mode will not send any beacon on
the mt7622 wifi anymore. Devices were still able to exchange data but
only if a bssid already existed. Two mt7622 devices will never be able
to communicate.

This commits reverts the preferation of slot 1-3 for ibss and
meshpoint. Only NL80211_IFTYPE_STATION will still prefer slot 1-3.

Tested on Banana Pi R64.

Fixes: d8d59f66d136 ("mt76: mt7615: support 16 interfaces")
Signed-off-by: Nick Hainke <vincent@systemli.org>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20211007225725.2615-1-vincent@systemli.org


# 6c833df9 18-Oct-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: do not reset MIB counters in get_stats callback

MIB counters are used for ethtool stats as well

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bd1e3e7b 13-Sep-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: introduce packet_id idr

Introduce per-wcid idr to manage packet id for txs. This allow fast idr
lookup and skb queueing at the same time.

Tested-by: mrkiko.rs@gmail.com
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1f832887 07-Aug-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: move mt7615_mcu_set_p2p_oppps in mt76_connac module

Move mt7615_mcu_set_p2p_oppps routine in mt76_connac_lib module in order
to be reused in mt7921 driver

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a27238a0 18-Jun-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: set macwork timeout according to runtime-pm

Set macwork timeout value according to runtime-pm in order to reduce
power consumption

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6ab079e2 02-Jun-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: add mt76_connac_power_save_sched in mt76_connac_pm_unref

Schedule power_save work running mt76_connac_pm_unref in order to reduce
power consumption

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ffce39bf 27-May-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: remove useless if condition in mt7615_add_interface()

Get rid of unnecessary if condition in mt7615_add_interface routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# accbcea4 25-May-2021 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: add .offset_tsf callback

It's much more accurate than .get_tsf + .set_tsf and switch to use
mt76_rmw to operate tsf registers.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 54c31b9e 10-May-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7663: enable hw rx header translation

As already done for mt7615 and mt7915, enable rx header translation
offload for mt7663 in order to reduce cpu load in the rx path.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 310718ba 18-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: do not run mt76_txq_schedule_all directly

In order to not break runtime-pm, do run mt76_txq_schedule_all in
mt7615_set_channel/mt7921_set_channel but rely on mt76_worker_schedule

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 335e97ac 18-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7663: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx path

Introduce mt7615_tx_worker routine as mt76 tx worker callback for
mt7663.
Rely on mt76_connac_pm_ref/mt76_connac_pm_unref to check PM state and
increment/decrement wake counter

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f4f4089e 16-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: connac: move mcu_update_arp_filter in mt76_connac module

Move mt76_connac_mcu_update_arp_filter in mt76_connac module since the
code is shared between mt7615 and mt7921

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 18369a4f 13-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: introduce single-sku support for mt7663/mt7921

Introduce support for rate-txpower compensation for mt7663/mt7921 chipsets.
Rate-txpower limit is specified through dts

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d9852ab2 25-Mar-2021 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: keep mcu_add_bss_info enabled till interface removal

BSS_INFO_BASIC is never called alone with inactive state, which always
follows beacon offload disable, so keep it enabled throughout interfaces
life cycle. Inactive state also removes sta record of all connected
stations, thurs causes connection lost which defeats the purpose of CSA.

Lastly, this is especially an unexpected behavior that keeping mt7622
failing beacon buffer recyled when scanning channels.

bss_conf change is updated with active state only, so just overwrite it.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4bec61d9 04-Mar-2021 Sean Wang <sean.wang@mediatek.com>

mt76: mt7663: fix when beacon filter is being applied

HW beacon filter command is being applied until we're in associated state
because the command would rely on the associated access point's beacon
interval and DTIM information.

Fixes: 7124198ab1a4 ("mt76: mt7615: enable beacon filtering by default for offload fw")
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c3800cc2 05-Mar-2021 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: check mcu returned values in mt7615_ops

Properly check returned values from mcu utility routines in
mt7615_ops.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2eb6f6c4 23-Feb-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: fix mib stats counter reporting to mac80211

In order to properly report MIB counters to mac80211, resets stats in
mt7615_get_stats routine and hold mt76 mutex accessing MIB counters.
Sum up MIB counters in mt7615_mac_update_mib_stats routine.

Fixes: c388d8584bc83 ("mt76: mt7615: add a get_stats() callback")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a4a5a430 23-Feb-2021 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: fix TSF configuration

The index of TSF counters should follow HWBSSID.

Fixes: d8d59f66d136 ("mt76: mt7615: support 16 interfaces")
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d4b98c63 17-Feb-2021 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: add support for rx decapsulation offload

For AP and Client mode, the hardware can pass received packets
as 802.3 frames that can be passed to the network stack as-is.

Tested-by: Frank Wunderlich <frank-w@public-files.de>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 730d6d0d 08-Feb-2021 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: fix key set/delete issues

There were multiple issues in the current key set/remove code:
- deleting a key with the previous key index deletes the current key
- BIP key would only be uploaded correctly initially and corrupted on rekey

Rework the code to better keep track of multiple keys and check for the
key index before deleting the current key

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1755f6ad 25-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76_connac: move pm utility routines in mt76_connac_lib module

Move power_save common code shared between mt7663 and mt7921 in
mt76_connac module

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b7dd3c2e 25-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76_connac: move pm data struct in mt76_connac.h

Move pm mt7663 data structure in mt76_connac.h introducing
mt76_connac_pm data struct. This is a preliminary patch to share pm code
between mt7663 and mt7921

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 55d4c19c 25-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76_connac: move WoW and suspend code in mt76_connac_mcu module

Move WoW and suspend code in mt76_connac_mcu module in order to be reused in
mt7615 and mt7921 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 399090ef 25-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76_connac: move hw_scan and sched_scan routine in mt76_connac_mcu module

Move hw_scan/sched_scan in mt76_connac_mcu module in order to be reused in
mt7615 and mt7921 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d0e274af 25-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76_connac: create mcu library

Introduce mt76_connac common mcu library for code sharing between mt7615 and
mt7921 devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 85d96704 25-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: introduce mt76_vif data structure

Introduce mt76_vif data structure to share common fields between
mt7615_vif and mt7921_vif and create a mcu common library

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2ab33b8d 20-Jan-2021 Felix Fietkau <nbd@nbd.name>

mt76: move vif_mask back from mt76_phy to mt76_dev

Since it is global for all drivers, it belongs to the main device

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 06e0bbe1 05-Jan-2021 Shayne Chen <shayne.chen@mediatek.com>

mt76: mt7615: mt7915: disable txpower sku when testmode enabled

When testmode can be enabled, the start() callback would already be
called, causing that txpower sku feature isn't really disabled after
testmode is enabled. This patch fix the issue.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b9027e08 04-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move chainmask in mt76_phy

Move chainmask from driver phy to mt76_phy since it is used by all
drivers. This is a preliminary patch to create a common mcu library used
by mt7615 and mt7921 drivers

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a782f8bf 04-Jan-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move mac_work in mt76_core module

Move mac_work delayed_work and mac_work_count in mt76_phy since it is
used by all drivers. This is a preliminary patch to create a common mcu
library used by mt7615 and mt7921 drivers

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c918c74d 04-Dec-2020 Shayne Chen <shayne.chen@mediatek.com>

mt76: testmode: introduce dbdc support

Add testmode support for DBDC NICs (both MT7615D and MT7915D work).
Testmode data and parameters are moved from per-dev to per-phy
for maintaining the value of each band.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d8d59f66 29-Oct-2020 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: support 16 interfaces

When looking for a MAC address slot, start by using main BSSID slots 1-3,
afterwards use 16 repeater mode BSSID slots, then start using the slots
usually used for AP mode.

This search order should prevent unnecessary conflicts with AP mode interfaces
on the same PHY.

Note that two PHYs share global 32 omac slots with each other.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# faa72684 20-Oct-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: run key configuration in mt7615_set_key for usb/sdio devices

Since rate configuration is run holding dev mutex, we can run key
configuration in mt7615_set_key for usb/sdio devices avoiding to
schedule the workqueue

Tested-by: Tested-by: YN Chen <yn.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d3a5d89e 17-Oct-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: switch to wep sw crypto for mt7615/mt7915

Switch to wep sw crypto for mt7615/mt7915 since wtbl require a sta
reference and wep key is not pairwise

Tested-by: YN Chen <yn.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7124198a 30-Sep-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: enable beacon filtering by default for offload fw

In order to reduce cpu cycles, enable hw beacon filter by default if
the device is running offload fw with sta only interfaces.
Disable runtime pm for multi-vif scenario.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2bffdded 02-Sep-2020 Felix Fietkau <nbd@nbd.name>

mt76: remove retry_q from struct mt76_txq and related code

Since the switch to using AQL by default, mtxq->retry_q is never filled anymore
Remove it to get rid of a few more unnecessary cycles in the tx path

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 781eef5b 24-Jul-2020 Felix Fietkau <nbd@nbd.name>

mt76: convert from tx tasklet to tx worker thread

This improves performance by allowing the scheduler to move the tx scheduling
work to idle CPUs. Since tx scheduling work is very latency sensitive and
kept short via AQL, sched_set_fifo_low is used to keep worker priority above
normal tasks

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5c4b29fd 28-Jul-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: remove mtxq->agg_ssn assignment

It is not used anywhere for this driver

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0825af2d 30-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: reschedule runtime-pm receiving a tx interrupt

Reschedule runtime-pm after receiving a tx interrupt.
Update runtime-pm last activity before injecting packets

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# cddaaa56 30-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: hold mt76 lock queueing wd in mt7615_queue_key_update

wq queue is always updated holding mt76 spinlock. Grab mt76 lock in
mt7615_queue_key_update() before putting a new element at the end of the
queue.

Fixes: eb99cc95c3b65 ("mt76: mt7615: introduce mt7663u support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0fa407c3 15-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: sdio code must access rate/key regs in preocess context

As usb, sdio relies on mt76 workqueue to configure tx rate or upload
keys to the hw. This is a preliminary patch to add SDIO support to
mt76 driver

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4bb586bc 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7663u: sync probe sampling with rate configuration

On usb device rate configuration for sampling is performed relying on a
workqueue since it is not possible to access the device in the interrupt
context. Move the configuration of the probe_rate flag in the workqueue
in order to keep probe sampling in sync with actual rate configuration

Fixes: eb99cc95c3b6 ("mt76: mt7615: introduce mt7663u support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 83b9f42a 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: enable beacon hw filter for runtime-pm

In order to reduce number of received interrupts and power consumption,
enable hw beacon filter if runtime-pm is enabled

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a2b30bd4 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: check MT76_STATE_PM flag before accessing the device

Double-check if the device is in low-power state before accessing
registermap in mt7615_sta_rate_tbl_update() and in
mt7615_led_set_config()

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1eae3fb9 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: run mt7615_pm_wake in mt7615_mac_sta_{add,remove}

Run mt7615_pm_wake()/mt7615_pm_power_save_sched() directly in order to
wake the device from low power state in mt7615_mac_sta_{add,remove}
since they run holding mt76 mutex in common mt76 code

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2b8cdfb2 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: wake device before pushing frames in mt7615_tx

Queue frames pushed by mac80211 running mt7615_tx if the device is
low-power state. Run wake workqueue in order to swicth to full-power
before transmitting pending frames

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5cf8f779 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: wake device before pulling packets from mac80211 queues

Make sure the device is in full-power before pulling frames from
mac80211 queues

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 46dadc31 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: run mt7615_mcu_set_roc holding mt76 mutex

Make sure to run mt7615_mcu_set_roc() holding mt76 mutex in order to
wake the device from low power state and avoid races

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# de1f66ba 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: run mt7615_mcu_set_wmm holding mt76 mutex

Make sure to run mt7615_mcu_set_wmm() holding mt76 mutex in order to
wake the device from low power state and avoid races

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 888a678a 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: wake device before performing freq scan

Set device in full power before performing hw scan or hw scheduled scan

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# de5ff3c9 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce pm_power_save delayed work

Introduce runtime-pm power_save delayed work used to enable
low-power after an inactivity period

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 940a0c63 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: wake device before configuring hw keys

Make sure the device is in full-power before uploading keys to the hw

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# adfd5112 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce mt7615_mutex_{acquire,release} utilities

Introduce mt7615_mutex_{acquire,release} utility routines in order to
switch in full-power/low-power before/after accessing device register-map

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 08523a2a 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add mt7615_pm_wake utility routine

Introduce mt7615_pm_wake utility routine to wake the device from
runtime low-power state (lower-power state is currently supported by
offload firmware for pcie devices).

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a86f1d01 03-Jul-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move mt76 workqueue in common code

Move mt76 workqueue from usb to common code in order to be reused adding
low-power support for mt7663 chipset

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4f0bce1c 18-Jun-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: implement testmode support

Supports sending a configurable number of packets with a specific rate
and configurable tx power levels / antenna settings, as well as displaying
rx statistics.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# beffe070 11-Jun-2020 Felix Fietkau <nbd@nbd.name>

mt76: vif_mask to struct mt76_phy

All drivers use this in pretty much the same way. Moving it to core helps with
some checks for the upcoming testmode support

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b876658b 17-Jun-2020 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: add .set_tsf callback

It is useful for IBSS Mesh to adjust t_clockdrift.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 73741b9b 07-Jun-2020 Sean Wang <sean.wang@mediatek.com>

mt76: mt7663: introduce ARP filter offload

Introduce ARP filter offload

Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@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>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a28bef56 30-May-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: re-enable offloading of sequence number assignment

Preparation for supporting more offload features

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1fec635b 30-May-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: fix hw queue mapping

mt7622/mt7663 chipsets rely on a fixed reverse queue map order respect
to mac80211 one:
- q(0): IEEE80211_AC_BK
- q(1): IEEE80211_AC_BE
- q(2): IEEE80211_AC_VI
- q(3): IEEE80211_AC_VO

Fixes: cdad4874057d ("mt76: mt7615: add dma and tx queue initialization for MT7622")
Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2cb002e3 02-Jun-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: add missing lock configuring coverage class

Coverage class callback can potentially run in parallel with other
routines (e.g. mt7615_set_channel) that configures timing registers.
Run coverage class callback holding mt76 mutex

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a07292ee 30-May-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: fix hw queue mapping

mt7622/mt7663 chipsets rely on a fixed reverse queue map order respect
to mac80211 one:
- q(0): IEEE80211_AC_BK
- q(1): IEEE80211_AC_BE
- q(2): IEEE80211_AC_VI
- q(3): IEEE80211_AC_VO

Fixes: cdad4874057d ("mt76: mt7615: add dma and tx queue initialization for MT7622")
Fixes: f40ac0f3d3c0 ("mt76: mt7615: introduce mt7663e support")
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bb577682 02-Jun-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: add missing lock configuring coverage class

Coverage class callback can potentially run in parallel with other
routines (e.g. mt7615_set_channel) that configures timing registers.
Run coverage class callback holding mt76 mutex

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 194a1508 28-May-2020 YueHaibing <yuehaibing@huawei.com>

mt76: mt7615: Use kmemdup in mt7615_queue_key_update()

Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a5e0aa78 19-May-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: switch to per-vif power_save support

switch to per-vif ps support since mt7615 offload firmware can handle it
properly. This patch allows enabling/disabling power-save support on p2p
interface

Tested-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7307f296 15-May-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce remain_on_channel support

Introduce remain_on_channel support to mt7615 driver if the device is
running offload firmware

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7a20388e 12-May-2020 Sean Wang <sean.wang@mediatek.com>

mt76: mt7615: configure bss info adding the interface

Introduce essential bss information for multiple vifs hw_scan in
mt7615_mcu_uni_add_dev adding the interface

Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 50eb0a88 12-May-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: enable p2p support

Introduce p2p-go/p2p-client suppor to mt76 driver

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7cba8c30 12-May-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: do not report scan_complete twice to mac80211

Fix the following kernel warning that occurs if scan work is scheduled
and the hw scan has been cancelled by mac80211

WARNING: CPU: 1 PID: 502 at net/mac80211/scan.c:391 __ieee80211_scan_completed+0x299/0x690
Modules linked in:
CPU: 1 PID: 502 Comm: kworker/u4:4 Not tainted 5.7.0-rc1+ #2882
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-2.fc32 04/01/2014
Workqueue: phy0 ieee80211_scan_work
RIP: 0010:__ieee80211_scan_completed+0x299/0x690
RSP: 0018:ffffc9000036fda8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 8c6318c6318c6320
RDX: 0000000000000000 RSI: 00000000ffffffff RDI: ffff88803bb129b8
RBP: ffff88803bb10d80 R08: 0000000000000001 R09: 0000000000000001
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: ffff88803bb12ae8
FS: 0000000000000000(0000) GS:ffff88803ec00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f13ee5c1470 CR3: 000000003c790000 CR4: 00000000000006a0
Call Trace:
ieee80211_scan_work+0x170/0x850
? sched_clock_cpu+0x11/0xb0
process_one_work+0x24f/0x580
? worker_thread+0xcc/0x3e0
worker_thread+0x4f/0x3e0
? process_one_work+0x580/0x580
kthread+0x11b/0x140
? __kthread_bind_mask+0x60/0x60
ret_from_fork+0x3a/0x50
irq event stamp: 9255532
hardirqs last enabled at (9255531): [<ffffffff81a504e4>] _raw_spin_unlock_irq+0x24/0x30
hardirqs last disabled at (9255532): [<ffffffff81001b3f>] trace_hardirqs_off_thunk+0x1a/0x1c
softirqs last enabled at (9255526): [<ffffffff8107c9ef>] process_one_work+0x24f/0x580
softirqs last disabled at (9255524): [<ffffffff815f2f41>] mt7615_scan_work+0x91/0xc0

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bb3e3fec 24-Apr-2020 Ryder Lee <ryder.lee@mediatek.com>

mt76: set runtime stream caps by mt76_phy

This patch can support concurrent dual-band operation.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b47e21e7 30-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add gtk rekey offload support

Add KCK and KEK offload support to mt7615 driver in order to
support GTK rekeying during PM suspend

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c6bf2010 30-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add WoW support

Introduce WoW support to mt7615 driver.
Current supported trigger are:
- magic-packet
- disconnect
- user-pattern

Co-developed-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Signed-off-by: Wan-Feng Jiang <Wan-Feng.Jiang@mediatek.com>
Co-developed-by: Soul Huang <Soul.Huang@mediatek.com>
Signed-off-by: Soul Huang <Soul.Huang@mediatek.com>
Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6c5974c1 30-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: do not mark sched_scan disabled in mt7615_scan_work

For the moment offload firmware supports just one entry in the scheduled
scan plan and so it runs till it is disabled by the userspace.
Do not mark the hw scheduled scan as disabled in mt7615_scan_work
after receiving a scan result

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f5596850 23-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add sta pointer to mt7615_mcu_add_bss_info signature

Introduce sta pointer to mt7615_mcu_add_bss_info signature in order to
avoid sta lookup in mt7615_mcu_bss_basic_tlv routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# dd89a013 22-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: enable TDLS support

Enable mac80211 TDLS support by default. Disable TDLS hw filtering for
mt7615 devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# dcc4c74f 22-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: move mcu bss upload before creating the sta

Run mt7615_mcu_add_bss_info routine before mt7615_mcu_sta_add since
the firmware requires the bss is created before the relative sta

Tested-by: Sean Wang <sean.wang@mediatek.com>
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: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7f8ebafe 17-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7663: introduce 802.11 PS support in sta mode

Enable 802.11 power-save support available in mt7663 firmware

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# eb99cc95 16-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce mt7663u support

Introduce support for mt7663u 802.11ac 2x2:2 chipset to mt7615 driver.
Main difference respect to pcie code base is the usb code needs to
configure wtbl from non-atomic context

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e90354e0 16-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: move core shared code in mt7615-common module

Create mt7615-common module in order to collect shared code between usb
and mmio code. Move the following source files in mt7615-common module:
- main.c
- init.c
- mcu.c
- mac.c
- debugfs.c
- eeprom.c
- trace.c

Create the following source files for mmio only source code and move them
in mt7615e module:
- pci_init.c
- dma.c
- pci_mac.c

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4fcf6e77 13-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: fix possible deadlock in mt7615_stop

make mac_work per phy instead of per device and fix a possible deadlock
in mt7615_stop since mt7615_mac_work runs holding mt76 mutex

Fixes: fdd2e570764c2 ("mt76: mt7615: add dual-phy support for mac80211 ops")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 371a59d1 06-Apr-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: add support for applying tx DPD calibration from EEPROM

When the EEPROM data is read from flash, it can contain tx DPD calibration
data. Add support for sending the data to the firmware.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ad380ad1 30-Mar-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: add support for applying DC offset calibration from EEPROM

When the EEPROM data is read from flash, it can contain DC offset calibration
data. Add support for sending the data to the firmware.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fdb786cc 03-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: do not always reset the dfs state setting the channel

mac80211/hostapd runs mt7615_set_channel with the same channel
parameters sending multiple rdd commands overwriting the previous ones.
This behaviour is causing tpt issues on dfs channels.
Fix the issue checking new channel freq/width with the running one.

Fixes: 5dabdf71e94e ("mt76: mt7615: add multiple wiphy support to the dfs support code")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5d3a4a4b 02-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce rlm tlv in bss_info mcu command

Introduce rlm tlv header in bss_info mcu command in order to
inform the mcu about operating channel. Rlm header is necessary only if
the mcu is running low power functionalities (e.g offloaded scan)

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 20305f98 02-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce scheduled scan support

Introduce scheduled scan support for mt7663e devices

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fcdfc29e 02-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce hw scan support

Introduce hw scan support to mt7663e driver

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# bf18fcdc 02-Apr-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce mt7615_mcu_set_channel_domain mcu command

Introduce mt7615_mcu_set_channel_domain routines in order to instruct
the mcu about supported band/channels. This is a preliminary patch to
add hw scan support to mt7663e driver

Co-developed-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 062c3699 17-Mar-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: move more mcu commands in mt7615_mcu_ops data structure

Move mt7615_mcu_set_beacon_offload, mt7615_mcu_set_dev and
mt7615_mcu_set_bss routine in mt7615_mcu_ops data structure.
This is a preliminary patch to support mt7663 firmware

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b4985ff1 17-Mar-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: move mt7615_mcu_set_sta in mt7615_mcu_ops

Move mt7615_mcu_set_sta for fw version 1 and version 2 in mt7615_mcu_ops
data structure. This is a preliminary patch to properly support mt7663e
firmware.
Rework utility routines to rely on skb APIs for msg parsing

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 99c457d9 17-Mar-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: move mt7615_mcu_set_bmc to mt7615_mcu_ops

Move mt7615_mcu_set_bmc for fw version 1 and version 2 in
mt7615_mcu_ops data structure. This is a preliminary patch
to properly support mt7663e firmware.
Rework utility routines to rely on skb APIs for msg parsing

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6f4d7cc8 17-Mar-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add mt7615_mcu_ops data structure

Introduce mt7615_mcu_ops data structure in order to support multiple
mcu ops API.
Move mt7615_mcu_set_{tx,rx}_ba to mt7615_mcu_ops differentiating between
fw v1 and v2. This is a preliminary patch to properly support mt7663e
firmware.
Rework utility routines to rely on skb APIs for msg parsing

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1a7d3f47 25-Feb-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: fix antenna mask initialization in DBDC mode

Update wiphy available antenna mask, and fix chainmask setting on 3x3 hardware

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0e544cb5 12-Feb-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: rework rx phy index handling

Overwriting the RMAC_CHFREQ register is not reliable enough, as the firmware
could potentially write it again.
Since there is no PHY index indication in the rx info, we need to use another
way:

If both PHYs are using different channels, find the PHY where chfreq matches
the register value.

The only corner case remaining is when both PHYs are using the same channel.
In that case, the per-packet noise value on the primary PHY will have
information belonging to the chains of the secondary PHY from the previous
received packet of that PHY. The secondary PHY will set noise to 0 for extra
chains.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 43ba1922 06-Feb-2020 Felix Fietkau <nbd@nbd.name>

mt76: avoid extra RCU synchronization on station removal

Use sta_pre_rcu_remove callback to clear wcid pointer earlier

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 8e2ad48e 02-Feb-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: fix monitor mode on second PHY

The second PHY receives no packets unless there is an active vif present.
Set the WANT_MONITOR_VIF flag to deal with that

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c5502b89 02-Feb-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: fix adding active monitor interfaces

Treat them the same as AP iftype internally for MCU commands

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 20c3604f 01-Feb-2020 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: simplify mcu_set_sta flow

Move mcu_add_wtbl and mcu_set_ht_cap into mcu_set_sta to simplify flow.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# dc80bb6f 01-Feb-2020 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: simplify mcu_set_bmc flow

Move set_bmc_wtbl into sta_rec function to simplify flow.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 15d9a5d7 30-Jan-2020 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: fix and rework tx power handling

Setting the tx power by manipulating EEPROM may in some cases not be enough,
since it only covers the base target power and not per-rate offsets.
In other cases, it could limit tx power of rates too much, possibly reducing
throughput or range.
Use firmware support for applying per-rate limit and power offsets for
different values of Nss.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 35da599f 18-Dec-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: implement probing and firmware loading on MT7622

MT7622 does not have a CR4 microcontroller, so it only uses its own N9
firmware.

Co-developed-by: Shayne Chen <shayne.chen@mediatek.com>
Co-developed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c388d858 27-Dec-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: add a get_stats() callback

Add a get_stats() callback for mib statistics.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 31affc96 27-Dec-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: report TSF information

This adds a get_tsf() callback for ibss.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0d88aea8 22-Dec-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: add set_antenna callback

Add a set_antenna callback to setup per phy tx/rx streams.

Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4fe9218c 22-Dec-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: rework set_channel function

No need to send both MCU_EXT_CMD_SET_RX_PATH and MCU_EXT_CMD_CHANNEL_SWITCH
together to MCU.

Split them out by passing the proper command in the corresponding flow.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e5051965 14-Dec-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: measure channel noise and report it via survey

Read measurements every 100 ms and build a simple moving average

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 183d1fcf 08-Dec-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add set_coverage class support

Add the capability to configure acktimeout for mt7615 driver. Moreover
configure slottime according to the value provided by mac80211

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3e384828 05-Dec-2019 Felix Fietkau <nbd@nbd.name>

mt7615: replace sta_state callback with sta_add/sta_remove

The MT7615 firmware needs to know the association id at creation time,
which is unavailable during the transition from notexist to none in
.sta_state.
This can cause a number of issues, probably also breaking powersave
support.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c3c25d09 05-Dec-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: defer mcu initialization via workqueue

Loading the mcu firmware and waiting for it to boot takes a long time,
which adds a significant amount to the system boot time.
Fix this by running the mcu init from a workqueue and waiting for it to
complete before starting the phy or issuing mcu commands via debugfs

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f0305d18 06-Nov-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: update beacon contents on BSS_CHANGED_BEACON

Beacon changes need to be sent to the firmware, otherwise it will
keep sending stale data

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b0b5426e 31-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: move radio/mac initialization to .start/stop callbacks

Run initialization per phy

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# ac3ef85c 30-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: initialize dbdc settings on interface add

Use the first two WMM slots for the primary phy and the second two for the
secondary phy.

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 27ae7219 30-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: add multiple wiphy support to the rx path

Program the RMAC CHFREQ registers to properly indicate the band that the
frames are received on.
Add some sanity checks to the programmed values, because the firmware
programs these registers differently

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5dabdf71 30-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: add multiple wiphy support to the dfs support code

There are two DFS detectors on the chip. When using 160 MHz channel bandwidth
(not supported in dual-wiphy mode), both are used. Otherwise, one detector is
used per wiphy.
Rework the code to start/stop them separately per phy and to indicate the
radar event on the right phy based on the detector index

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d446a20f 26-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: add multiple wiphy support for smart carrier sense

Use per-phy radio stats and tuning registers

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fdd2e570 15-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: add dual-phy support for mac80211 ops

Allows them to be used by a separately registered wiphy later

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 011849e0 15-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: move state from struct mt76_dev to mt76_phy

Allows keeping per-wiphy state separate

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 96747a51 12-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: move channel state to struct mt76_phy

Add support for an extra wiphy in mt76_set_channel and mt76_get_survey
This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9fba6d07 11-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: add support for an extra wiphy in the main tx path

This is preparation for supporting multiple wiphys per device to support the
concurrent dual-band feature of MT7615D

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 05d6c8cf 20-Nov-2019 Markus Theil <markus.theil@tu-ilmenau.de>

mt76: fix fix ampdu locking

The current ampdu locking code does not unlock its mutex in the early
return case. This patch fixes it.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Acked-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>


# e49c76d4 14-Nov-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move mt76_get_antenna in mt76_core module

Move mt76_get_antenna in mac80211.c in order to be reused by all
drivers. Initialize .get_antenna function pointer for mt76x0, mt7603,
mt7615 and mt76x2u drivers

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7f4b7920 07-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add ibss support

Enable IFTYPE_ADHOC support on 7615 devices. The feature has been tested
using a mt76x2 device as wireless peer.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5d1ad7d7 25-Oct-2019 YueHaibing <yuehaibing@huawei.com>

mt76: mt7615: remove unneeded semicolon

remove unneeded semicolon.
This is detected by coccinelle.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1a817fa7 06-Oct-2019 Felix Fietkau <nbd@nbd.name>

mt76: add missing locking around ampdu action

This is needed primarily to avoid races in dealing with rx aggregation
related data structures

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b2c2f029 17-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: track tx/rx airtime for airtime fairness

Poll per-station hardware counters available in WTBL after tx/rx
status events in order to report tx/rx airtime to mac80211 layer

Co-developed-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6bfa6e38 17-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: report tx_time, bss_rx and busy time to mac80211

Report tx time/rx time and obss time from hw mib counters to fill survey
info requested by mac80211

Co-developed-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 75601194 13-Sep-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: collect aggregation stats

Introduce ampdu_stat entry in mt7615 debugfs in order to dump 802.11
aggr cumulative statistics

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b4124a5b 12-Sep-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: fix control frame rx in monitor mode

Adjust filters and ensure frames don't get sent to MCU instead of host

Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2ce113de 02-Oct-2019 Johannes Berg <johannes.berg@intel.com>

mac80211: simplify TX aggregation start

There really is no need to make drivers call the
ieee80211_start_tx_ba_cb_irqsafe() function and then
schedule the worker if all we want is to set a bit.

Add a new return value (that was previously considered
invalid) to indicate that the driver is immediately
ready for the session, and make drivers use it. The
only drivers that remain different are the Intel ones
as they need to negotiate more with the firmware.

Link: https://lore.kernel.org/r/1570007543-I152912660131cbab2e5d80b4218238c20f8a06e5@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>


# e3ca8fa0 22-Aug-2019 Felix Fietkau <nbd@nbd.name>

mt76: do not send BAR frame on tx aggregation flush stop

There is no need to send a BAR frame after stopping aggregation, and doing
so could lead to sending class 3 frames after deauthentication from an AP

Signed-off-by: Balakrishna Bandi <b.balakrishna@globaledgesoft.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 8b8ab5c2 21-Aug-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: add default implementation for mt76_sw_scan/mt76_sw_scan_complete

Introduce a default implementation for mt76_sw_scan and
mt76_sw_scan_complete in mt76 module and remove duplicated code
since most of the drivers share the same implementation

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 01cfc1b4 20-Aug-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add BIP_CMAC_128 cipher support

Refactor mt7615_mac_wtbl_set_key and introduce
the following routines in order to configure wtbl entries
and properly add hw support to BIP_CMAC_128 cipher:
- mt7615_mac_wtbl_update_cipher
- mt7615_mac_wtbl_update_pk
- mt7615_mac_wtbl_update_key

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 863c15a1 05-Aug-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: enable survey support

Introduce channel survey support for mt7615 driver

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 49de79ad 28-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add Smart Carrier Sense support

Introduce Smart Carrier Sense support in order to tune device
sensitivity according to RTS error rate and False CCA reported by the
radio

Tested-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7fe96541 28-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: rework locking scheme for mt7615_set_channel

As already done for mt7603 driver, move mt76.mutex lock inside
mt7615_set_channel since we need to grab mt76.mutex in mt7615_mac_work.
This is a preliminary patch to add Smart Carrier Sense (SCS) support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 49f1132c 22-Jul-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: add 4 WMM sets support

Hardware supports 4 sets of WMM that should be put to good use.
And fix incorrect queue mapping in mt7615_conf_tx().

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 27b8a900 13-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add set_key_cmd and mt76_wcid to mt7615_mac_wtbl_set_key signature

Introduce set_key_cmd and mt76_wcid pointer to mt7615_mac_wtbl_set_key
signature and do not set key to NULL if cmd is DISABLE_KEY.
This is a preliminary patch to add BIP_CMAC_128 hw support to mt7615
driver

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 45db4400 13-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: introduce mt7615_mac_wtbl_set_key routine

Add mt7615_mac_wtbl_set_key routine to configure wtbl key parameter
directly from host cpu. This is a preliminary patch to add BIP_CMAC_128
hw support. Moreover add static qualifier to mt7615_mac_get_key_info
routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 3d1e5cdd 12-Jul-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: mt7615: use params->ssn value directly

There is no point to use pointer to params->ssn.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 592ed85d 03-Jul-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt7615: move mt7615_mcu_set_rates to mac.c

It bypasses the MCU, so it does not belong in mcu.c
Also make mt7615_mac_tx_rate_val static

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4a926e30 01-Jul-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: fall back to sw encryption for unsupported ciphers

Fix following warning falling back to sw encryption for unsupported
ciphers

WARNING: CPU: 2 PID: 1495 at backports-4.19.32-1/net/mac80211/key.c:1023
mt76_wcid_key_setup+0x68/0xbc [mt76]
CPU: 2 PID: 1495 Comm: hostapd Not tainted 4.14.131 #0
Stack : 00000000 8f0f8bc0 00000000 8007ccec 805f0000 8058ec18 00000000 00000000
80559788 8dca79bc 8fefb10c 805c89c7 805545c8 00000001 8dca7960 53261662
00000000 00000000 80640000 00004668 00000000 000000e9 00000007 00000000
00000000 805d0000 00072537 00000000 80000000 00000000 805f0000 8f1e70d0
8e8fa098 000003ff 805c0000 8f0f8bc0 00000001 802d4340 00000008 80630008
[<800108d0>] show_stack+0x58/0x100
[<8049214c>] dump_stack+0x9c/0xe0
[<80033998>] __warn+0xe0/0x138
[<80033a80>] warn_slowpath_null+0x1c/0x2c
[<8e8fa098>] mt76_wcid_key_setup+0x68/0xbc [mt76]
[<8e889930>] mt7615_eeprom_init+0x7c0/0xe14 [mt7615e]

Suggested-by: Sebastian Gottschall <s.gottschall@newmedia-net.de>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5ec87dc8 28-Jun-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add csa support

Add Channel Switch Announcement support to mt7615 driver updating beacon
template with CSA IE received from mac80211

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d67a6646 28-Jun-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add hw dfs pattern detector support

Add hw radar detection support to mt7615 driver in order to
unlock dfs channels on 5GHz band

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 07d557f6 21-Jun-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: remove cfg80211_chan_def from mt7615_set_channel signature

Simplify mt7615_set_channel signature removing cfg80211_chan_def
parameter since it is not actually used

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# e991c4c2 13-Jun-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: update peer's bssid when state transition occurs

This makes sure that the driver update peer's bssid when state
transition occurs.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fe559aed 03-Jun-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: fix slow performance when enable encryption

Fix wrong WCID assignment and add RKV (RX Key of this entry is valid)
flag to check if peer uses the same configuration with previous
handshaking.

If the configuration is mismatch, WTBL indicates a “cipher mismatch”
to stop SEC decryption to prevent the packet from damage.

Suggested-by: YF Luo <yf.luo@mediatek.com>
Suggested-by: Yiwei Chung <yiwei.chung@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f4ec7fdf 03-Jun-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt7615: enable support for mesh

Enable NL80211_IFTYPE_MESH_POINT and update its path.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 892fe32b 26-May-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: rearrange locking in mt7615_config

Since all the routines in mt7615_config grub mt76.mutex moves
mutex_lock/mutex_unlock at the beginning/end of mt7615_config

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2fccf4f0 26-May-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: init get_txpower mac80211 callback

Initialize get_txpower mac80211 callback to mt76_get_txpower
in order to report the configured tx power to mac80211

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 61d36824 26-May-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt7615: add the capability to configure tx power

Introduce mt7615_mcu_set_tx_power routine in order to cap tx power
according to the value configured by the user

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b1722925 04-May-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt7615: mcu: remove unused parameter in mt7615_mcu_del_wtbl

Remove unused vif parameter in mt7615_mcu_del_wtbl signature

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 598a4434 04-May-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt7615: mcu: unify mt7615_mcu_add_wtbl_bmc and mt7615_mcu_del_wtbl_bmc

Remove duplicated code in mt7615_bss_info_changed

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# b1571a0e 03-May-2019 Dan Carpenter <dan.carpenter@oracle.com>

mt76: Fix a signedness bug in mt7615_add_interface()

The problem is that "mvif->omac_idx" is a u8 so it can't be negative
and the error handling won't work. The get_omac_idx() function returns
-1 on error.

Fixes: 04b8e65922f6 ("mt76: add mac80211 driver for MT7615 PCIe-based chipsets")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 04b8e659 01-Apr-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: add mac80211 driver for MT7615 PCIe-based chipsets

This driver is for a newer generation of MediaTek MT7615 4x4 802.11ac
PCIe-based chipsets, which support wave2 MU-MIMO up to 4 users/group
and also support up to 160MHz bandwidth.

The driver fully supports AP, station and monitor mode.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Roy Luo <royluo@google.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>