mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-22 03:42:41 +00:00
104 lines
3.4 KiB
Diff
104 lines
3.4 KiB
Diff
From 7ea127667c219c9296b7e76b0b2cf78b9652d389 Mon Sep 17 00:00:00 2001
|
|
From: Aditya Kumar Singh <quic_adisi@quicinc.com>
|
|
Date: Mon, 12 Dec 2022 10:15:51 +0530
|
|
Subject: [PATCH 2/2] ath12k: add initial DFS MLO support
|
|
|
|
For MLO case, there is need to let the vdev get created in order
|
|
to start the CAC even though the partner vdevs are not yet created.
|
|
|
|
Add logic to create and start the vdev in MLO case.
|
|
|
|
Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
|
|
---
|
|
drivers/net/wireless/ath/ath12k/mac.c | 49 +++++++++++++++++++++++++--
|
|
1 file changed, 47 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/net/wireless/ath/ath12k/mac.c
|
|
+++ b/drivers/net/wireless/ath/ath12k/mac.c
|
|
@@ -10044,14 +10044,63 @@ static int ath12k_mac_mlo_vdev_start(str
|
|
int ret = 0;
|
|
u16 links_map;
|
|
bool radar_enabled = arvif->chanctx.radar_enabled;
|
|
+ bool radar_vdev_create = false;
|
|
|
|
lockdep_assert_held(&ah->conf_mutex);
|
|
- /* TODO some changes are expected in this func wrt DFS statemachine */
|
|
/* FIXME Note that this logic is temp and wont work for MBSSID cases
|
|
* There are two options, 1, the set link should have some pre channel info
|
|
* or FW should support dynamic partner add/remove support
|
|
*/
|
|
|
|
+ /* check if we need to do CAC here and allow the link to start.
|
|
+ */
|
|
+ ret = cfg80211_chandef_dfs_required(ah->hw->wiphy,
|
|
+ &arvif->chanctx.def,
|
|
+ NL80211_IFTYPE_AP);
|
|
+ if (ret > 0) {
|
|
+ ret = cfg80211_chandef_dfs_available(ah->hw->wiphy,
|
|
+ &arvif->chanctx.def);
|
|
+ if (!ret) {
|
|
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
|
|
+ "mac mlo vdev %d radar required",
|
|
+ arvif->vdev_id);
|
|
+ radar_vdev_create = true;
|
|
+ } else {
|
|
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC,
|
|
+ "mac mlo vdev %d radar available, wait for sync",
|
|
+ arvif->vdev_id);
|
|
+ radar_vdev_create = false;
|
|
+ ret = 0;
|
|
+ }
|
|
+ } else if (WARN_ON(ret < 0)) {
|
|
+ /* should not reach here */
|
|
+ return -EINVAL;
|
|
+ }
|
|
+
|
|
+ /* As per DFS state machine, vdev should be allowed to get created for
|
|
+ * CAC to happen even if other link's vdevs are not yet created
|
|
+ */
|
|
+ if (radar_vdev_create &&
|
|
+ (ahvif->num_vdev_created != hweight16(ahvif->vif->valid_links))) {
|
|
+ ath12k_dbg(ar->ab, ATH12K_DBG_MAC, "mac allowing MLO DFS vdev create");
|
|
+
|
|
+ mutex_lock(&ar->conf_mutex);
|
|
+ ret = ath12k_mac_vdev_start(arvif, &arvif->chanctx.def,
|
|
+ radar_enabled);
|
|
+ if (ret) {
|
|
+ ath12k_warn(ar->ab, "failed to start vdev %i on freq %d: %d\n",
|
|
+ arvif->vdev_id, arvif->chanctx.def.chan->center_freq, ret);
|
|
+ mutex_unlock(&ar->conf_mutex);
|
|
+ goto out;
|
|
+ }
|
|
+
|
|
+ arvif->is_started = true;
|
|
+ mutex_unlock(&ar->conf_mutex);
|
|
+ ahvif->num_vdev_started++;
|
|
+ /* Beaconing not required in DFS channel assignment for CAC */
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
/* we need to wait for all the link vdev in the vif to be created
|
|
* before we start
|
|
*/
|
|
@@ -10061,6 +10110,7 @@ static int ath12k_mac_mlo_vdev_start(str
|
|
links_map = ahvif->links_map;
|
|
for_each_set_bit(link_id, &links_map, IEEE80211_MLD_MAX_NUM_LINKS) {
|
|
arvif_p = ahvif->link[link_id];
|
|
+ radar_enabled = arvif_p->chanctx.radar_enabled;
|
|
|
|
if (!arvif_p->ar) {
|
|
ath12k_warn(ar->ab, "invalid ar in the arvif_p\n");
|
|
@@ -11300,7 +11350,11 @@ ath12k_mac_op_assign_vif_chanctx(struct
|
|
return -EINVAL;
|
|
}
|
|
} else if (vif->valid_links){
|
|
- /* not expected to be here */
|
|
+ ar = arvif->ar;
|
|
+ if (WARN_ON(!ar)) {
|
|
+ mutex_unlock(&ah->conf_mutex);
|
|
+ return -EINVAL;
|
|
+ }
|
|
} else {
|
|
ar = ath12k_get_ar_by_ctx(hw, ctx);
|
|
if (!ar) {
|