wifi: ath12k: Add hash table for ath12k_link_sta in ath12k_base
Currently ath12k_base maintains a linked list of ath12k_dp_link_peer as "peers".
This linked list is used for all kinds of peer search operations.
In the control path, if there is a requirement to search for ath12k_link_sta
using mac address, then below sequence is to be followed:
1. Find ath12k_dp_link_peer in the linked list using mac address
2. Fetch ieee80211_sta from ath12k_dp_link_peer
3. Fetch ath12k_sta from ieee80211_sta
4. Finally fetch ath12k_link_sta from ath12k_sta using link_id
In the above sequence, there are too many indirections involved.
In order to simplify this, add hash table for ath12k_link_sta in ath12k_base.
This hash table is lock protected by existing spinlock "base_lock" in
ath12k_base as this table can be concurrently accessed in different contexts.
Use this table for ath12k_link_sta search operations using mac address in the
control path.
Ex: For WMI interface and mac80211_ops interface in the control path, sta mac
address is received and this hash table can be used to search for
ath12k_link_sta directly instead of following the longer route mentioned above.
Helper APIs added:
- ath12k_link_sta_rhash_add() - To add arsta entry to hash table
- ath12k_link_sta_rhash_delete() - To remove arsta entry from hash table
- ath12k_link_sta_find_by_addr() - To find arsta from hash table using
mac address
Make changes in API ath12k_peer_sta_kickout_event() to find arsta using above
mechanism.
ath11k driver has been taken as reference for implementation of hash table.
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-4-quic_rdeuri@quicinc.com
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>