Introduce phys array in mt76_dev structure to reference mt76_phy
supported by the chipset. This is a preliminary patch to introduce
newer chipset support.
Sean Wang [Sun, 26 Jun 2022 23:27:06 +0000 (07:27 +0800)]
mt76: mt7921: reduce the mutex lock scope during reset
Reduce the mutex lock scope for reset to get rid of possible task hung
e.g wpa_supplicant and to allow the user-space process to keep running
during we need more retries to complete the reset.
Sean Wang [Tue, 21 Jun 2022 21:17:39 +0000 (05:17 +0800)]
mt76: mt7921: enable HW beacon filter in the initialization stage
The current driver has worked with HW beacon filter and connection
monitor all the way, here we move the enablement into the initialization
stage like other HW features being done to get rid of others are
confused why these configurations would be changed at runtime.
We still leave a way to turn off these offload features in debugfs knobs
but that is just for debugging purposes.
Felix Fietkau [Sat, 2 Jul 2022 13:56:23 +0000 (15:56 +0200)]
mt76: do not use skb_set_queue_mapping for internal purposes
Previously the code used skb_set_queue_mapping for management or non-bufferable
powersave frames that need to be sent to a different hardware queue.
This can confuse AQL, which expects the value to remain the same until the tx
status report.
The only place that currently uses the altered skb queue mapping is the txwi
write function. Change the code to pass the hardware queue id as a function
parameter instead.
Felix Fietkau [Fri, 24 Jun 2022 18:57:47 +0000 (20:57 +0200)]
mt76: mt7615: fix throughput regression on DFS channels
For some reason, mt7615 reacts badly to repeatedly enabling/disabling the radar
detector without also switching the channel.
This results in very bad throughput on DFS channels, because
hw->conf.radar_enabled can get toggled a few times after CAC ends.
Fix this by always leaving the DFS detector enabled on DFS channels and instead
suppress unwanted detection events.
Fixes: 2c86f6752046 ("mt76: mt7615: fix/rewrite the dfs state handling logic") Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau [Thu, 23 Jun 2022 09:39:58 +0000 (11:39 +0200)]
mt76: mt76x02: improve reliability of the beacon hang check
Increment the counter only when writing beacons to the hardware in order
to avoid triggering restarts if beacons are disabled.
Additionally, avoid resetting the MAC if stopping it failed
Shayne Chen [Mon, 20 Jun 2022 06:17:17 +0000 (14:17 +0800)]
mt76: mt7915: fix incorrect testmode ipg on band 1 caused by wmm_idx
Fix the issue that the measured inter packet gap didn't fit its
setting value.
Fixes: c2d3b1926f30 ("mt76: mt7915: add support for ipg in testmode") Signed-off-by: Shayne Chen <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau [Tue, 21 Jun 2022 18:34:44 +0000 (20:34 +0200)]
mt76: mt7915: disable UL MU-MIMO for mt7915
After initially establishing a connection, it can produce multi-second latency
spikes and tx hangs when pushing traffic.
It should work better for MT7916 and MT7986, so leave it enabled there
Lorenzo Bianconi [Mon, 20 Jun 2022 12:59:18 +0000 (14:59 +0200)]
mt76: move mt76_connac2_mcu_fill_message in mt76_connac module
Move mt76_connac2_mcu_fill_message routine in shared module in order to
reuse it for mt7921 and mt7915e drivers. This is a preliminary patch to
add mt7990 driver support.
Lorenzo Bianconi [Mon, 13 Jun 2022 12:07:08 +0000 (14:07 +0200)]
mt76: mt7921: do not update pm states in case of error
Do not update pm stats if mt7921e_mcu_fw_pmctrl routine returns an
error.
Fixes: 36873246f78a2 ("mt76: mt7921: add awake and doze time accounting") Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
Lorenzo Bianconi [Mon, 13 Jun 2022 12:03:28 +0000 (14:03 +0200)]
mt76: mt7615: do not update pm stats in case of error
Do not update pm stats if mt7615_mcu_fw_pmctrl returns an error.
Fixes: abe912ae3cd42 ("mt76: mt7663: add awake and doze time accounting") Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
Deren Wu [Wed, 8 Jun 2022 12:53:26 +0000 (20:53 +0800)]
mt76: mt7921: fix command timeout in AP stop period
Due to AP stop improperly, mt7921 driver would face random command timeout
by chip fw problem. Migrate AP start/stop process to .start_ap/.stop_ap and
congiure BSS network settings in both hooks.
The new flow is shown below.
* AP start
.start_ap()
configure BSS network resource
set BSS to connected state
.bss_info_changed()
enable fw beacon offload
* AP stop
.bss_info_changed()
disable fw beacon offload (skip this command)
.stop_ap()
set BSS to disconnected state (beacon offload disabled automatically)
destroy BSS network resource
Deren Wu [Tue, 7 Jun 2022 05:00:46 +0000 (13:00 +0800)]
mt76: enable the VHT extended NSS BW feature
According IEEE Std 802.11-2020, its definition is:
Indicates whether the STA is capable of interpreting the Extended NSS BW
Support subfield of the VHT Capabilities Information field.
Some APs, such as Xiaomi AX6000, would check this one for BW settings.
mt76 driver can get max BW capability only if the this field is confgured
properly.
mt76: connac: move mt76_connac2_load_patch in connac module
Move mt76_connac2_load_patch utility routine in mt76_connac module since
it is shared between mt7921 and mt7915. This is a preliminary patch to
support mt7902e driver.
mt76: connac: move mt76_connac2_load_ram in connac module
Move mt76_connac2_load_ram utility routine in mt76_connac module since
it is shared between mt7921 and mt7915. This is a preliminary patch to
support mt7902e driver.
mt76: connac: move shared fw structures in connac module
Move mt76_connac2 fw structures in connac module since they are shared
between mt7921 and mt7915 drivers. This is a preliminary patch to add
mt7902e support.
mt76: mt7921: add missing bh-disable around rx napi schedule
napi_schedule() can call __raise_softirq_irqoff(), which can perform
softirq handling, so it must not be called in a pure process context
with BH enabled.
Felix Fietkau [Thu, 2 Jun 2022 19:44:21 +0000 (21:44 +0200)]
mt76: mt7615: add missing bh-disable around rx napi schedule
napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq
handling, so it must not be called in a pure process context with BH enabled.
Felix Fietkau [Thu, 2 Jun 2022 19:43:04 +0000 (21:43 +0200)]
mt76: mt7915: add missing bh-disable around tx napi enable/schedule
napi_schedule() can call __raise_softirq_irqoff(), which can perform softirq
handling, so it must not be called in a pure process context with BH enabled.
YN Chen [Sat, 28 May 2022 01:28:54 +0000 (09:28 +0800)]
mt76: mt7921s: fix firmware download random fail
To avoid racing problems in chip, mt7921s should reacquire drv-own after
firmware semaphore is released.
Fixes: 78b217580c509 ("mt76: mt7921s: fix bus hang with wrong privilege") Signed-off-by: YN Chen <[email protected]> Signed-off-by: Deren Wu <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
Deren Wu [Fri, 20 May 2022 09:03:39 +0000 (17:03 +0800)]
mt76: mt7921: introduce ACPI SAR config in tx power
Add new function mt7921_set_tx_sar_pwr() to update SAR power from
.set_sar_specs and ACPI setting. Both settings would be merged into
mt76_freq_range_power for final tx power value.
Lorenzo Bianconi [Tue, 17 May 2022 16:05:59 +0000 (18:05 +0200)]
mt76: mt7915: fix endianness in mt7915_rf_regval_get
Fix the following sparse warning in mt7915_rf_regval_get routine:
drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c:979:16: warning: cast to restricted __le32
Fixes: 0a17329ae9c1f ("mt76: mt7915: add debugfs knob for RF registers read/write") Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
wifi: mac80211: fix center freq calculation in ieee80211_chandef_downgrade
When mac80211 downgrades working bandwidth, the
center_freq and center_freq1 need to be recalculated.
There is a typo in the case of downgrading bandwidth from
320MHz to 160MHz which would cause a wrong frequency value.
wifi: nl80211: fix sending link ID info of associated BSS
commit dd374f84baec ("wifi: nl80211: expose link ID for associated
BSSes") used a top-level attribute to send link ID of the associated
BSS in the nested attribute NL80211_ATTR_BSS. But since NL80211_ATTR_BSS
is a nested attribute of the attributes defined in enum nl80211_bss,
define a new attribute in enum nl80211_bss and use it for sending the
link ID of the BSS.
wifi: cfg80211: fix a comment in cfg80211_mlme_mgmt_tx()
A comment in cfg80211_mlme_mgmt_tx() is describing this API used only
for transmitting action frames. Fix the comment since
cfg80211_mlme_mgmt_tx() can be used to transmit any management frame.
wifi: nl80211: Fix reading NL80211_ATTR_MLO_LINK_ID in nl80211_pre_doit
nl80211_pre_doit() using nla_get_u16() to read u8 attribute
NL80211_ATTR_MLO_LINK_ID. Fix this by using nla_get_u8() to
read NL80211_ATTR_MLO_LINK_ID attribute.
Aloka Dixit [Mon, 23 May 2022 06:49:04 +0000 (23:49 -0700)]
wifi: nl80211: retrieve EHT related elements in AP mode
Add support to retrieve EHT capabilities and EHT operation elements
passed by the userspace in the beacon template and store the pointers
in struct cfg80211_ap_settings to be used by the drivers.
wifi: cfg80211: Increase akm_suites array size in cfg80211_crypto_settings
Increase akm_suites array size in struct cfg80211_crypto_settings to 10
and advertise the capability to userspace. This allows userspace to send
more than two AKMs to driver in netlink commands such as
NL80211_CMD_CONNECT.
This capability is needed for implementing WPA3-Personal transition mode
correctly with any driver that handles roaming internally. Currently,
the possible AKMs for multi-AKM connect can include PSK, PSK-SHA-256,
SAE, FT-PSK and FT-SAE. Since the count is already 5, increasing
the akm_suites array size to 10 should be reasonable for future
usecases.
Johannes Berg [Mon, 27 Jun 2022 10:49:03 +0000 (12:49 +0200)]
wifi: cfg80211: remove chandef check in cfg80211_cac_event()
The current check only worked for AP mode, but we can do
radar detection in mesh as well (for example). We could
try to check this using wdev_chandef(), but we also don't
really care since the chandef is passed in and we have no
need to use it anymore (since we added the argument in
commit d2859df5e7f0 ("cfg80211/mac80211: DFS setup chandef
for cac event")).
Change-Id: I856e4344d5e64ff4d2eead0b4c53b11f264be9b8 Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg <[email protected]>
Johannes Berg [Mon, 27 Jun 2022 10:49:03 +0000 (12:49 +0200)]
wifi: nl80211: relax wdev mutex check in wdev_chandef()
In many cases we might get here from driver code that's
not really set up to care about the locking, and for the
non-MLO cases we really don't care so much about it. So
relax the checking here for now, perhaps we should even
remove it completely since we might not really care if
we point to an invalid link's chandef and can require
the caller to check the link validity first.
Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg <[email protected]>
Johannes Berg [Mon, 27 Jun 2022 10:43:37 +0000 (12:43 +0200)]
wifi: nl80211: hold wdev mutex for tid config
We need wdev_chandef() in this code, which now requires
the wdev mutex due to the per-link nature. Hold it here
to make sure we can access the link.
Reported-by: [email protected] Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Signed-off-by: Johannes Berg <[email protected]>
Johannes Berg [Mon, 27 Jun 2022 10:36:03 +0000 (12:36 +0200)]
wifi: cfg80211: handle IBSS in channel switch
Prior to commit 7b0a0e3c3a88 ("wifi: cfg80211: do some
rework towards MLO link APIs") the interface type didn't
really matter here, but now we need to handle all of the
possible cases. Add IBSS ("ADHOC") and handle it.
Fixes: 7b0a0e3c3a88 ("wifi: cfg80211: do some rework towards MLO link APIs") Reported-by: [email protected] Signed-off-by: Johannes Berg <[email protected]>
Johannes Berg [Mon, 27 Jun 2022 10:28:31 +0000 (12:28 +0200)]
wifi: mac80211: properly skip link info driver update
If the interface isn't (yet) added to the driver, skip the
link info update. This was previously done for the BSS info
changes, but I forgot to copy the same check here.
Felix Fietkau [Sat, 25 Jun 2022 21:24:11 +0000 (23:24 +0200)]
wifi: mac80211: only accumulate airtime deficit for active clients
When a client does not generate any local tx activity, accumulating airtime
deficit for the round-robin scheduler can be harmful. If this goes on for too
long, the deficit could grow quite large, which might cause unreasonable
initial latency once the client becomes active
Felix Fietkau [Sat, 25 Jun 2022 21:24:09 +0000 (23:24 +0200)]
wifi: mac80211: add a per-PHY AQL limit to improve fairness
In order to maintain fairness, the amount of queueing needs to be limited
beyond the simple per-station AQL budget, otherwise the driver can simply
repeatedly do scheduling rounds until all queues that have not used their
AQL budget become eligble.
To be conservative, use the high AQL limit for the first txq and add half
of the low AQL for each subsequent queue.
Felix Fietkau [Sat, 25 Jun 2022 21:24:07 +0000 (23:24 +0200)]
wifi: mac80211: consider aql_tx_pending when checking airtime deficit
When queueing packets for a station, deficit only gets added once the packets
have been transmitted, which could be much later. During that time, a lot of
temporary unfairness could happen, which could lead to bursty behavior.
Fix this by subtracting the aql_tx_pending when checking the deficit in tx
scheduling.
The virtual time scheduler code has a number of issues:
- queues slowed down by hardware/firmware powersave handling were not properly
handled.
- on ath10k in push-pull mode, tx queues that the driver tries to pull from
were starved, causing excessive latency
- delay between tx enqueue and reported airtime use were causing excessively
bursty tx behavior
The bursty behavior may also be present on the round-robin scheduler, but there
it is much easier to fix without introducing additional regressions