Преглед изворни кода

qcacmn: Register callback to get max supported FW phymode

Register a callback to get max supported FW phymode for the given
channel list.

Also, corrected the array index value used to populate the DFS flag and
phymode.

Change-Id: Id635a159acac085827831726d3020cc209b810cf
CRs-Fixed: 3083405
Shashikala Prabhu пре 3 година
родитељ
комит
236152dcc0

+ 15 - 1
umac/wifi_pos/inc/wifi_pos_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -513,6 +513,20 @@ QDF_STATUS wifi_pos_register_get_pdev_id_by_dev_name(
 		struct wlan_objmgr_psoc *psoc,
 		QDF_STATUS (*handler)(char *dev_name, uint8_t *pdev_id,
 				      struct wlan_objmgr_psoc **psoc));
+
+/**
+ * wifi_pos_register_get_max_fw_phymode_for_channels: API to register callback
+ * to get FW phymode for the given channels.
+ * @psoc:  pointer to global psoc object
+ * @handler: callback to be registered
+ *
+ * Return: QDF_STATUS_SUCCESS in case of success, error codes in case of failure
+ */
+QDF_STATUS wifi_pos_register_get_max_fw_phymode_for_channels(
+		struct wlan_objmgr_psoc *psoc,
+		QDF_STATUS (*handler)(struct wlan_objmgr_pdev *pdev,
+				      struct wifi_pos_channel_power *chan_list,
+				      uint16_t wifi_pos_num_chans));
 #endif /* CNSS_GENL */
 
 #if !defined(CNSS_GENL) && defined(WLAN_RTT_MEASUREMENT_NOTIFICATION)

+ 30 - 1
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 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -438,6 +438,35 @@ QDF_STATUS wifi_pos_register_measurement_request_notification(
 	return QDF_STATUS_SUCCESS;
 }
 #endif /* WLAN_RTT_MEASUREMENT_NOTIFICATION */
+
+QDF_STATUS wifi_pos_register_get_max_fw_phymode_for_channels(
+		struct wlan_objmgr_psoc *psoc,
+		QDF_STATUS (*handler)(struct wlan_objmgr_pdev *pdev,
+				      struct wifi_pos_channel_power *chan_list,
+				      uint16_t wifi_pos_num_chans))
+{
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc;
+
+	if (!psoc) {
+		wifi_pos_err("psoc is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!handler) {
+		wifi_pos_err("Null callback");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	wifi_pos_psoc = wifi_pos_get_psoc_priv_obj(psoc);
+	if (!wifi_pos_psoc) {
+		wifi_pos_err("wifi_pos priv obj is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	wifi_pos_psoc->wifi_pos_get_max_fw_phymode_for_channels = handler;
+
+	return QDF_STATUS_SUCCESS;
+}
 #endif /* CNSS_GENL */
 
 QDF_STATUS wifi_pos_register_send_action(

+ 21 - 4
umac/wifi_pos/src/wifi_pos_main.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -505,6 +505,13 @@ static void wifi_pos_pdev_iterator(struct wlan_objmgr_psoc *psoc,
 	struct channel_power *ch_info = NULL;
 	struct wifi_pos_channel_power *wifi_pos_ch;
 	int i;
+	struct wifi_pos_psoc_priv_obj *wifi_pos_psoc =
+		wifi_pos_get_psoc_priv_obj(wifi_pos_get_psoc());
+
+	if (!wifi_pos_psoc) {
+		wifi_pos_err("wifi_pos priv obj is null");
+		return;
+	}
 
 	if (!chan_list) {
 		wifi_pos_err("wifi_pos priv arg is null");
@@ -546,6 +553,16 @@ static void wifi_pos_pdev_iterator(struct wlan_objmgr_psoc *psoc,
 				ch_info[i].center_freq, &wifi_pos_ch[i]);
 	}
 
+	if (wifi_pos_psoc->wifi_pos_get_max_fw_phymode_for_channels) {
+		status = wifi_pos_psoc->wifi_pos_get_max_fw_phymode_for_channels(
+				pdev, wifi_pos_ch, num_channels);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			wifi_pos_err("Failed to get phymode");
+			qdf_mem_free(ch_info);
+			return;
+		}
+	}
+
 	chan_list->num_channels += num_channels;
 	qdf_mem_free(ch_info);
 }
@@ -712,11 +729,11 @@ static QDF_STATUS wifi_pos_process_ch_info_req(struct wlan_objmgr_psoc *psoc,
 		REG_SET_CHANNEL_MAX_TX_POWER(ch_info[idx].reg_info_2,
 					     ch[idx].ch_power.tx_power);
 
-		if (ch[i].is_dfs_chan)
+		if (ch[idx].is_dfs_chan)
 			WIFI_POS_SET_DFS(ch_info[idx].info);
 
-		if (ch[i].phy_mode)
-			REG_SET_CHANNEL_MODE(&ch_info[idx], ch[i].phy_mode);
+		if (ch[idx].phy_mode)
+			REG_SET_CHANNEL_MODE(&ch_info[idx], ch[idx].phy_mode);
 	}
 
 	wifi_pos_obj->wifi_pos_send_rsp(psoc, wifi_pos_obj->app_pid,

+ 7 - 1
umac/wifi_pos/src/wifi_pos_utils_i.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 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
@@ -262,6 +262,8 @@ typedef void (*wifi_pos_send_rsp_handler)(struct wlan_objmgr_psoc *, uint32_t,
  *|          |resp |init |resp  |init  |resp   |init   |resp |init |
  *+----------+-----+-----+------+------+-------+-------+-----+-----+
  * resp - responder role; init- initiator role
+ * @wifi_pos_get_max_fw_phymode_for_channels: function pointer to get max
+ *            supported FW phymode for the given channels
  *
  */
 struct wifi_pos_psoc_priv_obj {
@@ -305,6 +307,10 @@ struct wifi_pos_psoc_priv_obj {
 			struct wlan_objmgr_pdev *pdev,
 			struct rtt_channel_info *chinfo);
 	uint32_t rsp_version;
+	QDF_STATUS (*wifi_pos_get_max_fw_phymode_for_channels)(
+			struct wlan_objmgr_pdev *pdev,
+			struct wifi_pos_channel_power *chan_list,
+			uint16_t wifi_pos_num_chans);
 };
 
 /**