Bladeren bron

qcacld-3.0: Store the NAN target caps inside its private obj

Host will receive the NAN related service capabilities from
the SERVICE_AVAILABLE event. In the HDD callback that gets
called afterwards, set the NAN related capabilities into
the NAN's private PSOC object.

Store the NAN target capabilities inside its private object.

Change-Id: If398b6f253613fc424b7821cfc62b0984ad34b6c
CRs-Fixed: 2356709
Nachiket Kukade 6 jaren geleden
bovenliggende
commit
85aa3788b6

+ 16 - 2
components/nan/core/inc/nan_public_structs.h

@@ -20,7 +20,6 @@
  * DOC: contains nan definitions exposed to other modules
  */
 
-#ifdef WLAN_FEATURE_NAN_CONVERGENCE
 #ifndef _NAN_PUBLIC_STRUCTS_H_
 #define _NAN_PUBLIC_STRUCTS_H_
 
@@ -705,5 +704,20 @@ struct wlan_nan_rx_ops {
 	QDF_STATUS (*nan_event_rx)(struct scheduler_msg *event);
 };
 
+/**
+ * struct nan_tgt_caps - NAN Target capabilities
+ * @nan_disable_supported: Target supports disabling NAN Discovery
+ * @nan_dbs_supported: Target supports NAN Discovery with DBS
+ * @ndi_dbs_supported: Target supports NAN Datapath with DBS
+ * @nan_sap_supported: Target supports NAN Discovery with SAP concurrency
+ * @ndi_sap_supported: Target supports NAN Datapth with SAP concurrency
+ */
+struct nan_tgt_caps {
+	uint32_t nan_disable_supported:1;
+	uint32_t nan_dbs_supported:1;
+	uint32_t ndi_dbs_supported:1;
+	uint32_t nan_sap_supported:1;
+	uint32_t ndi_sap_supported:1;
+};
+
 #endif
-#endif /* WLAN_FEATURE_NAN_CONVERGENCE */

+ 5 - 0
components/nan/core/src/nan_main_i.h

@@ -84,11 +84,16 @@ struct nan_cfg_params {
  * struct nan_psoc_priv_obj - nan private psoc obj
  * @lock: lock to be acquired before reading or writing to object
  * @cb_obj: struct contaning callback pointers
+ * @cfg_param: NAN Config parameters in INI
+ * @nan_caps: NAN Target capabilities
+ * @tx_ops: NAN Tx operations
+ * @rx_ops: NAN Rx operations
  */
 struct nan_psoc_priv_obj {
 	qdf_spinlock_t lock;
 	struct nan_callbacks cb_obj;
 	struct nan_cfg_params cfg_param;
+	struct nan_tgt_caps nan_caps;
 	struct wlan_nan_tx_ops tx_ops;
 	struct wlan_nan_rx_ops rx_ops;
 };

+ 21 - 4
components/nan/dispatcher/inc/nan_ucfg_api.h

@@ -26,6 +26,7 @@
 #include "wlan_objmgr_cmn.h"
 #include "nan_public_structs.h"
 
+#ifdef WLAN_FEATURE_NAN
 /**
  * ucfg_nan_set_ndi_state: set ndi state
  * @vdev: pointer to vdev object
@@ -248,10 +249,7 @@ static inline QDF_STATUS ucfg_nan_discovery_req(void *in_req, uint32_t req_type)
  *
  * Return: True if NAN DBS is supported, False otherwise
  */
-static inline bool ucfg_is_nan_dbs_supported(struct wlan_objmgr_psoc *psoc)
-{
-	return true;
-}
+bool ucfg_is_nan_dbs_supported(struct wlan_objmgr_psoc *psoc);
 
 /**
  * ucfg_is_nan_enable_allowed() - ucfg API to query if NAN Discovery is
@@ -264,4 +262,23 @@ static inline bool ucfg_is_nan_enable_allowed(struct wlan_objmgr_psoc *psoc)
 {
 	return true;
 }
+
+/**
+ * ucfg_nan_set_tgt_caps: ucfg API to set the NAN capabilities of the Target
+ * @psoc: pointer to psoc object
+ * @nan_caps: pointer to the structure of NAN capability bits
+ *
+ * Return: status of operation
+ */
+void ucfg_nan_set_tgt_caps(struct wlan_objmgr_psoc *psoc,
+			   struct nan_tgt_caps *nan_caps);
+
+#else /* WLAN_FEATURE_NAN */
+
+static inline
+void ucfg_nan_set_tgt_caps(struct wlan_objmgr_psoc *psoc,
+			   struct nan_tgt_caps *nan_caps)
+{
+}
+#endif /* WLAN_FEATURE_NAN */
 #endif /* _NAN_UCFG_API_H_ */

+ 26 - 0
components/nan/dispatcher/src/nan_ucfg_api.c

@@ -445,3 +445,29 @@ int ucfg_nan_register_lim_callbacks(struct wlan_objmgr_psoc *psoc,
 
 	return 0;
 }
+
+void ucfg_nan_set_tgt_caps(struct wlan_objmgr_psoc *psoc,
+			   struct nan_tgt_caps *nan_caps)
+{
+	struct nan_psoc_priv_obj *psoc_priv = nan_get_psoc_priv_obj(psoc);
+
+	if (!psoc_priv) {
+		nan_err("nan psoc priv object is NULL");
+		return;
+	}
+
+	psoc_priv->nan_caps = *nan_caps;
+}
+
+bool ucfg_is_nan_dbs_supported(struct wlan_objmgr_psoc *psoc)
+{
+	struct nan_psoc_priv_obj *psoc_priv;
+
+	psoc_priv = nan_get_psoc_priv_obj(psoc);
+	if (!psoc_priv) {
+		nan_err("nan psoc priv object is NULL");
+		return false;
+	}
+
+	return (psoc_priv->nan_caps.nan_dbs_supported == 1);
+}

+ 2 - 0
core/hdd/src/wlan_hdd_main.c

@@ -126,6 +126,7 @@
 #include "wlan_hdd_he.h"
 #include "os_if_nan.h"
 #include "nan_public_structs.h"
+#include "nan_ucfg_api.h"
 #include "wlan_reg_ucfg_api.h"
 #include "wlan_dfs_ucfg_api.h"
 #include "wlan_hdd_rx_monitor.h"
@@ -2119,6 +2120,7 @@ void hdd_update_tgt_cfg(hdd_handle_t hdd_handle, struct wma_tgt_cfg *cfg)
 
 	/* Configure NAN datapath features */
 	hdd_nan_datapath_target_config(hdd_ctx, cfg);
+	ucfg_nan_set_tgt_caps(hdd_ctx->psoc, &cfg->nan_caps);
 	hdd_ctx->dfs_cac_offload = cfg->dfs_cac_offload;
 	hdd_ctx->lte_coex_ant_share = cfg->services.lte_coex_ant_share;
 	hdd_ctx->obss_scan_offload = cfg->services.obss_scan_offload;

+ 2 - 0
core/wma/inc/wma_tgt_cfg.h

@@ -20,6 +20,7 @@
 #define WMA_TGT_CFG_H
 
 #include "wma_sar_public_structs.h"
+#include "nan_public_structs.h"
 
 /**
  * struct wma_tgt_services - target services
@@ -225,5 +226,6 @@ struct wma_tgt_cfg {
 	uint32_t hw_bd_id;
 	struct board_info hw_bd_info;
 	enum sar_version sar_version;
+	struct nan_tgt_caps nan_caps;
 };
 #endif /* WMA_TGT_CFG_H */

+ 32 - 0
core/wma/src/wma_main.c

@@ -5539,6 +5539,37 @@ static void wma_green_ap_register_handlers(tp_wma_handle wma_handle)
 }
 #endif
 
+#ifdef WLAN_FEATURE_NAN
+static void wma_update_nan_target_caps(tp_wma_handle wma_handle,
+				       struct wma_tgt_cfg *tgt_cfg)
+{
+	if (wmi_service_enabled(wma_handle->wmi_handle,
+				wmi_service_nan_disable_support))
+		tgt_cfg->nan_caps.nan_disable_supported = 1;
+
+	if (wmi_service_enabled(wma_handle->wmi_handle,
+				wmi_service_nan_dbs_support))
+		tgt_cfg->nan_caps.nan_dbs_supported = 1;
+
+	if (wmi_service_enabled(wma_handle->wmi_handle,
+				wmi_service_ndi_dbs_support))
+		tgt_cfg->nan_caps.ndi_dbs_supported = 1;
+
+	if (wmi_service_enabled(wma_handle->wmi_handle,
+				wmi_service_nan_sap_support))
+		tgt_cfg->nan_caps.nan_sap_supported = 1;
+
+	if (wmi_service_enabled(wma_handle->wmi_handle,
+				wmi_service_ndi_sap_support))
+		tgt_cfg->nan_caps.ndi_sap_supported = 1;
+}
+#else
+static void wma_update_nan_target_caps(tp_wma_handle wma_handle,
+				       struct wma_tgt_cfg *tgt_cfg)
+{
+}
+#endif
+
 /**
  * wma_update_hdd_cfg() - update HDD config
  * @wma_handle: wma handle
@@ -5632,6 +5663,7 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle)
 	wma_update_obss_detection_support(wma_handle, &tgt_cfg);
 	wma_update_obss_color_collision_support(wma_handle, &tgt_cfg);
 	wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg);
+	wma_update_nan_target_caps(wma_handle, &tgt_cfg);
 	wma_handle->tgt_cfg_update_cb(hdd_ctx, &tgt_cfg);
 	target_if_store_pdev_target_if_ctx(wma_get_pdev_from_scn_handle);
 	target_pdev_set_wmi_handle(wma_handle->pdev->tgt_if_handle,