Pārlūkot izejas kodu

qcacld-3.0: Override NSS with the HW NSS capability during TDLS setup

Add support override the NSS capability with HW NSS capability
during TDLS setup.

Change-Id: I916193969d5aafe042ee1bea2adc29668c9109ee
CRs-Fixed: 3792456
Vijay Raj 1 gadu atpakaļ
vecāks
revīzija
ebd1aaceda

+ 24 - 0
components/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -367,6 +367,30 @@ QDF_STATUS
 policy_mgr_get_dfs_sta_sap_go_scc_movement(struct wlan_objmgr_psoc *psoc,
 					   bool *move_sap_go_first);
 
+ /**
+  * policy_mgr_nss_update_cb() - callback from SME confirming nss
+  * update
+  * @psoc: psoc handle
+  * @tx_status: tx completion status for updated beacon with new
+  *              nss value
+  * @vdev_id: vdev id for the specific connection
+  * @next_action: next action to happen at policy mgr after
+  *              beacon update
+  * @reason: Reason for nss update
+  * @original_vdev_id: original request hwmode change vdev id
+  * @request_id: request ID
+  *
+  * This function is the callback registered with SME at nss
+  * update request time
+  *
+  * Return: None
+  */
+
+void policy_mgr_nss_update_cb(struct wlan_objmgr_psoc *psoc,
+			      uint8_t tx_status, uint8_t vdev_id,
+			      uint8_t next_action,
+			      enum policy_mgr_conn_update_reason reason,
+			      uint32_t original_vdev_id, uint32_t request_id);
 /*
  * policy_mgr_get_connected_vdev_band_mask() - to get the connected vdev band
  * mask

+ 6 - 24
components/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -4633,30 +4633,12 @@ void policy_mgr_check_scc_channel(struct wlan_objmgr_psoc *psoc,
 	qdf_mutex_release(&pm_ctx->qdf_conc_list_lock);
 }
 
-/**
- * policy_mgr_nss_update_cb() - callback from SME confirming nss
- * update
- * @psoc: psoc handle
- * @tx_status: tx completion status for updated beacon with new
- *		nss value
- * @vdev_id: vdev id for the specific connection
- * @next_action: next action to happen at policy mgr after
- *		beacon update
- * @reason: Reason for nss update
- * @original_vdev_id: original request hwmode change vdev id
- * @request_id: request ID
- *
- * This function is the callback registered with SME at nss
- * update request time
- *
- * Return: None
- */
-static void policy_mgr_nss_update_cb(struct wlan_objmgr_psoc *psoc,
-		uint8_t tx_status,
-		uint8_t vdev_id,
-		uint8_t next_action,
-		enum policy_mgr_conn_update_reason reason,
-		uint32_t original_vdev_id, uint32_t request_id)
+void policy_mgr_nss_update_cb(struct wlan_objmgr_psoc *psoc,
+			      uint8_t tx_status,
+			      uint8_t vdev_id,
+			      uint8_t next_action,
+			      enum policy_mgr_conn_update_reason reason,
+			      uint32_t original_vdev_id, uint32_t request_id)
 {
 	uint32_t conn_index = 0;
 	QDF_STATUS ret;

+ 62 - 0
components/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -752,6 +752,68 @@ static void policy_mgr_get_hw_mode_params(
 	}
 }
 
+QDF_STATUS policy_mgr_update_nss_req(struct wlan_objmgr_psoc *psoc,
+				     uint8_t vdev_id)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	struct target_psoc_info *tgt_hdl;
+	struct wlan_psoc_host_mac_phy_caps *tmp;
+	struct tgt_info *info;
+	struct policy_mgr_mac_ss_bw_info mac_ss_bw_info;
+	uint8_t i,  mac_found = 0;
+	uint32_t lmac_id;
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
+	if (!tgt_hdl) {
+		policy_mgr_err("tgt_hdl not found");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	info = &tgt_hdl->info;
+	lmac_id = policy_mgr_mode_get_macid_by_vdev_id(psoc, vdev_id);
+	if (lmac_id == 0xFF) {
+		policy_mgr_err("mac_id not found");
+		goto out;
+	}
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("pm ctx not found");
+		goto out;
+	}
+
+	for (i = 0; i < pm_ctx->num_dbs_hw_modes; i++) {
+		tmp = &info->mac_phy_cap[i];
+
+		if (tmp->lmac_id  != lmac_id)
+			continue;
+
+		policy_mgr_get_hw_mode_params(tmp,
+					      &mac_ss_bw_info);
+		mac_found = 1;
+		break;
+	}
+
+	if (!mac_found) {
+		policy_mgr_err("mac_id : %d not found", lmac_id);
+		return status;
+	}
+
+	status =
+	pm_ctx->sme_cbacks.sme_nss_update_request(vdev_id,
+						  mac_ss_bw_info.mac_rx_stream,
+						  mac_ss_bw_info.mac_bw,
+						  policy_mgr_nss_update_cb,
+						  PM_NOP, psoc,
+						  POLICY_MGR_UPDATE_REASON_START_AP,
+						  vdev_id,
+						  POLICY_MGR_DEF_REQ_ID);
+
+out:
+	return status;
+}
+
 /**
  * policy_mgr_set_hw_mode_params() - sets TX-RX stream,
  * bandwidth and DBS in hw_mode_list

+ 11 - 1
components/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -1032,6 +1032,16 @@ void policy_mgr_reg_chan_change_callback(struct wlan_objmgr_psoc *psoc,
 		struct avoid_freq_ind_data *avoid_freq_ind,
 		void *arg);
 
+/**
+ * policy_mgr_update_nss_req() - wrapper API to update nss
+ * @psoc: psoc object
+ * @vdev_id: vdev id
+ *
+ * Return: QDF_STATUS_SUCCESS
+ */
+QDF_STATUS policy_mgr_update_nss_req(struct wlan_objmgr_psoc *psoc,
+				     uint8_t vdev_id);
+
 /**
  * policy_mgr_nss_update() - update nss for AP vdev
  * @psoc: PSOC object information

+ 18 - 1
components/tdls/core/src/wlan_tdls_cmds_process.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -39,6 +39,7 @@
 #include "wlan_policy_mgr_api.h"
 #include "nan_ucfg_api.h"
 #include "wlan_mlme_main.h"
+#include "wlan_policy_mgr_i.h"
 
 static uint16_t tdls_get_connected_peer_count(struct tdls_soc_priv_obj *soc_obj)
 {
@@ -2377,6 +2378,8 @@ int tdls_process_set_responder(struct tdls_set_responder_req *set_req)
 {
 	struct tdls_peer *curr_peer;
 	struct tdls_vdev_priv_obj *tdls_vdev;
+	struct wlan_objmgr_psoc *psoc;
+	QDF_STATUS status;
 
 	tdls_vdev = wlan_vdev_get_tdls_vdev_obj(set_req->vdev);
 	if (!tdls_vdev) {
@@ -2390,6 +2393,20 @@ int tdls_process_set_responder(struct tdls_set_responder_req *set_req)
 	}
 
 	curr_peer->is_responder = set_req->responder;
+
+	psoc = wlan_vdev_get_psoc(tdls_vdev->vdev);
+	if (!psoc) {
+		tdls_err("psoc not found");
+		return -EINVAL;
+	}
+
+	status = policy_mgr_update_nss_req(psoc,
+					   wlan_vdev_get_id(tdls_vdev->vdev));
+	if (QDF_IS_STATUS_ERROR(status)) {
+		tdls_err("Unable to process NSS request");
+		return -EINVAL;
+	}
+
 	return 0;
 }