Pārlūkot izejas kodu

qcacld-3.0: MCL changes for WIFI Positioning component

Implement MCL changes to use new WIFI POS component APIs

Change-Id: Ifccc7f6e9c614570de758fde3a23b63ee5f387d7
CRs-Fixed: 2003488
Naveen Rawat 8 gadi atpakaļ
vecāks
revīzija
910726a844

+ 60 - 1
core/hdd/inc/wlan_hdd_main.h

@@ -69,7 +69,12 @@
 #include <wlan_objmgr_vdev_obj.h>
 #include <wlan_objmgr_peer_obj.h>
 #include "wlan_pmo_ucfg_api.h"
-
+#ifdef WIFI_POS_CONVERGED
+#include "os_if_wifi_pos.h"
+#include "wifi_pos_api.h"
+#else
+#include "wlan_hdd_oemdata.h"
+#endif
 /*
  * Preprocessor definitions and constants
  */
@@ -2218,6 +2223,7 @@ void wlan_hdd_init_chan_info(hdd_context_t *hdd_ctx);
  */
 void wlan_hdd_deinit_chan_info(hdd_context_t *hdd_ctx);
 void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
+
 /**
  * hdd_check_for_opened_interfaces()- Check for interface up
  * @hdd_ctx: HDD context
@@ -2228,4 +2234,57 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit);
  * Return: 0 if interface was opened else false
  */
 bool hdd_check_for_opened_interfaces(hdd_context_t *hdd_ctx);
+
+#ifdef WIFI_POS_CONVERGED
+/**
+ * hdd_send_peer_status_ind_to_app() - wrapper to call legacy or new wifi_pos
+ * function to send peer status to a registered application
+ * @peer_mac: MAC address of peer
+ * @peer_status: ePeerConnected or ePeerDisconnected
+ * @peer_timing_meas_cap: 0: RTT/RTT2, 1: RTT3. Default is 0
+ * @sessionId: SME session id, i.e. vdev_id
+ * @chan_info: operating channel information
+ * @dev_mode: dev mode for which indication is sent
+ *
+ * Return: none
+ */
+static inline void hdd_send_peer_status_ind_to_app(
+					struct qdf_mac_addr *peer_mac,
+					uint8_t peer_status,
+					uint8_t peer_timing_meas_cap,
+					uint8_t sessionId,
+					tSirSmeChanInfo *chan_info,
+					enum tQDF_ADAPTER_MODE dev_mode)
+{
+	struct wifi_pos_ch_info ch_info;
+
+	ch_info.chan_id = chan_info->chan_id;
+	ch_info.mhz = chan_info->mhz;
+	ch_info.band_center_freq1 = chan_info->band_center_freq1;
+	ch_info.band_center_freq2 = chan_info->band_center_freq2;
+	ch_info.info = chan_info->info;
+	ch_info.reg_info_1 = chan_info->reg_info_1;
+	ch_info.reg_info_2 = chan_info->reg_info_2;
+	ch_info.nss = chan_info->nss;
+	ch_info.rate_flags = chan_info->rate_flags;
+	ch_info.sec_ch_offset = chan_info->sec_ch_offset;
+	ch_info.ch_width = chan_info->ch_width;
+	os_if_wifi_pos_send_peer_status(peer_mac, peer_status,
+					peer_timing_meas_cap, sessionId,
+					&ch_info, dev_mode);
+}
+#else
+static inline void hdd_send_peer_status_ind_to_app(
+					struct qdf_mac_addr *peer_mac,
+					uint8_t peer_status,
+					uint8_t peer_timing_meas_cap,
+					uint8_t sessionId,
+					tSirSmeChanInfo *chan_info,
+					enum tQDF_ADAPTER_MODE dev_mode)
+{
+	hdd_send_peer_status_ind_to_oem_app(peer_mac, peer_status,
+			peer_timing_meas_cap, sessionId, chan_info, dev_mode);
+}
+#endif /* WIFI_POS_CONVERGENCE */
+
 #endif /* end #if !defined(WLAN_HDD_MAIN_H) */

+ 3 - 1
core/hdd/inc/wlan_hdd_oemdata.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -192,5 +192,7 @@ static inline int oem_activate_service(struct hdd_context_s *hdd_ctx)
 {
 	return 0;
 }
+
+static inline void hdd_send_oem_data_rsp_msg(void *oem_rsp) {}
 #endif /* FEATURE_OEM_DATA_SUPPORT */
 #endif /* __WLAN_HDD_OEM_DATA_H__ */

+ 7 - 9
core/hdd/src/wlan_hdd_assoc.c

@@ -1207,7 +1207,7 @@ static void hdd_send_association_event(struct net_device *dev,
 		}
 #endif
 	if (eConnectionState_Associated == pHddStaCtx->conn_info.connState) {
-		tSirSmeChanInfo chan_info;
+		tSirSmeChanInfo chan_info = {0};
 
 		if (!pCsrRoamInfo) {
 			hdd_err("STA in associated state but pCsrRoamInfo is null");
@@ -1287,13 +1287,11 @@ static void hdd_send_association_event(struct net_device *dev,
 					peerMacAddr.bytes);
 
 		/* send peer status indication to oem app */
-		hdd_send_peer_status_ind_to_oem_app(&peerMacAddr,
-							ePeerConnected,
-							pCsrRoamInfo->
-							timingMeasCap,
-							pAdapter->sessionId,
-							&chan_info,
-							pAdapter->device_mode);
+		hdd_send_peer_status_ind_to_app(&peerMacAddr,
+						ePeerConnected,
+						pCsrRoamInfo->timingMeasCap,
+						pAdapter->sessionId, &chan_info,
+						pAdapter->device_mode);
 		/* Update tdls module about connection event */
 		wlan_hdd_tdls_notify_connect(pAdapter, pCsrRoamInfo);
 
@@ -1347,7 +1345,7 @@ static void hdd_send_association_event(struct net_device *dev,
 					 &pHddStaCtx->conn_info.bssId);
 
 			/* send peer status indication to oem app */
-			hdd_send_peer_status_ind_to_oem_app(&peerMacAddr,
+			hdd_send_peer_status_ind_to_app(&peerMacAddr,
 							ePeerDisconnected, 0,
 							pAdapter->sessionId,
 							NULL,

+ 2 - 3
core/hdd/src/wlan_hdd_hostapd.c

@@ -80,7 +80,6 @@
 #include "wlan_hdd_object_manager.h"
 #include <qca_vendor.h>
 
-
 #define    IS_UP(_dev) \
 	(((_dev)->flags & (IFF_RUNNING|IFF_UP)) == (IFF_RUNNING|IFF_UP))
 #define    IS_UP_AUTO(_ic) \
@@ -1691,7 +1690,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		}
 		if (pHostapdAdapter->device_mode == QDF_P2P_GO_MODE) {
 			/* send peer status indication to oem app */
-			hdd_send_peer_status_ind_to_oem_app(&pSapEvent->sapevt.
+			hdd_send_peer_status_ind_to_app(&pSapEvent->sapevt.
 					sapStationAssocReassocCompleteEvent.
 					staMac, ePeerConnected,
 					pSapEvent->sapevt.
@@ -1820,7 +1819,7 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent,
 		}
 		if (pHostapdAdapter->device_mode == QDF_P2P_GO_MODE) {
 			/* send peer status indication to oem app */
-			hdd_send_peer_status_ind_to_oem_app(&pSapEvent->sapevt.
+			hdd_send_peer_status_ind_to_app(&pSapEvent->sapevt.
 						sapStationDisassocCompleteEvent.
 						staMac, ePeerDisconnected,
 						0,

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

@@ -114,6 +114,9 @@
 #include <qca_vendor.h>
 #include "wlan_pmo_ucfg_api.h"
 #include "sir_api.h"
+#include "os_if_wifi_pos.h"
+#include "wifi_pos_api.h"
+#include "wlan_hdd_oemdata.h"
 
 #ifdef CNSS_GENL
 #include <net/cnss_nl.h>
@@ -2042,6 +2045,63 @@ release_lock:
 	return -EINVAL;
 }
 
+#ifdef WIFI_POS_CONVERGED
+static int hdd_activate_wifi_pos(hdd_context_t *hdd_ctx)
+{
+	int ret = os_if_wifi_pos_register_nl();
+
+	if (ret)
+		hdd_err("os_if_wifi_pos_register_nl failed");
+
+	return ret;
+}
+
+static int hdd_deactivate_wifi_pos(void)
+{
+	int ret = os_if_wifi_pos_deregister_nl();
+
+	if (ret)
+		hdd_err("os_if_wifi_pos_deregister_nl failed");
+
+	return  ret;
+}
+
+/**
+ * hdd_populate_wifi_pos_cfg - populates wifi_pos parameters
+ * @hdd_ctx: hdd context
+ *
+ * Return: status of operation
+ */
+static void hdd_populate_wifi_pos_cfg(hdd_context_t *hdd_ctx)
+{
+	struct wlan_objmgr_psoc *psoc = hdd_ctx->hdd_psoc;
+	struct hdd_config *cfg = hdd_ctx->config;
+
+	wifi_pos_set_oem_target_type(psoc, hdd_ctx->target_type);
+	wifi_pos_set_oem_fw_version(psoc, hdd_ctx->target_fw_version);
+	wifi_pos_set_drv_ver_major(psoc, QWLAN_VERSION_MAJOR);
+	wifi_pos_set_drv_ver_minor(psoc, QWLAN_VERSION_MINOR);
+	wifi_pos_set_drv_ver_patch(psoc, QWLAN_VERSION_PATCH);
+	wifi_pos_set_drv_ver_build(psoc, QWLAN_VERSION_BUILD);
+	wifi_pos_set_dwell_time_min(psoc, cfg->nNeighborScanMinChanTime);
+	wifi_pos_set_dwell_time_max(psoc, cfg->nNeighborScanMaxChanTime);
+}
+#else
+static int hdd_activate_wifi_pos(hdd_context_t *hdd_ctx)
+{
+	return oem_activate_service(hdd_ctx);
+}
+
+static int hdd_deactivate_wifi_pos(void)
+{
+	return 0;
+}
+
+static void hdd_populate_wifi_pos_cfg(hdd_context_t *hdd_ctx)
+{
+}
+#endif
+
 /**
  * __hdd_open() - HDD Open function
  * @dev:	Pointer to net_device structure
@@ -2098,6 +2158,8 @@ static int __hdd_open(struct net_device *dev)
 			WLAN_CONTROL_PATH);
 	}
 
+	hdd_populate_wifi_pos_cfg(hdd_ctx);
+
 	return ret;
 }
 
@@ -4941,7 +5003,7 @@ static void hdd_unregister_notifiers(hdd_context_t *hdd_ctx)
 static void hdd_exit_netlink_services(hdd_context_t *hdd_ctx)
 {
 	hdd_close_cesium_nl_sock();
-
+	hdd_deactivate_wifi_pos();
 	ptt_sock_deactivate_svc();
 
 	nl_srv_exit();
@@ -4967,9 +5029,9 @@ static int hdd_init_netlink_services(hdd_context_t *hdd_ctx)
 	}
 	cds_set_radio_index(hdd_ctx->radio_index);
 
-	ret = oem_activate_service(hdd_ctx);
+	ret = hdd_activate_wifi_pos(hdd_ctx);
 	if (ret) {
-		hdd_alert("oem_activate_service failed: %d", ret);
+		hdd_alert("hdd_activate_wifi_pos failed: %d", ret);
 		goto err_nl_srv;
 	}
 

+ 60 - 9
core/hdd/src/wlan_hdd_wext.c

@@ -95,6 +95,7 @@
 #include "wlan_hdd_lro.h"
 #include "cds_utils.h"
 #include "wlan_hdd_request_manager.h"
+#include "os_if_wifi_pos.h"
 
 #define HDD_FINISH_ULA_TIME_OUT         800
 #define HDD_SET_MCBC_FILTERS_TO_FW      1
@@ -1886,9 +1887,25 @@ static const hdd_freq_chan_map_t freq_chan_map[] = {
  * </ioctl>
  */
 #define WE_GET_PHYMODE       12
-#ifdef FEATURE_OEM_DATA_SUPPORT
+
+/*
+ * <ioctl>
+ * getOemDataCap - Get the oem data caps.
+ *
+ * @INPUT: None
+ *
+ * @OUTPUT: oem data capability
+ *
+ * This IOCTL used to gets the current oem data cap.
+ *
+ * @E.g: iwpriv wlan0 getOemDataCap
+ *
+ * Usage: Internal/External
+ *
+ * </ioctl>
+ */
 #define WE_GET_OEM_DATA_CAP  13
-#endif
+
 /*
  * <ioctl>
  * getSNR - Enable SNR Monitoring
@@ -1908,6 +1925,7 @@ static const hdd_freq_chan_map_t freq_chan_map[] = {
  *
  * </ioctl>
  */
+
 #define WE_GET_SNR           14
 #define WE_LIST_FW_PROFILE      15
 
@@ -9306,6 +9324,43 @@ hdd_connection_state_string(eConnectionState connection_state)
 	}
 }
 
+#if defined(FEATURE_OEM_DATA_SUPPORT)
+/**
+ * iw_get_oem_data_cap_wrapper() - wrapper function to call legacy or new
+ * wifi_pos api to get oem data caps
+ * @dev: net device upon which the request was received
+ * @info: ioctl request information
+ * @wrqu: ioctl request data
+ * @extra: ioctl data payload
+ *
+ * Return: 0 for success, negative errno value on failure
+ */
+static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
+					struct iw_request_info *info,
+					union iwreq_data *wrqu, char *extra)
+{
+	return iw_get_oem_data_cap(dev, info, wrqu, extra);
+}
+#elif defined(WIFI_POS_CONVERGED)
+static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
+					struct iw_request_info *info,
+					union iwreq_data *wrqu, char *extra)
+{
+	hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+	hdd_context_t *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+
+	return os_if_wifi_pos_populate_caps(hdd_ctx->hdd_psoc,
+					(struct wifi_pos_driver_caps *)extra);
+}
+#else
+static inline int iw_get_oem_data_cap_wrapper(struct net_device *dev,
+					struct iw_request_info *info,
+					union iwreq_data *wrqu, char *extra)
+{
+	return -ENOTSUPP;
+}
+#endif
+
 /**
  * iw_get_char_setnone() - Generic "get string" private ioctl handler
  * @dev: device upon which the ioctl was received
@@ -9806,12 +9861,8 @@ static int __iw_get_char_setnone(struct net_device *dev,
 		break;
 	}
 
-#ifdef FEATURE_OEM_DATA_SUPPORT
 	case WE_GET_OEM_DATA_CAP:
-	{
-		return iw_get_oem_data_cap(dev, info, wrqu, extra);
-	}
-#endif /* FEATURE_OEM_DATA_SUPPORT */
+		return iw_get_oem_data_cap_wrapper(dev, info, wrqu, extra);
 	case WE_GET_SNR:
 	{
 		int8_t s7snr = 0;
@@ -13091,12 +13142,12 @@ static const struct iw_priv_args we_private_args[] = {
 	 0,
 	 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
 	 "getphymode"},
-#ifdef FEATURE_OEM_DATA_SUPPORT
+#if defined(FEATURE_OEM_DATA_SUPPORT) || defined(WIFI_POS_CONVERGED)
 	{WE_GET_OEM_DATA_CAP,
 	 0,
 	 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,
 	 "getOemDataCap"},
-#endif /* FEATURE_OEM_DATA_SUPPORT */
+#endif
 	{WE_GET_SNR,
 	 0,
 	 IW_PRIV_TYPE_CHAR | WE_MAX_STR_LEN,

+ 2 - 2
core/sme/inc/sme_api.h

@@ -388,8 +388,8 @@ extern QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal,
 void sme_deregister_oem_data_rsp_callback(tHalHandle h_hal);
 
 #else
-static inline QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle h_hal,
-		sme_send_oem_data_rsp_msg callback)
+static inline QDF_STATUS sme_register_oem_data_rsp_callback(tHalHandle hal,
+		void *callback)
 {
 	return QDF_STATUS_SUCCESS;
 }

+ 4 - 0
core/sme/inc/sme_internal.h

@@ -142,7 +142,9 @@ typedef void (*preferred_network_found_ind_cb)(void *callback_context,
 typedef void (*ocb_callback)(void *context, void *response);
 typedef void (*sme_set_thermal_level_callback)(void *context, u_int8_t level);
 typedef void (*p2p_lo_callback)(void *context, void *event);
+#ifdef FEATURE_OEM_DATA_SUPPORT
 typedef void (*sme_send_oem_data_rsp_msg)(struct oem_data_rsp *);
+#endif
 
 /**
  * typedef bpf_get_offload_cb - BPF offload callback signature
@@ -248,7 +250,9 @@ typedef struct tagSmeStruct {
 	bpf_get_offload_cb bpf_get_offload_cb;
 	p2p_lo_callback p2p_lo_event_callback;
 	void *p2p_lo_event_context;
+#ifdef FEATURE_OEM_DATA_SUPPORT
 	sme_send_oem_data_rsp_msg oem_data_rsp_callback;
+#endif
 	sme_encrypt_decrypt_callback encrypt_decrypt_cb;
 	void *encrypt_decrypt_context;
 	void (*lost_link_info_cb)(void *context,

+ 1 - 1
core/sme/src/common/sme_api.c

@@ -4512,7 +4512,6 @@ void  sme_deregister_oem_data_rsp_callback(tHalHandle h_hal)
 
 	pmac->sme.oem_data_rsp_callback = NULL;
 }
-#endif
 
 /**
  * sme_oem_update_capability() - update UMAC's oem related capability.
@@ -4567,6 +4566,7 @@ QDF_STATUS sme_oem_get_capability(tHalHandle hal,
 
 	return status;
 }
+#endif
 
 /**
  * sme_register_ftm_msg_processor() - registers hdd ftm message processor