Browse Source

qcacld-3.0: Implementation of NDI Create/Delete

Add MCL changes for NDI create and NDI delete commands.

Change-Id: I270cd213d89224f73ff2ce9fad784cec3e0f8fa3
CRs-Fixed: 2014795
Naveen Rawat 8 years ago
parent
commit
cb5c540e7f

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

@@ -117,6 +117,8 @@
 #include "wifi_pos_api.h"
 #include "wlan_hdd_oemdata.h"
 #include "wlan_hdd_he.h"
+#include "os_if_nan.h"
+#include "nan_public_structs.h"
 
 #ifdef CNSS_GENL
 #include <net/cnss_nl.h>
@@ -1925,6 +1927,26 @@ static void hdd_register_policy_manager_callback(
 }
 #endif
 
+#ifdef WLAN_FEATURE_NAN_CONVERGENCE
+static void hdd_nan_register_callbacks(hdd_context_t *hdd_ctx)
+{
+	struct nan_callbacks cb_obj = {0};
+
+	cb_obj.ndi_open = hdd_ndi_open;
+	cb_obj.ndi_close = hdd_ndi_close;
+	cb_obj.ndi_start = hdd_ndi_start;
+	cb_obj.ndi_delete = hdd_ndi_delete;
+	cb_obj.drv_ndi_create_rsp_handler = hdd_ndi_drv_ndi_create_rsp_handler;
+	cb_obj.drv_ndi_delete_rsp_handler = hdd_ndi_drv_ndi_delete_rsp_handler;
+
+	os_if_nan_register_hdd_callbacks(hdd_ctx->hdd_psoc, &cb_obj);
+}
+#else
+static void hdd_nan_register_callbacks(hdd_context_t *hdd_ctx)
+{
+}
+#endif
+
 /**
  * hdd_wlan_start_modules() - Single driver state machine for starting modules
  * @hdd_ctx: HDD context
@@ -2031,6 +2053,13 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
 			goto close;
 		}
 
+		/*
+		 * NAN compoenet requires certian operations like, open adapter,
+		 * close adapter, etc. to be initiated by HDD, for those
+		 * register HDD callbacks with UMAC's NAN componenet.
+		 */
+		hdd_nan_register_callbacks(hdd_ctx);
+
 		hdd_ctx->hHal = cds_get_context(QDF_MODULE_ID_SME);
 
 		status = cds_pre_enable(hdd_ctx->pcds_context);

+ 203 - 3
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -36,6 +36,8 @@
 #include "wlan_hdd_object_manager.h"
 #include <qca_vendor.h>
 #include "os_if_nan.h"
+#include "wlan_nan_api.h"
+#include "nan_public_structs.h"
 
 #ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /* NLA policy */
@@ -103,7 +105,10 @@ void hdd_nan_datapath_target_config(hdd_context_t *hdd_ctx,
 	hdd_ctx->nan_datapath_enabled =
 		hdd_ctx->config->enable_nan_datapath &&
 			cfg->nan_datapath_enabled;
-	hdd_info("enable_nan_datapath: %d", hdd_ctx->nan_datapath_enabled);
+	hdd_info("enable_nan_datapath: final: %d, host: %d, fw: %d",
+		hdd_ctx->nan_datapath_enabled,
+		hdd_ctx->config->enable_nan_datapath,
+		cfg->nan_datapath_enabled);
 }
 
 /**
@@ -1820,6 +1825,35 @@ void hdd_ndp_event_handler(hdd_adapter_t *adapter,
 	tCsrRoamInfo *roam_info, uint32_t roam_id, eRoamCmdStatus roam_status,
 	eCsrRoamResult roam_result)
 {
+	bool success;
+	struct wlan_objmgr_psoc *psoc = wlan_vdev_get_psoc(adapter->hdd_vdev);
+
+	if (roam_status == eCSR_ROAM_NDP_STATUS_UPDATE) {
+		switch (roam_result) {
+		case eCSR_ROAM_RESULT_NDI_CREATE_RSP:
+			success = (roam_info->ndp.ndi_create_params.status ==
+					NAN_DATAPATH_RSP_STATUS_SUCCESS);
+			hdd_debug("posting ndi create status: %d to umac",
+				success);
+			os_if_nan_post_ndi_create_rsp(psoc, adapter->sessionId,
+							success);
+			return;
+		case eCSR_ROAM_RESULT_NDI_DELETE_RSP:
+			success = (roam_info->ndp.ndi_create_params.status ==
+					NAN_DATAPATH_RSP_STATUS_SUCCESS);
+			hdd_debug("posting ndi delete status: %d to umac",
+				success);
+			os_if_nan_post_ndi_delete_rsp(psoc, adapter->sessionId,
+							success);
+			return;
+		default:
+			hdd_err("in correct roam_result: %d", roam_result);
+			return;
+		}
+	} else {
+		hdd_err("in correct roam_status: %d", roam_status);
+		return;
+	}
 }
 #endif
 
@@ -1976,6 +2010,21 @@ int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
 	return ret;
 }
 
+#ifndef WLAN_FEATURE_NAN_CONVERGENCE
+static int update_ndi_state(struct hdd_adapter_s *adapter, uint32_t state)
+{
+	struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
+
+	ndp_ctx->state = state;
+	return 0;
+}
+#else
+static int update_ndi_state(struct hdd_adapter_s *adapter, uint32_t state)
+{
+	return os_if_nan_set_ndi_state(adapter->hdd_vdev, state);
+}
+#endif
+
 /**
  * hdd_init_nan_data_mode() - initialize nan data mode
  * @adapter: adapter context
@@ -1985,7 +2034,6 @@ int wlan_hdd_cfg80211_process_ndp_cmd(struct wiphy *wiphy,
 int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter)
 {
 	struct net_device *wlan_dev = adapter->dev;
-	struct nan_datapath_ctx *ndp_ctx = WLAN_HDD_GET_NDP_CTX_PTR(adapter);
 	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
 	QDF_STATUS status;
 	int32_t ret_val = 0;
@@ -2033,7 +2081,7 @@ int hdd_init_nan_data_mode(struct hdd_adapter_s *adapter)
 		hdd_err("WMI_PDEV_PARAM_BURST_ENABLE set failed %d", ret_val);
 	}
 
-	ndp_ctx->state = NAN_DATA_NDI_CREATING_STATE;
+	update_ndi_state(adapter, NAN_DATA_NDI_CREATING_STATE);
 	return ret_val;
 
 error_wmm_init:
@@ -2048,3 +2096,155 @@ error_register_wext:
 
 	return ret_val;
 }
+
+#ifdef WLAN_FEATURE_NAN_CONVERGENCE
+struct wlan_objmgr_vdev *hdd_ndi_open(char *iface_name)
+{
+	hdd_adapter_t *adapter;
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	ENTER();
+	/* Check for an existing interface of NDI type */
+	adapter = hdd_get_adapter(hdd_ctx, QDF_NDI_MODE);
+	if (adapter) {
+		hdd_err("Cannot support more than one NDI");
+		return NULL;
+	}
+
+	adapter = hdd_open_adapter(hdd_ctx, QDF_NDI_MODE, iface_name,
+			wlan_hdd_get_intf_addr(hdd_ctx), NET_NAME_UNKNOWN,
+			true);
+	if (!adapter) {
+		hdd_err("hdd_open_adapter failed");
+		return NULL;
+	}
+
+	EXIT();
+	return adapter->hdd_vdev;
+}
+
+int hdd_ndi_start(uint8_t vdev_id)
+{
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	uint8_t op_channel = hdd_ctx->config->nan_datapath_ndi_channel;
+	hdd_adapter_t *adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+
+	ENTER();
+	/*
+	 * The NAN data interface has been created at this point.
+	 * Unlike traditional device modes, where the higher application
+	 * layer initiates connect / join / start, the NAN data
+	 * interface does not have any such formal requests. The NDI
+	 * create request is responsible for starting the BSS as well.
+	 */
+	if (op_channel != NAN_SOCIAL_CHANNEL_2_4GHZ ||
+		op_channel != NAN_SOCIAL_CHANNEL_5GHZ_LOWER_BAND ||
+		op_channel != NAN_SOCIAL_CHANNEL_5GHZ_UPPER_BAND) {
+		/* start NDI on the default 2.4 GHz social channel */
+		op_channel = NAN_SOCIAL_CHANNEL_2_4GHZ;
+	}
+	if (hdd_ndi_start_bss(adapter, op_channel)) {
+		hdd_err("NDI start bss failed");
+		/* Start BSS failed, delete the interface */
+		hdd_close_ndi(adapter);
+		EXIT();
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+int hdd_ndi_delete(uint8_t vdev_id, char *iface_name, uint16_t transaction_id)
+{
+	int ret;
+	hdd_adapter_t *adapter;
+	hdd_station_ctx_t *sta_ctx;
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+
+	/* Check if there is already an existing inteface with the same name */
+	adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	if (!adapter || !WLAN_HDD_IS_NDI(adapter)) {
+		hdd_err("NAN data interface %s is not available", iface_name);
+		return -EINVAL;
+	}
+
+	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	if (!sta_ctx) {
+		hdd_err("sta_ctx is NULL");
+		return -EINVAL;
+	}
+
+	/* Since, the interface is being deleted, remove the broadcast id. */
+	hdd_ctx->sta_to_adapter[sta_ctx->broadcast_staid] = 0;
+	sta_ctx->broadcast_staid = HDD_WLAN_INVALID_STA_ID;
+
+	os_if_nan_set_ndp_delete_transaction_id(adapter->hdd_vdev,
+						transaction_id);
+	os_if_nan_set_ndi_state(adapter->hdd_vdev, NAN_DATA_NDI_DELETING_STATE);
+
+	/* Delete the interface */
+	ret = __wlan_hdd_del_virtual_intf(hdd_ctx->wiphy, &adapter->wdev);
+	if (ret)
+		hdd_err("NDI delete request failed");
+	else
+		hdd_err("NDI delete request successfully issued");
+
+	return ret;
+}
+
+void hdd_ndi_drv_ndi_create_rsp_handler(uint8_t vdev_id,
+				struct nan_datapath_inf_create_rsp *ndi_rsp)
+{
+	tCsrRoamInfo roam_info = {0};
+	tSirBssDescription tmp_bss_descp = {0};
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	hdd_adapter_t *adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	struct qdf_mac_addr bc_mac_addr = QDF_MAC_ADDR_BROADCAST_INITIALIZER;
+	hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+
+	if (ndi_rsp->status == QDF_STATUS_SUCCESS) {
+		hdd_alert("NDI interface successfully created");
+		os_if_nan_set_ndp_create_transaction_id(adapter->hdd_vdev, 0);
+		os_if_nan_set_ndi_state(adapter->hdd_vdev,
+					NAN_DATA_NDI_CREATED_STATE);
+		wlan_hdd_netif_queue_control(adapter,
+					WLAN_START_ALL_NETIF_QUEUE_N_CARRIER,
+					WLAN_CONTROL_PATH);
+	} else {
+		hdd_alert("NDI interface creation failed with reason %d",
+			ndi_rsp->reason /* create_reason */);
+	}
+
+	sta_ctx->broadcast_staid = ndi_rsp->sta_id;
+	hdd_save_peer(sta_ctx, sta_ctx->broadcast_staid, &bc_mac_addr);
+	hdd_roam_register_sta(adapter, &roam_info,
+				sta_ctx->broadcast_staid,
+				&bc_mac_addr, &tmp_bss_descp);
+	hdd_ctx->sta_to_adapter[sta_ctx->broadcast_staid] = adapter;
+}
+
+void hdd_ndi_close(uint8_t vdev_id)
+{
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	hdd_adapter_t *adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+	hdd_close_ndi(adapter);
+}
+
+void hdd_ndi_drv_ndi_delete_rsp_handler(uint8_t vdev_id)
+{
+	hdd_context_t *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
+	hdd_adapter_t *adapter = hdd_get_adapter_by_vdev(hdd_ctx, vdev_id);
+
+	wlan_hdd_netif_queue_control(adapter,
+				     WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
+				     WLAN_CONTROL_PATH);
+
+	complete(&adapter->disconnect_comp_var);
+}
+
+void hdd_ndp_session_end_handler(hdd_adapter_t *adapter)
+{
+	os_if_nan_ndi_session_end(adapter->hdd_vdev);
+}
+
+#endif

+ 11 - 0
core/hdd/src/wlan_hdd_nan_datapath.h

@@ -246,4 +246,15 @@ static inline void hdd_ndp_session_end_handler(hdd_adapter_t *adapter)
 }
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
 
+enum nan_datapath_state;
+struct nan_datapath_inf_create_rsp;
+
+struct wlan_objmgr_vdev *hdd_ndi_open(char *iface_name);
+int hdd_ndi_start(uint8_t vdev_id);
+int hdd_ndi_delete(uint8_t vdev_id, char *iface_name, uint16_t transaction_id);
+void hdd_ndi_close(uint8_t vdev_id);
+void hdd_ndi_drv_ndi_create_rsp_handler(uint8_t vdev_id,
+			       struct nan_datapath_inf_create_rsp *ndi_rsp);
+void hdd_ndi_drv_ndi_delete_rsp_handler(uint8_t vdev_id);
+
 #endif /* __WLAN_HDD_NAN_DATAPATH_H */

+ 6 - 4
core/hdd/src/wlan_hdd_object_manager.c

@@ -34,14 +34,18 @@
 #include <wlan_osif_priv.h>
 
 #ifdef NAPIER_SCAN
+#define hdd_init_scan_priv(x) wlan_cfg80211_scan_priv_init(x)
+#else
+#define hdd_init_scan_priv(x)
+#endif
+
 static void hdd_init_pdev_os_priv(hdd_context_t *hdd_ctx,
 	struct pdev_osif_priv *os_priv)
 {
 	/* Initialize the OS private structure*/
 	os_priv->wiphy = hdd_ctx->wiphy;
-	wlan_cfg80211_scan_priv_init(hdd_ctx->hdd_pdev);
+	hdd_init_scan_priv(hdd_ctx->hdd_pdev);
 }
-#endif
 
 static void hdd_init_vdev_os_priv(hdd_adapter_t *adapter,
 	struct vdev_osif_priv *os_priv)
@@ -112,9 +116,7 @@ int hdd_objmgr_create_and_store_pdev(hdd_context_t *hdd_ctx)
 		return -ENOMEM;
 	}
 	hdd_ctx->hdd_pdev = pdev;
-#ifdef NAPIER_SCAN
 	hdd_init_pdev_os_priv(hdd_ctx, priv);
-#endif
 	return 0;
 }
 

+ 39 - 4
core/mac/src/pe/nan/nan_datapath.c

@@ -31,8 +31,11 @@
 #include "lim_types.h"
 #include "lim_send_messages.h"
 #include "wma_nan_datapath.h"
+#ifdef WLAN_FEATURE_NAN_CONVERGENCE
+#include "os_if_nan.h"
+#include "nan_public_structs.h"
+#endif
 
-#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * lim_send_ndp_event_to_sme() - generic function to prepare and send NDP
  * message to SME.
@@ -62,8 +65,8 @@ static void lim_send_ndp_event_to_sme(tpAniSirGlobal mac_ctx, uint32_t msg_type,
 	}
 	lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT);
 }
-#endif
 
+#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * lim_add_ndi_peer() - Function to add ndi peer
  * @mac_ctx: handle to mac structure
@@ -119,7 +122,6 @@ static QDF_STATUS lim_add_ndi_peer(tpAniSirGlobal mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
-#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * lim_handle_ndp_indication_event() - Function to handle SIR_HAL_NDP_INDICATION
  * event from WMA
@@ -218,7 +220,6 @@ responder_rsp:
 				bodyval ? 0 : sizeof(*rsp_ind), bodyval);
 	return ret_val;
 }
-#endif
 
 /**
  * lim_ndp_delete_peer_by_addr() - Delete NAN data peer, given addr and vdev_id
@@ -349,6 +350,7 @@ static void lim_ndp_delete_peers(tpAniSirGlobal mac_ctx,
 	}
 	qdf_mem_free(deleted_peers);
 }
+#endif
 
 #ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
@@ -824,6 +826,7 @@ end:
 	}
 }
 
+#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * lim_send_sme_ndp_add_sta_rsp() - prepares and send new peer ind to SME
  * @mac_ctx: handle to mac structure
@@ -865,6 +868,38 @@ static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx,
 	lim_sys_process_mmh_msg_api(mac_ctx, &mmh_msg, ePROT);
 	return QDF_STATUS_SUCCESS;
 }
+#else
+static QDF_STATUS lim_send_sme_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx,
+						tpPESession session,
+						tAddStaParams *add_sta_rsp)
+{
+	struct nan_datapath_peer_ind *new_peer_ind;
+	struct wlan_objmgr_psoc *psoc = mac_ctx->psoc;
+	struct wlan_objmgr_vdev *vdev =
+			wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
+					add_sta_rsp->smesessionId, WLAN_NAN_ID);
+
+	if (!add_sta_rsp) {
+		lim_log(mac_ctx, LOGE, FL("Invalid add_sta_rsp"));
+		return QDF_STATUS_E_INVAL;
+	}
+
+	new_peer_ind = qdf_mem_malloc(sizeof(*new_peer_ind));
+	if (!new_peer_ind) {
+		lim_log(mac_ctx, LOGE, FL("Failed to allocate memory"));
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	/* this message is going to os_if, fill in sme session id */
+	new_peer_ind->session_id = add_sta_rsp->smesessionId;
+	qdf_mem_copy(new_peer_ind->peer_mac_addr.bytes, add_sta_rsp->staMac,
+		     sizeof(tSirMacAddr));
+	new_peer_ind->sta_id = add_sta_rsp->staIdx;
+
+	ucfg_nan_event_handler(psoc, vdev, NDP_NEW_PEER, new_peer_ind);
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 
 /**
  * lim_ndp_add_sta_rsp() - handles add sta rsp for NDP from WMA

+ 23 - 24
core/mac/src/pe/nan/nan_datapath.h

@@ -27,7 +27,7 @@
 #ifndef __MAC_NAN_DATAPATH_H
 #define __MAC_NAN_DATAPATH_H
 
-#ifdef WLAN_FEATURE_NAN_DATAPATH
+#if defined(WLAN_FEATURE_NAN_DATAPATH) || defined(WLAN_FEATURE_NAN_CONVERGENCE)
 
 #include "sir_common.h"
 #include "ani_global.h"
@@ -100,12 +100,6 @@ struct ndp_peer_node {
 #endif
 };
 
-/* Function to process NDP requests */
-QDF_STATUS lim_handle_ndp_request_message(tpAniSirGlobal mac_ctx,
-					struct scheduler_msg *msg);
-/* Function to process NDP events */
-QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx,
-					struct scheduler_msg *msg);
 void lim_process_ndi_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx,
 				     struct scheduler_msg *lim_msg_q,
 				     tpPESession session_entry);
@@ -121,22 +115,6 @@ void lim_process_ndi_del_sta_rsp(tpAniSirGlobal mac_ctx,
 				 tpPESession pe_session);
 
 #else
-
-/* Function to process NDP requests */
-static inline QDF_STATUS lim_handle_ndp_request_message(tpAniSirGlobal mac_ctx,
-					struct scheduler_msg *msg)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-/* Function to process NDP events */
-static inline QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx,
-						      struct scheduler_msg *msg)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-/* Function to process NDP events */
 static inline void lim_process_ndi_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx,
 					struct scheduler_msg *lim_msg_q,
 					tpPESession session_entry)
@@ -158,7 +136,28 @@ static inline void lim_ndp_add_sta_rsp(tpAniSirGlobal mac_ctx,
 {
 }
 
-#endif /* WLAN_FEATURE_NAN_DATAPATH */
+#endif /* WLAN_FEATURE_NAN_DATAPATH || WLAN_FEATURE_NAN_CONVERGENCE */
+
+#if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
+/* Function to process NDP requests */
+QDF_STATUS lim_handle_ndp_request_message(tpAniSirGlobal mac_ctx,
+					struct scheduler_msg *msg);
+/* Function to process NDP events */
+QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx,
+				      struct scheduler_msg *msg);
+#else
+static inline QDF_STATUS lim_handle_ndp_request_message(tpAniSirGlobal mac_ctx,
+					struct scheduler_msg *msg)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS lim_handle_ndp_event_message(tpAniSirGlobal mac_ctx,
+						      struct scheduler_msg *msg)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* WLAN_FEATURE_NAN_DATAPATH && !WLAN_FEATURE_NAN_CONVERGENCE */
 
 #endif /* __MAC_NAN_DATAPATH_H */
 

+ 1 - 1
core/sme/inc/csr_api.h

@@ -1425,7 +1425,7 @@ typedef struct tagCsrRoamInfo {
 	tSirSmeChanInfo chan_info;
 	uint8_t target_channel;
 
-#if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
+#ifdef WLAN_FEATURE_NAN_DATAPATH
 	union {
 		struct sme_ndp_peer_ind ndp_peer_ind_params;
 		struct ndp_schedule_update_rsp ndp_sched_upd_rsp_params;

+ 44 - 38
core/sme/inc/sme_nan_datapath.h

@@ -29,7 +29,7 @@
 
 #include "csr_inside_api.h"
 
-#ifdef WLAN_FEATURE_NAN_DATAPATH
+#if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
 #include "qdf_types.h"
 #include "sir_api.h"
 #include "ani_global.h"
@@ -86,20 +86,6 @@ QDF_STATUS sme_ndp_responder_req_handler(tHalHandle hal,
 /* NAN indication response handler */
 QDF_STATUS sme_ndp_end_req_handler(tHalHandle hal, struct ndp_end_req *req);
 
-/* Start NDI BSS */
-QDF_STATUS csr_roam_start_ndi(tpAniSirGlobal mac_ctx, uint32_t session_id,
-			      tCsrRoamProfile *profile);
-
-void csr_roam_save_ndi_connected_info(tpAniSirGlobal mac_ctx,
-				      uint32_t session_id,
-				      tCsrRoamProfile *roam_profile,
-				      tSirBssDescription *bss_desc);
-
-void csr_roam_update_ndp_return_params(tpAniSirGlobal mac_ctx,
-					uint32_t result,
-					uint32_t *roam_status,
-					uint32_t *roam_result,
-					struct tagCsrRoamInfo *roam_info);
 QDF_STATUS csr_process_ndp_initiator_request(tpAniSirGlobal mac_ctx,
 					     tSmeCmd *cmd);
 QDF_STATUS csr_process_ndp_data_end_request(tpAniSirGlobal mac_ctx,
@@ -128,29 +114,6 @@ static inline QDF_STATUS sme_ndp_responder_req_handler(tHalHandle hal,
 	return QDF_STATUS_SUCCESS;
 }
 
-/* Start NDI BSS */
-static inline QDF_STATUS csr_roam_start_ndi(tpAniSirGlobal mac_ctx,
-					uint32_t session_id,
-					tCsrRoamProfile *profile)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-static inline void csr_roam_save_ndi_connected_info(tpAniSirGlobal mac_ctx,
-					uint32_t session_id,
-					tCsrRoamProfile *roam_profile,
-					tSirBssDescription *bss_desc)
-{
-}
-
-static inline void csr_roam_update_ndp_return_params(tpAniSirGlobal mac_ctx,
-					uint32_t result,
-					uint32_t *roam_status,
-					uint32_t *roam_result,
-					struct tagCsrRoamInfo *roam_info)
-{
-}
-
 /* NAN indication response handler */
 static inline QDF_STATUS sme_ndp_end_req_handler(uint32_t session_id,
 				   void *req_params) {
@@ -188,4 +151,47 @@ static inline void csr_release_ndp_data_end_req(tpAniSirGlobal mac_ctx,
 						tSmeCmd *cmd) {}
 
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
+
+#ifdef WLAN_FEATURE_NAN_DATAPATH
+/* Start NDI BSS */
+QDF_STATUS csr_roam_start_ndi(tpAniSirGlobal mac_ctx, uint32_t session_id,
+			      tCsrRoamProfile *profile);
+
+void csr_roam_save_ndi_connected_info(tpAniSirGlobal mac_ctx,
+				      uint32_t session_id,
+				      tCsrRoamProfile *roam_profile,
+				      tSirBssDescription *bss_desc);
+
+void csr_roam_update_ndp_return_params(tpAniSirGlobal mac_ctx,
+					uint32_t result,
+					uint32_t *roam_status,
+					uint32_t *roam_result,
+					struct tagCsrRoamInfo *roam_info);
+
+#else
+/* Start NDI BSS */
+static inline QDF_STATUS csr_roam_start_ndi(tpAniSirGlobal mac_ctx,
+					uint32_t session_id,
+					tCsrRoamProfile *profile)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline void csr_roam_save_ndi_connected_info(tpAniSirGlobal mac_ctx,
+					uint32_t session_id,
+					tCsrRoamProfile *roam_profile,
+					tSirBssDescription *bss_desc)
+{
+}
+
+static inline void csr_roam_update_ndp_return_params(tpAniSirGlobal mac_ctx,
+					uint32_t result,
+					uint32_t *roam_status,
+					uint32_t *roam_result,
+					struct tagCsrRoamInfo *roam_info)
+{
+}
+
+#endif /* WLAN_FEATURE_NAN_DATAPATH */
+
 #endif /* __SME_NAN_DATAPATH_H */

+ 3 - 1
core/sme/src/nan/nan_datapath_api.c

@@ -308,6 +308,7 @@ QDF_STATUS sme_ndp_end_req_handler(tHalHandle hal, struct ndp_end_req *req)
 	sme_release_global_lock(&mac_ctx->sme);
 	return ret;
 }
+#endif /* WLAN_FEATURE_NAN_CONVERGENCE */
 
 /**
  * csr_roam_start_ndi() - Start connection for NAN datapath
@@ -456,6 +457,7 @@ void csr_roam_update_ndp_return_params(tpAniSirGlobal mac_ctx,
 	}
 }
 
+#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * csr_process_ndp_initiator_request() - process ndp initiator request
  * @mac_ctx: Global MAC context
@@ -822,4 +824,4 @@ void csr_release_ndp_data_end_req(tpAniSirGlobal mac_ctx, tSmeCmd *cmd)
 	qdf_mem_free(cmd->u.data_end_req);
 	cmd->u.data_end_req = NULL;
 }
-#endif /* WLAN_FEATURE_NAN_CONVERGENCE */
+#endif /* WLAN_FEATURE_NAN_CONVERGENCE */

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

@@ -202,7 +202,7 @@ static inline QDF_STATUS wma_send_egap_conf_params(WMA_HANDLE handle,
 QDF_STATUS wma_set_tx_power_scale(uint8_t vdev_id, int value);
 QDF_STATUS wma_set_tx_power_scale_decr_db(uint8_t vdev_id, int value);
 
-#ifdef WLAN_FEATURE_NAN_DATAPATH
+#if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
 QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
 					  (tpAniSirGlobal mac_ctx,
 					  struct scheduler_msg *msg));
@@ -213,7 +213,7 @@ static inline QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
 {
 	return QDF_STATUS_SUCCESS;
 }
-#endif
+#endif /* WLAN_FEATURE_NAN_DATAPATH && !WLAN_FEATURE_NAN_CONVERGENCE */
 
 bool wma_is_p2p_lo_capable(void);
 QDF_STATUS wma_p2p_lo_start(struct sir_p2p_lo_start *params);

+ 2 - 0
core/wma/src/wma_nan_datapath.c

@@ -946,6 +946,7 @@ void wma_ndp_wow_event_callback(void *handle, void *event, uint32_t len,
 		break;
 	}
 }
+#endif /* WLAN_FEATURE_NAN_CONVERGENCE */
 
 /**
  * wma_add_bss_ndi_mode() - Process BSS creation request while adding NaN
@@ -1036,6 +1037,7 @@ send_fail_resp:
 	wma_send_msg(wma, WMA_ADD_BSS_RSP, (void *)add_bss, 0);
 }
 
+#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * wma_register_ndp_cb() - Register NDP callbacks
  * @pe_ndp_event_handler: PE NDP callback routine pointer

+ 32 - 23
core/wma/src/wma_nan_datapath.h

@@ -34,18 +34,6 @@
 #if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
 #define WMA_IS_VDEV_IN_NDI_MODE(intf, vdev_id) \
 				(WMI_VDEV_TYPE_NDI == intf[vdev_id].type)
-/**
- * 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;
-}
 QDF_STATUS wma_handle_ndp_responder_req(tp_wma_handle wma_handle,
 					struct ndp_responder_req *req_params);
 
@@ -53,7 +41,7 @@ void wma_ndp_register_all_event_handlers(tp_wma_handle wma_handle);
 void wma_ndp_unregister_all_event_handlers(tp_wma_handle wma_handle);
 void wma_ndp_wow_event_callback(void *handle, void *event,
 				uint32_t len, uint32_t event_id);
-void wma_add_bss_ndi_mode(tp_wma_handle wma, tpAddBssParams add_bss);
+
 void wma_add_sta_ndi_mode(tp_wma_handle wma, tpAddStaParams add_sta);
 QDF_STATUS wma_handle_ndp_initiator_req(tp_wma_handle wma_handle, void *req);
 QDF_STATUS wma_handle_ndp_end_req(tp_wma_handle wma_handle, void *req);
@@ -62,16 +50,6 @@ void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
 uint32_t wma_ndp_get_eventid_from_tlvtag(uint32_t tag);
 #else
 #define WMA_IS_VDEV_IN_NDI_MODE(intf, vdev_id) (false)
-static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
-					struct wma_tgt_cfg *tgt_cfg)
-{
-	return;
-}
-static inline void wma_add_bss_ndi_mode(tp_wma_handle wma,
-					tpAddBssParams add_bss)
-{
-	return;
-}
 static inline void wma_ndp_register_all_event_handlers(
 					tp_wma_handle wma_handle) {}
 static inline void wma_ndp_unregister_all_event_handlers(
@@ -105,5 +83,36 @@ static inline uint32_t wma_ndp_get_eventid_from_tlvtag(uint32_t tag)
 {
 	return 0;
 }
+#endif /* WLAN_FEATURE_NAN_DATAPATH !WLAN_FEATURE_NAN_CONVERGENCE */
+
+#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;
+}
+
+void wma_add_bss_ndi_mode(tp_wma_handle wma, tpAddBssParams add_bss);
+#else
+static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
+					struct wma_tgt_cfg *tgt_cfg)
+{
+	return;
+}
+
+static inline void wma_add_bss_ndi_mode(tp_wma_handle wma,
+					tpAddBssParams add_bss)
+{
+	return;
+}
+
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
+
 #endif /* __WMA_NAN_DATAPATH_H */