qcacmn: scan convergence - initial set of files

Add initial set of scan files, structure definitions
and API proto type.

Change-Id: Ibfaef8bb09d51e12bde773fcea69e273eff3bb41
CRs-Fixed: 1095299
diff --git a/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h
new file mode 100644
index 0000000..22068d7
--- /dev/null
+++ b/umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h
@@ -0,0 +1,1173 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: contains commnon ieee80211 definitions
+ */
+
+#ifndef _WLAN_CMN_IEEE80211_H_
+#define _WLAN_CMN_IEEE80211_H_
+#include <qdf_types.h>
+#include <osdep.h>
+
+#define WLAN_SEQ_SEQ_SHIFT 4
+
+#define P2P_WFA_OUI {0x50, 0x6f, 0x9a}
+#define P2P_WFA_VER 0x09
+
+#define WSC_OUI 0x0050f204
+/* WCN IE */
+/* Microsoft OUI */
+#define WCN_OUI 0xf25000
+/* WCN */
+#define WCN_OUI_TYPE 0x04
+#define WME_OUI 0xf25000
+#define WME_OUI_TYPE 0x02
+#define WME_PARAM_OUI_SUBTYPE 0x01
+#define WME_INFO_OUI_SUBTYPE 0x00
+ /* Atheros OUI */
+#define ATH_OUI 0x7f0300
+#define ATH_OUI_TYPE 0x01
+/* Atheros Extended Cap Type */
+#define ATH_OUI_EXTCAP_TYPE 0x04
+/* QCA Bandwidth NSS Mapping Type */
+#define ATH_OUI_BW_NSS_MAP_TYPE 0x05
+#define SFA_OUI 0x964000
+#define SFA_OUI_TYPE 0x14
+/* QCA OUI (in little endian) */
+#define QCA_OUI 0xf0fd8c
+#define QCA_OUI_WHC_TYPE  0x00
+
+/* Temporary vendor specific IE for 11n pre-standard interoperability */
+#define VENDOR_HT_OUI       0x00904c
+#define VENDOR_HT_CAP_ID    51
+#define VENDOR_HT_INFO_ID   52
+
+#define VHT_INTEROP_OUI 0x00904c
+#define VHT_INTEROP_TYPE 0x04
+#define VHT_INTEROP_OUI_SUBTYPE 0x08
+#define VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC 0x18
+
+/* EPR information element flags */
+#define ERP_NON_ERP_PRESENT   0x01
+#define ERP_USE_PROTECTION    0x02
+#define ERP_LONG_PREAMBLE     0x04
+
+#define QCA_OUI_WHC_AP_INFO_SUBTYPE 0x00
+
+#define WLAN_MAX_IE_LEN                255
+#define WLAN_RSN_IE_LEN                22
+
+/* HT capability flags */
+#define WLAN_HTCAP_C_ADVCODING             0x0001
+#define WLAN_HTCAP_C_CHWIDTH40             0x0002
+/* Capable of SM Power Save (Static) */
+#define WLAN_HTCAP_C_SMPOWERSAVE_STATIC    0x0000
+/* Capable of SM Power Save (Dynamic) */
+#define WLAN_HTCAP_C_SMPOWERSAVE_DYNAMIC   0x0004
+/* Reserved */
+#define WLAN_HTCAP_C_SM_RESERVED           0x0008
+/* SM enabled, no SM Power Save */
+#define WLAN_HTCAP_C_SMPOWERSAVE_DISABLED            0x000c
+#define WLAN_HTCAP_C_GREENFIELD            0x0010
+#define WLAN_HTCAP_C_SHORTGI20             0x0020
+#define WLAN_HTCAP_C_SHORTGI40             0x0040
+#define WLAN_HTCAP_C_TXSTBC                0x0080
+#define WLAN_HTCAP_C_TXSTBC_S                   7
+/* 2 bits */
+#define WLAN_HTCAP_C_RXSTBC                0x0300
+#define WLAN_HTCAP_C_RXSTBC_S                   8
+#define WLAN_HTCAP_C_DELAYEDBLKACK         0x0400
+/* 1 = 8K, 0 = 3839B */
+#define WLAN_HTCAP_C_MAXAMSDUSIZE          0x0800
+#define WLAN_HTCAP_C_DSSSCCK40             0x1000
+#define WLAN_HTCAP_C_PSMP                  0x2000
+#define WLAN_HTCAP_C_INTOLERANT40          0x4000
+#define WLAN_HTCAP_C_LSIGTXOPPROT          0x8000
+/* Spatial Multiplexing (SM) capabitlity bitmask */
+#define WLAN_HTCAP_C_SM_MASK               0x000c
+
+/* VHT Operation  */
+/* 20/40 MHz Operating Channel */
+#define WLAN_VHTOP_CHWIDTH_2040          0
+/* 80 MHz Operating Channel */
+#define WLAN_VHTOP_CHWIDTH_80            1
+/* 160 MHz Operating Channel */
+#define WLAN_VHTOP_CHWIDTH_160           2
+/* 80 + 80 MHz Operating Channel */
+#define WLAN_VHTOP_CHWIDTH_80_80         3
+/* 160 MHz Operating Channel  (revised signalling) */
+#define WLAN_VHTOP_CHWIDTH_REVSIG_160    1
+/* 80 + 80 MHz Operating Channel  (revised signalling) */
+#define WLAN_VHTOP_CHWIDTH_REVSIG_80_80  1
+
+#define WLAN_RATE_VAL              0x7f
+
+#define WLAN_RV(v)     ((v) & WLAN_RATE_VAL)
+
+#define WLAN_CHAN_IS_5GHZ(chanidx) \
+	((chanidx > 30) ? true : false)
+#define WLAN_CHAN_IS_2GHZ(chanidx) \
+	(((chanidx > 0) && (chanidx < 15)) ? true : false)
+
+/* Check if revised signalling is being used for VHT160 in vhtop */
+#define WLAN_IS_REVSIG_VHT160(vhtop) (((vhtop)->vht_op_chwidth == \
+	WLAN_VHTOP_CHWIDTH_REVSIG_160) && \
+	((vhtop)->vht_op_ch_freq_seg2 != 0) && \
+	(abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) == 8))
+
+/* Check if revised signalling is being used for VHT80p80 in vhtop */
+#define WLAN_IS_REVSIG_VHT80_80(vhtop) (((vhtop)->vht_op_chwidth == \
+	WLAN_VHTOP_CHWIDTH_REVSIG_80_80) && \
+	((vhtop)->vht_op_ch_freq_seg2 != 0) && \
+	(abs((vhtop)->vht_op_ch_freq_seg2 - (vhtop)->vht_op_ch_freq_seg1) > 8))
+
+#define LE_READ_2(p) \
+	((uint16_t)\
+	((((const uint8_t *)(p))[0]) |\
+	(((const uint8_t *)(p))[1] <<  8)))
+
+#define LE_READ_4(p) \
+	((uint32_t)\
+	((((const uint8_t *)(p))[0]) |\
+	(((const uint8_t *)(p))[1] <<  8) |  \
+	(((const uint8_t *)(p))[2] << 16) |\
+	(((const uint8_t *)(p))[3] << 24)))
+
+#define BE_READ_4(p) \
+	((uint32_t)\
+	((((const uint8_t *)(p))[0] << 24) |\
+	(((const uint8_t *)(p))[1] << 16) |\
+	(((const uint8_t *)(p))[2] <<  8) |\
+	(((const uint8_t *)(p))[3])))
+
+/**
+ * enum ext_chan_offset: extension channel offset
+ * @WLAN_HTINFO_EXTOFFSET_NA: no extension channel is present
+ * @WLAN_HTINFO_EXTOFFSET_ABOVE: above control channel
+ * @WLAN_HTINFO_EXTOFFSET_UNDEF: undefined
+ * @WLAN_HTINFO_EXTOFFSET_BELOW: below control channel
+ */
+enum ext_chan_offset {
+	WLAN_HTINFO_EXTOFFSET_NA    = 0,
+	WLAN_HTINFO_EXTOFFSET_ABOVE = 1,
+	WLAN_HTINFO_EXTOFFSET_UNDEF = 2,
+	WLAN_HTINFO_EXTOFFSET_BELOW = 3
+};
+
+/**
+ * enum element_ie :- Management information element
+ * @WLAN_ELEMID_SSID: ssid IE
+ * @WLAN_ELEMID_RATES: Rates IE
+ * @WLAN_ELEMID_FHPARMS: FH param IE
+ * @WLAN_ELEMID_DSPARMS: DS Param IE
+ * @WLAN_ELEMID_CFPARMS : CF Param IE
+ * @WLAN_ELEMID_TIM: TIM IE
+ * @WLAN_ELEMID_IBSSPARMS: Ibss params IE
+ * @WLAN_ELEMID_COUNTRY: Country code IE
+ * @WLAN_ELEMID_REQINFO: Req Info IE
+ * @WLAN_ELEMID_QBSS_LOAD: Qbss load IE
+ * @WLAN_ELEMID_TCLAS: TCLAS IE
+ * @WLAN_ELEMID_CHALLENGE: Challenge IE
+ * @WLAN_ELEMID_PWRCNSTR: Power cn IE
+ * @WLAN_ELEMID_PWRCAP: power cap IE
+ * @WLAN_ELEMID_TPCREQ: TPC req IE
+ * @WLAN_ELEMID_TPCREP: TPC rsp IE
+ * @WLAN_ELEMID_SUPPCHAN: Supported channel IE
+ * @WLAN_ELEMID_CHANSWITCHANN: Channel switch IE
+ * @WLAN_ELEMID_MEASREQ: Measurement request IE
+ * @WLAN_ELEMID_MEASREP: Measurement Resp IE
+ * @WLAN_ELEMID_QUIET: Quiet IE
+ * @WLAN_ELEMID_IBSSDFS: IBSS DFS IE
+ * @WLAN_ELEMID_ERP: ERP IE
+ * @WLAN_ELEMID_TCLAS_PROCESS: TCLAS process IE
+ * @WLAN_ELEMID_HTCAP_ANA: HTT Capability IE
+ * @WLAN_ELEMID_RSN: RSN IE
+ * @WLAN_ELEMID_XRATES: Extended rate IE
+ * @WLAN_ELEMID_HTCAP_VENDOR: HT cap vendor IE
+ * @WLAN_ELEMID_HTINFO_VENDOR: HT info vendor IE
+ * @WLAN_ELEMID_MOBILITY_DOMAIN: MD IE
+ * @WLAN_ELEMID_FT: FT IE
+ * @WLAN_ELEMID_TIMEOUT_INTERVAL: Timeout interval IE
+ * @WLAN_ELEMID_SUPP_OP_CLASS: OP class IE
+ * @WLAN_ELEMID_EXTCHANSWITCHANN: Extended Channel switch IE
+ * @WLAN_ELEMID_HTINFO_ANA: HT info IE
+ * @WLAN_ELEMID_SECCHANOFFSET: Sec channel Offset IE
+ * @WLAN_ELEMID_WAPI: WAPI IE
+ * @WLAN_ELEMID_TIME_ADVERTISEMENT: Time IE
+ * @WLAN_ELEMID_RRM: Radio resource measurement IE
+ * @WLAN_ELEMID_2040_COEXT: 20-40 COext ext IE
+ * @WLAN_ELEMID_2040_INTOL:20-40 INT OL IE
+ * @WLAN_ELEMID_OBSS_SCAN: OBSS scan IE
+ * @WLAN_ELEMID_MMIE: 802.11w Management MIC IE
+ * @WLAN_ELEMID_FMS_DESCRIPTOR: 802.11v FMS descriptor IE
+ * @WLAN_ELEMID_FMS_REQUEST: 802.11v FMS request IE
+ * @WLAN_ELEMID_FMS_RESPONSE: 802.11v FMS response IE
+ * @WLAN_ELEMID_BSSMAX_IDLE_PERIOD = 90: BSS MAX IDLE PERIOD
+ * @WLAN_ELEMID_TFS_REQUEST: TFS req IE
+ * @WLAN_ELEMID_TFS_RESPONSE: TFS resp IE
+ * @WLAN_ELEMID_TIM_BCAST_REQUEST: TIM bcast req IE
+ * @WLAN_ELEMID_TIM_BCAST_RESPONSE: TIM bcast resp IE
+ * @WLAN_ELEMID_INTERWORKING: Interworking IE
+ * @WLAN_ELEMID_QOS_MAP: QOS MAP IE
+ * @WLAN_ELEMID_XCAPS: Extended capability IE
+ * @WLAN_ELEMID_TPC: TPC IE
+ * @WLAN_ELEMID_CCKM: CCKM IE
+ * @WLAN_ELEMID_VHTCAP: VHT Capabilities
+ * @WLAN_ELEMID_VHTOP: VHT Operation
+ * @WLAN_ELEMID_EXT_BSS_LOAD: Extended BSS Load
+ * @WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH: Wide Band Channel Switch
+ * @WLAN_ELEMID_VHT_TX_PWR_ENVLP: VHT Transmit Power Envelope
+ * @WLAN_ELEMID_CHAN_SWITCH_WRAP: Channel Switch Wrapper
+ * @WLAN_ELEMID_AID: AID
+ * @WLAN_ELEMID_QUIET_CHANNEL: Quiet Channel
+ * @WLAN_ELEMID_OP_MODE_NOTIFY: Operating Mode Notification
+ * @WLAN_ELEMID_VENDOR: vendor private
+ */
+enum element_ie {
+	WLAN_ELEMID_SSID             = 0,
+	WLAN_ELEMID_RATES            = 1,
+	WLAN_ELEMID_FHPARMS          = 2,
+	WLAN_ELEMID_DSPARMS          = 3,
+	WLAN_ELEMID_CFPARMS          = 4,
+	WLAN_ELEMID_TIM              = 5,
+	WLAN_ELEMID_IBSSPARMS        = 6,
+	WLAN_ELEMID_COUNTRY          = 7,
+	WLAN_ELEMID_REQINFO          = 10,
+	WLAN_ELEMID_QBSS_LOAD        = 11,
+	WLAN_ELEMID_TCLAS            = 14,
+	WLAN_ELEMID_CHALLENGE        = 16,
+	/* 17-31 reserved for challenge text extension */
+	WLAN_ELEMID_PWRCNSTR         = 32,
+	WLAN_ELEMID_PWRCAP           = 33,
+	WLAN_ELEMID_TPCREQ           = 34,
+	WLAN_ELEMID_TPCREP           = 35,
+	WLAN_ELEMID_SUPPCHAN         = 36,
+	WLAN_ELEMID_CHANSWITCHANN    = 37,
+	WLAN_ELEMID_MEASREQ          = 38,
+	WLAN_ELEMID_MEASREP          = 39,
+	WLAN_ELEMID_QUIET            = 40,
+	WLAN_ELEMID_IBSSDFS          = 41,
+	WLAN_ELEMID_ERP              = 42,
+	WLAN_ELEMID_TCLAS_PROCESS    = 44,
+	WLAN_ELEMID_HTCAP_ANA        = 45,
+	WLAN_ELEMID_RSN              = 48,
+	WLAN_ELEMID_XRATES           = 50,
+	WLAN_ELEMID_HTCAP_VENDOR     = 51,
+	WLAN_ELEMID_HTINFO_VENDOR    = 52,
+	WLAN_ELEMID_MOBILITY_DOMAIN  = 54,
+	WLAN_ELEMID_FT               = 55,
+	WLAN_ELEMID_TIMEOUT_INTERVAL = 56,
+	WLAN_ELEMID_SUPP_OP_CLASS    = 59,
+	WLAN_ELEMID_EXTCHANSWITCHANN = 60,
+	WLAN_ELEMID_HTINFO_ANA       = 61,
+	WLAN_ELEMID_SECCHANOFFSET    = 62,
+	WLAN_ELEMID_WAPI             = 68,
+	WLAN_ELEMID_TIME_ADVERTISEMENT = 69,
+	WLAN_ELEMID_RRM              = 70,
+	WLAN_ELEMID_2040_COEXT       = 72,
+	WLAN_ELEMID_2040_INTOL       = 73,
+	WLAN_ELEMID_OBSS_SCAN        = 74,
+	WLAN_ELEMID_MMIE             = 76,
+	WLAN_ELEMID_FMS_DESCRIPTOR   = 86,
+	WLAN_ELEMID_FMS_REQUEST      = 87,
+	WLAN_ELEMID_FMS_RESPONSE     = 88,
+	WLAN_ELEMID_BSSMAX_IDLE_PERIOD = 90,
+	WLAN_ELEMID_TFS_REQUEST      = 91,
+	WLAN_ELEMID_TFS_RESPONSE     = 92,
+	WLAN_ELEMID_TIM_BCAST_REQUEST  = 94,
+	WLAN_ELEMID_TIM_BCAST_RESPONSE = 95,
+	WLAN_ELEMID_INTERWORKING     = 107,
+	WLAN_ELEMID_QOS_MAP          = 110,
+	WLAN_ELEMID_XCAPS            = 127,
+	WLAN_ELEMID_TPC              = 150,
+	WLAN_ELEMID_CCKM             = 156,
+	WLAN_ELEMID_VHTCAP           = 191,
+	WLAN_ELEMID_VHTOP            = 192,
+	WLAN_ELEMID_EXT_BSS_LOAD     = 193,
+	WLAN_ELEMID_WIDE_BAND_CHAN_SWITCH = 194,
+	WLAN_ELEMID_VHT_TX_PWR_ENVLP = 195,
+	WLAN_ELEMID_CHAN_SWITCH_WRAP = 196,
+	WLAN_ELEMID_AID              = 197,
+	WLAN_ELEMID_QUIET_CHANNEL    = 198,
+	WLAN_ELEMID_OP_MODE_NOTIFY   = 199,
+	WLAN_ELEMID_VENDOR           = 221,
+};
+
+#define WLAN_OUI_SIZE 4
+#define WLAN_MAX_CIPHER 4
+#define PMKID_LEN 16
+#define MAX_PMKID 4
+
+#define WLAN_WPA_OUI 0xf25000
+#define WLAN_WPA_OUI_TYPE 0x01
+#define WPA_VERSION 1
+#define WLAN_WPA_SEL(x) (((x) << 24) | WLAN_WPA_OUI)
+
+#define WLAN_RSN_OUI 0xac0f00
+#define WLAN_CCKM_OUI 0x964000
+#define WLAN_CCKM_ASE_UNSPEC 0
+#define WLAN_WPA_CCKM_AKM 0x00964000
+#define WLAN_RSN_CCKM_AKM 0x00964000
+
+#define RSN_VERSION 1
+#define WLAN_RSN_SEL(x) (((x) << 24) | WLAN_RSN_OUI)
+#define WLAN_CCKM_SEL(x) (((x) << 24) | WLAN_CCKM_OUI)
+
+#define WLAN_CSE_NONE                    0x00
+#define WLAN_CSE_WEP40                   0x01
+#define WLAN_CSE_TKIP                    0x02
+#define WLAN_CSE_RESERVED                0x03
+#define WLAN_CSE_CCMP                    0x04
+#define WLAN_CSE_WEP104                  0x05
+#define WLAN_CSE_AES_CMAC                0x06
+#define WLAN_CSE_GCMP_128                0x08
+#define WLAN_CSE_GCMP_256                0x09
+#define WLAN_CSE_CCMP_256                0x0A
+#define WLAN_CSE_BIP_GMAC_128            0x0B
+#define WLAN_CSE_BIP_GMAC_256            0x0C
+#define WLAN_CSE_BIP_CMAC_256            0x0D
+
+#define WLAN_AKM_IEEE8021X        0x01
+#define WLAN_AKM_PSK              0x02
+#define WLAN_AKM_FT_IEEE8021X     0x03
+#define WLAN_AKM_FT_PSK           0x04
+#define WLAN_AKM_SHA256_IEEE8021X 0x05
+#define WLAN_AKM_SHA256_PSK       0x06
+
+#define WLAN_ASE_NONE                    0x00
+#define WLAN_ASE_8021X_UNSPEC            0x01
+#define WLAN_ASE_8021X_PSK               0x02
+#define WLAN_ASE_FT_IEEE8021X            0x20
+#define WLAN_ASE_FT_PSK                  0x40
+#define WLAN_ASE_SHA256_IEEE8021X        0x80
+#define WLAN_ASE_SHA256_PSK              0x100
+#define WLAN_ASE_WPS                     0x200
+
+#define RSN_CAP_MFP_CAPABLE 0x80
+#define RSN_CAP_MFP_REQUIRED 0x40
+
+/**
+ * struct wlan_rsn_ie: rsn ie info
+ * @ver: RSN ver
+ * @gp_cipher_suite: group cipher
+ * @pwise_cipher_count: number of pw cipher
+ * @pwise_cipher_suites:  pair wise cipher list
+ * @akm_suite_count: Number of akm suite
+ * @akm_suites: akm suites list
+ * @cap: RSN capability
+ * @pmkid_count: number of PMKID
+ * @pmkid: PMKID list
+ * @mgmt_cipher_suite: management (11w) cipher suite
+ */
+struct wlan_rsn_ie {
+	uint16_t ver;
+	uint32_t gp_cipher_suite;
+	uint16_t pwise_cipher_count;
+	uint32_t pwise_cipher_suites[WLAN_MAX_CIPHER];
+	uint16_t akm_suite_count;
+	uint32_t akm_suites[WLAN_MAX_CIPHER];
+	uint16_t cap;
+	uint16_t pmkid_count;
+	uint8_t pmkid[MAX_PMKID][PMKID_LEN];
+	uint32_t mgmt_cipher_suite;
+};
+
+/**
+ * struct wlan_wpa_ie: WPA ie info
+ * @ver: WPA ver
+ * @mc_cipher: multicast cipher
+ * @uc_cipher_count: number of unicast cipher
+ * @uc_ciphers:  unicast cipher list
+ * @auth_suite_count: Number of akm suite
+ * @auth_suites: akm suites list
+ * @cap: WPA capability
+ */
+struct wlan_wpa_ie {
+	uint16_t ver;
+	uint32_t mc_cipher;
+	uint16_t uc_cipher_count;
+	uint32_t uc_ciphers[WLAN_MAX_CIPHER];
+	uint16_t auth_suite_count;
+	uint32_t auth_suites[WLAN_MAX_CIPHER];
+	uint16_t cap;
+};
+
+#define WAPI_VERSION 1
+#define WLAN_WAPI_OUI 0x721400
+
+#define WLAN_WAPI_SEL(x) (((x) << 24) | WLAN_WAPI_OUI)
+
+#define WLAN_WAI_CERT_OR_SMS4 0x01
+#define WLAN_WAI_PSK 0x02
+
+/**
+ * struct wlan_wapi_ie: WAPI ie info
+ * @ver: WAPI ver
+ * @akm_suite_count: Number of akm suite
+ * @akm_suites: akm suites list
+ * @uc_cipher_suites:unicast cipher count
+ * @uc_cipher_suites: unicast cipher suite
+ * @mc_cipher_suite: mc cipher suite
+ */
+struct wlan_wapi_ie {
+	uint16_t ver;
+	uint16_t akm_suite_count;
+	uint32_t akm_suites[WLAN_MAX_CIPHER];
+	uint16_t uc_cipher_count;
+	uint32_t uc_cipher_suites[WLAN_MAX_CIPHER];
+	uint32_t mc_cipher_suite;
+};
+
+/**
+ * struct wlan_frame_hdr: generic IEEE 802.11 frames
+ * @i_fc: frame control
+ * @i_dur: duration field
+ * @i_addr1: mac address 1
+ * @i_addr2: mac address 2
+ * @i_addr3: mac address 3
+ * @i_seq: seq info
+ */
+struct wlan_frame_hdr {
+	uint8_t i_fc[2];
+	uint8_t i_dur[2];
+	union {
+		struct {
+			uint8_t i_addr1[QDF_MAC_ADDR_SIZE];
+			uint8_t i_addr2[QDF_MAC_ADDR_SIZE];
+			uint8_t i_addr3[QDF_MAC_ADDR_SIZE];
+		};
+		uint8_t i_addr_all[3 * QDF_MAC_ADDR_SIZE];
+	};
+	uint8_t i_seq[2];
+} qdf_packed;
+
+/**
+ * union wlan_capability : wlan_capability info
+ * @value: capability value
+ */
+union wlan_capability {
+	struct caps {
+		uint16_t ess:1;
+		uint16_t ibss:1;
+		uint16_t cf_pollable:1;
+		uint16_t cf_poll_request:1;
+		uint16_t privacy:1;
+		uint16_t short_preamble:1;
+		uint16_t pbcc:1;
+		uint16_t channel_agility:1;
+		uint16_t spectrum_management:1;
+		uint16_t qos:1;
+		uint16_t short_slot_time:1;
+		uint16_t apsd:1;
+		uint16_t reserved2:1;
+		uint16_t dsss_ofdm:1;
+		uint16_t del_block_ack:1;
+		uint16_t immed_block_ack:1;
+	} wlan_caps;
+	uint16_t value;
+} qdf_packed;
+
+/**
+ * struct ie_header : IE header
+ * @ie_id: Element Id
+ * @ie_len: IE Length
+ */
+struct ie_header {
+	uint8_t ie_id;
+	uint8_t ie_len;
+} qdf_packed;
+
+/**
+ * struct ie_ssid : ssid IE
+ * @ssid_id: SSID Element Id
+ * @ssid_len: SSID IE Length
+ * @ssid: ssid value
+ */
+struct ie_ssid {
+	uint8_t ssid_id;
+	uint8_t ssid_len;
+	uint8_t ssid[WLAN_SSID_MAX_LEN];
+} qdf_packed;
+
+/**
+ * struct ds_ie : ds IE
+ * @ie: DS Element Id
+ * @len: DS IE Length
+ * @cur_chan: channel info
+ */
+struct ds_ie {
+	uint8_t ie;
+	uint8_t len;
+	uint8_t cur_chan;
+} qdf_packed;
+
+/**
+ * struct erp_ie: ERP IE
+ * @ie: ERP Element Id
+ * @len: ERP IE Length
+ * @value: EP Info
+ */
+struct erp_ie {
+	uint8_t ie;
+	uint8_t len;
+	uint8_t value;
+} qdf_packed;
+
+/**
+ * struct htcap_cmn_ie: HT common IE info
+ * @hc_cap: HT capabilities
+ * @ampdu_param: ampdu params
+ * @mcsset: supported MCS set
+ * @extcap: extended HT capabilities
+ * @txbf_cap: txbf capabilities
+ * @antenna: antenna capabilities
+ */
+struct htcap_cmn_ie {
+	uint16_t hc_cap;
+	uint8_t ampdu_param;
+	uint8_t mcsset[16];
+	uint16_t extcap;
+	uint32_t txbf_cap;
+	uint8_t antenna;
+} qdf_packed;
+
+/**
+ * struct htcap_ie: HT Capability IE
+ * @id: HT IE
+ * @len: HT IE LEN
+ * @ie: HT cap info
+ */
+struct htcap_ie {
+	uint8_t id;
+	uint8_t len;
+	struct htcap_cmn_ie ie;
+} qdf_packed;
+
+
+/**
+ * struct wlan_vendor_ie_htcap: vendor private HT Capability IE
+ * @id: HT IE
+ * @hlen: HT IE len
+ * @oui: vendor OUI
+ * @oui_type: Oui type
+ * @ie: HT cap info
+ */
+struct wlan_vendor_ie_htcap {
+	uint8_t id;
+	uint8_t hlen;
+	uint8_t oui[3];
+	uint8_t oui_type;
+	struct htcap_cmn_ie ie;
+} qdf_packed;
+
+/**
+ * struct wlan_ie_htinfo_cmn: ht info comman
+ * @hi_ctrlchannel: control channel
+ * @hi_extchoff: B0-1 extension channel offset
+ * @hi_txchwidth: B2 recommended xmiss width set
+ * @hi_rifsmode: rifs mode
+ * @hi_ctrlaccess: controlled access only
+ * @hi_serviceinterval: B5-7 svc interval granularity
+ * @uhi_opmode: B0-1 operating mode
+ * @hi_nongfpresent: B2 non greenfield devices present
+ * @hi_txburstlimit: B3 transmit burst limit
+ * @hi_obssnonhtpresent: B4 OBSS non-HT STA present
+ * @hi_reserved0: B5-15 reserved
+ * @hi_reserved2: B0-5 reserved
+ * @hi_dualbeacon: B6 dual beacon
+ * @hi_dualctsprot: B7 dual CTS protection
+ * @hi_stbcbeacon: B8 STBC beacon
+ * @hi_lsigtxopprot: B9 l-sig txop protection full support
+ * @hi_pcoactive: B10 pco active
+ * @hi_pcophase: B11 pco phase
+ * @hi_reserved1: B12-15 reserved
+ * @hi_basicmcsset[16]: basic MCS set
+ */
+struct wlan_ie_htinfo_cmn {
+	uint8_t hi_ctrlchannel;
+	uint8_t hi_extchoff:2,
+		hi_txchwidth:1,
+		hi_rifsmode:1,
+		hi_ctrlaccess:1,
+		hi_serviceinterval:3;
+	uint16_t hi_opmode:2,
+		hi_nongfpresent:1,
+		hi_txburstlimit:1,
+		hi_obssnonhtpresent:1,
+		hi_reserved0:11;
+	uint16_t hi_reserved2:6,
+		hi_dualbeacon:1,
+		hi_dualctsprot:1,
+		hi_stbcbeacon:1,
+		hi_lsigtxopprot:1,
+		hi_pcoactive:1,
+		hi_pcophase:1,
+		hi_reserved1:4;
+	uint8_t  hi_basicmcsset[16];
+} qdf_packed;
+
+/**
+ * struct wlan_ie_htinfo: HT info IE
+ * @hi_id: HT info IE
+ * @hi_len: HT info IE len
+ * @hi_ie: HT info info
+ */
+struct wlan_ie_htinfo {
+	uint8_t hi_id;
+	uint8_t hi_len;
+	struct wlan_ie_htinfo_cmn  hi_ie;
+} qdf_packed;
+
+/**
+ * struct wlan_ie_htinfo: vendor private HT info IE
+ * @hi_id: HT info IE
+ * @hi_len: HT info IE len
+ * @hi_oui: vendor OUI
+ * @hi_ouitype: Oui type
+ * @hi_ie: HT info info
+ */
+struct wlan_vendor_ie_htinfo {
+	uint8_t hi_id;
+	uint8_t hi_len;
+	uint8_t hi_oui[3];
+	uint8_t hi_ouitype;
+	struct wlan_ie_htinfo_cmn hi_ie;
+} qdf_packed;
+
+/**
+ * struct wlan_ie_vhtop: VHT op IE
+ * @elem_id: VHT op IE
+ * @elem_len: VHT op IE len
+ * @vht_op_chwidth: BSS Operational Channel width
+ * @vht_op_ch_freq_seg1: Channel Center frequency
+ * @vht_op_ch_freq_seg2: Channel Center frequency for 80+80MHz
+ * @vhtop_basic_mcs_set: Basic MCS set
+ */
+struct wlan_ie_vhtop {
+	uint8_t elem_id;
+	uint8_t elem_len;
+	uint8_t vht_op_chwidth;
+	uint8_t vht_op_ch_freq_seg1;
+	uint8_t vht_op_ch_freq_seg2;
+	uint16_t vhtop_basic_mcs_set;
+} qdf_packed;
+
+/**
+ * struct wlan_country_ie: country IE
+ * @ie: country IE
+ * @len: IE len
+ * @cc: country code
+ */
+struct wlan_country_ie {
+	uint8_t ie;
+	uint8_t len;
+	uint8_t cc[3];
+} qdf_packed;
+
+/**
+ * struct wlan_bcn_frame: beacon frame fixed params
+ * @timestamp: the value of sender's TSFTIMER
+ * @beacon_interval: beacon interval
+ * @capability: capability
+ * @ie: variable IE
+ */
+struct wlan_bcn_frame {
+	uint8_t timestamp[8];
+	uint16_t beacon_interval;
+	union wlan_capability capability;
+	struct ie_header ie;
+} qdf_packed;
+
+/**
+ * struct wlan_tim_ie: tim IE
+ * @tim_ie: Time IE
+ * @tim_len: TIM IE len
+ * @tim_count: dtim count
+ * @tim_period: dtim period
+ * @tim_bitctl: bitmap control
+ * @tim_bitmap: variable length bitmap
+ */
+struct wlan_tim_ie {
+	uint8_t tim_ie;         /* WLAN_ELEMID_TIM */
+	uint8_t tim_len;
+	uint8_t tim_count;      /* DTIM count */
+	uint8_t tim_period;     /* DTIM period */
+	uint8_t tim_bitctl;     /* bitmap control */
+	uint8_t tim_bitmap[1];  /* variable-length bitmap */
+} qdf_packed;
+
+/**
+ * struct rsn_mdie: mobility domain IE
+ * @mobility_domain: mobility domain info
+ * @ft_capab: ft capability
+ */
+struct rsn_mdie {
+	uint8_t mobility_domain[3];
+	uint8_t ft_capab;
+} qdf_packed;
+
+
+/**
+ * is_wpa_oui() - If vendor IE is WPA type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is WPA
+ *
+ * Return: true if its WPA IE
+ */
+static inline bool
+is_wpa_oui(uint8_t *frm)
+{
+	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
+		((WLAN_WPA_OUI_TYPE << 24) | WLAN_WPA_OUI));
+}
+
+/**
+ * is_wps_oui() - If vendor IE is WPS type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is WPS
+ *
+ * Return: true if its WPS IE
+ */
+static inline bool
+is_wps_oui(const uint8_t *frm)
+{
+	return frm[1] > 3 && BE_READ_4(frm + 2) == WSC_OUI;
+}
+
+/**
+ * is_wcn_oui() - If vendor IE is WCN type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is WCN
+ *
+ * Return: true if its WCN IE
+ */
+static inline bool
+is_wcn_oui(uint8_t *frm)
+{
+	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
+		((WCN_OUI_TYPE << 24) | WCN_OUI));
+}
+
+/**
+ * is_wme_param() - If vendor IE is WME param type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is WME param
+ *
+ * Return: true if its WME param IE
+ */
+static inline bool
+is_wme_param(const uint8_t *frm)
+{
+	return (frm[1] > 5) && (LE_READ_4(frm + 2) ==
+			((WME_OUI_TYPE << 24) | WME_OUI)) &&
+			(frm[6] == WME_PARAM_OUI_SUBTYPE);
+}
+
+/**
+ * is_wme_info() - If vendor IE is WME info type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is WME info
+ *
+ * Return: true if its WME info IE
+ */
+static inline bool
+is_wme_info(const uint8_t *frm)
+{
+	return (frm[1] > 5) && (LE_READ_4(frm + 2) ==
+		((WME_OUI_TYPE << 24) | WME_OUI)) &&
+		(frm[6] == WME_INFO_OUI_SUBTYPE);
+}
+
+/**
+ * is_atheros_oui() - If vendor IE is Atheros type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is Atheros
+ *
+ * Return: true if its Atheros IE
+ */
+static inline bool
+is_atheros_oui(const uint8_t *frm)
+{
+	return (frm[1] > 3) && LE_READ_4(frm + 2) ==
+		((ATH_OUI_TYPE << 24) | ATH_OUI);
+}
+
+/**
+ * is_atheros_extcap_oui() - If vendor IE is Atheros ext cap
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is Atheros ext cap
+ *
+ * Return: true if its Atheros ext cap IE
+ */
+static inline int
+is_atheros_extcap_oui(uint8_t *frm)
+{
+	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
+		((ATH_OUI_EXTCAP_TYPE << 24) | ATH_OUI));
+}
+
+/**
+ * is_sfa_oui() - If vendor IE is SFA type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is SFA
+ *
+ * Return: true if its SFA IE
+ */
+static inline bool
+is_sfa_oui(uint8_t *frm)
+{
+	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
+		((SFA_OUI_TYPE << 24) | SFA_OUI));
+}
+
+/**
+ * is_p2p_oui() - If vendor IE is P2P type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is P2P
+ *
+ * Return: true if its P2P IE
+ */
+static inline bool
+is_p2p_oui(const uint8_t *frm)
+{
+	const uint8_t wfa_oui[3] = P2P_WFA_OUI;
+
+	return (frm[1] >= 4) &&
+		(frm[2] == wfa_oui[0]) &&
+		(frm[3] == wfa_oui[1]) &&
+		(frm[4] == wfa_oui[2]) &&
+		(frm[5] == P2P_WFA_VER);
+}
+
+/**
+ * is_qca_whc_oui() - If vendor IE is QCA WHC type
+ * @frm: vendor IE pointer
+ * @whc_subtype: subtype
+ *
+ * API to check if vendor IE is QCA WHC
+ *
+ * Return: true if its QCA WHC IE
+ */
+static inline bool
+is_qca_whc_oui(uint8_t *frm, uint8_t whc_subtype)
+{
+	return (frm[1] > 4) && (LE_READ_4(frm + 2) ==
+		((QCA_OUI_WHC_TYPE << 24) | QCA_OUI)) &&
+		(*(frm + 6) == whc_subtype);
+}
+
+/**
+ * is_ht_cap() - If vendor IE is vendor HT cap type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is vendor HT cap
+ *
+ * Return: true if its vendor HT cap IE
+ */
+static inline bool
+is_ht_cap(uint8_t *frm)
+{
+	return (frm[1] > 3) && (BE_READ_4(frm + 2) ==
+		((VENDOR_HT_OUI << 8) | VENDOR_HT_CAP_ID));
+}
+
+/**
+ * is_ht_info() - If vendor IE is vendor HT info type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is vendor HT info
+ *
+ * Return: true if its vendor HT info IE
+ */
+static inline bool
+is_ht_info(uint8_t *frm)
+{
+	return (frm[1] > 3) && (BE_READ_4(frm + 2) ==
+		((VENDOR_HT_OUI << 8) | VENDOR_HT_INFO_ID));
+}
+
+/**
+ * is_interop_vht() - If vendor IE is VHT interop
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is VHT interop
+ *
+ * Return: true if its VHT interop IE
+ */
+static inline bool
+is_interop_vht(uint8_t *frm)
+{
+	return (frm[1] > 12) && (BE_READ_4(frm + 2) ==
+		((VHT_INTEROP_OUI << 8) | VHT_INTEROP_TYPE)) &&
+		((*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE) ||
+		(*(frm + 6) == VHT_INTEROP_OUI_SUBTYPE_VENDORSPEC));
+}
+
+/**
+ * is_bwnss_oui() - If vendor IE is BW NSS type
+ * @frm: vendor IE pointer
+ *
+ * API to check if vendor IE is BW NSS
+ *
+ * Return: true if its BW NSS IE
+ */
+static inline bool
+is_bwnss_oui(uint8_t *frm)
+{
+	return (frm[1] > 3) && (LE_READ_4(frm + 2) ==
+		((ATH_OUI_BW_NSS_MAP_TYPE << 24) | ATH_OUI));
+}
+
+/**
+ * wlan_parse_rsn_ie() - parse rsn ie
+ * @rsn_ie: rsn ie ptr
+ * @rsn: out structure for the parsed ie
+ *
+ * API, function to parse rsn ie
+ *
+ * Return: void
+ */
+static inline void wlan_parse_rsn_ie(uint8_t *rsn_ie,
+	struct wlan_rsn_ie *rsn)
+{
+	uint8_t len, i;
+	uint8_t *ie;
+
+	if (!rsn_ie)
+		return;
+
+	ie = rsn_ie;
+	len = ie[1];
+	/*
+	 * Check the length once for fixed parts:
+	 * version, mcast cipher, and 2 selector counts.
+	 * Other, variable-length data, must be checked separately.
+	 */
+	if (len < 10)
+		return;
+
+	ie += 2;
+
+	rsn->ver = LE_READ_2(ie);
+	if (rsn->ver != RSN_VERSION)
+		return;
+
+	ie += 2;
+	len -= 2;
+	rsn->gp_cipher_suite  = LE_READ_4(ie);
+	ie += WLAN_OUI_SIZE;
+	len -= WLAN_OUI_SIZE;
+
+	rsn->pwise_cipher_count = LE_READ_2(ie);
+	ie += 2;
+	len -= 2;
+	if ((rsn->pwise_cipher_count > WLAN_MAX_CIPHER) ||
+	   len < (rsn->pwise_cipher_count * WLAN_OUI_SIZE + 2))
+		return;
+	for (i = 0 ; i < rsn->pwise_cipher_count; i++) {
+		rsn->pwise_cipher_suites[i] = LE_READ_4(ie);
+		ie += WLAN_OUI_SIZE;
+		len -= WLAN_OUI_SIZE;
+	}
+
+	rsn->akm_suite_count = LE_READ_2(ie);
+	ie += 2;
+	len -= 2;
+	if ((rsn->akm_suite_count > WLAN_MAX_CIPHER) ||
+	   len < (rsn->akm_suite_count * WLAN_OUI_SIZE))
+		return;
+	for (i = 0 ; i < rsn->akm_suite_count; i++) {
+		rsn->akm_suites[i] = LE_READ_4(ie);
+		ie += WLAN_OUI_SIZE;
+		len -= WLAN_OUI_SIZE;
+	}
+
+	if (len >= 2) {
+		rsn->cap = LE_READ_2(ie);
+		ie += 2;
+		len -= 2;
+	}
+	if (len >= 2) {
+		rsn->pmkid_count = LE_READ_2(ie);
+		ie += 2;
+		len -= 2;
+
+		if ((rsn->pmkid_count > MAX_PMKID) ||
+		   len < (rsn->pmkid_count * PMKID_LEN))
+			return;
+
+		qdf_mem_copy(rsn->pmkid, ie,
+			rsn->pmkid_count * PMKID_LEN);
+
+		ie += rsn->pmkid_count * PMKID_LEN;
+		len -= rsn->pmkid_count * PMKID_LEN;
+	}
+
+	if (len >= WLAN_OUI_SIZE)
+		rsn->mgmt_cipher_suite = LE_READ_4(ie);
+}
+
+/**
+ * wlan_parse_wpa_ie() - parse wpa ie
+ * @wpa_ie: wpa ie ptr
+ * @wpa: out structure for the parsed ie
+ *
+ * API, function to parse wpa ie
+ *
+ * Return: void
+ */
+static inline void wlan_parse_wpa_ie(uint8_t *wpa_ie,
+	struct wlan_wpa_ie *wpa)
+{
+	uint8_t len, i;
+	uint8_t *ie;
+
+	if (!wpa_ie)
+		return;
+
+	ie = wpa_ie;
+	len = ie[1];
+	/*
+	 * Check the length once for fixed parts: OUI, type,
+	 * version, mcast cipher, and 2 selector counts.
+	 * Other, variable-length data, must be checked separately.
+	 */
+	if (len < 14)
+		return;
+
+	/* skip OUI type validation as its already validated */
+	ie += 6;
+	len -= 4;
+
+	wpa->ver = LE_READ_2(ie);
+	if (wpa->ver != WPA_VERSION)
+		return;
+
+	ie += 2;
+	len -= 2;
+
+	wpa->mc_cipher = LE_READ_4(ie);
+	ie += WLAN_OUI_SIZE;
+	len -= WLAN_OUI_SIZE;
+
+	wpa->uc_cipher_count = LE_READ_2(ie);
+	ie += 2;
+	len -= 2;
+
+	if ((wpa->uc_cipher_count > WLAN_MAX_CIPHER) ||
+	   len < (wpa->uc_cipher_count * WLAN_OUI_SIZE + 2))
+		return;
+	for (i = 0 ; i < wpa->uc_cipher_count; i++) {
+		wpa->uc_ciphers[i] = LE_READ_4(ie);
+		ie += WLAN_OUI_SIZE;
+		len -= WLAN_OUI_SIZE;
+	}
+
+	wpa->auth_suite_count = LE_READ_2(ie);
+	ie += 2;
+	len -= 2;
+
+	if ((wpa->auth_suite_count > WLAN_MAX_CIPHER) ||
+	   len < (wpa->auth_suite_count * WLAN_OUI_SIZE))
+		return;
+	for (i = 0 ; i < wpa->auth_suite_count; i++) {
+		wpa->auth_suites[i] = LE_READ_4(ie);
+		ie += WLAN_OUI_SIZE;
+		len -= WLAN_OUI_SIZE;
+	}
+}
+
+/**
+ * wlan_parse_wapi_ie() - parse wapi ie
+ * @wapi_ie: wpa ie ptr
+ * @wapi: out structure for the parsed  IE
+ *
+ * API, function to parse wapi ie
+ *
+ * Return: void
+ */
+static inline void wlan_parse_wapi_ie(uint8_t *wapi_ie,
+	struct wlan_wapi_ie *wapi)
+{
+	uint8_t len, i;
+	uint8_t *ie;
+
+	if (!wapi_ie)
+		return;
+
+	ie = wapi_ie;
+	len = ie[1];
+	/*
+	 * Check the length once for fixed parts: OUI, type,
+	 * version, mcast cipher, and 2 selector counts.
+	 * Other, variable-length data, must be checked separately.
+	 */
+	if (len < 20)
+		return;
+
+	ie += 2;
+
+	wapi->ver = LE_READ_2(ie);
+	if (wapi->ver != WAPI_VERSION)
+		return;
+
+	ie += 2;
+	len -= 2;
+
+	/* akm */
+	wapi->akm_suite_count = LE_READ_2(ie);
+
+	ie += 2;
+	len -= 2;
+
+	if ((wapi->akm_suite_count > WLAN_MAX_CIPHER) ||
+		   len < (wapi->akm_suite_count * WLAN_OUI_SIZE))
+		return;
+	for (i = 0 ; i < wapi->akm_suite_count; i++) {
+		wapi->akm_suites[i] = LE_READ_4(ie);
+		ie += WLAN_OUI_SIZE;
+		len -= WLAN_OUI_SIZE;
+	}
+
+	wapi->uc_cipher_count = LE_READ_2(ie);
+	ie += 2;
+	len -= 2;
+	if ((wapi->uc_cipher_count > WLAN_MAX_CIPHER) ||
+	   len < (wapi->uc_cipher_count * WLAN_OUI_SIZE + 2))
+		return;
+	for (i = 0 ; i < wapi->uc_cipher_count; i++) {
+		wapi->uc_cipher_suites[i] = LE_READ_4(ie);
+		ie += WLAN_OUI_SIZE;
+		len -= WLAN_OUI_SIZE;
+	}
+
+	if (len >= WLAN_OUI_SIZE)
+		wapi->mc_cipher_suite = LE_READ_4(ie);
+}
+
+#endif /* _WLAN_CMN_IEEE80211_DEFS_H_ */
diff --git a/umac/cmn_services/inc/wlan_cmn.h b/umac/cmn_services/inc/wlan_cmn.h
index f7107ed..7519bf1 100644
--- a/umac/cmn_services/inc/wlan_cmn.h
+++ b/umac/cmn_services/inc/wlan_cmn.h
@@ -22,6 +22,8 @@
 #ifndef _WLAN_CMN_H_
 #define _WLAN_CMN_H_
 
+#include <qdf_types.h>
+
 /* Max no of UMAC components */
 #define WLAN_UMAC_MAX_COMPONENTS 25
 /* Max no. of radios, a pSoc/Device can support */
@@ -75,9 +77,11 @@
 /**
  * enum wlan_umac_comp_id - UMAC component id
  * @WLAN_UMAC_COMP_MLME:     MLME
- * @WLAN_UMAC_COMP_SCAN:     SCAN MGR
  * @WLAN_UMAC_COMP_MGMT_TXRX:   MGMT Tx/Rx
  * @WLAN_UMAC_COMP_SERIALIZATION: Serialization
+ * @WLAN_UMAC_COMP_SCAN: SCAN - as scan module uses services provided by
+ *                       MLME, MGMT_TXRX and SERIALIZATION, SCAN module
+ *                       must be initializes after above modules.
  * @WLAN_UMAC_COMP_PMO:         PMO component
  * @WLAN_UMAC_COMP_P2P:      P2P
  * @WLAN_UMAC_COMP_ID_MAX: Maximum components in UMAC
@@ -87,9 +91,9 @@
  */
 enum wlan_umac_comp_id {
 	WLAN_UMAC_COMP_MLME           = 0,
-	WLAN_UMAC_COMP_SCAN           = 1,
-	WLAN_UMAC_COMP_MGMT_TXRX      = 2,
-	WLAN_UMAC_COMP_SERIALIZATION  = 3,
+	WLAN_UMAC_COMP_MGMT_TXRX      = 1,
+	WLAN_UMAC_COMP_SERIALIZATION  = 2,
+	WLAN_UMAC_COMP_SCAN           = 3,
 	WLAN_UMAC_COMP_PMO            = 4,
 	WLAN_UMAC_COMP_P2P            = 5,
 	WLAN_UMAC_COMP_ID_MAX,
@@ -173,6 +177,126 @@
 	WLAN_PEER_IBSS     = 7,
 };
 
+/**
+ * enum wlan_band - specifies operating channel band
+ * @WLAN_BAND_ALL: Any band
+ * @WLAN_BAND_2_4_GHZ: 2.4 GHz band
+ * @WLAN_BAND_5_GHZ: 5 GHz band
+ * @WLAN_BAND_4_9_GHZ: 4.9 GHz band
+ */
+enum wlan_band {
+	WLAN_BAND_ALL,
+	WLAN_BAND_2_4_GHZ,
+	WLAN_BAND_5_GHZ,
+	WLAN_BAND_4_9_GHZ,
+};
+
+/**
+ * enum wlan_bss_type - type of network
+ * @WLAN_TYPE_ANY: Default value
+ * @WLAN_TYPE_BSS: Type BSS
+ * @WLAN_TYPE_IBSS: Type IBSS
+ */
+enum wlan_bss_type {
+	WLAN_TYPE_ANY,
+	WLAN_TYPE_BSS,
+	WLAN_TYPE_IBSS,
+};
+
+/**
+ * enum wlan_pmf_cap: pmf capability
+ * @PMF_DISABLED: PMF is disabled
+ * @PMF_CAPABLE: PMF is supported
+ * @PMF_REQUIRED: PMF is mandatory
+ */
+enum wlan_pmf_cap {
+	WLAN_PMF_DISABLED,
+	WLAN_PMF_CAPABLE,
+	WLAN_PMF_REQUIRED,
+};
+
+/**
+ * enum wlan_auth_type - Enumeration of the various Auth types
+ * @WLAN_AUTH_TYPE_OPEN_SYSTEM: Open auth type
+ * @WLAN_AUTH_TYPE_SHARED_KEY: Shared Key Auth type
+ * @WLAN_AUTH_TYPE_AUTOSWITCH: Auto switch Open/Shared
+ * @WLAN_AUTH_TYPE_WPA: WPA Enterprise
+ * @WLAN_AUTH_TYPE_WPA_PSK: WPA PSK
+ * @WLAN_AUTH_TYPE_WPA_NONE: WPA None
+ * @WLAN_AUTH_TYPE_RSN: RSN Enterprise
+ * @WLAN_AUTH_TYPE_RSN_PSK: RSN PSK
+ * @WLAN_AUTH_TYPE_FT_RSN: FT RSN Enterprise
+ * @WLAN_AUTH_TYPE_FT_RSN_PSK: FT RSN PSK
+ * @WLAN_AUTH_TYPE_WAPI_WAI_CERTIFICATE: WAPI certificate
+ * @WLAN_AUTH_TYPE_WAPI_WAI_PSK: WAPI PSK
+ * @WLAN_AUTH_TYPE_CCKM_WPA: CCKM WPA
+ * @WLAN_AUTH_TYPE_CCKM_RSN: CCKM RSN
+ * @WLAN_AUTH_TYPE_RSN_PSK_SHA256: SHA256 PSK
+ * @WLAN_AUTH_TYPE_RSN_8021X_SHA256: SHA256 Enterprise
+ * @WLAN_NUM_OF_SUPPORT_AUTH_TYPE: Max no of Auth type
+ */
+enum wlan_auth_type {
+	WLAN_AUTH_TYPE_OPEN_SYSTEM,
+	WLAN_AUTH_TYPE_SHARED_KEY,
+	WLAN_AUTH_TYPE_AUTOSWITCH,
+	WLAN_AUTH_TYPE_WPA,
+	WLAN_AUTH_TYPE_WPA_PSK,
+	WLAN_AUTH_TYPE_WPA_NONE,
+	WLAN_AUTH_TYPE_RSN,
+	WLAN_AUTH_TYPE_RSN_PSK,
+	WLAN_AUTH_TYPE_FT_RSN,
+	WLAN_AUTH_TYPE_FT_RSN_PSK,
+	WLAN_AUTH_TYPE_WAPI_WAI_CERTIFICATE,
+	WLAN_AUTH_TYPE_WAPI_WAI_PSK,
+	WLAN_AUTH_TYPE_CCKM_WPA,
+	WLAN_AUTH_TYPE_CCKM_RSN,
+	WLAN_AUTH_TYPE_RSN_PSK_SHA256,
+	WLAN_AUTH_TYPE_RSN_8021X_SHA256,
+	WLAN_NUM_OF_SUPPORT_AUTH_TYPE,
+};
+
+/**
+ * enum wlan_enc_type - Enumeration of the various Enc types
+ * @WLAN_ENCRYPT_TYPE_NONE: No encryption
+ * @WLAN_ENCRYPT_TYPE_WEP40_STATICKEY: WEP 40 Static key
+ * @WLAN_ENCRYPT_TYPE_WEP104_STATICKEY: WEP 104 Static key
+ * @WLAN_ENCRYPT_TYPE_WEP40: WEP 40
+ * @WLAN_ENCRYPT_TYPE_WEP104: WEP 104
+ * @WLAN_ENCRYPT_TYPE_TKIP: TKIP
+ * @WLAN_ENCRYPT_TYPE_AES: AES
+ * @WLAN_ENCRYPT_TYPE_WPI: WAPI
+ * @WLAN_ENCRYPT_TYPE_KRK: KRK
+ * @WLAN_ENCRYPT_TYPE_BTK: BTK
+ * @WLAN_ENCRYPT_TYPE_AES_CMAC: 11W BIP
+ * @WLAN_ENCRYPT_TYPE_ANY: Any
+ * @WLAN_NUM_OF_ENCRYPT_TYPE: Max value
+ */
+enum wlan_enc_type {
+	WLAN_ENCRYPT_TYPE_NONE,
+	WLAN_ENCRYPT_TYPE_WEP40_STATICKEY,
+	WLAN_ENCRYPT_TYPE_WEP104_STATICKEY,
+	WLAN_ENCRYPT_TYPE_WEP40,
+	WLAN_ENCRYPT_TYPE_WEP104,
+	WLAN_ENCRYPT_TYPE_TKIP,
+	WLAN_ENCRYPT_TYPE_AES,
+	WLAN_ENCRYPT_TYPE_WPI,
+	WLAN_ENCRYPT_TYPE_KRK,
+	WLAN_ENCRYPT_TYPE_BTK,
+	WLAN_ENCRYPT_TYPE_AES_CMAC,
+	WLAN_ENCRYPT_TYPE_ANY,
+	WLAN_NUM_OF_ENCRYPT_TYPE = WLAN_ENCRYPT_TYPE_ANY,
+};
+
+/**
+ * struct wlan_ssid - SSID info
+ * @length: ssid length of bss excluding null
+ * @ssid: ssid character array potentially non null terminated
+ */
+struct wlan_ssid {
+	uint8_t length;
+	uint8_t ssid[WLAN_SSID_MAX_LEN];
+};
+
 /* MAC address length */
 #define WLAN_MACADDR_LEN 6
 /* Util API to copy the MAC address */
diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h
index fe7843b..c0db682 100644
--- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h
+++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h
@@ -721,4 +721,20 @@
 void wlan_objmgr_pdev_release_ref(struct wlan_objmgr_pdev *pdev,
 						wlan_objmgr_ref_dbgid id);
 
+/**
+ * wlan_objmgr_pdev_get_pdev_id() - get pdev id
+ * @pdev: PDEV object
+ *
+ * API to get pdev id from pdev object
+ *
+ * Caller need to acquire lock with wlan_pdev_obj_lock()
+ *
+ * Return: @pdev id
+ */
+static inline
+uint8_t wlan_objmgr_pdev_get_pdev_id(struct wlan_objmgr_pdev *pdev)
+{
+	/* This API is invoked with lock acquired, do not add log prints */
+	return pdev->pdev_objmgr.wlan_pdev_id;
+}
 #endif /* _WLAN_OBJMGR_PDEV_H_*/
diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c
new file mode 100644
index 0000000..ee680f8
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_cache_db.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan cache api and functionality
+ */
+
diff --git a/umac/scan/core/src/wlan_scan_cache_db.h b/umac/scan/core/src/wlan_scan_cache_db.h
new file mode 100644
index 0000000..aaaa9e3
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_cache_db.h
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan cache entry api
+ */
+
+#ifndef _WLAN_SCAN_CACHE_DB_H_
+#define _WLAN_SCAN_CACHE_DB_H_
+
+#include <scheduler_api.h>
+#include <wlan_scan_public_structs.h>
+
+#define SCAN_HASH_SIZE 64
+#define SCAN_GET_HASH(addr) \
+	(((const uint8_t *)(addr))[QDF_MAC_ADDR_SIZE - 1] % SCAN_HASH_SIZE)
+#define MAX_SCAN_CACHE_SIZE 300
+/* Hidden ssid age time in millisec */
+#define HIDDEN_SSID_TIME (1*60*1000)
+
+/**
+ * struct scan_dbs - scan cache data base definition
+ * @num_entries: number of scan entries
+ * @scan_hash_tbl: link list of bssid hashed scan cache entries for a pdev
+ */
+struct scan_dbs {
+	uint32_t num_entries;
+	qdf_spinlock_t scan_db_lock;
+	qdf_list_t scan_hash_tbl[SCAN_HASH_SIZE];
+};
+
+/**
+ * struct scan_bcn_probe_event - beacon/probe info
+ * @frm_type: frame type
+ * @rx_data: mgmt rx data
+ * @psoc: psoc pointer
+ * @buf: rx frame
+ */
+struct scan_bcn_probe_event {
+	uint32_t frm_type;
+	struct mgmt_rx_event_params *rx_data;
+	struct wlan_objmgr_psoc *psoc;
+	qdf_nbuf_t buf;
+};
+
+/**
+ * scm_handle_bcn_probe() - Process beacon and probe rsp
+ * @bcn: beacon info;
+ *
+ * API to handle the beacon/probe resp
+ *
+ * Return: QDF status.
+ */
+QDF_STATUS scm_handle_bcn_probe(struct scheduler_msg *msg);
+
+/**
+ * scm_flush_scan_entry() - API to flush the scan entry
+ * @scan_db: scan database
+ * @scan_entry:entry scan_node
+ *
+ * API to flush the scan entry
+ *
+ * Return: QDF status.
+ */
+QDF_STATUS scm_flush_scan_entry(struct scan_dbs *scan_db,
+	struct scan_cache_node *scan_node);
+
+/**
+ * scm_get_scan_result() - fetches scan result
+ * @pdev: pdev info
+ * @filter: Filters
+ *
+ * This function fetches scan result
+ *
+ * Return: scan list
+ */
+qdf_list_t *scm_get_scan_result(struct wlan_objmgr_pdev *pdev,
+	struct scan_filter *filter);
+
+/**
+ * scm_purge_scan_results() - purge the scan list
+ * @scan_result: scan list to be purged
+ *
+ * This function purge the temp scan list
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS scm_purge_scan_results(qdf_list_t *scan_result);
+
+/**
+ * scm_update_scan_mlme_info() - updates scan entry with mlme data
+ * @mlme_info: mlme info to be updated in scan db
+ *
+ * This function updates scan db with mlme data
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS scm_update_scan_mlme_info(struct mlme_update_info *mlme_info);
+
+/**
+ * scm_flush_results() - flush scan entries matching the filter
+ * @pdev: vdev object
+ * @filter: filter to flush the scan entries
+ *
+ * Flush scan entries matching the filter.
+ *
+ * Return: QDF status.
+ */
+QDF_STATUS scm_flush_results(struct wlan_objmgr_pdev *pdev,
+	struct scan_filter *filter);
+
+/**
+ * scm_filter_valid_channel() - The Public API to filter scan result
+ * based on valid channel list
+ * @pdev: pdev object
+ * @chan_list: valid channel list
+ * @num_chan: number of valid channels
+ *
+ * The Public API to to filter scan result
+ * based on valid channel list.
+ *
+ * Return: void.
+ */
+void scm_filter_valid_channel(struct wlan_objmgr_pdev *pdev,
+	uint8_t *chan_list, uint32_t num_chan);
+
+/**
+ * scm_iterate_scan_db() - function to iterate scan table
+ * @pdev: pdev object
+ * @func: iterator function pointer
+ * @arg: argument to be passed to func()
+ *
+ * API, this API iterates scan table and invokes func
+ * on each scan enetry by passing scan entry and arg.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+scm_iterate_scan_db(struct wlan_objmgr_pdev *pdev,
+	scan_iterator_func func, void *arg);
+
+/**
+ * scm_scan_register_bcn_cb() - API to register api to indicate bcn/probe
+ * as soon as they are received
+ * @pdev: psoc
+ * @cb: callback to be registered
+ * @type: Type of callback to be registered
+ *
+ * Return: enum scm_scan_status
+ */
+QDF_STATUS scm_scan_register_bcn_cb(struct wlan_objmgr_psoc *psoc,
+	update_beacon_cb cb, enum scan_cb_type type);
+
+/**
+ * scm_db_init() - API to init scan db
+ * @psoc: psoc
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS scm_db_init(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * scm_db_deinit() - API to deinit scan db
+ * @psoc: psoc
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS scm_db_deinit(struct wlan_objmgr_psoc *psoc);
+#endif
diff --git a/umac/scan/core/src/wlan_scan_cache_db_i.h b/umac/scan/core/src/wlan_scan_cache_db_i.h
new file mode 100644
index 0000000..1f22e62
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_cache_db_i.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan cache internal api
+ */
+
+#ifndef _WLAN_SCAN_CACHE_DB_I_H_
+#define _WLAN_SCAN_CACHE_DB_I_H_
+
+/**
+ * wlan_pdevid_get_scan_db() - private API to get scan db from pdev id
+ * @psoc: psoc object
+ * @pdev_id: Pdev_id
+ * Return: scan db for the pdev id
+ */
+static inline struct scan_dbs *
+wlan_pdevid_get_scan_db(struct wlan_objmgr_psoc *psoc, uint8_t pdev_id)
+{
+	struct wlan_scan_obj *scan_obj = NULL;
+
+	if (pdev_id > WLAN_UMAC_MAX_PDEVS) {
+		scm_err("invalid pdev_id %d", pdev_id);
+		return NULL;
+	}
+	scan_obj = wlan_psoc_get_scan_obj(psoc);
+
+	if (!scan_obj)
+		return NULL;
+
+	return &(scan_obj->scan_db[pdev_id]);
+}
+
+/**
+ * wlan_pdev_get_scan_db() - private API to get scan db from pdev
+ * @psoc: psoc object
+ * @pdev: Pdev
+ *
+ * Return: scan db for the pdev
+ */
+static inline struct scan_dbs *
+wlan_pdev_get_scan_db(struct wlan_objmgr_psoc *psoc,
+	struct wlan_objmgr_pdev *pdev)
+{
+	uint8_t pdev_id;
+
+	if (!pdev) {
+		scm_err("pdev is NULL");
+		return NULL;
+	}
+	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
+
+	return wlan_pdevid_get_scan_db(psoc, pdev_id);
+}
+#endif
diff --git a/umac/scan/core/src/wlan_scan_cache_db_ops.c b/umac/scan/core/src/wlan_scan_cache_db_ops.c
new file mode 100644
index 0000000..0604a42
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_cache_db_ops.c
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/*
+ * DOC: contains scan cache operations
+ */
diff --git a/umac/scan/core/src/wlan_scan_main.c b/umac/scan/core/src/wlan_scan_main.c
new file mode 100644
index 0000000..7c8c38e
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_main.c
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains core scan function definitions
+ */
+
diff --git a/umac/scan/core/src/wlan_scan_main.h b/umac/scan/core/src/wlan_scan_main.h
new file mode 100644
index 0000000..0166feb
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_main.h
@@ -0,0 +1,407 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan init/deinit public api
+ */
+
+#ifndef _WLAN_SCAN_MAIN_API_H_
+#define _WLAN_SCAN_MAIN_API_H_
+
+#include <qdf_atomic.h>
+#include <wlan_scan_structs.h>
+#include "wlan_scan_cache_db.h"
+
+#define scm_log(level, args...) \
+		QDF_TRACE(QDF_MODULE_ID_SCAN, level, ## args)
+#define scm_logfl(level, format, args...) \
+		scm_log(level, FL(format), ## args)
+#define scm_alert(format, args...) \
+		scm_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
+#define scm_err(format, args...) \
+		scm_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
+#define scm_warn(format, args...) \
+		scm_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
+#define scm_notice(format, args...) \
+		scm_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
+#define scm_info(format, args...) \
+		scm_logfl(QDF_TRACE_LEVEL_INFO_HIGH, format, ## args)
+#define scm_debug(format, args...) \
+		scm_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
+
+#define MAX_SCAN_EVENT_HANDLERS_PER_PDEV   100
+#define WLAN_MAX_MODULE_NAME    40
+#define WLAN_MAX_REQUESTORS     200
+#define WLAN_SCAN_ID_MASK 0x00000FFF
+#define WLAN_HOST_SCAN_REQ_ID_PREFIX 0x0000A000
+#define WLAN_SCAN_REQUESTER_ID_PREFIX 0x0000A000
+
+#ifdef CONFIG_MCL
+#define SCAN_ACTIVE_DWELL_TIME 20
+#define SCAN_PASSIVE_DWELL_TIME 100
+#define SCAN_MAX_REST_TIME 20
+#define SCAN_MIN_REST_TIME 0
+#define SCAN_BURST_DURATION 20
+#define SCAN_CONC_ACTIVE_DWELL_TIME 20
+#define SCAN_CONC_PASSIVE_DWELL_TIME 100
+#define SCAN_CONC_IDLE_TIME 25
+#define SCAN_CONC_MAX_REST_TIME 20
+#define SCAN_CONC_MIN_REST_TIME 10
+#define SCAN_REPEAT_PROBE_TIME 11
+#define SCAN_PROBE_SPACING_TIME 0
+#define SCAN_PROBE_DELAY 0
+#define SCAN_MAX_SCAN_TIME 30000
+#define SCAN_NUM_PROBES 3
+#define SCAN_NETWORK_IDLE_TIMEOUT 0
+#else
+#define SCAN_ACTIVE_DWELL_TIME 105
+#define SCAN_PASSIVE_DWELL_TIME 300
+#define SCAN_MAX_REST_TIME 0
+#define SCAN_MIN_REST_TIME 50
+#define SCAN_BURST_DURATION 0
+#define SCAN_CONC_ACTIVE_DWELL_TIME 0
+#define SCAN_CONC_PASSIVE_DWELL_TIME 0
+#define SCAN_CONC_IDLE_TIME 0
+#define SCAN_CONC_MAX_REST_TIME 0
+#define SCAN_CONC_MIN_REST_TIME 0
+#define SCAN_REPEAT_PROBE_TIME 50
+#define SCAN_PROBE_SPACING_TIME 0
+#define SCAN_PROBE_DELAY 0
+#define SCAN_MAX_SCAN_TIME 50000
+#define SCAN_NUM_PROBES 0
+#define SCAN_NETWORK_IDLE_TIMEOUT 200
+#endif
+
+#define SCAN_TIMEOUT_GRACE_PERIOD 10
+/* scan age time in millisec */
+#define SCAN_CACHE_AGING_TIME (300*1000)
+#define SCAN_MAX_BSS_PDEV 100
+#define SCAN_MAX_NUM_SCAN_ALLOWED 8
+#define SCAN_PRIORITY SCAN_PRIORITY_LOW
+
+/**
+ * struct cb_handler - defines scan event handler
+ * call back function and arguments
+ * @func: handler function pointer
+ * @arg: argument to handler function
+ */
+struct cb_handler {
+	scan_event_handler func;
+	void *arg;
+};
+
+/**
+ * struct pdev_scan_ev_handler - pdev scan event handlers
+ * @cb_handler: array of registered scan handlers
+ */
+struct pdev_scan_ev_handler {
+	uint32_t handler_cnt;
+	struct cb_handler cb_handlers[MAX_SCAN_EVENT_HANDLERS_PER_PDEV];
+};
+
+/**
+ * struct global_scan_ev_handlers - per pdev registered scan event handlers
+ * @pdev_scan_ev_handler: per pdev registered scan event handlers
+ */
+struct global_scan_ev_handlers {
+	struct pdev_scan_ev_handler pdev_ev_handlers[WLAN_UMAC_MAX_PDEVS];
+};
+
+/**
+ * struct scan_requester_info - defines scan requester id
+ * and event handler mapping
+ * @requester:   requester ID allocated
+ * @module:      module name of requester
+ * @ev_handler:  event handlerto be invoked
+ */
+struct scan_requester_info {
+	wlan_scan_requester requester;
+	uint8_t module[WLAN_MAX_MODULE_NAME];
+	struct cb_handler ev_handler;
+};
+
+/**
+ * struct pdev_scan_info - defines per pdev scan info
+ * @last_scan_time: time of last scan start on this pdev
+ */
+
+struct pdev_scan_info {
+	qdf_time_t last_scan_time;
+};
+
+/**
+ * struct scan_default_params - default scan parameters to be used
+ * @active_dwell: default active dwell time
+ * @passive_dwell:default passive dwell time
+ * @max_rest_time: default max rest time
+ * @min_rest_time: default min rest time
+ * @idle_time: default idle time
+ * @conc_active_dwell: default concurrent active dwell time
+ * @conc_passive_dwell: default concurrent passive dwell time
+ * @conc_max_rest_time: default concurrent max rest time
+ * @conc_min_rest_time: default concurrent min rest time
+ * @conc_idle_time: default concurrent idle time
+ * @repeat_probe_time: default repeat probe time
+ * @probe_spacing_time: default probe spacing time
+ * @probe_delay: default probe delay
+ * @burst_duration: default burst duration
+ * @max_scan_time: default max scan time
+ * @num_probes: default maximum number of probes to sent
+ * @cache_aging_time: default scan cache aging time
+ * @max_bss_per_pdev: maximum number of bss entries to be maintained per pdev
+ * @max_num_scan_allowed: maximum number of parallel scan allowed per psoc
+ * @scan_priority: default scan priority
+ * @scan_f_passive: passively scan all channels including active channels
+ * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified
+ * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req
+ * @scan_f_ofdm_rates: add ofdm rates to rates/xrates ie in prb req
+ * @scan_f_chan_stat_evnt: enable indication of chan load and noise floor
+ * @scan_f_filter_prb_req: filter Probe request frames
+ * @scan_f_bypass_dfs_chn: when set, do not scan DFS channels
+ * @scan_f_continue_on_err:continue scan even if few certain erros have occurred
+ * @scan_f_offchan_mgmt_tx: allow mgmt transmission during off channel scan
+ * @scan_f_offchan_data_tx: allow data transmission during off channel scan
+ * @scan_f_promisc_mode: scan with promiscuous mode
+ * @scan_f_capture_phy_err: enable capture ppdu with phy errrors
+ * @scan_f_strict_passive_pch: do passive scan on passive channels
+ * @scan_f_half_rate: enable HALF (10MHz) rate support
+ * @scan_f_quarter_rate: set Quarter (5MHz) rate support
+ * @scan_f_force_active_dfs_chn: allow to send probe req on DFS channel
+ * @scan_f_add_tpc_ie_in_probe: add TPC ie in probe req frame
+ * @scan_f_add_ds_ie_in_probe: add DS ie in probe req frame
+ * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe
+ * @scan_f_add_rand_seq_in_probe: use random sequence number in probe
+ * @scan_f_en_ie_whitelist_in_probe: enable ie whitelist in probe
+ * @scan_flags: variable to read and set scan_f_* flags in one shot
+ *              can be used to dump all scan_f_* flags for debug
+ * @scan_ev_started: notify scan started event
+ * @scan_ev_completed: notify scan completed event
+ * @scan_ev_bss_chan: notify bss chan event
+ * @scan_ev_foreign_chan: notify foreign chan event
+ * @scan_ev_dequeued: notify scan request dequed event
+ * @scan_ev_preempted: notify scan preempted event
+ * @scan_ev_start_failed: notify scan start failed event
+ * @scan_ev_restarted: notify scan restarted event
+ * @scan_ev_foreign_chn_exit: notify foreign chan exit event
+ * @scan_ev_invalid: notify invalid scan request event
+ * @scan_ev_gpio_timeout: notify gpio timeout event
+ * @scan_ev_suspended: notify scan suspend event
+ * @scan_ev_resumed: notify scan resumed event
+ * @scan_events: variable to read and set scan_ev_* flags in one shot
+ *               can be used to dump all scan_ev_* flags for debug
+ */
+struct scan_default_params {
+	uint32_t active_dwell;
+	uint32_t passive_dwell;
+	uint32_t max_rest_time;
+	uint32_t min_rest_time;
+	uint32_t idle_time;
+	uint32_t conc_active_dwell;
+	uint32_t conc_passive_dwell;
+	uint32_t conc_max_rest_time;
+	uint32_t conc_min_rest_time;
+	uint32_t conc_idle_time;
+	uint32_t repeat_probe_time;
+	uint32_t probe_spacing_time;
+	uint32_t probe_delay;
+	uint32_t burst_duration;
+	uint32_t max_scan_time;
+	uint32_t num_probes;
+	uint32_t scan_cache_aging_time;
+	uint16_t max_bss_per_pdev;
+	uint8_t max_num_scan_allowed;
+	enum scan_priority scan_priority;
+	union {
+		struct {
+			uint32_t scan_f_passive:1,
+				scan_f_bcast_probe:1,
+				scan_f_cck_rates:1,
+				scan_f_ofdm_rates:1,
+				scan_f_chan_stat_evnt:1,
+				scan_f_filter_prb_req:1,
+				scan_f_bypass_dfs_chn:1,
+				scan_f_continue_on_err:1,
+				scan_f_offchan_mgmt_tx:1,
+				scan_f_offchan_data_tx:1,
+				scan_f_promisc_mode:1,
+				scan_f_capture_phy_err:1,
+				scan_f_strict_passive_pch:1,
+				scan_f_half_rate:1,
+				scan_f_quarter_rate:1,
+				scan_f_force_active_dfs_chn:1,
+				scan_f_add_tpc_ie_in_probe:1,
+				scan_f_add_ds_ie_in_probe:1,
+				scan_f_add_spoofed_mac_in_probe:1,
+				scan_f_add_rand_seq_in_probe:1,
+				scan_f_en_ie_whitelist_in_probe:1,
+				scan_f_forced:1,
+				scan_f_2ghz:1,
+				scan_f_5ghz:1,
+				scan_f_80mhz:1;
+		};
+		uint32_t scan_flags;
+	};
+	union {
+		struct {
+			uint32_t scan_ev_started:1,
+				scan_ev_completed:1,
+				scan_ev_bss_chan:1,
+				scan_ev_foreign_chan:1,
+				scan_ev_dequeued:1,
+				scan_ev_preempted:1,
+				scan_ev_start_failed:1,
+				scan_ev_restarted:1,
+				scan_ev_foreign_chn_exit:1,
+				scan_ev_invalid:1,
+				scan_ev_gpio_timeout:1,
+				scan_ev_suspended:1,
+				scan_ev_resumed:1;
+		};
+		uint32_t scan_events;
+	};
+};
+
+/**
+ * struct scan_cb - nif/sif function callbacks
+ * @inform_beacon: cb to indicate frame to OS
+ * @update_beacon: cb to indicate frame to MLME
+ */
+struct scan_cb {
+	update_beacon_cb inform_beacon;
+	update_beacon_cb update_beacon;
+	/* Define nif/sif function callbacks here */
+};
+
+/**
+ * struct wlan_scan_obj - scan object definition
+ * @scan_db:    scan cache data base
+ * @lock:       spin lock
+ * @scan_def:   default scan parameters
+ * @cb:         nif/sif function callbacks
+ * @requesters: requester allocation pool
+ * @scan_ids:   last allocated scan id
+ * @global_evhandlers:  registered scan event handlers
+ */
+struct wlan_scan_obj {
+	qdf_spinlock_t lock;
+	qdf_atomic_t scan_ids;
+	struct scan_dbs scan_db[WLAN_UMAC_MAX_PDEVS];
+	struct scan_default_params scan_def;
+	struct scan_cb cb;
+	struct scan_requester_info requesters[WLAN_MAX_REQUESTORS];
+	struct global_scan_ev_handlers global_evhandlers;
+	struct pdev_scan_info pdev_info[WLAN_UMAC_MAX_PDEVS];
+};
+
+/**
+ * wlan_vdev_get_scan_obj() - private API to get scan object from vdev
+ * @psoc: vdev object
+ *
+ * Return: scan object
+ */
+static inline struct wlan_scan_obj *
+wlan_vdev_get_scan_obj(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_objmgr_psoc *psoc =
+		wlan_pdev_get_psoc(wlan_vdev_get_pdev(vdev));
+
+	return (struct wlan_scan_obj *)
+		wlan_objmgr_psoc_get_comp_private_obj(psoc,
+				WLAN_UMAC_COMP_SCAN);
+}
+
+/**
+ * wlan_psoc_get_scan_obj() - private API to get scan object from psoc
+ * @psoc: psoc object
+ *
+ * Return: scan object
+ */
+static inline struct wlan_scan_obj *
+wlan_psoc_get_scan_obj(struct wlan_objmgr_psoc *psoc)
+{
+	return (struct wlan_scan_obj *)
+		wlan_objmgr_psoc_get_comp_private_obj(psoc,
+				WLAN_UMAC_COMP_SCAN);
+}
+
+/**
+ * wlan_scan_vdev_get_pdev_id)() - private API to get pdev id from vdev object
+ * @vdev: vdev object
+ *
+ * Return: parent pdev id
+ */
+static inline uint8_t
+wlan_scan_vdev_get_pdev_id(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_objmgr_pdev *pdev = wlan_vdev_get_pdev(vdev);
+
+	return wlan_objmgr_pdev_get_pdev_id(pdev);
+}
+
+/**
+ * wlan_vdev_get_pdev_scan_ev_handlers() - private API to get
+ * pdev scan event handlers
+ * @vdev: vdev object
+ *
+ * Return: pdev_scan_ev_handler object
+ */
+static inline struct pdev_scan_ev_handler*
+wlan_vdev_get_pdev_scan_ev_handlers(struct wlan_objmgr_vdev *vdev)
+{
+	uint8_t pdevid = wlan_scan_vdev_get_pdev_id(vdev);
+	struct wlan_scan_obj *scan = wlan_vdev_get_scan_obj(vdev);
+	struct pdev_scan_ev_handler *pdev_ev_handler =
+		&scan->global_evhandlers.pdev_ev_handlers[pdevid];
+
+	return pdev_ev_handler;
+}
+
+/**
+ * wlan_vdev_get_def_scan_params() - private API to get scan defaults
+ * @psoc: vdev object
+ *
+ * Return: scan defaults
+ */
+static inline struct scan_default_params*
+wlan_vdev_get_def_scan_params(struct wlan_objmgr_vdev *vdev)
+{
+	struct wlan_scan_obj *scan = wlan_vdev_get_scan_obj(vdev);
+
+	return &scan->scan_def;
+}
+
+/**
+ * wlan_scan_psoc_created_notification() - scan psoc create handler
+ * @psoc: psoc object
+ * @arg_list: Argument list
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_scan_psoc_created_notification(struct wlan_objmgr_psoc *psoc,
+	void *arg_list);
+
+/**
+ * wlan_scan_psoc_deleted_notification() - scan psoc delete handler
+ * @psoc: psoc object
+ * @arg_list: Argument list
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS wlan_scan_psoc_deleted_notification(struct wlan_objmgr_psoc *psoc,
+	void *arg_list);
+#endif
diff --git a/umac/scan/core/src/wlan_scan_manager.c b/umac/scan/core/src/wlan_scan_manager.c
new file mode 100644
index 0000000..9aa01bd
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_manager.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan manager functionality
+ */
diff --git a/umac/scan/core/src/wlan_scan_manager.h b/umac/scan/core/src/wlan_scan_manager.h
new file mode 100644
index 0000000..7f37181
--- /dev/null
+++ b/umac/scan/core/src/wlan_scan_manager.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: Defines internal scan manager api
+ * Core routines which deal with starting a scan,
+ * serializing scan requests, scan cancellation, scan completion,
+ * scan event processing.
+ */
+
+#ifndef _WLAN_SCAN_MANAGER_API_H_
+#define _WLAN_SCAN_MANAGER_API_H_
+
+#include "wlan_scan_main.h"
+
+/*
+ * Maximum numbers of callback functions that may be invoked
+ * for a particular scan event.
+ */
+#define MAX_SCAN_EVENT_LISTENERS (MAX_SCAN_EVENT_HANDLERS_PER_PDEV + 1)
+
+/**
+ * struct scan_event_listners - listeners interested in a particular scan event
+ * @count: number of listners
+ * @cb: callback handler
+ */
+struct scan_event_listeners {
+	uint32_t count;
+	struct cb_handler cb[MAX_SCAN_EVENT_LISTENERS];
+};
+
+/**
+ * scm_scan_start_req() - scan start req core api
+ * @msg: scheduler message object containing start scan req params
+ * @req: start scan req params
+ *
+ * The API to start a scan
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS scm_scan_start_req(struct scheduler_msg *msg);
+
+/**
+ * scm_scan_cancel_req() - scan cancel req core api
+ * @msg: scheduler message object containing stop scan params
+ * @req: stop scan params
+ *
+ * The API to cancel a scan
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS scm_scan_cancel_req(struct scheduler_msg *msg);
+
+
+/**
+ * scm_scan_event_handler() - core scan event handler from tgt interface
+ * @msg: scheduler message object containing scan event
+ *
+ * This function calls registered event handlers of various modules
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS scm_scan_event_handler(struct scheduler_msg *msg);
+#endif
diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h
new file mode 100644
index 0000000..958f1f4
--- /dev/null
+++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h
@@ -0,0 +1,791 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan structure definations
+ */
+
+#ifndef _WLAN_SCAN_STRUCTS_H_
+#define _WLAN_SCAN_STRUCTS_H_
+#include <wlan_cmn.h>
+#include <qdf_time.h>
+#include <qdf_list.h>
+#include <wlan_cmn_ieee80211.h>
+
+typedef uint16_t wlan_scan_requester;
+typedef uint32_t wlan_scan_id;
+
+#define WLAN_SCAN_MAX_NUM_SSID          10
+#define WLAN_SCAN_MAX_NUM_BSSID         10
+#define WLAN_SCAN_MAX_NUM_CHANNELS      40
+
+#define SCM_PCL_ADVANTAGE       30
+#define SCM_PCL_RSSI_THRESHOLD -75
+#define SCM_NUM_RSSI_CAT        15
+
+#define SCM_BSS_CAP_VALUE_NONE  0/* not much value */
+#define SCM_BSS_CAP_VALUE_HT    1
+#define SCM_BSS_CAP_VALUE_VHT   2
+#define SCM_BSS_CAP_VALUE_WMM   1
+#define SCM_BSS_CAP_VALUE_UAPSD 1
+#define SCM_BSS_CAP_VALUE_5GHZ  2
+
+/**
+ * struct channel_info - BSS channel information
+ * @chan_idx: current operating channel index
+ * @cfreq0: channel frequency index0
+ * @cfreq1: channel frequency index1
+ * @priv: channel private information
+ */
+struct channel_info {
+	uint8_t chan_idx;
+	uint8_t cfreq0;
+	uint8_t cfreq1;
+	void *priv;
+};
+
+/**
+ * struct element_info - defines length of a memory block and memory block
+ * @len: length of memory block
+ * @ptr: memory block pointer
+ */
+struct element_info {
+	uint32_t len;
+	uint8_t *ptr;
+};
+
+/**
+ * struct ie_list - pointers to various IEs
+ * @tim:        pointer to tim ie
+ * @country:    pointer to country ie
+ * @ssid:       pointer to ssid ie
+ * @rates:      pointer to supported rates ie
+ * @xrates:     pointer to extended supported rate ie
+ * @csa:        pointer to csa ie
+ * @xcsa:       pointer to extended csa ie
+ * @wpa:        pointer to wpa ie
+ * @wcn:        pointer to wcn ie
+ * @rsn:        pointer to rsn ie
+ * @wps:        pointer to wps ie
+ * @wmeinfo:    pointer to wmeinfo ie
+ * @wmeparam:   pointer to wmeparam ie
+ * @quiet:      pointer to quiet ie
+ * @htcap:      pointer to htcap ie
+ * @htinfo:     pointer to htinfo ie
+ * @athcaps:    pointer to athcaps ie
+ * @athextcaps: pointer to extended athcaps ie
+ * @sfa:        pointer to sfa ie
+ * @vendor:     pointer to vendor ie
+ * @qbssload:   pointer to qbssload ie
+ * @wapi:       pointer to wapi ie
+ * @p2p:        pointer to p2p ie
+ * @alt_wcn:    pointer to alternate wcn ie
+ * @extcaps:    pointer to extended caps ie
+ * @ibssdfs:    pointer to ibssdfs ie
+ * @sonadv:     pointer to wifi son ie
+ * @vhtcap:     pointer to vhtcap ie
+ * @vhtop:      pointer to vhtop ie
+ * @opmode:     pointer to opmode ie
+ * @cswrp:      pointer to channel switch announcement wrapper ie
+ * @widebw:     pointer to wide band channel switch sub ie
+ * @txpwrenvlp: pointer to tx power envelop sub ie
+ */
+struct ie_list {
+	uint8_t *tim;
+	uint8_t *country;
+	uint8_t *ssid;
+	uint8_t *rates;
+	uint8_t *xrates;
+	uint8_t *csa;
+	uint8_t *xcsa;
+	uint8_t *wpa;
+	uint8_t *wcn;
+	uint8_t *rsn;
+	uint8_t *wps;
+	uint8_t *wmeinfo;
+	uint8_t *wmeparam;
+	uint8_t *quiet;
+	uint8_t *htcap;
+	uint8_t *htinfo;
+	uint8_t *athcaps;
+	uint8_t *athextcaps;
+	uint8_t *sfa;
+	uint8_t *vendor;
+	uint8_t *qbssload;
+	uint8_t *wapi;
+	uint8_t *p2p;
+	uint8_t *alt_wcn;
+	uint8_t *extcaps;
+	uint8_t *ibssdfs;
+	uint8_t *sonadv;
+	uint8_t *vhtcap;
+	uint8_t *vhtop;
+	uint8_t *opmode;
+	uint8_t *cswrp;
+	uint8_t *widebw;
+	uint8_t *txpwrenvlp;
+	uint8_t *bwnss_map;
+	uint8_t *secchanoff;
+	uint8_t *mdie;
+};
+
+/**
+ * struct mlme_info - mlme specific info
+ * temporarily maintained in scan cache for backward compatibility.
+ * must be removed as part of umac convergence.
+ * @bad_ap_time: time when this ap was marked bad
+ * @status: status
+ * @rank: rank
+ * @utility: utility
+ * @assoc_state: association state
+ * @chanload: channel load
+ */
+struct mlme_info {
+	qdf_time_t bad_ap_time;
+	uint32_t status;
+	uint32_t rank;
+	uint32_t utility;
+	uint32_t assoc_state;
+	uint32_t chanload;
+};
+
+/**
+ * struct bss_info - information required to uniquely define a bss
+ * @chan: bss operating primary channel index
+ * @ssid: ssid of bss
+ * @bssid: bssid of bss
+ */
+struct bss_info {
+	uint8_t chan;
+	struct wlan_ssid ssid;
+	struct qdf_mac_addr bssid;
+};
+
+/**
+ * struct scan_cache_node - Scan cache entry node
+ * @node: node pointers
+ * @entry: scan entry pointer
+ */
+struct scan_cache_node {
+	qdf_list_node_t node;   /* MUST be first element */
+	struct scan_cache_entry *entry;
+};
+
+struct security_info {
+	enum wlan_enc_type uc_enc;
+	enum wlan_enc_type mc_enc;
+	enum wlan_auth_type auth_type;
+};
+
+/**
+ * struct scan_cache_entry: structure containing scan entry
+ * @frm_subtype: updated from beacon/probe
+ * @bssid: bssid
+ * @mac_addr: mac address
+ * @ssid: ssid
+ * @seq_num: sequence number
+ * @phy_mode: Phy mode of the AP
+ * @avg_rssi: Average RSSI fof the AP
+ * @rssi_raw: The rssi of the last beacon/probe received
+ * @bcn_int: Beacon interval of the AP
+ * @cap_info: Capability of the AP
+ * @tsf_info: TSF info
+ * @erp: erp info
+ * @dtim_period: dtime period
+ * @is_p2p_ssid: is P2P entry
+ * @scan_entry_time: boottime in microsec when last beacon/probe is received
+ * @rssi_timestamp: boottime in microsec when RSSI was updated
+ * @hidden_ssid_timestamp: boottime in microsec when hidden
+ *                         ssid was received
+ * @channel: channel info on which AP is present
+ * @channel_mismatch: if channel received in metadata
+ *                    doesnot match the one in beacon
+ * @tsf_delta: TSF delta
+ * @prefer_value: Preffer value calulated for the AP
+ * @cap_value: Capability value calculated for the AP
+ * @neg_sec_info: negotiated security info
+ * @rrm_parent_tsf: RRM parent tsf
+ * @mlme_info: Mlme info, this will be updated by MLME for the scan entry
+ * @alt_wcn_ie: alternate WCN IE
+ * @ie_list: IE list pointers
+ * @raw_frame: contain raw frame and the length of the raw frame
+ */
+struct scan_cache_entry {
+	uint8_t frm_subtype;
+	struct qdf_mac_addr bssid;
+	struct qdf_mac_addr mac_addr;
+	struct wlan_ssid ssid;
+	uint16_t seq_num;
+	enum wlan_phymode phy_mode;
+	int8_t avg_rssi;
+	int8_t rssi_raw;
+	uint16_t bcn_int;
+	union wlan_capability cap_info;
+	union {
+		uint8_t data[8];
+		uint64_t tsf;
+	} tsf_info;
+	uint8_t erp;
+	uint8_t dtim_period;
+	bool is_p2p;
+	qdf_time_t scan_entry_time;
+	qdf_time_t rssi_timestamp;
+	qdf_time_t hidden_ssid_timestamp;
+	struct channel_info channel;
+	bool channel_mismatch;
+	struct mlme_info mlme_info;
+	uint32_t tsf_delta;
+	uint32_t prefer_value;
+	uint32_t cap_val;
+	struct security_info neg_sec_info;
+	uint32_t rrm_parent_tsf;
+	struct element_info alt_wcn_ie;
+	struct ie_list ie_list;
+	struct element_info raw_frame;
+};
+
+#define MAX_FAVORED_BSSID 16
+#define MAX_AVOID_LIST_BSSID 16
+#define MAX_ALLOWED_SSID_LIST 4
+
+/**
+ * struct roam_filter_params - Structure holding roaming parameters
+ * @num_bssid_avoid_list:       The number of BSSID's that we should
+ *                              avoid connecting to. It is like a
+ *                              blacklist of BSSID's.
+ *                              also for roaming apart from the connected one's
+ * @num_bssid_favored:          Number of BSSID's which have a preference over
+ *                              others
+ * @raise_rssi_thresh_5g:       The RSSI threshold below which the
+ *                              raise_factor_5g (boost factor) should be
+ *                              applied.
+ * @drop_rssi_thresh_5g:        The RSSI threshold beyond which the
+ *                              drop_factor_5g (penalty factor) should be
+ *                              applied
+ * @raise_factor_5g:            Boost factor
+ * @drop_factor_5g:             Penalty factor
+ * @max_raise_rssi_5g:          Maximum amount of Boost that can added
+ * @max_drop_rssi_5g:           Maximum amount of penalty that can be subtracted
+ * @is_5g_pref_enabled:         5GHz BSSID preference feature enable/disable.
+ * @bssid_avoid_list:           Blacklist SSID's
+ * @bssid_favored:              Favorable BSSID's
+ * @bssid_favored_factor:       RSSI to be added to this BSSID to prefer it
+ *
+ * This structure holds all the key parameters related to
+ * initial connection and also roaming connections.
+ */
+struct roam_filter_params {
+	uint32_t num_bssid_avoid_list;
+	uint32_t num_bssid_favored;
+	int raise_rssi_thresh_5g;
+	int drop_rssi_thresh_5g;
+	uint32_t raise_factor_5g;
+	uint32_t drop_factor_5g;
+	int max_raise_rssi_5g;
+	int max_drop_rssi_5g;
+	uint32_t is_5g_pref_enabled;
+	/* Variable params list */
+	struct qdf_mac_addr bssid_avoid_list[MAX_AVOID_LIST_BSSID];
+	struct qdf_mac_addr bssid_favored[MAX_FAVORED_BSSID];
+	uint8_t bssid_favored_factor[MAX_FAVORED_BSSID];
+};
+
+#define WLAN_SCAN_FILTER_NUM_SSID 5
+#define WLAN_SCAN_FILTER_NUM_BSSID 5
+
+/**
+ * @age_threshold: If set return entry which are newer than the age_threshold
+ * @p2p_results: If only p2p entries is required
+ * @rrm_measurement_filter: For measurement reports.if set, only SSID, BSSID
+ *                          and channel is considered for filtering.
+ * @num_of_bssid: number of bssid passed
+ * @num_of_ssid: number of ssid
+ * @num_of_channels: number of  channels
+ * @num_of_auth: number of auth types
+ * @num_of_enc_type: number of unicast enc type
+ * @num_of_mc_enc_type: number of multicast enc type
+ * @pmf_cap: Pmf capability
+ * @num_of_pcl_channels: number of pcl channels
+ * @bss_prefer_val: bss prefer value for the RSSI category
+ * @rssi_cat: RSSI category
+ * @strict_sel_5g: only 5G AP
+ * @bss_type: bss type BSS/IBSS etc
+ * @country[3]: Ap with specific country code
+ * @dot11_mode: operating modes 0 mean any
+ *              11a , 11g, 11n , 11ac , 11b etc
+ * @band: to get specific band 2.4G, 5G or 4.9 G
+ * @rssi_threshold: AP having RSSI greater than
+ *                  rssi threasholed (ignored if set 0)
+ * @only_wmm_ap: If only Qos AP is needed
+ * @ignore_auth_enc_type: Ignore enc type if
+ *                        this is set (For WPS/OSEN connection)
+ * @mobility_domain: Mobility domain for 11r
+ * @roam_params: roam related params
+ * @bssid_list: bssid list
+ * @ssid_list: ssid list
+ * @channel_list: channel list
+ * @auth_type_list: auth type list
+ * @enc_type_list: unicast enc type list
+ * @mc_enc_type_list: multicast cast enc type list
+ * @pcl_channel_list: PCL channel list
+ */
+struct scan_filter {
+	uint32_t age_threshold;
+	uint32_t p2p_results;
+	uint32_t rrm_measurement_filter;
+	uint32_t num_of_bssid;
+	uint32_t num_of_ssid;
+	uint32_t num_of_channels;
+	uint32_t num_of_auth;
+	uint32_t num_of_enc_type;
+	uint32_t num_of_mc_enc_type;
+	enum wlan_pmf_cap pmf_cap;
+	uint32_t num_of_pcl_channels;
+	/* each RSSI category has one value */
+	uint32_t bss_prefer_val[SCM_NUM_RSSI_CAT];
+	int rssi_cat[SCM_NUM_RSSI_CAT];
+	uint32_t strict_sel_5g;
+	enum wlan_bss_type bss_type;
+	enum wlan_phymode dot11_mode;
+	enum wlan_band band;
+	uint32_t rssi_threshold;
+	uint32_t only_wmm_ap;
+	uint32_t ignore_auth_enc_type;
+	uint32_t mobility_domain;
+	/* Variable params list */
+	uint8_t country[3];
+	struct roam_filter_params roam_params;
+	struct qdf_mac_addr bssid_list[WLAN_SCAN_FILTER_NUM_BSSID];
+	struct wlan_ssid ssid_list[WLAN_SCAN_FILTER_NUM_SSID];
+	uint8_t channel_list[QDF_MAX_NUM_CHAN];
+	enum wlan_auth_type auth_type[WLAN_NUM_OF_SUPPORT_AUTH_TYPE];
+	enum wlan_enc_type enc_type[WLAN_NUM_OF_ENCRYPT_TYPE];
+	enum wlan_enc_type mc_enc_type[WLAN_NUM_OF_ENCRYPT_TYPE];
+	uint8_t pcl_channel_list[QDF_MAX_NUM_CHAN];
+};
+
+
+/**
+ * enum scan_priority - scan priority definitions
+ * @SCAN_PRIORITY_VERY_LOW: very low priority
+ * @SCAN_PRIORITY_LOW: low scan priority
+ * @SCAN_PRIORITY_MEDIUM: medium priority
+ * @SCAN_PRIORITY_HIGH: high priority
+ * @SCAN_PRIORITY_VERY_HIGH: very high priority
+ * @SCAN_PRIORITY_COUNT: number of priorities supported
+ */
+enum scan_priority {
+	SCAN_PRIORITY_VERY_LOW,
+	SCAN_PRIORITY_LOW,
+	SCAN_PRIORITY_MEDIUM,
+	SCAN_PRIORITY_HIGH,
+	SCAN_PRIORITY_VERY_HIGH,
+	SCAN_PRIORITY_COUNT,
+};
+
+
+/**
+ * enum scan_type - type of scan
+ * @SCAN_TYPE_BACKGROUND: background scan
+ * @SCAN_TYPE_FOREGROUND: foregrounc scan
+ * @SCAN_TYPE_SPECTRAL: spectral scan
+ * @SCAN_TYPE_REPEATER_BACKGROUND: background scan in repeater
+ * @SCAN_TYPE_REPEATER_EXT_BACKGROUND: background scan in extended repeater
+ * @SCAN_TYPE_RADIO_MEASUREMENTS: redio measurement
+ * @SCAN_TYPE_COUNT: number of scan types supported
+ */
+enum scan_type {
+	SCAN_TYPE_BACKGROUND,
+	SCAN_TYPE_FOREGROUND,
+	SCAN_TYPE_SPECTRAL,
+	SCAN_TYPE_REPEATER_BACKGROUND,
+	SCAN_TYPE_REPEATER_EXT_BACKGROUND,
+	SCAN_TYPE_RADIO_MEASUREMENTS,
+	SCAN_TYPE_COUNT,
+};
+
+/**
+ * struct scan_extra_params_legacy
+ * extra parameters required for legacy DA scan module
+ * @scan_type: type of scan
+ * @min_dwell_active: min active dwell time
+ * @min_dwell_passive: min passive dwell time
+ * @init_rest_time: init rest time for enhanced independent repeater
+ */
+struct scan_extra_params_legacy {
+	enum scan_type scan_type;
+	uint32_t min_dwell_active;
+	uint32_t min_dwell_passive;
+	uint32_t init_rest_time;
+};
+
+
+/**
+ * struct scan_req_params - start scan request parameter
+ * @scan_id: scan id
+ * @scan_req_id: scan requester id
+ * @vdev_id: vdev id where scan was originated
+ * @scan_priority: scan priority
+ * @scan_ev_started: notify scan started event
+ * @scan_ev_completed: notify scan completed event
+ * @scan_ev_bss_chan: notify bss chan event
+ * @scan_ev_foreign_chan: notify foreign chan event
+ * @scan_ev_dequeued: notify scan request dequed event
+ * @scan_ev_preempted: notify scan preempted event
+ * @scan_ev_start_failed: notify scan start failed event
+ * @scan_ev_restarted: notify scan restarted event
+ * @scan_ev_foreign_chn_exit: notify foreign chan exit event
+ * @scan_ev_invalid: notify invalid scan request event
+ * @scan_ev_gpio_timeout: notify gpio timeout event
+ * @scan_ev_suspended: notify scan suspend event
+ * @scan_ev_resumed: notify scan resumed event
+ * @scan_events: variable to read and set scan_ev_* flags in one shot
+ *               can be used to dump all scan_ev_* flags for debug
+ * @dwell_time_active: active dwell time
+ * @dwell_time_passive: passive dwell time
+ * @min_rest_time: min rest time
+ * @max_rest_time: max rest time
+ * @repeat_probe_time: repeat probe time
+ * @probe_spacing_time: probe spacing time
+ * @idle_time: idle time
+ * @max_scan_time: max scan time
+ * @probe_delay: probe delay
+ * @scan_f_passive: passively scan all channels including active channels
+ * @scan_f_bcast_probe: add wild card ssid prbreq even if ssid_list is specified
+ * @scan_f_cck_rates: add cck rates to rates/xrates ie in prb req
+ * @scan_f_ofdm_rates: add ofdm rates to rates/xrates ie in prb req
+ * @scan_f_chan_stat_evnt: enable indication of chan load and noise floor
+ * @scan_f_filter_prb_req: filter Probe request frames
+ * @scan_f_bypass_dfs_chn: when set, do not scan DFS channels
+ * @scan_f_continue_on_err:continue scan even if few certain erros have occurred
+ * @scan_f_offchan_mgmt_tx: allow mgmt transmission during off channel scan
+ * @scan_f_offchan_data_tx: allow data transmission during off channel scan
+ * @scan_f_promisc_mode: scan with promiscuous mode
+ * @scan_f_capture_phy_err: enable capture ppdu with phy errrors
+ * @scan_f_strict_passive_pch: do passive scan on passive channels
+ * @scan_f_half_rate: enable HALF (10MHz) rate support
+ * @scan_f_quarter_rate: set Quarter (5MHz) rate support
+ * @scan_f_force_active_dfs_chn: allow to send probe req on DFS channel
+ * @scan_f_add_tpc_ie_in_probe: add TPC ie in probe req frame
+ * @scan_f_add_ds_ie_in_probe: add DS ie in probe req frame
+ * @scan_f_add_spoofed_mac_in_probe: use random mac address for TA in probe
+ * @scan_f_add_rand_seq_in_probe: use random sequence number in probe
+ * @scan_f_en_ie_whitelist_in_probe: enable ie whitelist in probe
+ * @scan_f_forced: force scan even in presence of data traffic
+ * @scan_f_2ghz: scan 2.4 GHz channels
+ * @scan_f_5ghz: scan 5 GHz channels
+ * @scan_f_80mhz: scan in 80 MHz channel width mode
+ * @scan_flags: variable to read and set scan_f_* flags in one shot
+ *              can be used to dump all scan_f_* flags for debug
+ * @burst_duration: burst duration
+ * @num_chan: no of channel
+ * @num_bssid: no of bssid
+ * @num_ssids: no of ssid
+ * @n_probes: no of probe
+ * @chan_list: channel list
+ * @ssid: ssid list
+ * @bssid_list: Lisst of bssid to scan
+ * @extraie: list of optional/vendor specific ie's to be added in probe requests
+ * @htcap: htcap ie
+ * @vhtcap: vhtcap ie
+ */
+
+struct scan_req_params {
+	uint32_t scan_id;
+	uint32_t scan_req_id;
+	uint32_t vdev_id;
+	enum scan_priority scan_priority;
+	union {
+		struct {
+			uint32_t scan_ev_started:1,
+				 scan_ev_completed:1,
+				 scan_ev_bss_chan:1,
+				 scan_ev_foreign_chan:1,
+				 scan_ev_dequeued:1,
+				 scan_ev_preempted:1,
+				 scan_ev_start_failed:1,
+				 scan_ev_restarted:1,
+				 scan_ev_foreign_chn_exit:1,
+				 scan_ev_invalid:1,
+				 scan_ev_gpio_timeout:1,
+				 scan_ev_suspended:1,
+				 scan_ev_resumed:1;
+		};
+		uint32_t scan_events;
+	};
+	uint32_t dwell_time_active;
+	uint32_t dwell_time_passive;
+	uint32_t min_rest_time;
+	uint32_t max_rest_time;
+	uint32_t repeat_probe_time;
+	uint32_t probe_spacing_time;
+	uint32_t idle_time;
+	uint32_t max_scan_time;
+	uint32_t probe_delay;
+	union {
+		struct {
+			uint32_t scan_f_passive:1,
+				 scan_f_bcast_probe:1,
+				 scan_f_cck_rates:1,
+				 scan_f_ofdm_rates:1,
+				 scan_f_chan_stat_evnt:1,
+				 scan_f_filter_prb_req:1,
+				 scan_f_bypass_dfs_chn:1,
+				 scan_f_continue_on_err:1,
+				 scan_f_offchan_mgmt_tx:1,
+				 scan_f_offchan_data_tx:1,
+				 scan_f_promisc_mode:1,
+				 scan_f_capture_phy_err:1,
+				 scan_f_strict_passive_pch:1,
+				 scan_f_half_rate:1,
+				 scan_f_quarter_rate:1,
+				 scan_f_force_active_dfs_chn:1,
+				 scan_f_add_tpc_ie_in_probe:1,
+				 scan_f_add_ds_ie_in_probe:1,
+				 scan_f_add_spoofed_mac_in_probe:1,
+				 scan_f_add_rand_seq_in_probe:1,
+				 scan_f_en_ie_whitelist_in_probe:1,
+				 scan_f_forced:1,
+				 scan_f_2ghz:1,
+				 scan_f_5ghz:1,
+				 scan_f_80mhz:1;
+		};
+		uint32_t scan_flags;
+	};
+	uint32_t burst_duration;
+	uint32_t num_chan;
+	uint32_t num_bssid;
+	uint32_t num_ssids;
+	uint32_t n_probes;
+	uint32_t chan_list[WLAN_SCAN_MAX_NUM_CHANNELS];
+	struct wlan_ssid ssid[WLAN_SCAN_MAX_NUM_SSID];
+	struct qdf_mac_addr bssid_list[WLAN_SCAN_MAX_NUM_BSSID];
+	struct element_info extraie;
+	struct element_info htcap;
+	struct element_info vhtcap;
+};
+
+/**
+ * struct scan_start_request - scan request config
+ * @vdev: vdev
+ * @legacy_params: extra parameters required for legacy DA arch
+ * @scan_req: common scan start request parameters
+ */
+struct scan_start_request {
+	struct wlan_objmgr_vdev *vdev;
+	struct scan_extra_params_legacy legacy_params;
+	struct scan_req_params scan_req;
+};
+
+/**
+ * enum scan_cancel_type - type specifiers for cancel scan request
+ * @WLAN_SCAN_CANCEL_SINGLE: cancel particular scan specified by scan_id
+ * @WLAN_SCAN_CANCEL_VAP_ALL: cancel all scans running on a particular vdevid
+ * WLAN_SCAN_CANCEL_PDEV_ALL: cancel all scans running on parent pdev of vdevid
+ */
+enum scan_cancel_req_type {
+	WLAN_SCAN_CANCEL_SINGLE = 1,
+	WLAN_SCAN_CANCEL_VDEV_ALL,
+	WLAN_SCAN_CANCEL_PDEV_ALL,
+};
+
+/**
+ * struct scan_cancel_param - stop scan cmd parameter
+ * @requester: scan requester
+ * @scan_id: scan id
+ * @req_type: scan request type
+ * @vdev_id: vdev id
+ */
+struct scan_cancel_param {
+	uint32_t requester;
+	uint32_t scan_id;
+	enum scan_cancel_req_type req_type;
+	uint32_t vdev_id;
+};
+
+/**
+ * struct scan_cancel_request - stop scan cmd
+ * @vdev: vdev object
+ * @cancel_req: stop scan cmd parameter
+ */
+struct scan_cancel_request {
+	/* Extra parameters consumed by scan module or serialization */
+	struct wlan_objmgr_vdev *vdev;
+	/* Actual scan cancel request parameters */
+	struct scan_cancel_param cancel_req;
+};
+
+/**
+ * struct mlme_update_info - meta information required to
+ * update mlme info in scan entry
+ * @vdev: vdev object
+ * @bss: bss identifier
+ * @mlme_info: mlme info to update
+ */
+struct mlme_update_info {
+	struct wlan_objmgr_vdev *vdev;
+	struct bss_info bss;
+	struct mlme_info mlme_info;
+};
+
+/**
+ * enum scan_event_type - scan event types
+ * @SCAN_EVENT_TYPE_STARTED: scan started
+ * @SCAN_EVENT_TYPE_COMPLETED: scan completed
+ * @SCAN_EVENT_TYPE_BSS_CHANNEL: HW came back to home channel
+ * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL: HW moved to foreign channel
+ * @SCAN_EVENT_TYPE_DEQUEUED: scan request dequeued
+ * @SCAN_EVENT_TYPE_PREEMPTED: scan got preempted
+ * @SCAN_EVENT_TYPE_START_FAILED: couldn't start scan
+ * @SCAN_EVENT_TYPE_RESTARTED: scan restarted
+ * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT: HW exited foreign channel
+ * @SCAN_EVENT_TYPE_SUSPENDED: scan got suspended
+ * @SCAN_EVENT_TYPE_RESUMED: scan resumed
+ * @SCAN_EVENT_TYPE_NLO_COMPLETE: NLO completed
+ * @SCAN_EVENT_TYPE_INVALID: invalid request
+ * @SCAN_EVENT_TYPE_GPIO_TIMEOUT: gpio timeout
+ * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START: radio measurement start
+ * @SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END: radio measurement end
+ * @SCAN_EVENT_TYPE_BSSID_MATCH: bssid match found
+ * @SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF: foreign channel noise floor
+ * @SCAN_EVENT_TYPE_MAX: marker for invalid event
+ */
+enum scan_event_type {
+	SCAN_EVENT_TYPE_STARTED,
+	SCAN_EVENT_TYPE_COMPLETED,
+	SCAN_EVENT_TYPE_BSS_CHANNEL,
+	SCAN_EVENT_TYPE_FOREIGN_CHANNEL,
+	SCAN_EVENT_TYPE_DEQUEUED,
+	SCAN_EVENT_TYPE_PREEMPTED,
+	SCAN_EVENT_TYPE_START_FAILED,
+	SCAN_EVENT_TYPE_RESTARTED,
+	SCAN_EVENT_TYPE_FOREIGN_CHANNEL_EXIT,
+	SCAN_EVENT_TYPE_SUSPENDED,
+	SCAN_EVENT_TYPE_RESUMED,
+	SCAN_EVENT_TYPE_NLO_COMPLETE,
+	SCAN_EVENT_TYPE_INVALID,
+	SCAN_EVENT_TYPE_GPIO_TIMEOUT,
+	SCAN_EVENT_TYPE_RADIO_MEASUREMENT_START,
+	SCAN_EVENT_TYPE_RADIO_MEASUREMENT_END,
+	SCAN_EVENT_TYPE_BSSID_MATCH,
+	SCAN_EVENT_TYPE_FOREIGN_CHANNEL_GET_NF,
+	SCAN_EVENT_TYPE_MAX,
+};
+
+/**
+ * enum scan_completion_reason - scan completion reason
+ * @SCAN_REASON_NONE: un specified reason
+ * @SCAN_REASON_COMPLETED: scan successfully completed
+ * @SCAN_REASON_CANCELLED: scan got cancelled
+ * @SCAN_REASON_PREEMPTED: scan got preempted
+ * @SCAN_REASON_TIMEDOUT: couldnt complete within specified time
+ * @SCAN_REASON_INTERNAL_FAILURE: cancelled because of some failure
+ * @SCAN_REASON_SUSPENDED: scan suspended
+ * @SCAN_REASON_RUN_FAILED: run failed
+ * @SCAN_REASON_TERMINATION_FUNCTION: termination function
+ * @SCAN_REASON_MAX_OFFCHAN_RETRIES: max retries exceeded thresold
+ * @SCAN_REASON_MAX: invalid completion reason marker
+ */
+enum scan_completion_reason {
+	SCAN_REASON_NONE,
+	SCAN_REASON_COMPLETED,
+	SCAN_REASON_CANCELLED,
+	SCAN_REASON_PREEMPTED,
+	SCAN_REASON_TIMEDOUT,
+	SCAN_REASON_INTERNAL_FAILURE,
+	SCAN_REASON_SUSPENDED,
+	SCAN_REASON_RUN_FAILED,
+	SCAN_REASON_TERMINATION_FUNCTION,
+	SCAN_REASON_MAX_OFFCHAN_RETRIES,
+	SCAN_REASON_MAX,
+};
+
+
+/**
+ * struct scan_event - scan event definition
+ * @vdev_id: vdev where scan was run
+ * @type: type of scan event
+ * @reason: completion reason
+ * @chan_freq: channel centre frequency
+ * @requester: requester id
+ * @scan_id: scan id
+ */
+struct scan_event {
+	uint32_t vdev_id;
+	enum scan_event_type type;
+	enum scan_completion_reason reason;
+	uint32_t chan_freq;
+	uint32_t requester;
+	uint32_t scan_id;
+};
+
+/**
+ * struct scan_event_info - scan event information
+ * @vdev: vdev object
+ * @event: scan event
+ */
+struct scan_event_info {
+	struct wlan_objmgr_vdev *vdev;
+	struct scan_event event;
+};
+
+/**
+ * enum scm_scan_status - scan status
+ * @SCAN_NOT_IN_PROGRESS: Neither active nor pending scan in progress
+ * @SCAN_IS_ACTIVE: scan request is present only in active list
+ * @SCAN_IS_PENDING: scan request is present only in pending list
+ * @SCAN_IS_ACTIVE_AND_PENDING: scan request is present in active
+ *                               and pending both lists
+ */
+enum scm_scan_status {
+	SCAN_NOT_IN_PROGRESS = 0, /* Must be 0 */
+	SCAN_IS_ACTIVE,
+	SCAN_IS_PENDING,
+	SCAN_IS_ACTIVE_AND_PENDING,
+};
+
+/**
+ * scan_event_handler() - function prototype of scan event handlers
+ * @vdev: vdev object
+ * @event: scan event
+ * @arg: argument
+ *
+ * PROTO TYPE, scan event handler call back function prototype
+ *
+ * @Return: void
+ */
+typedef void (*scan_event_handler) (struct wlan_objmgr_vdev *vdev,
+	struct scan_event *event, void *arg);
+
+/**
+ * enum scan_cb_type - update beacon cb type
+ * @SCAN_CB_TYPE_INFORM_BCN: Calback to indicate beacon to OS
+ * @SCAN_CB_TYPE_UPDATE_BCN: Calback to indicate beacon
+ *                    to MLME and update MLME info
+ *
+ */
+enum scan_cb_type {
+	SCAN_CB_TYPE_INFORM_BCN,
+	SCAN_CB_TYPE_UPDATE_BCN,
+};
+
+/**
+ * struct pno_scan_req_params - forward declaration
+ */
+struct pno_scan_req_params;
+#endif
diff --git a/umac/scan/dispatcher/inc/wlan_scan_tgt_api.h b/umac/scan/dispatcher/inc/wlan_scan_tgt_api.h
new file mode 100644
index 0000000..fffd1fc
--- /dev/null
+++ b/umac/scan/dispatcher/inc/wlan_scan_tgt_api.h
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan south bound interface definitions
+ */
+
+#ifndef _WLAN_SCAN_TGT_API_H_
+#define _WLAN_SCAN_TGT_API_H_
+
+#include <wlan_scan_structs.h>
+#include <wlan_objmgr_psoc_obj.h>
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_objmgr_vdev_obj.h>
+#include <wlan_objmgr_peer_obj.h>
+#include <wlan_mgmt_txrx_utils_api.h>
+
+/**
+ * tgt_scan_bcn_probe_rx_callback() - The callbeack registered to tx/rx module
+ * @psoc: psoc context
+ * @peer: peer
+ * @buf: frame buf
+ * @params: rx event params
+ * @frm_type: frame type
+ *
+ * The callbeack registered to tx/rx module and is called when beacon
+ * or probe resp is recived. This will post a msg to target_if queue.
+ *
+ * Return: success or error code.
+ */
+QDF_STATUS tgt_scan_bcn_probe_rx_callback(struct wlan_objmgr_psoc *psoc,
+	struct wlan_objmgr_peer *peer, qdf_nbuf_t buf,
+	struct mgmt_rx_event_params *rx_param, uint32_t frm_type);
+
+/**
+ * tgt_scan_nlo_complete_evt_handler() - The callbeack registered
+ * to WMI for PNO complete
+ * @handle: psoc handle
+ * @event: event handler
+ * @len: length of data
+ *
+ * This function handles NLO scan completion event.
+ *
+ * Return: 0 for success or error code.
+ */
+
+QDF_STATUS
+tgt_scan_nlo_complete_evt_handler(void *handle, uint8_t *event,
+	uint32_t len);
+
+/**
+ * tgt_nlo_match_evt_handler() - nlo match event handler
+ * @handle: psoc handle
+ * @event: event data
+ * @len: data length
+ *
+ * Record NLO match event comes from FW. It's a indication that
+ * one of the profile is matched.
+ *
+ * Return: 0 for success or error code.
+ */
+QDF_STATUS
+tgt_nlo_match_evt_handler(void *handle, uint8_t *event,
+	uint32_t len);
+
+/**
+ * tgt_scan_event_handler() - The callbeack registered to WMI for scan events
+ * @psoc: psoc handle
+ * @event_info: event info
+ *
+ * The callbeack registered to WMI for scan events and is called
+ * event for scan is received. This will post a msg to target_if queue.
+ *
+ * Return: 0 for success or error code.
+ */
+QDF_STATUS
+tgt_scan_event_handler(struct wlan_objmgr_psoc *psoc,
+	struct scan_event_info *event_info);
+
+/**
+ * tgt_scan_start() - invoke lmac scan start
+ * @req: scan request object
+ *
+ * This API invokes lmac API function to start scan
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code.
+ */
+QDF_STATUS
+tgt_scan_start(struct scan_start_request *req);
+
+
+/**
+ * tgt_scan_cancel() - invoke lmac scan cancel
+ * @req: scan request object
+ *
+ * This API invokes lmac API function to cancel scan
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code.
+ */
+QDF_STATUS
+tgt_scan_cancel(struct scan_cancel_request *req);
+
+/**
+ * tgt_scan_register_ev_handler() - invoke lmac register scan event handler
+ * @psoc: psoc object
+ *
+ * This API invokes lmac API function to register for scan events
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code.
+ */
+QDF_STATUS
+tgt_scan_register_ev_handler(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * tgt_scan_unregister_ev_handler() - invoke lmac unregister scan event handler
+ * @psoc: psoc object
+ *
+ * This API invokes lmac API function to unregister for scan events
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code.
+ */
+QDF_STATUS
+tgt_scan_unregister_ev_handler(struct wlan_objmgr_psoc *psoc);
+#endif
diff --git a/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h
new file mode 100644
index 0000000..644be7e
--- /dev/null
+++ b/umac/scan/dispatcher/inc/wlan_scan_ucfg_api.h
@@ -0,0 +1,376 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan north bound interface api
+ */
+
+#ifndef _WLAN_SCAN_UCFG_API_H_
+#define _WLAN_SCAN_UCFG_API_H_
+
+#include <scheduler_api.h>
+#include <wlan_scan_public_structs.h>
+#include <wlan_objmgr_psoc_obj.h>
+#include <wlan_objmgr_pdev_obj.h>
+#include <wlan_objmgr_vdev_obj.h>
+
+/**
+ * ucfg_scan_register_requester() - assigns requester ID to caller and
+ * registers scan event call back handler
+ * @psoc:       psoc object
+ * @module_name:name of requester module
+ * @event_cb:   event callback function pointer
+ * @arg:        argument to @event_cb
+ *
+ * API, allows other components to allocate requester id
+ * Normally used by modules at init time to register their callback
+ * and get one requester id. @event_cb will be invoked for
+ * all scan events whose requester id matches with @requester.
+ *
+ * Return: assigned non zero requester id for success
+ *         zero (0) for failure
+ */
+wlan_scan_requester
+ucfg_scan_register_requester(struct wlan_objmgr_psoc *psoc,
+	uint8_t *module_name, scan_event_handler event_cb, void *arg);
+
+/**
+ * ucfg_scan_unregister_requester() -reclaims previously allocated requester ID
+ * @psoc:       psoc object
+ * @requester:  requester ID to reclaim.
+ *
+ * API, reclaims previously allocated requester id by
+ * ucfg_scan_get_req_id_reg_cb()
+ *
+ * Return: void
+ */
+void ucfg_scan_unregister_requester(struct wlan_objmgr_psoc *psoc,
+	wlan_scan_requester requester);
+
+
+/**
+ * ucfg_get_scan_requester_name()- returns module name of requester ID owner
+ * @psoc:       psoc object
+ * @requester:  requester ID
+ *
+ * API, returns module name of requester id owner
+ *
+ * Return: pointer to module name or "unknown" if requester id not found.
+ */
+uint8_t *ucfg_get_scan_requester_name(struct wlan_objmgr_psoc *psoc,
+	wlan_scan_requester requester);
+
+
+
+/**
+ * ucfg_scan_get_scan_id() - allocates scan ID
+ * @psoc: psoc object
+ *
+ * API, allocates a new scan id for caller
+ *
+ * Return: newly allocated scan ID
+ */
+wlan_scan_id
+ucfg_scan_get_scan_id(struct wlan_objmgr_psoc *psoc);
+
+
+/**
+ * ucfg_scan_start() - Public API to start a scan
+ * @req: start scan req params
+ *
+ * The Public API to start a scan. Post a msg to target_if queue
+ *
+ * Return: 0 for success or error code.
+ */
+QDF_STATUS
+ucfg_scan_start(struct scan_start_request *req);
+
+/**
+ * ucfg_scan_cancel() - Public API to stop a scan
+ * @req: stop scan request params
+ *
+ * The Public API to stop a scan. Post a msg to target_if queue
+ *
+ * Return: 0 for success or error code.
+ */
+QDF_STATUS
+ucfg_scan_cancel(struct scan_cancel_request *req);
+
+/**
+ * ucfg_scan_get_result() - The Public API to get scan results
+ * @pdev: pdev info
+ * @filter: Filters
+ *
+ * This function fetches scan result
+ *
+ * Return: scan list pointer
+ */
+qdf_list_t *ucfg_scan_get_result(struct wlan_objmgr_pdev *pdev,
+	struct scan_filter *filter);
+
+/**
+ * ucfg_scan_purge_results() - purge the scan list
+ * @scan_list: scan list to be purged
+ *
+ * This function purge the temp scan list
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_scan_purge_results(qdf_list_t *scan_list);
+
+/**
+ * ucfg_scan_flush_results() - The Public API to flush scan result
+ * @pdev: pdev object
+ * @filter: filter to flush the scan entries
+ *
+ * The Public API to flush scan result.
+ *
+ * Return: 0 for success or error code.
+ */
+QDF_STATUS ucfg_scan_flush_results(struct wlan_objmgr_pdev *pdev,
+	struct scan_filter *filter);
+
+/**
+ * ucfg_scan_filter_valid_channel() - The Public API to filter scan result
+ * based on valid channel list
+ * @pdev: pdev object
+ * @chan_list: valid channel list
+ * @num_chan: number of valid channels
+ *
+ * The Public API to to filter scan result
+ * based on valid channel list.
+ *
+ * Return: void.
+ */
+void ucfg_scan_filter_valid_channel(struct wlan_objmgr_pdev *pdev,
+	uint8_t *chan_list, uint32_t num_chan);
+
+/**
+ * scan_iterator_func() - function prototype of scan iterator function
+ * @scan_entry: scan entry object
+ * @arg: extra argument
+ *
+ * PROTO TYPE, scan iterator function prototype
+ *
+ * @Return: QDF_STATUS
+ */
+typedef QDF_STATUS (*scan_iterator_func) (void *arg,
+	struct scan_cache_entry *scan_entry);
+
+/**
+ * ucfg_scan_db_iterate() - function to iterate scan table
+ * @pdev: pdev object
+ * @func: iterator function pointer
+ * @arg: argument to be passed to func()
+ *
+ * API, this API iterates scan table and invokes func
+ * on each scan enetry by passing scan entry and arg.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+ucfg_scan_db_iterate(struct wlan_objmgr_pdev *pdev,
+	scan_iterator_func func, void *arg);
+
+/**
+ * ucfg_scan_update_mlme_info() - The Public API to update mlme
+ * info in the scan entry
+ * @vdev: vdev object
+ * @bss: bss info to find the matching scan entry
+ * @mlme_info: mlme info to be updated.
+ *
+ * The Public API to update mlme info in the scan entry.
+ * Post a msg to target_if queue
+ *
+ * Return: 0 for success or error code.
+ */
+QDF_STATUS
+ucfg_scan_update_mlme_info(struct wlan_objmgr_vdev *vdev, struct bss_info *bss,
+	struct mlme_info *mlme_info);
+
+/**
+ * ucfg_scan_register_event_handler() - The Public API to register
+ * an event cb handler
+ * @vdev: vdev object
+ * @event_cb: callback function to register
+ * @arg: component specific priv argument to @event_cb callback function
+ *
+ * The Public API to register a event cb handler. This cb is called whenever
+ * any scan event is received.
+ *
+ * Return: 0 for success or error code.
+ */
+
+QDF_STATUS
+ucfg_scan_register_event_handler(struct wlan_objmgr_vdev *vdev,
+	scan_event_handler event_cb, void *arg);
+
+/**
+ * ucfg_scan_unregister_event_handler() - Public API to unregister
+ * event cb handler
+ * @vdev: vdev object
+ * @event_cb: callback function to unregister
+ * @arg: component specific priv argument to @event_cb callback function
+ *
+ * Unregister a event cb handler. cb and arg will be used to
+ * find the calback.
+ *
+ * Return: void
+ */
+
+void
+ucfg_scan_unregister_event_handler(struct wlan_objmgr_vdev *vdev,
+	scan_event_handler event_cb, void *arg);
+
+/**
+ * ucfg_scan_init_default_params() - get the defaults scan params
+ * @vdev: vdev object
+ * @req: scan request object
+ *
+ * get the defaults scan params
+ *
+ * Return: QDF_STATUS_SUCCESS or error code
+ */
+QDF_STATUS
+ucfg_scan_init_default_params(struct wlan_objmgr_vdev *vdev,
+	struct scan_start_request *req);
+
+/**
+ * ucfg_scan_init_ssid_params() - initialize scan request ssid list
+ *
+ * @scan_req: scan request object
+ * @num_ssid: number of ssid's in ssid list
+ * @ssid_list: ssid list
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS
+ucfg_scan_init_ssid_params(struct scan_start_request *scan_req,
+	uint32_t num_ssid, struct wlan_ssid *ssid_list);
+
+/**
+ * ucfg_scan_init_bssid_params() - initialize scan request bssid list
+ * @scan_req: scan request object
+ * @num_ssid: number of bssid's in bssid list
+ * @bssid_list: bssid list
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS
+ucfg_scan_init_bssid_params(struct scan_start_request *scan_req,
+	uint32_t num_ssid, struct qdf_mac_addr *bssid_list);
+
+/**
+ * ucfg_scan_init_chanlist_params() - initialize scan request channel list
+ * @scan_req: scan request object
+ * @num_ssid: number of channels in channel list
+ * @bssid_list: channel list
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS
+ucfg_scan_init_chanlist_params(struct scan_start_request *scan_req,
+	uint32_t num_chans, uint32_t *chan_list);
+
+/**
+ * ucfg_scan_get_vdev_status() - API to check vdev scan status
+ * @vdev: vdev object
+ *
+ * Return: enum scm_scan_status
+ */
+enum scm_scan_status
+ucfg_scan_get_vdev_status(struct wlan_objmgr_vdev *vdev);
+
+/**
+ * ucfg_scan_get_pdev_status() - API to check pdev scan status
+ * @pdev: vdev object
+ *
+ * Return: enum scm_scan_status
+ */
+enum scm_scan_status
+ucfg_scan_get_pdev_status(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * update_beacon_cb() - cb to inform/update beacon
+ * @psoc: psoc pointer
+ * @scan_params:  scan entry to inform/update
+ *
+ * @Return: void
+ */
+typedef void (*update_beacon_cb) (struct wlan_objmgr_pdev *pdev,
+	struct scan_cache_entry *scan_entry);
+
+/**
+ * ucfg_scan_register_bcn_cb() - API to register api
+ * to inform/update bcn/probe as soon as they are received
+ * @pdev: psoc
+ * @cb: callback to be registered
+ * @type: Type of callback to be registered
+ *
+ * Return: enum scm_scan_status
+ */
+QDF_STATUS ucfg_scan_register_bcn_cb(struct wlan_objmgr_psoc *psoc,
+	update_beacon_cb cb, enum scan_cb_type type);
+
+/*
+ * ucfg_scan_init() - Scan module initialization API
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_scan_init(void);
+
+/**
+ * ucfg_scan_deinit() - Scan module deinitilization API
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_scan_deinit(void);
+
+/**
+ * ucfg_scan_psoc_enable() - Scan module enable API
+ * @psoc: psoc object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_scan_psoc_enable(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_scan_psoc_enable() - Scan module disable API
+ * @psoc: psoc object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_scan_psoc_disable(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_scan_psoc_open() - Scan module psoc open API
+ * @psoc: psoc object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_scan_psoc_open(struct wlan_objmgr_psoc *psoc);
+
+/**
+ * ucfg_scan_psoc_close() - Scan module psoc close API
+ * @psoc: psoc object
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS ucfg_scan_psoc_close(struct wlan_objmgr_psoc *psoc);
+
+#endif
diff --git a/umac/scan/dispatcher/inc/wlan_scan_utils_api.h b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h
new file mode 100644
index 0000000..610cb13
--- /dev/null
+++ b/umac/scan/dispatcher/inc/wlan_scan_utils_api.h
@@ -0,0 +1,1254 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan public utility functions
+ */
+
+#ifndef _WLAN_SCAN_UTILS_H_
+#define _WLAN_SCAN_UTILS_H_
+
+#include <wlan_objmgr_cmn.h>
+#include <qdf_mc_timer.h>
+#include <wlan_scan_public_structs.h>
+#include<wlan_mgmt_txrx_utils_api.h>
+
+/**
+ * util_is_scan_entry_match() - func to check if both scan entry
+ * are from same AP
+ * @entry1: scan entry 1
+ * @entry2: scan entry 2
+ *
+ * match the two scan entries
+ *
+ * Return: true if entry match else false.
+ */
+bool util_is_scan_entry_match(
+	struct scan_cache_entry *entry1,
+	struct scan_cache_entry *entry2);
+
+/**
+ * util_scan_unpack_beacon_frame() - func to unpack beacon frame to scan entry
+ * @frame: beacon/probe frame
+ * @frame_len: beacon frame len
+ * @frm_subtype: beacon or probe
+ * @rx_param: rx meta data
+ *
+ * get the defaults scan params
+ *
+ * Return: unpacked scan entry.
+ */
+struct scan_cache_entry *util_scan_unpack_beacon_frame(
+	uint8_t *frame, qdf_size_t frame_len, uint32_t frm_subtype,
+	struct mgmt_rx_event_params *rx_param);
+
+/**
+ * util_scan_get_ev_type_name() - converts enum event to printable string
+ * @event:      event of type scan_event_type
+ *
+ * API, converts enum event to printable character string
+ *
+ * Return:      pointer to printable string
+ */
+const char *util_scan_get_ev_type_name(enum scan_event_type event);
+
+/**
+ * util_scan_get_ev_reason_name() - converts enum reason to printable string
+ * @reason      enum of scan completion reason
+ *
+ * API, converts enum event to printable character string
+ *
+ * Return:      pointer to printable string
+ */
+const char *util_scan_get_ev_reason_name(enum scan_completion_reason reason);
+
+/**
+ * util_scan_entry_macaddr() - function to read transmitter address
+ * @scan_entry: scan entry
+ *
+ * API, function to read transmitter address of scan entry
+ *
+ * Return:      pointer to mac address
+ */
+static inline uint8_t*
+util_scan_entry_macaddr(struct scan_cache_entry *scan_entry)
+{
+	return &(scan_entry->mac_addr.bytes[0]);
+}
+
+/**
+ * util_scan_entry_bssid() - function to read bssid
+ * @scan_entry: scan entry
+ *
+ * API, function to read bssid of scan entry
+ *
+ * Return: pointer to mac address
+ */
+static inline uint8_t*
+util_scan_entry_bssid(struct scan_cache_entry *scan_entry)
+{
+	return &(scan_entry->bssid.bytes[0]);
+}
+
+/**
+ * util_scan_entry_capinfo() - function to read capibility info
+ * @scan_entry: scan entry
+ *
+ * API, function to read capibility info of scan entry
+ *
+ * Return: capability info
+ */
+static inline union wlan_capability
+util_scan_entry_capinfo(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->cap_info;
+}
+
+/**
+ * util_scan_entry_beacon_interval() - function to read beacon interval
+ * @scan_entry: scan entry
+ *
+ * API, function to read beacon interval of scan entry
+ *
+ * Return: beacon interval
+ */
+static inline uint16_t
+util_scan_entry_beacon_interval(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->bcn_int;
+}
+
+/**
+ * util_scan_entry_sequence_number() - function to read sequence number
+ * @scan_entry: scan entry
+ *
+ * API, function to read sequence number of scan entry
+ *
+ * Return: sequence number
+ */
+static inline uint16_t
+util_scan_entry_sequence_number(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->seq_num;
+}
+
+/**
+ * util_scan_entry_tsf() - function to read tsf
+ * @scan_entry: scan entry
+ *
+ * API, function to read tsf of scan entry
+ *
+ * Return: tsf
+ */
+static inline uint8_t*
+util_scan_entry_tsf(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->tsf_info.data;
+}
+
+/**
+ * util_scan_entry_reset_timestamp() - function to reset bcn receive timestamp
+ * @scan_entry: scan entry
+ *
+ * API, function to reset bcn receive timestamp of scan entry
+ *
+ * Return: void
+ */
+static inline void
+util_scan_entry_reset_timestamp(struct scan_cache_entry *scan_entry)
+{
+	scan_entry->scan_entry_time = 0;
+}
+
+/*
+ * Macros used for RSSI calculation.
+ */
+
+#define WLAN_RSSI_EP_MULTIPLIER (1<<7)  /* pow2 to optimize out * and / */
+
+#define WLAN_RSSI_LPF_LEN       10
+#define WLAN_RSSI_DUMMY_MARKER  0x127
+
+#define WLAN_EP_MUL(x, mul) ((x) * (mul))
+
+#define WLAN_EP_RND(x, mul) ((((x)%(mul)) >= ((mul)/2)) ?\
+	((x) + ((mul) - 1)) / (mul) : (x)/(mul))
+
+#define WLAN_RSSI_GET(x) WLAN_EP_RND(x, WLAN_RSSI_EP_MULTIPLIER)
+
+#define RSSI_LPF_THRESHOLD      -20
+
+
+#define WLAN_RSSI_OUT(x) (((x) != WLAN_RSSI_DUMMY_MARKER) ?     \
+	(WLAN_EP_RND((x), WLAN_RSSI_EP_MULTIPLIER)) :  WLAN_RSSI_DUMMY_MARKER)
+
+
+#define WLAN_RSSI_IN(x)         (WLAN_EP_MUL((x), WLAN_RSSI_EP_MULTIPLIER))
+
+#define WLAN_LPF_RSSI(x, y, len) \
+	((x != WLAN_RSSI_DUMMY_MARKER) ? ((((x) << 3) + (y) - (x)) >> 3) : (y))
+
+#define WLAN_RSSI_LPF(x, y) do { \
+	if ((y) >= RSSI_LPF_THRESHOLD) \
+		x = WLAN_LPF_RSSI((x), WLAN_RSSI_IN((y)), WLAN_RSSI_LPF_LEN); \
+	} while (0)
+
+#define WLAN_ABS_RSSI_LPF(x, y) do { \
+	if ((y) >= (RSSI_LPF_THRESHOLD + WLAN_DEFAULT_NOISE_FLOOR)) \
+		x = WLAN_LPF_RSSI((x), WLAN_RSSI_IN((y)), WLAN_RSSI_LPF_LEN); \
+	} while (0)
+
+/**
+ * util_scan_entry_rssi() - function to read rssi of scan entry
+ * @scan_entry: scan entry
+ *
+ * API, function to read rssi value of scan entry
+ *
+ * Return: rssi
+ */
+static inline uint8_t
+util_scan_entry_rssi(struct scan_cache_entry *scan_entry)
+{
+	uint32_t rssi = WLAN_RSSI_OUT(scan_entry->avg_rssi);
+	/*
+	 * An entry is in the BSS list means we've received at least one beacon
+	 * from the corresponding AP, so the rssi must be initialized.
+	 *
+	 * If the RSSI is not initialized, return 0 (i.e. RSSI == Noise Floor).
+	 * Once se_avgrssi field has been initialized, ATH_RSSI_OUT always
+	 * returns values that fit in an 8-bit variable
+	 * (RSSI values are typically 0-90).
+	 */
+	return (rssi >= WLAN_RSSI_DUMMY_MARKER) ? 0 : (uint8_t) rssi;
+}
+
+/**
+ * util_scan_entry_phymode() - function to read phymode of scan entry
+ * @scan_entry: scan entry
+ *
+ * API, function to read phymode of scan entry
+ *
+ * Return: phymode
+ */
+static inline enum wlan_phymode
+util_scan_entry_phymode(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->phy_mode;
+}
+
+/**
+ * util_is_ssid_match() - to check if ssid match
+ * @ssid1: ssid 1
+ * @ssid2: ssid 2
+ *
+ * Return: true if ssid match
+ */
+static inline bool
+util_is_ssid_match(struct wlan_ssid *ssid1,
+		struct wlan_ssid *ssid2)
+{
+
+	if (ssid1->length == 0)
+		return true;
+
+	if (ssid1->length != ssid2->length)
+		return false;
+
+	if (!qdf_mem_cmp(ssid1->ssid,
+	   ssid2->ssid, ssid1->length))
+		return true;
+
+	return false;
+}
+
+/**
+ * util_is_bssid_match() - to check if bssid match
+ * @bssid1: bssid 1
+ * @bssid2: bssid 2
+ *
+ * Return: true if bssid match
+ */
+static inline bool util_is_bssid_match(struct qdf_mac_addr *bssid1,
+	struct qdf_mac_addr *bssid2)
+{
+
+	if (qdf_is_macaddr_zero(bssid1) ||
+	   qdf_is_macaddr_broadcast(bssid1))
+		return true;
+
+	if (qdf_is_macaddr_equal(bssid1, bssid2))
+		return true;
+
+	return false;
+}
+
+/**
+ * util_is_bss_type_match() - to check if bss type
+ * @bss_type: bss type
+ * @cap: capability
+ *
+ * Return: true if bss type match
+ */
+static inline bool util_is_bss_type_match(enum wlan_bss_type bss_type,
+	union wlan_capability cap)
+{
+	bool match = true;
+
+	switch (bss_type) {
+	case WLAN_TYPE_ANY:
+		break;
+	case WLAN_TYPE_IBSS:
+		if (!cap.wlan_caps.ibss)
+			match = false;
+		break;
+	case WLAN_TYPE_BSS:
+		if (!cap.wlan_caps.ess)
+			match = false;
+		break;
+	default:
+		match = false;
+	}
+
+	return match;
+}
+
+/**
+ * util_country_code_match() - to check if country match
+ * @country: country code pointer
+ * @country_ie: country IE in beacon
+ *
+ * Return: true if country match
+ */
+static inline bool util_country_code_match(uint8_t *country,
+	uint8_t *country_ie)
+{
+	struct wlan_country_ie *cc =
+		(struct wlan_country_ie *)country;
+
+	if (!country || !country[0])
+		return true;
+
+	if (!cc)
+		return false;
+
+	if (cc->cc[0] == country[0] &&
+		cc->cc[1] == country[1])
+		return true;
+
+	return false;
+}
+
+/**
+ * util_mdie_match() - to check if mdie match
+ * @mobility_domain: mobility domain
+ * @mdie: mobility domain ie
+ *
+ * Return: true if country match
+ */
+static inline bool util_mdie_match(uint16_t mobility_domain,
+	struct rsn_mdie *mdie)
+{
+	uint16_t md;
+
+	if (!mobility_domain)
+		return true;
+
+	if (!mdie)
+		return false;
+
+	md =
+	  (mdie->mobility_domain[1] << 8) |
+	   mdie->mobility_domain[0];
+
+	if (md == mobility_domain)
+		return true;
+
+	return false;
+}
+
+/**
+ * util_scan_entry_ssid() - function to read ssid of scan entry
+ * @scan_entry: scan entry
+ *
+ * API, function to read ssid of scan entry
+ *
+ * Return: ssid
+ */
+static inline struct wlan_ssid*
+util_scan_entry_ssid(struct scan_cache_entry *scan_entry)
+{
+	return &(scan_entry->ssid);
+}
+
+/**
+ * util_scan_entry_dtimperiod() - function to read dtim period of scan entry
+ * @scan_entry: scan entry
+ *
+ * API, function to read dtim period of scan entry
+ *
+ * Return: dtim period
+ */
+static inline uint8_t
+util_scan_entry_dtimperiod(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->dtim_period;
+}
+
+/**
+ * util_scan_entry_tim() - function to read tim ie of scan entry
+ * @scan_entry: scan entry
+ *
+ * API, function to read tim ie of scan entry
+ *
+ * Return: timie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_tim(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.tim;
+}
+
+/**
+ * util_scan_entry_beacon_frame() - function to read full beacon or
+ * probe resp frame
+ * @scan_entry: scan entry
+ *
+ * API, function to read full beacon or probe resp frame including frame header
+ *
+ * Return: beacon/probe resp frame
+ */
+static inline struct element_info
+util_scan_entry_beacon_frame(struct scan_cache_entry *scan_entry)
+{
+	/* util_scan_entry_beacon_data */
+	return scan_entry->raw_frame;
+}
+
+/**
+ * util_scan_entry_ie_data() - function to read tagged IEs
+ * @scan_entry: scan entry
+ *
+ * API, function to read beacon/probe response frames starting from tagged IEs
+ * (excluding frame header and fixed parameters)
+ *
+ * Return: tagged IES of beacon/probe resp frame
+ */
+static inline uint8_t*
+util_scan_entry_ie_data(struct scan_cache_entry *scan_entry)
+{
+	struct element_info bcn_frm;
+	uint8_t *ie_data = NULL;
+
+	bcn_frm = util_scan_entry_beacon_frame(scan_entry);
+	ie_data = (uint8_t *) (bcn_frm.ptr +
+		 sizeof(struct wlan_frame_hdr) +
+		 offsetof(struct wlan_bcn_frame, ie));
+	return ie_data;
+}
+
+/**
+ * util_scan_entry_ie_len() - function to read length of all tagged IEs
+ * @scan_entry: scan entry
+ *
+ * API, function to read length of all tagged IEs
+ *
+ * Return: length of all tagged IEs
+ */
+static inline uint16_t
+util_scan_entry_ie_len(struct scan_cache_entry *scan_entry)
+{
+	struct element_info bcn_frm;
+	uint16_t ie_len = 0;
+
+	bcn_frm = util_scan_entry_beacon_frame(scan_entry);
+	ie_len = (uint16_t) (bcn_frm.len -
+		sizeof(struct wlan_frame_hdr) -
+		offsetof(struct wlan_bcn_frame, ie));
+	return ie_len;
+}
+
+/**
+ * util_scan_entry_frame_len() - function to frame length
+ * @scan_entry: scan entry
+ *
+ * API, function to read frame length
+ *
+ * Return: frame length
+ */
+static inline uint32_t
+util_scan_entry_frame_len(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->raw_frame.len;
+}
+
+/**
+ * util_scan_entry_frame_ptr() - function to get frame ptr
+ * @scan_entry: scan entry
+ *
+ * API, function to read frame ptr
+ *
+ * Return: frame ptr
+ */
+static inline uint8_t*
+util_scan_entry_frame_ptr(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->raw_frame.ptr;
+}
+
+/**
+ * util_scan_entry_copy_ie_data() - function to get a copy of all tagged IEs
+ * @scan_entry: scan entry
+ *
+ * API, function to get a copy of all tagged IEs in passed memory
+ *
+ * Return: QDF_STATUS_SUCCESS if tagged IEs copied successfully
+ *         QDF_STATUS_E_NOMEM if passed memory/length can't hold all tagged IEs
+ */
+static inline QDF_STATUS
+util_scan_entry_copy_ie_data(struct scan_cache_entry *scan_entry,
+	uint8_t *iebuf, uint16_t *ie_len)
+{
+	u_int8_t     *buff;
+	u_int16_t    buff_len;
+
+	/* iebuf can be NULL, ie_len must be a valid pointer. */
+	QDF_ASSERT(ie_len != NULL);
+
+	buff = util_scan_entry_ie_data(scan_entry);
+	buff_len = util_scan_entry_ie_len(scan_entry);
+	/*
+	 * If caller passed a buffer, check the length to make sure
+	 * it's large enough.
+	 * If no buffer is passed, just return the length of the IE blob.
+	 */
+	if (iebuf != NULL) {
+		if (*ie_len >= buff_len) {
+			qdf_mem_copy(iebuf, buff, buff_len);
+			*ie_len = buff_len;
+			return QDF_STATUS_SUCCESS;
+		}
+	}
+
+	*ie_len = buff_len;
+	return QDF_STATUS_E_NOMEM;
+}
+
+/**
+ * util_scan_free_cache_entry() - function to free scan
+ * cache entry
+ * @scan_entry: scan entry
+ *
+ * API, function to free scan cache entry
+ *
+ * Return: void
+ */
+static inline void
+util_scan_free_cache_entry(struct scan_cache_entry *scan_entry)
+{
+	if (!scan_entry)
+		return;
+	if (scan_entry->alt_wcn_ie.ptr)
+		qdf_mem_free(scan_entry->alt_wcn_ie.ptr);
+	if (scan_entry->raw_frame.ptr)
+		qdf_mem_free(scan_entry->raw_frame.ptr);
+	qdf_mem_free(scan_entry);
+}
+
+#define conv_ptr(_address, _base1, _base2) \
+	((_address != NULL) ? (((u_int8_t *) (_address) - \
+	(u_int8_t *) (_base1)) + (u_int8_t *) (_base2)) : NULL)
+
+/**
+ * util_scan_copy_beacon_data() - copy beacon and update ie ptrs
+ * cache entry
+ * @new_entry: new scan entry
+ * @scan_entry: entry from where data is copied
+ *
+ * API, function to copy beacon and update ie ptrs
+ *
+ * Return: QDF_STATUS
+ */
+static inline QDF_STATUS
+util_scan_copy_beacon_data(struct scan_cache_entry *new_entry,
+	struct scan_cache_entry *scan_entry)
+{
+	u_int8_t *new_ptr, *old_ptr;
+	struct ie_list *ie_lst;
+
+	new_entry->raw_frame.ptr =
+		qdf_mem_malloc(scan_entry->raw_frame.len);
+	if (!new_entry->raw_frame.ptr)
+		return QDF_STATUS_E_NOMEM;
+
+	qdf_mem_copy(new_entry->raw_frame.ptr,
+		scan_entry->raw_frame.ptr,
+		scan_entry->raw_frame.len);
+
+	new_ptr = new_entry->raw_frame.ptr;
+	old_ptr = scan_entry->raw_frame.ptr;
+
+	new_entry->ie_list = scan_entry->ie_list;
+
+	ie_lst = &new_entry->ie_list;
+
+	/* New info_element needs also be added in ieee80211_parse_beacon */
+	ie_lst->tim = conv_ptr(ie_lst->tim, old_ptr, new_ptr);
+	ie_lst->country = conv_ptr(ie_lst->country, old_ptr, new_ptr);
+	ie_lst->ssid = conv_ptr(ie_lst->ssid, old_ptr, new_ptr);
+	ie_lst->rates = conv_ptr(ie_lst->rates, old_ptr, new_ptr);
+	ie_lst->xrates = conv_ptr(ie_lst->xrates, old_ptr, new_ptr);
+	ie_lst->csa = conv_ptr(ie_lst->csa, old_ptr, new_ptr);
+	ie_lst->xcsa = conv_ptr(ie_lst->xcsa, old_ptr, new_ptr);
+	ie_lst->secchanoff = conv_ptr(ie_lst->secchanoff, old_ptr, new_ptr);
+	ie_lst->wpa = conv_ptr(ie_lst->wpa, old_ptr, new_ptr);
+	ie_lst->wcn = conv_ptr(ie_lst->wcn, old_ptr, new_ptr);
+	ie_lst->rsn = conv_ptr(ie_lst->rsn, old_ptr, new_ptr);
+	ie_lst->wps = conv_ptr(ie_lst->wps, old_ptr, new_ptr);
+	ie_lst->wmeinfo = conv_ptr(ie_lst->wmeinfo, old_ptr, new_ptr);
+	ie_lst->wmeparam = conv_ptr(ie_lst->wmeparam, old_ptr, new_ptr);
+	ie_lst->quiet = conv_ptr(ie_lst->quiet, old_ptr, new_ptr);
+	ie_lst->htcap = conv_ptr(ie_lst->htcap, old_ptr, new_ptr);
+	ie_lst->htinfo = conv_ptr(ie_lst->htinfo, old_ptr, new_ptr);
+	ie_lst->athcaps = conv_ptr(ie_lst->athcaps, old_ptr, new_ptr);
+	ie_lst->athextcaps = conv_ptr(ie_lst->athextcaps, old_ptr, new_ptr);
+	ie_lst->sfa = conv_ptr(ie_lst->sfa, old_ptr, new_ptr);
+	ie_lst->vendor = conv_ptr(ie_lst->vendor, old_ptr, new_ptr);
+	ie_lst->qbssload = conv_ptr(ie_lst->qbssload, old_ptr, new_ptr);
+	ie_lst->wapi = conv_ptr(ie_lst->wapi, old_ptr, new_ptr);
+	ie_lst->p2p = conv_ptr(ie_lst->p2p, old_ptr, new_ptr);
+	ie_lst->alt_wcn = conv_ptr(ie_lst->alt_wcn, old_ptr, new_ptr);
+	ie_lst->extcaps = conv_ptr(ie_lst->extcaps, old_ptr, new_ptr);
+	ie_lst->ibssdfs = conv_ptr(ie_lst->ibssdfs, old_ptr, new_ptr);
+	ie_lst->sonadv = conv_ptr(ie_lst->sonadv, old_ptr, new_ptr);
+	ie_lst->vhtcap = conv_ptr(ie_lst->vhtcap, old_ptr, new_ptr);
+	ie_lst->vhtop = conv_ptr(ie_lst->vhtop, old_ptr, new_ptr);
+	ie_lst->opmode = conv_ptr(ie_lst->opmode, old_ptr, new_ptr);
+	ie_lst->cswrp = conv_ptr(ie_lst->cswrp, old_ptr, new_ptr);
+	ie_lst->widebw = conv_ptr(ie_lst->widebw, old_ptr, new_ptr);
+	ie_lst->txpwrenvlp = conv_ptr(ie_lst->txpwrenvlp, old_ptr, new_ptr);
+	ie_lst->bwnss_map = conv_ptr(ie_lst->bwnss_map, old_ptr, new_ptr);
+	ie_lst->mdie = conv_ptr(ie_lst->mdie, old_ptr, new_ptr);
+
+	return QDF_STATUS_SUCCESS;
+}
+/**
+ * util_scan_copy_cache_entry() - function to create a copy
+ * of scan cache entry
+ * @scan_entry: scan entry
+ *
+ * API, function to create a copy of scan cache entry
+ *
+ * Return: copy of scan_entry
+ */
+static inline struct scan_cache_entry *
+util_scan_copy_cache_entry(struct scan_cache_entry *scan_entry)
+{
+	struct scan_cache_entry *new_entry;
+	QDF_STATUS status;
+
+	if (!scan_entry)
+		return NULL;
+
+	new_entry =
+	   qdf_mem_malloc(sizeof(*scan_entry));
+	if (!new_entry)
+		return NULL;
+
+	qdf_mem_copy(new_entry,
+		scan_entry, sizeof(*scan_entry));
+
+	if (scan_entry->alt_wcn_ie.ptr) {
+		new_entry->alt_wcn_ie.ptr =
+		    qdf_mem_malloc(scan_entry->alt_wcn_ie.len);
+		if (!new_entry->alt_wcn_ie.ptr) {
+			qdf_mem_free(new_entry);
+			return NULL;
+		}
+		qdf_mem_copy(new_entry->alt_wcn_ie.ptr,
+		   scan_entry->alt_wcn_ie.ptr,
+		   scan_entry->alt_wcn_ie.len);
+		new_entry->alt_wcn_ie.len =
+			scan_entry->alt_wcn_ie.len;
+	}
+
+	status = util_scan_copy_beacon_data(new_entry, scan_entry);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		util_scan_free_cache_entry(new_entry);
+		return NULL;
+	}
+
+	return new_entry;
+}
+
+/**
+ * util_scan_entry_channel() - function to read channel info
+ * @scan_entry: scan entry
+ *
+ * API, function to read channel info
+ *
+ * Return: channel info
+ */
+static inline struct channel_info*
+util_scan_entry_channel(struct scan_cache_entry *scan_entry)
+{
+	return &(scan_entry->channel);
+}
+
+/**
+ * util_scan_entry_channel_num() - function to read channel number
+ * @scan_entry: scan entry
+ *
+ * API, function to read channel number
+ *
+ * Return: channel number
+ */
+static inline uint8_t
+util_scan_entry_channel_num(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->channel.chan_idx;
+}
+
+/**
+ * util_scan_entry_erpinfo() - function to read erp info
+ * @scan_entry: scan entry
+ *
+ * API, function to read erp info
+ *
+ * Return: erp info
+ */
+static inline uint8_t
+util_scan_entry_erpinfo(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->erp;
+}
+
+/**
+ * util_scan_entry_rates() - function to read supported rates IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read supported rates IE
+ *
+ * Return: basic ratesie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_rates(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.rates;
+}
+
+/**
+ * util_scan_entry_xrates()- function to read extended supported rates IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read extended supported rates IE
+ *
+ * Return: extended supported ratesie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_xrates(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.xrates;
+}
+
+/**
+ * util_scan_entry_rsn()- function to read rsn IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read rsn IE
+ *
+ * Return: rsnie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_rsn(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.rsn;
+}
+
+/**
+ * util_scan_entry_wpa() - function to read wpa IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read wpa IE
+ *
+ * Return: wpaie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_wpa(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.wpa;
+}
+
+/**
+ * util_scan_entry_wapi() - function to read wapi IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read wapi IE
+ *
+ * Return: wapiie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_wapi(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.wapi;
+}
+
+/**
+ * util_scan_entry_wps() - function to read wps IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read wps IE
+ *
+ * Return: wpsie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_wps(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.wps;
+}
+
+/**
+ * util_scan_entry_sfa() - function to read sfa IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read sfa IE
+ *
+ * Return: sfaie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_sfa(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.sfa;
+}
+
+/**
+ * util_scan_entry_csa() - function to read csa IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read csa IE
+ *
+ * Return: csaie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_csa(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.csa;
+}
+
+/**
+ * util_scan_entry_xcsa() - function to read extended csa IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read extended csa IE
+ *
+ * Return: extended csaie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_xcsa(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.xcsa;
+}
+
+/**
+ * util_scan_entry_htinfo() - function to read htinfo IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read htinfo IE
+ *
+ * Return: htinfoie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_htinfo(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.htinfo;
+}
+
+
+/**
+ * util_scan_entry_htcap() - function to read htcap IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read htcap IE
+ *
+ * Return: htcapie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_htcap(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.htcap;
+}
+
+/**
+ * util_scan_entry_vhtcap() - function to read vhtcap IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read vhtcap IE
+ *
+ * Return: vhtcapie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_vhtcap(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.vhtcap;
+}
+
+/**
+ * util_scan_entry_vhtop() - function to read vhtop IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read vhtop IE
+ *
+ * Return: vhtopie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_vhtop(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.vhtop;
+}
+
+/**
+ * util_scan_entry_quiet() - function to read quiet IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read quiet IE
+ *
+ * Return: quietie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_quiet(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.quiet;
+}
+
+/**
+ * util_scan_entry_qbssload() - function to read qbss load IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read qbss load IE
+ *
+ * Return: qbss loadie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_qbssload(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.qbssload;
+}
+
+/**
+ * util_scan_entry_vendor() - function to read vendor IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read vendor IE
+ *
+ * Return: vendorie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_vendor(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.vendor;
+}
+
+/**
+ * util_scan_entry_country() - function to read country IE
+ * @scan_entry: scan entry
+ *
+ * API, function to read country IE
+ *
+ * Return: countryie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_country(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.country;
+}
+
+/**
+ * util_scan_entry_copy_country() - function to copy country name
+ * @scan_entry: scan entry
+ * @cntry:      out buffer
+ *
+ * API, function to copy country name code string in given memory @centry
+ *
+ * Return: QDF_STATUS_SUCCESS if successfully copied country name
+ *         QDF_STATUS_E_INVAL if passed buffer is null
+ *         QDF_STATUS_E_NOMEM if scan entry dont have country IE
+ */
+static inline QDF_STATUS
+util_scan_entry_copy_country(struct scan_cache_entry *scan_entry,
+	uint8_t *cntry)
+{
+	struct wlan_country_ie *country_ie;
+
+	if (!cntry)
+		return QDF_STATUS_E_INVAL;
+
+	country_ie = (struct wlan_country_ie *)
+		util_scan_entry_country(scan_entry);
+
+	if (!country_ie)
+		return QDF_STATUS_E_NOMEM;
+
+	qdf_mem_copy(cntry, country_ie->cc, 3);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * util_scan_entry_wmeinfo() - function to read wme info ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read wme info ie
+ *
+ * Return: wme infoie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_wmeinfo(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.wmeinfo;
+}
+
+/**
+ * util_scan_entry_wmeparam() - function to read wme param ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read wme param ie
+ *
+ * Return: wme paramie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_wmeparam(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.wmeparam;
+}
+
+/**
+ * util_scan_entry_age() - function to read age of scan entry
+ * @scan_entry: scan entry
+ *
+ * API, function to read age of scan entry
+ *
+ * Return: age in ms
+ */
+static inline uint32_t
+util_scan_entry_age(struct scan_cache_entry *scan_entry)
+{
+	unsigned long ts = scan_entry->scan_entry_time;
+
+	return qdf_mc_timer_get_system_time() - ts;
+}
+
+/**
+ * util_scan_mlme_info() - function to read mlme info struct
+ * @scan_entry: scan entry
+ *
+ * API, function to read mlme info struct
+ *
+ * Return: mlme info
+ */
+static inline struct mlme_info*
+util_scan_mlme_info(struct scan_cache_entry *scan_entry)
+{
+	return &scan_entry->mlme_info;
+}
+
+/**
+ * util_scan_entry_bss_type() - function to read bss type
+ * @scan_entry: scan entry
+ *
+ * API, function to read bss type
+ *
+ * Return: bss type
+ */
+static inline enum wlan_bss_type
+util_scan_entry_bss_type(struct scan_cache_entry *scan_entry)
+{
+	if (scan_entry->cap_info.value & WLAN_CAPINFO_ESS)
+		return WLAN_TYPE_BSS;
+	else if (scan_entry->cap_info.value & WLAN_CAPINFO_IBSS)
+		return WLAN_TYPE_IBSS;
+	else
+		return WLAN_TYPE_ANY;
+}
+
+/**
+ * util_scan_entry_privacy() - function to check if privacy is enebled
+ * @scan_entry: scan entry
+ *
+ * API, function to check if privacy is enebled
+ *
+ * Return: true if privacy is enabled, false other wise
+ */
+static inline bool
+util_scan_entry_privacy(struct scan_cache_entry *scan_entry)
+{
+	return (scan_entry->cap_info.value &
+		WLAN_CAPINFO_PRIVACY) ? true : false;
+}
+
+/**
+ * util_scan_entry_athcaps() - function to read ath caps vendor ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read ath caps vendor ie
+ *
+ * Return: ath caps vendorie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_athcaps(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.athcaps;
+}
+
+/**
+ * util_scan_entry_athextcaps() - function to read ath extcaps vendor ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read ath extcaps vendor ie
+ *
+ * Return: ath extcaps vendorie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_athextcaps(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.athextcaps;
+}
+
+/**
+ * util_scan_entry_bwnss_map() - function to read bwnss_map ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read bwnss_map ie
+ *
+ * Return: bwnss_map ie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_bwnss_map(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.bwnss_map;
+}
+
+/**
+ * util_scan_entry_sonie() - function to read son ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read son ie
+ *
+ * Return: son ie or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_sonie(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.sonadv;
+}
+
+/**
+ * util_scan_entry_widebw() - function to read wide band chan switch sub elem ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read wide band chan switch sub elem ie
+ *
+ * Return: wide band chan switch sub elem or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_widebw(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.widebw;
+}
+
+/**
+ * util_scan_entry_secchanoff() - function to read secondary channel offset ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read secondary channel offset ie
+ *
+ * Return: secondary channel offset element or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_secchanoff(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.secchanoff;
+}
+
+/**
+ * util_scan_entry_cswrp() - function to read channel switch wrapper ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read channel switch wrapper ie
+ *
+ * Return: channel switch wrapper element or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_cswrp(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.cswrp;
+}
+
+/**
+ * util_scan_entry_omn() - function to read operating mode notification ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read operating mode notification
+ *
+ * Return: operating mode notification element or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_omn(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.opmode;
+}
+
+/**
+ * util_scan_entry_extcaps() - function to read extcap ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read extcap ie
+ *
+ * Return: extcap element or NULL if ie is not present
+ */
+static inline uint8_t*
+util_scan_entry_extcaps(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.extcaps;
+}
+
+/**
+ * util_scan_entry_athcaps() - function to read ath caps vendor ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read ath caps vendor ie
+ *
+ * Return: ath caps vendorie or NULL if ie is not present
+ */
+static inline struct mlme_info*
+util_scan_entry_mlme_info(struct scan_cache_entry *scan_entry)
+{
+	return &(scan_entry->mlme_info);
+}
+
+/**
+ * util_get_last_scan_time() - function to get last scan time on this pdev
+ * @vdev: vdev object
+ *
+ * API, function to read last scan time on this pdev
+ *
+ * Return: qdf_time_t
+ */
+qdf_time_t
+util_get_last_scan_time(struct wlan_objmgr_vdev *vdev);
+
+#endif
+
diff --git a/umac/scan/dispatcher/src/wlan_scan_tgt_api.c b/umac/scan/dispatcher/src/wlan_scan_tgt_api.c
new file mode 100644
index 0000000..70b339a
--- /dev/null
+++ b/umac/scan/dispatcher/src/wlan_scan_tgt_api.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan south bound interface definitions
+ */
diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c
new file mode 100644
index 0000000..338043c
--- /dev/null
+++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: contains scan north bound interface definitions
+ */
diff --git a/umac/scan/dispatcher/src/wlan_scan_utils_api.c b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
new file mode 100644
index 0000000..13a309c
--- /dev/null
+++ b/umac/scan/dispatcher/src/wlan_scan_utils_api.c
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * DOC: Defines scan utility functions
+ */