Переглянути джерело

qcacmn: Add target_if changes to DFS

Use target_if APIs to get dfs offload capability

Change-Id: Ic23770b0407e33e4b031bbbc4a8224663ac57e32
CRs-Fixed: 2177109
Srinivas Pitla 7 роки тому
батько
коміт
ee54aea6d8

+ 20 - 29
target_if/dfs/src/target_if_dfs.c

@@ -35,6 +35,8 @@
 #include <wmi_unified_dfs_api.h>
 #include "wlan_dfs_tgt_api.h"
 #include "target_type.h"
+#include <init_deinit_ucfg.h>
+#include <wlan_reg_ucfg_api.h>
 
 static inline struct wlan_lmac_if_dfs_rx_ops *
 target_if_dfs_get_rx_ops(struct wlan_objmgr_psoc *psoc)
@@ -314,14 +316,15 @@ static QDF_STATUS target_if_dfs_register_event_handler(
 			target_if_err("null tgt_psoc_info");
 			return QDF_STATUS_E_FAILURE;
 		}
-		if (target_if_is_dfs_3(tgt_psoc_info->target_type))
+		if (target_if_is_dfs_3(
+				target_psoc_get_target_type(tgt_psoc_info)))
 			return target_if_dfs_reg_phyerr_events(psoc);
 		else
 			return target_if_reg_phyerr_events_dfs2(psoc, pdev);
 	}
 
 	/* dfs offload case, send offload enable command first */
-	wmi_handle = GET_WMI_HDL_FROM_PDEV(pdev);
+	wmi_handle = ucfg_get_pdev_wmi_handle(pdev);
 	status = wmi_unified_dfs_phyerr_offload_en_cmd(wmi_handle,
 			WMI_HOST_PDEV_ID_SOC);
 	if (QDF_IS_STATUS_SUCCESS(status))
@@ -339,7 +342,7 @@ static QDF_STATUS target_process_bang_radar_cmd(
 	int i;
 	wmi_unified_t wmi_handle;
 
-	wmi_handle = (wmi_unified_t) GET_WMI_HDL_FROM_PDEV(pdev);
+	wmi_handle = (wmi_unified_t)ucfg_get_pdev_wmi_handle(pdev);
 
 	wmi_utest.vdev_id = dfs_unit_test->vdev_id;
 	wmi_utest.module_id = WLAN_MODULE_PHYERR_DFS;
@@ -361,18 +364,28 @@ static QDF_STATUS target_process_bang_radar_cmd(
 	return status;
 }
 
-#ifdef QCA_MCL_DFS_SUPPORT
 static QDF_STATUS target_if_dfs_is_pdev_5ghz(struct wlan_objmgr_pdev *pdev,
 		bool *is_5ghz)
 {
 	struct wlan_objmgr_psoc *psoc;
+	uint8_t pdev_id;
+	struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap_ptr;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 	if (!psoc) {
 		target_if_err("dfs: null psoc");
 		return QDF_STATUS_E_FAILURE;
 	}
-	if (psoc->service_param.hal_reg_cap.wireless_modes &
+
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+
+	reg_cap_ptr = ucfg_reg_get_hal_reg_cap(psoc);
+	if (!reg_cap_ptr) {
+		target_if_err("dfs: reg cap null");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (reg_cap_ptr[pdev_id].wireless_modes &
 			WMI_HOST_REGDMN_MODE_11A)
 		*is_5ghz = true;
 	else
@@ -381,6 +394,7 @@ static QDF_STATUS target_if_dfs_is_pdev_5ghz(struct wlan_objmgr_pdev *pdev,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef QCA_MCL_DFS_SUPPORT
 /**
  * target_if_dfs_set_phyerr_filter_offload() - config phyerr filter offload.
  * @pdev: Pointer to DFS pdev object.
@@ -416,29 +430,6 @@ static QDF_STATUS target_if_dfs_set_phyerr_filter_offload(
 	return QDF_STATUS_SUCCESS;
 }
 #else
-static QDF_STATUS target_if_dfs_is_pdev_5ghz(struct wlan_objmgr_pdev *pdev,
-		bool *is_5ghz)
-{
-	struct wlan_objmgr_psoc *psoc;
-	uint8_t pdev_id;
-
-	psoc = wlan_pdev_get_psoc(pdev);
-	if (!psoc) {
-		target_if_err("dfs: null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
-
-	if (psoc->ext_service_param.reg_cap[pdev_id].wireless_modes &
-			WMI_HOST_REGDMN_MODE_11A)
-		*is_5ghz = true;
-	else
-		*is_5ghz = false;
-
-	return QDF_STATUS_SUCCESS;
-}
-
 static QDF_STATUS target_if_dfs_set_phyerr_filter_offload(
 					struct wlan_objmgr_pdev *pdev,
 					bool dfs_phyerr_filter_offload)
@@ -487,7 +478,7 @@ static QDF_STATUS target_if_dfs_get_caps(struct wlan_objmgr_pdev *pdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	switch (tgt_psoc_info->target_type) {
+	switch (target_psoc_get_target_type(tgt_psoc_info)) {
 	case TARGET_TYPE_AR900B:
 		break;
 

+ 9 - 1
umac/dfs/dispatcher/inc/wlan_dfs_lmac_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -83,6 +83,14 @@ bool lmac_is_mode_offload(struct wlan_objmgr_pdev *pdev);
  */
 uint16_t lmac_get_ah_devid(struct wlan_objmgr_pdev *pdev);
 
+/**
+ * lmac_is_mode_dfs_offload() - Check the DFS offload is enabled.
+ * @psoc: Pointer to PSOC structure.
+ *
+ * returns true if DFS offload is enabled, otherwise returns false
+ */
+bool lmac_is_mode_dfs_offload(struct wlan_objmgr_psoc *psoc);
+
 /**
  * lmac_get_ext_busy() - Get ext_busy.
  * @pdev: Pointer to PDEV structure.

+ 1 - 7
umac/dfs/dispatcher/inc/wlan_dfs_utils_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -73,13 +73,7 @@
 /* WLAN 5GHz channel number 170 freq */
 #define DFS_CHAN_170_FREQ        (5852)
 
-/* dfs offload service bit */
-#define DFS_SERVICE_PHYERR_OFFLOAD 113
 
-/* check if dfs offload enabled */
-#define DFS_OFFLOAD_IS_ENABLED(service_bitmap) \
-	(((service_bitmap)[(DFS_SERVICE_PHYERR_OFFLOAD)/(sizeof(A_UINT32))] & \
-	   (1 << ((DFS_SERVICE_PHYERR_OFFLOAD)%(sizeof(A_UINT32))))) != 0)
 
 extern struct dfs_to_mlme global_dfs_to_mlme;
 

+ 7 - 6
umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c

@@ -29,6 +29,7 @@
 #endif
 #include "wlan_objmgr_global_obj.h"
 #include "wlan_dfs_init_deinit_api.h"
+#include "wlan_dfs_lmac_api.h"
 #include "../../core/src/dfs.h"
 #include "a_types.h"
 #include "wlan_serialization_api.h"
@@ -333,10 +334,10 @@ QDF_STATUS wlan_dfs_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
 	global_dfs_to_mlme.pdev_component_obj_attach(pdev,
 		WLAN_UMAC_COMP_DFS, (void *)dfs, QDF_STATUS_SUCCESS);
 	dfs->dfs_pdev_obj = pdev;
-	dfs->dfs_is_offload_enabled =
-		DFS_OFFLOAD_IS_ENABLED(psoc->service_param.service_bitmap);
-	dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
-			"dfs_offload %d", dfs->dfs_is_offload_enabled);
+	dfs->dfs_is_offload_enabled = lmac_is_mode_dfs_offload(psoc);
+	dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs_offload %d",
+			dfs->dfs_is_offload_enabled);
+
 	dfs = wlan_pdev_get_dfs_obj(pdev);
 	if (dfs_attach(dfs) == 1) {
 		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "dfs_attch failed");
@@ -412,9 +413,9 @@ static void dfs_scan_serialization_comp_info_cb(
 QDF_STATUS wifi_dfs_psoc_enable(struct wlan_objmgr_psoc *psoc)
 {
 	QDF_STATUS status;
-	bool dfs_offload =
-		DFS_OFFLOAD_IS_ENABLED(psoc->service_param.service_bitmap);
+	bool dfs_offload;
 
+	dfs_offload = lmac_is_mode_dfs_offload(psoc);
 	dfs_info(NULL, WLAN_DEBUG_DFS_ALWAYS, "dfs_offload %d", dfs_offload);
 
 	status = tgt_dfs_reg_ev_handler(psoc, dfs_offload);

+ 14 - 1
umac/dfs/dispatcher/src/wlan_dfs_lmac_api.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
  *
  *
  * Permission to use, copy, modify, and/or distribute this software for
@@ -133,6 +133,19 @@ uint16_t lmac_get_ah_devid(struct wlan_objmgr_pdev *pdev)
 	return devid;
 }
 
+bool lmac_is_mode_dfs_offload(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
+	bool is_offload = false;
+
+	dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops;
+
+	if (dfs_tx_ops->dfs_is_tgt_offload)
+		dfs_tx_ops->dfs_is_tgt_offload(psoc, &is_offload);
+
+	return is_offload;
+}
+
 uint32_t lmac_get_ext_busy(struct wlan_objmgr_pdev *pdev)
 {
 	struct wlan_objmgr_psoc *psoc;

+ 17 - 8
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -413,17 +413,17 @@ struct sta_uapsd_trig_params;
  * tdls module uses these functions to avail ol/da lmac services
  */
 struct wlan_lmac_if_tdls_tx_ops {
-	QDF_STATUS(*update_fw_state)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*update_fw_state)(struct wlan_objmgr_psoc *psoc,
 				     struct tdls_info *req);
-	QDF_STATUS(*update_peer_state)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*update_peer_state)(struct wlan_objmgr_psoc *psoc,
 				       struct tdls_peer_update_state *param);
-	QDF_STATUS(*set_offchan_mode)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*set_offchan_mode)(struct wlan_objmgr_psoc *psoc,
 				      struct tdls_channel_switch_params *param);
-	QDF_STATUS(*tdls_reg_ev_handler)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*tdls_reg_ev_handler)(struct wlan_objmgr_psoc *psoc,
 					 void *arg);
-	QDF_STATUS(*tdls_unreg_ev_handler) (struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*tdls_unreg_ev_handler) (struct wlan_objmgr_psoc *psoc,
 					    void *arg);
-	QDF_STATUS(*tdls_set_uapsd)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*tdls_set_uapsd)(struct wlan_objmgr_psoc *psoc,
 				    struct sta_uapsd_trig_params *params);
 };
 
@@ -436,7 +436,7 @@ struct tdls_event_info;
  * lmac modules uses this API to post scan events to tdls module
  */
 struct wlan_lmac_if_tdls_rx_ops {
-	QDF_STATUS(*tdls_ev_handler)(struct wlan_objmgr_psoc *psoc,
+	QDF_STATUS (*tdls_ev_handler)(struct wlan_objmgr_psoc *psoc,
 				     struct tdls_event_info *info);
 };
 #endif
@@ -558,6 +558,8 @@ struct wlan_lmac_if_dfs_tx_ops {
 	QDF_STATUS (*dfs_set_phyerr_filter_offload)(
 			struct wlan_objmgr_pdev *pdev,
 			bool dfs_phyerr_filter_offload);
+	QDF_STATUS (*dfs_is_tgt_offload)(struct wlan_objmgr_psoc *psoc,
+			bool *is_tgt_offload);
 };
 
 /**
@@ -567,12 +569,18 @@ struct wlan_lmac_if_dfs_tx_ops {
  * @tgt_is_tgt_type_ipq4019: To check IPQ4019 target type.
  * @tgt_is_tgt_type_qca9984: To check QCA9984 target type.
  * @tgt_is_tgt_type_qca9888: To check QCA9888 target type.
+ * @tgt_get_tgt_type:        Get target type
+ * @tgt_get_tgt_version:     Get target version
+ * @tgt_get_tgt_revision:    Get target revision
  */
 struct wlan_lmac_if_target_tx_ops {
 	bool (*tgt_is_tgt_type_ar900b)(uint32_t);
 	bool (*tgt_is_tgt_type_ipq4019)(uint32_t);
 	bool (*tgt_is_tgt_type_qca9984)(uint32_t);
 	bool (*tgt_is_tgt_type_qca9888)(uint32_t);
+	uint32_t (*tgt_get_tgt_type)(struct wlan_objmgr_psoc *psoc);
+	uint32_t (*tgt_get_tgt_version)(struct wlan_objmgr_psoc *psoc);
+	uint32_t (*tgt_get_tgt_revision)(struct wlan_objmgr_psoc *psoc);
 };
 
 #ifdef WLAN_OFFCHAN_TXRX_ENABLE
@@ -992,7 +1000,8 @@ struct wlan_lmac_if_dfs_rx_ops {
 			int *error);
 	QDF_STATUS (*dfs_is_precac_timer_running)(struct wlan_objmgr_pdev *pdev,
 			bool *is_precac_timer_running);
-	QDF_STATUS (*dfs_find_vht80_chan_for_precac)(struct wlan_objmgr_pdev *pdev,
+	QDF_STATUS (*dfs_find_vht80_chan_for_precac)(
+			struct wlan_objmgr_pdev *pdev,
 			uint32_t chan_mode,
 			uint8_t ch_freq_seg1,
 			uint32_t *cfreq1,