Browse Source

Merge "qcacmn: Fix ext Tx descriptor pool lock issue"

Linux Build Service Account 7 years ago
parent
commit
42f0350da1

+ 11 - 1
dp/inc/cdp_txrx_cmn_struct.h

@@ -767,6 +767,8 @@ struct cdp_tx_stats {
 	uint32_t non_amsdu_cnt;
 	/* Number of MSDUs part of AMSDU*/
 	uint32_t amsdu_cnt;
+	/* Tx Rate */
+	uint32_t tx_rate;
 
 	/* RSSI of last packet */
 	uint32_t last_ack_rssi;
@@ -783,6 +785,9 @@ struct cdp_tx_stats {
 	/* Packet Count for different bandwidths */
 	uint32_t bw[MAX_BW];
 
+	/* Excess Retry Count */
+	uint32_t excess_retries[WME_AC_MAX];
+
 	/* Wireless Multimedia type Count */
 	uint32_t wme_ac_type[WME_AC_MAX];
 
@@ -860,6 +865,8 @@ struct cdp_rx_stats {
 	uint32_t bar_recv_cnt;
 	/* RSSI of received signal */
 	uint32_t rssi;
+	/*Rx rate */
+	uint32_t rx_rate;
 };
 
 /* Tx ingress Stats */
@@ -1074,8 +1081,8 @@ struct cdp_pdev_stats {
  * @ba_bitmap: Block Ack bitmap
  * @start_seqa: Sequence number of first MPDU
  * @enq_bitmap: Enqueue MPDU bitmap
- * @tx_duration: PPDU airtime
  * @is_mcast: MCAST or UCAST
+ * @tx_rate: Transmission Rate
  */
 struct cdp_tx_completion_ppdu_user {
 	uint32_t completion_status:8,
@@ -1119,6 +1126,7 @@ struct cdp_tx_completion_ppdu_user {
 	uint32_t tx_duration;
 	uint16_t ru_tones;
 	bool is_mcast;
+	uint32_t tx_rate;
 };
 
 /**
@@ -1131,6 +1139,7 @@ struct cdp_tx_completion_ppdu_user {
  * @num_msdu: Number of MSDUs in PPDU
  * @channel: Channel informartion
  * @ack_rssi: RSSI value of last ack packet (units=dB above noise floor)
+ * @tx_duration: PPDU airtime
  * @ppdu_start_timestamp: TSF at PPDU start
  * @ppdu_end_timestamp: TSF at PPDU end
  * @ack_timestamp: TSF at the reception of ACK
@@ -1146,6 +1155,7 @@ struct cdp_tx_completion_ppdu {
 	uint16_t channel;
 	uint16_t phy_mode;
 	uint32_t ack_rssi;
+	uint32_t tx_duration;
 	uint32_t ppdu_start_timestamp;
 	uint32_t ppdu_end_timestamp;
 	uint32_t ack_timestamp;

+ 10 - 0
dp/inc/cdp_txrx_host_stats.h

@@ -401,6 +401,16 @@ static inline void cdp_get_dp_fw_peer_stats(ol_txrx_soc_handle soc,
 			(pdev, mac, caps);
 }
 
+static inline void cdp_get_dp_htt_stats(ol_txrx_soc_handle soc,
+					struct cdp_pdev *pdev,
+					void *data, uint32_t data_len)
+{
+	if (soc->ops->host_stats_ops->get_htt_stats)
+		return soc->ops->host_stats_ops->get_htt_stats
+			(pdev, data, data_len);
+	return;
+}
+
 /**
  * @brief Parse the stats header and get the payload from the message.
  *

+ 3 - 1
dp/inc/cdp_txrx_ops.h

@@ -559,7 +559,9 @@ struct cdp_host_stats_ops {
 	void
 		(*get_fw_peer_stats)(struct cdp_pdev *pdev, uint8_t *addr,
 				uint32_t cap);
-
+	void
+		(*get_htt_stats)(struct cdp_pdev *pdev, void *data,
+				uint32_t data_len);
 };
 
 struct cdp_wds_ops {

+ 154 - 25
dp/wifi3.0/dp_htt.c

@@ -74,16 +74,28 @@ static void dp_tx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 		return;
 
 	DP_STATS_INC_PKT(peer, tx.comp_pkt,
-			num_msdu, ppdu->success_bytes);
+			num_msdu, (ppdu->success_bytes +
+				ppdu->retry_bytes + ppdu->failed_bytes));
 	DP_STATS_INC(peer, tx.tx_failed, ppdu->failed_msdus);
-	DP_STATS_INC(peer, tx.sgi_count[ppdu->gi], 1);
-	DP_STATS_INC(peer, tx.bw[ppdu->bw], 1);
+	DP_STATS_UPD(peer, tx.tx_rate, ppdu->tx_rate);
+	DP_STATS_INC(peer, tx.sgi_count[ppdu->gi], num_msdu);
+	DP_STATS_INC(peer, tx.bw[ppdu->bw], num_msdu);
 	DP_STATS_UPD(peer, tx.last_ack_rssi, ack_rssi);
-	DP_STATS_INC(peer, tx.wme_ac_type[TID_TO_WME_AC(ppdu->tid)], 1);
-	DP_STATS_INC(peer, tx.stbc, ppdu->stbc);
-	DP_STATS_INC(peer, tx.ldpc, ppdu->ldpc);
+	DP_STATS_INC(peer, tx.wme_ac_type[TID_TO_WME_AC(ppdu->tid)], num_msdu);
+	DP_STATS_INCC(peer, tx.stbc, num_msdu, ppdu->stbc);
+	DP_STATS_INCC(peer, tx.ldpc, num_msdu, ppdu->ldpc);
 	DP_STATS_INC_PKT(peer, tx.tx_success, ppdu->success_msdus,
 			ppdu->success_bytes);
+	if (ppdu->is_mcast) {
+		DP_STATS_INC_PKT(peer, tx.mcast, num_msdu, (ppdu->success_bytes
+					+ ppdu->retry_bytes +
+					ppdu->failed_bytes));
+	} else {
+		DP_STATS_INC_PKT(peer, tx.ucast, num_msdu, (ppdu->success_bytes
+					+ ppdu->retry_bytes +
+					ppdu->failed_bytes));
+	}
+
 	DP_STATS_INC(peer, tx.retries,
 			(ppdu->long_retries + ppdu->short_retries));
 	DP_STATS_INCC(peer,
@@ -1119,6 +1131,45 @@ fail0:
 	return QDF_STATUS_E_FAILURE;
 }
 
+#if defined(CONFIG_WIN) && WDI_EVENT_ENABLE
+static inline QDF_STATUS dp_send_htt_stat_resp(struct htt_stats_context *htt_stats,
+					struct dp_soc *soc, qdf_nbuf_t htt_msg)
+
+{
+	uint32_t pdev_id;
+	uint32_t *msg_word = NULL;
+	uint32_t msg_remain_len = 0;
+
+	msg_word = (uint32_t *) qdf_nbuf_data(htt_msg);
+
+	/*COOKIE MSB*/
+	pdev_id = *(msg_word + 2);
+
+	/* stats message length + 16 size of HTT header*/
+	msg_remain_len = qdf_min(htt_stats->msg_len + 16,
+				(uint32_t)DP_EXT_MSG_LENGTH);
+
+	dp_wdi_event_handler(WDI_EVENT_HTT_STATS, soc,
+			msg_word,  msg_remain_len,
+			WDI_NO_VAL, pdev_id);
+
+	if (htt_stats->msg_len >= DP_EXT_MSG_LENGTH) {
+		htt_stats->msg_len -= DP_EXT_MSG_LENGTH;
+	}
+	/* Need to be freed here as WDI handler will
+	 * make a copy of pkt to send data to application
+	 */
+	qdf_nbuf_free(htt_msg);
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static inline QDF_STATUS dp_send_htt_stat_resp(struct htt_stats_context *htt_stats,
+					struct dp_soc *soc, qdf_nbuf_t htt_msg)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
+#endif
+
 /**
  * dp_process_htt_stat_msg(): Process the list of buffers of HTT EXT stats
  * @htt_stats: htt stats info
@@ -1139,7 +1190,8 @@ fail0:
  *
  * return: void
  */
-static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats)
+static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats,
+					struct dp_soc *soc)
 {
 	htt_tlv_tag_t tlv_type = 0xff;
 	qdf_nbuf_t htt_msg = NULL;
@@ -1149,11 +1201,19 @@ static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats)
 	uint32_t msg_remain_len = 0;
 	uint32_t tlv_remain_len = 0;
 	uint32_t *tlv_start;
+	int cookie_val;
 
 	/* Process node in the HTT message queue */
 	while ((htt_msg = qdf_nbuf_queue_remove(&htt_stats->msg))
 		!= NULL) {
 		msg_word = (uint32_t *) qdf_nbuf_data(htt_msg);
+		cookie_val = *(msg_word + 1);
+		if (cookie_val) {
+			if (dp_send_htt_stat_resp(htt_stats, soc, htt_msg)
+					== QDF_STATUS_SUCCESS) {
+				continue;
+			}
+		}
 		/* read 5th word */
 		msg_word = msg_word + 4;
 		msg_remain_len = qdf_min(htt_stats->msg_len,
@@ -1303,8 +1363,7 @@ void htt_t2h_stats_handler(void *context)
 	rem_stats = --soc->htt_stats.num_stats;
 	qdf_spin_unlock_bh(&soc->htt_stats.lock);
 
-	dp_process_htt_stat_msg(&htt_stats);
-
+	dp_process_htt_stat_msg(&htt_stats, soc);
 	/* If there are more stats to process, schedule stats work again */
 	if (rem_stats)
 		qdf_sched_work(0, &soc->htt_stats.work);
@@ -1381,9 +1440,13 @@ static void dp_process_ppdu_stats_common_tlv(struct dp_pdev *pdev,
 	else
 		ppdu_desc->frame_type = CDP_PPDU_FTYPE_CTRL;
 
-	ppdu_desc->ppdu_start_timestamp = dp_stats_buf->ppdu_start_tstmp_us;
-	ppdu_desc->ppdu_end_timestamp = dp_stats_buf->ppdu_sch_end_tstmp_us;
-	tag_buf += 6;
+	tag_buf += 2;
+	ppdu_desc->tx_duration = *tag_buf;
+	tag_buf += 3;
+	ppdu_desc->ppdu_start_timestamp = *tag_buf;
+	ppdu_desc->ppdu_end_timestamp = 0; /*TODO: value to be provided by FW */
+	tag_buf++;
+
 	freq = HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_GET(*tag_buf);
 	if (freq != ppdu_desc->channel) {
 		soc = pdev->soc;
@@ -1392,6 +1455,7 @@ static void dp_process_ppdu_stats_common_tlv(struct dp_pdev *pdev,
 			pdev->operating_channel =
 		soc->cdp_soc.ol_ops->freq_to_channel(pdev->osif_pdev, freq);
 	}
+
 	ppdu_desc->phy_mode = HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_GET(*tag_buf);
 }
 
@@ -1493,6 +1557,7 @@ static void dp_process_ppdu_stats_user_rate_tlv(struct dp_pdev *pdev,
 		HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_GET(*tag_buf);
 
 	tag_buf++;
+	ppdu_user_desc->tx_rate = *tag_buf;
 
 	ppdu_user_desc->ltf_size =
 		HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_GET(*tag_buf);
@@ -1656,6 +1721,8 @@ static void dp_process_ppdu_stats_user_cmpltn_common_tlv(
 
 	ppdu_user_desc->short_retries =
 	HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_GET(*tag_buf);
+	ppdu_user_desc->retry_msdus =
+		ppdu_user_desc->long_retries + ppdu_user_desc->short_retries;
 
 	ppdu_user_desc->is_ampdu =
 		HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_GET(*tag_buf);
@@ -1786,6 +1853,12 @@ static void dp_process_ppdu_stats_user_compltn_ack_ba_status_tlv(
 
 	ppdu_user_desc->num_msdu =
 	HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_GET(*tag_buf);
+
+	ppdu_user_desc->success_msdus = ppdu_user_desc->num_msdu;
+
+	tag_buf += 2;
+	ppdu_user_desc->success_bytes = *tag_buf;
+
 }
 
 /*
@@ -1809,9 +1882,9 @@ static void dp_process_ppdu_stats_user_common_array_tlv(struct dp_pdev *pdev,
 	ppdu_desc =
 	(struct cdp_tx_completion_ppdu *)qdf_nbuf_data(pdev->tx_ppdu_info.buf);
 
-	tag_buf += 2;
+	tag_buf++;
 	dp_stats_buf = (struct htt_tx_ppdu_stats_info *)tag_buf;
-	tag_buf += 4;
+	tag_buf += 3;
 	peer_id =
 		HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_GET(*tag_buf);
 
@@ -1827,11 +1900,11 @@ static void dp_process_ppdu_stats_user_common_array_tlv(struct dp_pdev *pdev,
 
 	ppdu_user_desc = &ppdu_desc->user[curr_user_index];
 
-	ppdu_user_desc->success_bytes = dp_stats_buf->tx_success_bytes;
 	ppdu_user_desc->retry_bytes = dp_stats_buf->tx_retry_bytes;
 	ppdu_user_desc->failed_bytes = dp_stats_buf->tx_failed_bytes;
 
 	tag_buf++;
+
 	ppdu_user_desc->success_msdus =
 		HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_GET(*tag_buf);
 	ppdu_user_desc->retry_bytes =
@@ -1839,8 +1912,45 @@ static void dp_process_ppdu_stats_user_common_array_tlv(struct dp_pdev *pdev,
 	tag_buf++;
 	ppdu_user_desc->failed_msdus =
 		HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_GET(*tag_buf);
-	ppdu_user_desc->tx_duration =
-		HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_GET(*tag_buf);
+}
+
+/*
+ * dp_process_ppdu_stats_flush_tlv: Process
+ * htt_ppdu_stats_flush_tlv
+ * @pdev: DP PDEV handle
+ * @tag_buf: buffer containing the htt_ppdu_stats_flush_tlv
+ *
+ * return:void
+ */
+static void dp_process_ppdu_stats_user_compltn_flush_tlv(struct dp_pdev *pdev,
+						uint32_t *tag_buf)
+{
+	uint32_t peer_id;
+	uint32_t drop_reason;
+	uint8_t tid;
+	uint32_t num_msdu;
+	struct dp_peer *peer;
+
+	tag_buf++;
+	drop_reason = *tag_buf;
+
+	tag_buf++;
+	num_msdu = HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_GET(*tag_buf);
+
+	tag_buf++;
+	peer_id =
+		HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_GET(*tag_buf);
+
+	peer = dp_peer_find_by_id(pdev->soc, peer_id);
+	if (!peer)
+		return;
+
+	tid = HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_GET(*tag_buf);
+
+	if (drop_reason == HTT_FLUSH_EXCESS_RETRIES) {
+		DP_STATS_INC(peer, tx.excess_retries[TID_TO_WME_AC(tid)],
+					num_msdu);
+	}
 }
 
 /*
@@ -1890,7 +2000,6 @@ static void dp_process_ppdu_tag(struct dp_pdev *pdev, uint32_t *tag_buf,
 		uint32_t tlv_len)
 {
 	uint32_t tlv_type = HTT_STATS_TLV_TAG_GET(*tag_buf);
-
 	switch (tlv_type) {
 	case HTT_PPDU_STATS_COMMON_TLV:
 		dp_process_ppdu_stats_common_tlv(pdev, tag_buf);
@@ -1928,6 +2037,10 @@ static void dp_process_ppdu_tag(struct dp_pdev *pdev, uint32_t *tag_buf,
 		dp_process_ppdu_stats_user_common_array_tlv(pdev,
 							tag_buf);
 		break;
+	case HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV:
+		dp_process_ppdu_stats_user_compltn_flush_tlv(pdev,
+								tag_buf);
+		break;
 	case HTT_PPDU_STATS_TX_MGMTCTRL_PAYLOAD_TLV:
 		dp_process_ppdu_stats_tx_mgmtctrl_payload_tlv(pdev,
 							tag_buf, tlv_len);
@@ -1955,16 +2068,11 @@ static QDF_STATUS dp_htt_process_tlv(struct dp_pdev *pdev,
 	ppdu_id = HTT_T2H_PPDU_STATS_PPDU_ID_GET(*msg_word);
 
 	msg_word = msg_word + 3;
-
 	while (length > 0) {
 		tlv_buf = (uint8_t *)msg_word;
 		tlv_type = HTT_STATS_TLV_TAG_GET(*msg_word);
 		tlv_length = HTT_STATS_TLV_LENGTH_GET(*msg_word);
 
-		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
-				"HTT PPDU Tag %d, Length %d", tlv_type,
-				tlv_length);
-
 		if (tlv_length == 0)
 			break;
 
@@ -1974,10 +2082,10 @@ static QDF_STATUS dp_htt_process_tlv(struct dp_pdev *pdev,
 		tlv_length += HTT_TLV_HDR_LEN;
 		dp_process_ppdu_tag(pdev, msg_word, tlv_length);
 
+
 		msg_word = (uint32_t *)((uint8_t *)tlv_buf + tlv_length);
 		length -= (tlv_length);
 	}
-
 	return status;
 }
 #endif /* FEATURE_PERPKT_INFO */
@@ -2522,7 +2630,7 @@ htt_soc_detach(void *htt_soc)
 QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
 		uint32_t stats_type_upload_mask, uint32_t config_param_0,
 		uint32_t config_param_1, uint32_t config_param_2,
-		uint32_t config_param_3)
+		uint32_t config_param_3, int cookie_val)
 {
 	struct htt_soc *soc = pdev->soc->htt_handle;
 	struct dp_htt_htc_pkt *pkt;
@@ -2559,6 +2667,13 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
+		"-----%s:%d----\n cookie <-> %d\n config_param_0 %u\n"
+		"config_param_1 %u\n config_param_2 %u\n"
+		"config_param_4 %u\n -------------\n",
+		__func__, __LINE__, cookie_val, config_param_0,
+		config_param_1, config_param_2,	config_param_3);
+
 	msg_word = (uint32_t *) qdf_nbuf_data(msg);
 
 	qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING);
@@ -2588,6 +2703,20 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
 	HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, config_param_3);
 
 	HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, 0);
+
+	/* word 5 */
+	msg_word++;
+
+	/* word 6 */
+	msg_word++;
+	*msg_word = 0;
+	HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, cookie_val);
+
+	/* word 7 */
+	msg_word++;
+	*msg_word = 0;
+	HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, pdev->pdev_id);
+
 	pkt = htt_htc_pkt_alloc(soc);
 	if (!pkt) {
 		qdf_nbuf_free(msg);

+ 1 - 1
dp/wifi3.0/dp_internal.h

@@ -301,7 +301,7 @@ void dp_tx_me_free_descriptor(struct cdp_pdev *pdev);
 QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
 		uint32_t stats_type_upload_mask, uint32_t config_param_0,
 		uint32_t config_param_1, uint32_t config_param_2,
-		uint32_t config_param_3);
+		uint32_t config_param_3, int cookie);
 void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf);
 void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn),
 		void *cb_ctxt);

+ 34 - 2
dp/wifi3.0/dp_main.c

@@ -4757,10 +4757,41 @@ dp_get_fw_peer_stats(struct cdp_pdev *pdev_handle, uint8_t *mac_addr,
 
 	dp_h2t_ext_stats_msg_send(pdev, HTT_DBG_EXT_STATS_PEER_INFO,
 			config_param0, config_param1, config_param2,
-			config_param3);
+			config_param3, 0);
 
 }
 
+/* This struct definition will be removed from here
+ * once it get added in FW headers*/
+struct httstats_cmd_req {
+    uint32_t    config_param0;
+    uint32_t    config_param1;
+    uint32_t    config_param2;
+    uint32_t    config_param3;
+    int cookie;
+    u_int8_t    stats_id;
+};
+
+/*
+ * dp_get_htt_stats: function to process the httstas request
+ * @pdev_handle: DP pdev handle
+ * @data: pointer to request data
+ * @data_len: length for request data
+ *
+ * return: void
+ */
+static void
+dp_get_htt_stats(struct cdp_pdev *pdev_handle, void *data, uint32_t data_len)
+{
+	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
+	struct httstats_cmd_req *req = (struct httstats_cmd_req *)data;
+
+	QDF_ASSERT(data_len == sizeof(struct httstats_cmd_req));
+	dp_h2t_ext_stats_msg_send(pdev, req->stats_id,
+				req->config_param0, req->config_param1,
+				req->config_param2, req->config_param3,
+				req->cookie);
+}
 /*
  * dp_set_pdev_param: function to set parameters in pdev
  * @pdev_handle: DP pdev handle
@@ -4903,7 +4934,7 @@ static int dp_fw_stats_process(struct cdp_vdev *vdev_handle,
 	pdev = vdev->pdev;
 
 	return dp_h2t_ext_stats_msg_send(pdev, stats, req->param0,
-				req->param1, req->param2, req->param3);
+				req->param1, req->param2, req->param3, 0);
 }
 
 /**
@@ -5420,6 +5451,7 @@ static struct cdp_mon_ops dp_ops_mon = {
 static struct cdp_host_stats_ops dp_ops_host_stats = {
 	.txrx_per_peer_stats = dp_get_host_peer_stats,
 	.get_fw_peer_stats = dp_get_fw_peer_stats,
+	.get_htt_stats = dp_get_htt_stats,
 	.txrx_enable_enhanced_stats = dp_enable_enhanced_stats,
 	.txrx_disable_enhanced_stats = dp_disable_enhanced_stats,
 	/* TODO */

+ 3 - 4
dp/wifi3.0/dp_peer.c

@@ -1693,7 +1693,7 @@ void *dp_find_peer_by_addr_and_vdev(struct cdp_pdev *pdev_handle,
 		return NULL;
 
 	*local_id = peer->local_id;
-	DP_TRACE(INFO, "peer %pK vdev %pK lcoal id %d", peer, vdev, *local_id);
+	DP_TRACE(INFO, "peer %pK vdev %pK local id %d", peer, vdev, *local_id);
 
 	/* ref_cnt is incremented inside dp_peer_find_hash_find().
 	 * Decrement it here.
@@ -1734,8 +1734,7 @@ void *dp_peer_find_by_local_id(struct cdp_pdev *pdev_handle, uint8_t local_id)
 	qdf_spin_lock_bh(&pdev->local_peer_ids.lock);
 	peer = pdev->local_peer_ids.map[local_id];
 	qdf_spin_unlock_bh(&pdev->local_peer_ids.lock);
-	DP_TRACE(INFO, "peer %pK lcoal id %d",
-			peer, local_id);
+	DP_TRACE(DEBUG, "peer %pK local id %d", peer, local_id);
 	return peer;
 }
 
@@ -1868,7 +1867,7 @@ int dp_get_peer_state(void *peer_handle)
 {
 	struct dp_peer *peer = peer_handle;
 
-	DP_TRACE(INFO, "peer %pK stats %d", peer, peer->state);
+	DP_TRACE(DEBUG, "peer %pK stats %d", peer, peer->state);
 	return peer->state;
 }
 

+ 0 - 1
dp/wifi3.0/dp_rx_mon_dest.c

@@ -341,7 +341,6 @@ qdf_nbuf_t dp_rx_mon_restitch_mpdu_from_msdus(struct dp_soc *soc,
 	/* The nbuf has been pulled just beyond the status and points to the
 	   * payload
 	*/
-
 	msdu_orig = head_msdu;
 
 	rx_desc = qdf_nbuf_data(msdu_orig);

+ 8 - 7
dp/wifi3.0/dp_rx_mon_status.c

@@ -123,28 +123,29 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	if (soc->process_rx_status)
 		return;
 	DP_STATS_UPD(peer, rx.rssi, ppdu->rssi);
-	DP_STATS_INC(peer, rx.sgi_count[ppdu->u.gi], 1);
+	DP_STATS_INC(peer, rx.sgi_count[ppdu->u.gi], num_msdu);
 	DP_STATS_INC(peer, rx.bw[ppdu->u.bw], num_msdu);
-	DP_STATS_INCC(peer, rx.ampdu_cnt, 1, ppdu->is_ampdu);
-	DP_STATS_INCC(peer, rx.non_ampdu_cnt, 1, !(ppdu->is_ampdu));
+	DP_STATS_INCC(peer, rx.ampdu_cnt, num_msdu, ppdu->is_ampdu);
+	DP_STATS_INCC(peer, rx.non_ampdu_cnt, num_msdu, !(ppdu->is_ampdu));
+	DP_STATS_UPD(peer, rx.rx_rate, mcs);
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
 			((mcs >= MAX_MCS_11A) && (preamble == DOT11_A)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
-			((mcs < MAX_MCS_11A) &&	(preamble == DOT11_A)));
+			((mcs < MAX_MCS_11A) && (preamble == DOT11_A)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
 			((mcs >= MAX_MCS_11B) && (preamble == DOT11_B)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
-			((mcs < MAX_MCS_11B) &&	(preamble == DOT11_B)));
+			((mcs < MAX_MCS_11B) && (preamble == DOT11_B)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
 			((mcs >= MAX_MCS_11A) && (preamble == DOT11_N)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
-			((mcs < MAX_MCS_11A) &&	(preamble == DOT11_N)));
+			((mcs < MAX_MCS_11A) && (preamble == DOT11_N)));
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[MAX_MCS], num_msdu,
 			((mcs >= MAX_MCS_11AC) && (preamble == DOT11_AC)));
@@ -157,7 +158,7 @@ static void dp_rx_stats_update(struct dp_soc *soc, struct dp_peer *peer,
 	DP_STATS_INCC(peer,
 			rx.pkt_type[preamble].mcs_count[mcs], num_msdu,
 			((mcs < (MAX_MCS - 1)) && (preamble == DOT11_AX)));
-	DP_STATS_INC(peer, rx.wme_ac_type[TID_TO_WME_AC(ppdu->tid)], 1);
+	DP_STATS_INC(peer, rx.wme_ac_type[TID_TO_WME_AC(ppdu->tid)], num_msdu);
 
 	if (soc->cdp_soc.ol_ops->update_dp_stats) {
 		soc->cdp_soc.ol_ops->update_dp_stats(pdev->osif_pdev,

+ 5 - 8
dp/wifi3.0/dp_tx.c

@@ -504,8 +504,8 @@ struct dp_tx_ext_desc_elem_s *dp_tx_prepare_ext_desc(struct dp_vdev *vdev,
 		break;
 	}
 
-	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO,
-			cached_ext_desc, HAL_TX_EXT_DESC_WITH_META_DATA);
+	QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
+			   cached_ext_desc, HAL_TX_EXT_DESC_WITH_META_DATA);
 
 	hal_tx_ext_desc_sync(&cached_ext_desc[0],
 			msdu_ext_desc->vaddr);
@@ -2242,7 +2242,7 @@ static inline void dp_tx_comp_process_tx_status(struct dp_tx_desc_s *tx_desc,
 	struct dp_peer *peer = NULL;
 	hal_tx_comp_get_status(&tx_desc->comp, &ts);
 
-	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_INFO_HIGH,
+	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
 				"-------------------- \n"
 				"Tx Completion Stats: \n"
 				"-------------------- \n"
@@ -2329,10 +2329,7 @@ static void dp_tx_comp_process_desc(struct dp_soc *soc,
 		peer = dp_peer_find_by_id(soc, ts.peer_id);
 		length = qdf_nbuf_len(desc->nbuf);
 
-		/* Process Tx status in descriptor */
-		if (soc->process_tx_status ||
-				(desc->vdev && desc->vdev->mesh_vdev))
-			dp_tx_comp_process_tx_status(desc, length);
+		dp_tx_comp_process_tx_status(desc, length);
 
 		dp_tx_comp_free_buf(soc, desc);
 
@@ -2464,7 +2461,7 @@ uint32_t dp_tx_comp_handler(struct dp_soc *soc, void *hal_srng, uint32_t quota)
 
 			/* Collect hw completion contents */
 			hal_tx_comp_desc_sync(tx_comp_hal_desc,
-					&tx_desc->comp, soc->process_tx_status);
+					&tx_desc->comp, 1);
 
 		}
 

+ 12 - 12
dp/wifi3.0/dp_tx_desc.c

@@ -246,7 +246,7 @@ QDF_STATUS dp_tx_ext_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 	}
 
 	soc->tx_ext_desc[pool_id].num_free = num_elem;
-	TX_DESC_LOCK_CREATE(&soc->tx_ext_desc[pool_id].lock);
+	qdf_spinlock_create(&soc->tx_ext_desc[pool_id].lock);
 	return QDF_STATUS_SUCCESS;
 
 free_ext_link_desc_page:
@@ -281,7 +281,7 @@ QDF_STATUS dp_tx_ext_desc_pool_free(struct dp_soc *soc, uint8_t pool_id)
 		qdf_get_dma_mem_context((&soc->tx_ext_desc[pool_id]), memctx),
 		false);
 
-	TX_DESC_LOCK_DESTROY(&soc->tx_ext_desc[pool_id].lock);
+	qdf_spinlock_destroy(&soc->tx_ext_desc[pool_id].lock);
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -331,7 +331,7 @@ QDF_STATUS dp_tx_tso_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 	TSO_DEBUG("Number of free descriptors: %u\n",
 			soc->tx_tso_desc[pool_id].num_free);
 	soc->tx_tso_desc[pool_id].pool_size = num_elem;
-	TX_DESC_LOCK_CREATE(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spinlock_create(&soc->tx_tso_desc[pool_id].lock);
 
 	return QDF_STATUS_SUCCESS;
 
@@ -359,11 +359,11 @@ void dp_tx_tso_desc_pool_free(struct dp_soc *soc, uint8_t pool_id)
 	struct qdf_tso_seg_elem_t *c_element;
 	struct qdf_tso_seg_elem_t *temp;
 
-	TX_DESC_LOCK_LOCK(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_tso_desc[pool_id].lock);
 	c_element = soc->tx_tso_desc[pool_id].freelist;
 
 	if (!c_element) {
-		TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
+		qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
 			FL("Desc Pool Corrupt %d"), pool_id);
 			return;
@@ -380,8 +380,8 @@ void dp_tx_tso_desc_pool_free(struct dp_soc *soc, uint8_t pool_id)
 	soc->tx_tso_desc[pool_id].freelist = NULL;
 	soc->tx_tso_desc[pool_id].num_free = 0;
 	soc->tx_tso_desc[pool_id].pool_size = 0;
-	TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
-	TX_DESC_LOCK_DESTROY(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spinlock_destroy(&soc->tx_tso_desc[pool_id].lock);
 	return;
 }
 /**
@@ -429,7 +429,7 @@ QDF_STATUS dp_tx_tso_num_seg_pool_alloc(struct dp_soc *soc, uint8_t pool_id,
 	}
 
 	soc->tx_tso_num_seg[pool_id].num_seg_pool_size = num_elem;
-	TX_DESC_LOCK_CREATE(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spinlock_create(&soc->tx_tso_num_seg[pool_id].lock);
 
 	return QDF_STATUS_SUCCESS;
 
@@ -457,11 +457,11 @@ void dp_tx_tso_num_seg_pool_free(struct dp_soc *soc, uint8_t pool_id)
 	struct qdf_tso_num_seg_elem_t *c_element;
 	struct qdf_tso_num_seg_elem_t *temp;
 
-	TX_DESC_LOCK_LOCK(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_tso_num_seg[pool_id].lock);
 	c_element = soc->tx_tso_num_seg[pool_id].freelist;
 
 	if (!c_element) {
-		TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
+		qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
 		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
 			FL("Desc Pool Corrupt %d"), pool_id);
 			return;
@@ -478,8 +478,8 @@ void dp_tx_tso_num_seg_pool_free(struct dp_soc *soc, uint8_t pool_id)
 	soc->tx_tso_num_seg[pool_id].freelist = NULL;
 	soc->tx_tso_num_seg[pool_id].num_free = 0;
 	soc->tx_tso_num_seg[pool_id].num_seg_pool_size = 0;
-	TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
-	TX_DESC_LOCK_DESTROY(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spinlock_destroy(&soc->tx_tso_num_seg[pool_id].lock);
 	return;
 }
 

+ 15 - 15
dp/wifi3.0/dp_tx_desc.h

@@ -367,16 +367,16 @@ struct dp_tx_ext_desc_elem_s *dp_tx_ext_desc_alloc(struct dp_soc *soc,
 {
 	struct dp_tx_ext_desc_elem_s *c_elem;
 
-	TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	if (soc->tx_ext_desc[desc_pool_id].num_free <= 0) {
-		TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
+		qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 		return NULL;
 	}
 	c_elem = soc->tx_ext_desc[desc_pool_id].freelist;
 	soc->tx_ext_desc[desc_pool_id].freelist =
 		soc->tx_ext_desc[desc_pool_id].freelist->next;
 	soc->tx_ext_desc[desc_pool_id].num_free--;
-	TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	return c_elem;
 }
 
@@ -391,11 +391,11 @@ struct dp_tx_ext_desc_elem_s *dp_tx_ext_desc_alloc(struct dp_soc *soc,
 static inline void dp_tx_ext_desc_free(struct dp_soc *soc,
 	struct dp_tx_ext_desc_elem_s *elem, uint8_t desc_pool_id)
 {
-	TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	elem->next = soc->tx_ext_desc[desc_pool_id].freelist;
 	soc->tx_ext_desc[desc_pool_id].freelist = elem;
 	soc->tx_ext_desc[desc_pool_id].num_free++;
-	TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	return;
 }
 
@@ -431,11 +431,11 @@ static inline void dp_tx_ext_desc_free_multiple(struct dp_soc *soc,
 	/* caller should always guarantee atleast list of num_free nodes */
 	qdf_assert_always(tail);
 
-	TX_DESC_LOCK_LOCK(&soc->tx_ext_desc[desc_pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 	tail->next = soc->tx_ext_desc[desc_pool_id].freelist;
 	soc->tx_ext_desc[desc_pool_id].freelist = head;
 	soc->tx_ext_desc[desc_pool_id].num_free += num_free;
-	TX_DESC_LOCK_UNLOCK(&soc->tx_ext_desc[desc_pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_ext_desc[desc_pool_id].lock);
 
 	return;
 }
@@ -456,14 +456,14 @@ static inline struct qdf_tso_seg_elem_t *dp_tx_tso_desc_alloc(
 {
 	struct qdf_tso_seg_elem_t *tso_seg = NULL;
 
-	TX_DESC_LOCK_LOCK(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_tso_desc[pool_id].lock);
 	if (soc->tx_tso_desc[pool_id].freelist) {
 		soc->tx_tso_desc[pool_id].num_free--;
 		tso_seg = soc->tx_tso_desc[pool_id].freelist;
 		soc->tx_tso_desc[pool_id].freelist =
 			soc->tx_tso_desc[pool_id].freelist->next;
 	}
-	TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
 
 	return tso_seg;
 }
@@ -482,11 +482,11 @@ static inline struct qdf_tso_seg_elem_t *dp_tx_tso_desc_alloc(
 static inline void dp_tx_tso_desc_free(struct dp_soc *soc,
 		uint8_t pool_id, struct qdf_tso_seg_elem_t *tso_seg)
 {
-	TX_DESC_LOCK_LOCK(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_tso_desc[pool_id].lock);
 	tso_seg->next = soc->tx_tso_desc[pool_id].freelist;
 	soc->tx_tso_desc[pool_id].freelist = tso_seg;
 	soc->tx_tso_desc[pool_id].num_free++;
-	TX_DESC_LOCK_UNLOCK(&soc->tx_tso_desc[pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_tso_desc[pool_id].lock);
 }
 
 static inline
@@ -495,14 +495,14 @@ struct qdf_tso_num_seg_elem_t  *dp_tso_num_seg_alloc(struct dp_soc *soc,
 {
 	struct qdf_tso_num_seg_elem_t *tso_num_seg = NULL;
 
-	TX_DESC_LOCK_LOCK(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_tso_num_seg[pool_id].lock);
 	if (soc->tx_tso_num_seg[pool_id].freelist) {
 		soc->tx_tso_num_seg[pool_id].num_free--;
 		tso_num_seg = soc->tx_tso_num_seg[pool_id].freelist;
 		soc->tx_tso_num_seg[pool_id].freelist =
 			soc->tx_tso_num_seg[pool_id].freelist->next;
 	}
-	TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
 
 	return tso_num_seg;
 }
@@ -511,11 +511,11 @@ static inline
 void dp_tso_num_seg_free(struct dp_soc *soc,
 		uint8_t pool_id, struct qdf_tso_num_seg_elem_t *tso_num_seg)
 {
-	TX_DESC_LOCK_LOCK(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spin_lock_bh(&soc->tx_tso_num_seg[pool_id].lock);
 	tso_num_seg->next = soc->tx_tso_num_seg[pool_id].freelist;
 	soc->tx_tso_num_seg[pool_id].freelist = tso_num_seg;
 	soc->tx_tso_num_seg[pool_id].num_free++;
-	TX_DESC_LOCK_UNLOCK(&soc->tx_tso_num_seg[pool_id].lock);
+	qdf_spin_unlock_bh(&soc->tx_tso_num_seg[pool_id].lock);
 }
 #endif
 

+ 1 - 0
dp/wifi3.0/dp_types.h

@@ -49,6 +49,7 @@
 #include "hal_rx.h"
 
 #define MAX_BW 4
+#define MAX_RETRIES 4
 #define MAX_RECEPTION_TYPES 4
 #define REPT_MU_MIMO 1
 #define REPT_MU_OFDMA_MIMO 3

+ 14 - 2
dp/wifi3.0/hal_rx.h

@@ -1394,6 +1394,7 @@ hal_rx_msdu_start_get_pkt_type(uint8_t *buf)
  * Return: uint32_t(nss)
  */
 
+#if !defined(QCA_WIFI_QCA6290_11AX)
 static inline uint32_t
 hal_rx_msdu_start_nss_get(uint8_t *buf)
 {
@@ -1405,6 +1406,13 @@ hal_rx_msdu_start_nss_get(uint8_t *buf)
 	nss = HAL_RX_MSDU_START_NSS_GET(msdu_start);
 	return nss;
 }
+#else
+static inline uint32_t
+hal_rx_msdu_start_nss_get(uint8_t *buf)
+{
+	return 0;
+}
+#endif
 
 #define HAL_RX_MPDU_GET_TODS(_rx_mpdu_info)	\
 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
@@ -2556,7 +2564,6 @@ static void hal_rx_dump_msdu_start_tlv(struct rx_msdu_start *msdu_start,
 			"ip_frag: %d\n"
 			"tcp_only_ack: %d\n"
 			"da_is_bcast_mcast: %d\n"
-			"toeplitz_hash: %d\n"
 			"ip4_protocol_ip6_next_header: %d\n"
 			"toeplitz_hash_2_or_4: %d\n"
 			"flow_id_toeplitz: %d\n"
@@ -2567,7 +2574,10 @@ static void hal_rx_dump_msdu_start_tlv(struct rx_msdu_start *msdu_start,
 			"rate_mcs: %d\n"
 			"receive_bandwidth: %d\n"
 			"reception_type: %d\n"
+#if !defined(QCA_WIFI_QCA6290_11AX)
+			"toeplitz_hash: %d\n"
 			"nss: %d\n"
+#endif
 			"ppdu_start_timestamp: %d\n"
 			"sw_phy_meta_data: %d\n",
 		msdu_start->rxpcu_mpdu_filter_in_category,
@@ -2587,7 +2597,6 @@ static void hal_rx_dump_msdu_start_tlv(struct rx_msdu_start *msdu_start,
 		msdu_start->ip_frag,
 		msdu_start->tcp_only_ack,
 		msdu_start->da_is_bcast_mcast,
-		msdu_start->toeplitz_hash,
 		msdu_start->ip4_protocol_ip6_next_header,
 		msdu_start->toeplitz_hash_2_or_4,
 		msdu_start->flow_id_toeplitz,
@@ -2598,7 +2607,10 @@ static void hal_rx_dump_msdu_start_tlv(struct rx_msdu_start *msdu_start,
 		msdu_start->rate_mcs,
 		msdu_start->receive_bandwidth,
 		msdu_start->reception_type,
+#if !defined(QCA_WIFI_QCA6290_11AX)
+		msdu_start->toeplitz_hash,
 		msdu_start->nss,
+#endif
 		msdu_start->ppdu_start_timestamp,
 		msdu_start->sw_phy_meta_data);
 }

+ 12 - 0
hal/wifi3.0/hal_api_mon.h

@@ -386,7 +386,9 @@ void hal_rx_mon_hw_desc_get_mpdu_status(void *hw_desc_addr,
 
 	reg_value = HAL_RX_GET(rx_msdu_start, RX_MSDU_START_5, SGI);
 	rs->sgi = sgi_hw_to_cdp[reg_value];
+#if !defined(QCA_WIFI_QCA6290_11AX)
 	rs->nr_ant = HAL_RX_GET(rx_msdu_start, RX_MSDU_START_5, NSS);
+#endif
 
 	reg_value = HAL_RX_GET(rx_msdu_start, RX_MSDU_START_5, PKT_TYPE);
 	switch (reg_value) {
@@ -400,8 +402,12 @@ void hal_rx_mon_hw_desc_get_mpdu_status(void *hw_desc_addr,
 		reg_value = HAL_RX_GET(rx_msdu_start, RX_MSDU_START_5,
 			RECEIVE_BANDWIDTH);
 		rs->vht_flag_values2 = reg_value;
+#if !defined(QCA_WIFI_QCA6290_11AX)
 		nss = HAL_RX_GET(rx_msdu_start, RX_MSDU_START_5, NSS);
 		nss = nss + 1;
+#else
+		nss = 0;
+#endif
 		rs->vht_flag_values3[0] = (rs->mcs << 4) | nss ;
 		break;
 	case HAL_RX_PKT_TYPE_11AX:
@@ -729,7 +735,13 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info)
 		ppdu_info->rx_status.rssi_comb = HAL_RX_GET(rssi_info_tlv,
 			PHYRX_RSSI_LEGACY_35, RSSI_COMB);
 		ppdu_info->rx_status.bw = HAL_RX_GET(rssi_info_tlv,
+#if !defined(QCA_WIFI_QCA6290_11AX)
 			PHYRX_RSSI_LEGACY_35, RECEIVE_BANDWIDTH);
+#else
+			PHYRX_RSSI_LEGACY_0, RECEIVE_BANDWIDTH);
+#endif
+		ppdu_info->rx_status.preamble_type = HAL_RX_GET(rssi_info_tlv,
+			PHYRX_RSSI_LEGACY_0, RECEPTION_TYPE);
 		ppdu_info->rx_status.he_re = 0;
 
 		value = HAL_RX_GET(rssi_info_tlv,

+ 83 - 0
hal/wifi3.0/hal_tx.h

@@ -78,6 +78,7 @@ do {                                            \
 #define HAL_TX_TID_BITS_MASK ((1 << HAL_TX_BITS_PER_TID) - 1)
 #define HAL_TX_NUM_DSCP_PER_REGISTER 10
 #define HAL_MAX_HW_DSCP_TID_MAPS 2
+#define HAL_MAX_HW_DSCP_TID_MAPS_11AX 32
 
 #define HTT_META_HEADER_LEN_BYTES 64
 #define HAL_TX_EXT_DESC_WITH_META_DATA \
@@ -459,6 +460,7 @@ static inline void hal_tx_desc_set_to_fw(void *desc, uint8_t to_fw)
  *
  * Return: void
  */
+#if !defined(QCA_WIFI_QCA6290_11AX)
 static inline void hal_tx_desc_set_dscp_tid_table_id(void *desc,
 						     uint8_t id)
 {
@@ -467,6 +469,16 @@ static inline void hal_tx_desc_set_dscp_tid_table_id(void *desc,
 		HAL_TX_SM(TCL_DATA_CMD_3,
 		       DSCP_TO_TID_PRIORITY_TABLE_ID, id);
 }
+#else
+static inline void hal_tx_desc_set_dscp_tid_table_id(void *desc,
+						     uint8_t id)
+{
+	HAL_SET_FLD(desc, TCL_DATA_CMD_5,
+			 DSCP_TID_TABLE_NUM) |=
+		HAL_TX_SM(TCL_DATA_CMD_5,
+		       DSCP_TID_TABLE_NUM, id);
+}
+#endif
 
 /**
  * hal_tx_desc_set_mesh_en - Set mesh_enable flag in Tx descriptor
@@ -968,6 +980,7 @@ static inline void hal_tx_comp_get_htt_desc(void *hw_desc, uint8_t *htt_desc)
 	qdf_mem_copy(htt_desc, desc, HAL_TX_COMP_HTT_STATUS_LEN);
 }
 
+#if !defined(QCA_WIFI_QCA6290_11AX)
 /**
  * hal_tx_set_dscp_tid_map_default() - Configure default DSCP to TID map table
  * @soc: HAL SoC context
@@ -1061,6 +1074,76 @@ static inline void hal_tx_update_dscp_tid(void *hal_soc, uint8_t tid,
 	HAL_REG_WRITE(soc, addr,
 			(regval & HWIO_TCL_R0_DSCP_TID1_MAP_1_RMSK));
 }
+#else
+/**
+ * hal_tx_set_dscp_tid_map_default() - Configure default DSCP to TID map table
+ * @soc: HAL SoC context
+ * @map: DSCP-TID mapping table
+ * @id: mapping table ID - 0-31
+ *
+ * DSCP are mapped to 8 TID values using TID values programmed
+ * in any of the 32 DSCP_TID_MAPS (id = 0-31).
+ *
+ * Return: none
+ */
+static inline void hal_tx_set_dscp_tid_map(void *hal_soc, uint8_t *map,
+		uint8_t id)
+{
+	int i;
+	uint32_t addr;
+	uint32_t value;
+
+	struct hal_soc *soc = (struct hal_soc *)hal_soc;
+
+	if (id >= HAL_MAX_HW_DSCP_TID_MAPS_11AX) {
+		return;
+	}
+
+	addr = HWIO_TCL_R0_DSCP_TID_MAP_n_ADDR(
+				SEQ_WCSS_UMAC_MAC_TCL_REG_OFFSET, id);
+
+	for (i = 0; i < 64; i += 10) {
+		value = (map[i] |
+			(map[i+1] << 0x3) |
+			(map[i+2] << 0x6) |
+			(map[i+3] << 0x9) |
+			(map[i+4] << 0xc) |
+			(map[i+5] << 0xf) |
+			(map[i+6] << 0x12) |
+			(map[i+7] << 0x15) |
+			(map[i+8] << 0x18) |
+			(map[i+9] << 0x1b));
+
+		HAL_REG_WRITE(soc, addr,
+				(value & HWIO_TCL_R0_DSCP_TID_MAP_n_RMSK));
+
+		addr += 4;
+	}
+}
+static inline void hal_tx_update_dscp_tid(void *hal_soc, uint8_t tid,
+		uint8_t id, uint8_t dscp)
+{
+	int index;
+	uint32_t addr;
+	uint32_t value;
+	uint32_t regval;
+
+	struct hal_soc *soc = (struct hal_soc *)hal_soc;
+	addr = HWIO_TCL_R0_DSCP_TID_MAP_n_ADDR(
+				SEQ_WCSS_UMAC_MAC_TCL_REG_OFFSET, id);
+
+	index = dscp % HAL_TX_NUM_DSCP_PER_REGISTER;
+	addr += 4 * (dscp/HAL_TX_NUM_DSCP_PER_REGISTER);
+	value = tid << (HAL_TX_BITS_PER_TID * index);
+
+	regval = HAL_REG_READ(soc, addr);
+	regval &= ~(HAL_TX_TID_BITS_MASK << (HAL_TX_BITS_PER_TID * index));
+	regval |= value;
+
+	HAL_REG_WRITE(soc, addr,
+			(regval & HWIO_TCL_R0_DSCP_TID_MAP_n_RMSK));
+}
+#endif
 
 /**
  * hal_tx_init_data_ring() - Initialize all the TCL Descriptors in SRNG

+ 18 - 0
htc/htc_send.c

@@ -58,6 +58,23 @@ uint32_t g_htc_credit_history_idx;
 uint32_t g_htc_credit_history_length;
 struct HTC_CREDIT_HISTORY htc_credit_history_buffer[HTC_CREDIT_HISTORY_MAX];
 
+#ifdef QCA_WIFI_NAPIER_EMULATION
+#define HTC_EMULATION_DELAY_IN_MS 20
+/**
+ * htc_add_delay(): Adds a delay in before proceeding, only for emulation
+ *
+ * Return: None
+ */
+static inline void htc_add_emulation_delay(void)
+{
+	qdf_mdelay(HTC_EMULATION_DELAY_IN_MS);
+}
+#else
+static inline void htc_add_emulation_delay(void)
+{
+}
+#endif
+
 /**
  * htc_credit_record() - records tx que state & credit transactions
  * @type:		type of echange can be HTC_REQUEST_CREDIT
@@ -89,6 +106,7 @@ void htc_credit_record(enum htc_credit_exchange_type type, uint32_t tx_credit,
 
 	g_htc_credit_history_idx++;
 	g_htc_credit_history_length++;
+	htc_add_emulation_delay();
 }
 
 #ifdef WMI_INTERFACE_EVENT_LOGGING

+ 20 - 0
init_deinit/dispatcher/inc/dispatcher_init_deinit.h

@@ -61,6 +61,26 @@ QDF_STATUS dispatcher_init(void);
  */
 QDF_STATUS dispatcher_deinit(void);
 
+/**
+ * dispatcher_enable(): global (above psoc) level component start
+ *
+ * Prepare components to service requests. Must only be called after
+ * dispatcher_init().
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dispatcher_enable(void);
+
+/**
+ * dispatcher_disable(): global (above psoc) level component stop
+ *
+ * Stop components from servicing requests. Must be called before
+ * scheduler_deinit().
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dispatcher_disable(void);
+
 /**
  * dispatcher_psoc_open(): API to trigger PSOC open for all new components
  * @psoc: psoc context

+ 12 - 0
init_deinit/dispatcher/src/dispatcher_init_deinit.c

@@ -780,6 +780,18 @@ QDF_STATUS dispatcher_deinit(void)
 }
 EXPORT_SYMBOL(dispatcher_deinit);
 
+QDF_STATUS dispatcher_enable(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+EXPORT_SYMBOL(dispatcher_enable);
+
+QDF_STATUS dispatcher_disable(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+EXPORT_SYMBOL(dispatcher_disable);
+
 QDF_STATUS dispatcher_psoc_open(struct wlan_objmgr_psoc *psoc)
 {
 	if (QDF_STATUS_SUCCESS != wlan_mgmt_txrx_psoc_open(psoc))

+ 5 - 0
os_if/linux/qca_vendor.h

@@ -245,6 +245,9 @@
  * @QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_STATUS: Get the current
  *     status of spectral scan. The status values are specified
  *     by enum qca_wlan_vendor_attr_spectral_scan_status.
+ * @QCA_NL80211_VENDOR_SUBCMD_HTT_STATS: Request the firmware
+ *     DP stats for a particualr stats type for response evnet
+ *     it carries the stats data sent from the FW
  */
 
 enum qca_nl80211_vendor_subcmds {
@@ -444,6 +447,7 @@ enum qca_nl80211_vendor_subcmds {
 	QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_DIAG_STATS = 159,
 	QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_CAP_INFO = 160,
 	QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_STATUS = 161,
+	QCA_NL80211_VENDOR_SUBCMD_HTT_STATS = 162,
 };
 
 enum qca_wlan_vendor_tos {
@@ -863,6 +867,7 @@ enum qca_nl80211_vendor_subcmds_index {
 	QCA_NL80211_VENDOR_SUBCMD_PWR_SAVE_FAIL_DETECTED_INDEX,
 	QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET_INDEX,
 	QCA_NL80211_VENDOR_SUBCMD_HANG_REASON_INDEX,
+	QCA_NL80211_VENDOR_SUBCMD_HTT_STATS_INDEX,
 };
 
 /**

+ 6 - 4
qdf/inc/qdf_types.h

@@ -494,12 +494,11 @@ enum QDF_OPMODE {
 	QDF_MAX_NO_OF_MODE
 };
 
-/* for backward compatability with the legacy definition */
+/* for backward compatibility with the legacy definition */
 #define tQDF_ADAPTER_MODE QDF_OPMODE
 
 /**
- * enum tQDF_GLOBAL_CON_MODE - global config mode when
- * driver is loaded.
+ * enum QDF_GLOBAL_MODE - global mode when driver is loaded.
  *
  * @QDF_GLOBAL_MISSION_MODE: mission mode (STA, SAP...)
  * @QDF_GLOBAL_MONITOR_MODE: Monitor Mode
@@ -509,7 +508,7 @@ enum QDF_OPMODE {
  * @QDF_GLOBAL_QVIT_MODE: QVIT global mode
  * @QDF_GLOBAL_MAX_MODE: Max place holder
  */
-enum tQDF_GLOBAL_CON_MODE {
+enum QDF_GLOBAL_MODE {
 	QDF_GLOBAL_MISSION_MODE,
 	QDF_GLOBAL_MONITOR_MODE = 4,
 	QDF_GLOBAL_FTM_MODE = 5,
@@ -520,6 +519,9 @@ enum tQDF_GLOBAL_CON_MODE {
 	QDF_GLOBAL_MAX_MODE
 };
 
+/* for backward compatibility with the legacy definition */
+#define tQDF_GLOBAL_CON_MODE QDF_GLOBAL_MODE
+
 #define  QDF_IS_EPPING_ENABLED(mode) (mode == QDF_GLOBAL_EPPING_MODE)
 
 

+ 0 - 15
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c

@@ -1627,21 +1627,6 @@ QDF_STATUS policy_mgr_get_valid_chan_weights(struct wlan_objmgr_psoc *psoc,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	if (!weight->pcl_list) {
-		policy_mgr_err("Invalid pcl");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (!weight->saved_chan_list) {
-		policy_mgr_err("Invalid valid channel list");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (!weight->weighed_valid_list) {
-		policy_mgr_err("Invalid weighed valid channel list");
-		return QDF_STATUS_E_FAILURE;
-	}
-
 	qdf_mem_set(weight->weighed_valid_list, QDF_MAX_NUM_CHAN,
 		    WEIGHT_OF_DISALLOWED_CHANNELS);
 	qdf_mutex_acquire(&pm_ctx->qdf_conc_list_lock);

+ 7 - 2
umac/cmn_services/utils/src/wlan_utility.c

@@ -191,6 +191,7 @@ struct wlan_objmgr_vdev *wlan_util_get_vdev_by_ifname(
 				struct wlan_objmgr_psoc *psoc, char *ifname,
 				wlan_objmgr_ref_dbgid ref_id)
 {
+	QDF_STATUS status;
 	struct wlan_find_vdev_filter filter = {0};
 
 	filter.ifname = ifname;
@@ -198,8 +199,12 @@ struct wlan_objmgr_vdev *wlan_util_get_vdev_by_ifname(
 				     wlan_util_get_vdev_by_ifname_cb,
 				     &filter, 0, ref_id);
 
-	if (filter.found_vdev)
-		wlan_objmgr_vdev_get_ref(filter.found_vdev, ref_id);
+	if (!filter.found_vdev)
+		return NULL;
+
+	status = wlan_objmgr_vdev_try_get_ref(filter.found_vdev, ref_id);
+	if (QDF_IS_STATUS_ERROR(status))
+		return NULL;
 
 	return filter.found_vdev;
 }

+ 2 - 0
umac/regulatory/dispatcher/inc/reg_services_public_struct.h

@@ -740,11 +740,13 @@ struct cur_regulatory_info {
  * @BAND_ALL:all bands
  * @BAND_2G: 2G band
  * @BAND_5G: 5G band
+ * @BAND_UNKNOWN: Unsupported band
  */
 enum band_info {
 	BAND_ALL,
 	BAND_2G,
 	BAND_5G,
+	BAND_UNKNOWN
 };
 
 /**

+ 2 - 902
umac/scan/core/src/wlan_scan_cache_db_ops.c → umac/scan/core/src/wlan_scan_bss_score.c

@@ -16,13 +16,10 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 /*
- * DOC: contains scan cache operations
+ * DOC: contains scan bss scoring logic
  */
 
-#include <qdf_status.h>
-#include <wlan_scan_ucfg_api.h>
 #include <wlan_scan_utils_api.h>
-#include "wlan_scan_cache_db.h"
 #include "wlan_scan_main.h"
 #include "wlan_scan_cache_db_i.h"
 #ifdef WLAN_POLICY_MGR_ENABLE
@@ -789,903 +786,6 @@ int scm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 	return score;
 }
 
-/**
- * scm_is_open_security() - Check if scan entry support open security
- * @filter: scan filter
- * @db_entry: db entry
- * @security: matched security.
- *
- * Return: true if open security else false
- */
-static bool scm_is_open_security(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry,
-	struct security_info *security)
-{
-	bool match = false;
-	int i;
-
-	if (db_entry->cap_info.wlan_caps.privacy)
-		return false;
-
-	/* Check MC cipher and Auth type requested. */
-	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
-		if (WLAN_ENCRYPT_TYPE_NONE ==
-			filter->mc_enc_type[i]) {
-			security->mc_enc =
-				filter->mc_enc_type[i];
-			match = true;
-			break;
-		}
-	}
-	if (!match && filter->num_of_mc_enc_type)
-		return match;
-
-	match = false;
-	/* Check Auth list. It should contain AuthOpen. */
-	for (i = 0; i < filter->num_of_auth; i++) {
-		if ((WLAN_AUTH_TYPE_OPEN_SYSTEM ==
-			filter->auth_type[i]) ||
-			(WLAN_AUTH_TYPE_AUTOSWITCH ==
-			filter->auth_type[i])) {
-			security->auth_type =
-				WLAN_AUTH_TYPE_OPEN_SYSTEM;
-			match = true;
-			break;
-		}
-	}
-
-	return match;
-}
-
-/**
- * scm_is_cipher_match() - Check if cipher match the cipher list
- * @cipher_list: cipher list to match
- * @num_cipher: number of cipher in cipher list
- * @cipher_to_match: cipher to found in cipher list
- *
- * Return: true if open security else false
- */
-static bool scm_is_cipher_match(
-	uint32_t *cipher_list,
-	uint16_t num_cipher, uint32_t cipher_to_match)
-{
-	int i;
-	bool match = false;
-
-	for (i = 0; i < num_cipher ; i++) {
-		match = (cipher_list[i] == cipher_to_match);
-		if (match)
-			break;
-	}
-
-	return match;
-}
-
-/**
- * scm_get_cipher_suite_type() - get cypher suite type from enc type
- * @enc: enc type
- *
- * Return: cypher suite type
- */
-static uint8_t scm_get_cipher_suite_type(enum wlan_enc_type enc)
-{
-	uint8_t cipher_type;
-
-	switch (enc) {
-	case WLAN_ENCRYPT_TYPE_WEP40:
-	case WLAN_ENCRYPT_TYPE_WEP40_STATICKEY:
-		cipher_type = WLAN_CSE_WEP40;
-		break;
-	case WLAN_ENCRYPT_TYPE_WEP104:
-	case WLAN_ENCRYPT_TYPE_WEP104_STATICKEY:
-		cipher_type = WLAN_CSE_WEP104;
-		break;
-	case WLAN_ENCRYPT_TYPE_TKIP:
-		cipher_type = WLAN_CSE_TKIP;
-		break;
-	case WLAN_ENCRYPT_TYPE_AES:
-		cipher_type = WLAN_CSE_CCMP;
-		break;
-	case WLAN_ENCRYPT_TYPE_AES_GCMP:
-		cipher_type = WLAN_CSE_GCMP_128;
-		break;
-	case WLAN_ENCRYPT_TYPE_AES_GCMP_256:
-		cipher_type = WLAN_CSE_GCMP_256;
-		break;
-	case WLAN_ENCRYPT_TYPE_NONE:
-		cipher_type = WLAN_CSE_NONE;
-		break;
-	case WLAN_ENCRYPT_TYPE_WPI:
-		cipher_type = WLAN_WAI_CERT_OR_SMS4;
-		break;
-	default:
-		cipher_type = WLAN_CSE_RESERVED;
-		break;
-	}
-
-	return cipher_type;
-}
-
-/**
- * scm_is_wep_security() - Check if scan entry support WEP security
- * @filter: scan filter
- * @db_entry: db entry
- * @security: matched security.
- *
- * Return: true if WEP security else false
- */
-static bool scm_is_wep_security(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry,
-	struct security_info *security)
-{
-	int i;
-	bool match = false;
-	enum wlan_auth_type neg_auth = WLAN_AUTH_TYPE_OPEN_SYSTEM;
-	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
-
-	/* If privacy bit is not set, consider no match */
-	if (!db_entry->cap_info.wlan_caps.privacy)
-		return false;
-
-	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
-		switch (filter->mc_enc_type[i]) {
-		case WLAN_ENCRYPT_TYPE_WEP40_STATICKEY:
-		case WLAN_ENCRYPT_TYPE_WEP104_STATICKEY:
-		case WLAN_ENCRYPT_TYPE_WEP40:
-		case WLAN_ENCRYPT_TYPE_WEP104:
-			/*
-			 * Multicast list may contain WEP40/WEP104.
-			 * Check whether it matches UC.
-			 */
-			if (security->uc_enc ==
-			   filter->mc_enc_type[i]) {
-				match = true;
-				neg_mccipher =
-				   filter->mc_enc_type[i];
-			}
-			break;
-		default:
-			match = false;
-			break;
-		}
-		if (match)
-			break;
-	}
-
-	if (!match)
-		return match;
-
-	for (i = 0; i < filter->num_of_auth; i++) {
-		switch (filter->auth_type[i]) {
-		case WLAN_AUTH_TYPE_OPEN_SYSTEM:
-		case WLAN_AUTH_TYPE_SHARED_KEY:
-		case WLAN_AUTH_TYPE_AUTOSWITCH:
-			match = true;
-			neg_auth = filter->auth_type[i];
-			break;
-		default:
-			match = false;
-		}
-		if (match)
-			break;
-	}
-
-	if (!match)
-		return match;
-
-	/*
-	 * In case of WPA / WPA2, check whether it supports WEP as well.
-	 * Prepare the encryption type for WPA/WPA2 functions
-	 */
-	if (security->uc_enc == WLAN_ENCRYPT_TYPE_WEP40_STATICKEY)
-		security->uc_enc = WLAN_ENCRYPT_TYPE_WEP40;
-	else if (security->uc_enc == WLAN_ENCRYPT_TYPE_WEP104)
-		security->uc_enc = WLAN_ENCRYPT_TYPE_WEP104;
-
-	/* else we can use the encryption type directly */
-	if (util_scan_entry_wpa(db_entry)) {
-		struct wlan_wpa_ie wpa = {0};
-		uint8_t cipher_type;
-
-		cipher_type =
-			scm_get_cipher_suite_type(security->uc_enc);
-		wlan_parse_wpa_ie(
-			util_scan_entry_wpa(db_entry), &wpa);
-
-		match = scm_is_cipher_match(&wpa.mc_cipher,
-				  1, WLAN_WPA_SEL(cipher_type));
-	}
-	if (!match && util_scan_entry_rsn(db_entry)) {
-		struct wlan_rsn_ie rsn = {0};
-		uint8_t cipher_type;
-
-		cipher_type =
-			scm_get_cipher_suite_type(security->uc_enc);
-
-		wlan_parse_rsn_ie(
-			   util_scan_entry_rsn(db_entry), &rsn);
-		match = scm_is_cipher_match(&rsn.gp_cipher_suite,
-				  1, WLAN_RSN_SEL(cipher_type));
-	}
-
-
-	if (match && security) {
-		security->auth_type = neg_auth;
-		security->mc_enc = neg_mccipher;
-	}
-
-	return match;
-}
-
-/**
- * scm_check_pmf_match() - Check PMF security of entry match filter
- * @filter: scan filter
- * @rsn: rsn IE of the scan entry
- *
- * Return: true if PMF security match else false
- */
-static bool
-scm_check_pmf_match(struct scan_filter *filter,
-	struct wlan_rsn_ie *rsn)
-{
-	enum wlan_pmf_cap ap_pmf_cap = WLAN_PMF_DISABLED;
-
-	if (rsn->cap & RSN_CAP_MFP_CAPABLE)
-		ap_pmf_cap = WLAN_PMF_CAPABLE;
-	if (rsn->cap & RSN_CAP_MFP_REQUIRED)
-		ap_pmf_cap = WLAN_PMF_REQUIRED;
-
-	if ((filter->pmf_cap == WLAN_PMF_REQUIRED) &&
-		(ap_pmf_cap == WLAN_PMF_DISABLED))
-		return false;
-	else if ((filter->pmf_cap == WLAN_PMF_DISABLED) &&
-		(ap_pmf_cap == WLAN_PMF_REQUIRED))
-		return false;
-
-	return true;
-}
-
-/**
- * scm_is_rsn_security() - Check if scan entry support RSN security
- * @filter: scan filter
- * @db_entry: db entry
- * @security: matched security.
- *
- * Return: true if RSN security else false
- */
-static bool scm_is_rsn_security(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry,
-	struct security_info *security)
-{
-	int i;
-	uint8_t cipher_type;
-	bool match = false;
-	enum wlan_auth_type neg_auth = WLAN_NUM_OF_SUPPORT_AUTH_TYPE;
-	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
-	struct wlan_rsn_ie rsn = {0};
-
-	if (!util_scan_entry_rsn(db_entry))
-		return false;
-
-	wlan_parse_rsn_ie(
-		   util_scan_entry_rsn(db_entry), &rsn);
-
-	cipher_type =
-		scm_get_cipher_suite_type(security->uc_enc);
-	match = scm_is_cipher_match(rsn.pwise_cipher_suites,
-		rsn.pwise_cipher_count, WLAN_RSN_SEL(cipher_type));
-	if (!match)
-		return false;
-
-	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
-		cipher_type =
-			scm_get_cipher_suite_type(
-				filter->mc_enc_type[i]);
-		match = scm_is_cipher_match(&rsn.gp_cipher_suite,
-			   1, WLAN_RSN_SEL(cipher_type));
-		if (match)
-			break;
-	}
-	if (!match)
-		return false;
-
-	neg_mccipher = filter->mc_enc_type[i];
-
-	/* Initializing with false as it has true value already */
-	match = false;
-	for (i = 0; i < filter->num_of_auth; i++) {
-		/*
-		 * Ciphers are supported, Match authentication algorithm and
-		 * pick first matching authtype.
-		 */
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_FILS_FT_SHA384))) {
-			if (WLAN_AUTH_TYPE_FT_FILS_SHA384 ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_FT_FILS_SHA384;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_FILS_FT_SHA256))) {
-			if (WLAN_AUTH_TYPE_FT_FILS_SHA256 ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_FT_FILS_SHA256;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_FILS_SHA384))) {
-			if (WLAN_AUTH_TYPE_FILS_SHA384 ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_FILS_SHA384;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_FILS_SHA256))) {
-			if (WLAN_AUTH_TYPE_FILS_SHA256 ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_FILS_SHA256;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count, WLAN_RSN_DPP_AKM)) {
-			if (WLAN_AUTH_TYPE_DPP_RSN ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_DPP_RSN;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_OWE))) {
-			if (WLAN_AUTH_TYPE_OWE ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_OWE;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_FT_IEEE8021X))) {
-			if (WLAN_AUTH_TYPE_FT_RSN ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_FT_RSN;
-				match = true;
-				break;
-			}
-		}
-
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_FT_PSK))) {
-			if (WLAN_AUTH_TYPE_FT_RSN_PSK ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_FT_RSN_PSK;
-				match = true;
-				break;
-			}
-		}
-		/* ESE only supports 802.1X.  No PSK. */
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_CCKM_AKM)) {
-			if (WLAN_AUTH_TYPE_CCKM_RSN ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_CCKM_RSN;
-				match = true;
-				break;
-			}
-		}
-		/* RSN */
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_IEEE8021X))) {
-			if (WLAN_AUTH_TYPE_RSN ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_RSN;
-				match = true;
-				break;
-			}
-		}
-		/* TKIP */
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_PSK))) {
-			if (WLAN_AUTH_TYPE_RSN_PSK ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_RSN_PSK;
-				match = true;
-				break;
-			}
-		}
-		/* SHA256 */
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_SHA256_PSK))) {
-			if (WLAN_AUTH_TYPE_RSN_PSK_SHA256 ==
-			   filter->auth_type[i]) {
-				neg_auth =
-					WLAN_AUTH_TYPE_RSN_PSK_SHA256;
-				match = true;
-				break;
-			}
-		}
-		/* 8021X SHA256 */
-		if (scm_is_cipher_match(rsn.akm_suites,
-		   rsn.akm_suite_count,
-		   WLAN_RSN_SEL(WLAN_AKM_SHA256_IEEE8021X))) {
-			if (WLAN_AUTH_TYPE_RSN_8021X_SHA256 ==
-			   filter->auth_type[i]) {
-				neg_auth =
-					WLAN_AUTH_TYPE_RSN_8021X_SHA256;
-				match = true;
-				break;
-			}
-		}
-	}
-
-	if (!match)
-		return false;
-	match = scm_check_pmf_match(filter, &rsn);
-
-	if (match && security) {
-		security->auth_type = neg_auth;
-		security->mc_enc = neg_mccipher;
-	}
-
-	return match;
-}
-
-/**
- * scm_is_wpa_security() - Check if scan entry support WPA security
- * @filter: scan filter
- * @db_entry: db entry
- * @security: matched security.
- *
- * Return: true if WPA security else false
- */
-static bool scm_is_wpa_security(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry,
-	struct security_info *security)
-{
-	int i;
-	uint8_t cipher_type;
-	bool match = false;
-	enum wlan_auth_type neg_auth = WLAN_NUM_OF_SUPPORT_AUTH_TYPE;
-	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
-	struct wlan_wpa_ie wpa = {0};
-
-	if (!util_scan_entry_wpa(db_entry))
-		return false;
-
-	wlan_parse_wpa_ie(util_scan_entry_wpa(db_entry), &wpa);
-
-	cipher_type =
-		scm_get_cipher_suite_type(security->uc_enc);
-	match = scm_is_cipher_match(wpa.uc_ciphers,
-		wpa.uc_cipher_count, WLAN_WPA_SEL(cipher_type));
-	if (!match)
-		return false;
-
-	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
-		cipher_type =
-		  scm_get_cipher_suite_type(
-		  filter->mc_enc_type[i]);
-		match = scm_is_cipher_match(&wpa.mc_cipher,
-			   1, WLAN_WPA_SEL(cipher_type));
-		if (match)
-			break;
-	}
-	if (!match)
-		return false;
-	neg_mccipher = filter->mc_enc_type[i];
-
-	/* Initializing with false as it has true value already */
-	match = false;
-	for (i = 0; i < filter->num_of_auth; i++) {
-		/*
-		 * Ciphers are supported, Match authentication algorithm and
-		 * pick first matching authtype.
-		 */
-		/**/
-		if (scm_is_cipher_match(wpa.auth_suites,
-		   wpa.auth_suite_count,
-		   WLAN_WPA_SEL(WLAN_AKM_IEEE8021X))) {
-			if (WLAN_AUTH_TYPE_WPA ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_WPA;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(wpa.auth_suites,
-		   wpa.auth_suite_count,
-		   WLAN_WPA_SEL(WLAN_AKM_PSK))) {
-			if (WLAN_AUTH_TYPE_WPA_PSK ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_WPA_PSK;
-				match = true;
-				break;
-			}
-		}
-		if (scm_is_cipher_match(wpa.auth_suites,
-		   wpa.auth_suite_count,
-		   WLAN_WPA_CCKM_AKM)) {
-			if (WLAN_AUTH_TYPE_CCKM_WPA ==
-			   filter->auth_type[i]) {
-				neg_auth = WLAN_AUTH_TYPE_CCKM_WPA;
-				match = true;
-				break;
-			}
-		}
-	}
-
-	if (match && security) {
-		security->auth_type = neg_auth;
-		security->mc_enc = neg_mccipher;
-	}
-
-	return match;
-}
-
-/**
- * scm_is_wapi_security() - Check if scan entry support WAPI security
- * @filter: scan filter
- * @db_entry: db entry
- * @security: matched security.
- *
- * Return: true if WAPI security else false
- */
-static bool scm_is_wapi_security(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry,
-	struct security_info *security)
-{
-	int i;
-	uint8_t cipher_type;
-	bool match = false;
-	enum wlan_auth_type neg_auth = WLAN_NUM_OF_SUPPORT_AUTH_TYPE;
-	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
-	struct wlan_wapi_ie wapi = {0};
-
-	if (!util_scan_entry_wapi(db_entry))
-		return false;
-
-	wlan_parse_wapi_ie(
-		   util_scan_entry_wapi(db_entry), &wapi);
-
-	cipher_type =
-		scm_get_cipher_suite_type(security->uc_enc);
-	match = scm_is_cipher_match(wapi.uc_cipher_suites,
-		wapi.uc_cipher_count, WLAN_WAPI_SEL(cipher_type));
-	if (!match)
-		return false;
-
-	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
-		cipher_type =
-		  scm_get_cipher_suite_type(
-		  filter->mc_enc_type[i]);
-		match = scm_is_cipher_match(&wapi.mc_cipher_suite,
-				  1, WLAN_WAPI_SEL(cipher_type));
-		if (match)
-			break;
-	}
-	if (!match)
-		return false;
-	neg_mccipher = filter->mc_enc_type[i];
-
-	if (scm_is_cipher_match(wapi.akm_suites,
-	   wapi.akm_suite_count,
-	   WLAN_WAPI_SEL(WLAN_WAI_CERT_OR_SMS4)))
-		neg_auth =
-			WLAN_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
-	else if (scm_is_cipher_match(wapi.akm_suites,
-	   wapi.akm_suite_count, WLAN_WAPI_SEL(WLAN_WAI_PSK)))
-		neg_auth = WLAN_AUTH_TYPE_WAPI_WAI_PSK;
-	else
-		return false;
-
-	match = false;
-	for (i = 0; i < filter->num_of_auth; i++) {
-		if (filter->auth_type[i] == neg_auth) {
-			match = true;
-			break;
-		}
-	}
-
-	if (match && security) {
-		security->auth_type = neg_auth;
-		security->mc_enc = neg_mccipher;
-	}
-
-	return match;
-}
-
-/**
- * scm_is_def_security() - Check if any security in filter match
- * @filter: scan filter
- * @db_entry: db entry
- * @security: matched security.
- *
- * Return: true if any security else false
- */
-static bool scm_is_def_security(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry,
-	struct security_info *security)
-{
-	bool match_any = false;
-	bool match = true;
-
-	/* It is allowed to match anything. Try the more secured ones first. */
-	/* Check AES first */
-	security->uc_enc = WLAN_ENCRYPT_TYPE_AES;
-	match_any = scm_is_rsn_security(filter,
-			    db_entry, security);
-	if (!match_any) {
-		/* Check TKIP */
-		security->uc_enc = WLAN_ENCRYPT_TYPE_TKIP;
-		match_any = scm_is_rsn_security(filter,
-			    db_entry, security);
-	}
-
-	if (!match_any) {
-		/* Check WAPI */
-		security->uc_enc = WLAN_ENCRYPT_TYPE_WPI;
-		match_any = scm_is_wapi_security(filter,
-			    db_entry, security);
-	}
-
-	if (match_any)
-		return match;
-
-	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP104;
-	if (scm_is_wep_security(filter,
-	   db_entry, security))
-		return true;
-	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP40;
-	if (scm_is_wep_security(filter,
-	   db_entry, security))
-		return true;
-	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP104_STATICKEY;
-	if (scm_is_wep_security(filter,
-	   db_entry, security))
-		return true;
-	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP40_STATICKEY;
-	if (scm_is_wep_security(filter,
-	   db_entry, security))
-		return true;
-
-	/* It must be open and no enc */
-	if (db_entry->cap_info.wlan_caps.privacy)
-		return false;
-
-	security->auth_type = WLAN_AUTH_TYPE_OPEN_SYSTEM;
-	security->mc_enc = WLAN_ENCRYPT_TYPE_NONE;
-	security->uc_enc = WLAN_ENCRYPT_TYPE_NONE;
-
-	return match;
-}
-
-/**
- * scm_is_fils_config_match() - Check if FILS config matches
- * @filter: scan filter
- * @db_entry: db entry
- *
- * Return: true if FILS config matches else false
- */
-static bool scm_is_fils_config_match(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry)
-{
-	int i;
-	struct fils_indication_ie *indication_ie;
-	uint8_t *data;
-
-	if (!filter->fils_scan_filter.realm_check)
-		return true;
-
-	if (!db_entry->ie_list.fils_indication)
-		return false;
-
-
-	indication_ie =
-		(struct fils_indication_ie *) db_entry->ie_list.fils_indication;
-
-	data = indication_ie->variable_data;
-	if (indication_ie->is_cache_id_present)
-		data += CACHE_IDENTIFIER_LEN;
-
-	if (indication_ie->is_hessid_present)
-		data += HESSID_LEN;
-
-	for (i = 1; i <= indication_ie->realm_identifiers_cnt; i++) {
-		if (!qdf_mem_cmp(filter->fils_scan_filter.fils_realm,
-				 data, REAM_HASH_LEN))
-			return true;
-		/* Max realm count reached */
-		if (indication_ie->realm_identifiers_cnt == i)
-			break;
-		else
-			data = data + REAM_HASH_LEN;
-	}
-
-	return false;
-}
-
-/**
- * scm_is_security_match() - Check if security in filter match
- * @filter: scan filter
- * @db_entry: db entry
- * @security: matched security.
- *
- * Return: true if security match else false
- */
-static bool scm_is_security_match(struct scan_filter *filter,
-	struct scan_cache_entry *db_entry,
-	struct security_info *security)
-{
-	int i;
-	bool match = false;
-	struct security_info local_security = {0};
-
-	if (!filter->num_of_enc_type)
-		return true;
-
-	for (i = 0; (i < filter->num_of_enc_type) &&
-	    !match; i++) {
-
-		local_security.uc_enc =
-			filter->enc_type[i];
-
-		switch (filter->enc_type[i]) {
-		case WLAN_ENCRYPT_TYPE_NONE:
-			match = scm_is_open_security(filter,
-				    db_entry, &local_security);
-			break;
-		case WLAN_ENCRYPT_TYPE_WEP40_STATICKEY:
-		case WLAN_ENCRYPT_TYPE_WEP104_STATICKEY:
-		case WLAN_ENCRYPT_TYPE_WEP40:
-		case WLAN_ENCRYPT_TYPE_WEP104:
-			match = scm_is_wep_security(filter,
-				    db_entry, &local_security);
-			break;
-		case WLAN_ENCRYPT_TYPE_TKIP:
-		case WLAN_ENCRYPT_TYPE_AES:
-		case WLAN_ENCRYPT_TYPE_AES_GCMP:
-		case WLAN_ENCRYPT_TYPE_AES_GCMP_256:
-			/* First check if there is a RSN match */
-			match = scm_is_rsn_security(filter,
-				    db_entry, &local_security);
-			/* If not RSN, then check WPA match */
-			if (!match)
-				match = scm_is_wpa_security(filter,
-				    db_entry, &local_security);
-			break;
-		case WLAN_ENCRYPT_TYPE_WPI:/* WAPI */
-			match = scm_is_wapi_security(filter,
-				    db_entry, &local_security);
-			break;
-		case WLAN_ENCRYPT_TYPE_ANY:
-		default:
-			match  = scm_is_def_security(filter,
-				    db_entry, &local_security);
-			break;
-		}
-	}
-
-	if (match && security)
-		qdf_mem_copy(security,
-			&local_security, sizeof(*security));
-
-	return match;
-}
-
-bool scm_filter_match(struct wlan_objmgr_psoc *psoc,
-	struct scan_cache_entry *db_entry,
-	struct scan_filter *filter,
-	struct security_info *security)
-{
-	int i;
-	bool match = false;
-	struct roam_filter_params *roam_params;
-	struct scan_default_params *def_param;
-
-	def_param = wlan_scan_psoc_get_def_params(psoc);
-	roam_params = &def_param->roam_params;
-
-	if (filter->p2p_results && !db_entry->is_p2p)
-		return false;
-
-	for (i = 0; i < roam_params->num_bssid_avoid_list; i++)
-		if (qdf_is_macaddr_equal(&roam_params->bssid_avoid_list[i],
-		   &db_entry->bssid))
-			return false;
-
-	match = false;
-	if (db_entry->ssid.length) {
-		for (i = 0; i < filter->num_of_ssid; i++) {
-			if (util_is_ssid_match(&filter->ssid_list[i],
-			   &db_entry->ssid)) {
-				match = true;
-				break;
-			}
-		}
-	}
-	if (!match && filter->num_of_ssid)
-		return false;
-
-	match = false;
-	/* TO do Fill p2p MAC*/
-	for (i = 0; i < filter->num_of_bssid; i++) {
-		if (util_is_bssid_match(&filter->bssid_list[i],
-		   &db_entry->bssid)) {
-			match = true;
-			break;
-		}
-		/* TODO match p2p mac */
-	}
-	if (!match && filter->num_of_bssid)
-		return false;
-
-	match = false;
-	for (i = 0; i < filter->num_of_channels; i++) {
-		if (!filter->channel_list[i] || (
-		   (filter->channel_list[i] ==
-		   db_entry->channel.chan_idx))) {
-			match = true;
-			break;
-		}
-	}
-
-	if (!match && filter->num_of_channels)
-		return false;
-
-	if (filter->rrm_measurement_filter)
-		return true;
-
-	/* TODO match phyMode */
-
-	if (!filter->ignore_auth_enc_type &&
-	   !scm_is_security_match(filter,
-	   db_entry, security))
-		return false;
-
-	if (!util_is_bss_type_match(filter->bss_type,
-	   db_entry->cap_info))
-		return false;
-
-	/* TODO match rate set */
-
-	if (filter->only_wmm_ap &&
-	   !db_entry->ie_list.wmeinfo &&
-	   !db_entry->ie_list.wmeparam)
-		return false;
-
-	/* Match realm */
-	if (!scm_is_fils_config_match(filter, db_entry))
-		return false;
-
-	if (!util_country_code_match(filter->country,
-	   db_entry->ie_list.country))
-		return false;
-
-	if (!util_mdie_match(filter->mobility_domain,
-	   (struct rsn_mdie *)db_entry->ie_list.mdie))
-		return false;
-
-	return true;
-}
 bool scm_get_pcl_weight_of_channel(int channel_id,
 		struct scan_filter *filter,
 		int *pcl_chan_weight,
@@ -1694,7 +794,7 @@ bool scm_get_pcl_weight_of_channel(int channel_id,
 	int i;
 	bool found = false;
 
-	if (NULL == filter)
+	if (!filter)
 		return found;
 
 	for (i = 0; i < filter->num_of_pcl_channels; i++) {

+ 1 - 1
umac/scan/core/src/wlan_scan_cache_db_i.h

@@ -17,7 +17,7 @@
  */
 
 /*
- * DOC: contains scan cache internal api
+ * DOC: contains scan internal api
  */
 
 #ifndef _WLAN_SCAN_CACHE_DB_I_H_

+ 922 - 0
umac/scan/core/src/wlan_scan_filter.c

@@ -0,0 +1,922 @@
+/*
+ * 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 filter logic
+ */
+
+#include <wlan_scan_utils_api.h>
+#include "wlan_scan_main.h"
+#include "wlan_scan_cache_db_i.h"
+
+/**
+ * scm_is_open_security() - Check if scan entry support open security
+ * @filter: scan filter
+ * @db_entry: db entry
+ * @security: matched security.
+ *
+ * Return: true if open security else false
+ */
+static bool scm_is_open_security(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry,
+	struct security_info *security)
+{
+	bool match = false;
+	int i;
+
+	if (db_entry->cap_info.wlan_caps.privacy)
+		return false;
+
+	/* Check MC cipher and Auth type requested. */
+	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
+		if (WLAN_ENCRYPT_TYPE_NONE ==
+			filter->mc_enc_type[i]) {
+			security->mc_enc =
+				filter->mc_enc_type[i];
+			match = true;
+			break;
+		}
+	}
+	if (!match && filter->num_of_mc_enc_type)
+		return match;
+
+	match = false;
+	/* Check Auth list. It should contain AuthOpen. */
+	for (i = 0; i < filter->num_of_auth; i++) {
+		if ((WLAN_AUTH_TYPE_OPEN_SYSTEM ==
+			filter->auth_type[i]) ||
+			(WLAN_AUTH_TYPE_AUTOSWITCH ==
+			filter->auth_type[i])) {
+			security->auth_type =
+				WLAN_AUTH_TYPE_OPEN_SYSTEM;
+			match = true;
+			break;
+		}
+	}
+
+	return match;
+}
+
+/**
+ * scm_is_cipher_match() - Check if cipher match the cipher list
+ * @cipher_list: cipher list to match
+ * @num_cipher: number of cipher in cipher list
+ * @cipher_to_match: cipher to found in cipher list
+ *
+ * Return: true if open security else false
+ */
+static bool scm_is_cipher_match(
+	uint32_t *cipher_list,
+	uint16_t num_cipher, uint32_t cipher_to_match)
+{
+	int i;
+	bool match = false;
+
+	for (i = 0; i < num_cipher ; i++) {
+		match = (cipher_list[i] == cipher_to_match);
+		if (match)
+			break;
+	}
+
+	return match;
+}
+
+/**
+ * scm_get_cipher_suite_type() - get cypher suite type from enc type
+ * @enc: enc type
+ *
+ * Return: cypher suite type
+ */
+static uint8_t scm_get_cipher_suite_type(enum wlan_enc_type enc)
+{
+	uint8_t cipher_type;
+
+	switch (enc) {
+	case WLAN_ENCRYPT_TYPE_WEP40:
+	case WLAN_ENCRYPT_TYPE_WEP40_STATICKEY:
+		cipher_type = WLAN_CSE_WEP40;
+		break;
+	case WLAN_ENCRYPT_TYPE_WEP104:
+	case WLAN_ENCRYPT_TYPE_WEP104_STATICKEY:
+		cipher_type = WLAN_CSE_WEP104;
+		break;
+	case WLAN_ENCRYPT_TYPE_TKIP:
+		cipher_type = WLAN_CSE_TKIP;
+		break;
+	case WLAN_ENCRYPT_TYPE_AES:
+		cipher_type = WLAN_CSE_CCMP;
+		break;
+	case WLAN_ENCRYPT_TYPE_AES_GCMP:
+		cipher_type = WLAN_CSE_GCMP_128;
+		break;
+	case WLAN_ENCRYPT_TYPE_AES_GCMP_256:
+		cipher_type = WLAN_CSE_GCMP_256;
+		break;
+	case WLAN_ENCRYPT_TYPE_NONE:
+		cipher_type = WLAN_CSE_NONE;
+		break;
+	case WLAN_ENCRYPT_TYPE_WPI:
+		cipher_type = WLAN_WAI_CERT_OR_SMS4;
+		break;
+	default:
+		cipher_type = WLAN_CSE_RESERVED;
+		break;
+	}
+
+	return cipher_type;
+}
+
+/**
+ * scm_is_wep_security() - Check if scan entry support WEP security
+ * @filter: scan filter
+ * @db_entry: db entry
+ * @security: matched security.
+ *
+ * Return: true if WEP security else false
+ */
+static bool scm_is_wep_security(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry,
+	struct security_info *security)
+{
+	int i;
+	bool match = false;
+	enum wlan_auth_type neg_auth = WLAN_AUTH_TYPE_OPEN_SYSTEM;
+	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
+
+	/* If privacy bit is not set, consider no match */
+	if (!db_entry->cap_info.wlan_caps.privacy)
+		return false;
+
+	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
+		switch (filter->mc_enc_type[i]) {
+		case WLAN_ENCRYPT_TYPE_WEP40_STATICKEY:
+		case WLAN_ENCRYPT_TYPE_WEP104_STATICKEY:
+		case WLAN_ENCRYPT_TYPE_WEP40:
+		case WLAN_ENCRYPT_TYPE_WEP104:
+			/*
+			 * Multicast list may contain WEP40/WEP104.
+			 * Check whether it matches UC.
+			 */
+			if (security->uc_enc ==
+			   filter->mc_enc_type[i]) {
+				match = true;
+				neg_mccipher =
+				   filter->mc_enc_type[i];
+			}
+			break;
+		default:
+			match = false;
+			break;
+		}
+		if (match)
+			break;
+	}
+
+	if (!match)
+		return match;
+
+	for (i = 0; i < filter->num_of_auth; i++) {
+		switch (filter->auth_type[i]) {
+		case WLAN_AUTH_TYPE_OPEN_SYSTEM:
+		case WLAN_AUTH_TYPE_SHARED_KEY:
+		case WLAN_AUTH_TYPE_AUTOSWITCH:
+			match = true;
+			neg_auth = filter->auth_type[i];
+			break;
+		default:
+			match = false;
+		}
+		if (match)
+			break;
+	}
+
+	if (!match)
+		return match;
+
+	/*
+	 * In case of WPA / WPA2, check whether it supports WEP as well.
+	 * Prepare the encryption type for WPA/WPA2 functions
+	 */
+	if (security->uc_enc == WLAN_ENCRYPT_TYPE_WEP40_STATICKEY)
+		security->uc_enc = WLAN_ENCRYPT_TYPE_WEP40;
+	else if (security->uc_enc == WLAN_ENCRYPT_TYPE_WEP104)
+		security->uc_enc = WLAN_ENCRYPT_TYPE_WEP104;
+
+	/* else we can use the encryption type directly */
+	if (util_scan_entry_wpa(db_entry)) {
+		struct wlan_wpa_ie wpa = {0};
+		uint8_t cipher_type;
+
+		cipher_type =
+			scm_get_cipher_suite_type(security->uc_enc);
+		wlan_parse_wpa_ie(
+			util_scan_entry_wpa(db_entry), &wpa);
+
+		match = scm_is_cipher_match(&wpa.mc_cipher,
+				  1, WLAN_WPA_SEL(cipher_type));
+	}
+	if (!match && util_scan_entry_rsn(db_entry)) {
+		struct wlan_rsn_ie rsn = {0};
+		uint8_t cipher_type;
+
+		cipher_type =
+			scm_get_cipher_suite_type(security->uc_enc);
+
+		wlan_parse_rsn_ie(
+			   util_scan_entry_rsn(db_entry), &rsn);
+		match = scm_is_cipher_match(&rsn.gp_cipher_suite,
+				  1, WLAN_RSN_SEL(cipher_type));
+	}
+
+
+	if (match && security) {
+		security->auth_type = neg_auth;
+		security->mc_enc = neg_mccipher;
+	}
+
+	return match;
+}
+
+/**
+ * scm_check_pmf_match() - Check PMF security of entry match filter
+ * @filter: scan filter
+ * @rsn: rsn IE of the scan entry
+ *
+ * Return: true if PMF security match else false
+ */
+static bool
+scm_check_pmf_match(struct scan_filter *filter,
+	struct wlan_rsn_ie *rsn)
+{
+	enum wlan_pmf_cap ap_pmf_cap = WLAN_PMF_DISABLED;
+
+	if (rsn->cap & RSN_CAP_MFP_CAPABLE)
+		ap_pmf_cap = WLAN_PMF_CAPABLE;
+	if (rsn->cap & RSN_CAP_MFP_REQUIRED)
+		ap_pmf_cap = WLAN_PMF_REQUIRED;
+
+	if ((filter->pmf_cap == WLAN_PMF_REQUIRED) &&
+		(ap_pmf_cap == WLAN_PMF_DISABLED))
+		return false;
+	else if ((filter->pmf_cap == WLAN_PMF_DISABLED) &&
+		(ap_pmf_cap == WLAN_PMF_REQUIRED))
+		return false;
+
+	return true;
+}
+
+/**
+ * scm_is_rsn_security() - Check if scan entry support RSN security
+ * @filter: scan filter
+ * @db_entry: db entry
+ * @security: matched security.
+ *
+ * Return: true if RSN security else false
+ */
+static bool scm_is_rsn_security(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry,
+	struct security_info *security)
+{
+	int i;
+	uint8_t cipher_type;
+	bool match = false;
+	enum wlan_auth_type neg_auth = WLAN_NUM_OF_SUPPORT_AUTH_TYPE;
+	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
+	struct wlan_rsn_ie rsn = {0};
+
+	if (!util_scan_entry_rsn(db_entry))
+		return false;
+
+	wlan_parse_rsn_ie(
+		   util_scan_entry_rsn(db_entry), &rsn);
+
+	cipher_type =
+		scm_get_cipher_suite_type(security->uc_enc);
+	match = scm_is_cipher_match(rsn.pwise_cipher_suites,
+		rsn.pwise_cipher_count, WLAN_RSN_SEL(cipher_type));
+	if (!match)
+		return false;
+
+	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
+		cipher_type =
+			scm_get_cipher_suite_type(
+				filter->mc_enc_type[i]);
+		match = scm_is_cipher_match(&rsn.gp_cipher_suite,
+			   1, WLAN_RSN_SEL(cipher_type));
+		if (match)
+			break;
+	}
+	if (!match)
+		return false;
+
+	neg_mccipher = filter->mc_enc_type[i];
+
+	/* Initializing with false as it has true value already */
+	match = false;
+	for (i = 0; i < filter->num_of_auth; i++) {
+		/*
+		 * Ciphers are supported, Match authentication algorithm and
+		 * pick first matching authtype.
+		 */
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_FILS_FT_SHA384))) {
+			if (WLAN_AUTH_TYPE_FT_FILS_SHA384 ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_FT_FILS_SHA384;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_FILS_FT_SHA256))) {
+			if (WLAN_AUTH_TYPE_FT_FILS_SHA256 ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_FT_FILS_SHA256;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_FILS_SHA384))) {
+			if (WLAN_AUTH_TYPE_FILS_SHA384 ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_FILS_SHA384;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_FILS_SHA256))) {
+			if (WLAN_AUTH_TYPE_FILS_SHA256 ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_FILS_SHA256;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count, WLAN_RSN_DPP_AKM)) {
+			if (WLAN_AUTH_TYPE_DPP_RSN ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_DPP_RSN;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_OWE))) {
+			if (WLAN_AUTH_TYPE_OWE ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_OWE;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_FT_IEEE8021X))) {
+			if (WLAN_AUTH_TYPE_FT_RSN ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_FT_RSN;
+				match = true;
+				break;
+			}
+		}
+
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_FT_PSK))) {
+			if (WLAN_AUTH_TYPE_FT_RSN_PSK ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_FT_RSN_PSK;
+				match = true;
+				break;
+			}
+		}
+		/* ESE only supports 802.1X.  No PSK. */
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_CCKM_AKM)) {
+			if (WLAN_AUTH_TYPE_CCKM_RSN ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_CCKM_RSN;
+				match = true;
+				break;
+			}
+		}
+		/* RSN */
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_IEEE8021X))) {
+			if (WLAN_AUTH_TYPE_RSN ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_RSN;
+				match = true;
+				break;
+			}
+		}
+		/* TKIP */
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_PSK))) {
+			if (WLAN_AUTH_TYPE_RSN_PSK ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_RSN_PSK;
+				match = true;
+				break;
+			}
+		}
+		/* SHA256 */
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_SHA256_PSK))) {
+			if (WLAN_AUTH_TYPE_RSN_PSK_SHA256 ==
+			   filter->auth_type[i]) {
+				neg_auth =
+					WLAN_AUTH_TYPE_RSN_PSK_SHA256;
+				match = true;
+				break;
+			}
+		}
+		/* 8021X SHA256 */
+		if (scm_is_cipher_match(rsn.akm_suites,
+		   rsn.akm_suite_count,
+		   WLAN_RSN_SEL(WLAN_AKM_SHA256_IEEE8021X))) {
+			if (WLAN_AUTH_TYPE_RSN_8021X_SHA256 ==
+			   filter->auth_type[i]) {
+				neg_auth =
+					WLAN_AUTH_TYPE_RSN_8021X_SHA256;
+				match = true;
+				break;
+			}
+		}
+	}
+
+	if (!match)
+		return false;
+	match = scm_check_pmf_match(filter, &rsn);
+
+	if (match && security) {
+		security->auth_type = neg_auth;
+		security->mc_enc = neg_mccipher;
+	}
+
+	return match;
+}
+
+/**
+ * scm_is_wpa_security() - Check if scan entry support WPA security
+ * @filter: scan filter
+ * @db_entry: db entry
+ * @security: matched security.
+ *
+ * Return: true if WPA security else false
+ */
+static bool scm_is_wpa_security(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry,
+	struct security_info *security)
+{
+	int i;
+	uint8_t cipher_type;
+	bool match = false;
+	enum wlan_auth_type neg_auth = WLAN_NUM_OF_SUPPORT_AUTH_TYPE;
+	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
+	struct wlan_wpa_ie wpa = {0};
+
+	if (!util_scan_entry_wpa(db_entry))
+		return false;
+
+	wlan_parse_wpa_ie(util_scan_entry_wpa(db_entry), &wpa);
+
+	cipher_type =
+		scm_get_cipher_suite_type(security->uc_enc);
+	match = scm_is_cipher_match(wpa.uc_ciphers,
+		wpa.uc_cipher_count, WLAN_WPA_SEL(cipher_type));
+	if (!match)
+		return false;
+
+	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
+		cipher_type =
+		  scm_get_cipher_suite_type(
+		  filter->mc_enc_type[i]);
+		match = scm_is_cipher_match(&wpa.mc_cipher,
+			   1, WLAN_WPA_SEL(cipher_type));
+		if (match)
+			break;
+	}
+	if (!match)
+		return false;
+	neg_mccipher = filter->mc_enc_type[i];
+
+	/* Initializing with false as it has true value already */
+	match = false;
+	for (i = 0; i < filter->num_of_auth; i++) {
+		/*
+		 * Ciphers are supported, Match authentication algorithm and
+		 * pick first matching authtype.
+		 */
+		/**/
+		if (scm_is_cipher_match(wpa.auth_suites,
+		   wpa.auth_suite_count,
+		   WLAN_WPA_SEL(WLAN_AKM_IEEE8021X))) {
+			if (WLAN_AUTH_TYPE_WPA ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_WPA;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(wpa.auth_suites,
+		   wpa.auth_suite_count,
+		   WLAN_WPA_SEL(WLAN_AKM_PSK))) {
+			if (WLAN_AUTH_TYPE_WPA_PSK ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_WPA_PSK;
+				match = true;
+				break;
+			}
+		}
+		if (scm_is_cipher_match(wpa.auth_suites,
+		   wpa.auth_suite_count,
+		   WLAN_WPA_CCKM_AKM)) {
+			if (WLAN_AUTH_TYPE_CCKM_WPA ==
+			   filter->auth_type[i]) {
+				neg_auth = WLAN_AUTH_TYPE_CCKM_WPA;
+				match = true;
+				break;
+			}
+		}
+	}
+
+	if (match && security) {
+		security->auth_type = neg_auth;
+		security->mc_enc = neg_mccipher;
+	}
+
+	return match;
+}
+
+/**
+ * scm_is_wapi_security() - Check if scan entry support WAPI security
+ * @filter: scan filter
+ * @db_entry: db entry
+ * @security: matched security.
+ *
+ * Return: true if WAPI security else false
+ */
+static bool scm_is_wapi_security(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry,
+	struct security_info *security)
+{
+	int i;
+	uint8_t cipher_type;
+	bool match = false;
+	enum wlan_auth_type neg_auth = WLAN_NUM_OF_SUPPORT_AUTH_TYPE;
+	enum wlan_enc_type neg_mccipher = WLAN_ENCRYPT_TYPE_NONE;
+	struct wlan_wapi_ie wapi = {0};
+
+	if (!util_scan_entry_wapi(db_entry))
+		return false;
+
+	wlan_parse_wapi_ie(
+		   util_scan_entry_wapi(db_entry), &wapi);
+
+	cipher_type =
+		scm_get_cipher_suite_type(security->uc_enc);
+	match = scm_is_cipher_match(wapi.uc_cipher_suites,
+		wapi.uc_cipher_count, WLAN_WAPI_SEL(cipher_type));
+	if (!match)
+		return false;
+
+	for (i = 0; i < filter->num_of_mc_enc_type; i++) {
+		cipher_type =
+		  scm_get_cipher_suite_type(
+		  filter->mc_enc_type[i]);
+		match = scm_is_cipher_match(&wapi.mc_cipher_suite,
+				  1, WLAN_WAPI_SEL(cipher_type));
+		if (match)
+			break;
+	}
+	if (!match)
+		return false;
+	neg_mccipher = filter->mc_enc_type[i];
+
+	if (scm_is_cipher_match(wapi.akm_suites,
+	   wapi.akm_suite_count,
+	   WLAN_WAPI_SEL(WLAN_WAI_CERT_OR_SMS4)))
+		neg_auth =
+			WLAN_AUTH_TYPE_WAPI_WAI_CERTIFICATE;
+	else if (scm_is_cipher_match(wapi.akm_suites,
+	   wapi.akm_suite_count, WLAN_WAPI_SEL(WLAN_WAI_PSK)))
+		neg_auth = WLAN_AUTH_TYPE_WAPI_WAI_PSK;
+	else
+		return false;
+
+	match = false;
+	for (i = 0; i < filter->num_of_auth; i++) {
+		if (filter->auth_type[i] == neg_auth) {
+			match = true;
+			break;
+		}
+	}
+
+	if (match && security) {
+		security->auth_type = neg_auth;
+		security->mc_enc = neg_mccipher;
+	}
+
+	return match;
+}
+
+/**
+ * scm_is_def_security() - Check if any security in filter match
+ * @filter: scan filter
+ * @db_entry: db entry
+ * @security: matched security.
+ *
+ * Return: true if any security else false
+ */
+static bool scm_is_def_security(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry,
+	struct security_info *security)
+{
+	bool match_any = false;
+	bool match = true;
+
+	/* It is allowed to match anything. Try the more secured ones first. */
+	/* Check AES first */
+	security->uc_enc = WLAN_ENCRYPT_TYPE_AES;
+	match_any = scm_is_rsn_security(filter,
+			    db_entry, security);
+	if (!match_any) {
+		/* Check TKIP */
+		security->uc_enc = WLAN_ENCRYPT_TYPE_TKIP;
+		match_any = scm_is_rsn_security(filter,
+			    db_entry, security);
+	}
+
+	if (!match_any) {
+		/* Check WAPI */
+		security->uc_enc = WLAN_ENCRYPT_TYPE_WPI;
+		match_any = scm_is_wapi_security(filter,
+			    db_entry, security);
+	}
+
+	if (match_any)
+		return match;
+
+	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP104;
+	if (scm_is_wep_security(filter,
+	   db_entry, security))
+		return true;
+	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP40;
+	if (scm_is_wep_security(filter,
+	   db_entry, security))
+		return true;
+	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP104_STATICKEY;
+	if (scm_is_wep_security(filter,
+	   db_entry, security))
+		return true;
+	security->uc_enc = WLAN_ENCRYPT_TYPE_WEP40_STATICKEY;
+	if (scm_is_wep_security(filter,
+	   db_entry, security))
+		return true;
+
+	/* It must be open and no enc */
+	if (db_entry->cap_info.wlan_caps.privacy)
+		return false;
+
+	security->auth_type = WLAN_AUTH_TYPE_OPEN_SYSTEM;
+	security->mc_enc = WLAN_ENCRYPT_TYPE_NONE;
+	security->uc_enc = WLAN_ENCRYPT_TYPE_NONE;
+
+	return match;
+}
+
+/**
+ * scm_is_fils_config_match() - Check if FILS config matches
+ * @filter: scan filter
+ * @db_entry: db entry
+ *
+ * Return: true if FILS config matches else false
+ */
+static bool scm_is_fils_config_match(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry)
+{
+	int i;
+	struct fils_indication_ie *indication_ie;
+	uint8_t *data;
+
+	if (!filter->fils_scan_filter.realm_check)
+		return true;
+
+	if (!db_entry->ie_list.fils_indication)
+		return false;
+
+
+	indication_ie =
+		(struct fils_indication_ie *) db_entry->ie_list.fils_indication;
+
+	data = indication_ie->variable_data;
+	if (indication_ie->is_cache_id_present)
+		data += CACHE_IDENTIFIER_LEN;
+
+	if (indication_ie->is_hessid_present)
+		data += HESSID_LEN;
+
+	for (i = 1; i <= indication_ie->realm_identifiers_cnt; i++) {
+		if (!qdf_mem_cmp(filter->fils_scan_filter.fils_realm,
+				 data, REAM_HASH_LEN))
+			return true;
+		/* Max realm count reached */
+		if (indication_ie->realm_identifiers_cnt == i)
+			break;
+		else
+			data = data + REAM_HASH_LEN;
+	}
+
+	return false;
+}
+
+/**
+ * scm_is_security_match() - Check if security in filter match
+ * @filter: scan filter
+ * @db_entry: db entry
+ * @security: matched security.
+ *
+ * Return: true if security match else false
+ */
+static bool scm_is_security_match(struct scan_filter *filter,
+	struct scan_cache_entry *db_entry,
+	struct security_info *security)
+{
+	int i;
+	bool match = false;
+	struct security_info local_security = {0};
+
+	if (!filter->num_of_enc_type)
+		return true;
+
+	for (i = 0; (i < filter->num_of_enc_type) &&
+	    !match; i++) {
+
+		local_security.uc_enc =
+			filter->enc_type[i];
+
+		switch (filter->enc_type[i]) {
+		case WLAN_ENCRYPT_TYPE_NONE:
+			match = scm_is_open_security(filter,
+				    db_entry, &local_security);
+			break;
+		case WLAN_ENCRYPT_TYPE_WEP40_STATICKEY:
+		case WLAN_ENCRYPT_TYPE_WEP104_STATICKEY:
+		case WLAN_ENCRYPT_TYPE_WEP40:
+		case WLAN_ENCRYPT_TYPE_WEP104:
+			match = scm_is_wep_security(filter,
+				    db_entry, &local_security);
+			break;
+		case WLAN_ENCRYPT_TYPE_TKIP:
+		case WLAN_ENCRYPT_TYPE_AES:
+		case WLAN_ENCRYPT_TYPE_AES_GCMP:
+		case WLAN_ENCRYPT_TYPE_AES_GCMP_256:
+			/* First check if there is a RSN match */
+			match = scm_is_rsn_security(filter,
+				    db_entry, &local_security);
+			/* If not RSN, then check WPA match */
+			if (!match)
+				match = scm_is_wpa_security(filter,
+				    db_entry, &local_security);
+			break;
+		case WLAN_ENCRYPT_TYPE_WPI:/* WAPI */
+			match = scm_is_wapi_security(filter,
+				    db_entry, &local_security);
+			break;
+		case WLAN_ENCRYPT_TYPE_ANY:
+		default:
+			match  = scm_is_def_security(filter,
+				    db_entry, &local_security);
+			break;
+		}
+	}
+
+	if (match && security)
+		qdf_mem_copy(security,
+			&local_security, sizeof(*security));
+
+	return match;
+}
+
+bool scm_filter_match(struct wlan_objmgr_psoc *psoc,
+	struct scan_cache_entry *db_entry,
+	struct scan_filter *filter,
+	struct security_info *security)
+{
+	int i;
+	bool match = false;
+	struct roam_filter_params *roam_params;
+	struct scan_default_params *def_param;
+
+	def_param = wlan_scan_psoc_get_def_params(psoc);
+	roam_params = &def_param->roam_params;
+
+	if (filter->p2p_results && !db_entry->is_p2p)
+		return false;
+
+	for (i = 0; i < roam_params->num_bssid_avoid_list; i++)
+		if (qdf_is_macaddr_equal(&roam_params->bssid_avoid_list[i],
+		   &db_entry->bssid))
+			return false;
+
+	match = false;
+	if (db_entry->ssid.length) {
+		for (i = 0; i < filter->num_of_ssid; i++) {
+			if (util_is_ssid_match(&filter->ssid_list[i],
+			   &db_entry->ssid)) {
+				match = true;
+				break;
+			}
+		}
+	}
+	if (!match && filter->num_of_ssid)
+		return false;
+
+	match = false;
+	/* TO do Fill p2p MAC*/
+	for (i = 0; i < filter->num_of_bssid; i++) {
+		if (util_is_bssid_match(&filter->bssid_list[i],
+		   &db_entry->bssid)) {
+			match = true;
+			break;
+		}
+		/* TODO match p2p mac */
+	}
+	if (!match && filter->num_of_bssid)
+		return false;
+
+	match = false;
+	for (i = 0; i < filter->num_of_channels; i++) {
+		if (!filter->channel_list[i] || (
+		   (filter->channel_list[i] ==
+		   db_entry->channel.chan_idx))) {
+			match = true;
+			break;
+		}
+	}
+
+	if (!match && filter->num_of_channels)
+		return false;
+
+	if (filter->rrm_measurement_filter)
+		return true;
+
+	/* TODO match phyMode */
+
+	if (!filter->ignore_auth_enc_type &&
+	   !scm_is_security_match(filter,
+	   db_entry, security))
+		return false;
+
+	if (!util_is_bss_type_match(filter->bss_type,
+	   db_entry->cap_info))
+		return false;
+
+	/* TODO match rate set */
+
+	if (filter->only_wmm_ap &&
+	   !db_entry->ie_list.wmeinfo &&
+	   !db_entry->ie_list.wmeparam)
+		return false;
+
+	/* Match realm */
+	if (!scm_is_fils_config_match(filter, db_entry))
+		return false;
+
+	if (!util_country_code_match(filter->country,
+	   db_entry->ie_list.country))
+		return false;
+
+	if (!util_mdie_match(filter->mobility_domain,
+	   (struct rsn_mdie *)db_entry->ie_list.mdie))
+		return false;
+
+	return true;
+}

+ 0 - 4
umac/tdls/core/src/wlan_tdls_ct.c

@@ -257,7 +257,6 @@ void tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
 	uint8_t valid_mac_entries;
 	struct tdls_conn_tracker_mac_table *mac_table;
 
-	tdls_debug("enter ");
 	if (QDF_STATUS_SUCCESS != tdls_get_vdev_objects(vdev, &tdls_vdev_obj,
 						   &tdls_soc_obj))
 		return;
@@ -296,7 +295,6 @@ void tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
 
 rx_cnt_return:
 	qdf_spin_unlock_bh(&tdls_soc_obj->tdls_ct_spinlock);
-	tdls_debug("exit: rx pkt count %d ", mac_table[mac_cnt].rx_packet_cnt);
 	return;
 }
 
@@ -309,7 +307,6 @@ void tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
 	uint8_t valid_mac_entries;
 	struct tdls_conn_tracker_mac_table *mac_table;
 
-	tdls_debug("enter ");
 	if (QDF_STATUS_SUCCESS != tdls_get_vdev_objects(vdev, &tdls_vdev_obj,
 						   &tdls_soc_obj))
 		return;
@@ -349,7 +346,6 @@ void tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev,
 
 tx_cnt_return:
 	qdf_spin_unlock_bh(&tdls_soc_obj->tdls_ct_spinlock);
-	tdls_debug("exit: tx pkt count %d", mac_table[mac_cnt].tx_packet_cnt);
 	return;
 }
 

+ 2 - 0
utils/host_diag_log/inc/host_diag_core_event.h

@@ -605,6 +605,7 @@ enum wifi_connectivity_events {
  * @WIFI_POWER_EVENT_WAKELOCK_DHCP: DHCP negotiation under way
  * @WIFI_POWER_EVENT_WAKELOCK_CONNECT: connection in progress
  * @WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER: iface change timer running
+ * @WIFI_POWER_EVENT_WAKELOCK_MONITOR_MODE: Montitor mode wakelock
  *
  * Indicates the reason for which the wakelock was taken/released
  */
@@ -630,6 +631,7 @@ enum wake_lock_reason {
 	WIFI_POWER_EVENT_WAKELOCK_DHCP,
 	WIFI_POWER_EVENT_WAKELOCK_CONNECT,
 	WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER,
+	WIFI_POWER_EVENT_WAKELOCK_MONITOR_MODE,
 };
 
 #ifdef __cplusplus

+ 1 - 0
wmi/inc/wmi_unified_param.h

@@ -6129,6 +6129,7 @@ typedef struct {
 	uint32_t gtk_offload_max_vdev;
 	uint32_t num_msdu_desc; /* Number of msdu desc */
 	uint32_t max_frag_entries;
+	uint32_t scheduler_params;
 	/* End common */
 
 	/* Added for Beeliner */

+ 1 - 0
wmi/src/wmi_unified_tlv.c

@@ -12719,6 +12719,7 @@ void wmi_copy_resource_config(wmi_resource_config *resource_cfg,
 	resource_cfg->use_pdev_id = tgt_res_cfg->use_pdev_id;
 	resource_cfg->max_num_dbs_scan_duty_cycle =
 		tgt_res_cfg->max_num_dbs_scan_duty_cycle;
+	resource_cfg->sched_params = tgt_res_cfg->scheduler_params;
 
 	if (tgt_res_cfg->atf_config)
 		WMI_RSRC_CFG_FLAG_ATF_CONFIG_ENABLE_SET(resource_cfg->flag1, 1);