Commit Graph
422 Commits
Author SHA1 Message Date
Lorenzo BianconiandFelix Fietkau 9a8fc6636d mt76: move sar_capa configuration in common code
Move wiphy SAR capability configuration in mt76 module and remove
duplicated code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-12-03 10:18:57 +01:00
Lorenzo BianconiandFelix Fietkau bc6798f729 mt76: move sar utilities to mt76-core module
Move mt76_get_sar_power and mt76_init_sar_power in the common code.
This is a preliminary patch to add sar support to mt76x02 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-22 16:05:20 +01:00
Shayne ChenandFelix Fietkau 0c489ea286 mt76: testmode: add support to set MAC
Add support to set SA/DA/BSSID in testmode.
During mass production stage, some test scripts or test equipments need
to set fixed addresses to detect or parse if a test is passed.
Also, MAC setting is necessary for some tx/rx tests with rx filter,
to make sure rx site only receives expected packets.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-11-21 20:26:13 +01:00
Lorenzo BianconiandFelix Fietkau 094e085abf mt76: move mt76_ethtool_worker_info in mt76 module
Move mt76_ethtool_worker_info in common code in order to be reused in
mt7921 driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:33:21 +02:00
Lorenzo BianconiandFelix Fietkau d54796787c mt76: move mt76_sta_stats in mt76.h
This is a preliminary patch to add ethtool stats to mt7921 driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:33:21 +02:00
Sean WangandFelix Fietkau 3143118baf mt76: mt7921s: add reset support
Introduce wifi chip reset support for mt7921 device to recover
mcu hangs or abnormal wifi system.

Tested-by: Deren Wu <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Sean WangandFelix Fietkau ddab3dd25f mt76: connac: extend mcu_get_nic_capability
Extend mcu_get_nic_capability to obtain tx resource for SDIO device,
MAC address, and PHY capability.

Tested-by: Deren Wu <[email protected]>
Acked-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Sean WangandFelix Fietkau e353424f1b mt76: sdio: extend sdio module to support CONNAC2
Extend sdio module to support CONNAC2 hw that mt7921s rely on.

Tested-by: Deren Wu <[email protected]>
Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Lorenzo BianconiandFelix Fietkau 2625759439 mt76: sdio: introduce parse_irq callback
Add parse_irq to handle that interrupt status structure is
different between mt7663s and mt7921s.

This is a preliminary patch to introduce mt7921s driver

Tested-by: Sean Wang <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:15:59 +02:00
Lorenzo BianconiandFelix Fietkau 5079d5b0b1 mt76: sdio: move common code in mt76_sdio module
Move sdio common code in mt76_sdio module.
This is a preliminary patch to support mt7921s devices.

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]>
2021-10-19 12:15:59 +02:00
Lorenzo BianconiandFelix Fietkau b6051f7713 mt76: sdio: export mt76s_alloc_rx_queue and mt76s_alloc_tx routines
Export mt76s_alloc_rx_queue and mt76s_alloc_tx utility routines in order
to allow mt7921s driver to configure a different main rx queue.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 12:08:20 +02:00
Lorenzo BianconiandFelix Fietkau d0ccc42979 mt76: rely on phy pointer in mt76_register_debugfs_fops routine signature
This is a preliminary patch to create a mt76 debugfs subir for ext-phy.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-19 11:29:44 +02:00
Xing SongandFelix Fietkau 47e8e96e8e mt76: use a separate CCMP PN receive counter for management frames
When received frame is decryped by hardware, CCMP PN is checked by
mt76.

When management frame protection (IEEE 802.11w) is used, we must use
a separate counter for tracking received CCMP packet number for the
management frames. The previously used counter was shared with data
frames and that can cause problems in detecting replays incorrectly
for robust management frames.

Add a new counter just for robust management frames to avoid this
issue.

Signed-off-by: Xing Song <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 12:01:50 +02:00
Sean WangandFelix Fietkau e8e2eae41f mt76: drop MCU header size from buffer size in __mt76_mcu_send_firmware
Each firmware piece with mt7915 and mt7921 do not have the MCU header to
reroute the packet to the internal RAM. So we do not need to consider the
MCU header size in __mt76_mcu_send_firmware.
Move the MCU header overhead calculation to mt76_mcu_send_firmware (for
older chipsets)

Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Fixes: 1c099ab44727 ("mt76: mt7921: add MCU support")
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 09:33:11 +02:00
Lorenzo BianconiandFelix Fietkau 75615480b3 mt76: introduce __mt76_mcu_send_firmware routine
Introduce __mt76_mcu_send_firmware routine to specify mcu message max
length. This is a preliminary patch to support mt7921s driver.

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]>
2021-10-11 09:30:40 +02:00
Lorenzo BianconiandFelix Fietkau 69bb59df89 mt76: schedule status timeout at dma completion
Reduce MT_TX_STATUS_SKB_TIMEOUT to 250ms

Tested-by: [email protected]
Co-developed-by: Ben Greear <[email protected]>
Signed-off-by: Ben Greear <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 09:19:04 +02:00
Lorenzo BianconiandFelix Fietkau ccbd847631 mt76: substitute sk_buff_head status_list with spinlock_t status_lock
Substitute sk_buff_head status_list with spinlock_t status_lock since we
just need it for locking

Tested-by: [email protected]
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 09:19:04 +02:00
Lorenzo BianconiandFelix Fietkau bcc8d9e03a mt76: remove mt76_wcid pointer from mt76_tx_status_check signature
Remove mt76_wcid pointer from mt76_tx_status_check signature since it is
always set to NULL

Tested-by: [email protected]
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 09:19:04 +02:00
Lorenzo BianconiandFelix Fietkau f143aedc1d mt76: introduce packet_id idr
Introduce per-wcid idr to manage packet id for txs. This allow fast idr
lookup and skb queueing at the same time.

Tested-by: [email protected]
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 09:19:04 +02:00
Lorenzo BianconiandFelix Fietkau 817a41826b mt76: connac: add 6GHz support to mt76_connac_mcu_set_channel_domain
Configure 6GHz channels defining mcu channel domain. This is a
preliminary patch to enable 6GHz band on mt7921 devices.

Tested-by: Deren Wu <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 08:11:21 +02:00
Ben GreearandFelix Fietkau d1d5e8cd3a mt76: mt7915: add tx stats gathered from tx-status callbacks
Add tx-mode (ofdma, ht, vht, HE) histogram,
tx-ru-idx histogram, and tx-bandwidth histogram.
Also add tx attempts and tx success counters.

All of this is per-station.

Signed-off-by: Ben Greear <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-10-11 08:03:30 +02:00
Ryder LeeandFelix Fietkau e2ee9d0a33 mt76: use IEEE80211_OFFLOAD_ENCAP_ENABLED instead of MT_DRV_AMSDU_OFFLOAD
Drop MT_DRV_AMSDU_OFFLOAD after introducing IEEE80211_OFFLOAD_ENCAP_ENABLED
flag in mac80211. Driver now checks vif->offload_flags to know encap offload
status of each interface.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-27 19:08:21 +02:00
Lorenzo BianconiandFelix Fietkau 51cff39d7a mt76: overwrite default reg_ops if necessary
Introduce mt76_register_debugfs_fops routine in order to
define per-driver regs file operations and make sure the
device is up before reading or writing its registers

Fixes: 1d8efc741df8 'mt76: mt7921: introduce Runtime PM support'
Fixes: de5ff3c9d1a2 'mt76: mt7615: introduce pm_power_save delayed work'
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:54:37 +02:00
Ryder LeeandFelix Fietkau d04814366c mt76: add support for setting mcast rate
Mesh and ad-hoc interfaces allow users to set mcast rate through
NL80211_ATTR_MCAST_RATE, so rework mt76_default_basic_rate() to
adapt that.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-08-13 12:26:54 +02:00
Felix Fietkau bbebea7d6d Revert "mt76: fix mt76_rates for the multiple devices"
Fix rate values for MT7915 and MT7921

This reverts commit ca64a36908.

Signed-off-by: Felix Fietkau <[email protected]>
2021-07-15 20:09:39 +02:00
Ryder LeeandFelix Fietkau 8e2d383fbd mt76: mt7915: report tx rate directly from tx status
Report tx rate from tx status packets instead of receving periodic mcu
event. This improves flexibility, accuracy and AQL performance, and
simplifies code flow for better readability.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-07-14 15:54:43 +02:00
YN ChenandFelix Fietkau 7118eacb7c mt76: mt7921: add .set_sar_specs support
add .set_sar_specs to allow configuring SAR power limitations on the
frequency ranges from the userland.

Co-developed-by: Sean Wang <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: YN Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-07-14 15:54:43 +02:00
Sean WangandFelix Fietkau f517116bf1 mt76: add mt76_default_basic_rate more devices can rely on
add mt76_default_basic_rate to mt76 core more devices can rely on
to send frames which require the rate in the basic rates.

Suggested-by: Ryder Lee <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-07-14 12:18:38 +02:00
Sean WangandFelix Fietkau ca64a36908 mt76: fix mt76_rates for the multiple devices
PHY offset in either .hw_value or .hw_value_short for mt7615, mt7663,
mt7915 and mt7921 device all start at bit 6, not 8.

Suggested-by: Ryder Lee <[email protected]>
Signed-off-by: Sean Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-07-14 12:18:38 +02:00
Ryder LeeandFelix Fietkau 12bf28feba mt76: fix iv and CCMP header insertion
The iv from RXD is only for TKIP_RSC/CCMP_PN/GCMP_PN, and it needs a
check for CCMP header insertion. Move mt76_cipher_type to mt76.h to
reduce duplicated code.

Signed-off-by: Xing Song <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-18 17:19:44 +02:00
Ryder LeeandFelix Fietkau 23c6ec49c0 mt76: make mt76_update_survey() per phy
Reduce duplicated survey for DBDC.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-18 16:38:20 +02:00
Lorenzo BianconiandFelix Fietkau 60f3d3adbb mt76: move mt76_get_next_pkt_id in mt76.h
In order to remove duplicated code, move mt76_get_next_pkt_id routine
in mt76.h

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-10 13:28:33 +02:00
Lorenzo BianconiandFelix Fietkau b24598b1c1 mt76: connac: add mt76_connac_mcu_get_nic_capability utility routine
Introduce mt76_connac_mcu_get_nic_capability utility routine to poll
device capabilities returned by mcu fw for CE devices (mt7663/mt7921).
This is a preliminary patch to introduce 6GHz support.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-06-10 13:28:33 +02:00
Lorenzo BianconiandFelix Fietkau 321443258b mt76: move mt76_rates in mt76 module
Move mt76_rates array in mt76 module and remove duplicated code since it
is shared by all drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
2021-06-02 08:25:00 +02:00
Felix Fietkau c6ae95d43e mt76: improve tx status codepath
Use ieee80211_tx_status_ext instead of ieee80211_free_skb and
ieee80211_tx_status. This makes it compatible with 802.3 encap offload
and improves performance by removing a redundant sta lookup

Signed-off-by: Felix Fietkau <[email protected]>
2021-05-07 17:15:27 +02:00
Lorenzo BianconiandFelix Fietkau 757af5c67d mt76: move mt76_token_init in mt76_alloc_device
In order to remove duplicated code, move mt76_token_init in
mt76_alloc_device routine

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-21 17:33:55 +02:00
Lorenzo BianconiandFelix Fietkau 2126b21763 mt76: mt7921: get rid of mcu_reset function pointer
since mcu_reset it used only by mt7921, move the reset callback to
mt7921_mcu_parse_response routine and get rid of the function pointer.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-21 14:30:19 +02:00
Lorenzo BianconiandFelix Fietkau 8d5c456be1 mt76: move token utilities in mt76 common module
Move token management in mt76 common module since it is shared between
mt7615, mt7915 and mt7921 drivers

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-21 14:30:19 +02:00
Lorenzo BianconiandFelix Fietkau ade1f5aad4 mt76: move token_lock, token and token_count in mt76_dev
Move token_lock, token and token_count data structures in mt76_dev.
This is a preliminary patch to move token management in mt76 common
module since it is shared by mt7615, mt7915 and mt7921 drivers.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-21 14:30:19 +02:00
Lorenzo BianconiandFelix Fietkau 51b3d1a9a2 mt76: dma: add the capability to define a custom rx napi poll routine
Add the capability to define a custom rx napi callback for each driver.
This is a preliminary patch to properly support runtime-pm on rx side

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-21 13:49:02 +02:00
Lorenzo BianconiandFelix Fietkau 36f664edc7 mt76: mt7663: rely on mt76_connac_pm_ref/mt76_connac_pm_unref in tx path
Introduce mt7615_tx_worker routine as mt76 tx worker callback for
mt7663.
Rely on mt76_connac_pm_ref/mt76_connac_pm_unref to check PM state and
increment/decrement wake counter

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-21 13:49:02 +02:00
Ryder LeeandFelix Fietkau cf0e406af8 mt76: mt7915: add support for applying pre-calibration data
When the EEPROM data is read from flash, it can contain pre-calibration
data, which can save calibration time.

Note that group_cal can save 30% bootup calibration time, and dpd_cal can
save 75% channel switching time.

Tested-by: Bo Jiao <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-17 11:19:58 +02:00
Shayne ChenandFelix Fietkau a8e89c5a1d mt76: testmode: add support to send larger packet
Add support to send larger packet in testmode to meet requirements
of some test cases.
The limit of max packet size is determined based on tx rate mode setting.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-13 10:15:11 +02:00
Ryder LeeandFelix Fietkau 7714dc914d mt76: report Rx timestamp
Frame reception timestamp (low 32-bits) that indicates the value of the
local TSF timer value at the time the first bit of the MAC header in the
received frame (PPDU unit) arriving at the MAC.

Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2021-04-11 12:49:17 +02:00
Lorenzo BianconiandFelix Fietkau 0b6c9a043f mt76: move de-amsdu buffer per-phy
mt7615d users report the following crash running both phy concurrently:

[  147.273909] CPU 1 Unable to handle kernel paging request at virtual address 00000000, epc == 8e4f288c, ra == 8e58a968
[  147.284570] Oops[#1]:
[  147.286854] CPU: 1 PID: 3724 Comm: kworker/u9:3 Not tainted 5.4.105 #0
[  147.293403] Workqueue: napi_workq napi_workfn
[  147.297742] $ 0   : 00000000 00000001 8e595ec0 00000000
[  147.302950] $ 4   : 8e595ec0 00000000 8e5ca600 00000000
[  147.308161] $ 8   : 00000000 000004c1 80808080 fefefeff
[  147.313370] $12   : 00000000 00000000 80704f1c 00000040
[  147.323781] $20   : 00000050 00000044 00000011 01ce9502
[  147.334195] $28   : 8e004000 8e005d18 8ddf2020 8e58a968
[  147.342266] Lo    : 00000000
[  147.350397] ra    : 8e58a968 mt7615_queue_rx_skb+0x94c/0xd0c [mt7615_common]
[  147.361580] Cause : 4080000c (ExcCode 03)
[  147.368434] PrId  : 0001992f (MIPS 1004Kc)
[  147.456965] Process kworker/u9:3 (pid: 3724, threadinfo=9ece68d6, task=b16d155f, tls=00000000)
[  147.473857]         0001ce95 00004188 00000000 00000080 00004c10 00000002 8074a2b8 80043dcc
[  147.490505]         00000000 8e4f0110 8069ddf4 806ab148 8dfc0000 00001000 00000000 00000050
[  147.507150]         ...
[  147.512033] [<8e4f288c>] mt76_rx+0x124/0x320 [mt76]
[  147.526633]
[  147.528512] ---[ end trace 3d137e75bb109149 ]---

The issue has been introduce enabling hw rx de-amsdu since the hw can
interleave amsdu frames from both phy. Fix the issue moving the de-amsdu
buffer per-phy.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Acked-by: Ryder Lee <[email protected]>
2021-03-18 10:44:42 +01:00
Lorenzo BianconiandFelix Fietkau a80e50098b mt76: dma: export mt76_dma_rx_cleanup routine
Export mt76_dma_rx_cleanup routine in mt76_queue_ops data structure.
This is a preliminary patch to introduce mt7921 chip reset support.

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]>
2021-03-14 23:39:22 +01:00
Lorenzo BianconiandFelix Fietkau 7b56d5bf6e mt76: dma: introduce mt76_dma_queue_reset routine
Introduce mt76_dma_queue_reset utility routine to reset a given hw
queue. This is a preliminary patch to introduce mt7921 chip reset
support.

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]>
2021-03-14 23:39:22 +01:00
Lorenzo BianconiandFelix Fietkau 3cf5afc029 mt76: introduce mcu_reset function pointer in mt76_mcu_ops structure
Introduce mcu_reset function pointer in mt76_mcu_ops structure in order
to run hw related reset function for the mcu running on the chipset.
This is a preliminary patch to introduce chip reset for mt7921 devices.

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]>
2021-03-14 23:39:22 +01:00
Felix Fietkau bfa8d5a6a9 mt76: adjust to upstream API for enabling threaded NAPI
Create a second dummy device for tx napi to avoid making it threaded

Signed-off-by: Felix Fietkau <[email protected]>
2021-03-14 17:36:54 +01:00
Felix Fietkau 289cd78045 mt76: mt7915: add support for rx decapsulation offload
For AP and Client mode, the hardware can pass received packets as 802.3 frames
that can be passed to the network stack as-is.

Signed-off-by: Felix Fietkau <[email protected]>
2021-02-14 12:26:01 +01:00