Browse Source

qcacmn: Do not allocate DFS object for 2GHz radio

DFS is applicable only for 5GHz radio. Therefore, do not
allocate DFS object for 2GHz  radio.

Change-Id: I5e8aec0c876e7862890fae689950bfbb4eae5255
CRs-Fixed: 2153493
Shashikala Prabhu 7 years ago
parent
commit
153b2881cf

+ 24 - 0
target_if/dfs/src/target_if_dfs.c

@@ -229,6 +229,29 @@ static QDF_STATUS target_process_bang_radar_cmd(
 	return status;
 }
 
+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;
+}
+
 QDF_STATUS target_if_register_dfs_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 {
 	struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
@@ -243,6 +266,7 @@ QDF_STATUS target_if_register_dfs_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
 
 	dfs_tx_ops->dfs_process_emulate_bang_radar_cmd =
 						&target_process_bang_radar_cmd;
+	dfs_tx_ops->dfs_is_pdev_5ghz = &target_if_dfs_is_pdev_5ghz;
 
 	return QDF_STATUS_SUCCESS;
 }

+ 9 - 0
umac/dfs/core/src/dfs.h

@@ -2036,4 +2036,13 @@ void dfs_send_csa_to_current_chan(struct wlan_dfs *dfs);
  */
 int dfs_radarevent_basic_sanity(struct wlan_dfs *dfs,
 		struct dfs_channel *chan);
+
+/**
+ * wlan_psoc_get_dfs_txops() - Get dfs_tx_ops pointer
+ * @psoc: Pointer to psoc structure.
+ *
+ * Return: Pointer to dfs_tx_ops.
+ */
+struct wlan_lmac_if_dfs_tx_ops *
+wlan_psoc_get_dfs_txops(struct wlan_objmgr_psoc *psoc);
 #endif  /* _DFS_H_ */

+ 30 - 5
umac/dfs/dispatcher/src/wlan_dfs_init_deinit_api.c

@@ -146,12 +146,42 @@ QDF_STATUS wlan_dfs_pdev_obj_create_notification(struct wlan_objmgr_pdev *pdev,
 {
 	struct wlan_dfs *dfs = NULL;
 	struct wlan_objmgr_psoc *psoc;
+	struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
+	uint8_t pdev_id;
+	QDF_STATUS status;
+	bool is_5ghz = false;
 
 	if (!pdev) {
 		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "null pdev");
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	psoc = wlan_pdev_get_psoc(pdev);
+	if (!psoc) {
+		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "null psoc");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	dfs_tx_ops = wlan_psoc_get_dfs_txops(psoc);
+	if (!(dfs_tx_ops && dfs_tx_ops->dfs_is_pdev_5ghz)) {
+		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "dfs_tx_ops is null");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	status = dfs_tx_ops->dfs_is_pdev_5ghz(pdev, &is_5ghz);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "Failed to get is_5ghz value");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!is_5ghz) {
+		pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+		dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
+				"Do not allocate DFS object for 2G, pdev_id = %d",
+				pdev_id);
+		return QDF_STATUS_SUCCESS;
+	}
+
 	if (dfs_create_object(&dfs) == 1) {
 		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "failed to create object");
 		return QDF_STATUS_E_FAILURE;
@@ -160,11 +190,6 @@ 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;
-	psoc = wlan_pdev_get_psoc(pdev);
-	if (!psoc) {
-		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,  "null psoc");
-		return QDF_STATUS_E_FAILURE;
-	}
 	dfs->dfs_is_offload_enabled =
 		DFS_OFFLOAD_IS_ENABLED(psoc->service_param.service_bitmap);
 	dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,

+ 1 - 1
umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c

@@ -30,7 +30,7 @@
 #include "../../core/src/dfs_zero_cac.h"
 #include "../../core/src/dfs_process_radar_found_ind.h"
 
-static inline struct wlan_lmac_if_dfs_tx_ops *
+struct wlan_lmac_if_dfs_tx_ops *
 wlan_psoc_get_dfs_txops(struct wlan_objmgr_psoc *psoc)
 {
 	return &((psoc->soc_cb.tx_ops.dfs_tx_ops));

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

@@ -467,6 +467,7 @@ struct wlan_lmac_if_reg_tx_ops {
  * @dfs_get_phymode_info:               Get phymode info.
  * @dfs_reg_ev_handler:                 Register dfs event handler.
  * @dfs_process_emulate_bang_radar_cmd: Process emulate bang radar test command.
+ * @dfs_is_pdev_5ghz:                   Check if the given pdev is 5GHz.
  */
 
 struct wlan_lmac_if_dfs_tx_ops {
@@ -499,6 +500,8 @@ struct wlan_lmac_if_dfs_tx_ops {
 	QDF_STATUS (*dfs_process_emulate_bang_radar_cmd)(
 			struct wlan_objmgr_pdev *pdev,
 			struct dfs_emulate_bang_radar_test_cmd *dfs_unit_test);
+	QDF_STATUS (*dfs_is_pdev_5ghz)(struct wlan_objmgr_pdev *pdev,
+			bool *is_5ghz);
 };
 
 /**