Parcourir la source

qcacmn: Use the correct Psoc to derive wifi_pos psoc priv object

Currently, as part of wifi load, the wifi_pos psoc private object is only
allocated for the first PSOC (PSOCx) and this PSOCx can be accessed via
wifi_pos_get_psoc() to derive the wifi_pos psoc private object.
In the current code, when RTT is triggered on PSOCy, this psoc is used to
derive the wifi_pos psoc private object instead of PSOCx.
Since wifi_psoc psoc private object is not tied to PSOCy,
wifi_pos_get_psoc_priv_obj() returns NULL and this leads to RTT failure.

To fix this, check and replace ‘wifi_pos_get_psoc_priv_obj(psoc)’ with
‘wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc())’

Change-Id: I2acb91c4c80ad94df22390f3763e2d34c83b743d
CRs-Fixed: 3619836
Shashikala Prabhu il y a 1 an
Parent
commit
5e17e0ba24

+ 22 - 9
umac/wifi_pos/src/wifi_pos_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2023 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
@@ -560,7 +560,8 @@ QDF_STATUS wifi_pos_register_get_pdev_id_by_dev_name(
 		QDF_STATUS (*handler)(char *dev_name, uint8_t *pdev_id,
 				      struct wlan_objmgr_psoc **psoc))
 {
-	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc;
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
 
 	if (!psoc) {
 		wifi_pos_err("psoc is null");
@@ -572,7 +573,9 @@ QDF_STATUS wifi_pos_register_get_pdev_id_by_dev_name(
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(psoc);
+	if (tmp_psoc)
+		wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(tmp_psoc);
+
 	if (!wifi_pos_psoc) {
 		wifi_pos_err("wifi_pos priv obj is null");
 		return QDF_STATUS_E_NULL_VALUE;
@@ -589,7 +592,8 @@ QDF_STATUS wifi_pos_register_measurement_request_notification(
 		QDF_STATUS (*handler)(struct wlan_objmgr_pdev *pdev,
 				      struct rtt_channel_info *chinfo))
 {
-	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc;
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
 
 	if (!psoc) {
 		wifi_pos_err("psoc is null");
@@ -601,7 +605,9 @@ QDF_STATUS wifi_pos_register_measurement_request_notification(
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(psoc);
+	if (tmp_psoc)
+		wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(tmp_psoc);
+
 	if (!wifi_pos_psoc) {
 		wifi_pos_err("wifi_pos priv obj is null");
 		return QDF_STATUS_E_NULL_VALUE;
@@ -619,7 +625,8 @@ QDF_STATUS wifi_pos_register_get_max_fw_phymode_for_channels(
 				      struct wifi_pos_channel_power *chan_list,
 				      uint16_t wifi_pos_num_chans))
 {
-	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc;
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
 
 	if (!psoc) {
 		wifi_pos_err("psoc is null");
@@ -631,7 +638,9 @@ QDF_STATUS wifi_pos_register_get_max_fw_phymode_for_channels(
 		return QDF_STATUS_E_NULL_VALUE;
 	}
 
-	wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(psoc);
+	if (tmp_psoc)
+		wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(tmp_psoc);
+
 	if (!wifi_pos_psoc) {
 		wifi_pos_err("wifi_pos priv obj is null");
 		return QDF_STATUS_E_NULL_VALUE;
@@ -650,7 +659,8 @@ QDF_STATUS wifi_pos_register_send_action(
 						uint8_t *buf,
 						uint32_t buf_len))
 {
-	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc;
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
 
 	if (!psoc) {
 		wifi_pos_err("psoc is null");
@@ -661,7 +671,10 @@ QDF_STATUS wifi_pos_register_send_action(
 		wifi_pos_err("Null callback");
 		return QDF_STATUS_E_NULL_VALUE;
 	}
-	wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(psoc);
+
+	if (tmp_psoc)
+		wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(tmp_psoc);
+
 	if (!wifi_pos_psoc) {
 		wifi_pos_err("wifi_pos priv obj is null");
 		return QDF_STATUS_E_NULL_VALUE;

+ 31 - 12
umac/wifi_pos/src/wifi_pos_main.c

@@ -314,11 +314,14 @@ static QDF_STATUS wifi_pos_process_set_cap_req(struct wlan_objmgr_psoc *psoc,
 					struct wifi_pos_req_msg *req)
 {
 	int error_code;
-	struct wifi_pos_psoc_priv_obj *wifi_pos_obj =
-				wifi_pos_get_psoc_priv_obj(psoc);
+	struct wifi_pos_psoc_priv_obj *wifi_pos_obj = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
 	struct wifi_pos_user_defined_caps *caps =
 				(struct wifi_pos_user_defined_caps *)req->buf;
 
+	if (tmp_psoc)
+		wifi_pos_obj = wifi_pos_get_psoc_priv_obj(tmp_psoc);
+
 	if (!wifi_pos_obj) {
 		wifi_pos_err("wifi_pos priv obj is null");
 		return QDF_STATUS_E_INVAL;
@@ -342,8 +345,11 @@ static QDF_STATUS wifi_pos_process_get_cap_req(struct wlan_objmgr_psoc *psoc,
 					struct wifi_pos_req_msg *req)
 {
 	struct wifi_pos_oem_get_cap_rsp cap_rsp = { { {0} } };
-	struct wifi_pos_psoc_priv_obj *wifi_pos_obj =
-					wifi_pos_get_psoc_priv_obj(psoc);
+	struct wifi_pos_psoc_priv_obj *wifi_pos_obj = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
+
+	if (tmp_psoc)
+		wifi_pos_obj = wifi_pos_get_psoc_priv_obj(tmp_psoc);
 
 	if (!wifi_pos_obj) {
 		wifi_pos_err("wifi_pos priv obj is null");
@@ -370,8 +376,11 @@ QDF_STATUS wifi_pos_send_report_resp(struct wlan_objmgr_psoc *psoc,
 				     int err_code)
 {
 	struct wifi_pos_err_msg_report err_report = {0};
-	struct wifi_pos_psoc_priv_obj *wifi_pos_obj =
-					wifi_pos_get_psoc_priv_obj(psoc);
+	struct wifi_pos_psoc_priv_obj *wifi_pos_obj = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
+
+	if (tmp_psoc)
+		wifi_pos_obj = wifi_pos_get_psoc_priv_obj(tmp_psoc);
 
 	if (!wifi_pos_obj) {
 		wifi_pos_err("wifi_pos priv obj is null");
@@ -631,11 +640,14 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc,
 	uint32_t num_valid_channels = 0;
 	struct wifi_pos_ch_info_rsp *ch_info;
 	struct wifi_pos_channel_list *ch_list = NULL;
-	struct wifi_pos_psoc_priv_obj *wifi_pos_obj =
-					wifi_pos_get_psoc_priv_obj(psoc);
+	struct wifi_pos_psoc_priv_obj *wifi_pos_obj = NULL;
 	QDF_STATUS ret_val;
 	struct wifi_pos_channel_power *ch;
 	bool dup_freq = false;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
+
+	if (tmp_psoc)
+		wifi_pos_obj = wifi_pos_get_psoc_priv_obj(tmp_psoc);
 
 	if (!wifi_pos_obj) {
 		wifi_pos_err("wifi_pos priv obj is null");
@@ -843,8 +855,11 @@ static QDF_STATUS wifi_pos_process_app_reg_req(struct wlan_objmgr_psoc *psoc,
 	uint32_t vdev_count;
 	char *sign_str = NULL;
 	struct app_reg_rsp_vdev_info *vdevs_info = NULL;
-	struct wifi_pos_psoc_priv_obj *wifi_pos_obj =
-			wifi_pos_get_psoc_priv_obj(psoc);
+	struct wifi_pos_psoc_priv_obj *wifi_pos_obj = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
+
+	if (tmp_psoc)
+		wifi_pos_obj = wifi_pos_get_psoc_priv_obj(tmp_psoc);
 
 	if (!wifi_pos_obj) {
 		wifi_pos_err("wifi_pos priv obj is null");
@@ -1284,11 +1299,15 @@ QDF_STATUS wifi_pos_populate_caps(struct wlan_objmgr_psoc *psoc,
 {
 	uint16_t i, count = 0;
 	uint32_t freq;
-	struct wifi_pos_psoc_priv_obj *wifi_pos_obj =
-					wifi_pos_get_psoc_priv_obj(psoc);
+	struct wifi_pos_psoc_priv_obj *wifi_pos_obj = NULL;
 	struct wifi_pos_channel_list *ch_list = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
 
 	wifi_pos_debug("Enter");
+
+	if (tmp_psoc)
+		wifi_pos_obj = wifi_pos_get_psoc_priv_obj(tmp_psoc);
+
 	if (!wifi_pos_obj) {
 		wifi_pos_err("wifi_pos_obj is null");
 		return QDF_STATUS_E_NULL_VALUE;

+ 5 - 2
umac/wifi_pos/src/wifi_pos_ucfg.c

@@ -206,8 +206,11 @@ void ucfg_wifi_pos_set_oem_6g_supported(struct wlan_objmgr_psoc *psoc,
 bool ucfg_wifi_pos_is_nl_rsp(struct wlan_objmgr_psoc *psoc)
 {
 	uint32_t val = 0;
-	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc =
-			wifi_pos_get_psoc_priv_obj(psoc);
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc = NULL;
+	struct wlan_objmgr_psoc *tmp_psoc = wifi_pos_get_psoc();
+
+	if (tmp_psoc)
+		wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(tmp_psoc);
 
 	if (!wifi_pos_psoc) {
 		wifi_pos_alert("unable to get wifi_pos psoc obj");