Commit Graph
71 Commits
Author SHA1 Message Date
Felix Fietkau 0b6520bd1c mt7603: rework and fix tx status reporting
Tx status reporting on mt7603 has a number of issues:

- the hardware can alter the first rate index, but it is not reported to
  the driver
- probing is very imprecise, because it alters the per-client rate set,
  but only considers info->status.rates for rate selection of a single probe
  packet
- short/long GI selection has limitations, which are not accurately reported
  to mac80211
- if rates are changed while packets are in flight, tx status reports for
  the old rate set might be processed based on the new selection

This led to very suboptimal rate selection with minstrel_ht.

This patch completely reworks tx status reporting to get rid of these
limitations:

- Store the previous and current rate set in the driver + the TSF value
  at the time of the switch.
- Use the tx status TSF value to determine which rate set needs to be used
  as reference.
- Report only short or long GI rates for a single status event, not a mix.
- The hardware reports the last used rate index. Use it along with the
  retry count to figure out what rate was used for the first attempt.
- Use the same retry count value for all rate slots to make this calculation
  work.
- Derive the probe rate from the current rateset instead of the skb cb
- Do not wait for a status report for the probe frame before removing the
  probe rate from the rate table. Do it immediately after it was referenced
  in a tx status report.
- Use the first half of the first rate retry budget for the probe rate
  in order to avoid using too many retries on that rate

With this patch, throughput under bad link conditions is improved
significantly, and there is a lot less rate fluctuation going on.

Signed-off-by: Felix Fietkau <[email protected]>
2019-06-25 00:03:50 +02:00
YueHaibingandFelix Fietkau 661c7c8e1a mt76: Remove set but not used variables 'pid' and 'final_mpdu'
Fixes gcc '-Wunused-but-set-variable' warnings:

drivers/net/wireless/mediatek/mt76/mt7603/mac.c: In function mt7603_fill_txs:
drivers/net/wireless/mediatek/mt76/mt7603/mac.c:969:5: warning: variable pid set but not used [-Wunused-but-set-variable]
drivers/net/wireless/mediatek/mt76/mt7603/mac.c:961:7: warning: variable final_mpdu set but not used [-Wunused-but-set-variable]
drivers/net/wireless/mediatek/mt76/mt7615/mac.c: In function mt7615_fill_txs:
drivers/net/wireless/mediatek/mt76/mt7615/mac.c:555:5: warning: variable pid set but not used [-Wunused-but-set-variable]
drivers/net/wireless/mediatek/mt76/mt7615/mac.c:552:19: warning: variable final_mpdu set but not used [-Wunused-but-set-variable]

They are never used, so can be removed.

Signed-off-by: YueHaibing <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-07 19:00:05 +02:00
Lorenzo BianconiandFelix Fietkau 5b9b62e0b0 mt76: move mt76_get_rate in mt76-module
Move mt7603_get_rate in mac80211.c and rename it to mt76_get_rate
since it is shared between mt7603 and mt7615 drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-07 19:00:05 +02:00
Lorenzo BianconiandFelix Fietkau 899efe755b mt76: move mt76_insert_ccmp_hdr in mt76-module
Move mt7615_insert_ccmp_hdr in mac80211.c and rename it in
mt76_insert_ccmp_hdr since it is shared between mt7603 and mt7615
drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-06-07 19:00:05 +02:00
Lorenzo BianconiandFelix Fietkau bce63c453c mt76: mt7603: use napi polling for tx cleanup
This allows tx scheduling and tx cleanup to run concurrently

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-05-11 15:25:58 +02:00
Lorenzo BianconiandFelix Fietkau 6e790e106a mt76: move pre_tbtt_tasklet in mt76_dev
Move pre_tbtt_tasklet tasklet in mt76_dev data structure since
it is used by all drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-30 17:52:28 +02:00
Lorenzo BianconiandFelix Fietkau f43fccf099 mt76: move beacon_int in mt76_dev
Move beacon_int in mt76_dev data structure since it is used by
all drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-30 11:43:51 +02:00
Ryder LeeandFelix Fietkau 7391f98f8b mt76: fix endianness sparse warnings
Fix many warnings with incorrect endian assumptions.

Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Reviewed-by: Stanislaw Gruszka <[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-30 11:37:13 +02:00
Lorenzo BianconiandFelix Fietkau 5007326555 mt76: add skb pointer to mt76_tx_info
Pass skb pointer to tx_prepare_skb through mt76_tx_info data structure.
This is a preliminary patch to properly support dma error path for
new chipsets (e.g. 7615)

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Ryder LeeandFelix Fietkau 355c07904d mt76: use macro for sn and seq_ctrl conversion
Use macro to convert sn and seq_ctrl for better readability.

Signed-off-by: Roy Luo <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-04-25 12:04:34 +02:00
Lorenzo BianconiandFelix Fietkau a7dfcf2e24 mt76: move mac_work in mt76_dev
Move mac_work delayed work in mt76_dev data structure since
it is used by all drivers and it will be reused adding mac work to
mt7615

Signed-off-by: Lorenzo Bianconi <[email protected]>
2019-04-25 12:04:34 +02:00
Felix Fietkau ae166b09cf Revert "mt76: mt7603: store software PN/IV in wcid"
This reverts commit 2660aa98c4.
PN needs to be shared with mac82011 for mgmt frame crypto

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-26 11:35:18 +01:00
Felix Fietkau 5912e8a1ff mt7603: fix sequence number assignment
If the MT_TXD3_SN_VALID flag is not set in the tx descriptor, the hardware
assigns the sequence number. However, the rest of the code assumes that the
sequence number specified in the 802.11 header gets transmitted.
This was causing issues with the aggregation setup, which worked for the
initial one (where the sequence numbers were still close), but not for
further teardown/re-establishing of sessions.

Additionally, the overwrite of the TID sequence number in WTBL2 was resetting
the hardware assigned sequence numbers, causing them to drift further apart.

Fix this by using the software assigned sequence numbers

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-23 17:58:06 +01:00
Felix Fietkau 60e508ed14 mt76: use readl/writel instead of ioread32/iowrite32
readl/writel is faster because it gets rid of unnecessary extra checks

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-23 15:24:58 +01:00
Felix Fietkau 2660aa98c4 mt76: mt7603: store software PN/IV in wcid
Avoids expensive 64-bit atomic access in the data path

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-16 20:11:42 +01:00
Felix Fietkau 5323005150 mt76: move tx tasklet to struct mt76_dev
Allows it to be scheduled from core code

Signed-off-by: Felix Fietkau <[email protected]>
2019-03-14 22:37:30 +01:00
Felix Fietkau c0ab515474 mt76: store wcid tx rate info in one u32 reduce locking
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-14 22:37:30 +01:00
Lorenzo BianconiandFelix Fietkau f977a924b8 mt76: introduce mt76_tx_info data structure
Add mt76_tx_info as auxiliary data structure to pass values
to tx_prepare_skb pointer. This is a preliminary patch to add
support for new chipsets (e.g. mt7615)

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-14 22:09:32 +01:00
Lorenzo BianconiandFelix Fietkau 06c917faeb mt76: introduce mt76_sw_queue data structure
Introduce mt76_sw_queue data structure in order to support new
chipsets (e.g. mt7615) that have a shared hardware queue for all traffic
identifiers. mt76_sw_queue will be used to track outstanding packets

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-13 12:53:23 +01:00
Lorenzo BianconiandFelix Fietkau 9bc2d56c37 mt76: remove mt76_queue dependency from tx_complete_skb function pointer
Remove mt76_queue dependency from tx_complete_skb function pointer and
rely on mt76_tx_qid instead. Remove flush from tx_complete_skb
signature. This is a preliminary patch to introduce mt76_sw_queue
support

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-12 16:58:06 +01:00
Lorenzo BianconiandFelix Fietkau ddd98f8870 mt76: remove mt76_queue dependency from tx_prepare_skb function pointer
Remove mt76_queue dependency from tx_prepare_skb function pointer and
rely on mt76_tx_qid instead. This is a preliminary patch to introduce
mt76_sw_queue support

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-12 16:58:06 +01:00
Felix Fietkau 2ed938271c mt76: mt7603: fix tx status HT rate validation
Use the correct variable in the check. Fixes an uninitialized variable warning

Reported-by: Gustavo A. R. Silva <[email protected]>
Fixes: c8846e1015022 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Felix Fietkau <[email protected]>
2019-03-03 11:06:20 +01:00
Felix Fietkau fd315bd0f2 mt7603: disable dynamic sensitivity adjustment by default
The vendor driver also does not enable it, and it has been shown to cause
some issues. It can be re-enabled for testing through debugfs

Signed-off-by: Felix Fietkau <[email protected]>
2019-02-26 15:15:54 +01:00
Roy LuoandFelix Fietkau e2a9d40772 mt7603: fix ba window size selection
The tx ba window size which is set to HW should not
exceed the actual window size of the ba session,
otherwise the HW might aggregate more packets than
what's negotiated.

Signed-off-by: Felix Fietkau <[email protected]>
2019-02-26 12:26:02 +01:00
Felix Fietkau 8027b5d061 mt7603: remove copyright headers
No longer needed because of SPDX License Identifier

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-31 18:30:30 +01:00
Felix Fietkau ce8cc5d52d mt7603: issue PSE client reset on init
Improves reliability of module reload after tx hangs

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-22 14:09:54 +01:00
Felix Fietkau fe30bd35e2 mt7603: issue PSE reset on tx hang
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-22 14:03:31 +01:00
Felix Fietkau 79b337cfad mt7603: move CF-End rate update to mt7603_mac_set_timing
Signed-off-by: Felix Fietkau <[email protected]>
2019-01-21 15:03:19 +01:00
Felix Fietkau 815fd03e0f mt7603: fix CCA timing values
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]>
2019-01-21 14:59:52 +01:00
Felix Fietkau 3e9a7d5c4d Revert "mt7603: fix txd q_idx field value"
This reverts commit 4bcb2f9fe2.
This causes a slight throughput regression

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-21 14:30:47 +01:00
Felix Fietkau fc31457cd9 mt7603: implement support for SMPS
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]>
2019-01-20 17:46:51 +01:00
Felix Fietkau 158529d679 mt7603: fix PSE reset retry sequence
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]>
2019-01-20 15:15:13 +01:00
Felix Fietkau 702f557c75 mt7603: use maximum tx count for buffered multicast packets
Should improve stability

Signed-off-by: Felix Fietkau <[email protected]>
2019-01-20 14:41:39 +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 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
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 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 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 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 80843237fa mt7603: implement code for adjusting energy detect CCA thresholds
Ported from the reference driver.
Should fix compliance with ETSI rules on preventing transmission while
energy detect values are above the threshold.
Relax rules for non-ETSI regdomains

Signed-off-by: Felix Fietkau <[email protected]>
2018-12-03 18:03:52 +01:00
Felix Fietkau 2a136cb2fd mt7603: fix TKIP key setup
Rx and Tx MIC keys are swapped compared to the order provided by mac80211

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-28 14:55:27 +01:00
Felix Fietkau 4063ae1ecb mt7603: check for PSE hang / stuck beacon first
Ensure that PSE reset is issued when necessary

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-28 13:55:37 +01:00
Felix Fietkau 31cd20eb6a mt7603: issue PSE reset on stuck beacon
Improves reliability of recovery

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-28 13:54:47 +01:00
Felix Fietkau 5fb60a7d7a mt7603: fix aggregation size handling
Do not step over the 32 subframe limit.
Fix staying under the limit

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-21 19:04:19 +01:00
Felix Fietkau da666a74a6 mt7603: issue PSE reset if firmware debug register indicates stuck queues
Signed-off-by: Felix Fietkau <[email protected]>
2018-11-21 15:10:31 +01:00
Felix Fietkau b38fe7d531 mt7603: only issue PSE reset on PSE stuck
The reset can take quite a bit of time, so only issue it when necessary

Signed-off-by: Felix Fietkau <[email protected]>
2018-11-21 15:04:47 +01:00