Browse Source

qcacmn: Add fw stats to cdp_pdev_stats

Add htt tx and rx structs from HTT to cdp_pdev_stats.
These Fw tx and rx stats are obtained through HTT events.
athstats application uses cdp_pdev_stats that contains host stats
and fw stats.

Change-Id: Ia063f406bdc6d32a684c4026b8425ecc96faa3db
CRs-Fixed: 2190793
Prathyusha Guduri 7 years ago
parent
commit
43bb056ed0

+ 1 - 0
dp/inc/cdp_txrx_cmn_struct.h

@@ -1125,6 +1125,7 @@ struct cdp_txrx_stats_req {
 	uint32_t	param1;
 	uint32_t	param2;
 	uint32_t	param3;
+	uint32_t	cookie_val;
 };
 
 /**

+ 369 - 1
dp/inc/cdp_txrx_stats_struct.h

@@ -336,7 +336,6 @@ struct cdp_vdev_stats {
 	struct cdp_rx_stats rx;
 };
 
-
 struct cdp_peer_stats {
 	/* CDP Tx Stats */
 	struct cdp_tx_stats tx;
@@ -368,6 +367,372 @@ struct cdp_hist_rx_ind {
 	uint32_t pkts_201_plus;
 };
 
+struct cdp_htt_tlv_hdr {
+	/* BIT [11 :  0]   :- tag
+	 * BIT [23 : 12]   :- length
+	 * BIT [31 : 24]   :- reserved
+	 */
+	uint32_t tag__length;
+};
+
+#define HTT_STATS_SUBTYPE_MAX     16
+
+struct cdp_htt_rx_pdev_fw_stats_tlv {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+
+    /* BIT [ 7 :  0]   :- mac_id
+     * BIT [31 :  8]   :- reserved
+     */
+    uint32_t mac_id__word;
+    /* Num PPDU status processed from HW */
+    uint32_t ppdu_recvd;
+    /* Num MPDU across PPDUs with FCS ok */
+    uint32_t mpdu_cnt_fcs_ok;
+    /* Num MPDU across PPDUs with FCS err */
+    uint32_t mpdu_cnt_fcs_err;
+    /* Num MSDU across PPDUs */
+    uint32_t tcp_msdu_cnt;
+    /* Num MSDU across PPDUs */
+    uint32_t tcp_ack_msdu_cnt;
+    /* Num MSDU across PPDUs */
+    uint32_t udp_msdu_cnt;
+    /* Num MSDU across PPDUs */
+    uint32_t other_msdu_cnt;
+    /* Num MPDU on FW ring indicated */
+    uint32_t fw_ring_mpdu_ind;
+    /* Num MGMT MPDU given to protocol */
+    uint32_t fw_ring_mgmt_subtype[HTT_STATS_SUBTYPE_MAX];
+    /* Num ctrl MPDU given to protocol */
+    uint32_t fw_ring_ctrl_subtype[HTT_STATS_SUBTYPE_MAX];
+    /* Num mcast data packet received */
+    uint32_t fw_ring_mcast_data_msdu;
+    /* Num broadcast data packet received */
+    uint32_t fw_ring_bcast_data_msdu;
+    /* Num unicat data packet received */
+    uint32_t fw_ring_ucast_data_msdu;
+    /* Num null data packet received  */
+    uint32_t fw_ring_null_data_msdu;
+    /* Num MPDU on FW ring dropped */
+    uint32_t fw_ring_mpdu_drop;
+
+    /* Num buf indication to offload */
+    uint32_t ofld_local_data_ind_cnt;
+    /* Num buf recycle from offload */
+    uint32_t ofld_local_data_buf_recycle_cnt;
+    /* Num buf indication to data_rx */
+    uint32_t drx_local_data_ind_cnt;
+    /* Num buf recycle from data_rx */
+    uint32_t drx_local_data_buf_recycle_cnt;
+    /* Num buf indication to protocol */
+    uint32_t local_nondata_ind_cnt;
+    /* Num buf recycle from protocol */
+    uint32_t local_nondata_buf_recycle_cnt;
+
+    /* Num buf fed */
+    uint32_t fw_status_buf_ring_refill_cnt;
+    /* Num ring empty encountered */
+    uint32_t fw_status_buf_ring_empty_cnt;
+    /* Num buf fed  */
+    uint32_t fw_pkt_buf_ring_refill_cnt;
+    /* Num ring empty encountered */
+    uint32_t fw_pkt_buf_ring_empty_cnt;
+    /* Num buf fed  */
+    uint32_t fw_link_buf_ring_refill_cnt;
+    /* Num ring empty encountered  */
+    uint32_t fw_link_buf_ring_empty_cnt;
+
+    /* Num buf fed */
+    uint32_t host_pkt_buf_ring_refill_cnt;
+    /* Num ring empty encountered */
+    uint32_t host_pkt_buf_ring_empty_cnt;
+    /* Num buf fed */
+    uint32_t mon_pkt_buf_ring_refill_cnt;
+    /* Num ring empty encountered */
+    uint32_t mon_pkt_buf_ring_empty_cnt;
+    /* Num buf fed */
+    uint32_t mon_status_buf_ring_refill_cnt;
+    /* Num ring empty encountered */
+    uint32_t mon_status_buf_ring_empty_cnt;
+    /* Num buf fed */
+    uint32_t mon_desc_buf_ring_refill_cnt;
+    /* Num ring empty encountered */
+    uint32_t mon_desc_buf_ring_empty_cnt;
+    /* Num buf fed */
+    uint32_t mon_dest_ring_update_cnt;
+    /* Num ring full encountered */
+    uint32_t mon_dest_ring_full_cnt;
+
+    /* Num rx suspend is attempted */
+    uint32_t rx_suspend_cnt;
+    /* Num rx suspend failed */
+    uint32_t rx_suspend_fail_cnt;
+    /* Num rx resume attempted */
+    uint32_t rx_resume_cnt;
+    /* Num rx resume failed */
+    uint32_t rx_resume_fail_cnt;
+    /* Num rx ring switch */
+    uint32_t rx_ring_switch_cnt;
+    /* Num rx ring restore */
+    uint32_t rx_ring_restore_cnt;
+    /* Num rx flush issued */
+    uint32_t rx_flush_cnt;
+};
+
+/* == TX PDEV STATS == */
+struct cdp_htt_tx_pdev_stats_cmn_tlv {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+
+    /* BIT [ 7 :  0]   :- mac_id
+     * BIT [31 :  8]   :- reserved
+     */
+    uint32_t mac_id__word;
+    /* Num queued to HW */
+    uint32_t hw_queued;
+    /* Num PPDU reaped from HW */
+    uint32_t hw_reaped;
+    /* Num underruns */
+    uint32_t underrun;
+    /* Num HW Paused counter. */
+    uint32_t hw_paused;
+    /* Num HW flush counter. */
+    uint32_t hw_flush;
+    /* Num HW filtered counter. */
+    uint32_t hw_filt;
+    /* Num PPDUs cleaned up in TX abort */
+    uint32_t tx_abort;
+    /* Num MPDUs requed by SW */
+    uint32_t mpdu_requed;
+    /* excessive retries */
+    uint32_t tx_xretry;
+    /* Last used data hw rate code */
+    uint32_t data_rc;
+    /* frames dropped due to excessive sw retries */
+    uint32_t mpdu_dropped_xretry;
+    /* illegal rate phy errors  */
+    uint32_t illgl_rate_phy_err;
+    /* wal pdev continous xretry */
+    uint32_t cont_xretry;
+    /* wal pdev continous xretry */
+    uint32_t tx_timeout;
+    /* wal pdev resets  */
+    uint32_t pdev_resets;
+    /* PhY/BB underrun */
+    uint32_t phy_underrun;
+    /* MPDU is more than txop limit */
+    uint32_t txop_ovf;
+    /* Number of Sequences posted */
+    uint32_t seq_posted;
+    /* Number of Sequences failed queueing */
+    uint32_t seq_failed_queueing;
+    /* Number of Sequences completed */
+    uint32_t seq_completed;
+    /* Number of Sequences restarted */
+    uint32_t seq_restarted;
+    /* Number of MU Sequences posted */
+    uint32_t mu_seq_posted;
+    /* Number of time HW ring is paused between seq switch within ISR */
+    uint32_t seq_switch_hw_paused;
+    /* Number of times seq continuation in DSR */
+    uint32_t next_seq_posted_dsr;
+    /* Number of times seq continuation in ISR */
+    uint32_t seq_posted_isr;
+    /* Number of seq_ctrl cached. */
+    uint32_t seq_ctrl_cached;
+    /* Number of MPDUs successfully transmitted */
+    uint32_t mpdu_count_tqm;
+    /* Number of MSDUs successfully transmitted */
+    uint32_t msdu_count_tqm;
+    /* Number of MPDUs dropped */
+    uint32_t mpdu_removed_tqm;
+    /* Number of MSDUs dropped */
+    uint32_t msdu_removed_tqm;
+    /* Num MPDUs flushed by SW, HWPAUSED, SW TXABORT (Reset,channel change) */
+    uint32_t mpdus_sw_flush;
+    /* Num MPDUs filtered by HW, all filter condition (TTL expired) */
+    uint32_t mpdus_hw_filter;
+    /* Num MPDUs truncated by PDG (TXOP, TBTT, PPDU_duration based on rate, dyn_bw) */
+    uint32_t mpdus_truncated;
+    /* Num MPDUs that was tried but didn't receive ACK or BA */
+    uint32_t mpdus_ack_failed;
+    /* Num MPDUs that was dropped due to expiry (MSDU TTL). */
+    uint32_t mpdus_expired;
+    /* Num MPDUs that was retried within seq_ctrl (MGMT/LEGACY) */
+    uint32_t mpdus_seq_hw_retry;
+    /* Num of TQM acked cmds processed */
+    uint32_t ack_tlv_proc;
+    /* coex_abort_mpdu_cnt valid. */
+    uint32_t coex_abort_mpdu_cnt_valid;
+    /* coex_abort_mpdu_cnt from TX FES stats. */
+    uint32_t coex_abort_mpdu_cnt;
+    /* Number of total PPDUs(DATA, MGMT, excludes selfgen) tried over the air (OTA) */
+    uint32_t num_total_ppdus_tried_ota;
+    /* Number of data PPDUs tried over the air (OTA) */
+    uint32_t num_data_ppdus_tried_ota;
+    /* Num Local control/mgmt frames (MSDUs) queued */
+    uint32_t local_ctrl_mgmt_enqued;
+    /* local_ctrl_mgmt_freed:
+     * Num Local control/mgmt frames (MSDUs) done
+     * It includes all local ctrl/mgmt completions
+     * (acked, no ack, flush, TTL, etc)
+     */
+    uint32_t local_ctrl_mgmt_freed;
+    /* Num Local data frames (MSDUs) queued */
+    uint32_t local_data_enqued;
+    /* local_data_freed:
+     * Num Local data frames (MSDUs) done
+     * It includes all local data completions
+     * (acked, no ack, flush, TTL, etc)
+     */
+    uint32_t local_data_freed;
+};
+
+struct cdp_htt_tx_pdev_stats_urrn_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    uint32_t urrn_stats[1]; /* HTT_TX_PDEV_MAX_URRN_STATS */
+};
+
+/* NOTE: Variable length TLV, use length spec to infer array size */
+struct cdp_htt_tx_pdev_stats_flush_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    uint32_t flush_errs[1]; /* HTT_TX_PDEV_MAX_FLUSH_REASON_STATS */
+};
+
+/* NOTE: Variable length TLV, use length spec to infer array size */
+struct cdp_htt_tx_pdev_stats_sifs_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    uint32_t sifs_status[1]; /* HTT_TX_PDEV_MAX_SIFS_BURST_STATS */
+};
+
+/* NOTE: Variable length TLV, use length spec to infer array size */
+struct cdp_htt_tx_pdev_stats_phy_err_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    uint32_t  phy_errs[1]; /* HTT_TX_PDEV_MAX_PHY_ERR_STATS */
+};
+
+/* == RX PDEV/SOC STATS == */
+/* HTT_STATS_RX_SOC_FW_STATS_TAG */
+struct cdp_htt_rx_soc_fw_stats_tlv {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    /* Num Packets received on REO FW ring */
+    uint32_t fw_reo_ring_data_msdu;
+    /* Num bc/mc packets indicated from fw to host */
+    uint32_t fw_to_host_data_msdu_bcmc;
+    /* Num unicast packets indicated from fw to host */
+    uint32_t fw_to_host_data_msdu_uc;
+    /* Num remote buf recycle from offload  */
+    uint32_t ofld_remote_data_buf_recycle_cnt;
+    /* Num remote free buf given to offload */
+    uint32_t ofld_remote_free_buf_indication_cnt;
+};
+
+struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    /* Num total buf refilled from refill ring */
+    uint32_t refill_ring_num_refill[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
+};
+
+struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    /* Num error MPDU for each RxDMA error type  */
+    uint32_t fw_ring_mpdu_err[1]; /* HTT_RX_STATS_RXDMA_MAX_ERR */
+};
+
+struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    /* Num MPDU dropped  */
+    uint32_t fw_mpdu_drop[1]; /* HTT_RX_STATS_FW_DROP_REASON_MAX */
+};
+
+#define HTT_STATS_PHY_ERR_MAX 43
+
+struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+
+    /* BIT [ 7 :  0]   :- mac_id
+     * BIT [31 :  8]   :- reserved
+     */
+    uint32_t mac_id__word;
+    /* Num of phy err */
+    uint32_t total_phy_err_cnt;
+    /* Counts of different types of phy errs
+     * The mapping of PHY error types to phy_err array elements is HW dependent.
+     * The only currently-supported mapping is shown below:
+     *
+     * 0 phyrx_err_phy_off Reception aborted due to receiving a PHY_OFF TLV
+     * 1 phyrx_err_synth_off
+     * 2 phyrx_err_ofdma_timing
+     * 3 phyrx_err_ofdma_signal_parity
+     * 4 phyrx_err_ofdma_rate_illegal
+     * 5 phyrx_err_ofdma_length_illegal
+     * 6 phyrx_err_ofdma_restart
+     * 7 phyrx_err_ofdma_service
+     * 8 phyrx_err_ppdu_ofdma_power_drop
+     * 9 phyrx_err_cck_blokker
+     * 10 phyrx_err_cck_timing
+     * 11 phyrx_err_cck_header_crc
+     * 12 phyrx_err_cck_rate_illegal
+     * 13 phyrx_err_cck_length_illegal
+     * 14 phyrx_err_cck_restart
+     * 15 phyrx_err_cck_service
+     * 16 phyrx_err_cck_power_drop
+     * 17 phyrx_err_ht_crc_err
+     * 18 phyrx_err_ht_length_illegal
+     * 19 phyrx_err_ht_rate_illegal
+     * 20 phyrx_err_ht_zlf
+     * 21 phyrx_err_false_radar_ext
+     * 22 phyrx_err_green_field
+     * 23 phyrx_err_bw_gt_dyn_bw
+     * 24 phyrx_err_leg_ht_mismatch
+     * 25 phyrx_err_vht_crc_error
+     * 26 phyrx_err_vht_siga_unsupported
+     * 27 phyrx_err_vht_lsig_len_invalid
+     * 28 phyrx_err_vht_ndp_or_zlf
+     * 29 phyrx_err_vht_nsym_lt_zero
+     * 30 phyrx_err_vht_rx_extra_symbol_mismatch
+     * 31 phyrx_err_vht_rx_skip_group_id0
+     * 32 phyrx_err_vht_rx_skip_group_id1to62
+     * 33 phyrx_err_vht_rx_skip_group_id63
+     * 34 phyrx_err_ofdm_ldpc_decoder_disabled
+     * 35 phyrx_err_defer_nap
+     * 36 phyrx_err_fdomain_timeout
+     * 37 phyrx_err_lsig_rel_check
+     * 38 phyrx_err_bt_collision
+     * 39 phyrx_err_unsupported_mu_feedback
+     * 40 phyrx_err_ppdu_tx_interrupt_rx
+     * 41 phyrx_err_unsupported_cbf
+     * 42 phyrx_err_other
+     */
+    uint32_t phy_err[HTT_STATS_PHY_ERR_MAX];
+};
+
+struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v {
+    struct cdp_htt_tlv_hdr tlv_hdr;
+    /* Num ring empty encountered */
+    uint32_t refill_ring_empty_cnt[1]; /* HTT_RX_STATS_REFILL_MAX_RING */
+};
+
+struct cdp_htt_tx_pdev_stats {
+    struct cdp_htt_tx_pdev_stats_cmn_tlv cmn_tlv;
+    struct cdp_htt_tx_pdev_stats_urrn_tlv_v underrun_tlv;
+    struct cdp_htt_tx_pdev_stats_sifs_tlv_v sifs_tlv;
+    struct cdp_htt_tx_pdev_stats_flush_tlv_v flush_tlv;
+    struct cdp_htt_tx_pdev_stats_phy_err_tlv_v phy_err_tlv;
+};
+
+struct cdp_htt_rx_soc_stats_t {
+    struct cdp_htt_rx_soc_fw_stats_tlv fw_tlv;
+    struct cdp_htt_rx_soc_fw_refill_ring_empty_tlv_v fw_refill_ring_empty_tlv;
+    struct cdp_htt_rx_soc_fw_refill_ring_num_refill_tlv_v fw_refill_ring_num_refill_tlv;
+};
+
+struct cdp_htt_rx_pdev_stats {
+    struct cdp_htt_rx_soc_stats_t soc_stats;
+    struct cdp_htt_rx_pdev_fw_stats_tlv fw_stats_tlv;
+    struct cdp_htt_rx_pdev_fw_ring_mpdu_err_tlv_v fw_ring_mpdu_err_tlv;
+    struct cdp_htt_rx_pdev_fw_mpdu_drop_tlv_v fw_ring_mpdu_drop;
+    struct cdp_htt_rx_pdev_fw_stats_phy_err_tlv fw_stats_phy_err_tlv;
+};
+
 struct cdp_pdev_stats {
 	/* packets dropped on rx */
 	struct {
@@ -418,6 +783,9 @@ struct cdp_pdev_stats {
 	/* Number of Rx ring descriptors reaped per interrupt */
 	struct cdp_hist_rx_ind rx_ind_histogram;
 	uint64_t ppdu_stats_counter[CDP_PPDU_STATS_MAX_TAG];
+
+	struct cdp_htt_tx_pdev_stats  htt_tx_pdev_stats;
+	struct cdp_htt_rx_pdev_stats  htt_rx_pdev_stats;
 };
 
 #ifndef BIG_ENDIAN_HOST

+ 22 - 5
dp/wifi3.0/dp_htt.c

@@ -36,6 +36,8 @@
 #define HTT_MSG_BUF_SIZE(msg_bytes) \
 	((msg_bytes) + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING)
 
+#define HTT_PID_BIT_MASK 0x3
+
 #define DP_EXT_MSG_LENGTH 2048
 #define DP_HTT_SEND_HTC_PKT(soc, pkt)                            \
 do {                                                             \
@@ -1308,7 +1310,7 @@ static inline QDF_STATUS dp_send_htt_stat_resp(struct htt_stats_context *htt_sta
 	msg_word = (uint32_t *) qdf_nbuf_data(htt_msg);
 
 	/*COOKIE MSB*/
-	pdev_id = *(msg_word + 2);
+	pdev_id = *(msg_word + 2) & HTT_PID_BIT_MASK;
 
 	/* stats message length + 16 size of HTT header*/
 	msg_remain_len = qdf_min(htt_stats->msg_len + 16,
@@ -1367,6 +1369,10 @@ static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats,
 	uint32_t tlv_remain_len = 0;
 	uint32_t *tlv_start;
 	int cookie_val;
+	int cookie_msb;
+	int pdev_id;
+	bool copy_stats = false;
+	struct dp_pdev *pdev;
 
 	/* Process node in the HTT message queue */
 	while ((htt_msg = qdf_nbuf_queue_remove(&htt_stats->msg))
@@ -1379,11 +1385,17 @@ static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats,
 				continue;
 			}
 		}
+		cookie_msb = *(msg_word + 2);
+		pdev_id = *(msg_word + 2) & HTT_PID_BIT_MASK;
+		pdev = soc->pdev_list[pdev_id];
+
+		if (cookie_msb >> 2) {
+			copy_stats = true;
+		}
 		/* read 5th word */
 		msg_word = msg_word + 4;
 		msg_remain_len = qdf_min(htt_stats->msg_len,
 				(uint32_t) DP_EXT_MSG_LENGTH);
-
 		/* Keep processing the node till node length is 0 */
 		while (msg_remain_len) {
 			/*
@@ -1424,7 +1436,10 @@ static inline void dp_process_htt_stat_msg(struct htt_stats_context *htt_stats,
 					tlv_start = msg_word;
 				}
 
-				dp_htt_stats_print_tag(tlv_type, tlv_start);
+				if (copy_stats)
+					dp_htt_stats_copy_tag(pdev, tlv_type, tlv_start);
+				else
+					dp_htt_stats_print_tag(tlv_type, tlv_start);
 
 				msg_remain_len -= tlv_remain_len;
 
@@ -2877,7 +2892,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, int cookie_val)
+		uint32_t config_param_3, int cookie_val, int cookie_msb)
 {
 	struct htt_soc *soc = pdev->soc->htt_handle;
 	struct dp_htt_htc_pkt *pkt;
@@ -2962,7 +2977,9 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev,
 	/* word 7 */
 	msg_word++;
 	*msg_word = 0;
-	HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, pdev->pdev_id);
+	/*Using last 2 bits for pdev_id */
+	cookie_msb = ((cookie_msb << 2) | pdev->pdev_id);
+	HTT_H2T_EXT_STATS_REQ_CONFIG_PARAM_SET(*msg_word, cookie_msb);
 
 	pkt = htt_htc_pkt_alloc(soc);
 	if (!pkt) {

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

@@ -383,8 +383,9 @@ 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, int cookie);
+		uint32_t config_param_3, int cookie, int cookie_msb);
 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),
 		void *cb_ctxt);
 void dp_set_pn_check_wifi3(struct cdp_vdev *vdev_handle,

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

@@ -74,6 +74,7 @@ static void dp_peer_delete_wifi3(void *peer_handle, uint32_t bitmap);
 #define DP_MAX_MCS_STRING_LEN 30
 #define DP_CURR_FW_STATS_AVAIL 19
 #define DP_HTT_DBG_EXT_STATS_MAX 256
+#define DP_MAX_SLEEP_TIME 100
 
 #ifdef IPA_OFFLOAD
 /* Exclude IPA rings from the interrupt context */
@@ -5602,7 +5603,7 @@ 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, 0);
+			config_param3, 0, 0);
 
 }
 
@@ -5635,7 +5636,7 @@ dp_get_htt_stats(struct cdp_pdev *pdev_handle, void *data, uint32_t data_len)
 	dp_h2t_ext_stats_msg_send(pdev, req->stats_id,
 				req->config_param0, req->config_param1,
 				req->config_param2, req->config_param3,
-				req->cookie);
+				req->cookie, 0);
 }
 /*
  * dp_set_pdev_param: function to set parameters in pdev
@@ -5751,9 +5752,20 @@ dp_txrx_stats_publish(struct cdp_pdev *pdev_handle, void *buf)
 {
 	struct dp_pdev *pdev = (struct dp_pdev *)pdev_handle;
 	struct cdp_pdev_stats *buffer = (struct cdp_pdev_stats *) buf;
+	struct cdp_txrx_stats_req req = {0,};
 
 	dp_aggregate_pdev_stats(pdev);
-
+	req.stats = HTT_DBG_EXT_STATS_PDEV_TX;
+	req.cookie_val = 1;
+	dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0,
+				req.param1, req.param2, req.param3, 0, req.cookie_val);
+	msleep(DP_MAX_SLEEP_TIME);
+
+	req.stats = HTT_DBG_EXT_STATS_PDEV_RX;
+	req.cookie_val = 1;
+	dp_h2t_ext_stats_msg_send(pdev, req.stats, req.param0,
+				req.param1, req.param2, req.param3, 0, req.cookie_val);
+	msleep(DP_MAX_SLEEP_TIME);
 	qdf_mem_copy(buffer, &pdev->stats, sizeof(pdev->stats));
 
 	return TXRX_STATS_LEVEL;
@@ -5819,7 +5831,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);
+				req->param1, req->param2, req->param3, 0, 0);
 }
 
 /**

+ 68 - 1
dp/wifi3.0/dp_stats.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
@@ -2890,3 +2890,70 @@ void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf)
 		break;
 	}
 }
+
+/*
+ * dp_htt_stats_copy_tag: function to select the tag type and
+ * copy the corresponding tag structure
+ * @pdev: DP_PDEV handle
+ * @tag_type: tag type that is to be printed
+ * @tag_buf: pointer to the tag structure
+ *
+ * return: void
+ */
+void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf)
+{
+	void *dest_ptr = NULL;
+	uint32_t size = 0;
+
+	switch (tag_type) {
+	case HTT_STATS_TX_PDEV_CMN_TAG:
+		dest_ptr = &pdev->stats.htt_tx_pdev_stats.cmn_tlv;
+		size = sizeof(htt_tx_pdev_stats_cmn_tlv);
+		break;
+	case HTT_STATS_TX_PDEV_UNDERRUN_TAG:
+		dest_ptr = &pdev->stats.htt_tx_pdev_stats.underrun_tlv;
+		size = sizeof(htt_tx_pdev_stats_urrn_tlv_v);
+		break;
+	case HTT_STATS_TX_PDEV_SIFS_TAG:
+		dest_ptr = &pdev->stats.htt_tx_pdev_stats.sifs_tlv;
+		size = sizeof(htt_tx_pdev_stats_sifs_tlv_v);
+		break;
+	case HTT_STATS_TX_PDEV_FLUSH_TAG:
+		dest_ptr = &pdev->stats.htt_tx_pdev_stats.flush_tlv;
+		size = sizeof(htt_tx_pdev_stats_flush_tlv_v);
+		break;
+	case HTT_STATS_TX_PDEV_PHY_ERR_TAG:
+		dest_ptr = &pdev->stats.htt_tx_pdev_stats.phy_err_tlv;
+		size = sizeof(htt_tx_pdev_stats_phy_err_tlv_v);
+		break;
+	case HTT_STATS_RX_PDEV_FW_STATS_TAG:
+		dest_ptr = &pdev->stats.htt_rx_pdev_stats.fw_stats_tlv;
+		size = sizeof(htt_rx_pdev_fw_stats_tlv);
+		break;
+	case HTT_STATS_RX_SOC_FW_STATS_TAG:
+		dest_ptr = &pdev->stats.htt_rx_pdev_stats.soc_stats.fw_tlv;
+		size = sizeof(htt_rx_soc_fw_stats_tlv);
+		break;
+	case HTT_STATS_RX_SOC_FW_REFILL_RING_EMPTY_TAG:
+		dest_ptr = &pdev->stats.htt_rx_pdev_stats.soc_stats.fw_refill_ring_empty_tlv;
+		size = sizeof(htt_rx_soc_fw_refill_ring_empty_tlv_v);
+		break;
+	case HTT_STATS_RX_SOC_FW_REFILL_RING_NUM_REFILL_TAG:
+		dest_ptr = &pdev->stats.htt_rx_pdev_stats.soc_stats.fw_refill_ring_num_refill_tlv;
+		size = sizeof(htt_rx_soc_fw_refill_ring_num_refill_tlv_v);
+		break;
+	case HTT_STATS_RX_PDEV_FW_RING_MPDU_ERR_TAG:
+		dest_ptr = &pdev->stats.htt_rx_pdev_stats.fw_ring_mpdu_err_tlv;
+		size = sizeof(htt_rx_pdev_fw_ring_mpdu_err_tlv_v);
+		break;
+	case HTT_STATS_RX_PDEV_FW_MPDU_DROP_TAG:
+		dest_ptr = &pdev->stats.htt_rx_pdev_stats.fw_ring_mpdu_drop;
+		size = sizeof(htt_rx_pdev_fw_mpdu_drop_tlv_v);
+		break;
+	default:
+		break;
+	}
+
+	if (dest_ptr)
+		qdf_mem_copy(dest_ptr, tag_buf, size);
+}