Commit Graph
1193 Commits
Author SHA1 Message Date
Felix Fietkau 4206db7157 mt76: set IEEE80211_HW_NEEDS_UNIQUE_STA_ADDR flag
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]>
2019-01-16 22:33:23 +01:00
Felix Fietkau 4bcb2f9fe2 mt7603: fix txd q_idx field value
Use 802.11e ACI values - the vendor driver does the same

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-16 19:56:18 +01:00
Felix Fietkau 9d11596ec6 mt7603: discard bogus tx status data
If parsing tx status information fails, do not report any rates to mac80211

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-16 19:55:42 +01:00
Felix Fietkau e45db12888 mt7603: fix tx status info
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]>
2019-01-16 19:53:45 +01:00
Felix Fietkau 63bf183451 mt76: add channel switch announcement support
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-15 14:27:02 +01:00
Felix Fietkau d273ddd9e3 mt7603: fix number of frames limit in .release_buffered_frames
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-15 12:50:01 +01:00
Lorenzo BianconiandFelix Fietkau a946b78acf mt76: add led support to mt76x0e driver
Move mt76x02 led support in mt76x02-lib module in order to
add tpt led trigger to mt76x0e driver

Tested-by: LGA1150 <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-01-11 15:24:32 +01:00
Arnd BergmannandFelix Fietkau d1bc504955 mt76: fix building without CONFIG_LEDS_CLASS
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]>
2019-01-11 15:24:32 +01:00
Lorenzo BianconiandFelix Fietkau eca96cd856 mt76: use proper name for __MT76x02_H macro
Use proper name for __MT76x02_H macro in mt76x02.h

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-11 15:24:32 +01:00
Felix Fietkau d77c861208 mt76: fix rssi ewma tracking
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]>
2019-01-11 15:24:32 +01:00
Felix Fietkau 2ad54b2f25 mt76: move wcid rssi ewma init to mt76 core
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-11 15:24:32 +01:00
Felix Fietkau 8167074dab Revert "mt7603: update firmware to 20161027164355"
This reverts commit f2ba65f73f
This firmware update has been reported to cause regressions on some devices

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-11 15:24:32 +01:00
Felix Fietkau f84b008222 mt76: fix tx status reporting for non-probing frames
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]>
2019-01-11 15:24:32 +01:00
Lorenzo BianconiandFelix Fietkau 7d4a95c8dd mt76: dma: avoid indirect call in mt76_dma_tx_queue_skb
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]>
2018-12-31 15:45:10 +01:00
Colin Ian KingandFelix Fietkau 9daa5ff1fd mt76: make const array 'data' static, shrinks object size
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]>
2018-12-31 15:45:10 +01:00
Felix Fietkau 48fb0116f0 mt7603: fix CF-End transmit rate when 11b stations are connected
Use a CCK rate in that case

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-30 17:08:40 +01:00
Felix Fietkau 24ec040a97 mt7603: fix BSSID configuration in AP mode
Fixes BSSID value in self-generated frames, such as CF-End

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-30 16:41:17 +01:00
Felix Fietkau 962152bd73 mt7603: fix WMM TXOP limit configuration
The config registers are swapped, AC2/AC3 comes before AC1/AC0

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-30 16:10:59 +01:00
Felix Fietkau 2a092e2b1d mt7603: fix per-rate retry accounting
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]>
2018-12-29 19:42:15 +01:00
Felix Fietkau 148219d572 mt7603: fix checkpatch issues
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-29 13:27:35 +01:00
Felix Fietkau bce700dd0c mt7603: fix signal strength reporting on single-stream devices
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]>
2018-12-29 13:03:20 +01:00
Felix Fietkau 58988a314d mt76: fix signedness of rx status signal field
It is usually negative, so it needs to be signed.

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-29 13:01:49 +01:00
Lorenzo BianconiandFelix Fietkau 3598046d01 mt76: mmio: introduce mt76x02_check_tx_hang watchdog
Port mt76x02_check_tx_hang watchdog from vendor driver in order to
perform a device reset when tx mac/dma logic hangs. Tx mac/dma stuck
has been observed when the device is heavy loaded or in a noisy
environment. Moreover introduce wdt delayed work in order to run
tx_hang watchdog. For the moment run mt76x02_check_tx_hang watchdog
just on mt76x2 devices since the issue has not been observed on mt76x0
driver yet

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 16:16:41 +01:00
Lorenzo BianconiandFelix Fietkau c78e317701 mt76: dma: do not build skb if reported len does not fit in buf_size
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]>
2018-12-28 16:15:53 +01:00
Lorenzo BianconiandFelix Fietkau 876d0e95bc mt76: mac: minor optimizations in mt76x02_mac_tx_rate_val
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]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 9661da4580 mt76: add energy detect CCA support to mt76x{0,2}e drivers
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]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 51b6daf6b2 mt76x2: init: set default value for MT_TX_LINK_CFG
Update default value for MT_TX_LINK_CFG according to vendor driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 37b2ad3449 mt76: dfs: run mt76x02_dfs_set_domain atomically
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]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 10f57cf795 mt76x2: add static qualifier to mt76x2_init_hardware
Add static qualifier to mt76x2_init_hardware routine since it is
used just in pci_init.c

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Stanislaw GruszkaandFelix Fietkau f7d8c17573 mt76x0: configure MT_VHT_HT_FBK_CFG1
Configure MT_VHT_HT_FBK_CFG1 values similar like vendor driver.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-12-28 13:43:56 +01:00
Stanislaw GruszkaandFelix Fietkau 628f8d72e2 mt76x02: set protection according to ht operation element
Configure protection based on information that are provided to
us either by remote AP or by hostapd via HT operation IE.

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-12-28 13:43:56 +01:00
Stanislaw GruszkaandFelix Fietkau 0d83d73b2e mt76x02: fixup MT_PROT_RATE_* defines
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]>
2018-12-28 13:43:56 +01:00
Stanislaw GruszkaandFelix Fietkau d94e9c4c44 mt76x02: do not set protection on set_rts_threshold callback
Use set_rts_threshold calback to enable/disable threshold only for
legacy traffic.

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

Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 40dad3240f mt76x0: pci: fix ACS support
Fix Automatic Channel Selection (ACS) support in mt76x0e driver
configuring properly MT_CH_TIME_CFG register

Fixes: 6250318694ca ("mt76x0: pci: add get_survey support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 6be90b667a mt76: usb: avoid queue/status spinlocks while passing tx status to mac80211
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]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 9c9fae34bc mt76: mac: run mt76x02_mac_work routine atomically
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]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 1d2819e39e mt76: fix typo in mt76x02_check_mac_err routine
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]>
2018-12-28 13:43:56 +01:00
Hauke MehrtensandFelix Fietkau eb076ae8db mt76: Add missing include of linux/module.h
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]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau 0490bd2126 mt76: usb: do not build the skb if reported len does not fit in buf_size
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]>
2018-12-28 13:43:56 +01:00
Lorenzo BianconiandFelix Fietkau e67e551496 mt76: dma: remove napi from mt76_dma_rx_fill signature
Remove napi from mt76_dma_rx_fill routine signature since
it is a leftover of a previous implementation and it is no
longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-12-28 13:43:56 +01:00
Weijie GaoandFelix Fietkau 8178f0d2ce mt7603: apply efuse data only when it exists
Some mt7603e chip has empty efuse data.
In this case driver will crash due to dereferencing NULL pointer.

The mt7603_eeprom_load will return success directly if the chip has no efuse
data and dev->mt76.otp.data is left empty, i.e. NULL pointer.
The mt7603_eeprom_init will then try to dereference dev->mt76.otp.data
without checking its value.

This patch adds a check around these codes to prevent kernel panic.

Signed-off-by: Weijie Gao <[email protected]>
2018-12-11 14:11:39 +01:00
Felix Fietkau 294e095a48 mt7603: reset DMA scheduler on MT7628
Should improve stability

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-09 17:18:12 +01:00
Felix Fietkau 6203d46fcc mt7603: add support for setting transmit power
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-06 14:38:07 +01:00
Felix Fietkau b2cc29b905 mt76: move mt76x02_get_txpower to mt76 core
It will be reused by mt7603 later

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-06 14:30:00 +01:00
Felix Fietkau 2c8e9acb40 mt7603: initialize channel maximum power from eeprom data
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-06 14:13:29 +01:00
Felix Fietkau 9d009be68d mt7603: add dynamic sensitivity tuning based on false CCA events
This reduces sensitivity in cases where it could help throughput/stability.

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-05 18:26:20 +01:00
Felix Fietkau fea7ad804e mt76: move mt76x02_phy_get_min_avg_rssi to mt76 core
This will be used by mt7603 as well

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-05 17:06:59 +01:00
Felix Fietkau 417ab779a0 mt7603: improve recovery from PSE reset failure
Only clear reset status and switch to DMA reset after 3 tries.

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-05 15:31:43 +01:00
Felix Fietkau da00af00c5 mt7603: clear bit 18 in MT_SEC_SCR to fix ICV error
Ported from vendor driver

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-04 12:22:21 +01:00
Felix Fietkau 0ad998b6ff mt7603: increase aggregation limits (based on vendor driver changes)
Signed-off-by: Felix Fietkau <[email protected]>
2018-12-04 12:22:21 +01:00