Prechádzať zdrojové kódy

Merge "qcacmn: add null checks in cdp_get_dp_htt_stats"

Linux Build Service Account 7 rokov pred
rodič
commit
8ea70525aa
51 zmenil súbory, kde vykonal 887 pridanie a 300 odobranie
  1. 4 2
      dp/inc/cdp_txrx_cmn_struct.h
  2. 2 1
      dp/inc/cdp_txrx_host_stats.h
  3. 31 1
      dp/inc/cdp_txrx_mon_struct.h
  4. 4 27
      dp/wifi3.0/dp_htt.c
  5. 1 1
      dp/wifi3.0/dp_internal.h
  6. 33 4
      dp/wifi3.0/dp_main.c
  7. 20 15
      dp/wifi3.0/dp_rx.h
  8. 97 0
      dp/wifi3.0/dp_rx_mon.h
  9. 5 0
      dp/wifi3.0/dp_rx_mon_dest.c
  10. 14 0
      dp/wifi3.0/dp_rx_mon_status.c
  11. 2 0
      dp/wifi3.0/dp_types.h
  12. 14 0
      hal/wifi3.0/hal_api_mon.h
  13. 87 0
      init_deinit/dispatcher/src/dispatcher_init_deinit.c
  14. 0 85
      os_if/linux/nan/inc/os_if_nan.h
  15. 13 13
      os_if/linux/nan/src/os_if_nan.c
  16. 137 0
      os_if/linux/qca_vendor.h
  17. 9 2
      os_if/linux/spectral/src/wlan_cfg80211_spectral.c
  18. 1 1
      spectral/core/spectral_common.c
  19. 5 1
      spectral/dispatcher/inc/wlan_spectral_public_structs.h
  20. 77 0
      target_if/cp_stats/src/target_if_mc_cp_stats.c
  21. 15 4
      target_if/spectral/target_if_spectral.c
  22. 1 1
      umac/cmn_services/crypto/inc/wlan_crypto_global_def.h
  23. 3 3
      umac/cmn_services/crypto/src/wlan_crypto_global_api.c
  24. 3 0
      umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h
  25. 13 0
      umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h
  26. 41 2
      umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c
  27. 3 4
      umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c
  28. 2 1
      umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c
  29. 2 2
      umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c
  30. 12 8
      umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c
  31. 3 2
      umac/cmn_services/utils/inc/wlan_utility.h
  32. 3 2
      umac/cmn_services/utils/src/wlan_utility.c
  33. 0 36
      umac/cp_stats/core/src/wlan_cp_stats_da_api.c
  34. 0 50
      umac/cp_stats/core/src/wlan_cp_stats_da_api.h
  35. 0 5
      umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c
  36. 20 0
      umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h
  37. 42 2
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h
  38. 10 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h
  39. 3 0
      umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h
  40. 35 0
      umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c
  41. 19 1
      umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c
  42. 9 20
      umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c
  43. 6 0
      umac/dfs/core/src/misc/dfs_full_offload.c
  44. 1 1
      umac/green_ap/core/src/wlan_green_ap_main.c
  45. 5 3
      umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c
  46. 1 0
      umac/tdls/core/src/wlan_tdls_mgmt.c
  47. 14 0
      wmi/inc/wmi_unified_api.h
  48. 15 0
      wmi/inc/wmi_unified_param.h
  49. 5 0
      wmi/inc/wmi_unified_priv.h
  50. 12 0
      wmi/src/wmi_unified_api.c
  51. 33 0
      wmi/src/wmi_unified_tlv.c

+ 4 - 2
dp/inc/cdp_txrx_cmn_struct.h

@@ -184,6 +184,7 @@ enum htt_cmn_dbg_stats_type {
  * @TXRX_RX_HOST_STATS: Print host Rx stats
  * @TXRX_CLEAR_STATS: clear all host stats
  * @TXRX_SRNG_PTR_STATS: Print SRNG pointer stats
+ * @TXRX_RX_MON_STATS: Print monitor mode stats
 */
 enum cdp_host_txrx_stats {
 	TXRX_HOST_STATS_INVALID  = -1,
@@ -194,6 +195,7 @@ enum cdp_host_txrx_stats {
 	TXRX_RX_HOST_STATS  = 4,
 	TXRX_AST_STATS = 5,
 	TXRX_SRNG_PTR_STATS	= 6,
+	TXRX_RX_MON_STATS   = 7,
 	TXRX_HOST_STATS_MAX,
 };
 
@@ -1179,7 +1181,7 @@ struct cdp_config_params {
  * @param1: opaque argument 1 to be passed to htt
  * @param2: opaque argument 2 to be passed to htt
  * @param3: opaque argument 3 to be passed to htt
- * @channel_param: Channel Information
+ * @mac id: mac_id
  */
 struct cdp_txrx_stats_req {
 	enum cdp_stats	stats;
@@ -1188,7 +1190,7 @@ struct cdp_txrx_stats_req {
 	uint32_t	param2;
 	uint32_t	param3;
 	uint32_t	cookie_val;
-	uint8_t		channel;
+	uint8_t		mac_id;
 };
 
 /**

+ 2 - 1
dp/inc/cdp_txrx_host_stats.h

@@ -405,7 +405,8 @@ 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)
+	if (soc && soc->ops && soc->ops->host_stats_ops &&
+		soc->ops->host_stats_ops->get_htt_stats)
 		return soc->ops->host_stats_ops->get_htt_stats
 			(pdev, data, data_len);
 	return;

+ 31 - 1
dp/inc/cdp_txrx_mon_struct.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 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
@@ -196,4 +196,34 @@ struct cdp_mon_status {
 
 };
 
+enum {
+	CDP_MON_PPDU_START = 0,
+	CDP_MON_PPDU_END,
+};
+
+/**
+ * struct cdp_pdev_mon_stats
+ * @status_ppdu_state: state on PPDU start and end
+ * @status_ppdu_start: status ring PPDU start TLV count
+ * @status_ppdu_end: status ring PPDU end TLV count
+ * @status_ppdu_compl: status ring matching start and end count on PPDU
+ * @status_ppdu_start_mis: status ring missing start TLV count on PPDU
+ * @status_ppdu_end_mis: status ring missing end TLV count on PPDU
+ * @status_ppdu_done: status ring PPDU done TLV count
+ * @dest_ppdu_done: destination ring PPDU count
+ * @dest_mpdu_done: destination ring MPDU count
+ */
+struct cdp_pdev_mon_stats {
+#ifndef REMOVE_MON_DBG_STATS
+	uint32_t status_ppdu_state;
+	uint32_t status_ppdu_start;
+	uint32_t status_ppdu_end;
+	uint32_t status_ppdu_compl;
+	uint32_t status_ppdu_start_mis;
+	uint32_t status_ppdu_end_mis;
+#endif
+	uint32_t status_ppdu_done;
+	uint32_t dest_ppdu_done;
+	uint32_t dest_mpdu_done;
+};
 #endif

+ 4 - 27
dp/wifi3.0/dp_htt.c

@@ -3065,31 +3065,6 @@ htt_soc_detach(void *htt_soc)
 	qdf_mem_free(soc);
 }
 
-/*
- * dp_get_pdev_mask_for_channel_id() - Retrieve pdev_id mask based on channel
- * information
- * @pdev - DP PDEV Handle
- * @channel - frequency
- *
- * Return - Pdev_id mask
- */
-static inline
-uint8_t dp_get_pdev_mask_for_channel_id(struct dp_pdev *pdev, uint8_t channel)
-{
-	uint8_t pdev_mask = 0;
-
-	if (!channel)
-		return 1 << (pdev->pdev_id + 1);
-
-	else if (channel && WLAN_CHAN_IS_5GHZ(channel))
-		pdev_mask = 0;
-
-	else if (channel && WLAN_CHAN_IS_2GHZ(channel))
-		pdev_mask = 1;
-
-	return 1 << (pdev_mask + 1);
-}
-
 /**
  * dp_h2t_ext_stats_msg_send(): function to contruct HTT message to pass to FW
  * @pdev: DP PDEV handle
@@ -3098,6 +3073,7 @@ uint8_t dp_get_pdev_mask_for_channel_id(struct dp_pdev *pdev, uint8_t channel)
  * @config_param_1: extra configuration parameters
  * @config_param_2: extra configuration parameters
  * @config_param_3: extra configuration parameters
+ * @mac_id: mac number
  *
  * return: QDF STATUS
  */
@@ -3105,7 +3081,7 @@ 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, int cookie_val, int cookie_msb,
-		uint8_t channel)
+		uint8_t mac_id)
 {
 	struct htt_soc *soc = pdev->soc->htt_handle;
 	struct dp_htt_htc_pkt *pkt;
@@ -3127,8 +3103,9 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
 	 * Bit 2: Pdev stats for pdev id 1
 	 * Bit 3: Pdev stats for pdev id 2
 	 */
-	pdev_mask = dp_get_pdev_mask_for_channel_id(pdev, channel);
+	mac_id = dp_get_mac_id_for_pdev(mac_id, pdev->pdev_id);
 
+	pdev_mask = 1 << DP_SW2HW_MACID(mac_id);
 	/*
 	 * Set the length of the message.
 	 * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added

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

@@ -399,7 +399,7 @@ 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, int cookie, int cookie_msb,
-		uint8_t channel);
+		uint8_t mac_id);
 void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf);
 void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf);
 void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn),

+ 33 - 4
dp/wifi3.0/dp_main.c

@@ -284,6 +284,7 @@ const int dp_stats_mapping_table[][STATS_TYPE_MAX] = {
 	{TXRX_FW_STATS_INVALID, TXRX_RX_HOST_STATS},
 	{TXRX_FW_STATS_INVALID, TXRX_AST_STATS},
 	{TXRX_FW_STATS_INVALID, TXRX_SRNG_PTR_STATS},
+	{TXRX_FW_STATS_INVALID, TXRX_RX_MON_STATS},
 };
 
 static int dp_peer_add_ast_wifi3(struct cdp_soc_t *soc_hdl,
@@ -5197,6 +5198,31 @@ dp_print_pdev_rx_stats(struct dp_pdev *pdev)
 
 }
 
+/**
+ * dp_print_pdev_rx_mon_stats(): Print Pdev level RX monitor stats
+ * @pdev: DP_PDEV Handle
+ *
+ * Return: void
+ */
+static inline void
+dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev)
+{
+	struct cdp_pdev_mon_stats *rx_mon_stats;
+
+	rx_mon_stats = &pdev->rx_mon_stats;
+
+	DP_PRINT_STATS("PDEV Rx Monitor Stats:\n");
+
+	dp_rx_mon_print_dbg_ppdu_stats(rx_mon_stats);
+
+	DP_PRINT_STATS("status_ppdu_done_cnt = %d",
+		       rx_mon_stats->status_ppdu_done);
+	DP_PRINT_STATS("dest_ppdu_done_cnt = %d",
+		       rx_mon_stats->dest_ppdu_done);
+	DP_PRINT_STATS("dest_mpdu_done_cnt = %d",
+		       rx_mon_stats->dest_mpdu_done);
+}
+
 /**
  * dp_print_soc_tx_stats(): Print SOC level  stats
  * @soc DP_SOC Handle
@@ -5810,8 +5836,11 @@ dp_print_host_stats(struct cdp_vdev *vdev_handle, enum cdp_host_txrx_stats type)
 		dp_print_peer_table(vdev);
 		break;
 	case TXRX_SRNG_PTR_STATS:
-		 dp_print_ring_stats(pdev);
-		 break;
+		dp_print_ring_stats(pdev);
+		break;
+	case TXRX_RX_MON_STATS:
+		dp_print_pdev_rx_mon_stats(pdev);
+		break;
 	default:
 		DP_TRACE(FATAL, "Wrong Input For TxRx Host Stats");
 		break;
@@ -6253,7 +6282,7 @@ static int dp_fw_stats_process(struct cdp_vdev *vdev_handle,
 	struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle;
 	struct dp_pdev *pdev = NULL;
 	uint32_t stats = req->stats;
-	uint8_t channel = req->channel;
+	uint8_t mac_id = req->mac_id;
 
 	if (!vdev) {
 		DP_TRACE(NONE, "VDEV not found");
@@ -6280,7 +6309,7 @@ static int dp_fw_stats_process(struct cdp_vdev *vdev_handle,
 
 	return dp_h2t_ext_stats_msg_send(pdev, stats, req->param0,
 				req->param1, req->param2, req->param3,
-				0, 0, channel);
+				0, 0, mac_id);
 }
 
 /**

+ 20 - 15
dp/wifi3.0/dp_rx.h

@@ -672,22 +672,27 @@ static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev,
 {
 	struct dp_vdev *psta_vdev;
 	struct dp_pdev *pdev = vdev->pdev;
+	struct dp_soc *soc = pdev->soc;
 	uint8_t *data = qdf_nbuf_data(nbuf);
-
-	if (qdf_unlikely(vdev->proxysta_vdev)) {
-		/* In qwrap isolation mode, allow loopback packets as all
-		 * packets go to RootAP and Loopback on the mpsta.
-		 */
-		if (vdev->isolation_vdev)
-			return false;
-		TAILQ_FOREACH(psta_vdev, &pdev->vdev_list, vdev_list_elem) {
-			if (qdf_unlikely(psta_vdev->proxysta_vdev &&
-				!qdf_mem_cmp(psta_vdev->mac_addr.raw,
-				&data[DP_MAC_ADDR_LEN], DP_MAC_ADDR_LEN))) {
-				/* Drop packet if source address is equal to
-				 * any of the vdev addresses.
-				 */
-				return true;
+	uint8_t i;
+
+	for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) {
+		pdev = soc->pdev_list[i];
+		if (qdf_unlikely(vdev->proxysta_vdev)) {
+			/* In qwrap isolation mode, allow loopback packets as all
+			 * packets go to RootAP and Loopback on the mpsta.
+			 */
+			if (vdev->isolation_vdev)
+				return false;
+			TAILQ_FOREACH(psta_vdev, &pdev->vdev_list, vdev_list_elem) {
+				if (qdf_unlikely(psta_vdev->proxysta_vdev &&
+					!qdf_mem_cmp(psta_vdev->mac_addr.raw,
+					&data[DP_MAC_ADDR_LEN], DP_MAC_ADDR_LEN))) {
+					/* Drop packet if source address is equal to
+					 * any of the vdev addresses.
+					 */
+					return true;
+				}
 			}
 		}
 	}

+ 97 - 0
dp/wifi3.0/dp_rx_mon.h

@@ -50,4 +50,101 @@ QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
 
 uint32_t dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id,
 	uint32_t quota);
+
+#ifndef REMOVE_MON_DBG_STATS
+/*
+ * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count
+ * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
+ * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
+ *
+ * Update status ring PPDU start and end count. Keep track TLV state on
+ * PPDU start and end to find out if start and end is matching. Keep
+ * track missing PPDU start and end count. Keep track matching PPDU
+ * start and end count.
+ *
+ * Return: None
+ */
+static inline void
+dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
+				struct cdp_pdev_mon_stats *rx_mon_stats)
+{
+	if (ppdu_info->rx_state ==
+		HAL_RX_MON_PPDU_START) {
+		rx_mon_stats->status_ppdu_start++;
+		if (rx_mon_stats->status_ppdu_state
+			!= CDP_MON_PPDU_END)
+			rx_mon_stats->status_ppdu_end_mis++;
+		rx_mon_stats->status_ppdu_state
+			= CDP_MON_PPDU_START;
+	} else if (ppdu_info->rx_state ==
+		HAL_RX_MON_PPDU_END) {
+		rx_mon_stats->status_ppdu_end++;
+		if (rx_mon_stats->status_ppdu_state
+			!= CDP_MON_PPDU_START)
+			rx_mon_stats->status_ppdu_start_mis++;
+		else
+			rx_mon_stats->status_ppdu_compl++;
+		rx_mon_stats->status_ppdu_state
+			= CDP_MON_PPDU_END;
+	}
+}
+
+/*
+ * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats
+ * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
+ * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
+ *
+ * Return: None
+ */
+static inline void
+dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
+			      struct cdp_pdev_mon_stats *rx_mon_stats)
+{
+	ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
+	rx_mon_stats->status_ppdu_state
+		= CDP_MON_PPDU_END;
+}
+
+/*
+ * dp_rx_mon_dbg_dbg_ppdu_stats() - Print monitor mode status ring stats
+ * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV
+ * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count
+ *
+ * Print monitor mode PPDU start and end TLV count
+ * Return: None
+ */
+static inline void
+dp_rx_mon_print_dbg_ppdu_stats(struct cdp_pdev_mon_stats *rx_mon_stats)
+{
+	DP_PRINT_STATS("status_ppdu_compl_cnt = %d",
+		       rx_mon_stats->status_ppdu_compl);
+	DP_PRINT_STATS("status_ppdu_start_cnt = %d",
+		       rx_mon_stats->status_ppdu_start);
+	DP_PRINT_STATS("status_ppdu_end_cnt = %d",
+		       rx_mon_stats->status_ppdu_end);
+	DP_PRINT_STATS("status_ppdu_start_mis_cnt = %d",
+		       rx_mon_stats->status_ppdu_start_mis);
+	DP_PRINT_STATS("status_ppdu_end_mis_cnt = %d",
+		       rx_mon_stats->status_ppdu_end_mis);
+}
+
+#else
+static inline void
+dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
+				struct cdp_pdev_mon_stats *rx_mon_stats)
+{
+}
+
+static inline void
+dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
+			      struct cdp_pdev_mon_stats *rx_mon_stats)
+{
+}
+
+static inline void
+dp_rx_mon_print_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
+			       struct cdp_pdev_mon_stats *rx_mon_stats)
+{
+}
+#endif
 #endif

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

@@ -742,6 +742,7 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota)
 	uint32_t ppdu_id;
 	uint32_t rx_bufs_used;
 	int mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id);
+	struct cdp_pdev_mon_stats *rx_mon_stats;
 
 	mon_dst_srng = pdev->rxdma_mon_dst_ring[mac_for_pdev].hal_srng;
 
@@ -771,6 +772,7 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota)
 
 	ppdu_id = pdev->ppdu_info.com_info.ppdu_id;
 	rx_bufs_used = 0;
+	rx_mon_stats = &pdev->rx_mon_stats;
 
 	while (qdf_likely(rxdma_dst_ring_desc =
 		hal_srng_dst_peek(hal_soc, mon_dst_srng))) {
@@ -804,6 +806,8 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota)
 			__func__, __LINE__);
 			break;
 		}
+
+		rx_mon_stats->dest_mpdu_done++;
 		dp_rx_mon_deliver(soc, mac_id, head_msdu, tail_msdu);
 
 		rxdma_dst_ring_desc = hal_srng_dst_get_next(hal_soc,
@@ -814,6 +818,7 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota)
 	qdf_spin_unlock_bh(&pdev->mon_lock);
 
 	if (rx_bufs_used) {
+		rx_mon_stats->dest_ppdu_done++;
 		dp_rx_buffers_replenish(soc, mac_id,
 			&pdev->rxdma_mon_buf_ring[mac_for_pdev],
 			&soc->rx_desc_mon[mac_id], rx_bufs_used, &head, &tail);

+ 14 - 0
dp/wifi3.0/dp_rx_mon_status.c

@@ -332,8 +332,10 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id,
 	uint8_t *rx_tlv_start;
 	uint32_t tlv_status = HAL_TLV_STATUS_BUF_DONE;
 	QDF_STATUS m_copy_status = QDF_STATUS_SUCCESS;
+	struct cdp_pdev_mon_stats *rx_mon_stats;
 
 	ppdu_info = &pdev->ppdu_info;
+	rx_mon_stats = &pdev->rx_mon_stats;
 
 	if (pdev->mon_ppdu_status != DP_PPDU_STATUS_START)
 		return;
@@ -356,6 +358,10 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id,
 			do {
 				tlv_status = hal_rx_status_get_tlv_info(rx_tlv,
 						ppdu_info);
+
+				dp_rx_mon_update_dbg_ppdu_stats(ppdu_info,
+								rx_mon_stats);
+
 				rx_tlv = hal_rx_status_get_next_tlv(rx_tlv);
 
 				if ((rx_tlv - rx_tlv_start) >= RX_BUFFER_SIZE)
@@ -374,6 +380,7 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id,
 		}
 
 		if (tlv_status == HAL_TLV_STATUS_PPDU_DONE) {
+			rx_mon_stats->status_ppdu_done++;
 			if (pdev->enhanced_stats_en ||
 					pdev->mcopy_mode)
 				dp_rx_handle_ppdu_stats(soc, pdev, ppdu_info);
@@ -831,8 +838,15 @@ dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int ring_id) {
 
 	pdev->mon_ppdu_status = DP_PPDU_STATUS_START;
 	pdev->ppdu_info.com_info.last_ppdu_id = 0;
+
 	qdf_mem_zero(&(pdev->ppdu_info.rx_status),
 		sizeof(pdev->ppdu_info.rx_status));
 
+	qdf_mem_zero(&pdev->rx_mon_stats,
+		     sizeof(pdev->rx_mon_stats));
+
+	dp_rx_mon_init_dbg_ppdu_stats(&pdev->ppdu_info,
+				      &pdev->rx_mon_stats);
+
 	return QDF_STATUS_SUCCESS;
 }

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

@@ -1102,6 +1102,8 @@ struct dp_pdev {
 	qdf_nbuf_queue_t rx_status_q;
 	uint32_t mon_ppdu_status;
 	struct cdp_mon_status rx_mon_recv_status;
+	/* monitor mode status/destination ring PPDU and MPDU count */
+	struct cdp_pdev_mon_stats rx_mon_stats;
 
 	/* pool addr for mcast enhance buff */
 	struct {

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

@@ -388,6 +388,16 @@ enum {
 	HAL_RX_TYPE_MU_OFDMA_MIMO,
 };
 
+/**
+ * enum
+ * @HAL_RX_MON_PPDU_START: PPDU start TLV is decoded in HAL
+ * @HAL_RX_MON_PPDU_END: PPDU end TLV is decided in HAL
+ */
+enum {
+	HAL_RX_MON_PPDU_START = 0,
+	HAL_RX_MON_PPDU_END,
+};
+
 /**
  * hal_rx_mon_hw_desc_get_mpdu_status: Retrieve MPDU status
  *
@@ -450,6 +460,8 @@ struct hal_rx_ppdu_info {
 	struct hal_rx_ppdu_user_info user_info[HAL_MAX_UL_MU_USERS];
 	struct mon_rx_status rx_status;
 	struct hal_rx_msdu_payload_info msdu_info;
+	/* status ring PPDU start and end state */
+	uint32_t rx_state;
 };
 
 static inline uint32_t
@@ -508,6 +520,7 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info)
 		ppdu_info->com_info.ppdu_timestamp =
 			HAL_RX_GET(rx_tlv, RX_PPDU_START_2,
 				PPDU_START_TIMESTAMP);
+		ppdu_info->rx_state = HAL_RX_MON_PPDU_START;
 		break;
 
 	case WIFIRX_PPDU_START_USER_INFO_E:
@@ -518,6 +531,7 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info)
 			"[%s][%d] ppdu_end_e len=%d",
 				__func__, __LINE__, tlv_len);
 		/* This is followed by sub-TLVs of PPDU_END */
+		ppdu_info->rx_state = HAL_RX_MON_PPDU_END;
 		break;
 
 	case WIFIRXPCU_PPDU_END_INFO_E:

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

@@ -77,6 +77,10 @@
 #include <wlan_green_ap_api.h>
 #endif
 
+#ifdef QCA_SUPPORT_CP_STATS
+#include <wlan_cp_stats_utils_api.h>
+#endif
+
 /**
  * DOC: This file provides various init/deinit trigger point for new
  * components.
@@ -89,6 +93,68 @@
 
 spectral_pdev_open_handler dispatcher_spectral_pdev_open_handler_cb;
 
+#ifdef QCA_SUPPORT_CP_STATS
+static QDF_STATUS dispatcher_init_cp_stats(void)
+{
+	return wlan_cp_stats_init();
+}
+
+static QDF_STATUS dispatcher_deinit_cp_stats(void)
+{
+	return wlan_cp_stats_deinit();
+}
+
+static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_cp_stats_open(psoc);
+}
+
+static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_cp_stats_close(psoc);
+}
+
+static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_cp_stats_enable(psoc);
+}
+
+static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc)
+{
+	return wlan_cp_stats_disable(psoc);
+}
+#else
+static QDF_STATUS dispatcher_init_cp_stats(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS dispatcher_deinit_cp_stats(void)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 #ifdef CONVERGED_P2P_ENABLE
 static QDF_STATUS p2p_init(void)
 {
@@ -835,6 +901,9 @@ QDF_STATUS dispatcher_init(void)
 	if (QDF_STATUS_SUCCESS != dispatcher_policy_mgr_init())
 		goto policy_mgr_init_fail;
 
+	if (QDF_STATUS_SUCCESS != dispatcher_init_cp_stats())
+		goto cp_stats_init_fail;
+
 	if (QDF_STATUS_SUCCESS != dispatcher_init_atf())
 		goto atf_init_fail;
 
@@ -911,6 +980,8 @@ wifi_pos_init_fail:
 sa_api_init_fail:
 	dispatcher_deinit_atf();
 atf_init_fail:
+	dispatcher_deinit_cp_stats();
+cp_stats_init_fail:
 	dispatcher_policy_mgr_deinit();
 policy_mgr_init_fail:
 	dispatcher_deinit_crypto();
@@ -962,6 +1033,8 @@ QDF_STATUS dispatcher_deinit(void)
 
 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_atf());
 
+	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_cp_stats());
+
 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_policy_mgr_deinit());
 
 	QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_crypto());
@@ -1017,6 +1090,9 @@ QDF_STATUS dispatcher_psoc_open(struct wlan_objmgr_psoc *psoc)
 	if (QDF_STATUS_SUCCESS != wlan_serialization_psoc_open(psoc))
 		goto serialization_psoc_open_fail;
 
+	if (QDF_STATUS_SUCCESS != cp_stats_psoc_open(psoc))
+		goto cp_stats_psoc_open_fail;
+
 	if (QDF_STATUS_SUCCESS != atf_psoc_open(psoc))
 		goto atf_psoc_open_fail;
 
@@ -1043,6 +1119,8 @@ regulatory_psoc_open_fail:
 policy_mgr_psoc_open_fail:
 	atf_psoc_close(psoc);
 atf_psoc_open_fail:
+	cp_stats_psoc_close(psoc);
+cp_stats_psoc_open_fail:
 	wlan_serialization_psoc_close(psoc);
 serialization_psoc_open_fail:
 	tdls_psoc_close(psoc);
@@ -1070,6 +1148,8 @@ QDF_STATUS dispatcher_psoc_close(struct wlan_objmgr_psoc *psoc)
 
 	QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_close(psoc));
 
+	QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_close(psoc));
+
 	QDF_BUG(QDF_STATUS_SUCCESS == wlan_serialization_psoc_close(psoc));
 
 	QDF_BUG(QDF_STATUS_SUCCESS == tdls_psoc_close(psoc));
@@ -1101,6 +1181,9 @@ QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	if (QDF_STATUS_SUCCESS != sa_api_psoc_enable(psoc))
 		goto sa_api_psoc_enable_fail;
 
+	if (QDF_STATUS_SUCCESS != cp_stats_psoc_enable(psoc))
+		goto cp_stats_psoc_enable_fail;
+
 	if (QDF_STATUS_SUCCESS != atf_psoc_enable(psoc))
 		goto atf_psoc_enable_fail;
 
@@ -1132,6 +1215,8 @@ nan_psoc_enable_fail:
 wifi_pos_psoc_enable_fail:
 	atf_psoc_disable(psoc);
 atf_psoc_enable_fail:
+	cp_stats_psoc_disable(psoc);
+cp_stats_psoc_enable_fail:
 	sa_api_psoc_disable(psoc);
 sa_api_psoc_enable_fail:
 	dispatcher_policy_mgr_psoc_disable(psoc);
@@ -1161,6 +1246,8 @@ QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc)
 
 	QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_disable(psoc));
 
+	QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_disable(psoc));
+
 	QDF_BUG(QDF_STATUS_SUCCESS == sa_api_psoc_disable(psoc));
 
 	QDF_BUG(QDF_STATUS_SUCCESS ==

+ 0 - 85
os_if/linux/nan/inc/os_if_nan.h

@@ -32,91 +32,6 @@ struct wlan_objmgr_vdev;
 
 #ifdef WLAN_FEATURE_NAN_CONVERGENCE
 
-/**
- * enum qca_wlan_vendor_attr_ndp_params - vendor attribute parameters
- * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: NDP Sub command
- * @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID: Transaction id reference
- * @QCA_WLAN_VENDOR_ATTR_NDP_STATUS_ID: NDP status id
- * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: Service instance id
- * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL: Requested channel
- * @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Peer discovery mac addr
- * @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Iface name
- * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: Security configuration
- * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: Qos configuration
- * @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: Application info
- * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance id
- * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: NDP instance id array
- * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE: Schedule response
- * @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI mac address
- * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE: Driver return status
- * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: Driver return value
- * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG: Channel config request type
- * @QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE: Cipher Suit ID
- * @QCA_WLAN_VENDOR_ATTR_NDP_PMK: Pairwise Master Key
- * @QCA_WLAN_VENDOR_ATTR_NDP_SCID: Security Context ID
- * @QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - pass phrase
- * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - service name
- */
-enum qca_wlan_vendor_attr_ndp_params {
-	QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0,
-	QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD,
-	QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID,
-	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID,
-	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL,
-	QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR,
-	QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR,
-	/* CONFIG_SECURITY is deprecated, use NCS_SK_TYPE/PMK/SCID instead */
-	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY,
-	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS,
-	QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO,
-	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID,
-	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY,
-	QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE,
-	QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR,
-	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE,
-	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
-	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG,
-	QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE,
-	QCA_WLAN_VENDOR_ATTR_NDP_PMK,
-	QCA_WLAN_VENDOR_ATTR_NDP_SCID,
-	QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
-	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
-
-	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST,
-	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX =
-		QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1,
-};
-
-/**
- * enum qca_wlan_vendor_attr_ndp_sub_cmd_value - NDP subcmd value
- * @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: Unused subcmd value
- * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: iface create
- * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: iface delete
- * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: NDP initiator request
- * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: NDP initiator response
- * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: NDP responder request
- * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: NDP responder response
- * @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: NDP end request
- * @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: NDP end response
- * @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: NDP request indication
- * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: NDP confirm indication
- * @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: NDP End indication
- */
-enum qca_wlan_vendor_attr_ndp_sub_cmd_value {
-	QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0,
-	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1,
-	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2,
-	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3,
-	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4,
-	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5,
-	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6,
-	QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7,
-	QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8,
-	QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 9,
-	QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 10,
-	QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 11
-};
-
 /**
  * os_if_nan_process_ndp_cmd: os_if api to handle nan request message
  * @psoc: pointer to psoc object

+ 13 - 13
os_if/linux/nan/src/os_if_nan.c

@@ -59,7 +59,7 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 						.len = sizeof(uint32_t)
 	},
 	[QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR] = {
-						.type = NLA_BINARY,
+						.type = NLA_UNSPEC,
 						.len = QDF_MAC_ADDR_SIZE
 	},
 	[QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY] = {
@@ -67,8 +67,8 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 						.len = sizeof(uint16_t)
 	},
 	[QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS] = {
-						.type = NLA_BINARY,
-						.len = NDP_QOS_INFO_LEN
+						.type = NLA_U32,
+						.len = sizeof(uint32_t)
 	},
 	[QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO] = {
 						.type = NLA_BINARY,
@@ -79,8 +79,8 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 						.len = sizeof(uint32_t)
 	},
 	[QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE] = {
-						.type = NLA_U16,
-						.len = sizeof(uint16_t)
+						.type = NLA_U32,
+						.len = sizeof(uint32_t)
 	},
 	[QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR] = {
 						.type = NLA_BINARY,
@@ -94,7 +94,7 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = {
 						.type = NLA_U32,
 						.len = sizeof(uint32_t)
 	},
-	[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE] = {
+	[QCA_WLAN_VENDOR_ATTR_NDP_CSID] = {
 						.type = NLA_U32,
 						.len = sizeof(uint32_t)
 	},
@@ -252,9 +252,9 @@ static int os_if_nan_parse_security_params(struct nlattr **tb,
 		return -EINVAL;
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]) {
+	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_CSID]) {
 		*ncs_sk_type =
-			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]);
+			nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_CSID]);
 	}
 
 	if (tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) {
@@ -309,7 +309,7 @@ static int os_if_nan_parse_security_params(struct nlattr **tb,
  * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional
- * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_CSID - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional
  *
@@ -441,7 +441,7 @@ initiator_req_failed:
  * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional
- * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional
+ * QCA_WLAN_VENDOR_ATTR_NDP_CSID - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional
  * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional
  *
@@ -866,7 +866,7 @@ static inline uint32_t osif_ndp_get_ndp_req_ind_len(
 	data_len += nla_total_size(vendor_attr_policy[
 			QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS].len);
 	data_len += nla_total_size(vendor_attr_policy[
-			QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE].len);
+			QCA_WLAN_VENDOR_ATTR_NDP_CSID].len);
 	/* allocate space including NULL terminator */
 	data_len += nla_total_size(vendor_attr_policy[
 			QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR].len + 1);
@@ -897,7 +897,7 @@ static inline uint32_t osif_ndp_get_ndp_req_ind_len(
  * QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID (4 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO (ndp_app_info_len size)
  * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS (4 bytes)
- * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE(4 bytes)
+ * QCA_WLAN_VENDOR_ATTR_NDP_CSID(4 bytes)
  * QCA_WLAN_VENDOR_ATTR_NDP_SCID(scid_len in size)
  *
  * Return: none
@@ -997,7 +997,7 @@ static void os_if_ndp_indication_handler(struct wlan_objmgr_vdev *vdev,
 
 	if (event->scid.scid_len) {
 		if (nla_put_u32(vendor_event,
-				QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE,
+				QCA_WLAN_VENDOR_ATTR_NDP_CSID,
 				event->ncs_sk_type))
 			goto ndp_indication_nla_failed;
 

+ 137 - 0
os_if/linux/qca_vendor.h

@@ -3557,6 +3557,123 @@ enum qca_wlan_vendor_attr_rssi_monitoring {
 		QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_AFTER_LAST - 1,
 };
 
+/**
+ * enum qca_wlan_vendor_attr_ndp_params - Used by the vendor command
+ * QCA_NL80211_VENDOR_SUBCMD_NDP.
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: sub commands values in qca_wlan_ndp_sub_cmd
+ * @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID:
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: indicats a service info
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL: channel frequency in MHz
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Interface Discovery MAC
+ * address
+ * @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Interface name on which NDP is being
+ * created
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: CONFIG_SECURITY is deprecated, use
+ * NCS_SK_TYPE/PMK/SCID instead
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: value for QoS
+ * @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: app info
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance Id
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: Array of instance Ids
+ * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE: initiator/responder NDP response
+ * code: accept/reject
+ * @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI MAC address
+ * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE: errors types returned by
+ * driver
+ * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: value error values returned by
+ * driver
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG: Channel setup configuration
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CSID: Cipher Suite Shared Key Type
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PMK: PMK_INFO
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SCID: Security Context Identifier that contains the
+ * PMKID
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE: passphrase
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME: service name
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REASON: bitmap indicating schedule
+ * update:
+ *     BIT_0: NSS Update
+ *     BIT_1: Channel list update
+ * @QCA_WLAN_VENDOR_ATTR_NDP_NSS: nss
+ * @QCA_WLAN_VENDOR_ATTR_NDP_NUM_CHANNELS: NUMBER NDP CHANNEL
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_WIDTH: CHANNEL BANDWIDTH:
+ *     0:20 MHz,
+ *     1:40 MHz,
+ *     2:80 MHz,
+ *     3:160 MHz
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_INFO: Array of channel/band width
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST: id after last valid attribute
+ * @QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX: max value of this enum type
+*/
+enum qca_wlan_vendor_attr_ndp_params {
+	QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD,
+	QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID,
+	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL,
+	QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR,
+	QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR,
+	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY,
+	QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS,
+	QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO,
+	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID,
+	QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY,
+	QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE,
+	QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR,
+	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE,
+	QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG,
+	QCA_WLAN_VENDOR_ATTR_NDP_CSID,
+	QCA_WLAN_VENDOR_ATTR_NDP_PMK,
+	QCA_WLAN_VENDOR_ATTR_NDP_SCID,
+	QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE,
+	QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME,
+	QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REASON,
+	QCA_WLAN_VENDOR_ATTR_NDP_NSS,
+	QCA_WLAN_VENDOR_ATTR_NDP_NUM_CHANNELS,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_WIDTH,
+	QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_INFO,
+
+	/* keep last */
+	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST,
+	QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX =
+		QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1,
+};
+
+/**
+ * enum qca_wlan_ndp_sub_cmd - NDP sub comands types for
+ * QCA_NL80211_VENDOR_SUBCMD_NDP.
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: invalid value
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: create a ndi
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: delete a ndi
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: initiate a ndp session
+ * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: response for above
+ * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: respond to ndp session
+ * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: response for above
+ * @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: initiate a ndp end
+ * @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: response for above
+ * @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: notify the peer about the end request
+ * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: confirm the ndp session is complete
+ * @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: indicate the peer about the end request
+ * being received
+ * @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND: indicate the peer of schedule
+ * update
+ */
+enum qca_wlan_ndp_sub_cmd {
+	QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0,
+	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1,
+	QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2,
+	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3,
+	QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4,
+	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5,
+	QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6,
+	QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7,
+	QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8,
+	QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 9,
+	QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 10,
+	QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 11,
+	QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND = 12
+};
+
 /**
  * qca_wlan_vendor_external_acs_event_chan_info_attr: Represents per channel
  * information. These attributes are sent as part of
@@ -5397,6 +5514,11 @@ enum qca_wlan_vendor_attr_spectral_cap {
 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_SPECTRAL = 3,
 	/* Flag attribute to indicate advanced spectral capability */
 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_ADVANCED_SPECTRAL = 4,
+	/* Spectral hardware generation. u32 attribute.
+	 * It uses values defined in enum
+	 * qca_wlan_vendor_spectral_scan_cap_hw_gen.
+	 */
+	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_HW_GEN = 5,
 
 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_AFTER_LAST,
 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_MAX =
@@ -5473,6 +5595,21 @@ enum qca_wlan_vendor_attr_spectral_scan_request_type {
 	QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_CONFIG,
 };
 
+/**
+ * qca_wlan_vendor_spectral_scan_cap_hw_gen: Attribute values for
+ * QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_HW_GEN to the vendor subcmd
+ * QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_CAP_INFO. This represents the
+ * spectral hardware generation.
+ * @QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_1: generation 1
+ * @QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_2: generation 2
+ * @QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_3: generation 3
+ */
+enum qca_wlan_vendor_spectral_scan_cap_hw_gen {
+	QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_1 = 0,
+	QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_2 = 1,
+	QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_3 = 2,
+};
+
 /**
  * enum qca_wlan_vendor_attr_rropavail_info - Specifies whether Representative
  * RF Operating Parameter (RROP) information is available, and if so, at which

+ 9 - 2
os_if/linux/spectral/src/wlan_cfg80211_spectral.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2018 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
@@ -549,7 +549,7 @@ int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
 
 	wlan_spectral_get_cap(pdev, &spectral_cap);
 
-	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 4 * sizeof(u32) +
+	skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 5 * sizeof(u32) +
 		NLA_HDRLEN + NLMSG_HDRLEN);
 	if (!skb) {
 		qdf_print(" reply skb alloc failed");
@@ -578,7 +578,14 @@ int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy,
 		skb,
 		QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_ADVANCED_SPECTRAL))
 			goto fail;
+
+	if (nla_put_u32(skb,
+			QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_HW_GEN,
+			spectral_cap.hw_gen))
+		goto fail;
+
 	cfg80211_vendor_cmd_reply(skb);
+
 	return 0;
 
 fail:

+ 1 - 1
spectral/core/spectral_common.c

@@ -57,7 +57,7 @@ spectral_get_vdev(struct wlan_objmgr_pdev *pdev)
 
 	qdf_assert_always(pdev);
 
-	vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, 0, WLAN_SPECTRAL_ID);
+	vdev = wlan_objmgr_pdev_get_first_vdev(pdev, WLAN_SPECTRAL_ID);
 
 	if (!vdev) {
 		spectral_warn("Unable to get first vdev of pdev");

+ 5 - 1
spectral/dispatcher/inc/wlan_spectral_public_structs.h

@@ -102,7 +102,9 @@
 #define SPECTRAL_SCAN_ACTIVE_DEFAULT           (0)
 #define SPECTRAL_SCAN_ENABLE_DEFAULT           (0)
 #define SPECTRAL_SCAN_COUNT_DEFAULT            (0)
-#define SPECTRAL_SCAN_PERIOD_DEFAULT           (35)
+#define SPECTRAL_SCAN_PERIOD_GEN_I_DEFAULT     (35)
+#define SPECTRAL_SCAN_PERIOD_GEN_II_DEFAULT    (35)
+#define SPECTRAL_SCAN_PERIOD_GEN_III_DEFAULT   (224)
 #define SPECTRAL_SCAN_PRIORITY_DEFAULT         (1)
 #define SPECTRAL_SCAN_FFT_SIZE_DEFAULT         (7)
 #define SPECTRAL_SCAN_GC_ENA_DEFAULT           (1)
@@ -228,12 +230,14 @@ struct spectral_diag_stats {
  * @radar_cap:           Radar detection capability
  * @spectral_cap:        Spectral capability
  * @advncd_spectral_cap: Advanced spectral capability
+ * @hw_gen: Spectral hw generation
  */
 struct spectral_caps {
 	uint8_t phydiag_cap;
 	uint8_t radar_cap;
 	uint8_t spectral_cap;
 	uint8_t advncd_spectral_cap;
+	uint32_t hw_gen;
 };
 
 /**

+ 77 - 0
target_if/cp_stats/src/target_if_mc_cp_stats.c

@@ -54,6 +54,8 @@ static void target_if_cp_stats_free_stats_event(struct stats_event *ev)
 	ev->pdev_stats = NULL;
 	qdf_mem_free(ev->peer_stats);
 	ev->peer_stats = NULL;
+	qdf_mem_free(ev->cca_stats);
+	ev->cca_stats = NULL;
 }
 
 static QDF_STATUS target_if_cp_stats_extract_pdev_stats(
@@ -130,6 +132,33 @@ static QDF_STATUS target_if_cp_stats_extract_peer_stats(
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS target_if_cp_stats_extract_cca_stats(
+					struct wmi_unified *wmi_hdl,
+					wmi_host_stats_event *stats_param,
+					struct stats_event *ev, uint8_t *data)
+{
+	QDF_STATUS status;
+	struct wmi_host_congestion_stats stats = {0};
+
+	status = wmi_extract_cca_stats(wmi_hdl, data, &stats);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		cp_stats_debug("no congestion stats");
+		return QDF_STATUS_SUCCESS;
+	}
+
+	ev->cca_stats = qdf_mem_malloc(sizeof(*ev->cca_stats));
+	if (!ev->cca_stats) {
+		cp_stats_err("malloc failed");
+		return QDF_STATUS_E_NOMEM;
+	}
+
+
+	ev->cca_stats->vdev_id = stats.vdev_id;
+	ev->cca_stats->congestion = stats.congestion;
+
+	return QDF_STATUS_SUCCESS;
+}
+
 static QDF_STATUS target_if_cp_stats_extract_event(struct wmi_unified *wmi_hdl,
 						   struct stats_event *ev,
 						   uint8_t *data)
@@ -156,6 +185,11 @@ static QDF_STATUS target_if_cp_stats_extract_event(struct wmi_unified *wmi_hdl,
 	if (QDF_IS_STATUS_ERROR(status))
 		return status;
 
+	status = target_if_cp_stats_extract_cca_stats(wmi_hdl, &stats_param,
+						      ev, data);
+	if (QDF_IS_STATUS_ERROR(status))
+		return status;
+
 	return QDF_STATUS_SUCCESS;
 }
 
@@ -216,34 +250,77 @@ static void target_if_cp_stats_inc_wake_lock_stats(uint32_t reason,
 	case WOW_REASON_UNSPECIFIED:
 		(*unspecified_wake_count)++;
 		break;
+
+	case WOW_REASON_ASSOC_REQ_RECV:
+		stats->mgmt_assoc++;
+		break;
+
+	case WOW_REASON_DISASSOC_RECVD:
+		stats->mgmt_disassoc++;
+		break;
+
+	case WOW_REASON_ASSOC_RES_RECV:
+		stats->mgmt_assoc_resp++;
+		break;
+
+	case WOW_REASON_REASSOC_REQ_RECV:
+		stats->mgmt_reassoc++;
+		break;
+
+	case WOW_REASON_REASSOC_RES_RECV:
+		stats->mgmt_reassoc_resp++;
+		break;
+
+	case WOW_REASON_AUTH_REQ_RECV:
+		stats->mgmt_auth++;
+		break;
+
+	case WOW_REASON_DEAUTH_RECVD:
+		stats->mgmt_deauth++;
+		break;
+
+	case WOW_REASON_ACTION_FRAME_RECV:
+		stats->mgmt_action++;
+		break;
+
 	case WOW_REASON_RA_MATCH:
 		stats->ipv6_mcast_wake_up_count++;
 		stats->ipv6_mcast_ra_stats++;
 		stats->icmpv6_count++;
 		break;
+
 	case WOW_REASON_NLOD:
 		stats->pno_match_wake_up_count++;
 		break;
+
 	case WOW_REASON_NLO_SCAN_COMPLETE:
 		stats->pno_complete_wake_up_count++;
 		break;
+
 	case WOW_REASON_LOW_RSSI:
 		stats->low_rssi_wake_up_count++;
 		break;
+
 	case WOW_REASON_EXTSCAN:
 		stats->gscan_wake_up_count++;
 		break;
+
 	case WOW_REASON_RSSI_BREACH_EVENT:
 		stats->rssi_breach_wake_up_count++;
 		break;
+
 	case WOW_REASON_OEM_RESPONSE_EVENT:
 		stats->oem_response_wake_up_count++;
+		break;
+
 	case WOW_REASON_11D_SCAN:
 		stats->scan_11d++;
 		break;
+
 	case WOW_REASON_CHIP_POWER_FAILURE_DETECT:
 		stats->pwr_save_fail_detected++;
 		break;
+
 	default:
 		break;
 	}

+ 15 - 4
target_if/spectral/target_if_spectral.c

@@ -214,7 +214,12 @@ target_if_spectral_info_init_defaults(struct target_if_spectral *spectral)
 	/* Parameters */
 	info->osps_cache.osc_params.ss_count = SPECTRAL_SCAN_COUNT_DEFAULT;
 
-	info->osps_cache.osc_params.ss_period = SPECTRAL_SCAN_PERIOD_DEFAULT;
+	if (spectral->spectral_gen == SPECTRAL_GEN3)
+		info->osps_cache.osc_params.ss_period =
+			SPECTRAL_SCAN_PERIOD_GEN_III_DEFAULT;
+	else
+		info->osps_cache.osc_params.ss_period =
+			SPECTRAL_SCAN_PERIOD_GEN_II_DEFAULT;
 
 	info->osps_cache.osc_params.ss_spectral_pri =
 	    SPECTRAL_SCAN_PRIORITY_DEFAULT;
@@ -1332,6 +1337,7 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral)
 	pcap->radar_cap = 1;
 	pcap->spectral_cap = 1;
 	pcap->advncd_spectral_cap = 1;
+	pcap->hw_gen = spectral->spectral_gen;
 }
 
 #ifdef QCA_SUPPORT_SPECTRAL_SIMULATION
@@ -1797,7 +1803,10 @@ target_if_spectral_init_param_defaults(struct target_if_spectral *spectral)
 	struct spectral_config *params = &spectral->params;
 
 	params->ss_count = SPECTRAL_SCAN_COUNT_DEFAULT;
-	params->ss_period = SPECTRAL_SCAN_PERIOD_DEFAULT;
+	if (spectral->spectral_gen == SPECTRAL_GEN3)
+		params->ss_period = SPECTRAL_SCAN_PERIOD_GEN_III_DEFAULT;
+	else
+		params->ss_period = SPECTRAL_SCAN_PERIOD_GEN_II_DEFAULT;
 	params->ss_spectral_pri = SPECTRAL_SCAN_PRIORITY_DEFAULT;
 	params->ss_fft_size = SPECTRAL_SCAN_FFT_SIZE_DEFAULT;
 	params->ss_gc_ena = SPECTRAL_SCAN_GC_ENA_DEFAULT;
@@ -1983,8 +1992,6 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
 	qdf_spinlock_create(&spectral->noise_pwr_reports_lock);
 	target_if_spectral_clear_stats(spectral);
 
-	/* Set the default values for spectral parameters */
-	target_if_spectral_init_param_defaults(spectral);
 #ifdef CONFIG_WIN
 	if (target_type == TARGET_TYPE_QCA8074) {
 		spectral->fftbin_size_war = 1;
@@ -2012,6 +2019,10 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
 		spectral->tlvhdr_size = sizeof(struct spectral_phyerr_tlv_gen2);
 	}
 
+	/* Set the default values for spectral parameters */
+	target_if_spectral_init_param_defaults(spectral);
+	/* Init spectral capability */
+	target_if_init_spectral_capability(spectral);
 	if (target_if_spectral_attach_simulation(spectral) < 0)
 		return NULL;
 

+ 1 - 1
umac/cmn_services/crypto/inc/wlan_crypto_global_def.h

@@ -264,7 +264,7 @@ struct wlan_crypto_req_key {
 	uint8_t    pad;
 	uint16_t   keyix;
 	uint8_t    keylen;
-	uint8_t    flags;
+	uint16_t    flags;
 	uint8_t    macaddr[QDF_MAC_ADDR_SIZE];
 	uint64_t   keyrsc;
 	uint64_t   keytsc;

+ 3 - 3
umac/cmn_services/crypto/src/wlan_crypto_global_api.c

@@ -360,7 +360,7 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	isbcast = qdf_is_macaddr_broadcast(
+	isbcast = qdf_is_macaddr_group(
 				(struct qdf_mac_addr *)req_key->macaddr);
 	if ((req_key->keylen == 0) && !IS_FILS_CIPHER(req_key->type)) {
 		/* zero length keys, only set default key id if flags are set*/
@@ -1074,7 +1074,7 @@ QDF_STATUS wlan_crypto_encap(struct wlan_objmgr_vdev *vdev,
 	if (peer)
 		wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID);
 
-	if (qdf_is_macaddr_broadcast((struct qdf_mac_addr *)mac_addr)) {
+	if (qdf_is_macaddr_group((struct qdf_mac_addr *)mac_addr)) {
 		crypto_params = wlan_crypto_vdev_get_comp_params(vdev,
 								&crypto_priv);
 		if (crypto_priv == NULL) {
@@ -1179,7 +1179,7 @@ QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev,
 	if (peer)
 		wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID);
 
-	if (qdf_is_macaddr_broadcast((struct qdf_mac_addr *)mac_addr)) {
+	if (qdf_is_macaddr_group((struct qdf_mac_addr *)mac_addr)) {
 		crypto_params = wlan_crypto_vdev_get_comp_params(vdev,
 								&crypto_priv);
 		if (crypto_priv == NULL) {

+ 3 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h

@@ -216,6 +216,7 @@ typedef void (*wlan_objmgr_peer_status_handler)(
  * @WLAN_INIT_DEINIT_ID:        Init deinit module
  * @WLAN_IPA_ID:                IPA operations
  * @WLAN_CP_STATS_ID:           Control Plane Statistics Module
+ * @WLAN_GREEN_AP_ID:           Green AP operations
  * @WLAN_REF_ID_MAX:            Max id used to generate ref count tracking array
  */
  /* New value added to the enum must also be reflected in function
@@ -261,6 +262,7 @@ typedef enum {
 	WLAN_INIT_DEINIT_ID   = 36,
 	WLAN_IPA_ID           = 37,
 	WLAN_CP_STATS_ID      = 38,
+	WLAN_GREEN_AP_ID      = 39,
 	WLAN_REF_ID_MAX,
 } wlan_objmgr_ref_dbgid;
 
@@ -313,6 +315,7 @@ static inline char *string_from_dbgid(wlan_objmgr_ref_dbgid id)
 					"WLAN_INIT_DEINIT_ID",
 					"WLAN_IPA_ID",
 					"WLAN_CP_STATS_ID",
+					"WLAN_GREEN_AP_ID",
 					"WLAN_REF_ID_MAX" };
 
 	return (char *)strings[id];

+ 13 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h

@@ -735,6 +735,19 @@ QDF_STATUS wlan_objmgr_pdev_try_get_ref(struct wlan_objmgr_pdev *pdev,
 void wlan_objmgr_pdev_release_ref(struct wlan_objmgr_pdev *pdev,
 						wlan_objmgr_ref_dbgid id);
 
+/**
+ * wlan_objmgr_pdev_get_first_vdev() - Get first vdev of pdev
+ * @pdev: PDEV object
+ * @dbg_id:   Object Manager ref debug id
+ *
+ * API to get reference to first vdev of pdev.
+ *
+ * Return: reference to first vdev
+ */
+struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev(
+		struct wlan_objmgr_pdev *pdev,
+		wlan_objmgr_ref_dbgid dbg_id);
+
 /**
  * wlan_objmgr_pdev_get_pdev_id() - get pdev id
  * @pdev: PDEV object

+ 41 - 2
umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c

@@ -197,8 +197,8 @@ static QDF_STATUS wlan_objmgr_pdev_obj_destroy(struct wlan_objmgr_pdev *pdev)
 	obj_mgr_info("Physically deleting pdev %d", pdev_id);
 
 	if (pdev->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) {
-		obj_mgr_err("pdev object delete is not invoked: pdev-id:%d",
-			pdev_id);
+		obj_mgr_err("PDEV object delete is not invoked pdevid:%d objstate:%d",
+			    pdev_id, pdev->obj_state);
 		WLAN_OBJMGR_BUG(0);
 	}
 
@@ -886,3 +886,42 @@ void wlan_objmgr_pdev_release_ref(struct wlan_objmgr_pdev *pdev,
 	return;
 }
 qdf_export_symbol(wlan_objmgr_pdev_release_ref);
+
+struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev(
+		struct wlan_objmgr_pdev *pdev,
+		wlan_objmgr_ref_dbgid dbg_id)
+{
+	struct wlan_objmgr_pdev_objmgr *objmgr = &pdev->pdev_objmgr;
+	qdf_list_t *vdev_list = NULL;
+	struct wlan_objmgr_vdev *vdev;
+	qdf_list_node_t *node = NULL;
+	qdf_list_node_t *prev_node = NULL;
+
+	wlan_pdev_obj_lock(pdev);
+
+	/* VDEV list */
+	vdev_list = &objmgr->wlan_vdev_list;
+	if (qdf_list_peek_front(vdev_list, &node) != QDF_STATUS_SUCCESS) {
+		wlan_pdev_obj_unlock(pdev);
+		return NULL;
+	}
+
+	do {
+		vdev = qdf_container_of(node, struct wlan_objmgr_vdev,
+					vdev_node);
+		if (wlan_objmgr_vdev_try_get_ref(vdev, dbg_id) ==
+						QDF_STATUS_SUCCESS) {
+			wlan_pdev_obj_unlock(pdev);
+			return vdev;
+		}
+
+		prev_node = node;
+	} while (qdf_list_peek_next(vdev_list, prev_node, &node) ==
+						QDF_STATUS_SUCCESS);
+
+	wlan_pdev_obj_unlock(pdev);
+
+	return NULL;
+}
+
+qdf_export_symbol(wlan_objmgr_pdev_get_first_vdev);

+ 3 - 4
umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c

@@ -280,10 +280,9 @@ static QDF_STATUS wlan_objmgr_peer_obj_destroy(struct wlan_objmgr_peer *peer)
 		      QDF_MAC_ADDR_ARRAY(macaddr));
 
 	if (peer->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) {
-		obj_mgr_err(
-		"peer(%02x:%02x:%02x:%02x:%02x:%02x) object del is not invoked",
-			macaddr[0], macaddr[1], macaddr[2],
-			macaddr[3], macaddr[4], macaddr[5]);
+		obj_mgr_err("PEER object del is not invoked obj_state:%d peer "
+			    QDF_MAC_ADDR_STR, peer->obj_state,
+			    QDF_MAC_ADDR_ARRAY(macaddr));
 		WLAN_OBJMGR_BUG(0);
 	}
 

+ 2 - 1
umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c

@@ -203,7 +203,8 @@ static QDF_STATUS wlan_objmgr_psoc_obj_destroy(struct wlan_objmgr_psoc *psoc)
 	obj_mgr_info("Physically deleting psoc %d", psoc->soc_objmgr.psoc_id);
 
 	if (psoc->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) {
-		obj_mgr_err("psoc object delete is not invoked");
+		obj_mgr_err("PSOC object delete is not invoked obj_state:%d",
+			    psoc->obj_state);
 		WLAN_OBJMGR_BUG(0);
 	}
 

+ 2 - 2
umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

@@ -283,8 +283,8 @@ static QDF_STATUS wlan_objmgr_vdev_obj_destroy(struct wlan_objmgr_vdev *vdev)
 	obj_mgr_info("Physically deleting vdev %d", vdev_id);
 
 	if (vdev->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) {
-		obj_mgr_err("vdev object delete is not invoked: vdev-id:%d",
-			wlan_vdev_get_id(vdev));
+		obj_mgr_err("VDEV object delete is not invoked vdevid:%d objstate:%d",
+			    wlan_vdev_get_id(vdev), vdev->obj_state);
 		WLAN_OBJMGR_BUG(0);
 	}
 

+ 12 - 8
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -947,7 +947,9 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
 {
 	struct policy_mgr_psoc_priv_obj *pm_ctx;
 	uint32_t mcc_to_scc_switch;
-	uint8_t operating_channel, vdev_id;
+	uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0};
+	uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0};
+	uint32_t cc_count = 0;
 
 	pm_ctx = policy_mgr_get_context(psoc);
 	if (!pm_ctx) {
@@ -955,11 +957,13 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
 		return;
 	}
 
-	if (policy_mgr_get_mode_specific_conn_info(psoc, &operating_channel,
-						&vdev_id, PM_STA_MODE)) {
-		policy_mgr_debug("STA operating Channel: %u",
-				operating_channel);
-	} else {
+	/*
+	 * force SCC with STA+STA+SAP will need some additional logic
+	 */
+	cc_count = policy_mgr_get_mode_specific_conn_info(psoc,
+					&operating_channel[cc_count],
+					&vdev_id[cc_count], PM_STA_MODE);
+	if (!cc_count) {
 		policy_mgr_err("Could not get STA operating channel&vdevid");
 		return;
 	}
@@ -967,7 +971,7 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
 	mcc_to_scc_switch =
 		policy_mgr_mcc_to_scc_switch_mode_in_user_cfg(psoc);
 	policy_mgr_info("MCC to SCC switch: %d chan: %d",
-			mcc_to_scc_switch, operating_channel);
+			mcc_to_scc_switch, operating_channel[0]);
 
 	if (!policy_mgr_is_restart_sap_allowed(psoc, mcc_to_scc_switch)) {
 		policy_mgr_debug(
@@ -976,7 +980,7 @@ void policy_mgr_check_concurrent_intf_and_restart_sap(
 	}
 
 	if ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) &&
-		policy_mgr_valid_sta_channel_check(psoc, operating_channel)
+		policy_mgr_valid_sta_channel_check(psoc, operating_channel[0])
 		&& !pm_ctx->sta_ap_intf_check_work_info) {
 		struct sta_ap_intf_check_work_ctx *work_info;
 		work_info = qdf_mem_malloc(

+ 3 - 2
umac/cmn_services/utils/inc/wlan_utility.h

@@ -177,9 +177,10 @@ uint8_t *wlan_util_vdev_get_if_name(struct wlan_objmgr_vdev *vdev);
 /*
  * wlan_util_is_vap_active() - Check for vap active
  * @pdev: pdev pointer
+ * @dbg_id: debug id for ref counting
  *
  * @Return: QDF_STATUS_SUCCESS in case of vap active
  */
-QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev);
-
+QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev,
+				   wlan_objmgr_ref_dbgid dbg_id);
 #endif /* _WLAN_UTILITY_H_ */

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

@@ -281,7 +281,8 @@ static void wlan_vap_active(struct wlan_objmgr_pdev *pdev,
 	wlan_vdev_obj_unlock(vdev);
 }
 
-QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev)
+QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev,
+				   wlan_objmgr_ref_dbgid dbg_id)
 {
 	uint8_t flag = 0;
 
@@ -291,7 +292,7 @@ QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev)
 	wlan_objmgr_pdev_iterate_obj_list(pdev,
 				WLAN_VDEV_OP,
 				wlan_vap_active,
-				&flag, 0, WLAN_OBJMGR_ID);
+				&flag, 0, dbg_id);
 
 	if (flag == 1)
 		return QDF_STATUS_SUCCESS;

+ 0 - 36
umac/cp_stats/core/src/wlan_cp_stats_da_api.c

@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2018 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: wlan_cp_stats_da_api.c
- *
- * This file provide definitions for cp stats global context initialization
- * specific to DA
- */
-#include "wlan_cp_stats_defs.h"
-#include "wlan_cp_stats_da_api.h"
-
-QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc)
-{
-	return QDF_STATUS_SUCCESS;
-}
-
-QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *ac)
-{
-	return QDF_STATUS_SUCCESS;
-}

+ 0 - 50
umac/cp_stats/core/src/wlan_cp_stats_da_api.h

@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2018 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: wlan_cp_stats_da_api.h
- *
- * This header file provide declarations for cp stats global context object
- * initialization specific to DA
- */
-#ifndef __WLAN_CP_STATS_DA_API_H__
-#define __WLAN_CP_STATS_DA_API_H__
-
-#ifdef QCA_SUPPORT_CP_STATS
-#include <wlan_objmgr_cmn.h>
-#include "wlan_cp_stats_defs.h"
-#include "wlan_cp_stats_da_api.h"
-
-/**
- * wlan_cp_stats_ctx_init_da() - initialize cp stats global context
- * @pdev: Pointer to cp stats global context object
- *
- * Return: QDF_STATUS - Success or Failure
- */
-QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc);
-
-/**
- * wlan_cp_stats_ctx_deinit_da() - deinitialize cp stats global context
- * @pdev: Pointer to cp stats global context object
- *
- * Return: QDF_STATUS - Success or Failure
- */
-QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *csc);
-
-#endif /* QCA_SUPPORT_CP_STATS */
-#endif /* __WLAN_CP_STATS_DA_API_H__ */

+ 0 - 5
umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c

@@ -26,13 +26,8 @@
  */
 #include "wlan_cp_stats_obj_mgr_handler.h"
 #include "wlan_cp_stats_defs.h"
-#include "wlan_cp_stats_da_api.h"
 #include "wlan_cp_stats_ol_api.h"
-
 #include "wlan_cp_stats_defs.h"
-#include "wlan_cp_stats_ic_ucfg_handler.h"
-
-#include <wlan_cp_stats_ucfg_api.h>
 #include "wlan_cp_stats_utils_api.h"
 
 QDF_STATUS

+ 20 - 0
umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h

@@ -34,6 +34,12 @@
 #include <wlan_objmgr_vdev_obj.h>
 #include <wlan_objmgr_peer_obj.h>
 
+#ifdef QCA_SUPPORT_CP_STATS_DA
+#include "wlan_cp_stats_da_api.h"
+#else
+#include "wlan_cp_stats_defs.h"
+#endif
+
 /**
  * wlan_cp_stats_psoc_obj_create_handler() - psoc create notification handler
  * callback function
@@ -122,5 +128,19 @@ QDF_STATUS wlan_cp_stats_peer_obj_create_handler(
 QDF_STATUS wlan_cp_stats_peer_obj_destroy_handler(
 		struct wlan_objmgr_peer *peer, void *data);
 
+#ifndef QCA_SUPPORT_CP_STATS_DA
+static inline
+QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *csc)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ */

+ 42 - 2
umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h

@@ -73,6 +73,14 @@ enum stats_req_type {
  * @oem_response_wake_up_count: oem response wakeup count
  * @pwr_save_fail_detected:     pwr save fail detected wakeup count
  * @scan_11d                    11d scan wakeup count
+ * @mgmt_assoc: association request management frame
+ * @mgmt_disassoc: disassociation management frame
+ * @mgmt_assoc_resp: association response management frame
+ * @mgmt_reassoc: reassociate request management frame
+ * @mgmt_reassoc_resp: reassociate response management frame
+ * @mgmt_auth: authentication managament frame
+ * @mgmt_deauth: deauthentication management frame
+ * @mgmt_action: action managament frame
  */
 struct wake_lock_stats {
 	uint32_t ucast_wake_up_count;
@@ -92,6 +100,14 @@ struct wake_lock_stats {
 	uint32_t oem_response_wake_up_count;
 	uint32_t pwr_save_fail_detected;
 	uint32_t scan_11d;
+	uint32_t mgmt_assoc;
+	uint32_t mgmt_disassoc;
+	uint32_t mgmt_assoc_resp;
+	uint32_t mgmt_reassoc;
+	uint32_t mgmt_reassoc_resp;
+	uint32_t mgmt_auth;
+	uint32_t mgmt_deauth;
+	uint32_t mgmt_action;
 };
 
 struct stats_event;
@@ -125,6 +141,16 @@ struct pending_stats_requests {
 	struct request_info req[TYPE_MAX];
 };
 
+/**
+ * struct cca_stats - cca stats
+ * @congestion: the congestion percentage = (busy_time/total_time)*100
+ *    for the interval from when the vdev was started to the current time
+ *    (or the time at which the vdev was stopped).
+ */
+struct cca_stats {
+	uint32_t congestion;
+};
+
 /**
  * struct psoc_mc_cp_stats: psoc specific stats
  * @pending: details of pending requests
@@ -144,11 +170,13 @@ struct pdev_mc_cp_stats {
 };
 
 /**
- * struct vdev_mc_cp_stats -    vdev specific stats
- * @wow_stats:                  wake_lock stats for vdev
+ * struct vdev_mc_cp_stats - vdev specific stats
+ * @wow_stats: wake_lock stats for vdev
+ * @cca: cca stats
  */
 struct vdev_mc_cp_stats {
 	struct wake_lock_stats wow_stats;
+	struct cca_stats cca;
 };
 
 /**
@@ -165,18 +193,30 @@ struct peer_mc_cp_stats {
 	uint8_t peer_macaddr[WLAN_MACADDR_LEN];
 };
 
+/**
+ * struct congestion_stats_event: congestion stats event param
+ * @vdev_id: vdev_id of the event
+ * @congestion: the congestion percentage
+ */
+struct congestion_stats_event {
+	uint8_t vdev_id;
+	uint32_t congestion;
+};
+
 /**
  * struct stats_event - parameters populated by stats event
  * @num_pdev_stats: num pdev stats
  * @pdev_stats: if populated array indicating pdev stats (index = pdev_id)
  * @num_peer_stats: num peer stats
  * @peer_stats: if populated array indicating peer stats
+ * @cca_stats: if populated indicates congestion stats
  */
 struct stats_event {
 	uint32_t num_pdev_stats;
 	struct pdev_mc_cp_stats *pdev_stats;
 	uint32_t num_peer_stats;
 	struct peer_mc_cp_stats *peer_stats;
+	struct congestion_stats_event *cca_stats;
 };
 
 #endif /* CONFIG_MCL */

+ 10 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h

@@ -185,5 +185,15 @@ QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc,
  */
 void ucfg_mc_cp_stats_free_stats_resources(struct stats_event *ev);
 
+/**
+ * ucfg_mc_cp_stats_cca_stats_get() - API to fetch cca stats
+ * @vdev: pointer to vdev object
+ * @cca_stats: pointer to cca info
+ *
+ * Return - status of operation
+ */
+QDF_STATUS ucfg_mc_cp_stats_cca_stats_get(struct wlan_objmgr_vdev *vdev,
+					  struct cca_stats *cca_stats);
+
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */

+ 3 - 0
umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h

@@ -26,6 +26,9 @@
 #define __WLAN_CP_STATS_UCFG_API_H__
 
 #ifdef QCA_SUPPORT_CP_STATS
+#include <wlan_cp_stats_utils_api.h>
+#include "../../core/src/wlan_cp_stats_defs.h"
+#include "../../core/src/wlan_cp_stats_cmn_api_i.h"
 
 #endif /* QCA_SUPPORT_CP_STATS */
 #endif /* __WLAN_CP_STATS_UCFG_API_H__ */

+ 35 - 0
umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c

@@ -325,6 +325,39 @@ static void tgt_mc_cp_stats_extract_peer_stats(struct wlan_objmgr_psoc *psoc,
 	ucfg_mc_cp_stats_reset_pending_req(psoc, TYPE_PEER_STATS);
 }
 
+static void tgt_mc_cp_stats_extract_cca_stats(struct wlan_objmgr_psoc *psoc,
+						  struct stats_event *ev)
+{
+	struct wlan_objmgr_vdev *vdev;
+	struct vdev_mc_cp_stats *vdev_mc_stats;
+	struct vdev_cp_stats *vdev_cp_stats_priv;
+
+	if (!ev->cca_stats)
+		return;
+
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc,
+						    ev->cca_stats->vdev_id,
+						    WLAN_CP_STATS_ID);
+	if (!vdev) {
+		cp_stats_err("vdev is null");
+		return;
+	}
+
+	vdev_cp_stats_priv = wlan_cp_stats_get_vdev_stats_obj(vdev);
+	if (!vdev_cp_stats_priv) {
+		cp_stats_err("vdev cp stats object is null");
+		goto end;
+	}
+
+	wlan_cp_stats_vdev_obj_lock(vdev_cp_stats_priv);
+	vdev_mc_stats = vdev_cp_stats_priv->vdev_stats;
+	vdev_mc_stats->cca.congestion =  ev->cca_stats->congestion;
+	wlan_cp_stats_vdev_obj_unlock(vdev_cp_stats_priv);
+
+end:
+	wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
+}
+
 QDF_STATUS tgt_mc_cp_stats_process_stats_event(struct wlan_objmgr_psoc *psoc,
 					       struct stats_event *ev)
 {
@@ -334,6 +367,8 @@ QDF_STATUS tgt_mc_cp_stats_process_stats_event(struct wlan_objmgr_psoc *psoc,
 	if (ucfg_mc_cp_stats_is_req_pending(psoc, TYPE_PEER_STATS))
 		tgt_mc_cp_stats_extract_peer_stats(psoc, ev, false);
 
+	tgt_mc_cp_stats_extract_cca_stats(psoc, ev);
+
 	return QDF_STATUS_SUCCESS;
 }
 

+ 19 - 1
umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c

@@ -532,10 +532,28 @@ QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS ucfg_mc_cp_stats_cca_stats_get(struct wlan_objmgr_vdev *vdev,
+					  struct cca_stats *cca_stats)
+{
+	struct vdev_cp_stats *vdev_cp_stats_priv;
+	struct vdev_mc_cp_stats *vdev_mc_stats;
+
+	vdev_cp_stats_priv = wlan_cp_stats_get_vdev_stats_obj(vdev);
+	if (!vdev_cp_stats_priv) {
+		cp_stats_err("vdev cp stats object is null");
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
+	wlan_cp_stats_vdev_obj_lock(vdev_cp_stats_priv);
+	vdev_mc_stats = vdev_cp_stats_priv->vdev_stats;
+	cca_stats->congestion = vdev_mc_stats->cca.congestion;
+	wlan_cp_stats_vdev_obj_unlock(vdev_cp_stats_priv);
+	return QDF_STATUS_SUCCESS;
+}
+
 void ucfg_mc_cp_stats_free_stats_resources(struct stats_event *ev)
 {
 	qdf_mem_free(ev->pdev_stats);
 	qdf_mem_free(ev->peer_stats);
 	qdf_mem_zero(ev, sizeof(*ev));
 }
-

+ 9 - 20
umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c

@@ -233,7 +233,6 @@ QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc)
 
 QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc)
 {
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	struct cp_stats_context *csc;
 
 	if (!psoc) {
@@ -242,16 +241,12 @@ QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc)
 	}
 	csc =
 	wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS);
-	if (!csc) {
-		cp_stats_err("cp_stats_context is null!");
-		return QDF_STATUS_E_FAILURE;
+	if (csc && csc->cp_stats_close) {
+		csc->cp_stats_close(psoc);
+		qdf_spinlock_destroy(&csc->csc_lock);
 	}
 
-	if (csc->cp_stats_close)
-		status = csc->cp_stats_close(psoc);
-
-	qdf_spinlock_destroy(&csc->csc_lock);
-	return status;
+	return QDF_STATUS_SUCCESS;
 }
 
 /* WMI registrations stage */
@@ -261,13 +256,13 @@ QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc)
 	struct cp_stats_context *csc;
 
 	if (!psoc) {
-		cp_stats_err("PSOC is null!\n");
+		cp_stats_err("PSOC is null!");
 		return QDF_STATUS_E_INVAL;
 	}
 	csc =
 	wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS);
 	if (!csc) {
-		cp_stats_err("cp_stats_context is null!\n");
+		cp_stats_err("cp_stats_context is null!");
 		return QDF_STATUS_E_FAILURE;
 	}
 
@@ -279,7 +274,6 @@ QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc)
 
 QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc)
 {
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
 	struct cp_stats_context *csc;
 
 	if (!psoc) {
@@ -288,15 +282,10 @@ QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc)
 	}
 	csc =
 	wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS);
-	if (!csc) {
-		cp_stats_err("cp_stats_context is null!\n");
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	if (csc->cp_stats_disable)
-		status = csc->cp_stats_disable(psoc);
+	if (csc && csc->cp_stats_disable)
+		csc->cp_stats_disable(psoc);
 
-	return status;
+	return QDF_STATUS_SUCCESS;
 }
 
 QDF_STATUS

+ 6 - 0
umac/dfs/core/src/misc/dfs_full_offload.c

@@ -35,6 +35,12 @@ int dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs,
 	 * More parameters are to be added later indicating
 	 * seg id, chirp and sidx values to be sent to fw.
 	 */
+	if (!(WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(dfs->dfs_curchan))) {
+		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
+			"Ignore bangradar on a NON-DFS channel");
+		return -EINVAL;
+	}
+
 	dfs_unit_test->num_args = DFS_UNIT_TEST_NUM_ARGS;
 	dfs_unit_test->args[IDX_CMD_ID] =
 			DFS_PHYERR_OFFLOAD_TEST_SET_RADAR;

+ 1 - 1
umac/green_ap/core/src/wlan_green_ap_main.c

@@ -56,7 +56,7 @@ static QDF_STATUS wlan_green_ap_ant_ps_reset
 	 * Add protection against green AP enabling interrupts
 	 * when not valid or no VAPs exist
 	 */
-	if (wlan_util_is_vap_active(pdev) == QDF_STATUS_SUCCESS)
+	if (wlan_util_is_vap_active(pdev, WLAN_GREEN_AP_ID) == QDF_STATUS_SUCCESS)
 		green_ap_tx_ops->reset_dev(pdev);
 	else
 		green_ap_err("Green AP tried to enable IRQs when invalid");

+ 5 - 3
umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c

@@ -216,11 +216,12 @@ QDF_STATUS ucfg_green_ap_config(struct wlan_objmgr_pdev *pdev, uint8_t val)
 	}
 
 	if (val) {
-	struct wlan_pdev_green_ap_ctx *green_ap_ctx;
+		struct wlan_pdev_green_ap_ctx *green_ap_ctx;
+
 		wlan_objmgr_pdev_iterate_obj_list(pdev,
 					WLAN_VDEV_OP,
 					wlan_green_ap_check_mode,
-					&flag, 0, WLAN_OBJMGR_ID);
+					&flag, 0, WLAN_GREEN_AP_ID);
 		if (flag == 1) {
 			green_ap_err("Radio not in AP mode."
 					"Feature not supported");
@@ -237,7 +238,8 @@ QDF_STATUS ucfg_green_ap_config(struct wlan_objmgr_pdev *pdev, uint8_t val)
 
 		ucfg_green_ap_set_ps_config(pdev, val);
 
-		if (wlan_util_is_vap_active(pdev) == QDF_STATUS_SUCCESS)
+		if (wlan_util_is_vap_active(pdev, WLAN_GREEN_AP_ID) ==
+					    QDF_STATUS_SUCCESS)
 			wlan_green_ap_start(pdev);
 	} else {
 		wlan_green_ap_stop(pdev);

+ 1 - 0
umac/tdls/core/src/wlan_tdls_mgmt.c

@@ -417,6 +417,7 @@ QDF_STATUS tdls_process_mgmt_req(
 	case WLAN_SER_CMD_DENIED_UNSPECIFIED:
 		/* free the request */
 		qdf_mem_free(tdls_mgmt_req);
+		break;
 
 	default:
 		QDF_ASSERT(0);

+ 14 - 0
wmi/inc/wmi_unified_api.h

@@ -2252,4 +2252,18 @@ QDF_STATUS wmi_unified_invoke_neighbor_report_cmd(void *wmi_hdl,
 wmi_host_channel_width wmi_get_ch_width_from_phy_mode(void *wmi_hdl,
 					WMI_HOST_WLAN_PHY_MODE phymode);
 
+#ifdef QCA_SUPPORT_CP_STATS
+/**
+ * wmi_extract_cca_stats() - api to extract congestion stats from event buffer
+ * @wmi_handle: wma handle
+ * @evt_buf: event buffer
+ * @datalen: length of buffer
+ * @stats: buffer to populated after stats extraction
+ *
+ * Return: status of operation
+ */
+QDF_STATUS wmi_extract_cca_stats(wmi_unified_t wmi_handle, void *evt_buf,
+				 struct wmi_host_congestion_stats *stats);
+#endif /* QCA_SUPPORT_CP_STATS */
+
 #endif /* _WMI_UNIFIED_API_H_ */

+ 15 - 0
wmi/inc/wmi_unified_param.h

@@ -8391,4 +8391,19 @@ struct wmi_obss_color_collision_info {
 	uint32_t obss_color_bitmap_bit0to31;
 	uint32_t obss_color_bitmap_bit32to63;
 };
+
+#ifdef QCA_SUPPORT_CP_STATS
+/**
+ * struct wmi_host_congestion_stats - host definition of congestion stats
+ * @vdev_id: ID of the vdev to which this info belongs.
+ * @congestion: This field holds the congestion percentage =
+ *                                             (busy_time/total_time)*100
+ * for the interval from when the vdev was started to the current time
+ * (or the time at which the vdev was stopped).
+ */
+struct wmi_host_congestion_stats {
+	uint32_t vdev_id;
+	uint32_t congestion;
+};
+#endif
 #endif /* _WMI_UNIFIED_PARAM_H_ */

+ 5 - 0
wmi/inc/wmi_unified_priv.h

@@ -1616,6 +1616,11 @@ QDF_STATUS (*extract_twt_resume_dialog_comp_event)(wmi_unified_t wmi_handle,
 		uint8_t *evt_buf,
 		struct wmi_twt_resume_dialog_complete_event_param *params);
 #endif
+
+#ifdef QCA_SUPPORT_CP_STATS
+QDF_STATUS (*extract_cca_stats)(wmi_unified_t wmi_handle, void *evt_buf,
+				struct wmi_host_congestion_stats *stats);
+#endif /* QCA_SUPPORT_CP_STATS */
 };
 
 /* Forward declartion for psoc*/

+ 12 - 0
wmi/src/wmi_unified_api.c

@@ -7482,3 +7482,15 @@ wmi_host_channel_width wmi_get_ch_width_from_phy_mode(void *wmi_hdl,
 	else
 		return WMI_HOST_CHAN_WIDTH_20;
 }
+
+#ifdef QCA_SUPPORT_CP_STATS
+QDF_STATUS wmi_extract_cca_stats(wmi_unified_t wmi_handle, void *evt_buf,
+				 struct wmi_host_congestion_stats *stats)
+{
+	if (wmi_handle->ops->extract_cca_stats)
+		return wmi_handle->ops->extract_cca_stats(wmi_handle, evt_buf,
+							  stats);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#endif /* QCA_SUPPORT_CP_STATS */

+ 33 - 0
wmi/src/wmi_unified_tlv.c

@@ -17806,6 +17806,36 @@ static QDF_STATUS extract_ndp_end_ind_tlv(wmi_unified_t wmi_handle,
 }
 #endif
 
+#ifdef QCA_SUPPORT_CP_STATS
+/**
+ * extract_cca_stats_tlv - api to extract congestion stats from event buffer
+ * @wmi_handle: wma handle
+ * @evt_buf: event buffer
+ * @out_buff: buffer to populated after stats extraction
+ *
+ * Return: status of operation
+ */
+static QDF_STATUS extract_cca_stats_tlv(wmi_unified_t wmi_handle,
+		void *evt_buf, struct wmi_host_congestion_stats *out_buff)
+{
+	WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf;
+	wmi_congestion_stats *congestion_stats;
+
+	param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *)evt_buf;
+	congestion_stats = param_buf->congestion_stats;
+	if (!congestion_stats) {
+		WMI_LOGD("%s: no cca stats in event buffer", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	out_buff->vdev_id = congestion_stats->vdev_id;
+	out_buff->congestion = congestion_stats->congestion;
+
+	WMI_LOGD("%s: cca stats event processed", __func__);
+	return QDF_STATUS_SUCCESS;
+}
+#endif /* QCA_SUPPORT_CP_STATS */
+
 /**
  * save_service_bitmap_tlv() - save service bitmap
  * @wmi_handle: wmi handle
@@ -22891,6 +22921,9 @@ struct wmi_ops tlv_ops =  {
 		extract_obss_color_collision_info_tlv,
 	.extract_comb_phyerr = extract_comb_phyerr_tlv,
 	.extract_single_phyerr = extract_single_phyerr_tlv,
+#ifdef QCA_SUPPORT_CP_STATS
+	.extract_cca_stats = extract_cca_stats_tlv,
+#endif
 };
 
 /**