wifi: ath12k: Attach and detach ath12k_dp_link_peer to ath12k_dp_peer
Introduce explicit attach/detach of ath12k_dp_link_peer objects to their parent
ath12k_dp_peer to formalize the data path station hierarchy:
ath12k_dp_peer
|
|--> ath12k_dp_link_peer
|
|--> ath12k_dp_link_peer
|
|--> ath12k_dp_link_peer
ath12k_dp_peer maintains an array of RCU-protected pointers
"link_peers[ATH12K_NUM_MAX_LINKS]" to ath12k_dp_link_peer indexed by its
protocol_link_id, and each ath12k_dp_link_peer holds a back pointer to its
parent ath12k_dp_peer.
Attach is performed after link peer creation, and detach occurs before link peer
deletion. This ensures consistent lifetime management and safe concurrent
access.
ath12k_dp_peer also maintains an array "hw_links[ATH12K_GROUP_MAX_RADIO]" to
store the mapping between hw_link_id and protocol_link_id for each of the
ath12k_dp_link_peer.
RCU locking/unlocking rules:
- Readers must hold rcu_read_lock() and fetch the pointer with
rcu_dereference(dp_peer->link[link_id]); drop with rcu_read_unlock() when
done.
- Writers publish with rcu_assign_pointer() and reclaim only after
synchronize_rcu().
Handle the case of detachment of link peer from ath12k_dp_peer in case of core
reset.
Ensure the following order of locks to be followed for attach and detach:
- Lock dp->dp_lock
- Lock dp_hw->peer_lock
- Unlock dp_hw->peer_lock
- Unlock dp->dp_lock
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.4.1-00199-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3
Signed-off-by: Harsh Kumar Bijlani <quic_hbijlani@quicinc.com>
Signed-off-by: Ripan Deuri <quic_rdeuri@quicinc.com>
Reviewed-by: Vasanthakumar Thiagarajan <vasanthakumar.thiagarajan@oss.qualcomm.com>
Reviewed-by: Baochen Qiang <baochen.qiang@oss.qualcomm.com>
Link: https://patch.msgid.link/20251024181548.3255166-8-quic_rdeuri@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>