Take into account device rx stream in mt76x02_mac_process_rate
in order to not report wrong number of rx spatial stream to mac80211.
The issue has been reported on mt76x0 device which is 1x1:1 however
the hw sometimes reports rx nss equal to 2
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Sync CCK values with reference driver.
Use OFDM values obtained from the hardware reset value
Stop tx/rx on change only using the ARB_SCR register
Signed-off-by: Felix Fietkau <[email protected]>
The hardware needs to be notified of peers using dynamic SMPS mode
Fixes using dual-stream rates on some clients (e.g. Intel)
Signed-off-by: Felix Fietkau <[email protected]>
Clear pending PSE request bit in order to avoid having it trigger by the
firmware at a bad point in time.
Only clear AC queue stuck bits if the PSE reset succeeded
Signed-off-by: Felix Fietkau <[email protected]>
The hardware cannot report accurate tx A-MPDU length information, so tell rate
control to ignore it. Improves tx rate selection
Signed-off-by: Felix Fietkau <[email protected]>
The hardware does not deal with multiple WCID entries for the same station
properly. Set IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR to avoid those cases
Signed-off-by: Felix Fietkau <[email protected]>
Reporting A-MPDU length from txs does not work, because only completed
subframes are reported. Trying to aggregate tx status report for one
completed A-MPDU does not work, because individual subframe retries can
be different.
Do not report A-MPDU length > 1 and pass individual subframe tx status
information to mac80211 to fix rate control errors
Signed-off-by: Felix Fietkau <[email protected]>
Move mt76x02 led support in mt76x02-lib module in order to
add tpt led trigger to mt76x0e driver
Tested-by: LGA1150 <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
When CONFIG_LEDS_CLASS is disabled, or it is a loadable module while
mt76 is built-in, we run into a link error:
drivers/net/wireless/mediatek/mt76/mac80211.o: In function `mt76_register_device':
mac80211.c:(.text+0xb78): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `devm_of_led_classdev_register'
We don't really need a hard dependency here as the driver can presumably
work just fine without LEDs, so this follows the iwlwifi example and
adds a separate Kconfig option for the LED support, this will be available
whenever it will link, and otherwise the respective code gets left out from
the driver object.
Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Use proper name for __MT76x02_H macro in mt76x02.h
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
The generic EWMA code cannot deal with negative numbers, so convert signal
to a positive number before adding it
Fixes mt76x2 AGC tuning
Signed-off-by: Felix Fietkau <[email protected]>
This reverts commit f2ba65f73f
This firmware update has been reported to cause regressions on some devices
Signed-off-by: Felix Fietkau <[email protected]>
On MT76x2, the hardware does not report tx status in the FIFO register,
if the packet id is 0.
Change the allocation of packet IDs to use 0 for no-ack packets, 1 for
non-probing packets and 2-255 for packets with tx status requested.
Fixes rate control issues
Signed-off-by: Felix Fietkau <[email protected]>
Call mt76_dma_add_buf routine directly in mt76_dma_tx_queue_skb
and avoid indirect call if not necessary
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Don't populate the const array 'data' on the stack but instead
make it static. Makes the object code smaller by 78 bytes:
Before:
text data bss dec hex filename
5438 1080 0 6518 1976 mediatek/mt76/mt76x2/usb_mcu.o
After:
text data bss dec hex filename
5296 1144 0 6440 1928 mediatek/mt76/mt76x2/usb_mcu.o
(gcc version 8.2.0 x86_64)
Signed-off-by: Colin Ian King <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
Each rate retry slot takes up MT7603_RATE_RETRY tries, and cannot be altered
based on mac80211 provided rate retry counts.
Signed-off-by: Felix Fietkau <[email protected]>
The second chain value is 0 if the second chain is disabled, which
would make the reported signal strength 0 as well.
Signed-off-by: Felix Fietkau <[email protected]>
Port mt76x02_check_tx_hang watchdog from vendor driver in order to
perform a device reset when tx mac/dma logic hangs. Tx mac/dma stuck
has been observed when the device is heavy loaded or in a noisy
environment. Moreover introduce wdt delayed work in order to run
tx_hang watchdog. For the moment run mt76x02_check_tx_hang watchdog
just on mt76x2 devices since the issue has not been observed on mt76x0
driver yet
Signed-off-by: Lorenzo Bianconi <[email protected]>
Precompute data length in order to avoid to allocate the related
skb data structure if reported length does not fit in queue buf_size
Signed-off-by: Lorenzo Bianconi <[email protected]>
Do not set bw variable to zero for legacy rates since it is already
initialized to zero. Moreover set nss to 1 just for legacy rates
since nss will be properly set for VHT/HT rates
Signed-off-by: Lorenzo Bianconi <[email protected]>
Ported from the reference driver. Should fix compliance with ETSI
regulatories on preventing transmission while energy detect values
are above the threshold.
The code has been tested using an ath9k device running tx99 as
noise generator
Signed-off-by: Lorenzo Bianconi <[email protected]>
Grab mt76_dev mutex in mt76x02_dfs_set_domain since it runs
concurrently with mt76x{0,2}_set_channel routines
Signed-off-by: Lorenzo Bianconi <[email protected]>
Configure protection based on information that are provided to
us either by remote AP or by hostapd via HT operation IE.
Signed-off-by: Stanislaw Gruszka <[email protected]>
On new mt76 chips, phy mode is configured by last 3 bits
of rate value. Hence OFDM bit is marked by 0x2000
instead of 0x4000.
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Stanislaw Gruszka <[email protected]>
Use set_rts_threshold calback to enable/disable threshold only for
legacy traffic.
Protection for HT and VHT traffic is defined by HT operation element
and it's provided by remote AP or by hostapd.
Signed-off-by: Stanislaw Gruszka <[email protected]>
As already done for pcie code in commit 79d1c94c9c78 ("mt76: avoid
queue/status spinlocks while passing tx status to mac80211") make sure
that no tx related spinlocks are taken during the ieee80211_tx_status call
Signed-off-by: Lorenzo Bianconi <[email protected]>
Grab mt76_dev mutex in mt76x02_mac_work handler since it runs
concurrently with mt76x{0,2}_set_channel routines
Signed-off-by: Lorenzo Bianconi <[email protected]>
Reconfigure properly MT_MAC_SYS_CTRL register after mac sw-reset
in mt76x02_check_mac_err routine
Fixes: 73556561ab9f ("mt76x0: use mt76x02_mac_work as stats handler")
Signed-off-by: Lorenzo Bianconi <[email protected]>
MODULE_FIRMWARE() is used in usb_mcu.c and provided by linux/module.h,
but this header file is not directly included. This causes problems in
backports with some kernel versions.
Add the missing include.
Signed-off-by: Hauke Mehrtens <[email protected]>