Преглед изворни кода

qcacld-3.0: Enable NAN datapath based on target capability

qcacld-2.0 to qcacld3.0 propagation

Configure NAN datapath capability of the driver based on
the target device capability.

CRs-Fixed: 962367
Change-Id: I99eac7ae3ae495347208e3849e2383e999dcc125
Deepak Dhamdhere пре 9 година
родитељ
комит
13230d329b

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

@@ -104,6 +104,7 @@
 #include <wlan_hdd_regulatory.h>
 #include "ol_rx_fwd.h"
 #include "wlan_hdd_lpass.h"
+#include "wlan_hdd_nan_datapath.h"
 
 #ifdef MODULE
 #define WLAN_MODULE_NAME  module_name(THIS_MODULE)
@@ -1392,6 +1393,8 @@ void hdd_update_tgt_cfg(void *context, void *param)
 		 hdd_ctx->current_antenna_mode);
 
 	hdd_ctx->bpf_enabled = cfg->bpf_enabled;
+	/* Configure NAN datapath features */
+	hdd_nan_datapath_target_config(hdd_ctx, cfg);
 }
 
 /**

+ 20 - 1
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -23,7 +23,7 @@
  *
  * WLAN Host Device Driver nan datapath API implementation
  */
-#include "wlan_hdd_includes.h"
+#include <wlan_hdd_includes.h>
 #include "wlan_hdd_nan_datapath.h"
 
 /**
@@ -41,3 +41,22 @@ void hdd_ndp_print_ini_config(hdd_context_t *hdd_ctx)
 		CFG_ENABLE_NAN_NDI_CHANNEL_NAME,
 		hdd_ctx->config->nan_datapath_ndi_channel);
 }
+
+/**
+ * hdd_nan_datapath_target_config() - Configure NAN datapath features
+ * @hdd_ctx: Pointer to HDD context
+ * @cfg: Pointer to target device capability information
+ *
+ * NaN datapath functionality is enabled if it is enabled in
+ * .ini file and also supported in target device.
+ *
+ * Return: None
+ */
+
+void hdd_nan_datapath_target_config(hdd_context_t *hdd_ctx,
+					struct wma_tgt_cfg *cfg)
+{
+	hdd_ctx->config->enable_nan_datapath &= cfg->nan_datapath_enabled;
+	hddLog(LOG1, FL("enable_nan_datapath: %d"),
+		hdd_ctx->config->enable_nan_datapath);
+}

+ 15 - 1
core/hdd/src/wlan_hdd_nan_datapath.h

@@ -28,14 +28,28 @@
 #define __WLAN_HDD_NAN_DATAPATH_H
 
 struct hdd_context_s;
+struct wma_tgt_cfg;
+struct hdd_config;
 
 #ifdef WLAN_FEATURE_NAN_DATAPATH
 void hdd_ndp_print_ini_config(struct hdd_context_s *hdd_ctx);
+void hdd_nan_datapath_enable(struct hdd_config *cfg_ini, bool enable);
+void hdd_nan_datapath_target_config(struct hdd_context_s *hdd_ctx,
+						struct wma_tgt_cfg *cfg);
+
 #else
 static inline void hdd_ndp_print_ini_config(struct hdd_context_s *hdd_ctx)
 {
 }
+static inline void hdd_nan_datapath_enable(struct hdd_config *cfg_ini,
+								bool enable)
+{
+}
+static inline void hdd_nan_datapath_target_config(struct hdd_context_s *hdd_ctx,
+						struct wma_tgt_cfg *cfg)
+{
+}
+
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
 
 #endif /* __WLAN_HDD_NAN_DATAPATH_H */
-

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

@@ -1429,6 +1429,8 @@ typedef struct {
 	uint32_t fine_time_measurement_cap;
 	struct wma_ini_config ini_config;
 	struct wma_valid_channels saved_chan;
+	/* NAN datapath support enabled in firmware */
+	bool nan_datapath_enabled;
 } t_wma_handle, *tp_wma_handle;
 
 /**

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

@@ -148,6 +148,7 @@ struct wma_dfs_radar_ind {
  * @max_intf_count: max interface count
  * @lpss_support: lpass support
  * @egap_support: enhanced green ap support
+ * @nan_datapath_enabled: nan data path support
  */
 struct wma_tgt_cfg {
 	uint32_t target_fw_version;
@@ -168,5 +169,8 @@ struct wma_tgt_cfg {
 #endif
 	uint32_t fine_time_measurement_cap;
 	bool bpf_enabled;
+#ifdef WLAN_FEATURE_NAN_DATAPATH
+	bool nan_datapath_enabled;
+#endif
 };
 #endif /* WMA_TGT_CFG_H */

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

@@ -78,6 +78,7 @@
 #include "cdp_txrx_flow_ctrl_legacy.h"
 #include "cdp_txrx_flow_ctrl_v2.h"
 #include "cdp_txrx_ipa.h"
+#include "wma_nan_datapath.h"
 
 #define WMA_LOG_COMPLETION_TIMER 10000 /* 10 seconds */
 
@@ -3912,6 +3913,7 @@ static void wma_update_hdd_cfg(tp_wma_handle wma_handle)
 	wma_setup_egap_support(&tgt_cfg, wma_handle);
 
 	wma_handle->tgt_cfg_update_cb(hdd_ctx, &tgt_cfg);
+	wma_update_hdd_cfg_ndp(wma_handle, &tgt_cfg);
 }
 
 /**
@@ -4324,6 +4326,9 @@ int wma_rx_service_ready_event(void *handle, uint8_t *cmd_param_info,
 		return -EINVAL;
 	}
 
+	wma_handle->nan_datapath_enabled =
+		WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap,
+			WMI_SERVICE_NAN_DATA);
 	qdf_mem_copy(target_cap.wmi_service_bitmap,
 		     param_buf->wmi_service_bitmap,
 		     sizeof(wma_handle->wmi_service_bitmap));

+ 27 - 0
core/wma/src/wma_nan_datapath.h

@@ -27,4 +27,31 @@
 #ifndef __WMA_NAN_DATAPATH_H
 #define __WMA_NAN_DATAPATH_H
 
+#include "wma.h"
+#include "sir_api.h"
+
+#ifdef WLAN_FEATURE_NAN_DATAPATH
+
+/**
+ * wma_update_hdd_cfg_ndp() - Update target device NAN datapath capability
+ * @wma_handle: pointer to WMA context
+ * @tgt_cfg: Pointer to target configuration data structure
+ *
+ * Return: none
+ */
+static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
+					struct wma_tgt_cfg *tgt_cfg)
+{
+	tgt_cfg->nan_datapath_enabled = wma_handle->nan_datapath_enabled;
+}
+
+#else
+static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
+					struct wma_tgt_cfg *tgt_cfg)
+{
+	return;
+}
+
+#endif
+
 #endif /* __WMA_NAN_DATAPATH_H */