Commit Graph
100 Commits
Author SHA1 Message Date
Felix Fietkau e861cb0518 mt76: rely on AQL for burst size limits on tx queueing
Now that AQL works well on all mt76 drivers, completely replace the arbitrary
burst sizing and number of bursts logic for tx scheduling.
For the short period of time in which AQL does not work well yet, limit each
stations to 16 in-flight packets that have no estimated tx time.
This should avoid filling the queue if a station connects and queues up a
large number of packets before rate control information is available, especially
with hardware rate control

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau 05aa857861 mt76: remove swq from struct mt76_sw_queue
Since txq selection was moved to mac80211, it is no longer used

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau 780cdabb86 mt76: remove qid argument to drv->tx_complete_skb
It is not needed

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau 3c2cd85803 mt76: unify queue tx cleanup code
Cleanup and preparation for changing tx scheduling behavior

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau 8124daf531 mt76: sdio: fix use of q->head and q->tail
Their use is reversed compared to DMA. The order for DMA makes more sense,
so let's use that

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau e8d489647c mt76: usb: fix use of q->head and q->tail
Their use is reversed compared to DMA. The order for DMA makes more sense,
so let's use that

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:59:30 +02:00
Felix Fietkau 519510277a mt76: initialize tx worker function earlier
Allows usb code to overwrite it

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:48:47 +02:00
Felix Fietkau 974486ec26 util: in worker setup, only overwrite function pointer if not NULL
Can be used to set up the worker function pointer earlier

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 20:46:05 +02:00
Felix Fietkau 90c8422d3f mt76: mt7915: fix typo in function name
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-24 06:49:14 +02:00
Felix Fietkau 25dd8bdae3 mt76: mt7615: significantly reduce interrupt load
On 7615 and newer, DMA completion only triggers unmap, but not free of queued
skbs, since pointers to packets are queued internally.
Because of that, there is no need to process the main data queue immediately
on DMA completion.
To improve performance, mask out the DMA data queue completion interrupt and
process the queue only when we receive a txfree event.
This brings the number of interrupts under load down to a small fraction.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 17:18:37 +02:00
Felix Fietkau f9ce5c776c mt76: use ieee80211_rx_list to pass frames to the network stack as a batch
Improves icache footprint

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 16:00:28 +02:00
Felix Fietkau 72f0979566 mt76: mt7915: add support for accessing mapped registers via bus ops
Makes it possible to read/write them via debugfs, similar to mt7615/7603

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 16:00:17 +02:00
Felix Fietkau 2f1318a06d mt76: convert from tx tasklet to tx worker thread
This should improve performance by allowing the scheduler to move the tx
scheduling work to idle CPUs

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 87a6942906 mt76: add utility functions for deferring work to a kernel thread
In order to avoid keeping work like tx scheduling pinned to the CPU it was
scheduled from, it makes sense to switch from tasklets to kernel threads.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 5cf34cda70 mt76: mt7915: significantly reduce interrupt load
On 7615 and newer, DMA completion only triggers unmap, but not free of queued
skbs, since pointers to packets are queued internally.
Because of that, there is no need to process the main data queue immediately
on DMA completion.
To improve performance, mask out the DMA data queue completion interrupt and
process the queue only when we receive a txfree event.
This brings the number of interrupts under load down to a small fraction.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 23dbd64d63 mt76: mt7915: schedule tx tasklet in mt7915_mac_tx_free
The previous scheduling round may have been limited by AQL.
More frames might be available after the tx free run.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 55d79ab7fa mt76: dma: update q->queued immediately on cleanup
With threaded NAPI support it becomes more likely that tx cleanup and tx
enqueuing will run in parallel. In order to avoid queue starvation issues
under load, update q->queued immediately.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 795b772cd3 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 <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 3a3306e408 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 <[email protected]>
2020-08-22 15:56:57 +02:00
Felix Fietkau 888990e159 mt76: use threaded NAPI
With threaded NAPI, the rx handler function is no longer bound to the CPU that
fired the interrupt, which significantly helps to spread the workload over
multiple CPUs, especially when multiple devices are using threaded NAPI at the
same time.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 15:56:52 +02:00
Felix Fietkau b54157df7c mt7615: update firmware to version 20200814
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 12:17:15 +02:00
Felix Fietkau 692065b4c9 mt76: mt7915: only enable hw amsdu for AP and station
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 12:17:15 +02:00
Felix Fietkau d2fe5e8330 mt76: mt7915: fix variable initialization in sta poll
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-22 12:17:15 +02:00
Felix Fietkau 3743e7c904 mt76: mt7915: optimize mt7915_mac_sta_poll
Since DMA completion does not imply tx completion, it makes more sense to
poll for airtime from mt7915_mac_tx_free.
Reduce the runtime of the function by moving all items from dev->sta_poll_list
to a local list once and process any stations that were added afterwards
on the next run

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-20 13:02:58 +02:00
Felix Fietkau 8027c7d952 mt76: mt7615: fix reading airtime statistics
- change the WTBL LMAC access function to set the mapping window only once
- use ac * 2 as offset, since each AC has separate words for rx and tx

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-20 13:02:22 +02:00
Felix Fietkau efc8669db5 mt76: mt7615: fix max_mpdu_size field for A-MSDU
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-13 09:52:37 +02:00
Felix Fietkau 34aed01ca8 mt76: mt7915: use ieee80211_free_txskb to free tx skbs
Using dev_kfree_skb for tx skbs breaks AQL. This worked until now only
by accident, because a mac80211 issue breaks AQL on drivers with firmware
rate control that report the rate via ieee80211_tx_status_ext as struct
rate_info.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-12 16:46:34 +02:00
Felix Fietkau 2767051432 mt76: mt7615: use v1 MCU API on MT7615 to fix issues with adding/removing stations
The implementation of embedding WTBL update inside the STA_REC update is buggy
on the MT7615 v2 firmware. This leads to connection issues after a station has
connected and disconnected again.

Switch to the v1 MCU API ops, since they have received much more testing and
should be more stable.

On MT7622 and later, the v2 API is more actively used, so we should keep using
it as well.

Fixes: 6849e29ed92e ("mt76: mt7615: add starec operating flow for firmware v2")
Cc: [email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-12 12:19:40 +02:00
Felix Fietkau 21f7734cbb mt76: mt7915: add missing flags in WMM parameter settings
Indicate the filled parameter to the firmware

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-11 12:13:34 +02:00
Felix Fietkau 335cd51be4 mt76: mt7915: simplify aggregation session check
Use the txwi data as primary source information to avoid touching skb data
Use bitfield instead of state variable + spinlock

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-11 12:13:34 +02:00
Felix Fietkau ad90170b0a mt76: mt7615: remove mtxq->agg_ssn assignment
It is not used anywhere for this driver

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-11 12:13:34 +02:00
Felix Fietkau 9816f9812a mt76: move mt76_check_agg_ssn to driver tx_prepare calls
mt7615 and newer drivers do not need this, since they use sequence number offload
Moving this code also reduces the number of callsites to make it easier to review

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-11 12:13:34 +02:00
Felix Fietkau fa69dd96f9 mt76: mt7915: enable offloading of sequence number assignment
Preparation for supporting more offload features

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-11 12:13:34 +02:00
Felix Fietkau 9ab20dfbf7 mt76: mt7915: increase tx retry count
Set it to 15 to match reference driver

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-11 12:13:34 +02:00
Felix Fietkau 5e0c587b9a mt76: mt7915: clean up station stats polling and rate control update
Queueing a per-sta work item from the tx free path can become very expensive
under load. This work is only supposed to pull rate control stats every
second and deal with rate control changes.

Additionally, the rate control update code was wrong, because it was
confusing bit masks and bit numbers in test_bit.

Fix this by introducing a dedicated device work item for rate control
updates, and by polling station stats from the phy mac work.
Stations requiring polling or rate control updates are added to lists
protected by dev->sta_poll_lock.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-10 11:00:17 +02:00
Felix Fietkau 1eb94624bb mt76: mt7915: do not do any work in napi poll after calling napi_complete_done()
Fixes a race condition where multiple tx cleanup or sta poll tasks could run
in parallel.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-08 09:32:03 +02:00
Felix Fietkau f2e71f0c1b mt76: mt7615: do not do any work in napi poll after calling napi_complete_done()
Fixes a race condition where multiple tx cleanup tasks could run in parallel

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-08 09:30:27 +02:00
Felix Fietkau 5ea8b6187d mt76: mt76x02: clean up and fix interrupt masking in the irq handler
Only clear unmasked interrupts. If an interrupt is temporarily masked,
its pending events need to be processed later, even if another interrupt
happened in the mean time.
Disable interrupts in one call before scheduling

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-07 22:10:43 +02:00
Felix Fietkau 2fbd6baac1 mt76: mt7615: only clear unmasked interrupts in irq tasklet
If an interrupt is temporarily masked, its pending events need to be processed
later, even if another interrupt happened in the mean time.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-07 22:09:58 +02:00
Felix Fietkau 06f722d804 mt76: mt7915: clean up and fix interrupt masking in the irq handler
Only clear unmasked interrupts. If an interrupt is temporarily masked,
its pending events need to be processed later, even if another interrupt
happened in the mean time.

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-07 22:07:50 +02:00
Felix Fietkau 58774b605f mt76: set interrupt mask register to 0 before requesting irq
Avoids spurious interrupts in case the hardware was running already

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-07 21:56:37 +02:00
Felix Fietkau 825343467d mt76: fix double DMA unmap of the first buffer on 7615/7915
A small part of the first skb buffer is passed to the firmware for parsing
via DMA, while the full buffer is passed as part of the TXP.

Avoid calling DMA unmap on the first part (with a different length than map)

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-05 11:31:29 +02:00
Felix Fietkau 8d9a62e4de mt76: mt7915: fix crash on tx rate report for invalid stations
Check wcid RCU pointer before using it

Signed-off-by: Felix Fietkau <[email protected]>
2020-07-24 16:14:42 +02:00
Felix Fietkau b5df0fbb18 mt7615: update firmware to version 20200629
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-22 11:15:14 +02:00
Felix Fietkau 632ce698e8 mt76: mt7615: fix antenna settings for test mode
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-21 18:43:15 +02:00
Felix Fietkau 1eb8b7d689 mt76: testmode: fix tx_done accounting on enqueue failures
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-21 13:21:04 +02:00
Felix Fietkau 6838d002f9 mt76: mt7615: fix tx_frames setup
Properly set up the state when entering the tx_frames state

Signed-off-by: Felix Fietkau <[email protected]>
2020-07-14 18:48:07 +02:00
Felix Fietkau 1641aa2016 mt76: mt7615: fix mt7615_mcu_set_test_param set non-bool parameters
Fixes testmode freq_offset

Signed-off-by: Felix Fietkau <[email protected]>
2020-07-14 18:17:34 +02:00
Felix Fietkau f9a7a2f7db testmode: fix setting tx_power
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-14 18:09:31 +02:00
Felix Fietkau 750797b61b mt76: fix copy&paste error in mt76_testmode_cmd
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-13 09:17:24 +02:00
Felix Fietkau 6789a2db72 mt7615: fix getting wideband RSSI in test mode
Signed-off-by: Felix Fietkau <[email protected]>
2020-07-09 22:06:43 +02:00
Felix Fietkau 3ea5da1639 add utility for using testmode support
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:32:26 +02:00
Felix Fietkau d7467bc018 mt76: mt7615: implement testmode support
Supports sending a configurable number of packets with a specific rate
and configurable tx power levels / antenna settings, as well as displaying
rx statistics.

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:32:02 +02:00
Felix Fietkau 3a1ea7287e mt76: add API for testmode support
This can be used for calibration in the manufacturing process.
It supports sending a configurable number of packets with a specific rate
and configurable tx power levels / antenna settings.
It also supports receiving packets and showing some statistics, including
packet counters and detailed RSSI information.
It will only be compiled in if CONFIG_NL80211_TESTMODE is enabled

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:31:02 +02:00
Felix Fietkau b1ddb8e35c 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 <[email protected]>
2020-06-22 21:28:35 +02:00
Felix Fietkau 882cec4206 mt76: mt7615: use full on-chip memory address for WF_PHY registers
Now that the bus access functions can use mapping for accessing full
register addresses, use it for WF_PHY registers to keep them constant.
Needed for follow-up work on testmode support

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:28:35 +02:00
Felix Fietkau 46bc8a0b53 mt76: mt7615: add support for accessing RF registers via MCU
Includes debugfs files for testing it.
Will be used for testmode support.

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:28:35 +02:00
Felix Fietkau 72f3410724 mt76: mt7615: add support for accessing mapped registers via bus ops
Makes it possible to read/write them via debugfs, similar to mt7603

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:28:35 +02:00
Felix Fietkau b5eee1b522 mt76: mt7615: schedule tx tasklet and sta poll on mac tx free
Unlike on earlier chips, DMA completion on MT7615 does not imply actually
having sent out any packets.
Since AQL will prevent filling the hardware queues and will only allow more
packets to be passed to the driver after tx completion, it makes much more
sense to schedule the tx tasklet there.
This is also needed for scheduling tx in testmode support

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 21:28:35 +02:00
Felix Fietkau ee13b78367 mt76: mt7615: fix EEPROM buffer size
Avoid adding MT7615_EEPROM_SIZE twice.
Rename MT7615_EEPROM_EXTRA_DATA to MT7615_EEPROM_FULL_SIZE, since it already
includes MT7615_EEPROM_SIZE

Fixes: ad380ad1ebbe ("mt76: mt7615: add support for applying DC offset calibration from EEPROM")
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-22 17:05:13 +02:00
Felix Fietkau a3e17ff8e6 mt76: mt7615: implement support for using DT rate power limits
Limits are used to update the channel max_power settings and also passed
to the firmware on channel changes

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-16 22:04:15 +02:00
Felix Fietkau 769b030de6 mt76: add functions for parsing rate power limits from DT
This subnode can be used to set per-rate tx power limits either per
country code / regdomain or globally.
These limits are typically provided by the device manufacturers and are
used to limit sideband emissions and stay within regulatory limits

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-16 22:04:15 +02:00
Felix Fietkau ec4057d685 mt76: add script for generating single-sku device tree data
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-16 22:04:15 +02:00
Felix Fietkau 0ed6a335eb mt76: mt7615: re-enable offloading of sequence number assignment
Preparation for supporting more offload features

Signed-off-by: Felix Fietkau <[email protected]>
2020-06-16 11:44:04 +02:00
Felix Fietkau f185d90ec5 update mt7915 firmware to the latest version
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-15 20:40:04 +02:00
Felix Fietkau 49c7131dd0 mt76: mt76x02: do not access uninitialized NAPI structs
Fixes a crash on MMIO devices when running into the watchdog reset

Fixes: d3377b78cec6 ("mt76: add HE phy modes and hardware queue")
Signed-off-by: Felix Fietkau <[email protected]>
2020-06-14 18:21:58 +02:00
Felix Fietkau 4e6f4e432d mt76: only iterate over initialized rx queues
Fixes the following reported crash:

[    2.361127] BUG: spinlock bad magic on CPU#0, modprobe/456
[    2.361583]  lock: 0xffffa1287525b3b8, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
[    2.362250] CPU: 0 PID: 456 Comm: modprobe Not tainted 4.14.177 #5
[    2.362751] Hardware name: HP Meep/Meep, BIOS Google_Meep.11297.75.0 06/17/2019
[    2.363343] Call Trace:
[    2.363552]  dump_stack+0x97/0xdb
[    2.363826]  ? spin_bug+0xa6/0xb3
[    2.364096]  do_raw_spin_lock+0x6a/0x9a
[    2.364417]  mt76_dma_rx_fill+0x44/0x1de [mt76]
[    2.364787]  ? mt76_dma_kick_queue+0x18/0x18 [mt76]
[    2.365184]  mt76_dma_init+0x53/0x85 [mt76]
[    2.365532]  mt7615_dma_init+0x3d7/0x546 [mt7615e]
[    2.365928]  mt7615_register_device+0xe6/0x1a0 [mt7615e]
[    2.366364]  mt7615_mmio_probe+0x14b/0x171 [mt7615e]
[    2.366771]  mt7615_pci_probe+0x118/0x13b [mt7615e]
[    2.367169]  pci_device_probe+0xaf/0x13d
[    2.367491]  driver_probe_device+0x284/0x2ca
[    2.367840]  __driver_attach+0x7a/0x9e
[    2.368146]  ? driver_attach+0x1f/0x1f
[    2.368451]  bus_for_each_dev+0xa0/0xdb
[    2.368765]  bus_add_driver+0x132/0x204
[    2.369078]  driver_register+0x8e/0xcd
[    2.369384]  do_one_initcall+0x160/0x257
[    2.369706]  ? 0xffffffffc0240000
[    2.369980]  do_init_module+0x60/0x1bb
[    2.370286]  load_module+0x18c2/0x1a2b
[    2.370596]  ? kernel_read_file+0x141/0x1b9
[    2.370937]  ? kernel_read_file_from_fd+0x46/0x71
[    2.371320]  SyS_finit_module+0xcc/0xf0
[    2.371636]  do_syscall_64+0x6b/0xf7
[    2.371930]  entry_SYSCALL_64_after_hwframe+0x3d/0xa2
[    2.372344] RIP: 0033:0x7da218ae4199
[    2.372637] RSP: 002b:00007fffd0608398 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[    2.373252] RAX: ffffffffffffffda RBX: 00005a705449df90 RCX: 00007da218ae4199
[    2.373833] RDX: 0000000000000000 RSI: 00005a7052e73bd8 RDI: 0000000000000006
[    2.374411] RBP: 00007fffd06083e0 R08: 0000000000000000 R09: 00005a705449d540
[    2.374989] R10: 0000000000000006 R11: 0000000000000246 R12: 0000000000000000
[    2.375569] R13: 00005a705449def0 R14: 00005a7052e73bd8 R15: 0000000000000000

Reported-by: Sean Wang <[email protected]>
Fixes: d3377b78cec6 ("mt76: add HE phy modes and hardware queue")
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-24 19:11:50 +02:00
Felix Fietkau 984a172609 mt76: fix wcid allocation issues
mt76 core uses ffs() to find the next free bit. This works well for 32 bit
architectures where BITS_PER_LONG is 32. ffs only checks 32 bit values, so
allocation fails on 64 bit architectures.
Additionally, the wcid mask array was too small in cases where the array
was not a multiple of BITS_PER_LONG.
Fix this by making the wcid mask array u32 instead and use DIV_ROUND_UP
for the size, just in case we ever bump it to a value that's not a multiple
of 32.

Signed-off-by: Felix Fietkau <[email protected]>
2020-05-23 14:42:49 +02:00
Felix Fietkau 060e375a92 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 <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-20 08:11:08 +02:00
Felix Fietkau f85c1f3fc1 firmware: add mt7915 firmware
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:22:30 +02:00
Felix Fietkau d7a10094c4 mt7663: add client offload firmware
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-12 19:12:52 +02:00
Felix Fietkau 8688ed70c9 mt76: mt7615: use module parameter option for offload firmware preference
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:06 +02:00
Felix Fietkau 10a5b7630a mt76: mt7615: fix getting maximum tx power from eeprom
On top of the EEPROM target power, each rate can also has a power offset.
On many devices, this power offset is used to boost the tx power of lower
rates. Take this into account when parsing rate power.
The assumption here is, that the first rate (OFDM 6M or CCK 1M) has the
highest tx power

Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:06 +02:00
Felix Fietkau 7aabfd0c92 mt7615: add CONFIG_MT76_LEDS to cflags
Signed-off-by: Felix Fietkau <[email protected]>
2020-05-05 17:54:06 +02:00
Felix Fietkau 6aaf029973 mt76: mt7615: fix endian issues in dcoc/txdpd calibration
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-27 19:53:08 +02:00
Felix Fietkau 1846da5dd4 mt76: mt7615: set spatial extension index
The vendor driver sets this in firmware rate control (which we don't use)

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-27 19:45:45 +02:00
Felix Fietkau 8304b38661 mt76: mt7603: fix tx status rate index calculation
A switch from one rate index to the next only happens when tx count from
the current slot is greater than MT7615_RATE_RETRY, which is 1 has to be
subtracted from count, instead of added to it.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 4e7ce907fa mt76: mt7615: fix tx status rate index calculation
A switch from one rate index to the next only happens when tx count from
the current slot is greater than MT7615_RATE_RETRY, which is 1 has to be
subtracted from count, instead of added to it.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 1656882f27 mt76: mt7615: do not adjust MAC timings if the device is not running
Avoids register writes and MAC start/stop when the hardware isn't ready for it

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau c0b19ac97c mt76: mt7615: adjust timing in mt7615_mac_set_timing to match fw/hw values
Slightly improves performance

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 29a92c5606 mt76: mt7603: never use an 802.11b CF-End rate on 5GHz
Sometimes mt7615_mac_set_timing gets called while the slot time is still
configured to 20. Ensure that in this case it always uses the OFDM CFend
rate.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:49:41 +02:00
Felix Fietkau 257319e9b0 mt76: mt7615: never use an 802.11b CF-End rate on 5GHz
Sometimes mt7615_mac_set_timing gets called while the slot time is still
configured to 20. Ensure that in this case it always uses the OFDM CFend
rate.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-22 17:46:38 +02:00
Felix Fietkau d73e3a23a5 mt76: mt7615: use larger rx buffers if VHT is supported
In VHT mode we can receive larger MPDUs. Increasing the buffer size reduces
fragmentation here, which should improve performance.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-20 16:53:29 +02:00
Felix Fietkau e5adbb2077 mt76: fix A-MPDU density handling
The hardware requirements for A-MPDU density are entirely on the tx side,
not the rx side. Because of that, the IE value should stay at 0 and the
minimum value should instead be enforced in WTBL/TXWI

MT7615 has no restrictions here

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-20 16:35:19 +02:00
Felix Fietkau 01fd34f3a6 mt76: mt7615: fix sta ampdu factor for VHT
If VHT has a larger A-MPDU size limit, pass it to the MCU via the wtbl_ht
TLV element.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-20 15:49:36 +02:00
Felix Fietkau 05b23d7478 mt76: mt7615: rework IRQ handling to prepare for MSI support
With MSI interrupts, IRQs must not be enabled from within the IRQ handler,
because that can lead to lost events.
Defer IRQ processing to a tasklet, which is also responsible for enabling
IRQs (to avoid race conditions against the handler)

Co-developed-by: Soul Huang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 19:54:25 +02:00
Felix Fietkau 8fb1cd20a7 mt76: mt7615: set hw scan limits only for firmware with offload support
They do not apply to software scan

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 12:35:22 +02:00
Felix Fietkau 08b8bd2bc9 mt76: mt7615: disable hw/sched scan ops for non-offload firmware
Avoid having to attempt hw scan and fall back to software for every scan
on devices/firmware without hw scan support

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-09 12:26:05 +02:00
Felix Fietkau 9406eb1d11 mt76: mt7615: fix endian issues in applying flash calibration data
Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 16:54:00 +02:00
Felix Fietkau bf60f43b12 mt76: mt76x2: disable merge of OTP ROM data by default
The reference driver does not seem to enable it by default, only under certain
conditions, e.g. when a .bin file is loaded.
Make it opt-in via a device tree property for now, in case it is needed on some
boards.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 14:03:06 +02:00
Felix Fietkau 5a1eaa38d3 mt76: mt7603: disable merge of OTP ROM data by default
The reference driver does not seem to enable it by default, only under certain
conditions, e.g. when a .bin file is loaded.
Make it opt-in via a device tree property for now, in case it is needed on some
boards.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 14:01:56 +02:00
Felix Fietkau 55198aafb7 mt76: mt7615: add support for applying tx DPD calibration from EEPROM
When the EEPROM data is read from flash, it can contain tx DPD calibration
data. Add support for sending the data to the firmware.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Felix Fietkau 2b58998bb5 mt76: mt7615: add support for applying DC offset calibration from EEPROM
When the EEPROM data is read from flash, it can contain DC offset calibration
data. Add support for sending the data to the firmware.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Felix Fietkau d16a4698f1 mt76: mt7615: disable merge of OTP ROM data by default
The reference driver does not seem to enable it by default, only under certain
conditions, e.g. when a .bin file is loaded.
Make it opt-in via a device tree property for now, in case it is needed on some
boards.

Signed-off-by: Felix Fietkau <[email protected]>
2020-04-06 12:20:17 +02:00
Felix Fietkau 6e4b2a709f mt76: sync Makefile with upstream
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-26 14:36:18 +01:00
Felix Fietkau 3b4f938409 mt76: add memory barrier to DMA queue kick
Ensure that descriptor memory has been fully written before letting the
hardware read it

Signed-off-by: Felix Fietkau <[email protected]>
2020-03-26 14:24:28 +01:00
Felix Fietkau 8e9cd01228 mt7615: sync Kconfig with upstream
Signed-off-by: Felix Fietkau <[email protected]>
2020-03-26 14:22:15 +01:00
Felix Fietkau a94e43f277 mt76: mt76x02: reset MCU timeout counter earlier in watchdog reset
Ensure that MCU commands issued right after hardware reset are not dropped
and treated as failed.

Signed-off-by: Felix Fietkau <[email protected]>
2020-03-10 17:11:04 +01:00
Felix Fietkau 81476f11b6 mt76: mt7615: fix antenna mask initialization in DBDC mode
Update wiphy available antenna mask, and fix chainmask setting on 3x3 hardware

Signed-off-by: Felix Fietkau <[email protected]>
2020-02-25 13:15:38 +01:00
Felix Fietkau 46e63c05f7 mt76: mt7603: enable dynamic sensitivity adjustment by default
Signed-off-by: Felix Fietkau <[email protected]>
2020-02-22 10:05:32 +01:00