Explorar el Código

qcacmn: Enable spectral registration to direct dma

Enable registration of spectral feature to direct dma

CRs-Fixed: 2219121
Change-Id: I483e87b9a6c7dcd297bc8b88d24c49e8d80ed547
Edayilliam Jayadev hace 7 años
padre
commit
01b4921127

+ 4 - 0
spectral/core/spectral_defs_i.h

@@ -93,6 +93,7 @@ struct wmi_spectral_cmd_ops;
  * @sptrlc_register_netlink_cb: Register Netlink callbacks
  * @sptrlc_use_nl_bcast: Check whether to use Netlink broadcast/unicast
  * @sptrlc_deregister_netlink_cb: De-register Netlink callbacks
+ * @sptrlc_process_spectral_report: Process spectral report
  */
 struct spectral_context {
 	struct wlan_objmgr_psoc *psoc_obj;
@@ -130,6 +131,9 @@ struct spectral_context {
 		struct spectral_nl_cb *nl_cb);
 	bool (*sptrlc_use_nl_bcast)(struct wlan_objmgr_pdev *pdev);
 	void (*sptrlc_deregister_netlink_cb)(struct wlan_objmgr_pdev *pdev);
+	int (*sptrlc_process_spectral_report)(
+		struct wlan_objmgr_pdev *pdev,
+		void *payload);
 };
 
 #endif				/* _SPECTRAL_DEFS_I_H_ */

+ 1 - 0
spectral/core/spectral_direct_attach.c

@@ -45,4 +45,5 @@ spectral_ctx_init_da(struct spectral_context *sc)
 	sc->sptrlc_register_netlink_cb = tgt_spectral_register_nl_cb;
 	sc->sptrlc_use_nl_bcast = tgt_spectral_use_nl_bcast;
 	sc->sptrlc_deregister_netlink_cb = tgt_spectral_deregister_nl_cb;
+	sc->sptrlc_process_spectral_report = tgt_spectral_process_report;
 }

+ 1 - 0
spectral/core/spectral_offload.c

@@ -46,4 +46,5 @@ spectral_ctx_init_ol(struct spectral_context *sc)
 	sc->sptrlc_register_netlink_cb = tgt_spectral_register_nl_cb;
 	sc->sptrlc_use_nl_bcast = tgt_spectral_use_nl_bcast;
 	sc->sptrlc_deregister_netlink_cb = tgt_spectral_deregister_nl_cb;
+	sc->sptrlc_process_spectral_report = tgt_spectral_process_report;
 }

+ 29 - 0
spectral/dispatcher/inc/wlan_spectral_tgt_api.h

@@ -219,4 +219,33 @@ bool tgt_spectral_use_nl_bcast(struct wlan_objmgr_pdev *pdev);
  * Return: void
  */
 void tgt_spectral_deregister_nl_cb(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * tgt_spectral_process_report() - Process spectral report
+ * @pdev: Pointer to pdev object
+ * @payload: Pointer to spectral report buffer
+ *
+ * Return: status
+ */
+int
+tgt_spectral_process_report(struct wlan_objmgr_pdev *pdev,
+			    void *payload);
+
+/**
+ * tgt_spectral_register_to_dbr() - Register to direct dma
+ * @pdev: Pointer to pdev object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * tgt_spectral_get_target_type() - Get target type
+ * @psoc: Pointer to psoc object
+ *
+ * Return: target type
+ */
+uint32_t
+tgt_spectral_get_target_type(struct wlan_objmgr_psoc *psoc);
 #endif /* _WLAN_SPECTRAL_TGT_API_H_ */

+ 16 - 0
spectral/dispatcher/inc/wlan_spectral_utils_api.h

@@ -23,6 +23,9 @@
 #include <wlan_objmgr_cmn.h>
 #include <wlan_lmac_if_def.h>
 
+/* Forward declaration */
+struct direct_buf_rx_data;
+
 /**
  * wlan_spectral_init() - API to init spectral component
  *
@@ -142,4 +145,17 @@ spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev);
  */
 QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev);
 
+#ifdef DIRECT_BUF_RX_ENABLE
+/**
+ * spectral_dbr_event_handler() - Spectral dbr event handler
+ * @pdev:  pointer to pdev object
+ * @payload: dbr event buffer
+ *
+ * API to handle spectral dbr event
+ *
+ * Return: status
+ */
+int spectral_dbr_event_handler(struct wlan_objmgr_pdev *pdev,
+			       struct direct_buf_rx_data *payload);
+#endif
 #endif /* _WLAN_SPECTRAL_UTILS_API_H_*/

+ 56 - 0
spectral/dispatcher/src/wlan_spectral_tgt_api.c

@@ -18,6 +18,8 @@
  */
 
 #include <wlan_spectral_tgt_api.h>
+#include <wlan_spectral_utils_api.h>
+#include <target_type.h>
 
 void *
 tgt_get_target_handle(struct wlan_objmgr_pdev *pdev)
@@ -245,3 +247,57 @@ void tgt_spectral_deregister_nl_cb(struct wlan_objmgr_pdev *pdev)
 
 	psptrl_tx_ops->sptrlto_deregister_netlink_cb(pdev);
 }
+
+int
+tgt_spectral_process_report(struct wlan_objmgr_pdev *pdev,
+			    void *payload)
+{
+	struct wlan_objmgr_psoc *psoc = NULL;
+	struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+
+	psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops;
+
+	return psptrl_tx_ops->sptrlto_process_spectral_report(pdev, payload);
+}
+
+uint32_t
+tgt_spectral_get_target_type(struct wlan_objmgr_psoc *psoc)
+{
+	uint32_t target_type = 0;
+	struct wlan_lmac_if_target_tx_ops *target_type_tx_ops;
+
+	target_type_tx_ops = &psoc->soc_cb.tx_ops.target_tx_ops;
+
+	if (target_type_tx_ops->tgt_get_tgt_type)
+		target_type = target_type_tx_ops->tgt_get_tgt_type(psoc);
+
+	return target_type;
+}
+
+#ifdef DIRECT_BUF_RX_ENABLE
+QDF_STATUS
+tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_lmac_if_direct_buf_rx_tx_ops *dbr_tx_ops = NULL;
+
+	psoc = wlan_pdev_get_psoc(pdev);
+	dbr_tx_ops = &psoc->soc_cb.tx_ops.dbr_tx_ops;
+
+	if (tgt_spectral_get_target_type(psoc) == TARGET_TYPE_QCA8074)
+		if (dbr_tx_ops->direct_buf_rx_module_register)
+			return dbr_tx_ops->direct_buf_rx_module_register
+				(pdev, 0,
+				 spectral_dbr_event_handler);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#else
+QDF_STATUS
+tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif

+ 23 - 7
spectral/dispatcher/src/wlan_spectral_utils_api.c

@@ -191,15 +191,31 @@ wlan_register_wmi_spectral_cmd_ops(struct wlan_objmgr_pdev *pdev,
 }
 qdf_export_symbol(wlan_register_wmi_spectral_cmd_ops);
 
-QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev)
+#ifdef DIRECT_BUF_RX_ENABLE
+int spectral_dbr_event_handler(struct wlan_objmgr_pdev *pdev,
+			       struct direct_buf_rx_data *payload)
 {
-	struct wlan_objmgr_psoc *psoc;
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	struct spectral_context *sc;
 
-	psoc = wlan_pdev_get_psoc(pdev);
+	if (!pdev) {
+		spectral_err("PDEV is NULL!");
+		return -EINVAL;
+	}
+	sc = spectral_get_spectral_ctx_from_pdev(pdev);
+	if (!sc) {
+		spectral_err("spectral context is NULL!");
+		return -EINVAL;
+	}
+
+	return sc->sptrlc_process_spectral_report(pdev, payload);
+}
+#endif
 
-	/* Enable the registartion once FW supports this */
-	spectral_debug("Enable registration to direct dma once FW supports it");
+QDF_STATUS spectral_pdev_open(struct wlan_objmgr_pdev *pdev)
+{
+	QDF_STATUS status;
 
-	return status;
+	status = tgt_spectral_register_to_dbr(pdev);
+
+	return QDF_STATUS_SUCCESS;
 }

+ 28 - 2
target_if/spectral/target_if_spectral.c

@@ -1447,8 +1447,10 @@ target_if_init_spectral_ops_gen2(void)
 static void
 target_if_init_spectral_ops_gen3(void)
 {
-	/* Placeholder */
-	spectral_debug("Placeholder for gen3 spectral ops registration");
+	struct target_if_spectral_ops *p_sops = &spectral_ops;
+
+	p_sops->process_spectral_report =
+			target_if_spectral_process_report_gen3;
 	return;
 }
 
@@ -1626,6 +1628,13 @@ null_spectral_process_phyerr(struct target_if_spectral *spectral,
 	return 0;
 }
 
+static int
+null_process_spectral_report(struct wlan_objmgr_pdev *pdev,
+			     void *payload)
+{
+	spectral_ops_not_registered("process_spectral_report");
+	return 0;
+}
 /**
  * target_if_spectral_init_dummy_function_table() -
  * Initialize target_if internal
@@ -1661,6 +1670,7 @@ target_if_spectral_init_dummy_function_table(struct target_if_spectral *ps)
 	p_sops->reset_hw = null_reset_hw;
 	p_sops->get_chain_noise_floor = null_get_chain_noise_floor;
 	p_sops->spectral_process_phyerr = null_spectral_process_phyerr;
+	p_sops->process_spectral_report = null_process_spectral_report;
 }
 
 /**
@@ -1697,6 +1707,7 @@ target_if_spectral_register_funcs(struct target_if_spectral *spectral,
 	p_sops->reset_hw = p->reset_hw;
 	p_sops->get_chain_noise_floor = p->get_chain_noise_floor;
 	p_sops->spectral_process_phyerr = p->spectral_process_phyerr;
+	p_sops->process_spectral_report = p->process_spectral_report;
 }
 
 /**
@@ -2823,6 +2834,19 @@ target_if_deregister_netlink_cb(struct wlan_objmgr_pdev *pdev)
 	qdf_mem_zero(&spectral->nl_cb, sizeof(struct spectral_nl_cb));
 }
 
+static int
+target_if_process_spectral_report(struct wlan_objmgr_pdev *pdev,
+				  void *payload)
+{
+	struct target_if_spectral *spectral = NULL;
+	struct target_if_spectral_ops *p_sops = NULL;
+
+	spectral = get_target_if_spectral_handle_from_pdev(pdev);
+	p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
+
+	return p_sops->process_spectral_report(pdev, payload);
+}
+
 void
 target_if_sptrl_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 {
@@ -2858,6 +2882,8 @@ target_if_sptrl_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 	    target_if_use_nl_bcast;
 	tx_ops->sptrl_tx_ops.sptrlto_deregister_netlink_cb =
 	    target_if_deregister_netlink_cb;
+	tx_ops->sptrl_tx_ops.sptrlto_process_spectral_report =
+		target_if_process_spectral_report;
 }
 qdf_export_symbol(target_if_sptrl_register_tx_ops);
 

+ 19 - 3
target_if/spectral/target_if_spectral.h

@@ -27,8 +27,9 @@
 #include <qdf_lock.h>
 #include <wlan_spectral_public_structs.h>
 #include <reg_services_public_struct.h>
+#ifdef DIRECT_BUF_RX_ENABLE
 #include <target_if_direct_buf_rx_api.h>
-
+#endif
 #ifdef WIN32
 #pragma pack(push, target_if_spectral, 1)
 #define __ATTRIB_PACK
@@ -443,6 +444,7 @@ struct target_if_spectral_rfqual_info {
  * @reset_hw:                Reset HW
  * @get_chain_noise_floor:   Get Channel noise floor
  * @spectral_process_phyerr: Process phyerr event
+ * @process_spectral_report: Process spectral report
  */
 struct target_if_spectral_ops {
 	uint64_t (*get_tsf64)(void *arg);
@@ -474,6 +476,8 @@ struct target_if_spectral_ops {
 			struct target_if_spectral_chan_info *p_chaninfo,
 			uint64_t tsf64,
 			struct target_if_spectral_acs_stats *acs_stats);
+	int (*process_spectral_report)(struct wlan_objmgr_pdev *pdev,
+				       void *payload);
 };
 
 /**
@@ -945,9 +949,9 @@ void target_if_spectral_create_samp_msg(
  *
  * Return: Success/Failure
  */
-int target_if_spectral_process_phyerr_gen3(
+int target_if_spectral_process_report_gen3(
 	struct wlan_objmgr_pdev *pdev,
-	struct direct_buf_rx_data *payload);
+	void *buf);
 
 /**
  * target_if_process_phyerr_gen2() - Process PHY Error for gen2
@@ -1568,6 +1572,18 @@ void target_if_register_wmi_spectral_cmd_ops(
 	struct wlan_objmgr_pdev *pdev,
 	struct wmi_spectral_cmd_ops *cmd_ops);
 
+/**
+ * target_if_consume_sfft_report_gen3() -  Process fft report for gen3
+ * @spectral: Pointer to spectral object
+ * @data: Pointer to phyerror data
+ *
+ * Process fft report for gen3
+ *
+ * Return: Success/Failure
+ */
+int
+target_if_consume_spectral_report_gen3(struct target_if_spectral *spectral,
+				       uint8_t *data);
 
 #ifdef WIN32
 #pragma pack(pop, target_if_spectral)

+ 15 - 13
target_if/spectral/target_if_spectral_phyerr.c

@@ -1311,16 +1311,7 @@ target_if_verify_sig_and_tag_gen3(struct target_if_spectral *spectral,
 	return 0;
 }
 
-/**
- * target_if_consume_sfft_report_gen3() -  Process fft report for gen3
- * @spectral: Pointer to spectral object
- * @data: Pointer to phyerror data
- *
- * Process fft report for gen3
- *
- * Return: Success/Failure
- */
-static int
+int
 target_if_consume_spectral_report_gen3(
 	 struct target_if_spectral *spectral,
 	 uint8_t *data)
@@ -1581,11 +1572,13 @@ target_if_consume_spectral_report_gen3(
 	return -EPERM;
 }
 
-int target_if_spectral_process_phyerr_gen3(
+#ifdef DIRECT_BUF_RX_ENABLE
+int target_if_spectral_process_report_gen3(
 	struct wlan_objmgr_pdev *pdev,
-	struct direct_buf_rx_data *payload)
+	void *buf)
 {
 	int ret = 0;
+	struct direct_buf_rx_data *payload = buf;
 	uint8_t *data = (uint8_t *)payload->vaddr;
 	struct target_if_spectral *spectral;
 
@@ -1612,7 +1605,16 @@ int target_if_spectral_process_phyerr_gen3(
 
 	return ret;
 }
-qdf_export_symbol(target_if_spectral_process_phyerr_gen3);
+#else
+int target_if_spectral_process_report_gen3(
+	struct wlan_objmgr_pdev *pdev,
+	void *buf)
+{
+	spectral_err("Direct dma support is not enabled");
+	return -EINVAL;
+}
+#endif
+qdf_export_symbol(target_if_spectral_process_report_gen3);
 /* END of spectral GEN III HW specific functions */
 
 #endif  /* WLAN_SPECTRAL_ENABLE */

+ 4 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -337,6 +337,7 @@ struct wmi_spectral_cmd_ops;
  * @sptrlto_register_netlink_cb: Register Spectral Netlink callbacks
  * @sptrlto_use_nl_bcast: Get whether to use Netlink broadcast/unicast
  * @sptrlto_deregister_netlink_cb: De-register Spectral Netlink callbacks
+ * @sptrlto_process_spectral_report: Process spectral report
  **/
 struct wlan_lmac_if_sptrl_tx_ops {
 	void *(*sptrlto_pdev_spectral_init)(struct wlan_objmgr_pdev *pdev);
@@ -366,6 +367,9 @@ struct wlan_lmac_if_sptrl_tx_ops {
 		struct spectral_nl_cb *nl_cb);
 	bool (*sptrlto_use_nl_bcast)(struct wlan_objmgr_pdev *pdev);
 	void (*sptrlto_deregister_netlink_cb)(struct wlan_objmgr_pdev *pdev);
+	int (*sptrlto_process_spectral_report)(
+		struct wlan_objmgr_pdev *pdev,
+		void *payload);
 };
 #endif /* WLAN_CONV_SPECTRAL_ENABLE */