Jelajahi Sumber

qcacmn: Reconfigure the link info when csa is received

Reconfigure the link information structure for the partner
links and assoc link when a channel switch event is received.

Change-Id: I022bb6c6e2bcf43a1efaa6234e52648142b9fde2
CRs-Fixed: 3599451
Aasir Rasheed 2 tahun lalu
induk
melakukan
1bd26224ae

+ 13 - 0
umac/cmn_services/utils/inc/wlan_utility.h

@@ -1057,4 +1057,17 @@ void wlan_minidump_remove(void *start_addr, const size_t size,
  */
 bool wlan_util_is_vdev_in_cac_wait(struct wlan_objmgr_pdev *pdev,
 				   wlan_objmgr_ref_dbgid dbg_id);
+
+/**
+ * wlan_eht_chan_phy_mode - convert eht chan to phy mode
+ * @freq: frequency
+ * @bw_val: bandwidth
+ * @chan_width: channel width
+ *
+ * Return: return phy mode
+ */
+enum wlan_phymode
+wlan_eht_chan_phy_mode(uint32_t freq,
+		       uint16_t bw_val,
+		       enum phy_ch_width chan_width);
 #endif /* _WLAN_UTILITY_H_ */

+ 37 - 0
umac/cmn_services/utils/src/wlan_utility.c

@@ -29,6 +29,7 @@
 #include "cfg_ucfg_api.h"
 #include <wlan_serialization_api.h>
 #include "wlan_cm_api.h"
+#include "host_diag_core_event.h"
 
 /* CRC polynomial 0xedb88320 */
 static unsigned long const wlan_shortssid_table[] = {
@@ -1987,6 +1988,42 @@ bool wlan_get_connected_vdev_by_mld_addr(struct wlan_objmgr_psoc *psoc,
 }
 #endif
 
+#if defined(WLAN_FEATURE_11BE)
+enum wlan_phymode
+wlan_eht_chan_phy_mode(uint32_t freq,
+		       uint16_t bw_val,
+		       enum phy_ch_width chan_width)
+{
+	if (wlan_reg_is_24ghz_ch_freq(freq)) {
+		if (bw_val == 20)
+			return WLAN_PHYMODE_11BEG_EHT20;
+		else if (bw_val == 40)
+			return WLAN_PHYMODE_11BEG_EHT40;
+	} else {
+		if (bw_val == 20)
+			return WLAN_PHYMODE_11BEA_EHT20;
+		else if (bw_val == 40)
+			return WLAN_PHYMODE_11BEA_EHT40;
+		else if (bw_val == 80)
+			return WLAN_PHYMODE_11BEA_EHT80;
+		else if (chan_width == CH_WIDTH_160MHZ)
+			return WLAN_PHYMODE_11BEA_EHT160;
+		else if (chan_width == CH_WIDTH_320MHZ)
+			return WLAN_PHYMODE_11BEA_EHT320;
+	}
+	return WLAN_PHYMODE_AUTO;
+}
+#else
+enum wlan_phymode
+wlan_eht_chan_phy_mode(uint32_t freq,
+		       uint16_t bw_val,
+		       enum phy_ch_width chan_width)
+{
+	return WLAN_PHYMODE_AUTO;
+}
+
+#endif
+
 static void wlan_pdev_chan_match(struct wlan_objmgr_pdev *pdev, void *object,
 				 void *arg)
 {

+ 19 - 0
umac/mlo_mgr/inc/wlan_mlo_mgr_link_switch.h

@@ -258,6 +258,17 @@ mlo_mgr_get_ap_link_by_link_id(struct wlan_mlo_dev_context *mlo_dev_ctx,
 struct mlo_link_info *mlo_mgr_get_ap_link(struct wlan_objmgr_vdev *vdev);
 
 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
+/**
+ * mlo_mgr_update_csa_link_info - update mlo sta csa params
+ * @mlo_dev_ctx: mlo dev ctx
+ * @csa_param: csa parameters to be updated
+ * @link_id: link id
+ * Return : true if csa parameters are updated
+ */
+bool mlo_mgr_update_csa_link_info(struct wlan_mlo_dev_context *mlo_dev_ctx,
+				  struct csa_offload_params *csa_param,
+				  uint8_t link_id);
+
 /**
  * mlo_mgr_osif_update_connect_info() - Update connection info to OSIF
  * layer on successful connection complete.
@@ -738,5 +749,13 @@ mlo_mgr_link_switch_defer_disconnect_req(struct wlan_objmgr_vdev *vdev,
 {
 	return QDF_STATUS_E_NOSUPPORT;
 }
+
+static inline bool
+mlo_mgr_update_csa_link_info(struct wlan_mlo_dev_context *mlo_dev_ctx,
+			     struct csa_offload_params *csa_param,
+			     uint8_t link_id)
+{
+	return false;
+}
 #endif
 #endif

+ 37 - 0
umac/mlo_mgr/src/wlan_mlo_mgr_link_switch.c

@@ -26,6 +26,7 @@
 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
 #include "wlan_cm_roam_api.h"
 #endif
+#include "host_diag_core_event.h"
 
 void mlo_mgr_update_link_info_mac_addr(struct wlan_objmgr_vdev *vdev,
 				       struct wlan_mlo_link_mac_update *ml_mac_update)
@@ -240,6 +241,42 @@ void mlo_mgr_free_link_info_wmi_chan(struct wlan_mlo_dev_context *ml_dev)
 }
 
 #ifdef WLAN_FEATURE_11BE_MLO_ADV_FEATURE
+bool mlo_mgr_update_csa_link_info(struct wlan_mlo_dev_context *mlo_dev_ctx,
+				  struct csa_offload_params *csa_param,
+				  uint8_t link_id)
+{
+	struct mlo_link_info *link_info;
+	uint16_t bw_val;
+
+	if (!mlo_dev_ctx) {
+		mlo_err("invalid mlo dev ctx");
+		goto done;
+	}
+
+	bw_val = wlan_reg_get_bw_value(csa_param->new_ch_width);
+
+	link_info = mlo_mgr_get_ap_link_by_link_id(mlo_dev_ctx, link_id);
+	if (!link_info) {
+		mlo_err("invalid link_info");
+		goto done;
+	}
+
+	link_info->link_chan_info->ch_freq =
+				csa_param->csa_chan_freq;
+	link_info->link_chan_info->ch_cfreq1 =
+				csa_param->new_ch_freq_seg1;
+	link_info->link_chan_info->ch_cfreq2 =
+				csa_param->new_ch_freq_seg2;
+
+	link_info->link_chan_info->ch_phymode =
+			wlan_eht_chan_phy_mode(
+				csa_param->csa_chan_freq,
+				bw_val, csa_param->new_ch_width);
+	return true;
+done:
+	return false;
+}
+
 struct wlan_objmgr_vdev *
 mlo_mgr_link_switch_get_assoc_vdev(struct wlan_objmgr_vdev *vdev)
 {