Commit Graph
100 Commits
Author SHA1 Message Date
Felix Fietkau b80c997b3f wifi: mt76: partially move channel change code to core
This allows the core code to change the channel. Code deduplication and
preparation for adding scanning code to the core.

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-12 21:08:33 +02:00
Felix Fietkau 6ccafa50c6 firmware: update firmware for MT7915 to 20240429200502
Signed-off-by: Felix Fietkau <[email protected]>
2024-08-12 21:08:33 +02:00
Felix Fietkau c13032ba47 wifi: mt76: mt7915: always query station rx rate from firmware
When offloading is enabled, the software rx path may not have the latest
rate information.

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-12 17:56:37 +02:00
Felix Fietkau fdba7f4088 wifi: mt76: fix mt76_get_rate
Do not assume that the first phy has 2 GHz support.
Check sband->band instead of accessing dev->phy.sband_2g.

Signed-off-by: Felix Fietkau <[email protected]>
2024-08-09 10:32:37 +02:00
Felix Fietkau 6585a4353a wifi: mt76: mt7921: fix crash on ipv6 addr notification during vif bringup
mvif->phy is NULL when the interface is not properly initialized yet

Signed-off-by: Felix Fietkau <[email protected]>
2024-07-17 17:26:53 +02:00
Felix Fietkau e25fb9a010 wifi: mt76: mt7921: add missing bss_conf vif init
Signed-off-by: Felix Fietkau <[email protected]>
2024-07-16 14:33:33 +02:00
Felix Fietkau 564cd93961 mt76: sync with upstream changes
Signed-off-by: Felix Fietkau <[email protected]>
2024-07-12 17:15:04 +02:00
Felix Fietkau 513c131c63 mt76: mt7603: fix mixed declarations and code
Move the qid variable declaration further up

Fixes: b473c0e47f04 ("wifi: mt76: mt7603: fix tx queue of loopback packets")
Signed-off-by: Felix Fietkau <[email protected]>
2024-05-17 13:53:55 +02:00
Felix Fietkau 14d5ee9f33 mt76: shrink mt76_queue_buf
Reuse one bit from the length field for skip_unmap

Signed-off-by: Felix Fietkau <[email protected]>
2024-05-03 22:42:40 +02:00
Felix Fietkau c40e648b89 wifi: mt76: enable spectrum management
It is supported by all drivers

Signed-off-by: Felix Fietkau <[email protected]>
2024-04-19 13:35:28 +02:00
Felix Fietkau d9c62742be wifi: mt76: make const arrays in functions static
Reduces size by avoiding duplicates

Signed-off-by: Felix Fietkau <[email protected]>
2024-04-19 10:02:17 +02:00
Felix Fietkau 2d264aecbf mt76: mt7915: make pre-cal freq lists static const
Signed-off-by: Felix Fietkau <[email protected]>
2024-04-19 09:54:41 +02:00
Felix Fietkau 8f301a5c5f firmware: add mt7981 default eeprom
Signed-off-by: Felix Fietkau <[email protected]>
2024-04-04 17:28:55 +02:00
Felix Fietkau 1e336a8582 wifi: mt76: connac: use muar idx 0xe for non-mt799x as well
This is expected by the firmware of older chipsets as well, though it may
not have been as strongly required as on mt799x

Fixes: 098428c400ff ("wifi: mt76: connac: set correct muar_idx for mt799x chipsets")
Signed-off-by: Felix Fietkau <[email protected]>
2024-04-03 13:05:12 +02:00
Felix Fietkau 669aba47a1 wifi: mt76: mt7915: fix HE PHY capability regression
Fix a logic error that was dropping required capabilities

Signed-off-by: Felix Fietkau <[email protected]>
2024-04-03 11:34:14 +02:00
Felix Fietkau 446f652c96 wifi: mt76: mt7603: add wpdma tx eof flag for PSE client reset
This flag is needed for the PSE client reset. Fixes watchdog reset issues.

Fixes: c677dda16523 ("wifi: mt76: mt7603: improve watchdog reset reliablity")
Signed-off-by: Felix Fietkau <[email protected]>
2024-04-03 11:13:34 +02:00
Felix Fietkau e4de3592c4 wifi: mt76: mt7603: fix tx queue of loopback packets
Use the correct WMM AC queue instead of the MGMT one to fix potential issues
with aggregation sequence number tracking. Drop non-bufferable packets.

Fixes: fca9615f1a43 ("mt76: mt7603: fix up hardware queue index for PS filtered packets")
Signed-off-by: Felix Fietkau <[email protected]>
2024-04-03 11:12:55 +02:00
Felix Fietkau 605624a4e1 mt76: fix path to page_pool helper include
Signed-off-by: Felix Fietkau <[email protected]>
2024-03-24 15:51:52 +01:00
Felix Fietkau 2135e201e7 mt76: mt7915: add fallback in case of missing precal data
When pre-calibration data is missing, do not fail the driver probe.
Instead, just print a warning and fall back to regular calibration.

Signed-off-by: Felix Fietkau <[email protected]>
2024-03-18 10:33:01 +01:00
Felix Fietkau 2330781b8c wifi: mt76: mt7996: only set MT76_MCU_RESET for the main phy
The MT76_MCU_RESET flag is only read on the main phy.

Signed-off-by: Felix Fietkau <[email protected]>
2024-03-15 17:07:47 +01:00
Felix Fietkau b5640b3153 wifi: mt76: fix tx packet loss when scanning on DBDC
When queueing packets, only the MT76_RESET flag of the primary PHY
is checked. If the primary PHY is scanning or changing channels, this can
lead to packet loss for tx on the second PHY.
Fix this by passing the phy to the .tx_queue_skb op and using it to check
the correct flag.

Signed-off-by: Felix Fietkau <[email protected]>
2024-03-15 17:07:47 +01:00
Felix Fietkau 46c7d1849d wifi: mt76: replace skb_put with skb_put_zero
Avoid potentially reusing uninitialized data

Signed-off-by: Felix Fietkau <[email protected]>
2024-03-15 17:07:47 +01:00
Felix Fietkau a238df940d wifi: mt76: mt7915: initialize rssi on adding stations
Improves initial rate selection after connecting

Signed-off-by: Felix Fietkau <[email protected]>
2024-03-15 17:07:31 +01:00
Felix Fietkau 786a339bac wifi: mt76: mt7996: fix fortify warning
Copy cck and ofdm separately in order to avoid __read_overflow2_field
warning.

Fixes: f75e4779d215 ("wifi: mt76: mt7996: add txpower setting support")
Signed-off-by: Felix Fietkau <[email protected]>
2024-02-03 14:22:05 +01:00
Felix Fietkau 3e81173d9e wifi: mt76: mt7603: initialize chainmask
Fixes reported tx power by accounting for the combined output

Signed-off-by: Felix Fietkau <[email protected]>
2024-01-29 11:09:31 +01:00
Felix Fietkau 0258dc90e3 wifi: mt76: mt7603: fix reading target power from eeprom
If the ext-PA target power is unset, fall back to the standard EEPROM value.

Signed-off-by: Felix Fietkau <[email protected]>
2024-01-29 11:00:08 +01:00
Felix Fietkau 3d5890e2ca wifi: mt76: mt7915: fix error recovery with WED enabled
Do not clear the interrupt mask register on MT7915, since that prevents
MCU_CMD interrupts from being reported, thus causing timeouts during the
reset sequence. Defer stopping WED until tx/rx processing activity has
stopped.

Signed-off-by: Felix Fietkau <[email protected]>
2024-01-18 15:51:57 +01:00
Felix Fietkau f559adf184 wifi: mt76: fix crash with WED rx support enabled
If WED rx is enabled, rx buffers are added to a buffer pool that can be
filled from multiple page pools. Because buffers freed from rx poll are
not guaranteed to belong to the processed queue's page pool, lockless
caching must not be used in this case.

Cc: [email protected]
Fixes: 2f5c3c77fc9b ("wifi: mt76: switch to page_pool allocator")
Signed-off-by: Felix Fietkau <[email protected]>
2023-12-08 08:43:42 +01:00
Felix Fietkau 7730fc91dd wifi: mt76: fix shift overflow warnings on 32 bit systems
Signed-off-by: Felix Fietkau <[email protected]>
2023-12-07 18:49:45 +01:00
Felix Fietkau 890ae4d717 wifi: mt76: mt76x02: fix MT76x0 external LNA gain handling
On MT76x0, LNA gain should be applied for both external and internal LNA.
On MT76x2, LNA gain should be treated as 0 for external LNA.
Move the LNA type based logic to mt76x2 in order to fix mt76x0.

Fixes: 2daa67588f34 ("mt76x0: unify lna_gain parsing")
Reported-by: Shiji Yang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-19 21:48:01 +02:00
Felix Fietkau 8d5ea32d48 wifi: mt76: remove unused error path in mt76_connac_tx_complete_skb
The error handling code was added in order to allow tx enqueue to fail after
calling .tx_prepare_skb. Since this can no longer happen, the error handling
code is unused.

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 15:15:19 +02:00
Felix Fietkau cd371fcc98 mt76: mt7996: sync with upstream
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:51 +02:00
Felix Fietkau f1e1e67d97 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.

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Felix Fietkau bbbac7deee wifi: mt76: rename mt76_packet_id_init/flush to mt76_wcid_init/cleanup
Also un-inline the functions. Will be used for further wcid init/cleanup

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Felix Fietkau b5d13611d3 mt76: mt7915: fix monitor mode issues
Enable receiving other-unicast packets
Disable RX header translation in order to proprerly receive data packets

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Felix Fietkau b14c2351dd wifi: mt76: mt7603: disable A-MSDU tx support on MT7628
It was reported that this can cause the PSE hang issues, even with a low
number of fragments.

Link: https://github.com/openwrt/mt76/issues/793#issuecomment-1676529138
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 21:33:36 +02:00
Felix Fietkau 85cc58378d wifi: mt76: mt7603: add missing register initialization for MT7628
Ported from the vendor driver code

Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00
Felix Fietkau c03d84c0d0 wifi: mt76: mt7603: improve stuck beacon handling
Before preparing the new beacon, check the queue status, flush out all
previous beacons and buffered multicast packets, then (if necessary)
try to recover more gracefully from a stuck beacon condition by making a
less invasive attempt at getting the MAC un-stuck.

Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00
Felix Fietkau a8d9553d8f wifi: mt76: mt7603: improve watchdog reset reliablity
Only trigger PSE reset if PSE was stuck, otherwise it can cause DMA issues.
Trigger the PSE reset while DMA is fully stopped in order to improve
reliabilty.

Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00
Felix Fietkau 80b8bcf0e3 wifi: mt76: mt7603: rework/fix rx pse hang check
It turns out that the code in mt7603_rx_pse_busy() does not detect actual
hardware hangs, it only checks for busy conditions in PSE.
A reset should only be performed if these conditions are true and if there
is no rx activity as well.
Reset the counter whenever a rx interrupt occurs. In order to also deal with
a fully loaded CPU that leaves interrupts disabled with continuous NAPI
polling, also check for pending rx interrupts in the function itself.

Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00
Felix Fietkau 7ef4dd12d9 wifi: mt76: mt7603: fix tx filter/flush function
Setting MT_TX_ABORT does not abort any transmission for a wtbl index on its
own. Instead, it modifies the behavior of a queue flush to make it selectively
flush packets for a particular wtbl index.
Adjust powersave filtering to make use of this in order to avoid running into
unnecessary timeouts while flushing

Signed-off-by: Felix Fietkau <[email protected]>
2023-07-25 21:06:12 +02:00
Felix Fietkau 53edfc7aaa wifi: mt76: mt7603: fix beacon interval after disabling a single vif
When disabling beacons on a vif, intval is 0. Ensure that dev->mt76.beacon_int
is not overwritten in this case, so that beacons continue to work for other
interfaces.

Signed-off-by: Felix Fietkau <[email protected]>
2023-07-25 12:38:02 +02:00
Felix Fietkau bb3937d5c3 wifi: mt76: mt7915: remove VHT160 capability on MT7915
The IEEE80211_VHT_CAP_EXT_NSS_BW value already indicates support for half-NSS
160 MHz support, so it is wrong to also advertise full 160 MHz support.

Fixes: c2f73eacee3b ("wifi: mt76: mt7915: add back 160MHz channel width support for MT7915")
Signed-off-by: Felix Fietkau <[email protected]>
2023-07-14 10:59:20 +02:00
Felix Fietkau f704e4f83c mt76: mt7915: fix copy&paste issue on capability check rework
Fixes disabling capabilities in AP mode via config

Reported-by: Money Wang (王信安) <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-07-04 06:04:08 +02:00
Felix Fietkau 1377f586c6 wifi: mt7915: move capability check to start_ap
Avoid using it for non-AP modes

Signed-off-by: Felix Fietkau <[email protected]>
2023-06-30 11:01:52 +02:00
Felix Fietkau d7d7479b00 wifi: mt7915: fix beaconing in mesh mode
The bringup sequence was fixed for AP mode, but not mesh

Signed-off-by: Felix Fietkau <[email protected]>
2023-06-30 11:01:20 +02:00
Felix Fietkau c50be0b54c wifi: mt76: mt7915: fix capabilities in non-AP mode
Capabilities in vif->bss_conf are only initialized in AP mode.
For other modes, they should be enabled by default, in order to avoid a
mismatch.

Fixes: 885f7af7e544 ("wifi: mt76: mt7915: remove mt7915_mcu_beacon_check_caps()")
Signed-off-by: Felix Fietkau <[email protected]>
2023-06-29 22:40:04 +02:00
Felix Fietkau f36b921692 Revert "wifi: mt76: mt76x02: remove WEP support
This reverts commit 40f6e433f7.

Signed-off-by: Felix Fietkau <[email protected]>
2023-06-27 13:37:05 +02:00
Felix Fietkau c85a0f2f09 mt7921: remove duplicated line
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-18 11:47:29 +02:00
Felix Fietkau d63cb85c12 wifi: mt76: add missing locking to protect against concurrent rx/status calls
According to the documentation, ieee80211_rx_list must not run concurrently
with ieee80211_tx_status (or its variants).

Cc: [email protected]
Fixes: 88046b2c9f6d ("mt76: add support for reporting tx status with skb")
Reported-by: Brian Coverstone <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-04-17 15:46:10 +02:00
Felix Fietkau 22f1b7776d mt76: adjust for ieee80211_is_bufferable_mmpdu API change
Signed-off-by: Felix Fietkau <[email protected]>
2023-03-30 11:08:19 +02:00
Felix Fietkau 8ecf551c6d wifi: mt76: set NL80211_EXT_FEATURE_CAN_REPLACE_PTK0 on supported drivers
Drivers that do not generate IV/PN in software can safely rekey PTK0

Signed-off-by: Felix Fietkau <[email protected]>
2023-03-30 11:07:53 +02:00
Felix Fietkau efa44cb57f 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: [email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2023-03-30 11:07:40 +02:00
Felix Fietkau 56f0cd4d5e wifi: mt76: mt7915 add tc offloading support
This is used for offloading flows from WLAN to Ethernet, or from WLAN to WLAN

Signed-off-by: Felix Fietkau <[email protected]>
2023-03-21 09:39:38 +01:00
Felix Fietkau f9ca70d636 wifi: mt76: mt7915: add back 160MHz channel width support for MT7915
A number of users reported that this support was working fine before
it got removed. Add it back, but leave out the unsupported 80+80 mode.

Fixes: ac922bd60ace ("wifi: mt76: mt7915: remove BW160 and BW80+80 support")
Signed-off-by: Felix Fietkau <[email protected]>
2023-03-01 16:36:55 +01:00
Felix Fietkau 09c6147348 Revert "wifi: mt76: mt7996: rely on mt76_connac2_mac_decode_he_radiotap"
This reverts commit fbf986dbd4.
2023-02-03 14:52:20 +01:00
Felix Fietkau e8c10835cf wifi: mt76: fix compile error without CONFIG_PAGE_POOL_STATS
Signed-off-by: Felix Fietkau <[email protected]>
2023-01-27 11:31:03 +01:00
Felix Fietkau 6c256218e5 wifi: mt76: dma: use napi_build_skb
Improves performance by using bulk allocation

Signed-off-by: Felix Fietkau <[email protected]>
2022-12-31 08:47:20 +01:00
Felix Fietkau 5b509e8038 wifi: mt76: dma: fix a regression in adding rx buffers
When adding WED support, mt76_dma_add_buf was accidentally changed to set
the skip_buf0 flag for tx buffers on the wrong queue descriptor entry.
Additionally, there is a rxwi leak when rx buffer allocation fails.

Fix this and make the code more readable by adding a separate function for
adding rx buffers.

Reported-by: Mikhail Gavrilov <[email protected]>
Tested-by: Mikhail Gavrilov <[email protected]>
Fixes: cd372b8c99c5 ("wifi: mt76: add WED RX support to mt76_dma_{add,get}_buf")
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-22 16:17:39 +01:00
Felix Fietkau a03ef0aab9 wifi: mt76: mt7921: fix deadlock in mt7921_abort_roc
When mt7921_abort_roc is called with dev->mutex held, it can deadlock while
calling cancel_work_sync(&phy->roc_work), because the work function could
be waiting to acquire the mutex.

Fix this by flushing the work before taking the mutex

Reported-by: Mikhail Gavrilov <[email protected]>
Fixes: 034ae28b56f1 ("wifi: mt76: mt7921: introduce remain_on_channel support")
Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-22 16:17:39 +01:00
Felix Fietkau ec46d7486a sync with upstream
Signed-off-by: Felix Fietkau <[email protected]>
2022-12-10 13:11:04 +01:00
Felix Fietkau e7a9f7a044 wifi: mt76: mt7915: fix unused-but-set warning
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-25 15:05:23 +01:00
Felix Fietkau 4bf2607362 wifi: mt76: fix dbdc number of spatial streams limit
Limit per-band streams to 2 instead of unconditionally dividing by 2

Fixes: 869815e5ef ("wifi: mt76: mt7915: Fix chainmask calculation on mt7915 DBDC")
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-12 19:13:25 +01:00
Felix Fietkau a9ac73ed82 wifi: mt76: mt7615: increase eeprom size for mt7663
mt7663 efuse has 0x600 bytes instead of 0x400. Increase the size in order
to fix issues with incomplete calibration data

Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 19:55:31 +01:00
Felix Fietkau f5034abea8 mt76: mt7915: fix format string
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 18:15:39 +01:00
Felix Fietkau 413a4bf395 mt76: mt7915: fix unused-but-set variable
Signed-off-by: Felix Fietkau <[email protected]>
2022-11-11 15:06:37 +01:00
Felix Fietkau 269df4b01f wifi: mt76: fix rx checksum offload on mt7615/mt7915/mt7921
Checking the relevant rxd bits for the checksum information only indicates
if the checksum verification was performed by the hardware and doesn't show
actual checksum errors. Checksum errors are indicated in the info field of
the DMA descriptor. Fix packets erroneously marked as CHECKSUM_UNNECESSARY
by checking the extra bits as well.
Those bits are only passed to the driver for MMIO devices at the moment, so
limit checksum offload to those.

Fixes: 2122dfbfd0bd ("mt76: mt7615: add rx checksum offload support")
Fixes: 94244d2ea503 ("mt76: mt7915: add rx checksum offload support")
Fixes: 0e75732764e8 ("mt76: mt7921: enable rx csum offload")
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-05 15:05:43 +02:00
Felix Fietkau 2182de50a3 wifi: mt76: fix receiving LLC packets on mt7615/mt7915
When 802.3 decap offload is enabled, the hardware indicates header translation
failure, whenever either the LLC-SNAP header was not found, or a VLAN header
with an unregcognized tag is present.
In that case, the hardware inserts a 2-byte length fields after the MAC
addresses. For VLAN packets, this tag needs to be removed. However,
for 802.3 LLC packets, the length bytes should be preserved, since there
is no separate ethertype field in the data.
This fixes an issue where the length field was omitted for LLC frames, causing
them to be malformed after hardware decap.

Fixes: 1eeff0b4c1a6 ("mt76: mt7915: fix decap offload corner case with 4-addr VLAN frames")
Reported-by: Chad Monroe <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-05 15:04:31 +02:00
Felix Fietkau 8cc34bdc9e wifi: mt76: mt7921: set MT_DRV_AMSDU_OFFLOAD for USB/SDIO
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-05 14:31:14 +02:00
Felix Fietkau 172d68b625 mt76: mt76x02: fix vht rate power array overrun
Signed-off-by: Felix Fietkau <[email protected]>
2022-10-01 17:01:59 +02:00
Felix Fietkau 3f27f6adb1 wifi: mt76: mt76x02: simplify struct mt76x02_rate_power
- remove stbc, because mt76x0 doesn't support it and mt76x2 uses the same
  values as HT/VHT
- reduce vht array to 2 elements, because VHT MCS0-7 are the same as HT

Signed-off-by: Felix Fietkau <[email protected]>
2022-09-28 11:29:46 +02:00
Felix Fietkau e49b6063fb wifi: mt76: move mt76_rate_power from core to mt76x02 driver code
Its layout and code is mt76x02 specific

Signed-off-by: Felix Fietkau <[email protected]>
2022-09-28 11:29:15 +02:00
Felix Fietkau d70546462b mt76: fix 5 GHz connection regression on mt76x0/mt76x2
Some users have reported being unable to connect to MT76x0 APs running mt76
after a commit enabling the VHT extneded NSS BW feature.
Fix this regression by ensuring that this feature only gets enabled on drivers
that support it

Fixes: d9fcfc1424aa ("mt76: enable the VHT extended NSS BW feature")
Signed-off-by: Felix Fietkau <[email protected]>
2022-09-06 22:39:56 +02:00
Felix Fietkau 5ec78e1ec4 wifi: mt76: fix reading current per-tid starting sequence number for aggregation
The code was accidentally shifting register values down by tid % 32 instead of
(tid * field_size) % 32.

Signed-off-by: Felix Fietkau <[email protected]>
2022-08-26 19:46:09 +02:00
Felix Fietkau 9485e3b470 mt76: remove q->qid
It is no longer used

Signed-off-by: Felix Fietkau <[email protected]>
2022-07-03 20:59:06 +02:00
Felix Fietkau 93e3fce916 mt76: pass original queue id from __mt76_tx_queue_skb to the driver
MT7615 and newer map multiple software tx queues to the hardware id

Signed-off-by: Felix Fietkau <[email protected]>
2022-07-03 17:52:25 +02:00
Felix Fietkau af406a2d1c mt76: do not use skb_set_queue_mapping for internal purposes
Previously the code used skb_set_queue_mapping for management or non-bufferable
powersave frames that need to be sent to a different hardware queue.
This can confuse AQL, which expects the value to remain the same until the tx
status report.
The only place that currently uses the altered skb queue mapping is the txwi
write function. Change the code to pass the hardware queue id as a function
parameter instead.

Signed-off-by: Felix Fietkau <[email protected]>
2022-07-02 15:57:02 +02:00
Felix Fietkau c07f459278 firmware: update mt7622 firmware to version 20220630
Signed-off-by: Felix Fietkau <[email protected]>
2022-07-01 18:42:47 +02:00
Felix Fietkau b6e865e2cc mt76: mt7615: fix throughput regression on DFS channels
For some reason, mt7615 reacts badly to repeatedly enabling/disabling the radar
detector without also switching the channel.
This results in very bad throughput on DFS channels, because
hw->conf.radar_enabled can get toggled a few times after CAC ends.
Fix this by always leaving the DFS detector enabled on DFS channels and instead
suppress unwanted detection events.

Fixes: 2c86f6752046 ("mt76: mt7615: fix/rewrite the dfs state handling logic")
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-24 21:08:25 +02:00
Felix Fietkau f2edd340dd mt76: allow receiving frames with invalid CCMP PN via monitor interfaces
This can be useful for debugging

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-23 14:21:20 +02:00
Felix Fietkau fd8211cf7c mt76: mt7921: sync with updated patch
Signed-off-by: Felix Fietkau <[email protected]>
2022-06-23 14:14:52 +02:00
Felix Fietkau ba39ed3b44 mt76: mt76x02: improve reliability of the beacon hang check
Increment the counter only when writing beacons to the hardware in order
to avoid triggering restarts if beacons are disabled.
Additionally, avoid resetting the MAC if stopping it failed

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-23 14:10:22 +02:00
Felix Fietkau 4fb991f2c9 mt76: mt7615: add sta_rec with EXTRA_INFO_NEW for the first time only
Set EXTRA_INFO_NEW for the first time only to prevent adding the same
starec entry, otherwise the entry might be removed in fw.

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-22 14:11:23 +02:00
Felix Fietkau e522834390 mt76: mt7915: disable UL MU-MIMO for mt7915
After initially establishing a connection, it can produce multi-second latency
spikes and tx hangs when pushing traffic.
It should work better for MT7916 and MT7986, so leave it enabled there

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-21 20:35:36 +02:00
Felix Fietkau 1d8af168e8 mt76: mt7615: add missing bh-disable around rx napi enable/schedule
napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq
handling, so it must not be called in a pure process context with BH enabled.

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:45:37 +02:00
Felix Fietkau 28b19d2cc5 mt76: mt7915: add missing bh-disable around tx napi enable/schedule
napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq
handling, so it must not be called in a pure process context with BH enabled.

Signed-off-by: Felix Fietkau <[email protected]>
2022-06-02 21:45:33 +02:00
Felix Fietkau a666d5637b mt76: fix tx status related use-after-free race on station removal
There is a small race window where ongoing tx activity can lead to a skb
getting added to the status tracking idr after that idr has already been
cleaned up, which will keep the wcid linked in the status poll list.
Fix this by only adding status skbs if the wcid pointer is still assigned
in dev->wcid, which gets cleared early by mt76_sta_pre_rcu_remove

Fixes: bd1e3e7b693c ("mt76: introduce packet_id idr")
Tested-by: Ben Greear <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-04-23 07:12:47 +02:00
Felix Fietkau eecbb49920 mt76: fix encap offload ethernet type check
The driver needs to check if the format is 802.2 vs 802.3 in order to set
a tx descriptor flag. skb->protocol can't be used, since it may not be properly
initialized for packets coming in from a packet socket.
Fix misdetection by checking the ethertype from the skb data instead

Reported-by: Thibaut VARÈNE <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-04-20 14:32:21 +02:00
Felix Fietkau f50672518b mt76: do not attempt to reorder received 802.3 packets without agg session
Fixes potential latency / packet drop issues in cases where a BA session has
not (yet) been established.

Fixes: e195dad14115 ("mt76: add support for 802.3 rx frames")
Signed-off-by: Felix Fietkau <[email protected]>
2022-04-20 13:21:45 +02:00
Felix Fietkau d4937118ec mt76: fix rx reordering with non explicit / psmp ack policy
When the QoS ack policy was set to non explicit / psmp ack, frames are treated
as not being part of a BA session, which causes extra latency on reordering.
Fix this by only bypassing reordering for packets with no-ack policy

Signed-off-by: Felix Fietkau <[email protected]>
2022-04-20 12:27:38 +02:00
Felix Fietkau 87a962e060 mt76: mt7915: add Wireless Ethernet Dispatch support
This is used to support hardware flow offloading from Ethernet to WLAN

Signed-off-by: Felix Fietkau <[email protected]>
2022-04-07 11:56:24 +02:00
Felix Fietkau b8c842daa0 mt76: make number of tokens configurable dynamically
Preparation for adding Wireless Ethernet Dispatch support

Signed-off-by: Felix Fietkau <[email protected]>
2022-03-29 13:13:27 +02:00
Felix Fietkau e0bc736d56 mt76: add support for overriding the device used for DMA mapping
WED support requires using non-coherent DMA, whereas the PCI device might
be configured for coherent DMA.
The WED driver will take care of changing the PCI HIF coherent IO setting
on attach.

Signed-off-by: Felix Fietkau <[email protected]>
2022-03-29 13:13:27 +02:00
Felix Fietkau 5beb87716e mt76: dma: add wrapper macro for accessing queue registers
Preparation for adding indirection used for Wireless Ethernet Dispatch support

Signed-off-by: Felix Fietkau <[email protected]>
2022-03-29 13:13:24 +02:00
Felix Fietkau eed44048ca Revert "mt76: dma: reduce lock contention in mt76_dma_tx_cleanup"
This reverts commit 2e51013b38.
2022-03-29 13:09:02 +02:00
Felix Fietkau 376ea8152b mt76: mt7915: add missing chunk from wfsys reset fix
Signed-off-by: Felix Fietkau <[email protected]>
2022-03-28 10:21:42 +02:00
Felix Fietkau 6b1efcd729 mt76: mt7915: fix wfsys reset regression
Reset needs to be performed before hif2 initialization

Signed-off-by: Felix Fietkau <[email protected]>
2022-03-27 21:18:58 +02:00
Felix Fietkau 5b7dd093c8 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: [email protected]
Reported-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2022-03-25 22:08:28 +01:00
Felix Fietkau 36c23a4a84 mt76: mt7921: accept rx frames with non-standard VHT MCS10-11
The hardware receives them properly, they should not be dropped

Signed-off-by: Felix Fietkau <[email protected]>
2022-03-25 21:15:15 +01:00
Felix Fietkau c2bb44cab5 mt76: mt7915: accept rx frames with non-standard VHT MCS10-11
The hardware receives them properly, they should not be dropped

Signed-off-by: Felix Fietkau <[email protected]>
2022-03-25 21:14:29 +01:00