Selaa lähdekoodia

qcacmn: Add support to extract sscan bandwidth capabilities

WMI_SPECTRAL_CAPABILITIES_EVENTID event will be sent by the FW to
indicate different capabilities of the Spectral HW.
Add support to extract the sscan bandwidth capabilities from this event.

Change-Id: I6ff6e5a8d80271fa62a430c986f53a321d46c66b
CRs-Fixed: 3098832
Shiva Krishna Pittala 3 vuotta sitten
vanhempi
sitoutus
861c4e29aa

+ 57 - 1
target_if/spectral/target_if_spectral.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2011,2017-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
@@ -7062,6 +7062,45 @@ target_if_wmi_extract_spectral_caps_fixed_param(
 	return psoc_spectral->wmi_ops.extract_spectral_caps_fixed_param(
 			wmi_handle, evt_buf, param);
 }
+
+/**
+ * target_if_wmi_extract_spectral_scan_bw_caps() - Wrapper function to
+ * extract bandwidth capabilities from Spectral capabilities WMI event
+ * @psoc: Pointer to psoc object
+ * @evt_buf: Event buffer
+ * @bw_caps: Data structure to be filled by this API after extraction
+ *
+ * Return: QDF_STATUS of operation
+ */
+QDF_STATUS
+target_if_wmi_extract_spectral_scan_bw_caps(
+			struct wlan_objmgr_psoc *psoc,
+			uint8_t *evt_buf,
+			struct spectral_scan_bw_capabilities *bw_caps)
+{
+	struct target_if_psoc_spectral *psoc_spectral;
+	wmi_unified_t wmi_handle;
+
+	if (!psoc) {
+		spectral_err("psoc is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc);
+	if (!wmi_handle) {
+		spectral_err("WMI handle is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	psoc_spectral = get_target_if_spectral_handle_from_psoc(psoc);
+	if (!psoc_spectral) {
+		spectral_err("spectral object is null");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return psoc_spectral->wmi_ops.extract_spectral_scan_bw_caps(
+			wmi_handle, evt_buf, bw_caps);
+}
 #else
 /**
  * target_if_spectral_wmi_unified_register_event_handler() - Wrapper function to
@@ -7319,6 +7358,23 @@ target_if_wmi_extract_spectral_caps_fixed_param(
 	return wmi_extract_spectral_caps_fixed_param(wmi_handle, evt_buf,
 						     param);
 }
+
+QDF_STATUS
+target_if_wmi_extract_spectral_scan_bw_caps(
+			struct wlan_objmgr_psoc *psoc,
+			uint8_t *evt_buf,
+			struct spectral_scan_bw_capabilities *bw_caps)
+{
+	wmi_unified_t wmi_handle;
+
+	wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc);
+	if (!wmi_handle) {
+		spectral_err("WMI handle is null");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	return wmi_extract_spectral_scan_bw_caps(wmi_handle, evt_buf, bw_caps);
+}
 #endif
 
 /**

+ 22 - 1
target_if/spectral/target_if_spectral.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2011,2017-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
@@ -944,6 +944,8 @@ struct vdev_spectral_enable_params;
  * detector information
  * @extract_spectral_caps_fixed_param: Extract fixed parameters from Spectral
  * capabilities event
+ * @extract_spectral_scan_bw_caps: Extract bandwidth capabilities from Spectral
+ * capabilities event
  */
 struct spectral_wmi_ops {
 	QDF_STATUS (*wmi_spectral_configure_cmd_send)(
@@ -980,6 +982,9 @@ struct spectral_wmi_ops {
 	QDF_STATUS (*extract_spectral_caps_fixed_param)(
 		wmi_unified_t wmi_handle, void *event,
 		struct spectral_capabilities_event_params *param);
+	QDF_STATUS (*extract_spectral_scan_bw_caps)(
+		wmi_unified_t wmi_handle, void *event,
+		struct spectral_scan_bw_capabilities *bw_caps);
 };
 
 /**
@@ -3000,4 +3005,20 @@ QDF_STATUS target_if_wmi_extract_spectral_caps_fixed_param(
 			struct wlan_objmgr_psoc *psoc,
 			uint8_t *evt_buf,
 			struct spectral_capabilities_event_params *param);
+
+struct spectral_scan_bw_capabilities;
+/**
+ * target_if_wmi_extract_spectral_scan_bw_caps() - Wrapper function to
+ * extract bandwidth capabilities from Spectral capabilities WMI event
+ * @psoc: Pointer to psoc object
+ * @evt_buf: Event buffer
+ * @bw_caps: Data structure to be filled by this API after extraction
+ *
+ * Return: QDF_STATUS of operation
+ */
+QDF_STATUS
+target_if_wmi_extract_spectral_scan_bw_caps(
+			struct wlan_objmgr_psoc *psoc,
+			uint8_t *evt_buf,
+			struct spectral_scan_bw_capabilities *bw_caps);
 #endif /* _TARGET_IF_SPECTRAL_H_ */

+ 14 - 1
wmi/inc/wmi_unified_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2013-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
@@ -2325,6 +2325,19 @@ QDF_STATUS wmi_extract_pdev_spectral_session_detector_info(
 QDF_STATUS wmi_extract_spectral_caps_fixed_param(
 		wmi_unified_t wmi_handle, void *event,
 		struct spectral_capabilities_event_params *param);
+
+/**
+ * wmi_extract_spectral_scan_bw_caps() - Extract bandwidth caps from
+ * Spectral capabilities WMI event
+ * @wmi_handle: handle to WMI.
+ * @event: Event buffer
+ * @bw_caps: Data structure to be populated by this API after extraction
+ *
+ * Return: QDF_STATUS of operation
+ */
+QDF_STATUS wmi_extract_spectral_scan_bw_caps(
+		wmi_unified_t wmi_handle, void *event,
+		struct spectral_scan_bw_capabilities *bw_caps);
 #endif /* WLAN_CONV_SPECTRAL_ENABLE */
 
 #if defined(WLAN_SUPPORT_FILS) || defined(CONFIG_BAND_6GHZ)

+ 17 - 1
wmi/inc/wmi_unified_param.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-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
@@ -3117,6 +3117,22 @@ struct spectral_capabilities_event_params {
 	uint8_t num_sscan_bw_caps;
 	uint8_t num_fft_size_caps;
 };
+
+/**
+ * struct spectral_scan_bw_capabilities - Spectral scan bandwidth caps
+ * that are extracted from Spectral capabilities WMI event
+ * @pdev_id: pdev ID
+ * @smode: Spectral scan mode
+ * @operating_bw: Operating bandwidth
+ * @supported_bws: Supported sscan bandwidths bitmap for given @pdev_id,
+ * @operating_bw, and @smode
+ */
+struct spectral_scan_bw_capabilities {
+	uint8_t pdev_id;
+	enum spectral_scan_mode smode;
+	enum phy_ch_width operating_bw;
+	uint32_t supported_bws;
+};
 #endif
 
 /**

+ 5 - 1
wmi/inc/wmi_unified_priv.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2013-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
@@ -1518,6 +1518,10 @@ QDF_STATUS (*extract_pdev_spectral_session_detector_info)(
 QDF_STATUS (*extract_spectral_caps_fixed_param)(
 		wmi_unified_t wmi_handle, void *event,
 		struct spectral_capabilities_event_params *param);
+
+QDF_STATUS (*extract_spectral_scan_bw_caps)(
+		wmi_unified_t wmi_handle, void *event,
+		struct spectral_scan_bw_capabilities *bw_caps);
 #endif /* WLAN_CONV_SPECTRAL_ENABLE */
 
 QDF_STATUS (*send_vdev_spectral_configure_cmd)(wmi_unified_t wmi_handle,

+ 12 - 1
wmi/src/wmi_unified_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-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
@@ -2695,6 +2695,17 @@ QDF_STATUS wmi_extract_spectral_caps_fixed_param(
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+QDF_STATUS wmi_extract_spectral_scan_bw_caps(
+		wmi_unified_t wmi_handle, void *event,
+		struct spectral_scan_bw_capabilities *bw_caps)
+{
+	if (wmi_handle->ops->extract_spectral_scan_bw_caps)
+		return wmi_handle->ops->extract_spectral_scan_bw_caps(
+					wmi_handle, event, bw_caps);
+
+	return QDF_STATUS_E_FAILURE;
+}
 #endif /* WLAN_CONV_SPECTRAL_ENABLE */
 
 QDF_STATUS wmi_extract_spectral_scaling_params_service_ready_ext(

+ 52 - 1
wmi/src/wmi_unified_tlv.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2016-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
@@ -7449,6 +7449,55 @@ extract_spectral_caps_fixed_param_tlv(
 
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * extract_spectral_scan_bw_caps_tlv() - Extract bandwidth caps from
+ * Spectral capabilities WMI event
+ * @wmi_handle: handle to WMI.
+ * @event: Event buffer
+ * @bw_caps: Data structure to be populated by this API after extraction
+ *
+ * Return: QDF_STATUS of operation
+ */
+static QDF_STATUS
+extract_spectral_scan_bw_caps_tlv(
+	wmi_unified_t wmi_handle, void *event,
+	struct spectral_scan_bw_capabilities *bw_caps)
+{
+	WMI_SPECTRAL_CAPABILITIES_EVENTID_param_tlvs *param_buf = event;
+	int idx;
+
+	if (!param_buf) {
+		wmi_err("param_buf is NULL");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	if (!bw_caps) {
+		wmi_err("bw_caps is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	for (idx = 0; idx < param_buf->num_sscan_bw_caps; idx++) {
+		bw_caps[idx].pdev_id =
+			wmi_handle->ops->convert_pdev_id_target_to_host(
+				wmi_handle,
+				param_buf->sscan_bw_caps[idx].pdev_id);
+		bw_caps[idx].smode = param_buf->sscan_bw_caps[idx].sscan_mode;
+		bw_caps[idx].operating_bw = wmi_map_ch_width(
+			param_buf->sscan_bw_caps[idx].operating_bw);
+		bw_caps[idx].supported_bws =
+			param_buf->sscan_bw_caps[idx].supported_flags;
+
+		wmi_debug("bw_caps[%u]:: pdev_id:%u smode:%u"
+			  "operating_bw:%u supported_flags:0x%x",
+			  idx, param_buf->sscan_bw_caps[idx].pdev_id,
+			  param_buf->sscan_bw_caps[idx].sscan_mode,
+			  param_buf->sscan_bw_caps[idx].operating_bw,
+			  param_buf->sscan_bw_caps[idx].supported_flags);
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
 #endif /* WLAN_CONV_SPECTRAL_ENABLE */
 
 #ifdef FEATURE_WPSS_THERMAL_MITIGATION
@@ -17041,6 +17090,8 @@ struct wmi_ops tlv_ops =  {
 				extract_pdev_spectral_session_detector_info_tlv,
 	.extract_spectral_caps_fixed_param =
 				extract_spectral_caps_fixed_param_tlv,
+	.extract_spectral_scan_bw_caps =
+				extract_spectral_scan_bw_caps_tlv,
 #endif /* WLAN_CONV_SPECTRAL_ENABLE */
 	.send_thermal_mitigation_param_cmd =
 		send_thermal_mitigation_param_cmd_tlv,