History log of /linux-master/drivers/net/wireless/mediatek/mt76/mt76x02_util.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>


# 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


# 3abd46dd 07-Dec-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: move leds struct in mt76_phy

Move leds struct in mt76_phy in order to have leds associated to phy
(e.g. in dbdc mode) instead of per device.

Tested-by: Frank Wunderlich <frank-w@public-files.de>
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>


# a00b7910 07-Dec-2022 Lorenzo Bianconi <lorenzo@kernel.org>

wifi: mt76: move leds field in leds struct

This is a preliminary patch to support per-phy leds.

Tested-by: Frank Wunderlich <frank-w@public-files.de>
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>


# 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>


# 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>


# d43de9cf 01-Dec-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move sar_capa configuration in common code

Move wiphy SAR capability configuration in mt76 module and remove
duplicated code.

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


# 633f77b5 21-Nov-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x02: introduce SAR support

Add SAR spec support to mt76x02 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>


# 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>


# 54b8fdeb 29-Apr-2021 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move mt76_rates in mt76 module

Move mt76_rates array in mt76 module and remove duplicated code since it
is shared by all drivers

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


# 4b36cc6b 07-Feb-2021 David Bauer <mail@david-bauer.net>

mt76: mt76x0: disable GTK offloading

When operating two VAP on a MT7610 with encryption (PSK2, SAE, OWE),
only the first one to be created will transmit properly encrypteded
frames.

All subsequently created VAPs will sent out frames with the payload left
unencrypted, breaking multicast traffic (ICMP6 NDP) and potentially
disclosing information to a third party.

Disable GTK offloading and encrypt these frames in software to
circumvent this issue. THis only seems to be necessary on MT7610 chips,
as MT7612 is not affected from our testing.

Signed-off-by: David Bauer <mail@david-bauer.net>
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>


# 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>


# 98df2bae 13-Nov-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move hw mac_addr in mt76_phy

This is a preliminary patch to properly support mt7915 dbdc

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


# 91990519 11-Nov-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move tx hw data queues in mt76_phy

Move hw data queues in mt76_phy from mt76_dev since mt7915 supports per
phy hw queues in dbdc mode

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


# 7af1ae62 26-Sep-2020 Felix Fietkau <nbd@nbd.name>

mt76: do not set NEEDS_UNIQUE_STA_ADDR for 7615 and 7915

The newer chipsets can deal with the same STA on multiple interfaces
Preparation for supporting more station interfaces

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>


# f099c2e5 23-Aug-2020 Felix Fietkau <nbd@nbd.name>

mt76: remove struct mt76_sw_queue

All members except for the struct mt76_queue pointer have been removed

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>


# 238f5d6f 20-May-2020 Felix Fietkau <nbd@nbd.name>

mt76: fix per-driver wcid range checks after wcid array size bump

All drivers before MT7915 have a limit of 128 WCID entries. Stop relying
on ARRAY_SIZE(dev->mt76.wcid), since it no longer reflects that limit.

Fixes: 49e649c3e0a6 ("mt76: adjust wcid size to support new 802.11ax generation")
Reported-by: kbuild test robot <lkp@intel.com>
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>


# e22d0b89 13-Feb-2020 Felix Fietkau <nbd@nbd.name>

mt76: do not set HOST_BROADCAST_PS_BUFFERING for mt7615

mt7615 handles powersave buffering in firmware

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


# fecde5da 07-Jan-2020 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76_phy_init

Move WIPHY_FLAG_HAS_CHANNEL_SWITCH in mt76-core module since now all
drivers support Channel Switch Announcement

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


# d1ff4a3c 16-Dec-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x02: simplify led reg definitions

Rely on FIELD_PREP macro for led register definitions and
remove open coding

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


# d3cc4e76 18-Dec-2019 Markus Theil <markus.theil@tu-ilmenau.de>

mt76: mt76x02: add channel switch support for usb interfaces

This patch enables channel switch support on mt76 usb interfaces.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7d288640 18-Dec-2019 Markus Theil <markus.theil@tu-ilmenau.de>

mt76: mt76x02: add check for invalid vif idx

On adding vifs the idx can become 1 + (7 & 7) = 8 for APs.
Check against that, as only AP vif idx 0-7 is possible.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


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

mt76: mt76x02: fix coverage_class type

Fix coverage_class type in mt76x02_dev data structure since
coverage_class can be negative to enable dynack (just supported by
ath9k). Set 0 as minimum value for coverage_class

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


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

mt76: move txpower and antenna mask to struct mt76_phy

Adds multiple wiphy support to mt76_get_txpower

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


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

mt76: move chainmask back to driver specific structs

Nothing in the core uses it

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>


# 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>


# 0eb8c104 31-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move interface_modes definition in mt76_core module

Move interface modes declaration in common code since now mt76
chipsets support all modes (NL80211_IFTYPE_STATION, NL80211_IFTYPE_AP,
NL80211_IFTYPE_MESH_POINT and NL80211_IFTYPE_ADHOC)

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


# 19d0affa 31-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move SUPPORTS_REORDERING_BUFFER hw property in mt76_register_device

Move SUPPORTS_REORDERING_BUFFER hw property configuration from chip
specific code to mt76_register_device since it is supported by all mt76
drivers

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


# 61c51a74 29-Oct-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: use mt76_dev in mt76_is_{mmio,usb}

Convert mt76_is_mmio and mt76_is_usb to rely on mt76_dev instead of
mt76x02_dev since this is a property not strictly related to hw chipset
and it will be more reusable

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
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>


# 355f8d00 06-Sep-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: track approximate tx airtime for airtime fairness and survey

Estimate by calculating duration for EWMA packet size + estimated A-MPDU
length on tx status events

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>


# f110d1d5 02-Aug-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: mt76x02u: enable multi-vif support

Enable multi-interface support for mt76x02u driver. For the moment
allow max two concurrent interfaces in order to preserve enough room
for ps traffic since we are using beacon slots for it.
I have successfully tested the following configuration:
- AP + STA
- AP0 + AP1

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Tested-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 0e3d6777 24-Jul-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: switch to SPDX tag instead of verbose boilerplate text

No functional change intended.

Add SPDX identifiers to all remaining files in /mt76.

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


# ff97c52a 24-Jul-2019 Ryder Lee <ryder.lee@mediatek.com>

mt76: mt76x02: fix some checkpatch warnings

This fixes the following checkpatch warnings:

ERROR: code indent should use tabs where possible
CHECK: Alignment should match open parenthesis
CHECK: No space is necessary after a cast
CHECK: Please don't use multiple blank lines
CHECK: Avoid precedence issues in macro
WARNING: Statements should start on a tabstop
WARNING: Unnecessary space before function pointer arguments

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


# 5eedd2a5 12-Jul-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: mt76x02: 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>


# ae66068f 30-Apr-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: do not enable/disable pre_tbtt_tasklet in scan_start/scan_complete

Do not enable/disable pre_tbtt_tasklet tasklet in
mt76x02_sw_scan/mt76x02_sw_scan_complete since it is already done
setting the operating channel. Do run tbtt_tasklet while the device is
offchannel

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


# dc6057f4 30-Apr-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move pre_tbtt_tasklet in mt76_dev

Move pre_tbtt_tasklet tasklet in mt76_dev data structure since
it is used by all drivers

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


# 3041c445 29-Apr-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move beacon_int in mt76_dev

Move beacon_int in mt76_dev data structure since it is used by
all drivers

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


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

mt76: use macro for sn and seq_ctrl conversion

Use macro to convert sn and seq_ctrl for better readability.

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


# 37426fb6 18-Mar-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move mac_work in mt76_dev

Move mac_work delayed work in mt76_dev data structure since
it is used by all drivers and it will be reused adding mac work to
mt7615

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


# db9f11d3 13-Mar-2019 Felix Fietkau <nbd@nbd.name>

mt76: store wcid tx rate info in one u32 reduce locking

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


# 02d49a2e 19-Mar-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: enable AP mode for USB

Enable AP mode. For now without multi-vif support, this will require
more testing and investigation.

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


# b98558e2 19-Mar-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: disable HW encryption for group frames

This is required to sent multicast/broadcast frames in USB AP
mode just after beacon.

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


# 2baed5db 19-Mar-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02u: add sta_ps

Add sta_ps callback but dont set WCID drop sicne registers for USB
can not be accessed from tasklet context.

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


# 8d71aef9 19-Mar-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: introduce mt76x02_beacon.c

Move most of beaconing code into separate file and separate beacon
initialization for USB and MMIO as pre TBTT implementation for USB
will be different.

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


# 3bb45b5f 14-Mar-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: move mt76x02_insert_hdr_pad in mt76-core module

Move mt76x02_insert_hdr_pad in m76-core and rename it in
mt76_insert_hdr_pad in order to be used in mt76_dma_tx_queue_skb.
This is a preliminary patch in order to properly support tx dma
mapping for new chipsets (e.g. mt7615)

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


# af005f26 02-Mar-2019 Lorenzo Bianconi <lorenzo@kernel.org>

mt76: introduce mt76_sw_queue data structure

Introduce mt76_sw_queue data structure in order to support new
chipsets (e.g. mt7615) that have a shared hardware queue for all traffic
identifiers. mt76_sw_queue will be used to track outstanding packets

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


# 3fd0824a 01-Mar-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: only update the base mac address if necessary

Also update the mask first before calculating the vif index.
Fixes an issue where adding back the same interfaces in a different order
fails because of duplicate vif index use

Fixes: 06662264ce2ad ("mt76x02: use mask for vifs")
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 00496042 27-Feb-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x2: implement full device restart on watchdog reset

Restart the firmware and re-initialize the MAC to be able to recover
from more kinds of hang states

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


# 90f42f2d 24-Feb-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: only reset beacon drift counter when enabling beacons

When the timer is already running, there is no need to reset the counter,
because the drift will remain the same.

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


# ed55c9b9 24-Feb-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: fix beacon timer issue

When mt76x0 and mt76x2 beacon code was unified, it changed the order in which
beacon enable and beacon interval are configured.
Configuring beacon enable before beacon interval can in some cases cause
problems with the beacon timer, leading to clients not waking up properly
from powersave mode.
Fix this by changing the order back to interval first, then enable.

Fixes: cc726268e4dce ("mt76: move mt76x02_bss_info_changed in mt76x02-lib module")
Cc: stable@vger.kernel.org
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a6982fcd 23-Feb-2019 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: fix TSF sync mode

MT_BEACON_TIME_CFG_SYNC_MODE needs to be set for AP mode, according to the
documentation. For other modes it should be irrelevant in this case.

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


# f2f6a47b 25-Jan-2019 Felix Fietkau <nbd@nbd.name>

mt76: fix resetting software IV flag on key delete

It needs to be unset instead of set

Fixes: 23405236460b9 ("mt76: fix transmission of encrypted management frames")
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2bd7f3d2 30-Jan-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: enable support for IBSS and MESH

Since we implement beconing on USB now, similar interfaces should be
supported for USB as are for MMIO. Tested only on IBSS mode and
AP mode (not enabled due to lack of PS buffering).

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


# dbb2b22b 30-Jan-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: beaconing fixes for USB

Configure beaconing on USB devices without PS buffering support.

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


# 39834c12 30-Jan-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: minor beaconing init changes

Disable BEACON timer during init and configure interrupt registers
only for mmio devices.

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


# 0b2d27e5 30-Jan-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: initialize mutli bss mode when set up address

BSSID is not strtirct related with beaconing (for example we can have
2 STA vifs) and more related with MAC address, so initaize BSSID when
setting MAC address.

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


# f9a043c5 30-Jan-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: use commmon add interface for mt76x2u

Since we now support mt76x2u feature to allow set mac address
when creating interface in common code we can use it for
mt76x2u.

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


# 06662264 30-Jan-2019 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: use mask for vifs

Use vif_mask to count interfaces to allow to set mac address in HW
if there is only one interface and report error if we create
interface with wrong BSSID resulting in already used index.

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


# e7173858 15-Jan-2019 Felix Fietkau <nbd@nbd.name>

mt76: add channel switch announcement support

Use the appropriate mac80211 callbacks after beacon transmission

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


# ef13edc0 05-Dec-2018 Felix Fietkau <nbd@nbd.name>

mt76: move mt76x02_phy_get_min_avg_rssi to mt76 core

This will be used by mt7603 as well

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


# 9313faac 06-Dec-2018 Felix Fietkau <nbd@nbd.name>

mt76: move mt76x02_get_txpower to mt76 core

It will be reused by mt7603 later

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


# 5c9decdf 10-Jan-2019 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: add led support to mt76x0e driver

Move mt76x02 led support in mt76x02-lib module in order to
add tpt led trigger to mt76x0e driver

Tested-by: LGA1150 <dqfext@gmail.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c1e0d2be 28-Dec-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: mmio: introduce mt76x02_check_tx_hang watchdog

Port mt76x02_check_tx_hang watchdog from vendor driver in order to
perform a device reset when tx mac/dma logic hangs. Tx mac/dma stuck
has been observed when the device is heavy loaded or in a noisy
environment. Moreover introduce wdt delayed work in order to run
tx_hang watchdog. For the moment run mt76x02_check_tx_hang watchdog
just on mt76x2 devices since the issue has not been observed on mt76x0
driver yet

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 26a7b547 10-Dec-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: set protection according to ht operation element

Configure protection based on information that are provided to
us either by remote AP or by hostapd via HT operation IE.

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


# 20ce270e 10-Dec-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: do not set protection on set_rts_threshold callback

Use set_rts_threshold calback to enable/disable threshold only for
legacy traffic.

Protection for HT and VHT traffic is defined by HT operation element
and it's provided by remote AP or by hostapd.

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


# e28487ea 16-Nov-2018 Felix Fietkau <nbd@nbd.name>

mt76: replace sta_add/remove ops with common sta_state function

Allows adding unassociated stations from mac80211

Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>


# 54f1bf8a 15-Nov-2018 Felix Fietkau <nbd@nbd.name>

mt76: mt76x02: remove mt76x02_txq_init

Open-coding it simplifies the code

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


# 723b90dc 13-Nov-2018 Felix Fietkau <nbd@nbd.name>

mt76: add mt76_sta_remove helper

This allows station removal code to be used by mt7603 later

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


# c2a1a5e1 13-Nov-2018 Felix Fietkau <nbd@nbd.name>

mt76: fix race condition in station removal

If there are still pending packets in the tx queue when removing a station,
it could possibly lead to a call to further attempts to pull packets from
the mac80211 tx queue after it has already been removed from the scheduling
list.
Prevent this from happening by calling synchronize_rcu after deleting the
wcid pointer before further cleaning up the tx queues.
To be extra careful, ensure that mtxq->list is always initialized properly.

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


# 79d1c94c 05-Nov-2018 Felix Fietkau <nbd@nbd.name>

mt76: avoid queue/status spinlocks while passing tx status to mac80211

There is some code in the mac80211 tx status processing code that could
potentially call back into the tx codepath.
To avoid deadlocks, make sure that no tx related spinlocks are taken
during the ieee80211_tx_status call.

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


# 8f2fbff5 06-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: pci: enable VHT rates in IBSS mode

Enable VHT tx rates in ad-hoc mode for mt76x0e driver.

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 269906ac 06-Nov-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: introduce mt76x02_config_mac_addr_list routine

Add mt76x02_config_mac_addr_list routine in order to set
the mac address list supported by the driver. Initialize
wiphy->addresses/n_addresses for mt76x0e driver

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 4784a3cc 01-Nov-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: assure we update gain after scan

Assure that after we initialize dev->cal.low_gain to -1 this
will cause update gain calibration. Otherwise this might or
might not happen depending on value of second bit of low_gain
and values read from registers in mt76x02_phy_adjust_vga_gain().

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


# f1b8ee35 01-Nov-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76x02: run calibration after scanning

If we are associated and scanning is performed, sw_scan_complete callback
is done after we get back to operating channel, so we do not perform
queue cal work. Fix this queue cal work from sw_scan_complete().

On mt76x0 we have to restore gain in MT_BBP(AGC, 8) register after
scanning, as it was multiple times modified by channel switch code.
So queue cal work without any delay to set AGC gain value.

Similar like in mt76x2 init AGC gain only when set operating channel
and just check before queuing cal work in sw_scan_complete() if
initialization was already done.

Fixes: bbd10586f0df ("mt76x0: phy: do not run calibration during channel switch")
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 88046b2c 25-Oct-2018 Felix Fietkau <nbd@nbd.name>

mt76: add support for reporting tx status with skb

MT76x2/MT76x0 has somewhat unreliable tx status reporting, and for that
reason the driver currently does not report per-skb tx ack status at all.
This breaks things like client idle polling, which relies on the tx ack
status of a transmitted nullfunc frame.

This patch adds code to report skb-attached tx status if requested by
mac80211 or the rate control module. Since tx status is polled from a
simple FIFO register, the code needs to account for the possibility of
tx status events getting lost.

The code keeps a list of skbs for which tx status is required and passes
them to mac80211 once tx status has been filled in and the DMA queue is
done with it.
If a tx status event is not received after one second, the status rates
are cleared, and a succesful ACK is indicated to avoid spurious disassoc
during assoc or client polling.

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


# 1a4846fc 24-Oct-2018 Felix Fietkau <nbd@nbd.name>

mt76: clean up more unused EXPORT_SYMBOLs

Make functions static where possible

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


# 801ccc8a 22-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x0: pci: add DFS support

Introduce dfs support in mt76x0e driver and unlock radar channels

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# cc726268 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_bss_info_changed in mt76x02-lib module

Unify drv_bss_info_changed mac80211 callback and remove duplicated
code in mt76x0 and mt76x2 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 317ed42b 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move tx protection routines in mt76x02-lib module

Move mt76x02_set_rts_threshold and mt76x02_mac_set_tx_protection
routines in mt76x02-lib module and remove duplicated code in mt76x0
and mt76x2 drivers. Remove pci_mac.c and mt76x0/mac.c since now are
empty files

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 36704051 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_set_tx_ackto in mt76x02-lib module

Move mt76x02_set_tx_ackto and mt76x02_set_coverage_class routines
in mt76x02-lib module in order to be reused by mt76x0 driver.
This is a preliminary patch to unify drv_bss_info_changed mac80211
callback between mt76x0 and mt76x2 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# fc245983 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: introduce mt76x02_init_beacon_config routine

Add mt76x02_init_beacon_config utility routine in mt76x02-lib
module in order to be reused by mt76x0 driver configuring
BSSID registers and remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# f7c8a0f2 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_sta_ps in mt76x02-lib module

Move mt76x02_sta_ps utility routine in mt76x02_util.c
in order to be reused by mt76x0 driver adding AP support

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 1da0a411 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_get_txpower in mt76x02_util.c

Move mt76x02_get_txpower utility routine in mt76x02-lib module
in order to be reused by mt76x0 and mt76x2u drivers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c2756a1c 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_sw_scan and mt76x02_sw_scan_complete in mt76x02-lib module

Move mt76x02_sw_scan and mt76x02_sw_scan_complete utility routines
in mt76x02_util.c in order to be reused by mt76x0 and mt76x2u drivers
and remove duplicated code

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 5cbace02 19-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_init_device in mt76x02-lib module

Move mt76x02_init_device routine in mt76x02_util.c in order to be
reused by mt76x0 driver and remove duplicated code. Move interface
combo definition supported by the driver in mt76x02_init_device routine

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 91be8e8a 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: use mt76x02_dev instead of mt76_dev in mt76x02_txrx.c

Use mt76x02_dev data structure as reference in mt76x02_txrx.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 8d66af49 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: use mt76x02_dev instead of mt76_dev in mt76x02_mac.c

Use mt76x02_dev data structure as reference in mt76x02_mac.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d87cf75f 07-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: use mt76x02_dev instead of mt76_dev in mt76x02_util.c

Use mt76x02_dev data structure as reference in mt76x02_util.c
instead of mt76_dev

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 7a07adcd 05-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: rename mt76x02_util.h in mt76x02.h

Rename mt76x02_util.h header file in mt76x02.h since now contains
all mt76x02 related definitions and not just utility routines
declarations

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 8e3ed001 05-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move txrx shared routines in mt76x02_txrx.c

Add mt76x02_txrx.c source file in order to contain tx/rx shared
routines for mt76x0 and mt76x2 drivers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 2f0308d0 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_tx in mt76x02-lib module

Move mt76x02_tx shared routine in mt76x02-lib module and remove
duplicated code. Moreover remove mt76x0/tx.c since it is an empty
file

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 9ba1e0e6 04-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: unify rxwi parsing between mt76x2 and mt76x0 drivers

Unify rxwi parsing between mt76x2 and mt76x0. Remove the following
routines:
- mt76x0_phy_get_rssi
- mt76x0_queue_rx_skb
- mt76x0_mac_process_rx
Moreover remove mt76x2/common.c and mt76x0/mac.h since are empty files
Enable CCMP PN sw validation

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# d697b00b 01-Oct-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_tx_get_max_txpwr_adj in mt76x02_util.c

Move mt76x02_tx_get_max_txpwr_adj routine in mt76x02-lib module
since now both mt76x0 and mt76x2 drivers read rate tx power gain from
rate_power data structure. Moreover remove get_max_txpwr_adj function
pointer from mt76_driver_ops data structure

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# a6daf796 28-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x02_beacon_offset in mt76x02_util.c

Move mt76x02_beacon_offset utility routine in mt76x02-lib module
since it is shared between mt76x0 and mt76x2 driver and remove
duplicated code. Moreover move beacon_offset data structure in
mt76x02-lib module since it is shared between mt76x0 and mt76x2
drivers

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# db6bb5c6 24-Sep-2018 Felix Fietkau <nbd@nbd.name>

mt76: include linux/module.h in files using MODULE_*

Fix source files using MODULE_* macros without including linux/module.h

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


# 6d6631fd 09-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x02: add static qualifier to mt76x02_remove_dma_hdr

Add static qualifier to mt76x02_remove_dma_hdr routine and
do not export the symbol since it is only used in mt76x02_util.c

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 6181bf2a 09-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76x02: move TXD/RXD/MCU definitions in mt76x02_dma.h

Introduce mt76x02_dma.h header file to contain mt76x02 dma
related definitions

Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# c2db13ac 09-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: usb: move mt76u_skb_dma_info in mt76x02_usb_core.c

Move mt76u_skb_dma_info routine in mt76x02-usb module and rename it in
mt76x02u_skb_dma_info. Moreover move mt76x02u_set_txinfo in
mt76x02_usb_core.c. This is a preliminary patch to move MT_TXD_INFO,
MT_MCU_MSG and MT_RX_FCE_INFO defs in mt76x02-lib module since other
chipsets (e.g. mt7603) use different dma definitions

Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>


# 58b5eb8c 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76 rate definitions in mt76x02-lib module

Move mt76x2_rate definition in mt76x02-lib module and rename it in
mt76x02_rates in order to be reused in mt76x0 driver.
Moreover remove unused mt76_rate definition

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


# 8f6c23a9 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x2u_tx_status_data in mt76x02-lib module

Move mt76x2u_tx_status_data routine in mt76x02-lib module and rename it
in mt76x02_tx_status_data in order to be reused in mt76x0 driver

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


# 41868f98 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x2u_set_txinfo in mt76x02-lib module

Move mt76x2u_set_txinfo routine in mt76x02-lib module and rename it in
mt76x02_set_txinfo in order to be reused in mt76x0 driver

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


# f847e45a 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x2u_tx_complete_skb in mt76x02-lib moudule

Move mt76x2u_tx_complete_skb routine in mt76x02-lib module
and rename it in mt76x02_tx_complete_skb in order to be reused
in mt76x0 driver

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


# b38b8207 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x2u_remove_dma_hdr in mt76x02-lib module

Move mt76x2u_remove_dma_hdr in mt76x02-lib module and rename it in
mt76x02_remove_dma_hdr. Moreover use mt76x02_remove_hdr_pad routine
in mt76x02_remove_dma_hdr function.
Furthermore remove mt76x0_tx_skb_remove_dma_overhead routine

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


# 2a45ad31 06-Sep-2018 Lorenzo Bianconi <lorenzo.bianconi@redhat.com>

mt76: move mt76x2_tx_complete routine in mt76x02-lib module

Move mt76x2_tx_complete routine in mt76x02-lib module and rename it in
mt76x02_tx_complete in order to be used in mt76x0 driver

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


# 0e59cba8 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify {insert/remove}_hdr_pad

Merge insert/remove _hdr_pad from mt76x0 and mt76x2.

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


# 5327b5ea 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify sta_rate_tbl_update and related helpers

Use common sta_rate_tbl_update on mt76x0 and mt76x2.
mt76x0 do not have support TPC (transmision power control) implmented,
msta->wcid.max_txpwr_adj is only set for mt76x2.

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


# 212926eb 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify add_interface

Make common add_interface for mt76x0 and mt76x2e. This change behavior
for mt76x0, but it should work with the new implementation.

mt76x2u has different implementation. Maybe it can use common one,
but for now leave it as is.

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


# 0cd47bae 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify remove_interface

Use common remove_interface callback in mt76x0 and mt76x2.

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


# 10337263 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify conf_tx

Use one conf_tx implementation in mt76x0 and mt76x2. Note this change
conf_tx for mt76x0, but it should work with mt76x2 version.

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


# 60c26859 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify set_key

Merge mt76x0 and mt76x2 set_key mac80211 callback.

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


# 22c575c4 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify ampdu_action

Use mt76x2_ampdu_action as common function, mt76x0 ampdu_action was
diffrent, but mt76x2 version should work for this driver as well.

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


# cab12953 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: pratially unify add_interface

Create common mt76x02_vif_init function and use int on drivers
add_interface callback.

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


# 624400e4 04-Sep-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: unify sta_add / sta_remove

Merge mt76x0 and mt76x0 sta add/remove callback. We drop
mt76x0_mac_set_ampdu_factor() for now. Need to consider to add
it to common code, but mt76x2 don't do it so perhaps mt76x0 don't
need it as well.

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


# 108a4861 29-Aug-2018 Stanislaw Gruszka <sgruszka@redhat.com>

mt76: create new mt76x02-lib module for common mt76x{0,2} code

Move rxfilter and mutex to common structure. Create mt76x02-lib.ko
for mt76x0 and mt76x2 common functions and create new unified
mt76x02_configure_filter() function there.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>