Skip to content

Commit 6db6e70

Browse files
Karthikeyan Periyasamykvalo
authored andcommitted
wifi: ath12k: Introduce the container for mac80211 hw
To support multi link operation, we need to combine all the link/pdev under a single wiphy. This avoids the overhead of synchronization across multiple hardware instances in both the cfg80211 and mac80211 layers. Currently, each link/pdev is registered as separate wiphy, tightly coupled with link/pdev/radio (ar) structure. To enable single wiphy registration within the chip, we decouple the wiphy data entity from the link/pdev/radio (ar) structure and move it under the chip (ab) structure with a new data container (ath12k_hw) structure. This approach improves scalability for future multi link operation support. mac80211 hw private data structure diagram ------------------------------------------ Now After +---------------------+ +---------------------+ |mac80211 hw priv data| |mac80211 hw priv data| | | | | | | | | | | | | | | | ath12k_hw (ah) | | | | | | | +-------------------> | | | ath12k (ar) | | +-------------+ | | | | | | | | | | | ath12k (ar) | | | | | | | | | | | | | | | | | +-------------+ | | | | | | | | | +---------------------+ +---------------------+ 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: Karthikeyan Periyasamy <quic_periyasa@quicinc.com> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com> Link: https://msgid.link/20240118010320.3918136-3-quic_periyasa@quicinc.com
1 parent b856f02 commit 6db6e70

File tree

5 files changed

+335
-136
lines changed

5 files changed

+335
-136
lines changed

drivers/net/wireless/ath/ath12k/core.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab)
923923
{
924924
struct ath12k *ar;
925925
struct ath12k_pdev *pdev;
926+
struct ath12k_hw *ah;
926927
int i;
927928

928929
spin_lock_bh(&ab->base_lock);
@@ -932,13 +933,20 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab)
932933
if (ab->is_reset)
933934
set_bit(ATH12K_FLAG_CRASH_FLUSH, &ab->dev_flags);
934935

936+
for (i = 0; i < ab->num_hw; i++) {
937+
if (!ab->ah[i])
938+
continue;
939+
940+
ah = ab->ah[i];
941+
ieee80211_stop_queues(ah->hw);
942+
}
943+
935944
for (i = 0; i < ab->num_radios; i++) {
936945
pdev = &ab->pdevs[i];
937946
ar = pdev->ar;
938947
if (!ar || ar->state == ATH12K_STATE_OFF)
939948
continue;
940949

941-
ieee80211_stop_queues(ath12k_ar_to_hw(ar));
942950
ath12k_mac_drain_tx(ar);
943951
complete(&ar->scan.started);
944952
complete(&ar->scan.completed);

drivers/net/wireless/ath/ath12k/core.h

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ struct ath12k_per_peer_tx_stats {
473473
struct ath12k {
474474
struct ath12k_base *ab;
475475
struct ath12k_pdev *pdev;
476-
struct ieee80211_hw *hw;
476+
struct ath12k_hw *ah;
477477
struct ath12k_wmi_pdev *wmi;
478478
struct ath12k_pdev_dp dp;
479479
u8 mac_addr[ETH_ALEN];
@@ -537,6 +537,7 @@ struct ath12k {
537537
/* pdev_idx starts from 0 whereas pdev->pdev_id starts with 1 */
538538
u8 pdev_idx;
539539
u8 lmac_id;
540+
u8 hw_link_id;
540541

541542
struct completion peer_assoc_done;
542543
struct completion peer_delete_done;
@@ -596,6 +597,13 @@ struct ath12k {
596597
int monitor_vdev_id;
597598
};
598599

600+
struct ath12k_hw {
601+
struct ieee80211_hw *hw;
602+
603+
u8 num_radio;
604+
struct ath12k radio[] __aligned(sizeof(void *));
605+
};
606+
599607
struct ath12k_band_cap {
600608
u32 phy_id;
601609
u32 max_bw_supported;
@@ -729,6 +737,16 @@ struct ath12k_base {
729737
u8 fw_pdev_count;
730738

731739
struct ath12k_pdev __rcu *pdevs_active[MAX_RADIOS];
740+
741+
/* Holds information of wiphy (hw) registration.
742+
*
743+
* In Multi/Single Link Operation case, all pdevs are registered as
744+
* a single wiphy. In other (legacy/Non-MLO) cases, each pdev is
745+
* registered as separate wiphys.
746+
*/
747+
struct ath12k_hw *ah[MAX_RADIOS];
748+
u8 num_hw;
749+
732750
struct ath12k_wmi_hal_reg_capabilities_ext_arg hal_reg_cap[MAX_RADIOS];
733751
unsigned long long free_vdev_map;
734752
unsigned long long free_vdev_stats_id_map;
@@ -810,6 +828,11 @@ struct ath12k_base {
810828
u8 drv_priv[] __aligned(sizeof(void *));
811829
};
812830

831+
struct ath12k_pdev_map {
832+
struct ath12k_base *ab;
833+
u8 pdev_idx;
834+
};
835+
813836
int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab);
814837
int ath12k_core_pre_init(struct ath12k_base *ab);
815838
int ath12k_core_init(struct ath12k_base *ath12k);
@@ -896,8 +919,18 @@ static inline const char *ath12k_bus_str(enum ath12k_bus bus)
896919
return "unknown";
897920
}
898921

922+
static inline struct ath12k_hw *ath12k_hw_to_ah(struct ieee80211_hw *hw)
923+
{
924+
return hw->priv;
925+
}
926+
927+
static inline struct ath12k *ath12k_ah_to_ar(struct ath12k_hw *ah)
928+
{
929+
return ah->radio;
930+
}
931+
899932
static inline struct ieee80211_hw *ath12k_ar_to_hw(struct ath12k *ar)
900933
{
901-
return ar->hw;
934+
return ar->ah->hw;
902935
}
903936
#endif /* _CORE_H_ */

0 commit comments

Comments
 (0)