John Crispin cb911ccd0f ath11k: fix num_peers counter corruption and add debug logging
The num_peers counter becomes corrupted during peer deletion due to race
conditions between ath11k_peer_delete() and ath11k_peer_unmap_event().
The firmware may or may not send unmap events, and the timing varies,
causing the counter to either leak (increment without decrement) or
underflow (double decrement).

Root causes:
1. ath11k_peer_delete() doesn't decrement num_peers, relying on
   ath11k_peer_unmap_event() to do it
2. Firmware sometimes doesn't send unmap events, leaving num_peers
   inflated
3. When unmap events do arrive, timing races with ath11k_peer_delete()
   can cause missed decrements
4. Cleanup paths may double-decrement if delete_in_progress not checked
5. num_peers modified outside proper locking in some paths

This fix:
- Moves num_peers decrement into ath11k_peer_delete() after successful
  peer deletion wait, ensuring exactly one decrement per deletion
- Handles both cases: peer removed by unmap event, or peer still in list
- Removes num_peers decrement from ath11k_peer_unmap_event() to prevent
  double-decrement when unmap event arrives
- Adds ath11k_dp_peer_cleanup() call before ath11k_peer_delete() in
  roaming path to ensure datapath structures properly cleaned up
- Adds delete_in_progress checks in cleanup paths to prevent
  double-delete
- Ensures all num_peers modifications happen under base_lock
- Adds comprehensive debug logging to track num_peers throughout peer
  lifecycle

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
Signed-off-by: John Crispin <john@phrozen.org>
2025-10-02 11:48:16 +02:00
2022-01-31 07:01:31 +01:00
2021-05-04 13:51:23 +02:00
2023-10-03 07:22:31 +02:00
2024-02-29 08:48:14 -08:00
2022-10-19 17:04:14 -07:00

OpenWiFi AP NOS

OpenWrt-based access point network operating system (AP NOS) for TIP OpenWiFi. Read more at openwifi.tip.build.

Building

Setting up your build machine

Building requires a recent Linux installation. Older systems without Python 3.7 will have trouble. See this guide for details: https://openwrt.org/docs/guide-developer/toolchain/beginners-build-guide

Install build packages on Debian/Ubuntu (or see above guide for other systems):

sudo apt install build-essential libncurses5-dev gawk git libssl-dev gettext zlib1g-dev swig unzip time rsync python3 python3-setuptools python3-yaml

Doing a native build on Linux

Use ./build.sh <target>, or follow the manual steps below:

  1. Clone and set up the tree. This will create an openwrt/ directory.
./setup.py --setup    # for subsequent builds, use --rebase instead
  1. Select the profile and base package selection. This setup will install the feeds and packages and generate the .config file.
cd openwrt
./scripts/gen_config.py linksys_ea8300
  1. Build the tree (replace -j 8 with the number of cores to use).
make -j 8 V=s

Build output

The build results are located in the openwrt/bin/ directory:

Type Path
Firmware images openwrt/bin/targets/<target>/<subtarget>/
Kernel modules openwrt/bin/targets/<target>/<subtarget>/packages/
Package binaries openwrt/bin/packages/<platform>/<feed>/

Developer Notes

Branching model

  • main - Stable dev branch
  • next - Integration branch
  • staging-* - Feature/bug branches
  • release/v#.#.# - Release branches (major.minor.patch)

Repository structure

Build files:

  • Makefile - Calls Docker environment per target
  • dock-run.sh - Dockerized build environment
  • docker/Dockerfile - Dockerfile for build image
  • build.sh - Build script
  • setup.py - Clone and set up the tree
  • config.yml - Specifies OpenWrt version and patches to apply

Directories:

  • feeds/ - OpenWiFi feeds
  • patches/ - OpenWiFi patches applied during builds
  • profiles/ - Per-target kernel configs, packages, and feeds

uCentral packages

AP-NOS packages implementing the uCentral protocol include the following repositories (refer to the ucentral feed for a full list):

Description
No description provided
Readme BSD-3-Clause 209 MiB
Latest
2025-10-17 17:44:48 +00:00
Languages
C 85.9%
Shell 5.6%
Makefile 3.3%
Roff 1.8%
UnrealScript 1.6%
Other 1.6%