Browse Source

qcacld-3.0: Implement NDP_INITIATOR_REQ

Add MCL changes for NDP_INITIATOR_REQ.

Change-Id: Idcf9df354dc24f7cf82a818833ff3c2c5e2da1e8
CRs-Fixed: 2014795
Naveen Rawat 8 years ago
parent
commit
37f62c8796

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

@@ -1939,6 +1939,9 @@ static void hdd_nan_register_callbacks(hdd_context_t *hdd_ctx)
 	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;
 
+	cb_obj.new_peer_ind = hdd_ndp_new_peer_handler;
+	cb_obj.get_peer_idx = hdd_ndp_get_peer_idx;
+
 	os_if_nan_register_hdd_callbacks(hdd_ctx->hdd_psoc, &cb_obj);
 }
 #else

+ 47 - 0
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -2247,4 +2247,51 @@ void hdd_ndp_session_end_handler(hdd_adapter_t *adapter)
 	os_if_nan_ndi_session_end(adapter->hdd_vdev);
 }
 
+int hdd_ndp_get_peer_idx(uint8_t vdev_id, struct qdf_mac_addr *addr)
+{
+	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_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	return hdd_get_peer_idx(sta_ctx, addr);
+}
+
+/**
+ * hdd_ndp_new_peer_handler() - NDP new peer indication handler
+ * @adapter: pointer to adapter context
+ * @ind_params: indication parameters
+ *
+ * Return: none
+ */
+int hdd_ndp_new_peer_handler(uint8_t vdev_id, uint16_t sta_id,
+			struct qdf_mac_addr *peer_mac_addr, bool fist_peer)
+{
+	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);
+	tSirBssDescription tmp_bss_descp = {0};
+	tCsrRoamInfo roam_info = {0};
+	hdd_station_ctx_t *sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+
+	ENTER();
+	/* save peer in ndp ctx */
+	if (false == hdd_save_peer(sta_ctx, sta_id, peer_mac_addr)) {
+		hdd_err("Ndp peer table full. cannot save new peer");
+		return -EPERM;
+	}
+
+	/* this function is called for each new peer */
+	hdd_roam_register_sta(adapter, &roam_info, sta_id,
+				peer_mac_addr, &tmp_bss_descp);
+	hdd_ctx->sta_to_adapter[sta_id] = adapter;
+	/* perform following steps for first new peer ind */
+	if (fist_peer) {
+		hdd_info("Set ctx connection state to connected");
+		sta_ctx->conn_info.connState = eConnectionState_NdiConnected;
+		hdd_wmm_connect(adapter, &roam_info, eCSR_BSS_TYPE_NDI);
+		wlan_hdd_netif_queue_control(adapter,
+				WLAN_WAKE_ALL_NETIF_QUEUE, WLAN_CONTROL_PATH);
+	}
+	EXIT();
+	return 0;
+}
+
 #endif

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

@@ -256,5 +256,8 @@ 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);
+int hdd_ndp_get_peer_idx(uint8_t vdev_id, struct qdf_mac_addr *addr);
+int hdd_ndp_new_peer_handler(uint8_t vdev_id, uint16_t sta_id,
+			struct qdf_mac_addr *peer_mac_addr, bool fist_peer);
 
 #endif /* __WLAN_HDD_NAN_DATAPATH_H */

+ 17 - 0
core/mac/src/pe/lim/lim_api.c

@@ -74,6 +74,7 @@
 #include "wma.h"
 #include "wlan_mgmt_txrx_utils_api.h"
 #include "wlan_objmgr_psoc_obj.h"
+#include "os_if_nan.h"
 
 static void __lim_init_scan_vars(tpAniSirGlobal pMac)
 {
@@ -739,6 +740,21 @@ static void lim_register_debug_callback(void)
 	qdf_register_debug_callback(QDF_MODULE_ID_PE, &lim_state_info_dump);
 }
 
+#ifdef WLAN_FEATURE_NAN_CONVERGENCE
+static void lim_nan_register_callbacks(tpAniSirGlobal mac_ctx)
+{
+	struct nan_callbacks cb_obj = {0};
+
+	cb_obj.add_ndi_peer = lim_add_ndi_peer_converged;
+
+	ucfg_nan_register_lim_callbacks(mac_ctx->psoc, &cb_obj);
+}
+#else
+static void lim_nan_register_callbacks(tpAniSirGlobal mac_ctx)
+{
+}
+#endif
+
 /** -------------------------------------------------------------
    \fn pe_open
    \brief will be called in Open sequence from mac_open
@@ -803,6 +819,7 @@ tSirRetStatus pe_open(tpAniSirGlobal pMac, struct cds_config_info *cds_cfg)
 	MTRACE(lim_trace_init(pMac));
 #endif
 	lim_register_debug_callback();
+	lim_nan_register_callbacks(pMac);
 
 	return status; /* status here will be eSIR_SUCCESS */
 

+ 13 - 1
core/mac/src/pe/nan/nan_datapath.c

@@ -34,6 +34,7 @@
 #ifdef WLAN_FEATURE_NAN_CONVERGENCE
 #include "os_if_nan.h"
 #include "nan_public_structs.h"
+#include "nan_ucfg_api.h"
 #endif
 
 /**
@@ -66,7 +67,6 @@ 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);
 }
 
-#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * lim_add_ndi_peer() - Function to add ndi peer
  * @mac_ctx: handle to mac structure
@@ -122,6 +122,18 @@ static QDF_STATUS lim_add_ndi_peer(tpAniSirGlobal mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS lim_add_ndi_peer_converged(uint32_t vdev_id,
+				struct qdf_mac_addr peer_mac_addr)
+{
+	tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
+
+	if (!mac_ctx)
+		return QDF_STATUS_E_NULL_VALUE;
+
+	return lim_add_ndi_peer(mac_ctx, vdev_id, peer_mac_addr);
+}
+
+#ifndef WLAN_FEATURE_NAN_CONVERGENCE
 /**
  * lim_handle_ndp_indication_event() - Function to handle SIR_HAL_NDP_INDICATION
  * event from WMA

+ 2 - 0
core/mac/src/pe/nan/nan_datapath.h

@@ -114,6 +114,8 @@ void lim_process_ndi_del_sta_rsp(tpAniSirGlobal mac_ctx,
 				 struct scheduler_msg *lim_msg,
 				 tpPESession pe_session);
 
+QDF_STATUS lim_add_ndi_peer_converged(uint32_t vdev_id,
+				struct qdf_mac_addr peer_mac_addr);
 #else
 static inline void lim_process_ndi_mlm_add_bss_rsp(tpAniSirGlobal mac_ctx,
 					struct scheduler_msg *lim_msg_q,

+ 1 - 1
core/wma/src/wma_nan_datapath.c

@@ -1061,6 +1061,7 @@ QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
 	WMA_LOGD("Registered NDP callbacks with WMA successfully");
 	return QDF_STATUS_SUCCESS;
 }
+#endif /* WLAN_FEATURE_NAN_CONVERGENCE */
 
 /**
  * wma_add_sta_ndi_mode() - Process ADD_STA for NaN Data path
@@ -1204,4 +1205,3 @@ send_del_rsp:
 		wma_send_msg(wma, WMA_DELETE_STA_RSP, del_sta, 0);
 	}
 }
-#endif /* WLAN_FEATURE_NAN_CONVERGENCE */

+ 16 - 12
core/wma/src/wma_nan_datapath.h

@@ -32,8 +32,6 @@
 #include "sme_nan_datapath.h"
 
 #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)
 QDF_STATUS wma_handle_ndp_responder_req(tp_wma_handle wma_handle,
 					struct ndp_responder_req *req_params);
 
@@ -42,22 +40,16 @@ 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_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);
-void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
-					tpDeleteStaParams del_sta);
 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_ndp_register_all_event_handlers(
 					tp_wma_handle wma_handle) {}
 static inline void wma_ndp_unregister_all_event_handlers(
 					tp_wma_handle wma_handle) {}
 static inline void wma_ndp_wow_event_callback(void *handle, void *event,
 					uint32_t len, uint32_t event_id) {}
-static inline void wma_add_sta_ndi_mode(tp_wma_handle wma,
-					tpAddStaParams add_sta) {}
 static inline QDF_STATUS wma_handle_ndp_initiator_req(tp_wma_handle wma_handle,
 						      void *req)
 {
@@ -74,10 +66,6 @@ static inline QDF_STATUS wma_handle_ndp_end_req(tp_wma_handle wma_handle,
 {
 	return QDF_STATUS_SUCCESS;
 }
-static inline void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
-					tpDeleteStaParams del_sta)
-{
-}
 
 static inline uint32_t wma_ndp_get_eventid_from_tlvtag(uint32_t tag)
 {
@@ -86,6 +74,11 @@ static inline uint32_t wma_ndp_get_eventid_from_tlvtag(uint32_t tag)
 #endif /* WLAN_FEATURE_NAN_DATAPATH !WLAN_FEATURE_NAN_CONVERGENCE */
 
 #ifdef WLAN_FEATURE_NAN_DATAPATH
+#define WMA_IS_VDEV_IN_NDI_MODE(intf, vdev_id) \
+				(WMI_VDEV_TYPE_NDI == intf[vdev_id].type)
+
+void wma_add_sta_ndi_mode(tp_wma_handle wma, tpAddStaParams add_sta);
+
 /**
  * wma_update_hdd_cfg_ndp() - Update target device NAN datapath capability
  * @wma_handle: pointer to WMA context
@@ -100,7 +93,12 @@ static inline void wma_update_hdd_cfg_ndp(tp_wma_handle wma_handle,
 }
 
 void wma_add_bss_ndi_mode(tp_wma_handle wma, tpAddBssParams add_bss);
+
+void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
+					tpDeleteStaParams del_sta);
+
 #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)
 {
@@ -113,6 +111,12 @@ static inline void wma_add_bss_ndi_mode(tp_wma_handle wma,
 	return;
 }
 
+static inline void wma_delete_sta_req_ndi_mode(tp_wma_handle wma,
+					tpDeleteStaParams del_sta)
+{
+}
+static inline void wma_add_sta_ndi_mode(tp_wma_handle wma,
+					tpAddStaParams add_sta) {}
 #endif /* WLAN_FEATURE_NAN_DATAPATH */
 
 #endif /* __WMA_NAN_DATAPATH_H */