wifi: ath12k: prepare sta data structure for MLO handling
To prepare the driver for MLO support, split the driver sta data structure to
scale for multiple links. This requires changing the use of arsta to per link
and not per hw which can now comprise of multiple links. Also since most
configurations from mac80211 are done per link, do refactoring of the driver
functions to apply these configurations at link level.
Split struct ath12k_sta, which is the driver private of struct ieee80211_sta,
to store link specific information as struct ath12k_link_sta. For default use
cases struct ath12k_sta will have a preallocated link sta called deflink which
will be used by non ML STAs and the first link sta of ML STA.
With MLO support to be added, remaining link stas will allocated during state
change where new STA is added. These link stas will be freed when STA is
deleted.
Current ath12k_sta(arsta) structure:
+-----------------+ +----------------+
| | | |
| ieee80211_sta | | ieee80211_sta |
| private data | | private data |
| | | |
| ath12k_sta | | ath12k_sta |
| (arsta) | | (arsta) |
|+---------------+| | +-------------+|
|| *arvif (link || | |*arvif (link ||
|| vif of an ar || | | vif of an ar||
|| say 5GHz) || | | say 6GHz) ||
|+---------------+| | +-------------+|
+-----------------+ +----------------+
New struct ath12k_sta (ahsta) containing ath12k_link_sta(s) (arsta) (deflink is
preallocated member which is always the first link if ieee80211_sta is ML STA
and is the only link sta otherwise):
+---------------------------------------+
| ieee80211_sta |
| private data |
| |
| ath12k_sta (ahsta) |
| +-------------------------------------+
| | ath12k_link_sta deflink (arsta) |
| | |
| | *arvif (link vif of ar (5GHz)) |
| +-------------------------------------+
| +-------------------------------------+
| | ath12k_link_sta *link (arsta) |
| | |
| | *arvif (link vif of ar (6GHz)) |
| | |
| +-------------------------------------+
| |
+---------------------------------------+
To refactor existing ath12k_sta to make use of link stas, following changes are
made:
1. Limit struct ieee80211_sta argument mac80211 ops unless otherwise really required.
2. struct ath12k_sta, now called by variable name arsta, stores multiple
arstas (struct ah12k_link_sta) and also has a back pointer to struct
ath12k_sta.
3. Pass struct ath12k_link_sta to mac functions that passed struct
ieee80211_sta argument and fetch struct ath12k_sta (ahsta) and struct
ieee80211_sta(sta) internally. This is done to avoid passing link id in all
the functions and performing validation across these functions. Rather the
validation and sta to arsta conversion can be done only at the mac80211 ops.
4. In this patchset, only ahsta->deflink is used to be on par with the
existing code. When MLO support is added the link id will be used to fetch the
arsta.
5. Change ath12k_sta_to_arsta() to ath12k_vif_to_ahsta() to fetch the
ML level sta. The link sta can be fetched from ahsta->link[], or the
deflink can be accessed via ahsta->deflink. API to access link
sta (arsta) by passing link_id can be introduced with MLO Support.
6. The ieee80211_sta can be accessed from ahsta using ath12k_ahsta_to_sta()
Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-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: Sriram R <quic_srirrama@quicinc.com>
Co-developed-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Rameshkumar Sundaram <quic_ramess@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://patch.msgid.link/20241015171416.518022-4-kvalo@kernel.org
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>