Commit Graph
3744 Commits
Author SHA1 Message Date
Felix Fietkau 890ae4d717 wifi: mt76: mt76x02: fix MT76x0 external LNA gain handling
On MT76x0, LNA gain should be applied for both external and internal LNA.
On MT76x2, LNA gain should be treated as 0 for external LNA.
Move the LNA type based logic to mt76x2 in order to fix mt76x0.

Fixes: 2daa67588f34 ("mt76x0: unify lna_gain parsing")
Reported-by: Shiji Yang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-19 21:48:01 +02:00
Deren WuandFelix Fietkau 2afc7285f7 wifi: mt76: mt7925: add Mediatek Wi-Fi7 driver for mt7925 chips
Add mt7925, a new mac80211 driver for the MediaTek Wi-Fi 7 (802.11be) device
Filogic 360, which can support Station, AP, P2P, and monitor modes.
Filogic 360 supports max 4096-QAM/160MHz radio operation at 6 GHz, 5 GHz,
or 2.4 GHz with 2x2 antennas. This chip supports PCIe and USB bus type.

mt7925 supports Wi-Fi 6E and EHT rate with single link only at this moment,
whereas Wi-Fi 7 and its specific features are working in progress. They will be
introduced in further patches.

The driver is build tested by Intel's kernel test robot with both GCC and Clang
with several architecture. Sparse reports no warnings.

There are multiple authors, they are listed in alphabetical order below.

Co-developed-by: Hao Zhang <[email protected]>
Signed-off-by: Hao Zhang <[email protected]>
Co-developed-by: Leon Yen <[email protected]>
Signed-off-by: Leon Yen <[email protected]>
Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Co-developed-by: Mingyen Hsieh <[email protected]>
Signed-off-by: Mingyen Hsieh <[email protected]>
Co-developed-by: Nelson Yu <[email protected]>
Signed-off-by: Nelson Yu <[email protected]>
Co-developed-by: Quan Zhou <[email protected]>
Signed-off-by: Quan Zhou <[email protected]>
Co-developed-by: Rong Yan <[email protected]>
Signed-off-by: Rong Yan <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-18 12:42:45 +02:00
Sean WangandFelix Fietkau 9fc37b0ac5 wifi: mt76: mt7921: fix the wrong rate selected in fw for the chanctx driver
The variable band should be determined by the ieee80211_chanctx_conf when
the driver is a kind of chanctx one e.g mt7921 and mt7922 driver so we
added the extension to mt76_connac2_mac_tx_rate_val and
mt76_connac_get_he_phy_cap for the firmware can select the proper rate.

Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")
Signed-off-by: Sean Wang <[email protected]>
Tested-by: David Ruth <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-18 12:15:31 +02:00
Sean WangandFelix Fietkau 66d5694e18 wifi: mt76: mt7921: fix the wrong rate pickup for the chanctx driver
The variable band should be determined by the ieee80211_chanctx_conf when
the driver is a kind of chanctx one e.g mt7921 and mt7922 driver so we
added the extension to mt76_connac2_mac_tx_rate_val by distinguishing if
it can support chanctx to fix the incorrect rate pickup.

Fixes: 41ac53c899bd ("wifi: mt76: mt7921: introduce chanctx support")
Signed-off-by: Sean Wang <[email protected]>
Reviewed-by: David Ruth <[email protected]>
Tested-by: David Ruth <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-18 12:15:31 +02:00
Sean WangandFelix Fietkau d1881b1b2b wifi: mt76: move struct ieee80211_chanctx_conf up to struct mt76_vif
Move struct ieee80211_chanctx_conf up to struct mt76_vif to allow the
connac2 library can access the struct ieee80211_chanctx_conf * member in
struct mt76_vif.

Signed-off-by: Sean Wang <[email protected]>
Reviewed-by: David Ruth <[email protected]>
Tested-by: David Ruth <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-18 12:15:31 +02:00
Jinjie RuanandFelix Fietkau 08e1e6cb7d wifi: mt76: Drop unnecessary error check for debugfs_create_dir()
debugfs_create_dir() returns ERR_PTR and never return NULL.

As Russell suggested, this patch removes the error checking for
debugfs_create_dir(). This is because the DebugFS kernel API is developed
in a way that the caller can safely ignore the errors that occur during
the creation of DebugFS nodes. The debugfs APIs have a IS_ERR() judge in
start_creating() which can handle it gracefully. So these checks are
unnecessary.

Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipsets")
Signed-off-by: Jinjie Ruan <[email protected]>
Suggested-by: Russell King (Oracle) <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:34 +02:00
MeiChia ChiuandFelix Fietkau 791a45cffa wifi: mt76: mt7915: fix beamforming availability check
Without this patch, when ap sets the tx stream number to 2,
ap won't send any beamforming packet.

Fixes: f89f297aef28 ("mt76: mt7915: fix txbf starec TLV issues")
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:15 +02:00
Peter ChiuandFelix Fietkau 4a85678fe0 wifi: mt76: mt7915: update mpdu density capability
Set mpdu density to 2 usec for non-mt7915 Wi-Fi 6 generation chipsets
to align to the hardware capability which improves the throughput.

Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Peter ChiuandFelix Fietkau 4da6277403 wifi: mt76: check vif type before reporting cca and csa
Do not report cca and csa finish to upper layer on station type vif to
prevent warnings caused by setting beacon.

Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Shayne ChenandFelix Fietkau 29411e5205 wifi: mt76: fix per-band IEEE80211_CONF_MONITOR flag comparison
Use the correct ieee80211_conf of each band for IEEE80211_CONF_MONITOR
comparison.

Fixes: 24e69f6bc3ca ("mt76: fix monitor rx FCS error in DFS channel")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
StanleyYP WangandFelix Fietkau 65d91a833b wifi: mt76: get rid of false alamrs of tx emission issues
When the set_chan_info command is set with CH_SWITCH_NORMAL reason,
even if the action is UNI_CHANNEL_RX_PATH, it'll still generate some
unexpected tones, which might confuse DFS CAC tests that there are some
tone leakages. To get rid of these kinds of false alarms, always bypass
DPD calibration when IEEE80211_CONF_IDLE is set.

Reviewed-by: Evelyn Tsai <[email protected]>
Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Bo JiaoandFelix Fietkau af0e1f6daf wifi: mt76: fix potential memory leak of beacon commands
Fix potential memory leak when setting beacon and inband discovery
commands.

Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Allen YeandFelix Fietkau d5b4b81dcc wifi: mt76: check sta rx control frame to multibss capability
Add CAP3_RX_CTRL_FRAME_TO_MULTIBSS check when setting sta_muru_tlv,
which is used to get stations's capability of receiving control frames
when running OFDMA with MBSSIDs.

Signed-off-by: Allen Ye <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
MeiChia ChiuandFelix Fietkau 5a47dd323b wifi: mt76: update beacon size limitation
To accommodate 11v MBSSID IE and support maximum 16 MBSSIDs, expand the
beacon size limitation for beacon and inband discovery commands.

Co-developed-by: Peter Chiu <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Co-developed-by: Money Wang <[email protected]>
Signed-off-by: Money Wang <[email protected]>
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Chank ChenandFelix Fietkau 5971aa9684 wifi: mt76: connac: add MBSSID support for mt7996
Add bss_info_uni_mbssid tag and implement 802.11v MBSSID support for
mt7996 chipsets.

Signed-off-by: Chank Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Dmitry AntipovandFelix Fietkau 7d25bfc3f0 wifi: mt76: fix clang-specific fortify warnings
When compiling with clang 16.0.6 and CONFIG_FORTIFY_SOURCE=y, I've
noticed the following (somewhat confusing due to absence of an actual
source code location):

In file included from drivers/net/wireless/mediatek/mt76/mt792x_core.c:4:
In file included from ./include/linux/module.h:13:
In file included from ./include/linux/stat.h:19:
In file included from ./include/linux/time.h:60:
In file included from ./include/linux/time32.h:13:
In file included from ./include/linux/timex.h:67:
In file included from ./arch/x86/include/asm/timex.h:5:
In file included from ./arch/x86/include/asm/processor.h:23:
In file included from ./arch/x86/include/asm/msr.h:11:
In file included from ./arch/x86/include/asm/cpumask.h:5:
In file included from ./include/linux/cpumask.h:12:
In file included from ./include/linux/bitmap.h:11:
In file included from ./include/linux/string.h:254:
./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
declared with 'warning' attribute: detected read beyond size of field (2nd
parameter); maybe use struct_group()? [-Wattribute-warning]
                        __read_overflow2_field(q_size_field, size);

In file included from drivers/net/wireless/mediatek/mt76/mt7915/main.c:4:
In file included from ./include/linux/etherdevice.h:20:
In file included from ./include/linux/if_ether.h:19:
In file included from ./include/linux/skbuff.h:15:
In file included from ./include/linux/time.h:60:
In file included from ./include/linux/time32.h:13:
In file included from ./include/linux/timex.h:67:
In file included from ./arch/x86/include/asm/timex.h:5:
In file included from ./arch/x86/include/asm/processor.h:23:
In file included from ./arch/x86/include/asm/msr.h:11:
In file included from ./arch/x86/include/asm/cpumask.h:5:
In file included from ./include/linux/cpumask.h:12:
In file included from ./include/linux/bitmap.h:11:
In file included from ./include/linux/string.h:254:
./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
declared with 'warning' attribute: detected read beyond size of field (2nd
parameter); maybe use struct_group()? [-Wattribute-warning]
                        __read_overflow2_field(q_size_field, size);

In file included from drivers/net/wireless/mediatek/mt76/mt7996/main.c:6:
In file included from drivers/net/wireless/mediatek/mt76/mt7996/mt7996.h:9:
In file included from ./include/linux/interrupt.h:8:
In file included from ./include/linux/cpumask.h:12:
In file included from ./include/linux/bitmap.h:11:
In file included from ./include/linux/string.h:254:
./include/linux/fortify-string.h:592:4: warning: call to '__read_overflow2_field'
declared with 'warning' attribute: detected read beyond size of field (2nd
parameter); maybe use struct_group()? [-Wattribute-warning]
                        __read_overflow2_field(q_size_field, size);

The compiler actually complains on 'mt7915_get_et_strings()',
'mt792x_get_et_strings()' and 'mt7996_get_et_strings()' due to the same
reason: fortification logic inteprets call to 'memcpy()' as an attempt
to copy the whole array from its first member and so issues an overread
warning. These warnings may be silenced by passing an address of the whole
array and not the first member to 'memcpy()'.

Signed-off-by: Dmitry Antipov <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Ingo RohloffandFelix Fietkau 161f70217e wifi: mt76: mt7921e: Support MT7992 IP in Xiaomi Redmibook 15 Pro (2023)
In the Xiaomi Redmibook 15 Pro (2023) laptop I have got, a wifi chip is
used, which according to its PCI Vendor ID is from "ITTIM Technology".

This chip works flawlessly with the mt7921e module.  The driver doesn't
bind to this PCI device, because the Vendor ID from "ITTIM Technology" is
not recognized.

This patch adds the PCI Vendor ID from "ITTIM Technology" to the list of
PCI Vendor IDs and lets the mt7921e driver bind to the mentioned wifi
chip.

Signed-off-by: Ingo Rohloff <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:13:14 +02:00
Jinjie RuanandFelix Fietkau 8ccc841111 wifi: mt76: Use PTR_ERR_OR_ZERO() to simplify code
Return PTR_ERR_OR_ZERO() instead of return 0 or PTR_ERR() to
simplify code.

Signed-off-by: Jinjie Ruan <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Jen-Hao ChengandFelix Fietkau d497ee8aa2 wifi: mt76: mt7996: support per-band LED control
Extend settings of LED registers to support per-band configuration.

Signed-off-by: Jen-Hao Cheng <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Howard HsuandFelix Fietkau fea1e10c77 wifi: mt76: mt7996: support more options for mt7996_set_bitrate_mask()
Add support to configure parameters at runtime, such as mcs, gi, and
he_ltf. Note that EHT mode does not support this feature yet.

Co-developed-by: MeiChia Chiu <[email protected]>
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Shayne ChenandFelix Fietkau 751b054891 wifi: mt76: mt7996: only set vif teardown cmds at remove interface
Only send commands that disable vif when removing interface, this
reduces some unnecessary bss_info and sta_rec commands, especially for
station interface.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Peter ChiuandFelix Fietkau 1bb5a6a549 wifi: mt76: mt7996: fix TWT command format
Align the command format of UNI_CMD_TWT_ARGT_UPDATE to firmware.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Peter ChiuandFelix Fietkau 9723562f2a wifi: mt76: mt7996: fix rx rate report for CBW320-2
RX vector reports channel bandwidth 320-1 and 320-2 with different
values. Fix it to correctly report rx rate when using CBW320-2.

Fixes: 80f5a31d2856 ("wifi: mt76: mt7996: add support for EHT rate report")
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Peter ChiuandFelix Fietkau 719a98f832 wifi: mt76: mt7996: fix wmm queue mapping
Firmware uses access class index (ACI) for wmm parameters update, so
convert mac80211 queue to ACI in mt7996_conf_tx().

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Howard HsuandFelix Fietkau e512241bb5 wifi: mt76: mt7996: fix beamformee ss subfield in EHT PHY cap
According to P802.11be_D3.2 Table 9-404m, the minimum value of
Beamformee SS field shall be 3. Fix the values to follow the spec.

Fixes: 348533eb968d ("wifi: mt76: mt7996: add EHT capability init")
Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Howard HsuandFelix Fietkau 2cfe2fb0bb wifi: mt76: mt7996: fix beamform mcu cmd configuration
The bf_num field represents how many bands can support beamform, so set
the value to 3, and bf_bitmap represents the bitmap of bf_num.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Peter ChiuandFelix Fietkau 6fe92398c9 wifi: mt76: mt7996: set correct wcid in txp
Set correct wcid in txp to let the SDO hw module look into the correct
wtbl, otherwise the tx descriptor may be wrongly fiiled. This patch also
fixed the issue that driver could not correctly report sta statistics,
especially in WDS mode, which misled AQL.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Co-developed-by: Michael-CY Lee <[email protected]>
Signed-off-by: Michael-CY Lee <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau 84984e6dc8 wifi: mt76: connac: add more unified event IDs
Add more unified event IDs which will be used in new chipset.

This is the preliminary patch for mt7925 support.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau 9b38aebecf wifi: mt76: connac: add more unified command IDs
Add more unified command IDs which will be used in new chipset.

This is the preliminary patch for mt7925 support.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau a8081345c6 wifi: mt76: connac: add data field in struct tlv
Add tlv->data element for tlv parsing easier.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau 5df6b26a9f wifi: mt76: connac: add eht support for tx power
Add eht field in struct mt76_power_limits for 802.11be power config.
The function stack size would be too big by eht adding in structure,
we also refactor mt76_connac_mcu_rate_txpower_band() to take dynamic
allocated memory instead.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau c3858b5bf3 wifi: mt76: connac: add eht support for phy mode config
Add eht configuration support in existing function
mt76_connac_get_phy_mode_v2() and export it for mt7925.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau 899ff37808 wifi: mt76: connac: export functions for mt7925
mt7925 rely on the similar functionalities in connac layer.
Export them for mt7925 reuse.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau 0837f37e99 wifi: mt76: mt792x: support mt7925 chip init
add firmware download and dma init support for mt7925.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Deren WuandFelix Fietkau 62ddb6d46a wifi: mt76: connac: introduce helper for mt7925 chipset
Introduce is_mt7925() helper for new chipset. mt7925 runs the same
firmware download and mmio map flow as mt7921.

This is a preliminary patch to support mt7925 driver.

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-16 14:12:29 +02:00
Dmitry AntipovandFelix Fietkau 01860c02c5 wifi: mt76: add DMA mapping error check in mt76_alloc_txwi()
Add 'dma_mapping_error()' check in 'mt76_alloc_txwi()'.

Signed-off-by: Dmitry Antipov <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 20:35:32 +02:00
Felix Fietkau 8d5ea32d48 wifi: mt76: remove unused error path in mt76_connac_tx_complete_skb
The error handling code was added in order to allow tx enqueue to fail after
calling .tx_prepare_skb. Since this can no longer happen, the error handling
code is unused.

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 15:15:19 +02:00
Johannes BergandFelix Fietkau d71f8d1b17 wifi: mt76: use atomic iface iteration for pre-TBTT work
In addition to the previous series I posted, over time I'd
also like to get rid of the iflist_mtx in mac80211. That
isn't easy now since lots of places use iteration and would
have to be audited, but even a cursory look suggests that
mt76 might be more problematic than most since holding the
wiphy lock for the latency-sensitive pre-TBTT work could be
an issue.

Convert the pre-TBTT work to use atomic iteration and then
sending the device commands outside of it.

Signed-off-by: Johannes Berg <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 15:13:56 +02:00
Felix Fietkau cd371fcc98 mt76: mt7996: sync with upstream
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:51 +02:00
Ryder LeeandFelix Fietkau 325a0c4931 wifi: mt76: mt7996: fill txd by host driver
The hardware SDO has issue to fill txd for the moment, so fallback to
driver filling method.

Fixes: 98686cd21624 (wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices)
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:51 +02:00
Lorenzo BianconiandFelix Fietkau ca4917062f wifi: mt76: mt76x0: remove dead code in mt76x0_phy_get_target_power
tx_rate can't be greater than 3 in mt76x0_phy_get_target_power routine
for cck rates. Get rid of dead code.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:51 +02:00
Shayne ChenandFelix Fietkau b3f739a64e wifi: mt76: mt7996: add eht rx rate support
Add support to report eht rx rate.
Note that extended fields for eht in mt76_rx_status will make the struct
size exceed the cb size, so make nss and band share the same u8.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:51 +02:00
Felix Fietkau f1e1e67d97 wifi: mt76: fix race condition related to checking tx queue fill status
When drv_tx calls race against local tx scheduling, the queue fill status checks
can potentially race, leading to dma queue entries being overwritten.
Fix this by deferring packets from drv_tx calls to the tx worker, in order to
ensure that all regular queue tx comes from the same context.

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Felix Fietkau bbbac7deee wifi: mt76: rename mt76_packet_id_init/flush to mt76_wcid_init/cleanup
Also un-inline the functions. Will be used for further wcid init/cleanup

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Felix Fietkau b5d13611d3 mt76: mt7915: fix monitor mode issues
Enable receiving other-unicast packets
Disable RX header translation in order to proprerly receive data packets

Signed-off-by: Felix Fietkau <[email protected]>
2023-09-11 13:10:34 +02:00
Felix Fietkau b14c2351dd wifi: mt76: mt7603: disable A-MSDU tx support on MT7628
It was reported that this can cause the PSE hang issues, even with a low
number of fragments.

Link: https://github.com/openwrt/mt76/issues/793#issuecomment-1676529138
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 21:33:36 +02:00
Felix Fietkau 85cc58378d wifi: mt76: mt7603: add missing register initialization for MT7628
Ported from the vendor driver code

Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00
Felix Fietkau c03d84c0d0 wifi: mt76: mt7603: improve stuck beacon handling
Before preparing the new beacon, check the queue status, flush out all
previous beacons and buffered multicast packets, then (if necessary)
try to recover more gracefully from a stuck beacon condition by making a
less invasive attempt at getting the MAC un-stuck.

Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00
Felix Fietkau a8d9553d8f wifi: mt76: mt7603: improve watchdog reset reliablity
Only trigger PSE reset if PSE was stuck, otherwise it can cause DMA issues.
Trigger the PSE reset while DMA is fully stopped in order to improve
reliabilty.

Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00
Felix Fietkau 80b8bcf0e3 wifi: mt76: mt7603: rework/fix rx pse hang check
It turns out that the code in mt7603_rx_pse_busy() does not detect actual
hardware hangs, it only checks for busy conditions in PSE.
A reset should only be performed if these conditions are true and if there
is no rx activity as well.
Reset the counter whenever a rx interrupt occurs. In order to also deal with
a fully loaded CPU that leaves interrupts disabled with continuous NAPI
polling, also check for pending rx interrupts in the function itself.

Fixes: c8846e101502 ("mt76: add driver for MT7603E and MT7628/7688")
Signed-off-by: Felix Fietkau <[email protected]>
2023-08-14 14:08:13 +02:00