platform/kernel/linux-rpi.git
3 years agomt76: dma: rely on mt76_queue in mt76_dma_tx_cleanup signature
Lorenzo Bianconi [Wed, 11 Nov 2020 13:47:27 +0000 (14:47 +0100)]
mt76: dma: rely on mt76_queue in mt76_dma_tx_cleanup signature

This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: rely on mt76_queue in mt7663s_tx_run_queue signature
Lorenzo Bianconi [Wed, 11 Nov 2020 13:47:26 +0000 (14:47 +0100)]
mt76: mt7663s: rely on mt76_queue in mt7663s_tx_run_queue signature

This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc for mt7915

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: sdio: rely on mt76_queue in mt76s_process_tx_queue signature
Lorenzo Bianconi [Wed, 11 Nov 2020 13:47:25 +0000 (14:47 +0100)]
mt76: sdio: rely on mt76_queue in mt76s_process_tx_queue signature

This is a preliminary patch to move data queues in mt76_phy and properly
support dbdc for mt7915

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: sdio: introduce mt76s_alloc_tx_queue
Lorenzo Bianconi [Wed, 11 Nov 2020 13:47:24 +0000 (14:47 +0100)]
mt76: sdio: introduce mt76s_alloc_tx_queue

This is a preliminary patch to move hw data queues in mt76_phy for
mt7915 dbdc support

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move mt76_init_tx_queue in common code
Lorenzo Bianconi [Wed, 11 Nov 2020 13:47:23 +0000 (14:47 +0100)]
mt76: move mt76_init_tx_queue in common code

Move mt76_init_tx_queue in mac80211.c since it is shared by all
drivers.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: rely on eeprom definitions
Lorenzo Bianconi [Tue, 10 Nov 2020 11:17:37 +0000 (12:17 +0100)]
mt76: mt7915: rely on eeprom definitions

In order to make the code more readable, rely on mt7915_eeprom_field
definitions for eeprom parsing

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: refactor usb/sdio rate code
Lorenzo Bianconi [Sun, 8 Nov 2020 10:27:45 +0000 (11:27 +0100)]
mt76: mt7615: refactor usb/sdio rate code

Since wtbl workqueue is used only for rate handling, refactor code to
make it more clear

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: support 16 interfaces
Ryder Lee [Thu, 29 Oct 2020 17:11:17 +0000 (01:11 +0800)]
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>
3 years agomt76: mt7915: remove unused mt7915_mcu_bss_sync_tlv()
Ryder Lee [Thu, 29 Oct 2020 17:11:16 +0000 (01:11 +0800)]
mt76: mt7915: remove unused mt7915_mcu_bss_sync_tlv()

mt7915_mcu_bss_sync_tlv() is no longer used, so remove it.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: use BIT_ULL for omac_idx
Ryder Lee [Thu, 29 Oct 2020 17:11:15 +0000 (01:11 +0800)]
mt76: mt7915: use BIT_ULL for omac_idx

The omac_idx variable is u64 so we should use the 64-bit BIT_ULL().

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: make mt7915_eeprom_read static
Lorenzo Bianconi [Sun, 25 Oct 2020 10:56:16 +0000 (11:56 +0100)]
mt76: mt7915: make mt7915_eeprom_read static

Make mt7915_eeprom_read routine static since it is used only in eeprom.c

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add support to set tx frequency offset in testmode
Shayne Chen [Thu, 22 Oct 2020 02:28:20 +0000 (10:28 +0800)]
mt76: mt7915: add support to set tx frequency offset in testmode

Support to set tx frequency offset in testmode, which is usally used in
the pre-calibration stage.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add support to set txpower in testmode
Shayne Chen [Thu, 22 Oct 2020 02:28:19 +0000 (10:28 +0800)]
mt76: mt7915: add support to set txpower in testmode

Support tx_power setting in testmode. Note that the tx power value of
antenna 1-3 equal to antenna 0.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: implement testmode rx support
Shayne Chen [Thu, 22 Oct 2020 02:28:18 +0000 (10:28 +0800)]
mt76: mt7915: implement testmode rx support

Support testmode rx and display rx statistic by parsing RXV packet
type, which is currently only enabled in testmode.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: implement testmode tx support
Shayne Chen [Thu, 22 Oct 2020 02:28:17 +0000 (10:28 +0800)]
mt76: mt7915: implement testmode tx support

Support testmode tx for MT7915A, including tx streams and HE rate
settings.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: add support for HE rate modes
Shayne Chen [Thu, 22 Oct 2020 02:28:16 +0000 (10:28 +0800)]
mt76: testmode: add support for HE rate modes

Extend enum mt76_testmode_tx_mode to support various HE rate modes.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix tx rate related fields in tx descriptor
Shayne Chen [Thu, 22 Oct 2020 02:28:15 +0000 (10:28 +0800)]
mt76: mt7915: fix tx rate related fields in tx descriptor

Correct the bitfields of tx rateval and bw in tx descriptor.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: add support for LTF and GI combinations for HE mode
Shayne Chen [Thu, 22 Oct 2020 02:28:14 +0000 (10:28 +0800)]
mt76: testmode: add support for LTF and GI combinations for HE mode

Prepare for setting different LTF (1x, 2x, and 4x) and GI (0.8us,
1.6us, 3.2us) combinations in HE rate mode.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: add tx_rate_stbc parameter
Shayne Chen [Thu, 22 Oct 2020 02:28:13 +0000 (10:28 +0800)]
mt76: testmode: add tx_rate_stbc parameter

Add the parameter to control STBC function in testmode.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: add snr attribute in rx statistics
Shayne Chen [Thu, 22 Oct 2020 02:28:12 +0000 (10:28 +0800)]
mt76: testmode: add snr attribute in rx statistics

Support to display snr value when dumping rx statistics.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: testmode: switch ib and wb rssi to array type for per-antenna report
Shayne Chen [Thu, 22 Oct 2020 02:28:11 +0000 (10:28 +0800)]
mt76: testmode: switch ib and wb rssi to array type for per-antenna report

Change ib_rssi and wb_rssi into array type, since they could be reported
by per-antenna.

Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76u: use dedicated thread for status work
Lorenzo Bianconi [Tue, 20 Oct 2020 09:13:11 +0000 (11:13 +0200)]
mt76: mt76u: use dedicated thread for status work

Split tx and status path in mt76-usb module relying on mt76 workers APIs

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt76u: rely on woker APIs for rx work
Lorenzo Bianconi [Tue, 20 Oct 2020 09:13:10 +0000 (11:13 +0200)]
mt76: mt76u: rely on woker APIs for rx work

In order to improve parallelism, convert rx path in mt76-usb module to
mt76 workers APIs

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: run key configuration in mt7615_set_key for usb/sdio devices
Lorenzo Bianconi [Tue, 20 Oct 2020 08:03:17 +0000 (10:03 +0200)]
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>
3 years agomt76: fix tkip configuration for mt7615/7663 devices
Lorenzo Bianconi [Sat, 17 Oct 2020 15:15:25 +0000 (17:15 +0200)]
mt76: fix tkip configuration for mt7615/7663 devices

Fix Tx-Rx MIC overwrite during TKIP hw key configuration

Fixes: 01cfc1b45421 ("mt76: mt7615: add BIP_CMAC_128 cipher support")
Tested-by: YN Chen <yn.chen@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: switch to wep sw crypto for mt7615/mt7915
Lorenzo Bianconi [Sat, 17 Oct 2020 09:43:35 +0000 (11:43 +0200)]
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>
3 years agomt76: mt7663s: introduce WoW support via GPIO
Sean Wang [Fri, 16 Oct 2020 00:26:42 +0000 (08:26 +0800)]
mt76: mt7663s: introduce WoW support via GPIO

SDIO-based WiFi would rely on an additional GPIO pin to wake up the host.

Co-developed-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: YN Chen <YN.Chen@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move mt76_mcu_send_firmware in common module
Lorenzo Bianconi [Wed, 14 Oct 2020 10:03:58 +0000 (12:03 +0200)]
mt76: move mt76_mcu_send_firmware in common module

Move mt76_mcu_send_firmware routine in common code since it is actually
shared between mt7615, mt7663, mt7603 and mt7915 devices

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7603: add additional EEPROM chip ID
David Bauer [Tue, 13 Oct 2020 14:23:26 +0000 (16:23 +0200)]
mt76: mt7603: add additional EEPROM chip ID

Some newer MT7628 based routers (notably the TP-Link Archer C50 v4) are
shipped with a chip-id of 0x7600 in the on-flash EEPROM. Add this as a
possible valid ID.

Ref: https://bugs.openwrt.org/index.php?do=details&task_id=2781

Suggested-by: Ron Asimi <ron.asimi@gmail.com>
Signed-off-by: David Bauer <mail@david-bauer.net>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: fix memory leak if device probing fails
Lorenzo Bianconi [Tue, 13 Oct 2020 08:33:49 +0000 (10:33 +0200)]
mt76: fix memory leak if device probing fails

Run mt76_free_device instead of ieee80211_free_hw if device probing
fails in order to remove the already allocated mt76 workqueue

Fixes: a86f1d01f5ce5 ("mt76: move mt76 workqueue in common code")
Fixes: f1d962369d568 ("mt76: mt7915: implement HE per-rate tx power support")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix sparse warning cast from restricted __le16
Ryder Lee [Mon, 12 Oct 2020 16:21:21 +0000 (00:21 +0800)]
mt76: mt7915: fix sparse warning cast from restricted __le16

drivers/net/wireless/mediatek/mt76/mt7915/init.c:339:26: sparse:
sparse: cast from restricted __le16

Fixes: 00b2e16e0063 ("mt76: mt7915: add TxBF capabilities")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: dma: fix possible deadlock running mt76_dma_cleanup
Lorenzo Bianconi [Sun, 11 Oct 2020 22:43:55 +0000 (00:43 +0200)]
mt76: dma: fix possible deadlock running mt76_dma_cleanup

Fix the following possible deadlock reported by lockdep disabling BH
running mt76_free_pending_txwi()

================================
WARNING: inconsistent lock state
5.9.0-rc6 #14 Not tainted
--------------------------------
inconsistent {IN-SOFTIRQ-W} -> {SOFTIRQ-ON-W} usage.
rmmod/1227 [HC0[0]:SC0[0]:HE1:SE1] takes:
ffff888156a83530 (&dev->lock#2){+.?.}-{2:2}, at: mt76_dma_cleanup+0x125/0x150 [mt76]
{IN-SOFTIRQ-W} state was registered at:
  __lock_acquire+0x20c/0x6b0
  lock_acquire+0x9d/0x220
  _raw_spin_lock+0x2c/0x70
  mt76_dma_tx_cleanup+0xc7/0x200 [mt76]
  mt76x02_poll_tx+0x31/0xb0 [mt76x02_lib]
  napi_poll+0x3a/0x100
  net_rx_action+0xa8/0x200
  __do_softirq+0xc4/0x430
  asm_call_on_stack+0xf/0x20
  do_softirq_own_stack+0x49/0x60
  irq_exit_rcu+0x9a/0xd0
  common_interrupt+0xa4/0x190
  asm_common_interrupt+0x1e/0x40
irq event stamp: 9915
hardirqs last  enabled at (9915): [<ffffffff8124e286>] __free_pages_ok+0x336/0x3b0
hardirqs last disabled at (9914): [<ffffffff8124e24e>] __free_pages_ok+0x2fe/0x3b0
softirqs last  enabled at (9912): [<ffffffffa03aa672>] mt76_dma_rx_cleanup+0xa2/0x120 [mt76]
softirqs last disabled at (9846): [<ffffffffa03aa5ea>] mt76_dma_rx_cleanup+0x1a/0x120 [mt76]

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(&dev->lock#2);
  <Interrupt>
    lock(&dev->lock#2);

 *** DEADLOCK ***

1 lock held by rmmod/1227:
 #0: ffff88815b5eb240 (&dev->mutex){....}-{3:3}, at: driver_detach+0xb5/0x110

stack backtrace:
CPU: 1 PID: 1227 Comm: rmmod Kdump: loaded Not tainted 5.9.0-rc6-wdn-src+ #14
Hardware name: Dell Inc. Studio XPS 1340/0K183D, BIOS A11 09/08/2009
Call Trace:
 dump_stack+0x77/0xa0
 mark_lock_irq.cold+0x15/0x39
 mark_lock+0x1fc/0x500
 mark_usage+0xc7/0x140
 __lock_acquire+0x20c/0x6b0
 ? find_held_lock+0x2b/0x80
 ? sched_clock_cpu+0xc/0xb0
 lock_acquire+0x9d/0x220
 ? mt76_dma_cleanup+0x125/0x150 [mt76]
 _raw_spin_lock+0x2c/0x70
 ? mt76_dma_cleanup+0x125/0x150 [mt76]
 mt76_dma_cleanup+0x125/0x150 [mt76]
 mt76x2_cleanup+0x5a/0x70 [mt76x2e]
 mt76x2e_remove+0x18/0x30 [mt76x2e]
 pci_device_remove+0x36/0xa0
 __device_release_driver+0x16c/0x220
 driver_detach+0xcf/0x110
 bus_remove_driver+0x56/0xca
 pci_unregister_driver+0x36/0x80
 __do_sys_delete_module.constprop.0+0x127/0x200
 ? syscall_enter_from_user_mode+0x1d/0x50
 ? trace_hardirqs_on+0x1c/0xe0
 do_syscall_64+0x33/0x80
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x7ff0da54e36b
Code: 73 01 c3 48 8b 0d 2d 0b 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d fd 0a 0c 00 f7 d8 64 89 01 48

Fixes: dd57a95cfddc ("mt76: move txwi handling code to dma.c, since it is mmio specific")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: set fops_tx_stats.owner to THIS_MODULE
Taehee Yoo [Thu, 8 Oct 2020 15:51:56 +0000 (15:51 +0000)]
mt76: set fops_tx_stats.owner to THIS_MODULE

If THIS_MODULE is not set, the module would be removed while debugfs is
being used.
It eventually makes kernel panic.

Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: rename mt7915_mcu_get_rate_info to mt7915_mcu_get_tx_rate
Ryder Lee [Thu, 8 Oct 2020 16:57:36 +0000 (00:57 +0800)]
mt76: mt7915: rename mt7915_mcu_get_rate_info to mt7915_mcu_get_tx_rate

Avoid confusion with rx rate query function.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: update ppe threshold
Ryder Lee [Thu, 8 Oct 2020 16:57:35 +0000 (00:57 +0800)]
mt76: mt7915: update ppe threshold

Update ppe_thresh capability to sync SDK setting.

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>
3 years agomt76: mt7915: set fops_sta_stats.owner to THIS_MODULE
Taehee Yoo [Thu, 8 Oct 2020 15:51:57 +0000 (15:51 +0000)]
mt76: mt7915: set fops_sta_stats.owner to THIS_MODULE

If THIS_MODULE is not set, the module would be removed while debugfs is
being used.
It eventually makes kernel panic.

Fixes: ec9742a8f38e ("mt76: mt7915: add .sta_add_debugfs support")
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agowireless: mt76: convert tasklets to use new tasklet_setup() API
Allen Pais [Wed, 7 Oct 2020 10:33:07 +0000 (16:03 +0530)]
wireless: mt76: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.

Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <apais@linux.microsoft.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: sdio: get rid of sched.lock
Lorenzo Bianconi [Tue, 6 Oct 2020 12:00:01 +0000 (14:00 +0200)]
mt76: sdio: get rid of sched.lock

sched quota is now updated in mt7663s_txrx_worker so there is no more
need of sched.lock mutex

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: fix a possible ple quota underflow
Lorenzo Bianconi [Mon, 5 Oct 2020 15:22:23 +0000 (17:22 +0200)]
mt76: mt7663s: fix a possible ple quota underflow

Properly account current consumed ple quota in mt7663s_tx_pick_quota
routine and avoid possible underflow.

Fixes: 6ef2d665f64d ("mt76: mt7663s: split mt7663s_tx_update_sched in mt7663s_tx_{pick,update}_quota")
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: get rid of mt7663s_sta_add
Lorenzo Bianconi [Mon, 5 Oct 2020 11:36:31 +0000 (13:36 +0200)]
mt76: mt7663s: get rid of mt7663s_sta_add

Get rid of mt7663s_sta_add routine and rely on mt7615_mac_sta_add
since sched quota is already initialized in mt7663s_mcu_init_sched
routine

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: introduce quota debugfs node for mt7663s
Lorenzo Bianconi [Mon, 5 Oct 2020 08:18:33 +0000 (10:18 +0200)]
mt76: mt7615: introduce quota debugfs node for mt7663s

Add sched_quota debugfs node for mt7663s. Scheduling quota stats
are useful for debugging

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: enable beacon filtering by default for offload fw
Lorenzo Bianconi [Wed, 30 Sep 2020 08:57:15 +0000 (10:57 +0200)]
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>
3 years agomt76: add back the SUPPORTS_REORDERING_BUFFER flag
Felix Fietkau [Sat, 10 Oct 2020 13:20:18 +0000 (15:20 +0200)]
mt76: add back the SUPPORTS_REORDERING_BUFFER flag

It was accidentally dropped while adding multiple wiphy support
Fixes fast-rx support and avoids handling reordering in both mac80211
and the driver

Cc: stable@vger.kernel.org
Fixes: c89d36254155 ("mt76: add function for allocating an extra wiphy")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: query station rx rate from firmware
Felix Fietkau [Wed, 30 Sep 2020 09:39:04 +0000 (11:39 +0200)]
mt76: mt7915: query station rx rate from firmware

When per-packet rate reporting is enabled, the hardware can get stuck under
some conditions. It self-recovers quickly, but in practice this leads to
reduced performance.
In order to avoid running into this issue, disable per-packet rate reporting
by default and query the rx rate from firmware instead, unless monitor mode
is enabled.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: move eeprom parsing out of mt7915_mcu_parse_response
Felix Fietkau [Wed, 30 Sep 2020 03:45:46 +0000 (05:45 +0200)]
mt76: mt7915: move eeprom parsing out of mt7915_mcu_parse_response

Use the new mt76_mcu_send_and_get_msg function

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: implement functions to get the response skb for MCU calls
Felix Fietkau [Wed, 30 Sep 2020 03:03:21 +0000 (05:03 +0200)]
mt76: implement functions to get the response skb for MCU calls

Can be used by the caller to get the response data directly instead of using the
hack of storing the result in internal data structures from .mcu_parse_response

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7603: switch to .mcu_skb_send_msg
Felix Fietkau [Wed, 30 Sep 2020 02:51:03 +0000 (04:51 +0200)]
mt76: mt7603: switch to .mcu_skb_send_msg

Reduces code duplication

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: make mcu_ops->mcu_send_msg optional
Felix Fietkau [Wed, 30 Sep 2020 02:46:43 +0000 (04:46 +0200)]
mt76: make mcu_ops->mcu_send_msg optional

Remove it from mt7615 and mt7915 and implement it in core code instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move waiting and locking out of mcu_ops->mcu_skb_send_msg
Felix Fietkau [Wed, 30 Sep 2020 02:35:11 +0000 (04:35 +0200)]
mt76: move waiting and locking out of mcu_ops->mcu_skb_send_msg

This removes some code duplication and prepares the code for making
the MCU API more flexible

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: move mcu timeout handling to .mcu_parse_response
Felix Fietkau [Wed, 30 Sep 2020 02:01:01 +0000 (04:01 +0200)]
mt76: move mcu timeout handling to .mcu_parse_response

Preparation for further cleanup

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: implement .mcu_parse_response in struct mt76_mcu_ops
Felix Fietkau [Wed, 30 Sep 2020 01:53:59 +0000 (03:53 +0200)]
mt76: implement .mcu_parse_response in struct mt76_mcu_ops

Do not free skb inside that function
Preparation for further cleanup

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: rename __mt76_mcu_skb_send_msg to mt76_mcu_skb_send_msg
Felix Fietkau [Wed, 30 Sep 2020 01:10:52 +0000 (03:10 +0200)]
mt76: rename __mt76_mcu_skb_send_msg to mt76_mcu_skb_send_msg

Preparation for further cleanup

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: rename __mt76_mcu_send_msg to mt76_mcu_send_msg
Felix Fietkau [Wed, 30 Sep 2020 01:09:19 +0000 (03:09 +0200)]
mt76: rename __mt76_mcu_send_msg to mt76_mcu_send_msg

Preparation for further cleanup

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: disable OFDMA/MU-MIMO UL
Felix Fietkau [Tue, 29 Sep 2020 06:48:19 +0000 (08:48 +0200)]
mt76: mt7915: disable OFDMA/MU-MIMO UL

The feature is not ready in firmware yet, and it leads to hangs

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix DRR sta bss group index
Felix Fietkau [Mon, 28 Sep 2020 13:14:50 +0000 (15:14 +0200)]
mt76: mt7915: fix DRR sta bss group index

The firmware/hardware supports only 16 entries. Trying to use more can lead
to timeouts on some firmware versions

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: use napi_consume_skb to bulk-free tx skbs
Felix Fietkau [Tue, 1 Sep 2020 15:46:19 +0000 (17:46 +0200)]
mt76: mt7915: use napi_consume_skb to bulk-free tx skbs

Slightly improves performance

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix processing txfree events
Felix Fietkau [Sun, 27 Sep 2020 14:36:25 +0000 (16:36 +0200)]
mt76: mt7915: fix processing txfree events

In the MT7915 info, the fields for the WLAN index / queue overlap with the
token id, and the MT_TX_FREE_PAIR bit indicates, which one is present.

If MT_TX_FREE_PAIR is set, skip processing the token index, since the data
will not be valid.

This fixes accidentally freeing tokens which are still in use by the
hardware with a wrong station pointer.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: support 32 station interfaces
Felix Fietkau [Sat, 26 Sep 2020 20:40:41 +0000 (22:40 +0200)]
mt76: mt7915: support 32 station 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

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: do not set NEEDS_UNIQUE_STA_ADDR for 7615 and 7915
Felix Fietkau [Sat, 26 Sep 2020 20:39:31 +0000 (22:39 +0200)]
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>
3 years agomt76: mt7615: add debugfs knob for setting extended local mac addresses
Felix Fietkau [Fri, 25 Sep 2020 13:56:49 +0000 (15:56 +0200)]
mt76: mt7615: add debugfs knob for setting extended local mac addresses

This is primarily for testing and can be used in combination with monitor
mode to make the card respond to packets sent to a specific MAC address.
For now this is only exposed as a debug/testing feature, later on the
approach might be used to support more concurrent station interfaces

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: use ieee80211_rx_list to pass frames to the network stack as a batch
Felix Fietkau [Sat, 25 Jul 2020 17:03:17 +0000 (19:03 +0200)]
mt76: use ieee80211_rx_list to pass frames to the network stack as a batch

Improves icache footprint

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add encap offload for 4-address mode stations
Felix Fietkau [Fri, 21 Aug 2020 06:42:46 +0000 (08:42 +0200)]
mt76: mt7915: add encap offload for 4-address mode stations

Enable MWDS mode in firmware as well and fix txp->rept_wds_wcid for wcid >= 255

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: add 802.11 encap offload support
Felix Fietkau [Mon, 17 Aug 2020 05:30:54 +0000 (07:30 +0200)]
mt76: mt7915: add 802.11 encap offload support

It is currently limited to 3-address mode AP and STA interfaces

Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: sdio: convert {status/net}_work to mt76_worker
Lorenzo Bianconi [Sat, 26 Sep 2020 15:06:25 +0000 (17:06 +0200)]
mt76: sdio: convert {status/net}_work to mt76_worker

In order to improve driver throughput, convert status_work and net_work
to mt76 worker APIs.
Remove txrx_wq sdio workqueue since it is no longer used

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: disable interrupt during txrx_worker processing
Lorenzo Bianconi [Sat, 26 Sep 2020 15:06:24 +0000 (17:06 +0200)]
mt76: mt7663s: disable interrupt during txrx_worker processing

In order to reduce sdio bus contention, disable interrupts during
txrx_worker processing

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: convert txrx_work to mt76_worker
Lorenzo Bianconi [Sat, 26 Sep 2020 15:06:23 +0000 (17:06 +0200)]
mt76: mt7663s: convert txrx_work to mt76_worker

In order to improve driver throughput, convert txrx_work to mt76 worker
threads APIs.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7663s: move tx/rx processing in the same txrx workqueue
Lorenzo Bianconi [Sat, 26 Sep 2020 15:06:22 +0000 (17:06 +0200)]
mt76: mt7663s: move tx/rx processing in the same txrx workqueue

Move mt7663 tx and rx processing in the same workqueue in order to
reduce jitter that can hit tcp performances. This is a preliminary patch
to switch to mt76 workers APIs

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7615: retry if mt7615_mcu_init returns -EAGAIN
Chuanhong Guo [Wed, 23 Sep 2020 07:23:03 +0000 (15:23 +0800)]
mt76: mt7615: retry if mt7615_mcu_init returns -EAGAIN

mt7615_load_patch in mt7615/mcu.c sometimes fails with:
mt7622-wmac 18000000.wmac: Failed to get patch semaphore
and returns -EAGAIN. But this error is returned all the way up to
mt7615_init_work with no actual retrial performed, leaving a
broken wireless phy.
Wait a bit and retry for up to 10 times before giving up.

Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: fix VHT LDPC capability
Ryder Lee [Thu, 24 Sep 2020 15:23:14 +0000 (23:23 +0800)]
mt76: mt7915: fix VHT LDPC capability

The MCU field should contain a boolean 0/1, not the flag itself.

Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agomt76: mt7915: measure channel noise and report it via survey
Ryder Lee [Thu, 24 Sep 2020 15:23:13 +0000 (23:23 +0800)]
mt76: mt7915: measure channel noise and report it via survey

Read per-stream measurements every 100 ms and build a simple moving average.

Tested-by: Shayne Chen <shayne.chen@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
3 years agoMerge ath-next from git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git
Kalle Valo [Wed, 2 Dec 2020 19:46:55 +0000 (21:46 +0200)]
Merge ath-next from git://git./linux/kernel/git/kvalo/ath.git

ath.git patches for v5.11. Major changes:

ath11k

* Fast Initial Link Setup (FILS) discovery and unsolicited broadcast
  probe response support

* qcom,ath11k-calibration-variant Device Tree setting

* cold boot calibration support

* new DFS region: JP

wnc36xx

* enable connection monitoring and keepalive in firmware

ath10k

* firmware IRAM recovery feature

mhi

* merge mhi-ath11k-immutable branch to make MHI API change go smoothly

3 years agowl1251: remove trailing semicolon in macro definition
Tom Rix [Fri, 27 Nov 2020 18:08:35 +0000 (10:08 -0800)]
wl1251: remove trailing semicolon in macro definition

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201127180835.2769297-1-trix@redhat.com
3 years agoairo: remove trailing semicolon in macro definition
Tom Rix [Fri, 27 Nov 2020 17:58:21 +0000 (09:58 -0800)]
airo: remove trailing semicolon in macro definition

The macro use will already have a semicolon.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201127175821.2756988-1-trix@redhat.com
3 years agowilc1000: added queue support for WMM
Ajay Singh [Wed, 25 Nov 2020 11:41:10 +0000 (11:41 +0000)]
wilc1000: added queue support for WMM

Added multiple queues[BK,BE,VI,VO] to handle different priority data
packets. Before adding a packet to the queue, checked its priority from
the header, and then add to the suitable queue. The limit for each queue
is maintained separately. Also while passing the packets to the firmware
via VMM take care to select data packets based on priority and available
space.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201125114059.10006-6-ajay.kathat@microchip.com
3 years agowilc1000: call complete() for failure in wilc_wlan_txq_add_cfg_pkt()
Ajay Singh [Wed, 25 Nov 2020 11:41:10 +0000 (11:41 +0000)]
wilc1000: call complete() for failure in wilc_wlan_txq_add_cfg_pkt()

Added complete() call for failure case in wilc_wlan_txq_add_cfg_pkt().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201125114059.10006-5-ajay.kathat@microchip.com
3 years agowilc1000: free resource in wilc_wlan_txq_add_mgmt_pkt() for failure path
Ajay Singh [Wed, 25 Nov 2020 11:41:09 +0000 (11:41 +0000)]
wilc1000: free resource in wilc_wlan_txq_add_mgmt_pkt() for failure path

Before returing from wilc_wlan_txq_add_mgmt_pkt() invoke tx_complete_fn()
callback to free up allocated memory for failure case.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201125114059.10006-4-ajay.kathat@microchip.com
3 years agowilc1000: free resource in wilc_wlan_txq_add_net_pkt() for failure path
Ajay Singh [Wed, 25 Nov 2020 11:41:08 +0000 (11:41 +0000)]
wilc1000: free resource in wilc_wlan_txq_add_net_pkt() for failure path

Before returing from wilc_wlan_txq_add_net_pkt() invoke tx_complete_fn()
callback to free up allocated memory for failure cases.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201125114059.10006-3-ajay.kathat@microchip.com
3 years agowilc1000: added 'ndo_set_mac_address' callback support
Ajay Singh [Wed, 25 Nov 2020 11:41:08 +0000 (11:41 +0000)]
wilc1000: added 'ndo_set_mac_address' callback support

Added support for 'ndo_set_mac_address call' callback to allow change of
interface MAC address.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201125114059.10006-2-ajay.kathat@microchip.com
3 years agobrcmfmac: expose firmware config files through modinfo
Matthias Brugger [Tue, 24 Nov 2020 12:00:18 +0000 (13:00 +0100)]
brcmfmac: expose firmware config files through modinfo

Apart from a firmware binary the chip needs a config file used by the
FW. Add the config files to modinfo so that they can be read by
userspace.

Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201124120018.31358-1-matthias.bgg@kernel.org
3 years agowlcore: Switch to using the new API kobj_to_dev()
Tian Tao [Mon, 23 Nov 2020 01:47:42 +0000 (09:47 +0800)]
wlcore: Switch to using the new API kobj_to_dev()

Switch to using the new API kobj_to_dev().

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1606096062-32251-1-git-send-email-tiantao6@hisilicon.com
3 years agortw88: coex: add feature to enhance HID coexistence performance
Ching-Te Ku [Thu, 26 Nov 2020 02:10:59 +0000 (10:10 +0800)]
rtw88: coex: add feature to enhance HID coexistence performance

Add toggle table related function to enhance WL throughput when WL coexist
with 4/18 HID.
The toggle table feature will toggle WL/BT priority table during WL slot,
it can decrease the impact from HID's frequently packets and prevent HID
lag.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-11-pkshih@realtek.com
3 years agortw88: coex: upgrade coexistence A2DP mechanism
Ching-Te Ku [Thu, 26 Nov 2020 02:10:58 +0000 (10:10 +0800)]
rtw88: coex: upgrade coexistence A2DP mechanism

Add modifications for A2DP interoperability issue of TWS earphones.
Some TWS earphones has low buffer size, so it's necessary to reduce
the slot period to let it get data more frequently.
(e.g. use 4-slot to replace the original 2-slot method).

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-10-pkshih@realtek.com
3 years agortw88: coex: add action for coexistence in hardware initial
Ching-Te Ku [Thu, 26 Nov 2020 02:10:57 +0000 (10:10 +0800)]
rtw88: coex: add action for coexistence in hardware initial

The original setting misses some necessary configuration.
Make coexistence slot align to beacon and check the connection situation
to know if we need to extend WLAN slot or not.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-9-pkshih@realtek.com
3 years agortw88: coex: add function to avoid cck lock
Ching-Te Ku [Thu, 26 Nov 2020 02:10:56 +0000 (10:10 +0800)]
rtw88: coex: add function to avoid cck lock

Some AP will not follow the power save request, or it cannot stop
transmission until its queue is empty. It may bring the decreasing of
data rate.

WLAN firmware will count is the AP still leaked packet after power save
handshake was done or not to enable WLAN slot extend mechanism.

The extend WLAN slot mechanism will extend the WLAN slot after power save
handshake, 5 ms per times, maximum is 5 times to received the leaked packet
to avoid the rate lower down.

And if the transmission was already locked at CCK rate.
The extended WLAN slot can also increase the opportunity that we can
received the CCK's long packet and be released from CCK rate.

While BT multi-link status was finished, there is possible that it still
has some packet remained for seconds. Add a timer to remain the multi-link
mechanism to protect WLAN Rx.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-8-pkshih@realtek.com
3 years agortw88: coex: change the coexistence mechanism for WLAN connected
Ching-Te Ku [Thu, 26 Nov 2020 02:10:55 +0000 (10:10 +0800)]
rtw88: coex: change the coexistence mechanism for WLAN connected

Add a flag to make decision whether the mechanism
should go into free-run mode or not.
For now, it is always false, the flag assignment will
be implemented later.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-7-pkshih@realtek.com
3 years agortw88: coex: change the coexistence mechanism for HID
Ching-Te Ku [Thu, 26 Nov 2020 02:10:54 +0000 (10:10 +0800)]
rtw88: coex: change the coexistence mechanism for HID

Add TDMA slot type setting for later usage.
Since the transmission of HID profile is very frequently,
it may bring a big impact to WLAN performance.
To change slot type, it can make mechanism be more flexible.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-6-pkshih@realtek.com
3 years agortw88: coex: update AFH information while in free-run mode
Ching-Te Ku [Thu, 26 Nov 2020 02:10:53 +0000 (10:10 +0800)]
rtw88: coex: update AFH information while in free-run mode

In free run mode, this WLAN info updating is only related to AFH
information, not related to the connection state, which is the current
implementation.
Always update WLAN info in free run mode now.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-5-pkshih@realtek.com
3 years agortw88: coex: update the mechanism for A2DP + PAN
Ching-Te Ku [Thu, 26 Nov 2020 02:10:52 +0000 (10:10 +0800)]
rtw88: coex: update the mechanism for A2DP + PAN

Update A2DP+PAN+WL mechanism for CPT(Coexistence Performance Test) to
enhance WL/BT performance at the environment that some specific AP are
existing.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-4-pkshih@realtek.com
3 years agortw88: coex: add debug message
Ching-Te Ku [Thu, 26 Nov 2020 02:10:51 +0000 (10:10 +0800)]
rtw88: coex: add debug message

Add message for debugging usage and the program flow is no change.
Add a variable reserved for WLAN firmware synchronize.
Add a group of variable to save BT packet counter, it will be
assigned as mechanism judgment in the future. Now it is just for
debug usage.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-3-pkshih@realtek.com
3 years agortw88: coex: run coexistence when WLAN entering/leaving LPS
Ching-Te Ku [Thu, 26 Nov 2020 02:10:50 +0000 (10:10 +0800)]
rtw88: coex: run coexistence when WLAN entering/leaving LPS

When WLAN entering or leaving, it's necessary to run coexistence mechanism
to ensure the setting matched current status.
Without calling rtw_coex_run_coex(), WLAN poor throughput or bad A2DP
quality may happen.

Signed-off-by: Ching-Te Ku <ku920601@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201126021059.11981-2-pkshih@realtek.com
3 years agoRevert "rtl8xxxu: Add Buffalo WI-U3-866D to list of supported devices"
Tokunori Ikegami [Sat, 21 Nov 2020 00:34:11 +0000 (09:34 +0900)]
Revert "rtl8xxxu: Add Buffalo WI-U3-866D to list of supported devices"

This reverts commit 28606150768a20b291a35dbbbb0ab4dd7d4739db.
Since actually Buffalo WI-U3-866D is falied to power on with the change.

The rtl8812au driver code to power on is same with the rtl8821a code.
But the rtl8821ae included rtl8821a does not support USB interface.
So seems that rtl8812au should be supported by rt1l8821a code with USB.

Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201121003411.9450-1-ikegami.t@gmail.com
3 years agoath11k: dp_rx: fix monitor status dma unmap direction
Kalle Valo [Tue, 24 Nov 2020 15:59:20 +0000 (17:59 +0200)]
ath11k: dp_rx: fix monitor status dma unmap direction

After enabling CONFIG_DMA_API_DEBUG there was a warning about using
dma_unmap_single() in wrong direction from ath11k_dp_rx_process_mon_status().

[  140.279477] ------------[ cut here ]------------
[  140.279908] DMA-API: ath11k_pci 0000:06:00.0: device driver syncs DMA memory with different direction [device address=0x00000000fac08a40] [size=2176 bytes] [mapped with DMA_FROM_DEVICE] [s
[  140.279925] WARNING: CPU: 7 PID: 97 at kernel/dma/debug.c:1120 check_sync+0x494/0x730
[  140.279939] Modules linked in: ath11k_pci ath11k mac80211 libarc4 cfg80211 qmi_helpers qrtr_mhi mhi qrtr ns nvme nvme_core
[  140.279958] CPU: 7 PID: 97 Comm: kworker/u16:1 Not tainted 5.10.0-rc4+ #262
[  140.279968] Hardware name: Intel(R) Client Systems NUC8i7HVK/NUC8i7HVB, BIOS HNKBLi70.86A.0049.2018.0801.1601 08/01/2018
[  140.279995] Workqueue: phy0 ieee80211_scan_work [mac80211]
[  140.280009] RIP: 0010:check_sync+0x494/0x730
[  140.280022] Code: 8b 4c 24 10 4c 8b 44 24 18 4c 8b 54 24 20 48 89 c6 4c 89 54 24 10 4c 89 f9 4c 89 ea 48 c7 c7 40 b9 74 9c 41 56 e8 2f a0 ab 00 <0f> 0b 48 89 ef e8 e5 17 ac 00 41 58 4c 8b
[  140.280033] RSP: 0018:ffff9f588024cbd8 EFLAGS: 00010086
[  140.280046] RAX: 0000000000000000 RBX: ffff9f588024cc40 RCX: ffff8eed18dd9f98
[  140.280057] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff8eed18dd9f90
[  140.280067] RBP: ffff8eebc1407800 R08: 00000000ffffffea R09: 0000000000000000
[  140.280082] R10: 0000000000000003 R11: 3fffffffffffffff R12: ffffffff9e081060
[  140.280093] R13: ffff8eebc43908b0 R14: ffffffff9c74c104 R15: 00000000fac08a40
[  140.280104] FS:  0000000000000000(0000) GS:ffff8eed18c00000(0000) knlGS:0000000000000000
[  140.280115] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  140.280127] CR2: 00007f6feafb12a0 CR3: 00000001604ca001 CR4: 00000000003706e0
[  140.280138] Call Trace:
[  140.280149]  <IRQ>
[  140.280161]  debug_dma_sync_single_for_cpu+0x79/0x80
[  140.280173]  ? mark_held_locks+0x50/0x80
[  140.280185]  ? lockdep_hardirqs_on_prepare.part.0+0x65/0x130
[  140.280197]  ? __local_bh_enable_ip+0x6f/0xb0
[  140.280215]  ? ath11k_dp_rx_reap_mon_status_ring+0x202/0x340 [ath11k]
[  140.280231]  ath11k_dp_rx_reap_mon_status_ring+0x22c/0x340 [ath11k]
[  140.280249]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280265]  ath11k_dp_rx_process_mon_status+0x83/0x3c0 [ath11k]
[  140.280278]  ? __lock_acquire+0x3bd/0x6d0
[  140.280296]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280311]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280326]  ? ath11k_hw_mac_id_to_srng_id_qca6390+0x10/0x10 [ath11k]
[  140.280341]  ? ath11k_dp_rx_process_mon_rings+0x4a/0x1a0 [ath11k]
[  140.280353]  ? timer_fixup_init+0x30/0x30
[  140.280367]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280385]  ath11k_dp_service_mon_ring+0x2b/0x50 [ath11k]
[  140.280400]  ? ath11k_dp_rx_process_mon_rings+0x1a0/0x1a0 [ath11k]
[  140.280413]  call_timer_fn+0xb1/0x2d0
[  140.280426]  __run_timers.part.0+0x205/0x2f0
[  140.280439]  run_timer_softirq+0x21/0x50
[  140.280450]  __do_softirq+0xc2/0x454
[  140.280463]  asm_call_irq_on_stack+0x12/0x20
[  140.280476]  </IRQ>
[  140.280488]  do_softirq_own_stack+0x56/0x60
[  140.280500]  irq_exit_rcu+0x9a/0xd0
[  140.280511]  sysvec_apic_timer_interrupt+0x43/0xa0
[  140.280526]  asm_sysvec_apic_timer_interrupt+0x12/0x20
[  140.280540] RIP: 0010:_raw_spin_unlock_irqrestore+0x25/0x40
[  140.280551] Code: 80 00 00 00 00 55 48 89 fd 48 83 c7 18 53 48 89 f3 48 8b 74 24 10 e8 ca 8f 4b ff 48 89 ef e8 22 dc 4b ff f6 c7 02 75 0c 53 9d <65> ff 0d 04 51 20 64 5b 5d c3 e8 9c 08 56
[  140.280563] RSP: 0018:ffff9f58802e7878 EFLAGS: 00000246
[  140.280578] RAX: 00000000000435ef RBX: 0000000000000246 RCX: 0000000000000040
[  140.280592] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff9be13e84
[  140.280603] RBP: ffff8eed18dde480 R08: 0000000000000001 R09: ffff8eebc2292760
[  140.280614] R10: 0000000000000005 R11: ffff8eebc2292760 R12: 0000000000000000
[  140.280625] R13: ffff9f58802e7900 R14: ffff8eed18dde480 R15: ffff8eed18dde480
[  140.280637]  ? _raw_spin_unlock_irqrestore+0x34/0x40
[  140.280649]  __mod_timer+0x274/0x400
[  140.280661]  ? wait_for_completion_timeout+0x76/0x110
[  140.280675]  schedule_timeout+0xa8/0x140
[  140.280687]  ? __next_timer_interrupt+0x100/0x100
[  140.280698]  wait_for_completion_timeout+0xa2/0x110
[  140.280714]  ath11k_start_scan+0x4c/0xf0 [ath11k]
[  140.280730]  ath11k_mac_op_hw_scan+0x1e9/0x2c0 [ath11k]
[  140.280763]  drv_hw_scan+0x79/0x260 [mac80211]
[  140.280789]  __ieee80211_scan_completed+0x379/0x440 [mac80211]
[  140.280816]  ieee80211_scan_work+0x12f/0x330 [mac80211]
[  140.280830]  process_one_work+0x279/0x5b0
[  140.280842]  worker_thread+0x49/0x300
[  140.280854]  ? process_one_work+0x5b0/0x5b0
[  140.280868]  kthread+0x135/0x150
[  140.280880]  ? __kthread_bind_mask+0x60/0x60
[  140.280891]  ret_from_fork+0x22/0x30
[  140.280903] irq event stamp: 275961
[  140.280918] hardirqs last  enabled at (275960): [<ffffffff9b270f1f>] __local_bh_enable_ip+0x6f/0xb0
[  140.280931] hardirqs last disabled at (275961): [<ffffffff9be13ca3>] _raw_spin_lock_irqsave+0x63/0x80
[  140.280946] softirqs last  enabled at (275944): [<ffffffffc055288d>] ath11k_ce_send+0x14d/0x260 [ath11k]
[  140.280958] softirqs last disabled at (275953): [<ffffffff9c000f72>] asm_call_irq_on_stack+0x12/0x20
[  140.280971] ---[ end trace 31cb94e18d401398 ]---

Tested-on: QCA6390 hw2.0 PCI WLAN.HST.1.0.1-01740-QCAHSTSWPLZ_V2_TO_X86-1

Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1606156046-24764-1-git-send-email-kvalo@codeaurora.org
3 years agowcn36xx: Send NULL data packet when exiting BMPS
Bryan O'Donoghue [Tue, 24 Nov 2020 15:59:19 +0000 (17:59 +0200)]
wcn36xx: Send NULL data packet when exiting BMPS

This commit updates the BMPS exit path to be consistent with downstream in
terms of exiting BMPS mode. Downstream sets the flag to send a NULL data
frame to the host on exiting BMPS.

This will tell the AP to send any queued frames to the STA immediately.
Verified the relevant bit toggle in wireshark.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201120021403.2646574-2-bryan.odonoghue@linaro.org
3 years agoath10k: Constify static qmi structs
Rikard Falkeborn [Tue, 24 Nov 2020 15:59:18 +0000 (17:59 +0200)]
ath10k: Constify static qmi structs

qmi_msg_handler[] and ath10k_qmi_ops are only used as input arguments
to qmi_handle_init() which accepts const pointers to both qmi_ops and
qmi_msg_handler. Make them const to allow the compiler to put them in
read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201122234031.33432-3-rikard.falkeborn@gmail.com
3 years agoath10k: Release some resources in an error handling path
Christophe JAILLET [Tue, 24 Nov 2020 15:59:18 +0000 (17:59 +0200)]
ath10k: Release some resources in an error handling path

Should an error occur after calling 'ath10k_usb_create()', it should be
undone by a corresponding 'ath10k_usb_destroy()' call

Fixes: 4db66499df91 ("ath10k: add initial USB support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201122170358.1346065-1-christophe.jaillet@wanadoo.fr
3 years agoath10k: Fix an error handling path
Christophe JAILLET [Tue, 24 Nov 2020 15:59:18 +0000 (17:59 +0200)]
ath10k: Fix an error handling path

If 'ath10k_usb_create()' fails, we should release some resources and report
an error instead of silently continuing.

Fixes: 4db66499df91 ("ath10k: add initial USB support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201122170342.1346011-1-christophe.jaillet@wanadoo.fr
3 years agoath10k: Fix the parsing error in service available event
Rakesh Pillai [Tue, 24 Nov 2020 15:59:17 +0000 (17:59 +0200)]
ath10k: Fix the parsing error in service available event

The wmi service available event has been
extended to contain extra 128 bit for new services
to be indicated by firmware.

Currently the presence of any optional TLVs in
the wmi service available event leads to a parsing
error with the below error message:
ath10k_snoc 18800000.wifi: failed to parse svc_avail tlv: -71

The wmi service available event parsing should
not return error for the newly added optional TLV.
Fix this parsing for service available event message.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.2-00720-QCAHLSWMTPL-1

Fixes: cea19a6ce8bf ("ath10k: add WMI_SERVICE_AVAILABLE_EVENT support")
Signed-off-by: Rakesh Pillai <pillair@codeaurora.org>
Reviewed-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/1605501291-23040-1-git-send-email-pillair@codeaurora.org
3 years agoath11k: Fix an error handling path
Christophe JAILLET [Tue, 24 Nov 2020 15:59:16 +0000 (17:59 +0200)]
ath11k: Fix an error handling path

If 'kzalloc' fails, we must return an error code.

While at it, remove a useless initialization of 'err' which could hide the
issue.

Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201122173943.1366167-1-christophe.jaillet@wanadoo.fr
3 years agoath11k: Build check size of ath11k_skb_cb
Sven Eckelmann [Tue, 24 Nov 2020 15:59:16 +0000 (17:59 +0200)]
ath11k: Build check size of ath11k_skb_cb

It is rather easy to add more entries to ath11k_skb_cb while forgetting the
size limit of ieee80211_tx_info->driver_data. So just check this during the
build to reduce the change of accidental buffer overflow in the skbuff->cb.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201119154235.263250-3-sven@narfation.org
3 years agoath11k: Reset ath11k_skb_cb before setting new flags
Sven Eckelmann [Tue, 24 Nov 2020 15:59:15 +0000 (17:59 +0200)]
ath11k: Reset ath11k_skb_cb before setting new flags

It was observed that the codepath for the ATH11K_SKB_HW_80211_ENCAP was
used even when the IEEE80211_TX_CTRL_HW_80211_ENCAP was not enabled for a
an skbuff. This became even more prominent when the QCAs wlan-open patchset
for ath11k [1] was applied and a sane looking fix just caused crashes when
injecting frames via a monitor interface (for example with ratechecker):

  [   86.963152] Unable to handle kernel NULL pointer dereference at virtual address 00000338
  [   86.963192] pgd = ffffffc0008f0000
  [   86.971034] [00000338] *pgd=0000000051706003, *pud=0000000051706003, *pmd=0000000051707003, *pte=00e800000b000707
  [   86.984292] Internal error: Oops: 96000006 [#1] PREEMPT SMP
  [...]
  [   87.713339] [<ffffffbffc802480>] ieee80211_tx_status_8023+0xf8/0x220 [mac80211]
  [   87.715654] [<ffffffbffc98bad4>] ath11k_dp_tx_completion_handler+0x42c/0xa10 [ath11k]
  [   87.722924] [<ffffffbffc989190>] ath11k_dp_service_srng+0x70/0x3c8 [ath11k]
  [   87.730831] [<ffffffbffca03460>] 0xffffffbffca03460
  [   87.737599] [<ffffffc00046ef58>] net_rx_action+0xf8/0x288
  [   87.742462] [<ffffffc000097554>] __do_softirq+0xfc/0x220
  [   87.748014] [<ffffffc000097900>] irq_exit+0x98/0xe8
  [   87.753396] [<ffffffc0000cf188>] __handle_domain_irq+0x90/0xb8
  [   87.757999] [<ffffffc000081ca4>] gic_handle_irq+0x6c/0xc8
  [   87.763899] Exception stack(0xffffffc00081bdc0 to 0xffffffc00081bef0)

Problem is that the state of ath11k_skb_cb->flags must be considered
unknown and could contain anything when it is not manually initialized. So
it could also contain ATH11K_SKB_HW_80211_ENCAP. And this can result in the
code to assume that the ath11k_skb_cb->vif is set - even when this is not
always the case for non ATH11K_SKB_HW_80211_ENCAP transmissions.

Tested-on: IPQ8074 hw2.0 WLAN.HK.2.4.0.1.r1-00026-QCAHKSWPL_SILICONZ-2

[1] https://source.codeaurora.org/quic/qsdk/oss/system/feeds/wlan-open/tree/mac80211/patches?h=NHSS.QSDK.11.4.r3
    (162 patches at the moment which are often not upstreamed but essential
     to get ath11k working)

Fixes: e7f33e0c52c0 ("ath11k: add tx hw 802.11 encapsulation offloading support")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/20201119154235.263250-2-sven@narfation.org