Commit Graph
2210 Commits
Author SHA1 Message Date
Felix Fietkau 8c73f3b15a mt76: implement .mcu_parse_response in struct mt76_mcu_ops
Do not free skb inside that function
Preparation for further cleanup

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-30 03:54:03 +02:00
Felix Fietkau eb9afae96b mt76: rename __mt76_mcu_skb_send_msg to mt76_mcu_skb_send_msg
Preparation for further cleanup

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-30 03:11:06 +02:00
Felix Fietkau 6cdebe8058 mt76: rename __mt76_mcu_send_msg to mt76_mcu_send_msg
Preparation for further cleanup

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-30 03:09:22 +02:00
Felix Fietkau 75977a85e8 mt76: mt7915: disable OFDMA/MU-MIMO UL
The feature is not ready in firmware yet, and it leads to hangs

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-29 08:48:20 +02:00
Felix Fietkau 9cb12f7042 mt76: mt7915: fix DRR sta bss group index
The firmware/hardware supports only 16 entries. Trying to use more can lead
to timeouts on some firmware versions

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-28 15:15:20 +02:00
Lorenzo BianconiandFelix Fietkau b381729626 mt76: sdio: convert {status/net}_work to mt76_worker
In order to improve driver throughput, convert status_work and net_work
to mt76 worker APIs.
Remove txrx_wq sdio workqueue since it is no longer used

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 19:13:26 +02:00
Lorenzo BianconiandFelix Fietkau 6dc67b058e mt76: mt7663s: disable interrupt during txrx_worker processing
In order to reduce sdio bus contention, disable interrupts during
txrx_worker processing

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 19:13:26 +02:00
Lorenzo BianconiandFelix Fietkau 75157b59ae mt76: mt7663s: convert txrx_work to mt76_worker
In order to improve driver throughput, convert txrx_work to mt76 worker
threads APIs.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 19:13:26 +02:00
Lorenzo BianconiandFelix Fietkau b5c593b63f mt76: mt7663s: move tx/rx processing in the same txrx workqueue
Move mt7663 tx and rx processing in the same workqueue in order to
reduce jitter that can hit tcp performances. This is a preliminary patch
to switch to mt76 workers APIs

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 19:13:26 +02:00
Chuanhong GuoandFelix Fietkau 2363268965 mt76: mt7615: retry if mt7615_mcu_init returns -EAGAIN
mt7615_load_patch in mt7615/mcu.c sometimes fails with:
mt7622-wmac 18000000.wmac: Failed to get patch semaphore
and returns -EAGAIN. But this error is returned all the way up to
mt7615_init_work with no actual retrial performed, leaving a
broken wireless phy.
Wait a bit and retry for up to 10 times before giving up.

Signed-off-by: Chuanhong Guo <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 19:13:26 +02:00
Ryder LeeandFelix Fietkau 434940e082 mt76: mt7915: measure channel noise and report it via survey
Read per-stream measurements every 100 ms and build a simple moving average.

Tested-by: Shayne Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 19:13:26 +02:00
Felix Fietkau 709f2cd778 mt76: mt7915: fix processing txfree events
In the MT7915 info, the fields for the WLAN index / queue overlap with the
token id, and the MT_TX_FREE_PAIR bit indicates, which one is present.

If MT_TX_FREE_PAIR is set, skip processing the token index, since the data
will not be valid.

This fixes accidentally freeing tokens which are still in use by the
hardware with a wrong station pointer.

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 16:43:16 +02:00
Felix Fietkau 2741fd071b mt76: mt7915: support 32 station interfaces
When looking for a MAC address slot, start by using main BSSID slots 1-3,
afterwards use 16 repeater mode BSSID slots, then start using the slots
usually used for AP mode.
This search order should prevent unnecessary conflicts with AP mode interfaces
on the same PHY

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-27 15:26:48 +02:00
Felix Fietkau 1a2547b27d mt76: do not set NEEDS_UNIQUE_STA_ADDR for 7615 and 7915
The newer chipsets can deal with the same STA on multiple interfaces
Preparation for supporting more station interfaces

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-26 22:40:13 +02:00
Felix Fietkau 7f53d68b1a mt76: mt7615: add debugfs knob for setting extended local mac addresses
This is primarily for testing and can be used in combination with monitor
mode to make the card respond to packets sent to a specific MAC address.
For now this is only exposed as a debug/testing feature, later on the
approach might be used to support more concurrent station interfaces

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-25 15:58:32 +02:00
Lorenzo BianconiandFelix Fietkau b22977c272 mt76: mt7663s: remove max_tx_fragments limitation
Remove A-MSDU max_tx_fragments constraint for sdio since the check is
already performed in mt7663s_tx_run_queue routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-23 08:16:55 +02:00
Qinglang MiaoandFelix Fietkau 1449e602fa mt76: Convert to DEFINE_SHOW_ATTRIBUTE
Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code.

Signed-off-by: Qinglang Miao <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-23 08:16:55 +02:00
Shayne ChenandFelix Fietkau 8c47ed12c2 mt76: mt7915: add offchannel condition in switch channel command
Add a missing offchannel condition for channel switch reason, which
bypasses DPD calibration to reduce scanning time.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-23 08:16:55 +02:00
Felix Fietkau 73301065ac mt76: mt7615: reduce maximum VHT MPDU length to 7991
After fixing mac80211 to allow larger A-MSDUs in some cases, there have been
reports of performance regressions and packet loss with some clients.
It appears that the issue occurs when the hardware is transmitting A-MSDUs
bigger than 8k. Limit the local VHT MPDU size capability to 7991, matching
the value used for MT7915 as well.

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-23 07:24:47 +02:00
Liu ShixinandFelix Fietkau ec84891a4d mt76: mt7915: convert to use le16_add_cpu()
Convert cpu_to_le16(le16_to_cpu(E1) + E2) to use le16_add_cpu().

Signed-off-by: Liu Shixin <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-16 11:04:05 +02:00
Ye BinandFelix Fietkau 5b78e52927 mt76: Fix unsigned expressions compared with zero
Fixes variable types in mt76x02_dfs_create_sequence and
mt76x02_dfs_add_event_to_sequence

Signed-off-by: Ye Bin <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-16 11:04:05 +02:00
Lorenzo BianconiandFelix Fietkau fee1f4a8e8 mt76: mt7915: fix possible memory leak in mt7915_mcu_add_beacon
Release mcu message memory in case of failure in mt7915_mcu_add_beacon
routine

Fixes: e57b7901469fc ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-16 11:04:05 +02:00
Felix Fietkau 17ba3432f5 Revert "mt76: mt7615: unlock dfs bands"
This reverts commit b647180c86.
Now enabled properly by a separate interface combination

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-09 11:31:27 +02:00
Lee JonesandFelix Fietkau 448cd2d36e mt76: mt76x0: Move tables used only by init.c to their own header file
Taking the same approach as initvals_phy.h.

Fixes the following W=1 kernel build warning(s):

 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:218:35: warning: ‘mt76x0_dcoc_tab’ defined but not used [-Wunused-const-variable=]
 218 | static const struct mt76_reg_pair mt76x0_dcoc_tab[] = {
 | ^~~~~~~~~~~~~~~
 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:86:35: warning: ‘mt76x0_bbp_init_tab’ defined but not used [-Wunused-const-variable=]
 86 | static const struct mt76_reg_pair mt76x0_bbp_init_tab[] = {
 | ^~~~~~~~~~~~~~~~~~~
 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:48:35: warning: ‘mt76x0_mac_reg_table’ defined but not used [-Wunused-const-variable=]
 48 | static const struct mt76_reg_pair mt76x0_mac_reg_table[] = {
 | ^~~~~~~~~~~~~~~~~~~~
 drivers/net/wireless/mediatek/mt76/mt76x0/initvals.h:14:35: warning: ‘common_mac_reg_table’ defined but not used [-Wunused-const-variable=]
 14 | static const struct mt76_reg_pair common_mac_reg_table[] = {
 | ^~~~~~~~~~~~~~~~~~~~

Cc: Felix Fietkau <[email protected]>
Cc: Lorenzo Bianconi <[email protected]>
Cc: Ryder Lee <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Matthias Brugger <[email protected]>
Cc: Stanislaw Gruszka <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Lee Jones <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Gustavo A. R. SilvaandFelix Fietkau 1ccd31bbe1 mt76: Use fallthrough pseudo-keyword
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau f96cffa03e mt76: mt7615: unlock dfs bands
Unlock dfs channels for mt7615 devices since the driver supports
radar detection. Dfs pattern detector has been tested successfully by
mt7615 users.
Do not unlock DFS frequencies for mt7663 devices since it has not been
tested yet.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau 56e77a3a3a mt76: mt7663: check isr read return value in mt7663s_rx_work
In order to avoid using stale isr values, check return value from
sdio_readsb() in mt7663s_rx_work()

Tested-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau 979c0fdc5d mt76: mt7663s: introduce sdio tx aggregation
Introduce sdio tx aggregation to reduce bus transaction ands improve tx
throughput. For the moment the skb are copied in a dedicated buffer
since mmc APIs do not support sg table for zero-copy.
Since skb data are already copied in xmit_buff[], avoid linearization in
ma80211 layer. Relying on tx aggregation, we improve tx tpt of ~65%.

Tested-by: Sean Wang <[email protected]>
Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau d048f8e87b mt76: mt7663s: fix possible quota leak in mt7663s_refill_sched_quota
Look just at reported quota since the hw sporadically reports mcu tx
quota without setting WHIER_TX_DONE_INT_EN bit

Tested-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau fdf14d1b6a mt76: move pad estimation out of mt76_skb_adjust_pad
Move frame pad computation out of mt76_skb_adjust_pad routine.
This is a preliminary patch to introduce sdio tx aggregation.

Tested-by: Sean Wang <[email protected]>
Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau d62ba15b1b mt76: mt7663s: introduce __mt7663s_xmit_queue routine
This is a preliminary patch to introduce sdio tx aggregation

Tested-by: Sean Wang <[email protected]>
Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau 13b9641151 mt76: mt7663s: split mt7663s_tx_update_sched in mt7663s_tx_{pick,update}_quota
In order to not update the available quota in case of a tx error, split
mt7663s_tx_update_sched in mt7663s_tx_{pick,update}_quota routines

Tested-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau 0a955d944b mt76: mt7663s: do not use altx for ctl/mgmt traffic
Since the sdio engine does not report quota for altx queue, move
ctl/mgmt traffic to standard data queues

Tested-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Lorenzo BianconiandFelix Fietkau 848f4a6334 mt76: mt7622: fix fw hang on mt7622
Set poll timeout to 3s for mt7622 devices in order to avoid fw hangs.
Swap mt7622_trigger_hif_int and doorbell configuration order in
mt7615_mcu_drv_pmctrl routine.
Introduce mt7615_mcu_lp_drv_pmctrl routine to take care of drv_own
configuration for runtime-pm.

Fixes: 08523a2a1db5 ("mt76: mt7615: add mt7615_pm_wake utility routine")
Fixes: 894b7767ec2f ("mt76: mt7615: improve mt7615_driver_own reliability")
Fixes: 757b0e7fd6f4 ("mt76: mt7615: avoid polling in fw_own for mt7663")
Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Co-developed-by: Ryder Lee <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Ryder LeeandFelix Fietkau 0b7d2b7628 mt76: mt7615: fix VHT LDPC capability
The MCU field should contain a boolean 0/1, not the flag itself.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Wang HaiandFelix Fietkau 146488631f mt76: mt7615: Remove set but unused variable 'index'
Fixes gcc '-Wunused-but-set-variable' warning:

drivers/net/wireless/mediatek/mt76/mt7615/testmode.c: In function mt7615_tm_set_tx_power
drivers/net/wireless/mediatek/mt76/mt7615/testmode.c:83:7: warning: variable ‘index’ set but not used [-Wunused-but-set-variable]=

commit 4f0bce1c8888 ("mt76: mt7615: implement testmode support")
involved this unused variable, remove it.

Signed-off-by: Wang Hai <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 23:44:29 +02:00
Felix Fietkau e2b8a4ec98 mt76: testmode: add a limit for queued tx_frames packets
This avoids running out of available tx tokens

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-08 19:12:53 +02:00
Ryder LeeandFelix Fietkau e3af31409d update mt7915 firmware to the latest version
Signed-off-by: Ryder Lee <[email protected]>
2020-09-07 21:52:19 +02:00
Felix Fietkau 130e5de093 Revert "mt76: dma: queue more rx frames internally before passing them to the stack"
This reverts commit 0fc3c5eb61.
2020-09-07 12:08:07 +02:00
Felix Fietkau 0fc3c5eb61 mt76: dma: queue more rx frames internally before passing them to the stack
On MT7615 and MT7915, packets received from DMA can include TX_FREE events,
which free up space for tx. In order to process those packets faster, keep
keep a longer internal queue of packets and pass as many packets to the
stack as the NAPI budget allows

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:34:57 +02:00
Chih-Min ChenandFelix Fietkau bab866a01e mt76: mt7915: fix unexpected firmware mode
Avoid firmware falling into spectrum mode since that will set
unexpected PSE/PLE thresholds which lead to Tx hang.

This mode should be cleaned before firmware download stage.

Signed-off-by: Chih-Min Chen <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau e22c65cdc5 mt76: mt7915: simplify checks for the 802.3 offload path
No multicast frames enter this path, so there is no need to check the
ethernet header

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau 115b62efac mt76: remove retry_q from struct mt76_txq and related code
Since the switch to using AQL by default, mtxq->retry_q is never filled anymore
Remove it to get rid of a few more unnecessary cycles in the tx path

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau cfaf408587 mt76: mt7915: fix queue/tid mapping for airtime reporting
Unlike 7615, 7915 uses the same AC index for rx and tx, which matches the
LMAC queue mapping

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau 8f48855f5d mt76: mt7915: simplify mt7915_lmac_mapping
Compared to mac80211 ACs, MT7915 queue numbers are in reverse order
There is no need for the defensive WARN_ON_ONCE, so we can simplify
the function to avoid the array lookup

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau b1f4256861 mt76: mt7915: fix VHT LDPC capability
The MCU field should contain a boolean 0/1, not the flag itself

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau 5f080033ec mt76: move txwi handling code to dma.c, since it is mmio specific
This way we can make some functions static

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-04 19:31:36 +02:00
Felix Fietkau 69b3f868d1 mt76: mt7915: use napi_consume_skb to bulk-free tx skbs
Slightly improves performance

Signed-off-by: Felix Fietkau <[email protected]>
2020-09-01 17:57:43 +02:00
Felix Fietkau 72c8a81e64 mt76: mt7915: fix encap offload multicast traffic with 4-address mode
multicast packets need to be transmitted as 802.11 unicast packets

Signed-off-by: Felix Fietkau <[email protected]>
2020-08-28 23:49:28 +02:00
Felix Fietkau 15391c1c94 mt76: fix tx hang on non-AQL frame limit
Signed-off-by: Felix Fietkau <[email protected]>
2020-08-27 15:16:25 +02:00