Explorar o código

qcacmn: Add API to get spectral version

Since struct spectral_samp_msg may be modified, so provide API to get
version information, then spectraltool can compatible with different
host based on version information.

Change-Id: If68dbd0d85b28f46056208d849fe2db4faea493a
CRs-Fixed: 2575818
Wu Gao %!s(int64=5) %!d(string=hai) anos
pai
achega
80df191a1a

+ 6 - 0
spectral/dispatcher/inc/spectral_ioctl.h

@@ -53,6 +53,12 @@
 #define SPECTRAL_GET_DEBUG_LEVEL         (DFS_LAST_IOCTL + 23)
 #define SPECTRAL_SET_DMA_DEBUG           (DFS_LAST_IOCTL + 24)
 
+/*
+ * Increase spectral sub version if struct spectral_samp_msg updated.
+ */
+#define SPECTRAL_VERSION     (3)
+#define SPECTRAL_SUB_VERSION (1)
+
 /*
  * ioctl parameter types
  */

+ 15 - 1
spectral/dispatcher/inc/wlan_spectral_ucfg_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -84,4 +84,18 @@ QDF_STATUS ucfg_spectral_extract_response(struct spectral_cp_request *sscan_req,
  * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure
  */
 QDF_STATUS ucfg_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * ucfg_spectral_get_version() - ucfg API to get spectral version
+ * @pdev: Pointer to pdev object
+ * @version: Pointer to return version
+ * @sub_version: Pointer to return sub version
+ *
+ * Since struct spectral_samp_msg may be modified, so provide API to get
+ * version information and make sure spectraltool compatible with host.
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on failure
+ */
+QDF_STATUS ucfg_spectral_get_version(struct wlan_objmgr_pdev *pdev,
+				     uint32_t *version, uint32_t *sub_version);
 #endif /* _WLAN_SPECTRAL_UCFG_API_H_ */

+ 16 - 1
spectral/dispatcher/src/wlan_spectral_ucfg_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -221,3 +221,18 @@ QDF_STATUS ucfg_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev)
 {
 	return spectral_pdev_open(pdev);
 }
+
+QDF_STATUS ucfg_spectral_get_version(struct wlan_objmgr_pdev *pdev,
+				     uint32_t *version, uint32_t *sub_version)
+{
+	if (!pdev || !version || !sub_version) {
+		spectral_err("invalid param");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*version = SPECTRAL_VERSION;
+	*sub_version = SPECTRAL_SUB_VERSION;
+	spectral_debug("Spectral get version %d:%d", *version, *sub_version);
+
+	return QDF_STATUS_SUCCESS;
+}