Commit Graph
703 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau a6915cbc99 mt76: move MT_TXD_INFO, MT_MCU_MSG and MT_RX_FCE_INFO defs in dma.h
Since MT_TXD_INFO, MT_MCU_MSG and MT_RX_FCE_INFO definitions are in
common between mt76x2u, mt76x2 and mt76x0u move them in dma.h in order
to reuse usb code supporting mt76x2u and mt76x0u based devices

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 016df9cc4c mt76x2: debugfs: add sw pulse statistics to dfs debugfs
Add sw pattern detector statistics to mt76x2 debugfs.
Moreover track down number of allocated sequence by the detector

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau df8071f58c mt76x2: dfs: add sw pattern detector
Add sw DFS pattern detector support for mt76x2 based devices.
Dfs pattern supported:
- short pulse radar patterns
- staggered radar patterns

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 0f6379a72b mt76x2: dfs: add sw event ring buffer
Introduce sw event ring buffer to queue DFS pulses loaded from the hw.
Radar pulses will be used in DFS sw detector

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 0d42d226de mt76: introduce mt76_{incr,decr} utility routines
Add mt76_{incr,decr} utility routines to increment/decrement a value
with wrap-around (they will be used by mt76x2 DFS sw detector)

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau d00c6169c7 mt76x2: fix mrr idx/count estimation in mt76x2_mac_fill_tx_status()
Fix mcs and attempt count estimation in mt76x2_mac_fill_tx_status routine
if the number of tx retries reported by the hw is grater than
IEEE80211_TX_MAX_RATES

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau fbf4791e22 mt76x2: fix TXD_INFO bitmask definition
Despite this issue is not harmful since it is not actually used in
mt76 driver, fix DMA txinfo bitmask definition

Fixes: 7bc04215a66b ('mt76: add driver code for MT76x2e')
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 38014de244 mt76x2: remove unnecessary break in mt76x2_mac_process_tx_rate()
Remove unnecessary break statement in the default case of bw switch
block in mt76x2_mac_process_tx_rate routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
2018-09-11 13:49:19 +02:00
Lorenzo BianconiandFelix Fietkau 3f0ac3557b mt76x2: init: disable APCLI by default
It is no longer necessary for client mode operation, vif index entries
8-16 are no longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2018-09-11 13:49:19 +02:00
Felix Fietkau 8ba17b1825 Revert "mt76: use a per rx queue page fragment cache"
Will be added back after merging upstream changes

Signed-off-by: Felix Fietkau <[email protected]>
2018-09-11 13:49:15 +02:00
Felix Fietkau 0853d79366 Revert "mt76x2: add functions for setting extended MAC address registers"
This reverts commit 68b0cf17ef.
Not used at the moment, will be added back later, when needed.

Signed-off-by: Felix Fietkau <[email protected]>
2018-08-25 13:17:16 +02:00
Felix Fietkau d220f4383a Revert "mt76x2: reset HW before probe"
This reverts commit 4d2c565653.
Will be added back later after mt76x2u rework

Signed-off-by: Felix Fietkau <[email protected]>
2018-08-25 13:17:16 +02:00
Felix Fietkau 30b8371ad7 mt7603: fix BAR rate
The mask is wider, and the rate should be configured to OFDM 6M

Signed-off-by: Felix Fietkau <[email protected]>
2018-08-24 14:00:05 +02:00
Felix Fietkau 980c60666e mt7603: add fix for CCA signal configuration
Allow preamble detection to block tx

Signed-off-by: Felix Fietkau <[email protected]>
2018-08-24 12:22:26 +02:00
Felix Fietkau 7daf9621ad mt7603: add survey support
Since channel active time is not available from MIB registers, emulate it
using the kernel boot time (in us)

Signed-off-by: Felix Fietkau <[email protected]>
2018-08-22 12:26:35 +02:00
Lorenzo BianconiandFelix Fietkau 6780375236 mt76x2: add frame protection support
Introduce mac80211 rts threshold handler in order to add frame
protection support to mt76x2 driver

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-07-13 16:33:44 +02:00
Lorenzo BianconiandFelix Fietkau f622975a99 mt76x2: fix CCK protection control frame rate
Use 11M as tx rate for CCK protection control frames

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-07-13 16:32:33 +02:00
Stanislaw GruszkaandFelix Fietkau 4d2c565653 mt76x2: reset HW before probe
Signed-off-by: Stanislaw Gruszka <[email protected]>
2018-07-13 16:30:17 +02:00
Felix Fietkau 08719b1129 mt76: use a per rx queue page fragment cache
Using the NAPI or netdev frag cache along with other drivers can lead to
32 KiB pages being held for a long time, despite only being used for
very few page fragments.

This can happen if the driver grabs one or two fragments for rx ring
refill, while other drivers use (and free up) the remaining fragments.
The 32 KiB higher-order page can only be freed once all users have freed
their fragments.

Depending on the traffic patterns, this can waste a lot of memory and
look a lot like a memory leak.

Signed-off-by: Felix Fietkau <[email protected]>
2018-07-13 16:28:41 +02:00
Felix Fietkau 1d4ca10a56 mt76x2: track rssi for gain adjustment per station
This preserves more sensitivity when weak stations are active

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-19 11:15:19 +02:00
Felix Fietkau f450659334 mt76x2: improve gain adjustment in noisy environments
When switching between low gain (high RSSI) and high gain settings, it
can take a few seconds to adjust to the current environment.
This can lead to short periods of time with extreme packet loss.

When switching from low_gain=1 to low_gain=2, start with the same gain
adjustment value instead of the lowest to avoid spikes of huge numbers
of false CCA events

Also avoid resetting adjustment values on switching between low_gain
values 0 and 1, since it affects only the upper limit of vga adjustment

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-18 12:27:02 +02:00
Lorenzo BianconiandFelix Fietkau 072fdac8d6 mt76x2: mac: consider multicast/broadcast frames in ewma rssi estimation
Take into account rx multicast and broadcast frames from connected AP in
ewma rssi estimation

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-06-18 12:09:16 +02:00
Felix Fietkau 65e161bec8 mt76x2: fix tracking rssi for dynamic gain adjustment
Only use unicast rssi, to avoid counting signal data from other
networks.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 20:49:55 +02:00
Felix Fietkau f3522e1d2b mt76x2: add a debugfs file to dump agc calibration information
Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 19:12:14 +02:00
Felix Fietkau 1528fe7f57 mt76x2: fix variable gain adjustment range
The range should only be limited to 4 for really weak signals, for all
other gain settings the range is 16.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 19:02:24 +02:00
Felix Fietkau 4936c0cef0 mt76x2: clear false CCA counters after changing gain settings
They will be read on the next calibration step without gain change and
must not count earlier events

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:56:58 +02:00
Felix Fietkau a39ab7043a mt76x2: adjust AGC control register 26 based on gain for VHT80
Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:41:20 +02:00
Felix Fietkau 2cbaa57a77 mt76x2: fix swapped values for RXO-18 in gain control
The lowest bit should be set to 0 only for strong links, not for weak
ones.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:28:53 +02:00
Felix Fietkau 9090f9c705 mt76x2: fix threshold for gain adjustment
The gain should be reduced only for very strong connections, not for mid
range.

Signed-off-by: Felix Fietkau <[email protected]>
2018-06-15 18:27:54 +02:00
Felix Fietkau 792dbe0261 mt7603: do not hold dev->mutex while flushing dev->mac_work
Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau fcbb49e863 mt76x2: use udelay instead of usleep_range in mt76x2_mac_stop
usleep_range can cause excessive latency on channel change if waiting
for the MAC to stop fails. It will be forced to stop by the code
following that loop anyway.

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau 730c292a2c mt76: wait for pending tx to complete before switching channel
Reduces interruption caused by scanning

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau 21c1e1eae5 mt76: move ieee80211_hw allocation to common core
Allows it to be shared between different drivers and locks to be
initialized earlier

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau f399da3b2e mt76: prevent tx scheduling during channel change
Re-schedule tx afterwards

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau 0ef26ef052 mt76: only stop tx queues on offchannel, not during the entire scan
During scans, mac80211 frequently switches back to the home channel to
minimize interruption of ongoing traffic. Keep regular tx queues active
during that time.

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau d87e4b0252 mt7603: clear PSE reset bit if PSE reset fails
If the firmware is blocked, it should not continue to attempt a reset
until it is safe to do so

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-20 07:57:25 +02:00
Felix Fietkau f24b56f935 update MT7628 firmware to the latest version
Signed-off-by: Felix Fietkau <[email protected]>
2018-05-19 10:52:29 +02:00
Felix Fietkau 664e32171c mt7603: add extra PSE hang check signature for MT7628
Signed-off-by: Felix Fietkau <[email protected]>
2018-05-19 10:48:48 +02:00
Felix Fietkau 20c0766c8f mt7603: adjust rx hang watchdog for MT7628
The MT7628 vendor driver checks a different DMA debug register compared to
MT7603.

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-19 10:48:33 +02:00
Felix Fietkau 0b8d1ddec9 mt76: fix beacon timer drift
The beacon timer drifts by 1 microsecond every TBTT. After 20 minutes
with a beacon interval of 100, the drift will be almost 12 ms, enough to
cause weird issues for devices in powersave mode.

Since the beacon timer is configured in units of 1/16 TU (64 us), we
need to adjust it once every 64 beacons and only for one beacon.

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-18 17:46:01 +02:00
Felix Fietkau 73edb22822 mt76: discard early received packets if not running yet
If the radio was previously in running state, it can receive some
packets before it is able to process them.
This can lead to a crash if the channel is not initialized yet.
Discard all rx packets until start() is called

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-15 14:28:28 +02:00
Lorenzo BianconiandFelix Fietkau e87f925667 mt76x2: apply coverage class on slot time too
According to 802.11-2007 17.3.8.6 (slot time), the slot time should
be increased by 3 us * coverage class. Taking into account coverage
class in slot time configuration allows to increase by an order of
magnitude the throughput on a 4Km link in a noisy environment

Tested-by: Luca Bisti <[email protected]>
Tested-by: Gaetano Catalli <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-05-15 13:16:16 +02:00
Felix Fietkau a78673d523 mt76: fix sending encrypted broadcast packets for secondary interfaces
For encryption to work properly, the BSS index needs to be initialized
for the WCID entry used for the interface.

Signed-off-by: Felix Fietkau <[email protected]>
2018-05-15 13:03:31 +02:00
Lorenzo BianconiandFelix Fietkau fd58b28292 mt76x2: add a polling delay in mt76x2_mac_stop routine
Add a usleep_range in mt76x2_mac_stop routine in order to add
a polling delay checking values of MT_MAC_STATUS and IBI_R12 registers

Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-05-10 18:28:18 +02:00
Lorenzo BianconiandFelix Fietkau b2ecc529b4 mt76x2: fix avg_rssi estimation
Add leftover filter coefficients in IIR rssi estimation

Fixes: 7bc04215a66b ("mt76: add driver code for MT76x2e")
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-05-03 13:38:49 +02:00
Felix Fietkau e2eedc9229 mt7603: retry PSE reset calls
PSE reset can fail and a subsequent reset could recover it again

Signed-off-by: Felix Fietkau <[email protected]>
2018-04-18 11:53:24 +02:00
Lorenzo BianconiandFelix Fietkau e08d5dab5d mt76x2: fix is_mt7612 routine
Fix is_mt7612 routine since asic version is set in mt76_dev revision
field and not in mt76x2_dev one.
Moreover remove mt76x2_dev rev field since it is never used in the
driver

Fixes: 7bc04215a66b ('mt76: add driver code for MT76x2e')
Signed-off-by: Lorenzo Bianconi <[email protected]>
2018-04-18 09:39:48 +02:00
Felix Fietkau ec8435e711 mt76: initialize rx lock earlier
Fixes lockdep warning on mt7603

Signed-off-by: Felix Fietkau <[email protected]>
2018-04-18 09:38:07 +02:00
Felix Fietkau ca5cc9a478 mt76: fix concurrent rx calls on A-MPDU release
Add a spinlock in mt76_rx_complete. Without this, multiple stats updates
could happen in parallel, which can lead to deadlocks. There are
probably more corner cases fixed by this change.

Signed-off-by: Felix Fietkau <[email protected]>
2018-04-17 14:49:29 +02:00
Felix Fietkau 8c92c91abe mt7603: turn vif wcid entry back into a full mt7603_sta
The tx status reporting code needs access to mt7603_sta members for rate
status processing.

Signed-off-by: Felix Fietkau <[email protected]>
2018-04-16 12:07:53 +02:00