Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync 7/5 #113

Merged
merged 351 commits into from
May 7, 2024
Merged

Conversation

rmandrad
Copy link
Owner

@rmandrad rmandrad commented May 7, 2024

Thanks for your contribution to OpenWrt!

To help keep the codebase consistent and readable,
and to help people review your contribution,
we ask you to follow the rules you find in the wiki at this link
https://openwrt.org/submitting-patches

Please remove this message before posting the pull request.

qosmio and others added 30 commits January 13, 2024 08:16
also support offload for the following:

  mac80211:
    * vlan
    * mesh (partial)
  ath11k:
    * vlan
bugfixes:
  * Rreverted patch `105-ath11k-fix-monitor-crash-if-tx-offload-is-enabled.patch`.
    Initial test show lower memory use. `ieee80211_tx_status_8023` was
    also removed upstream for a reason as it wasn't being used, and the
    logic behind it was flawed.
    See https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]

  * Mmemory profile for '256M' was missing logic that was in 512/1G.
    Should build correctly now

  * added more qsdk related patches to nss/offload
M3 SSR dump logic makes the router coredump. Just putting dummy case to
skip warning.

[12394.072384] Hardware name: Dynalink DL-WRX36 (DT)
[12394.079758] Call trace:
[12394.084354]  dump_backtrace.part.0+0xbc/0xd0
[12394.086614]  show_stack+0x18/0x30
[12394.091127]  dump_stack_lvl+0x6c/0x88
[12394.094339]  dump_stack+0x18/0x34
[12394.097985]  bad_page+0xe0/0x110
[12394.101282]  __free_pages_ok+0x33c/0x360
[12394.104582]  __free_pages+0xbc/0xe0
[12394.108487]  dma_direct_free+0xd0/0x140
[12394.111701]  dma_free_attrs+0x90/0xb0
[12394.115519]  ath11k_qmi_fwreset_from_cold_boot+0x9e0/0xa10 [ath11k]
[12394.119343]  ath11k_qmi_deinit_service+0x64/0x21d0 [ath11k]
[12394.125419]  ath11k_core_deinit+0xa4/0xc0 [ath11k]
[12394.130974]  0xffffffc000fb3600
[12394.135831]  platform_shutdown+0x24/0x40
[12394.138871]  device_shutdown+0x14c/0x240
[12394.143037]  kernel_restart+0x40/0xb0
[12394.146944]  __do_sys_reboot+0xcc/0x200
[12394.150502]  __arm64_sys_reboot+0x24/0x30
[12394.154148]  invoke_syscall.constprop.0+0x5c/0x110
[12394.158317]  do_el0_svc+0x58/0x170
[12394.163001]  el0_svc+0x18/0x60
[12394.166386]  el0t_64_sync_handler+0x114/0x120
[12394.169426]  el0t_64_sync+0x174/0x178
uci option pbuf.opt.memory_profile must be explicity set to auto, 1gb,
512m, 256m to run.
Since NSS requires patches to subsys, and ath*k directories. Move
patches into a subset of nss for better tracking against QSDK,
and modularization.
To reduce bug tracking headaches, I've remove the following patches, as
they are not required for NSS offload and have been around the last 2-3
years without ever being upstreamed.

nss/ath11k/235-001-ath11k-Add-support-for-beacon-tx-mode.patch
nss/ath11k/237-002-ath11k-Add-provision-to-configure-rx-hashmap.patch
nss/ath11k/902-020-ath11k-add-btcoex-config.patch
nss/ath11k/902-022-ath11k-add-ap-ps-support.patch
nss/ath11k/907-068-ath11k-add-rx-histogram-stats.patch
nss/ath11k/907-108-ath11k-enable-ul-ofdma-ru-allocation-in-peer-stats.patch
nss/ath11k/911-373-ath11k-Add-retry-mechanism-for-update_rx_qu.patch
nss/ath11k/913-353-ath11k-ignore-frags-from-uninitialized-peer-in-dp.patch
nss/ath11k/913-356-ath11k-invalid-desc-sanity-check.patch
nss/ath11k/913-374-ath11k-Check-skb_headroom-before-using-skb_push.patch
nss/ath11k/913-830-ath11k-Avoiding-memset-of-ppdu-info-for-next-skb.patch
nss/subsys/235-002-mac80211-Add-support-for-beacon-tx-mode.patch
nss/subsys/913-726-mac80211-fix-crash-when-accessing-null-pointer.patch
Remove patches unrelated to NSS offloading to minimize bloat and better
track NSS related issues.
Reworked patches to use upstream QSDK names. Allows for better tracking
The option in qca-nss-drv is actually 'NSS_DRV_WIFIOFFLOAD_ENABLE' use
the same syntax.
qosmio added 24 commits May 6, 2024 12:49
uci option pbuf.opt.memory_profile must be explicity set to auto, 1gb,
512m, 256m to run.
ath11k_nss: fix build for 256/1G mem, and ath10k

ath11k_nss: bump release version '8'

mac80211: refactor NSS patches

Since NSS requires patches to subsys, and ath*k directories. Move
patches into a subset of nss for better tracking against QSDK,
and modularization.

ath11k_nss: rename patches

ath11k_nss: clean up optional patches

To reduce bug tracking headaches, I've remove the following patches, as
they are not required for NSS offload and have been around the last 2-3
years without ever being upstreamed.

nss/ath11k/235-001-ath11k-Add-support-for-beacon-tx-mode.patch
nss/ath11k/237-002-ath11k-Add-provision-to-configure-rx-hashmap.patch
nss/ath11k/902-020-ath11k-add-btcoex-config.patch
nss/ath11k/902-022-ath11k-add-ap-ps-support.patch
nss/ath11k/907-068-ath11k-add-rx-histogram-stats.patch
nss/ath11k/907-108-ath11k-enable-ul-ofdma-ru-allocation-in-peer-stats.patch
nss/ath11k/911-373-ath11k-Add-retry-mechanism-for-update_rx_qu.patch
nss/ath11k/913-353-ath11k-ignore-frags-from-uninitialized-peer-in-dp.patch
nss/ath11k/913-356-ath11k-invalid-desc-sanity-check.patch
nss/ath11k/913-374-ath11k-Check-skb_headroom-before-using-skb_push.patch
nss/ath11k/913-830-ath11k-Avoiding-memset-of-ppdu-info-for-next-skb.patch
nss/subsys/235-002-mac80211-Add-support-for-beacon-tx-mode.patch
nss/subsys/913-726-mac80211-fix-crash-when-accessing-null-pointer.patch

ath11k_nss: Remove superfluous patches

Remove patches unrelated to NSS offloading to minimize bloat and better
track NSS related issues.

ath11k_nss: Refactor patches to use upstream names

Reworked patches to use upstream QSDK names. Allows for better tracking

ath11k_nss: align wifi offload with qca-nss-drv

The option in qca-nss-drv is actually 'NSS_DRV_WIFIOFFLOAD_ENABLE' use
the same syntax.

ath10k-ct: fix compile with NSS wifi

ath11k_nss: Merge every NSS related feature + more

* Added macro to disable NSS mesh offload
* Added menuconfig option "ATH11K_NSS_MESH_SUPPORT" to selectivley build mesh support,
	as well it's depenacndy on nss-drv-wifimeshmgr.
* Added option to disable HTT Stats, and STA stats (stations).
* Reducing footprint by ~210KB. Debugfs minimal is still enabled.
* Reworked a TON of patches, some my own, hopefully there should be a far less amount of WOA2/WPA3 connection issues.
* Updated the /etc/init.d/pbuf script to be more robust. (handles tweaking ath11k and NSS settings better)

NOTES: Although mesh package builds (nss-drv-wifimeshmgr), ath11k doesn't seem to support it yet.
Not sure if NSS requires 3 radios to work, I'm at a dead end currently with that route.

ATTENTION:
the ptch `37-006-ath11k-Allow-fast-rx-by-bypassing-stats-update.patch`
works well on nss with frame_mode=2.
And on `ath11k frame_mode=1 nss_offload=0`

And on `ath11k frame_mode=2 nss_offload=1`

if you set nss_offload=off and frame_mode=2, it will CRASH
if you set nss_offload=on and frame_mode=2, it will  RUN
if you set nss_offload=off and frame_mode=1, it will RUN

ath11k_nss: fix n2h high_water_core0/wifi_pool_buf

These were commented out, but looks like they are needed to prevent lock
ups with heavy usage apps (users report in torrenting)

ath11k_nss: Renumber ath11k patches in the range

commit 3c7cc4b725ea406f19b736427034e3bdb436aedc
Author:     Yuvasree Sivasankaran <[email protected]>
AuthorDate: Thu Jan 4 11:25:56 2024 +0530
Commit:     Yuvasree Sivasankaran <[email protected]>
CommitDate: Wed Jan 3 22:53:51 2024 -0800

    wifi: ath11k: Renumber ath11k patches in the range

    In ath11k, patches are not maintained in the range and not sequential.
    Renumber the patches sequential and in the range.

    Change-Id: I77c51c0f5bf9f94863db4ef364b156e14465a60c
    Signed-off-by: Yuvasree Sivasankaran <[email protected]>

ath11k_nss: Add mac hw flag to avoid tx queue in mac80211

commit 4e9b5f7f0d1ed40dbf3208f7ed4448e49b4a4ac1
Author:     Yuvasree Sivasankaran <[email protected]>
AuthorDate: Wed Dec 6 12:20:59 2023 +0530
Commit:     Yuvasree Sivasankaran <[email protected]>
CommitDate: Mon Dec 18 12:52:33 2023 +0530

    wifi: mac80211: Add mac hw flag to avoid tx queue in mac80211

    Queue SKB in mac80211 become mandatory from latest 6.1 kernel. Because of
    this queuing, there will be performance degradation. Add hw flag option
    to enable tx queue in Driver/Hardware.

    Driver/hardware can register for HAS_TX_QUEUE HW flag and avoid tx queuing
    in mac80211.

    Add same HW flag checks to avoid accessing skb queues which will be
    NULL or invalid and also NULL checks for sta txqs for NULL or invalid
    access.

ath11k_nss: add the HTC+ / iPhone fix

commit ccdca73cd65723c3cb63c17edc95c4c43318cb38
Author:     John Crispin <[email protected]>
AuthorDate: Sun Jul 9 17:12:34 2023 +0200
Commit:     John Crispin <[email protected]>
CommitDate: Thu Aug 31 16:08:34 2023 +0200

    mac80211: add the HTC+ / iPhone fix

    Signed-off-by: John Crispin <[email protected]>

ath11k_nss: ath-next fix connection failure due to unexpected peer delete

Currently ath11k_mac_op_unassign_vif_chanctx() deletes peer but
ath11k_mac_op_assign_vif_chanctx() doesn't create it. This results in
connection failure if MAC80211 calls drv_unassign_vif_chanctx() and
drv_assign_vif_chanctx() during AUTH and ASSOC, see below log:

[  102.372431] wlan0: authenticated
[  102.372585] ath11k_pci 0000:01:00.0: wlan0: disabling HT/VHT/HE as WMM/QoS is not supported by the AP
[  102.372593] ath11k_pci 0000:01:00.0: mac chanctx unassign ptr ffff895084638598 vdev_id 0
[  102.372808] ath11k_pci 0000:01:00.0: WMI vdev stop id 0x0
[  102.383114] ath11k_pci 0000:01:00.0: vdev stopped for vdev id 0
[  102.384689] ath11k_pci 0000:01:00.0: WMI peer delete vdev_id 0 peer_addr 20:e5:2a:21:c4:51
[  102.396676] ath11k_pci 0000:01:00.0: htt peer unmap vdev 0 peer 20:e5:2a:21:c4:51 id 3
[  102.396711] ath11k_pci 0000:01:00.0: peer delete resp for vdev id 0 addr 20:e5:2a:21:c4:51
[  102.396722] ath11k_pci 0000:01:00.0: mac removed peer 20:e5:2a:21:c4:51  vdev 0 after vdev stop
[  102.396780] ath11k_pci 0000:01:00.0: mac chanctx assign ptr ffff895084639c18 vdev_id 0
[  102.400628] wlan0: associate with 20:e5:2a:21:c4:51 (try 1/3)
[  102.508864] wlan0: associate with 20:e5:2a:21:c4:51 (try 2/3)
[  102.612815] wlan0: associate with 20:e5:2a:21:c4:51 (try 3/3)
[  102.720846] wlan0: association with 20:e5:2a:21:c4:51 timed out

The peer delete logic in ath11k_mac_op_unassign_vif_chanctx() is
introduced by commit b4a0f54156ac ("ath11k: move peer delete after
vdev stop of station for QCA6390 and WCN6855") to fix firmware
crash issue caused by unexpected vdev stop/peer delete sequence.

Actually for a STA interface peer should be deleted in
ath11k_mac_op_sta_state() when STA's state changes from
IEEE80211_STA_NONE to IEEE80211_STA_NOTEXIST, which also coincides
with current peer creation design that peer is created during
IEEE80211_STA_NOTEXIST -> IEEE80211_STA_NONE transition. So move
peer delete back to ath11k_mac_op_sta_state(), also stop vdev before
deleting peer to fix the firmware crash issue mentioned there. In
this way the connection failure mentioned here is also fixed.

Also do some cleanups in patch "wifi: ath11k: remove invalid peer
create logic", and refactor in patches "wifi: ath11k: rename
ath11k_start_vdev_delay()" and "wifi: ath11k: avoid forward declaration
of ath11k_mac_start_vdev_delay()".

Tested this patch set using QCA6390 and WCN6855 on both STA and SAP
interfaces. Basic connection and ping work well.

Baochen Qiang (4):
  wifi: ath11k: remove invalid peer create logic
  wifi: ath11k: rename ath11k_start_vdev_delay()
  wifi: ath11k: avoid forward declaration of
    ath11k_mac_start_vdev_delay()
  wifi: ath11k: fix connection failure due to unexpected peer delete

 drivers/net/wireless/ath/ath11k/mac.c | 564 +++++++++++++-------------
 1 file changed, 288 insertions(+), 276 deletions(-)

ath11k_nss: Revert support for beacon_tx_mode

ath11k_nss: Update release fix dependancies

ath11k_nss: mgmt and data ack rssi update

Data ACK RSSI :

      Advertise NL80211_EXT_FEATURE_ACK_SIGNAL_SUPPORT feature support
for accounting and notifying "last ack signal" and "avg ack signal" to
user space through NL interface.

      Enabled data ack rssi support for ethernet mode.

Mgmt ACK RSSI:

      Enabled support for Tx-ACK RSSI in HTT over Management packets.
Without it, NSS based SQM doesn't work.
Implementing the updating of firmware initiated dynamic MU-EDCA
parameters in Beacon IE. Firmware routinely checks its clients and
updates its MU-EDCA values every 3 seconds. Firmware is tuning
MU-EDCA parameters to improve performance. As part of this process,
the firmware informs host about new MU-EDCA values utilizing
WMI_MUEDCA_PARAMS_CONFIG_EVENTID. FW expectation is that host will
update MU-EDCA parameters in the Beacon IE.
not needed for NSS offload and helps save some memory
Leave it set to '0', as it will kernel panic with 2K skb patch. This
flag was incorrectly assumed to save memory on 1G platforms.

ath11k_nss: remove leftover max_tx_ring

it was not removed when applying patch to replace it with 'max_tx_ring =
DP_TCL_NUM_RING_MAX +1'

ath11k_nss: Import bugfix patches

ath11k_nss: Experimental build for IPQ6018

This will require setting the correct `ATH11K_MEM_PROFILE_XXX` for your
platform. Setting it to value lower/higher than physically available
will cause NULL virtual address kernel panics.

I believe this setting was not originally meant to reduce memory
footprint of 1G+ platforms, but to account for platforms that were
512M or less.

Will require tweaking to allow for the old behvaior on 1G+ IPQ807x,
while still saving memory for platforms <= 512M.
QSDK NSS builds utilize skbuff recycling for better handling of memory.

On a Dynalink DL-WRX36 (pbuf script should be set to 'auto') a significant drop in
memory usage was observed as well consistent sustained RX/TX speeds.

BEFORE:
echo 3 >! /proc/sys/vm/drop_caches

free -m
               total        used        free      shared  buff/cache   available
Mem:             867         338         547          90         101         528
Swap:              0           0           0

AFTER:
               total        used        free      shared  buff/cache   available
Mem:             867         242         594           1          81         624
Swap:              0           0           0

NOTE:

For 512MB platforms, users need to test with the following scenarios,
as the patch `999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch` is
really only testable on platforms with 512M or less RAM.

1.) Explicitly setting 'ATH11K_MEM_PROFILE_512M' on and see if system
    crashes on boot.

2.) Explicitly setting 'ATH11K_MEM_PROFILE_1G'

3.) Remove patches
    999-233-ath11k-Disable-rx_header-tlv-for-2K-SKB.patch
    999-311-ath11k-configure-nss-thread-priority-during-pdev_ini.patch

    And re-test with #1 and #2

It was incorrectly assumed that setting a 512M for 1G platforms would save
memory, instead it needs to be explicitly set to know proper memory
regions, otherwise it would cause fw crash.

ath11k_nss: fix typo in 512M memory profile

ath11k_nss: remove SFE patch 718-e-mac80211-Deliver-the-frame-to-driver-tx-ops-directly

It is not relevant to NSS builds and only meant for SFE.

ath11k_nss: remove unecessary patches

Color collision should be left on by default, as it's a primary feature
of 802.11AX.

ath11k_nss: fix spacing

ath11k_nss: Remove unnecessary TKIP bloat

Remove TKIP patches that are not being used as 99% of folks are running
modern encryption (AES-CCMP,SAE,etc).

ath11k_nss: parameterize DP_RXDMA_REFILL_RING_SIZE memory profile

ath11k_nss: Remove SFE related code

Cleanup SFE (shortcut fe) related code as we're not using it on NSS

ath11k_nss: idr, ampdu, and skb headroom check optimizations

ath11k_nss: get valid last_rate for rx_bitrate from cpu stats

ath11k_nss: Fix BCCA counter for EMA

Currently BCCA counter is updated to FW via csa counter offs and
beacon with new countdown is updated for every beacon tx completion event.
For EMA, all EMA beacons are updated in one shot, and counter update for
every tx event will mess up the actual sequence of countdown sent over the air.

Allow FW to update the countdown till 1 and finalize the color
change.

ath11k_nss: Fix compile for TRACE feature
The performance of Qualcomm Crypto Engine is 10x slower than kernel
based encryption via ARMv8 crypto extensions. Rather than building it
into the kernel allow users to select it as module which can be tested with
other HW based crypto APIs via cryptodev-linux.
Since SKB recycler was merged into main nss-wifi branch, it is not
necessary to manually tinker with pbuf script. Memory is now properly
managed between NSS driver allocating/deallocating SKBs. For optimal
wifi performance, especially upload, it is advised to leave the script
to 'auto'.

Users who use sysupgrade should manually set the uci config
'/etc/config/pbuf' as it will not overwrite existing configuration.
This will now be the default NSS branch, and will cover
both kernel 6.1 and 6.6 related changes going forward.

qualcommax: NSS: fix up 'nss_region'
Symbols for crypto, ktls, netfilter are removed from from being compiled
into the kernel and instead left up to the user to compile as modules,
as is the case upstream. Other unused qca features were also removed as
they don't apply to ipq807x/6018 and are not upstream.

Common symbols between 6.1/6.6 that are required for NSS related
features have been consolidated into 'config-default'.

There is an average 300kb of savings in the final kernel image as well
decreased compile time.

qualcommax: NSS: consolidate patches and align with 6.1

Update nss-cfi to kernel 6.6
Disable software input output translation lookaside buffer (swiotlb) as
it wastes memory on low memory platforms (512m or less)

qualcommax: only disable swiotlb for platforms <= 512M

Disabling swiotlb is only required for platforms with 512M or less to save
64mb.
In ath11k_dp_rx_msdu_coalesce(), rxcb is fetched from skb and bool
is_continuation is part of rxcb.

Currently, after freeing the skb, the rxcb->is_continuation accessed
again which is wrong since the memory is already freed.

Hence fix the issue by locally defining bool is_continuation from rxcb,
so that after freeing skb also we can use is_continuation.

Signed-off-by: Sean Khan <[email protected]>
Qualcomm recently committed a new branch (12.5.r2) targeting kernel
6.6. This lets us clean up a few patches particularly the one for
"C22/C45" mdio.

A quick way to see what changed for IPQ807x/6018 was to list the files produced
during build (**/*.o), replace the extension with ".c", and doing a
`git log`.

Filtering from those commits, ones of particular interest are listed
below:

```
2024-04-16 - 0d8f30aa - fix compile issue on hk with linux style build
2024-01-29 - 636464f7 - update the check for port link notify
2024-01-24 - 30c10e7f - enable and disable loopback for xgmac to fix qm stuck issue
2024-01-15 - b6ea10aa - update the the APIs to access switch
2024-01-08 - a1687502 - Disable Tx bridge mac before power off the PHY
2024-01-07 - 3eafb613 - support led configure for malibu phy
2024-01-07 - 5c1af60d - remove phy type check from mac reset when mode switch
2023-12-17 - 79d0b1e8 - remove the PHY access APIs in ssdk_plat.c
2023-12-16 - b2953740 - Update mii read/write functions
2023-12-11 - 37f2eac3 - add port id check for fdb entry
2023-12-11 - d040ca4d - support mdio clause45 on kernel6.6
2023-12-07 - 11494fbc - use barrier mw() during access fdb entry table
2023-12-03 - 8e40a284 - fix build warnings on kernel6.6
2023-11-10 - 10aa0a02 - change speed value when call ssdk_port_link_notify
2023-11-06 - ee4c4a60 - Update mac bitmap value of L3 table on MAC delete
2023-11-03 - 7cd27d39 - support 10G phy common feature
2023-10-30 - 383cc0d2 - fix mactype and mux select issue
2023-10-24 - decf534a - support autoneg status query on force port
2023-10-11 - 111d574e - move ssdk_led_init to regi_init
2023-10-08 - 6b14c142 - the combo port also need to parse SFP pins
2023-10-03 - fb2e0401 - fix port5 interface mode switch issue in erp case
```

Verified with users on QNAP 301W, NBG7815, and myself on Dynalink
DL-WRX36 that everything is functional, including LEDS.

Signed-off-by: Sean Khan <[email protected]>
@rmandrad rmandrad merged commit a0b9408 into rmandrad:qosmio-wifi-br-6-6 May 7, 2024
1 check passed
@qosmio qosmio deleted the qualcommax-6.x-nss-wifi branch May 8, 2024 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants