]> Git Repo - linux.git/log
linux.git
16 months agowifi: mt76: mt7996: rework register offsets for mt7992
StanleyYP Wang [Mon, 13 Nov 2023 07:06:15 +0000 (15:06 +0800)]
wifi: mt76: mt7996: rework register offsets for mt7992

Add mt7992_offs to differentiate registers that share the same
definitions with mt7996 chipsets but have differnet offsets.
This is a preliminary patch for mt7992 chipsets support.

Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add DMA support for mt7992
Benjamin Lin [Mon, 13 Nov 2023 07:06:14 +0000 (15:06 +0800)]
wifi: mt76: mt7996: add DMA support for mt7992

Add DMA TX/RX queues and RRO init flow for mt7992 chipsets.
This is a preliminary patch for mt7992 chipsets support.

Co-developed-by: StanleyYP Wang <[email protected]>
Signed-off-by: StanleyYP Wang <[email protected]>
Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Benjamin Lin <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: connac: add firmware support for mt7992
StanleyYP Wang [Mon, 13 Nov 2023 07:06:13 +0000 (15:06 +0800)]
wifi: mt76: connac: add firmware support for mt7992

Support firmware download and enable related AFE PLL for mt7992 chipsets.
This is a preliminary patch for mt7992 chipsets support.

Co-developed-by: Benjamin Lin <[email protected]>
Signed-off-by: Benjamin Lin <[email protected]>
Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: introduce mt7996_band_valid()
Shayne Chen [Mon, 13 Nov 2023 07:06:12 +0000 (15:06 +0800)]
wifi: mt76: mt7996: introduce mt7996_band_valid()

Replace dbdc_support and tbtc_support with mt7996_band_valid() to
support mt7996 variants with band0/band2 dual-band support.
This changes reduces ambiguity when checking supported bands on different
variants or new chipsets, as well as during the init configurations on
DMA TX/RX queues or irq masks.

Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: fix mt7996_mcu_all_sta_info_event struct packing
Arnd Bergmann [Fri, 10 Nov 2023 14:29:30 +0000 (15:29 +0100)]
wifi: mt76: mt7996: fix mt7996_mcu_all_sta_info_event struct packing

The internal struct and union inside mt7996_mcu_all_sta_info_event is
marked as being aligned, which conflicts with it being unaligned
within that structure:

drivers/net/wireless/mediatek/mt76/mt7996/mcu.h:165:2: error: field  within 'struct mt7996_mcu_all_sta_info_event' is less aligned than 'union mt7996_mcu_all_sta_info_event::(anonymous at ../drivers/net/wireless/mediatek/mt76/mt7996/mcu.h:165:2)' and is usually due to 'struct mt7996_mcu_all_sta_info_event' being packed, which can lead to unaligned accesses [-Werror,-Wunaligned-access]

Mark all three as being packed as well to ensure byte packing for
the entire thing.

Fixes: adde3eed4a75 ("wifi: mt76: mt7996: Add mcu commands for getting sta tx statistic")
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7915: also MT7981 is 3T3R but nss2 on 5 GHz band
StanleyYP Wang [Mon, 6 Nov 2023 22:39:31 +0000 (22:39 +0000)]
wifi: mt76: mt7915: also MT7981 is 3T3R but nss2 on 5 GHz band

Just like MT7916 also MT7981 can handle 3T3R DBDC frontend and should
hence be included in the corresponding conditional expression in the
driver. Add it.

Fixes: 6bad146d162e ("wifi: mt76: mt7915: add support for MT7981")
Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Daniel Golle <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7915: fix EEPROM offset of TSSI flag on MT7981
StanleyYP Wang [Mon, 6 Nov 2023 22:38:53 +0000 (22:38 +0000)]
wifi: mt76: mt7915: fix EEPROM offset of TSSI flag on MT7981

The offset of the TSSI flag on the EEPROM of MT7981 devices was wrong.
Set the correct offset instead.

Fixes: 6bad146d162e ("wifi: mt76: mt7915: add support for MT7981")
Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Daniel Golle <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: connac: fix EHT phy mode check
MeiChia Chiu [Thu, 2 Nov 2023 10:03:02 +0000 (18:03 +0800)]
wifi: mt76: connac: fix EHT phy mode check

Add a BSS eht_support check before returning EHT phy mode. Without this
patch, there might be an inconsistency where the softmac layer thinks
the BSS is in HE mode, while the FW thinks it is in EHT mode.

Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: connac: add beacon protection support for mt7996
Allen Ye [Thu, 2 Nov 2023 10:03:01 +0000 (18:03 +0800)]
wifi: mt76: connac: add beacon protection support for mt7996

Implement beacon protection feature for mt7996 chipsets, and also do
some cleanup on the set key routine.

Co-developed-by: Rudra Shahi <[email protected]>
Signed-off-by: Rudra Shahi <[email protected]>
Signed-off-by: Allen Ye <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: rework ampdu params setting
Peter Chiu [Thu, 2 Nov 2023 10:03:00 +0000 (18:03 +0800)]
wifi: mt76: mt7996: rework ampdu params setting

Add sta_rec_ht_uni struct to pass HT ampdu params to firmware. For VHT,
HE, and EHT mode, firmware will get the ampdu params by parsing the
corresponding capability.

Co-developed-by: Shayne Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: fix alignment of sta info event
StanleyYP Wang [Thu, 2 Nov 2023 10:02:59 +0000 (18:02 +0800)]
wifi: mt76: mt7996: fix alignment of sta info event

Fix the alignment of struct mt7996_mcu_all_sta_info_event.

Fixes: adde3eed4a75 ("wifi: mt76: mt7996: Add mcu commands for getting sta tx statistic")
Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: switch to mcu command for TX GI report
Benjamin Lin [Thu, 2 Nov 2023 10:02:58 +0000 (18:02 +0800)]
wifi: mt76: mt7996: switch to mcu command for TX GI report

During runtime, the GI value in the WTBL is not updated in real-time. To
obtain the latest results for the TX GI, switch to use an MCU command.

Signed-off-by: Benjamin Lin <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: use chainmask for power delta calculation
Allen Ye [Thu, 2 Nov 2023 10:02:57 +0000 (18:02 +0800)]
wifi: mt76: use chainmask for power delta calculation

The power gain value is related to total TX path, so change the
calculation to use per-phy chainmask.

Signed-off-by: Allen Ye <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add txpower setting support
Shayne Chen [Thu, 2 Nov 2023 10:02:56 +0000 (18:02 +0800)]
wifi: mt76: mt7996: add txpower setting support

Add support for setting txpower from upper layer and configuring per-rate
txpower limit table.

Co-developed-by: Allen Ye <[email protected]>
Signed-off-by: Allen Ye <[email protected]>
Co-developed-by: StanleyYP Wang <[email protected]>
Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: change txpower init to per-phy
Shayne Chen [Thu, 2 Nov 2023 10:02:55 +0000 (18:02 +0800)]
wifi: mt76: change txpower init to per-phy

Use per-phy structure for maximum txpower value initializing, since each
phy may have a different chainmask, which can impact the calculation of
power gain.

Co-developed-by: Allen Ye <[email protected]>
Signed-off-by: Allen Ye <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: fix rate usage of inband discovery frames
MeiChia Chiu [Mon, 23 Oct 2023 15:38:54 +0000 (23:38 +0800)]
wifi: mt76: mt7996: fix rate usage of inband discovery frames

For UBPR and FILS frames, the BSS_CHANGED_BEACON flag will also be set,
which causes those frames to use the beacon rate in TX descriptors.
Adjust the statement to fix this issue.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: MeiChia Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: align the format of fixed rate command
Peter Chiu [Mon, 23 Oct 2023 15:38:53 +0000 (23:38 +0800)]
wifi: mt76: mt7996: align the format of fixed rate command

Use the new fixed rate command format to let the fixed field function
work normally.

Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: handle IEEE80211_RC_SMPS_CHANGED
Peter Chiu [Mon, 23 Oct 2023 15:38:52 +0000 (23:38 +0800)]
wifi: mt76: mt7996: handle IEEE80211_RC_SMPS_CHANGED

Make mt7996_mcu_set_fixed_field() non-static in order to handle
IEEE80211_RC_SMPS_CHANGED in mt7996_mac_sta_rc_work().

Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: connac: set fixed_bw bit in TX descriptor for fixed rate frames
Howard Hsu [Mon, 23 Oct 2023 15:38:51 +0000 (23:38 +0800)]
wifi: mt76: connac: set fixed_bw bit in TX descriptor for fixed rate frames

Always set the fixed_bw bitfield for fixed rate frames to keep it being
sent with specific bandwidth. Without this change, the bw of fixed rate
frames will still be decided by hardware.

Reported-by: Chank Chen <[email protected]>
Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: adjust WFDMA settings to improve performance
Peter Chiu [Mon, 23 Oct 2023 15:38:50 +0000 (23:38 +0800)]
wifi: mt76: mt7996: adjust WFDMA settings to improve performance

Refactor and update dma prefetch parts and also split band 1 traffic to
PCIe 1 to enhance throughput.

Signed-off-by: Peter Chiu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: fix the size of struct bss_rate_tlv
Sujuan Chen [Mon, 23 Oct 2023 15:38:49 +0000 (23:38 +0800)]
wifi: mt76: mt7996: fix the size of struct bss_rate_tlv

Align the format of struct bss_rate_tlv to the firmware.

Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices")
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: connac: add beacon duplicate TX mode support for mt7996
StanleyYP Wang [Mon, 23 Oct 2023 15:38:48 +0000 (23:38 +0800)]
wifi: mt76: connac: add beacon duplicate TX mode support for mt7996

For connac3 chipsets, setting of spe_idx is moved from TX descriptor to
the fixed rate table. This patch implements the setting to support
duplicate TX mode for beacon.

Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add thermal sensor device support
Howard Hsu [Mon, 23 Oct 2023 15:38:47 +0000 (23:38 +0800)]
wifi: mt76: mt7996: add thermal sensor device support

This patch adds support for thermal sensor device, including the
following features:
- Support to read current chip temperature.
- Support to set/get the trigger/restore temperature for thermal service.
- Support to read current chip tx cycle.

Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: connac: add thermal protection support for mt7996
Howard Hsu [Mon, 23 Oct 2023 15:38:46 +0000 (23:38 +0800)]
wifi: mt76: connac: add thermal protection support for mt7996

Implement thermal protection commands and support Linux cooling device
control for mt7996 chipsets.

Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add TX statistics for EHT mode in debugfs
Howard Hsu [Mon, 23 Oct 2023 15:38:45 +0000 (23:38 +0800)]
wifi: mt76: mt7996: add TX statistics for EHT mode in debugfs

Add EHT statistics of beamforming feedback and BW320 in debugfs tx_stats
command.

Signed-off-by: Howard Hsu <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add support for variants with auxiliary RX path
Shayne Chen [Mon, 23 Oct 2023 15:38:44 +0000 (23:38 +0800)]
wifi: mt76: mt7996: add support for variants with auxiliary RX path

Add support to correctly configure the rx chainmask of variants that
have additional auxiliary RX path. e.g., 4T5R.
The auxiliary RX path is transparent to driver, but driver needs to
correctly configure it in the set channel fw command.

Co-developed-by: StanleyYP Wang <[email protected]>
Signed-off-by: StanleyYP Wang <[email protected]>
Signed-off-by: Shayne Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7915: fallback to non-wed mode if platform_get_resource fails in mt7915...
Lorenzo Bianconi [Fri, 20 Oct 2023 10:45:19 +0000 (12:45 +0200)]
wifi: mt76: mt7915: fallback to non-wed mode if platform_get_resource fails in mt7915_mmio_wed_init()

mt76 assumes mt7915_mmio_wed_init can fail just after wed driver has
been attached running mtk_wed_device_attach().
Fall back to non-wed mode if platform_get_resource fails in
mt7915_mmio_wed_init routines.

Fixes: eebb70976be5 ("wifi: mt76: mt7915: enable wed for mt7986-wmac chipset")
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add wed rro delete session garbage collector
Lorenzo Bianconi [Fri, 20 Oct 2023 10:31:00 +0000 (12:31 +0200)]
wifi: mt76: mt7996: add wed rro delete session garbage collector

Introduce the capability to clear WED rro session configured in the hw
according to the event reported by the MCU firmware

Co-developed-by: Sujuan Chen <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Co-developed-by: Bo Jiao <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add wed reset support
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:59 +0000 (12:30 +0200)]
wifi: mt76: mt7996: add wed reset support

Introduce the capability to reset mt7996 chipset if requested by wed
driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: move wed reset common code in mt76 module
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:58 +0000 (12:30 +0200)]
wifi: mt76: move wed reset common code in mt76 module

Move WED reset code shared between mt7915 and mt7996 in common module.
This is a preliminary patch to introduce WED reset support for mt7996.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add wed rx support
Bo Jiao [Fri, 20 Oct 2023 10:30:57 +0000 (12:30 +0200)]
wifi: mt76: mt7996: add wed rx support

Similar to MT7915, enable Wireless Ethernet Ditpatcher for MT7996
to offload traffic received from the WLAN nic and transmitted on the
LAN one

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Co-developed-by: Sujuan Chen <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Bo Jiao <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: use u16 for val field in mt7996_mcu_set_rro signature
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:56 +0000 (12:30 +0200)]
wifi: mt76: mt7996: use u16 for val field in mt7996_mcu_set_rro signature

This is a preliminary patch to introduce WED rx support for mt7996
driver.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: dma: introduce __mt76_dma_queue_reset utility routine
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:55 +0000 (12:30 +0200)]
wifi: mt76: dma: introduce __mt76_dma_queue_reset utility routine

This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: add wed tx support
Sujuan Chen [Fri, 20 Oct 2023 10:30:54 +0000 (12:30 +0200)]
wifi: mt76: mt7996: add wed tx support

Similar to MT7915, enable Wireless Ethernet Ditpatcher for MT7996
to offload traffic received from the LAN nic and transmitted on the
WLAN one

Co-developed-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Sujuan Chen <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: increase MT_QFLAG_WED_TYPE size
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:53 +0000 (12:30 +0200)]
wifi: mt76: increase MT_QFLAG_WED_TYPE size

This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: introduce wed pointer in mt76_queue
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:52 +0000 (12:30 +0200)]
wifi: mt76: introduce wed pointer in mt76_queue

Introduce mtk_wed_device pointer in mt76_queue structure in order to
configure WED chip.
Get rid of dev parameter in Q_READ and Q_WRITE macros.
Introduce wed parameter to the following routine signatures:
- mt76_init_queue
- mt76_init_tx_queue

This is a preliminary patch to introduce WED support for mt7996 since
mt7996 runs two separate WED chips.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: introduce mt76_queue_is_wed_tx_free utility routine
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:51 +0000 (12:30 +0200)]
wifi: mt76: introduce mt76_queue_is_wed_tx_free utility routine

This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: move mt76_net_setup_tc in common code
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:50 +0000 (12:30 +0200)]
wifi: mt76: move mt76_net_setup_tc in common code

This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: move mt76_mmio_wed_offload_{enable,disable} in common code
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:49 +0000 (12:30 +0200)]
wifi: mt76: move mt76_mmio_wed_offload_{enable,disable} in common code

mt76_mmio_wed_offload_enable and mt76_mmio_wed_offload_disable routines
will be reused by mt7996 driver for wed support.

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mmio: move mt76_mmio_wed_{init,release}_rx_buf in common code
Lorenzo Bianconi [Fri, 20 Oct 2023 10:30:48 +0000 (12:30 +0200)]
wifi: mt76: mmio: move mt76_mmio_wed_{init,release}_rx_buf in common code

Move mt76_mmio_wed_init_rx_buf and mt76_mmio_wed_release_rx_buf routines
in common code.
This is a preliminary patch to introduce WED support for mt7996

Signed-off-by: Lorenzo Bianconi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: Remove unnecessary (void*) conversions
Wu Yunchuan [Fri, 20 Oct 2023 09:34:32 +0000 (17:34 +0800)]
wifi: mt76: Remove unnecessary (void*) conversions

No need cast (void *) to (struct mt7615_phy *).

Signed-off-by: Wu Yunchuan <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: permit to load precal from NVMEM cell for mt7915
Christian Marangi [Wed, 18 Oct 2023 13:09:42 +0000 (15:09 +0200)]
wifi: mt76: permit to load precal from NVMEM cell for mt7915

Permit to load precal from NVMEM cell for mt7915. The NVMEM cell must be
named "precal" to be correctly loaded.

NVMEM cell must already account the correct offset and be placed after
the EEPROM as the function expect the data right from the start.

Tested-by: Shiji Yang <[email protected]>
Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: permit to use alternative cell name to eeprom NVMEM load
Christian Marangi [Wed, 18 Oct 2023 13:09:41 +0000 (15:09 +0200)]
wifi: mt76: permit to use alternative cell name to eeprom NVMEM load

Generilize mt76_get_of_eeprom_from_nvmem to use alternative cell name by
passing the cell name as an arg and expose it.

Rename it to mt76_get_of_data_from_nvmem to better reflect the now more
generic usage.

This is to permit driver to load additional cell, like precal cell.

Tested-by: Shiji Yang <[email protected]>
Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: make mt76_get_of_eeprom static again
Christian Marangi [Wed, 18 Oct 2023 13:09:40 +0000 (15:09 +0200)]
wifi: mt76: make mt76_get_of_eeprom static again

Since mt76_get_of_eeprom is not used by mt7915 anymore, unexport it and
make it static again.

Also drop offset arg as it's only supported for MTD and was always set
to 0, hardcode the MTD functio instead.

Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: limit support of precal loading for mt7915 to MTD only
Christian Marangi [Wed, 18 Oct 2023 13:09:39 +0000 (15:09 +0200)]
wifi: mt76: limit support of precal loading for mt7915 to MTD only

Limit support for precal loading for mt7915 only to MTD. Passing data
from DT doesn't support offset and NVMEM require a different cell name
and doesn't support offset hence only MTD way is actually supported.

Rename mt76_get_of_eeprom_from_mtd to mt76_get_of_data_from_mtd as it is
now used for a more generic purpose and export it.

Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: fix typo in mt76_get_of_eeprom_from_nvmem function
Christian Marangi [Wed, 18 Oct 2023 13:09:38 +0000 (15:09 +0200)]
wifi: mt76: fix typo in mt76_get_of_eeprom_from_nvmem function

Fix typo in mt76_get_of_eeprom_from_nvmem where eeprom was misspelled as
epprom.

Fixes: 5bef3a406c6e ("wifi: mt76: add support for providing eeprom in nvmem cells")
Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: fix broken precal loading from MTD for mt7915
Christian Marangi [Wed, 18 Oct 2023 13:09:37 +0000 (15:09 +0200)]
wifi: mt76: fix broken precal loading from MTD for mt7915

Commit 495184ac91bb ("mt76: mt7915: add support for applying
pre-calibration data") was fundamentally broken and never worked.

The idea (before NVMEM support) was to expand the MTD function and pass
an additional offset. For normal EEPROM load the offset would always be
0. For the purpose of precal loading, an offset was passed that was
internally the size of EEPROM, since precal data is right after the
EEPROM.

Problem is that the offset value passed is never handled and is actually
overwrite by

offset = be32_to_cpup(list);
ret = mtd_read(mtd, offset, len, &retlen, eep);

resulting in the passed offset value always ingnored. (and even passing
garbage data as precal as the start of the EEPROM is getting read)

Fix this by adding to the current offset value, the offset from DT to
correctly read the piece of data at the requested location.

Cc: [email protected]
Fixes: 495184ac91bb ("mt76: mt7915: add support for applying pre-calibration data")
Signed-off-by: Christian Marangi <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7996: fix uninitialized variable in parsing txfree
Yi-Chia Hsieh [Thu, 12 Oct 2023 22:00:26 +0000 (15:00 -0700)]
wifi: mt76: mt7996: fix uninitialized variable in parsing txfree

Fix the uninitialized variable warning in mt7996_mac_tx_free.

Fixes: 2461599f835e ("wifi: mt76: mt7996: get tx_retries and tx_failed from txfree")
Signed-off-by: Yi-Chia Hsieh <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: mt7921: support 5.9/6GHz channel config in acpi
Rong Yan [Sun, 1 Oct 2023 15:02:05 +0000 (23:02 +0800)]
wifi: mt76: mt7921: support 5.9/6GHz channel config in acpi

The mtcl table, configured by platform vendor, provides regulatory
information for 5.9/6 GHz channels. mt792x should work on
corresponding channels supported by mtcl. This patch would parse
the settings in mtcl table and apply the result into chip side.

Signed-off-by: Rong Yan <[email protected]>
Co-developed-by: Deren Wu <[email protected]>
Signed-off-by: Deren Wu <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: mt76: add ability to explicitly forbid LED registration with DT
Ryder Lee [Thu, 24 Aug 2023 17:08:37 +0000 (01:08 +0800)]
wifi: mt76: add ability to explicitly forbid LED registration with DT

Add ability to explicitly forbid LED registration using DT led\status = "disabled".

Tested-by: Alexey D. Filimonov <[email protected]>
Signed-off-by: Alexey D. Filimonov <[email protected]>
Signed-off-by: Ryder Lee <[email protected]>
Signed-off-by: Felix Fietkau <[email protected]>
16 months agowifi: rtw89: mac: refine SER setting during WiFi CPU power on
Ping-Ke Shih [Mon, 4 Dec 2023 08:07:51 +0000 (16:07 +0800)]
wifi: rtw89: mac: refine SER setting during WiFi CPU power on

Don't enable firmware debug mode to prevent SER flow stuck due to fail
to reset payload buffer, and clear HALT_C2H_INT to avoid handling
unexpected interrupt at beginning.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: 8922a: dump MAC registers when SER occurs
Chia-Yuan Li [Mon, 4 Dec 2023 08:07:50 +0000 (16:07 +0800)]
wifi: rtw89: 8922a: dump MAC registers when SER occurs

To diagnose the reason why firmware or hardware get abnormal, add to dump
MAC registers related to counters and interrupt masks. With these values,
people can classify problems and check if registers values are unexpected,
and then correct them. However, it could possible false alarm because
firmware triggers this SER event by wrong conditions that we should
correct it at firmware or register settings.

In field, SER might happen under special conditions, and very hard to
happen again, so dump lots of registers to provide rich information to
catch the problem.

Signed-off-by: Chia-Yuan Li <[email protected]>
Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: 8922a: add SER IMR tables
Ping-Ke Shih [Mon, 4 Dec 2023 08:07:49 +0000 (16:07 +0800)]
wifi: rtw89: 8922a: add SER IMR tables

To activate SER (system error recovery) in firmware, we have to configure
IMR to trigger interrupts, and then SER can check registers to know if it
need to reset hardware or notify driver to re-configure whole settings.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: fw: extend program counter dump for Wi-Fi 7 chip
Zong-Zhe Yang [Mon, 4 Dec 2023 08:07:48 +0000 (16:07 +0800)]
wifi: rtw89: fw: extend program counter dump for Wi-Fi 7 chip

Extend FW program counter dump for Wi-Fi 7 chip.
They poll different addresses.

Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: 8922a: configure CRASH_TRIGGER FW feature
Zong-Zhe Yang [Mon, 4 Dec 2023 08:07:47 +0000 (16:07 +0800)]
wifi: rtw89: 8922a: configure CRASH_TRIGGER FW feature

RTL8922A FW supports CRASH_TRIGGER feature from v0.34.30.0.
After it, debugfs fw_crash can accept type 1 on RTL8922A to
trigger firmware crash and verify L2 recovery.

Besides, RTL8922A sync address offset of reserved payload engine.
And, SER (system error recovery) tweaks conversion from WCPU address
to indirect access address for RTL8922A. The new conversion works
for all supported chips.

Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath5k: remove unused ath5k_eeprom_info::ee_antenna
Jiri Slaby (SUSE) [Tue, 5 Dec 2023 11:15:15 +0000 (12:15 +0100)]
wifi: ath5k: remove unused ath5k_eeprom_info::ee_antenna

clang-struct [1] found that ee_antenna in struct ath5k_eeprom_info is
unused. The commit 1048643ea94d ("ath5k: Clean up eeprom
parsing and add missing calibration data") added it, but did not use it
in any way. Neither, there is a later user.

So remove that unused member.

[1] https://github.com/jirislaby/clang-struct

Signed-off-by: Jiri Slaby (SUSE) <[email protected]>
Cc: Felix Fietkau <[email protected]>
Cc: Nick Kossifidis <[email protected]>
Cc: Luis Chamberlain <[email protected]>
Cc: Kalle Valo <[email protected]>
Cc: [email protected]
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath10k: add support to allow broadcast action frame RX
James Prestwood [Tue, 5 Dec 2023 15:15:36 +0000 (17:15 +0200)]
wifi: ath10k: add support to allow broadcast action frame RX

Broadcast action frames are needed for the Device Provisioning
Protocol (DPP) for Presence and PKEX Exchange requests. Currently
just ath9k has this capability so this is being enabled for
ath10k (for at least one hardware variant).

Add a new capability flag in ath10k_hw_params to indicate support
for receiving multicast action frames. This bit is then checked
when configuring the RX filter and (if set) multicast action frame
registration is enabled.

Until more hardware can be tested only the "qca6174 hw3.2" variant
is enabling this feature.

Note: I went ahead and removed the 'changed_flags' mask operation
since it had no effect, that parameter was not being used anywhere.

Tested-on: QCA6174 hw3.2 WLAN.RM.4.4.1-00288-

Signed-off-by: James Prestwood <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: cfg80211: make RX assoc data const
Johannes Berg [Thu, 30 Nov 2023 21:50:58 +0000 (22:50 +0100)]
wifi: cfg80211: make RX assoc data const

This is just a collection of data and we only read it,
so make it const.

Signed-off-by: Johannes Berg <[email protected]>
16 months agowifi: nl80211: refactor nl80211_send_mlme_event() arguments
Johannes Berg [Thu, 30 Nov 2023 21:39:41 +0000 (22:39 +0100)]
wifi: nl80211: refactor nl80211_send_mlme_event() arguments

This function has so many arguments already, before adding
yet another one, refactor it to take a struct instead.

Signed-off-by: Johannes Berg <[email protected]>
16 months agowifi: ath12k: avoid repeated wiphy access from hw
Karthikeyan Periyasamy [Fri, 1 Dec 2023 01:37:35 +0000 (07:07 +0530)]
wifi: ath12k: avoid repeated wiphy access from hw

Currently repeated access of wiphy data from mac80211 hw structure is
happen inside the mac80211 registration helper functions. So optimize
these helper functions by storing wiphy data locally and accessing it
directly.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Karthikeyan Periyasamy <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: fix and enable AP mode for WCN7850
Kang Yang [Fri, 1 Dec 2023 16:09:48 +0000 (18:09 +0200)]
wifi: ath12k: fix and enable AP mode for WCN7850

For AP mode, the peer is created earlier in ath12k_mac_op_add_interface() but
ath12k_mac_op_assign_vif_chanctx() will try to create peer again.  Then an
error will return which makes AP mode startup fail.

Kernel log:

[ 5017.665006] ath12k_pci 0000:04:00.0: failed to create peer after vdev start delay: -22

wpa_supplicant log:

Failed to set beacon parameters
Interface initialization failed
wls1: interface state UNINITIALIZED->DISABLED
wls1: AP-DISABLED
wls1: Unable to setup interface.
Failed to initialize AP interface
wls1: interface state DISABLED->DISABLED
wls1: AP-DISABLED

So fix this check and enable AP mode for WCN7850, as now AP mode works normally.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: set IRQ affinity to CPU0 in case of one MSI vector
Kang Yang [Fri, 1 Dec 2023 16:09:48 +0000 (18:09 +0200)]
wifi: ath12k: set IRQ affinity to CPU0 in case of one MSI vector

With VT-d disabled on Intel platform, ath12k gets only one MSI
vector. In that case, ath12k does not free IRQ when doing suspend,
hence the kernel has to migrate it to CPU0 (if it was affine to
other CPUs) and allocates a new MSI vector. However, ath12k has
no chance to reconfig it to HW srngs during this phase, thus
ath12k fails to resume.

This issue can be fixed by setting IRQ affinity to CPU0 before
request_irq is called. With such affinity, migration will not
happen and thus the vector keeps unchanged during suspend/resume.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: do not restore ASPM in case of single MSI vector
Kang Yang [Fri, 1 Dec 2023 16:09:47 +0000 (18:09 +0200)]
wifi: ath12k: do not restore ASPM in case of single MSI vector

Current code enables ASPM by default, it allows MHI to enter M2 state.
In case of one MSI vector, system hang is observed if ath12k does MHI
register reading in this state.

The workaround here is to prevent MHI from entering M2 state, this can
be done by disabling ASPM if only one MSI vector is used. When using 32
vectors ASPM is enabled as before.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: add support one MSI vector
Kang Yang [Fri, 1 Dec 2023 16:09:47 +0000 (18:09 +0200)]
wifi: ath12k: add support one MSI vector

On some platforms it's not possible to allocate 32 MSI vectors for
various reasons, maybe kernel configuration, VT-d disabled, buggy BIOS
etc. So ath12k was not able to use WCN7850 PCI devices on those
platforms. Add support for one MSI vector to solve that.

In case of one MSI vector, interrupt migration needs to be disabled.
This is because when interrupt migration happens, the msi_data may
change. However, msi_data is already programmed to rings during initial
phase and ath12k has no way to know that msi_data is changed during run
time and reprogram again.

In case of one MSI vector, MHI subsystem should not use IRQF_NO_SUSPEND
as WCN7850 doesn't set this flag too. Ath12k doesn't need to leave IRQ
enabled in suspend state.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: refactor multiple MSI vector implementation
Kang Yang [Fri, 1 Dec 2023 16:09:47 +0000 (18:09 +0200)]
wifi: ath12k: refactor multiple MSI vector implementation

This is to prepare for one MSI vector support. IRQ enable and disable
of CE and DP are done only in case of multiple MSI vectors.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: use ATH12K_PCI_IRQ_DP_OFFSET for DP IRQ
Kang Yang [Fri, 1 Dec 2023 16:09:47 +0000 (18:09 +0200)]
wifi: ath12k: use ATH12K_PCI_IRQ_DP_OFFSET for DP IRQ

Like ATH12K_PCI_IRQ_CE0_OFFSET, define ATH12K_PCI_IRQ_DP_OFFSET for
DP to save the IRQ instead of base_vector from MSI config.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: add CE and ext IRQ flag to indicate irq_handler
Kang Yang [Fri, 1 Dec 2023 16:09:47 +0000 (18:09 +0200)]
wifi: ath12k: add CE and ext IRQ flag to indicate irq_handler

Add two flags to indicate whether IRQ handler for CE and DP can be called.
This is because in one MSI vector case, interrupt is not disabled in
hif_stop and hif_irq_disable. So if interrupt is disabled, MHI interrupt
is disabled too.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: get msi_data again after request_irq is called
Kang Yang [Fri, 1 Dec 2023 16:09:47 +0000 (18:09 +0200)]
wifi: ath12k: get msi_data again after request_irq is called

The reservation mode of interrupts in kernel assigns a dummy vector
when the interrupt is allocated and assigns a real vector when the
request_irq is called. The reservation mode helps to ease vector
pressure when devices with a large amount of queues/interrupts are
initialized, but only a minimal subset of those queues/interrupts
is actually used.

So on reservation mode, the msi_data may change after request_irq is
called, then it will lead to spurious interrupt. But when VT-d in
BIOS is enabled and ath12k can get 32 MSI vectors, ath12k always get
the same msi_data before and after request_irq.

So in case of one MSI vector, ath12k need read msi_data again after
request_irq is called, and then the correct msi_data is programmed
into WCN7850 hardware components.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0-03427-QCAHMTSWPL_V1.0_V2.0_SILICONZ-1.15378.4

Signed-off-by: Kang Yang <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: wcn36xx: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 17 Nov 2023 09:31:01 +0000 (10:31 +0100)]
wifi: wcn36xx: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <[email protected]>
Reviewed-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath5k: Convert to platform remove callback returning void
Uwe Kleine-König [Fri, 17 Nov 2023 09:30:59 +0000 (10:30 +0100)]
wifi: ath5k: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.

To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <[email protected]>
Reviewed-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: avoid repeated hw access from ar
Karthikeyan Periyasamy [Mon, 20 Nov 2023 23:58:12 +0000 (05:28 +0530)]
wifi: ath12k: avoid repeated hw access from ar

Currently, the helper functions are accessing mac80211 hw data from the
radio (ar) structure repeatedly. So optimize these helper functions by
storing mac80211 hw data locally and accessing it directly.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Karthikeyan Periyasamy <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: Optimize the mac80211 hw data access
Karthikeyan Periyasamy [Mon, 20 Nov 2023 23:58:11 +0000 (05:28 +0530)]
wifi: ath12k: Optimize the mac80211 hw data access

Currently mac80211 hw data is accessed by convert the hw to radio (ar)
structure and then radio to hw structure which is not necessary in some
places where mac80211 hw data is already present. So in that kind of
places avoid the conversion and directly access the mac80211 hw data.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Karthikeyan Periyasamy <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: ath12k: add 320 MHz bandwidth enums
Muna Sinada [Thu, 30 Nov 2023 17:09:51 +0000 (19:09 +0200)]
wifi: ath12k: add 320 MHz bandwidth enums

Add 320 MHz bandwidth as a new bandwidth enum for ATH12k driver. This
is extending existing bandwidth related enums to include 320 MHz. This
is a precursor to supporting 320 MHz in the future.

Sanity test performed to confirm that there was no impact in existing
bandwidths.

Additionally update QuIC copyright to include 2023 in hal_rx.h.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00125-QCAHKSWPL_SILICONZ-1

Signed-off-by: Muna Sinada <[email protected]>
Acked-by: Jeff Johnson <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: fix misbehavior of TX beacon in concurrent mode
Chih-Kang Chang [Wed, 29 Nov 2023 07:00:46 +0000 (15:00 +0800)]
wifi: rtw89: fix misbehavior of TX beacon in concurrent mode

In concurrent mode, when STA interface is scanning, it causes
AP interface TX beacon on wrong channel. We modified it to scan
with the operating channel when one of the interfaces is already
connected. Additionally, STA interface need to stop scan when AP
interface is starting to avoid TX beacon on wrong channel. Finally,
AP interface need to stop TX beacon when STA interface is scanning
and switching to non-OP channel,This prevent other device to get
beacons on wrong channel.

Signed-off-by: Chih-Kang Chang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: refine remain on channel flow to improve P2P connection
Chih-Kang Chang [Wed, 29 Nov 2023 07:00:45 +0000 (15:00 +0800)]
wifi: rtw89: refine remain on channel flow to improve P2P connection

We add a scanning check to avoid entering IPS after ROC (remain on
channel) during scanning. Additionally, When P2P scanning, the flow is
`1. p2p_listen step` and `2. configure filter` and `3. p2p_scan starts`
in wpas, but in kernel, cfg80211 uses another workqueue to notify driver
the filter change, so sometimes we see (1 > 3 > 2), that will cause Rx
filter related to scan to be cleared. Therefore, we add a scanning check
when configure filter to avoid scan results to be filtered. Finally, we
cancel the ROC delayed workqueue before entering ROC to avoid entering
twice, which might cause leaving ROC too early.

Signed-off-by: Chih-Kang Chang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: Refine active scan behavior in 6 GHz
Po-Hao Huang [Wed, 29 Nov 2023 07:00:44 +0000 (15:00 +0800)]
wifi: rtw89: Refine active scan behavior in 6 GHz

The interval between sending each probe request is regulated. Before
this patch, some packets are not sent out properly because of our HW
limit. Extend the 6 GHz channel dwell time to cope with this.

Signed-off-by: Po-Hao Huang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: fix not entering PS mode after AP stops
Po-Hao Huang [Wed, 29 Nov 2023 07:00:43 +0000 (15:00 +0800)]
wifi: rtw89: fix not entering PS mode after AP stops

The attempt to enter power save mode might fail if there are still
beacons pending in the queue. This sometimes happens after stopping
P2P GO or AP mode. Extend stop AP function and flush all beacons to
resolve this.

Signed-off-by: Po-Hao Huang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rt2x00: make watchdog param per device
Stanislaw Gruszka [Sun, 26 Nov 2023 19:53:58 +0000 (20:53 +0100)]
wifi: rt2x00: make watchdog param per device

We can run PCI/MMIO devices together with USB devices in the system.
Make watchdog parameter per device to avoid situation when plugin
USB device change modparam_watchdog for PCI/MMIO device.

Signed-off-by: Stanislaw Gruszka <[email protected]>
Tested-by: Shiji Yang <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: Remove bridge vendor/device ids
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:25 +0000 (10:47 +0200)]
wifi: rtlwifi: Remove bridge vendor/device ids

Neither vendorid nor deviceid in the struct mp_adapter is used so
remove them.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: Remove unused PCI related defines and struct
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:24 +0000 (10:47 +0200)]
wifi: rtlwifi: Remove unused PCI related defines and struct

The rtlwifi driver comes with a number of PCI related defines that are
unused and many would be provided by PCI core anyway if they'd be
needed again.

Similarly, the struct rtl_pci_capabilities_header is unused and no
driver should come up their own way to access PCI Capabilities anyway.

Remove the unused/duplicated PCI related defines and struct.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: rtl8821ae: Access full PMCS reg and use pci_regs.h
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:23 +0000 (10:47 +0200)]
wifi: rtlwifi: rtl8821ae: Access full PMCS reg and use pci_regs.h

_rtl8821ae_clear_pci_pme_status() accesses the upper byte of the Power
Management Control/Status register (PMCS) with literal 5 offset.

Access the entire PMCS register using defines from pci_regs.h to
improve code readability.

While at it, remove the obvious comment and tweak debug prints
slightly to not sound misleading.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: rtl8821ae: Add pdev into _rtl8821ae_clear_pci_pme_status()
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:22 +0000 (10:47 +0200)]
wifi: rtlwifi: rtl8821ae: Add pdev into _rtl8821ae_clear_pci_pme_status()

Add local variable pdev to shorten rtlpci->pdev.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: rtl8821ae: Use pci_find_capability()
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:21 +0000 (10:47 +0200)]
wifi: rtlwifi: rtl8821ae: Use pci_find_capability()

Instead of open coding the capability structure search, find the PM
Capability using pci_find_capability().

While at it, rename the generic 'cap_pointer' to 'pm_cap' which makes
the intent of the code more obvious.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: rtl8821ae: Reverse PM Capability exists check
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:20 +0000 (10:47 +0200)]
wifi: rtlwifi: rtl8821ae: Reverse PM Capability exists check

Check if PM Capability does not exists and return early which follows
the usual error handling pattern.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: rtl8821ae: Remove unnecessary PME_Status bit set
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:19 +0000 (10:47 +0200)]
wifi: rtlwifi: rtl8821ae: Remove unnecessary PME_Status bit set

BIT(7) (PME_Status) is first checked and then set unnecessarily. Remove
the unnecessary setting for the bit that is already on and adjust the
comment related to it.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: Convert to use PCIe capability accessors
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:18 +0000 (10:47 +0200)]
wifi: rtlwifi: Convert to use PCIe capability accessors

The rtlwifi driver accesses PCIe capabilities through custom config
offsets. Convert the accesses to use the normal PCIe capability
accessors.

Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: Convert LNKCTL change to PCIe cap RMW accessors
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:17 +0000 (10:47 +0200)]
wifi: rtlwifi: Convert LNKCTL change to PCIe cap RMW accessors

The rtlwifi driver comes with custom code to write into PCIe Link
Control register. RMW access for the Link Control register requires
locking that is already provided by the standard PCIe capability
accessors.

Convert the custom RMW code writing into LNKCTL register to standard
RMW capability accessors. The accesses are changed to cover the full
LNKCTL register instead of touching just a single byte of the register.

Fixes: 0c8173385e54 ("rtl8192ce: Add new driver")
Cc: [email protected]
Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtlwifi: Remove bogus and dangerous ASPM disable/enable code
Ilpo Järvinen [Fri, 24 Nov 2023 08:47:16 +0000 (10:47 +0200)]
wifi: rtlwifi: Remove bogus and dangerous ASPM disable/enable code

Ever since introduction in the commit 0c8173385e54 ("rtl8192ce: Add new
driver") the rtlwifi code has, according to comments, attempted to
disable/enable ASPM of the upstream bridge by writing into its LNKCTL
register. However, the code has never been correct because it performs
the writes to the device instead of the upstream bridge.

Worse yet, the offset where the PCIe capabilities reside is derived
from the offset of the upstream bridge. As a result, the write will use
an offset on the device that does not relate to the LNKCTL register
making the ASPM disable/enable code outright dangerous.

Because of those problems, there is no indication that the driver needs
disable/enable ASPM on the upstream bridge. As the Capabilities offset
is not correctly calculated for the write to target device's LNKCTL
register, the code is not disabling/enabling device's ASPM either.
Therefore, just remove the upstream bridge related ASPM disable/enable
code entirely.

The upstream bridge related ASPM code was the only user of the struct
mp_adapter members num4bytes, pcibridge_pciehdr_offset, and
pcibridge_linkctrlreg so those are removed as well.

Note: This change does not remove the code related to changing the
device's ASPM on purpose (which is independent of this flawed code
related to upstream bridge's ASPM).

Suggested-by: Bjorn Helgaas <[email protected]>
Fixes: 0c8173385e54 ("rtl8192ce: Add new driver")
Fixes: 886e14b65a8f ("rtlwifi: Eliminate raw reads and writes from PCIe portion")
Cc: [email protected]
Signed-off-by: Ilpo Järvinen <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw88: sdio: Honor the host max_req_size in the RX path
Martin Blumenstingl [Mon, 20 Nov 2023 11:57:26 +0000 (12:57 +0100)]
wifi: rtw88: sdio: Honor the host max_req_size in the RX path

Lukas reports skb_over_panic errors on his Banana Pi BPI-CM4 which comes
with an Amlogic A311D (G12B) SoC and a RTL8822CS SDIO wifi/Bluetooth
combo card. The error he observed is identical to what has been fixed
in commit e967229ead0e ("wifi: rtw88: sdio: Check the HISR RX_REQUEST
bit in rtw_sdio_rx_isr()") but that commit didn't fix Lukas' problem.

Lukas found that disabling or limiting RX aggregation works around the
problem for some time (but does not fully fix it). In the following
discussion a few key topics have been discussed which have an impact on
this problem:
- The Amlogic A311D (G12B) SoC has a hardware bug in the SDIO controller
  which prevents DMA transfers. Instead all transfers need to go through
  the controller SRAM which limits transfers to 1536 bytes
- rtw88 chips don't split incoming (RX) packets, so if a big packet is
  received this is forwarded to the host in it's original form
- rtw88 chips can do RX aggregation, meaning more multiple incoming
  packets can be pulled by the host from the card with one MMC/SDIO
  transfer. This Depends on settings in the REG_RXDMA_AGG_PG_TH
  register (BIT_RXDMA_AGG_PG_TH limits the number of packets that will
  be aggregated, BIT_DMA_AGG_TO_V1 configures a timeout for aggregation
  and BIT_EN_PRE_CALC makes the chip honor the limits more effectively)

Use multiple consecutive reads in rtw_sdio_read_port() and limit the
number of bytes which are copied by the host from the card in one
MMC/SDIO transfer. This allows receiving a buffer that's larger than
the hosts max_req_size (number of bytes which can be transferred in
one MMC/SDIO transfer). As a result of this the skb_over_panic error
is gone as the rtw88 driver is now able to receive more than 1536 bytes
from the card (either because the incoming packet is larger than that
or because multiple packets have been aggregated).

In case of an receive errors (-EILSEQ has been observed by Lukas) we
need to drain the remaining data from the card's buffer, otherwise the
card will return corrupt data for the next rtw_sdio_read_port() call.

Fixes: 65371a3f14e7 ("wifi: rtw88: sdio: Add HCI implementation for SDIO based chipsets")
Reported-by: Lukas F. Hartmann <[email protected]>
Closes: https://lore.kernel.org/linux-wireless/CAFBinCBaXtebixKbjkWKW_WXc5k=NdGNaGUjVE8NCPNxOhsb2g@mail.gmail.com/
Suggested-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Martin Blumenstingl <[email protected]>
Reviewed-by: Ulf Hansson <[email protected]>
Acked-by: Ping-Ke Shih <[email protected]>
Tested-by: Lukas F. Hartmann <[email protected]>
Reported-by: Lukas F. Hartmann <[email protected]>
Signed-off-by: Martin Blumenstingl <[email protected]>
Reviewed-by: Ulf Hansson <[email protected]>
Acked-by: Ping-Ke Shih <[email protected]>
Tested-by: Lukas F. Hartmann <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: mac: functions to configure hardware engine and quota for WiFi 7 chips
Ping-Ke Shih [Fri, 24 Nov 2023 07:17:03 +0000 (15:17 +0800)]
wifi: rtw89: mac: functions to configure hardware engine and quota for WiFi 7 chips

Add functions to configure HCI, DMAC (data MAC), DLE (data link engine),
HFC (HCI flow control), PLE (payload engine) and etc for WiFi 7 chips.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: mac: use pointer to access functions of hardware engine and quota
Ping-Ke Shih [Fri, 24 Nov 2023 07:17:02 +0000 (15:17 +0800)]
wifi: rtw89: mac: use pointer to access functions of hardware engine and quota

To share flow with WiFi 7 chips, abstract functions related hardware
engines and their quota, so use pointer to access them. This doesn't change
logic at all.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: mac: move code related to hardware engine to individual functions
Ping-Ke Shih [Fri, 24 Nov 2023 07:17:01 +0000 (15:17 +0800)]
wifi: rtw89: mac: move code related to hardware engine to individual functions

WiFi 7 chips will use the same functionalities but different registers to
control hardware components, so move these stuff into functions, and then
we can implement these for WiFi 7 chips later. This patch doesn't change
logic.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: mac: check queue empty according to chip gen
Zong-Zhe Yang [Fri, 24 Nov 2023 07:17:00 +0000 (15:17 +0800)]
wifi: rtw89: mac: check queue empty according to chip gen

This function, currently called by WoWLAN flow, polls until specific HW
queues are empty. The polling bit definitions are not totally the same
between WiFi 6 and 7 chips. In addition, the check conditions are also
a little different. So, we differentiate the implementations according to
chip gen.

Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: refine element naming used by queue empty check
Zong-Zhe Yang [Fri, 24 Nov 2023 07:16:59 +0000 (15:16 +0800)]
wifi: rtw89: refine element naming used by queue empty check

In queue empty check, one group contains 32 queues. And, the two elements,
wde_qempty_acq_num and wde_qempty_mgq_sel, are number of group and select
of group. To avoid confusing them with queue number and queue selection,
we refine their naming.

(don't change logic at all)

Signed-off-by: Zong-Zhe Yang <[email protected]>
Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: add reserved size as factor of DLE used size
Ping-Ke Shih [Fri, 24 Nov 2023 07:16:58 +0000 (15:16 +0800)]
wifi: rtw89: add reserved size as factor of DLE used size

DLE stands for Double Link Engine that is used to maintain buffer page.
To avoid linking to wrong pages, we check the used page size during
initialization and stop driver probe if the used size is unexpected.

Currently, we check the page size used by PLE (payload engine) and WDE
(WiFi descriptor engine). For coming WiFi 7 chips, additional reserved
size is added for BB as buffer to run LA mode, so add and check the
reserved size as well.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: mac: add to get DLE reserved quota
Ping-Ke Shih [Fri, 24 Nov 2023 07:16:57 +0000 (15:16 +0800)]
wifi: rtw89: mac: add to get DLE reserved quota

The reserved quota of DLE (data link engine) is used for processing next
packet. Add this to get quota number, and then WiFi 7 chips can use them.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: 8922a: extend and add quota number
Ping-Ke Shih [Fri, 24 Nov 2023 07:16:56 +0000 (15:16 +0800)]
wifi: rtw89: 8922a: extend and add quota number

Define 8922A buffer quota that are used by HCI control flow, payload
engine, descriptor engine and etc for operation modes, such as SCC (single
channel concurrence) and download firmware. Since WiFi 7 chips has more
buffer classifications, add fields and struct according to design.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: iwlwifi: fw: replace deprecated strncpy with strscpy_pad
Justin Stitt [Thu, 19 Oct 2023 17:44:59 +0000 (17:44 +0000)]
wifi: iwlwifi: fw: replace deprecated strncpy with strscpy_pad

strncpy() is deprecated for use on NUL-terminated destination strings
[1] and as such we should prefer more robust and less ambiguous string
interfaces.

Based on the deliberate `sizeof(dest) ... - 1` pattern we can see that
both dump_info->dev_human_readable and dump_info->bus_human_readable are
intended to be NUL-terminated.

Moreover, since this seems to cross the file boundary let's NUL-pad to
ensure no behavior change.

strscpy_pad() covers both the NUL-termination and NUL-padding, let's use
it.

Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings
Link: https://github.com/KSPP/linux/issues/90
Cc: [email protected]
Signed-off-by: Justin Stitt <[email protected]>
Reviewed-by: Kees Cook <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/20231019-strncpy-drivers-net-wireless-intel-iwlwifi-fw-dbg-c-v2-1-179b211a374b@google.com
16 months agowifi: rtw89: debug: remove wrapper of rtw89_debug()
Ping-Ke Shih [Wed, 22 Nov 2023 06:04:58 +0000 (14:04 +0800)]
wifi: rtw89: debug: remove wrapper of rtw89_debug()

The wrapper of rtw89_debug() is unnecessary, so just remove it.

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
16 months agowifi: rtw89: debug: add debugfs entry to disable dynamic mechanism
Ping-Ke Shih [Wed, 22 Nov 2023 06:04:57 +0000 (14:04 +0800)]
wifi: rtw89: debug: add debugfs entry to disable dynamic mechanism

A dynamic mechanism is usually an algorithm to adjust registers to adapt
to different environment every two seconds. In field, it could get
unexpected result, so we need to stop it and adjust registers manually, and
then fine tune the algorithm.

To stop mechanisms to assist debugging, add a debugfs entry shown as

  Disabled DM: 0x1
  [0] DYNAMIC_EDCCA: X

Signed-off-by: Ping-Ke Shih <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
This page took 0.117779 seconds and 4 git commands to generate.