Browse Source

qcacmn: Add support for Tx and RX Broadcast Packets

Add counters to display the broadcast packets on Tx and Rx side

Change-Id: I85bea07b83d34dc15b185297e7ec63208d8ab8e8
Pranita Solanke 7 years ago
parent
commit
a5a3ae721e

+ 5 - 4
dp/inc/cdp_txrx_cmn_struct.h

@@ -801,6 +801,8 @@ struct cdp_tx_stats {
 	struct cdp_pkt_info ucast;
 	/* Multicast Packet Count */
 	struct cdp_pkt_info mcast;
+	/* Broadcast Packet Count*/
+	struct cdp_pkt_info bcast;
 	/*NAWDS  Multicast Packet Count */
 	struct cdp_pkt_info nawds_mcast;
 	/*NAWDS  Multicast Drop Count */
@@ -842,14 +844,11 @@ struct cdp_tx_stats {
 	/* Packet Count for different bandwidths */
 	uint32_t bw[MAX_BW];
 
-	/* Excess Retry Count */
-	uint32_t excess_retries[WME_AC_MAX];
-
 	/* Wireless Multimedia type Count */
 	uint32_t wme_ac_type[WME_AC_MAX];
 
 	/* Wireless Multimedia type Count */
-	uint32_t excess_retries_ac[WME_AC_MAX];
+	uint32_t excess_retries_per_ac[WME_AC_MAX];
 
 	/* Packets dropped on the Tx side */
 	struct {
@@ -874,6 +873,8 @@ struct cdp_rx_stats {
 	struct cdp_pkt_info unicast;
 	/* Total multicast packets */
 	struct cdp_pkt_info multicast;
+	/* Broadcast Packet Count*/
+	struct cdp_pkt_info bcast;
 	/* WDS packets received */
 	struct cdp_pkt_info wds;
 	/* Raw Pakets received */

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

@@ -2113,7 +2113,7 @@ static void dp_process_ppdu_stats_user_compltn_flush_tlv(struct dp_pdev *pdev,
 	tid = HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_GET(*tag_buf);
 
 	if (drop_reason == HTT_FLUSH_EXCESS_RETRIES) {
-		DP_STATS_INC(peer, tx.excess_retries[TID_TO_WME_AC(tid)],
+		DP_STATS_INC(peer, tx.excess_retries_per_ac[TID_TO_WME_AC(tid)],
 					num_msdu);
 	}
 }

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

@@ -255,7 +255,7 @@ while (0)
 		for (i = 0; i < WME_AC_MAX; i++) { \
 			DP_STATS_AGGR(_tgtobj, _srcobj, tx.wme_ac_type[i]); \
 			DP_STATS_AGGR(_tgtobj, _srcobj, rx.wme_ac_type[i]); \
-			DP_STATS_AGGR(_tgtobj, _srcobj, tx.excess_retries_ac[i]); \
+			DP_STATS_AGGR(_tgtobj, _srcobj, tx.excess_retries_per_ac[i]); \
 		\
 		} \
 		\
@@ -267,6 +267,7 @@ while (0)
 		DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.comp_pkt); \
 		DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.ucast); \
 		DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.mcast); \
+		DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.bcast); \
 		DP_STATS_AGGR_PKT(_tgtobj, _srcobj, tx.tx_success); \
 		DP_STATS_AGGR(_tgtobj, _srcobj, tx.tx_failed); \
 		DP_STATS_AGGR(_tgtobj, _srcobj, tx.ofdma); \
@@ -287,6 +288,7 @@ while (0)
 		DP_STATS_AGGR(_tgtobj, _srcobj, rx.non_amsdu_cnt); \
 		DP_STATS_AGGR(_tgtobj, _srcobj, rx.amsdu_cnt); \
 		DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.to_stack); \
+		DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.bcast);\
 								\
 		for (i = 0; i <  CDP_MAX_RX_RINGS; i++)	\
 			DP_STATS_AGGR_PKT(_tgtobj, _srcobj, rx.rcvd_reo[i]); \

+ 17 - 0
dp/wifi3.0/dp_main.c

@@ -4846,6 +4846,10 @@ static inline void dp_print_peer_stats(struct dp_peer *peer)
 			peer->stats.tx.mcast.num);
 	DP_PRINT_STATS("Multicast Success Bytes = %llu",
 			peer->stats.tx.mcast.bytes);
+	DP_PRINT_STATS("Broadcast Success Packets = %d",
+			peer->stats.tx.bcast.num);
+	DP_PRINT_STATS("Broadcast Success Bytes = %llu",
+			peer->stats.tx.bcast.bytes);
 	DP_PRINT_STATS("Packets Failed = %d",
 			peer->stats.tx.tx_failed);
 	DP_PRINT_STATS("Packets In OFDMA = %d",
@@ -4902,6 +4906,15 @@ static inline void dp_print_peer_stats(struct dp_peer *peer)
 			peer->stats.tx.sgi_count[1],
 			peer->stats.tx.sgi_count[2],
 			peer->stats.tx.sgi_count[3]);
+	DP_PRINT_STATS("Excess Retries per AC ");
+	DP_PRINT_STATS("	 Best effort = %d",
+			peer->stats.tx.excess_retries_per_ac[0]);
+	DP_PRINT_STATS("	 Background= %d",
+			peer->stats.tx.excess_retries_per_ac[1]);
+	DP_PRINT_STATS("	 Video = %d",
+			peer->stats.tx.excess_retries_per_ac[2]);
+	DP_PRINT_STATS("	 Voice = %d",
+			peer->stats.tx.excess_retries_per_ac[3]);
 	DP_PRINT_STATS("BW Counts = 20MHZ %d 40MHZ %d 80MHZ %d 160MHZ %d\n",
 			peer->stats.tx.bw[2], peer->stats.tx.bw[3],
 			peer->stats.tx.bw[4], peer->stats.tx.bw[5]);
@@ -4936,6 +4949,10 @@ static inline void dp_print_peer_stats(struct dp_peer *peer)
 			peer->stats.rx.multicast.num);
 	DP_PRINT_STATS("Multicast Bytes Received = %llu",
 			peer->stats.rx.multicast.bytes);
+	DP_PRINT_STATS("Broadcast Packets Received = %d",
+			peer->stats.rx.bcast.num);
+	DP_PRINT_STATS("Broadcast Bytes Received = %llu",
+			peer->stats.rx.bcast.bytes);
 	DP_PRINT_STATS("WDS Packets Received = %d",
 			peer->stats.rx.wds.num);
 	DP_PRINT_STATS("WDS Bytes Received = %llu",

+ 15 - 0
dp/wifi3.0/dp_rx.c

@@ -1072,10 +1072,12 @@ dp_rx_process(struct dp_intr *int_ctx, void *hal_ring, uint32_t quota)
 	struct dp_pdev *pdev;
 	struct dp_srng *dp_rxdma_srng;
 	struct rx_desc_pool *rx_desc_pool;
+	struct ether_header *eh;
 	struct dp_soc *soc = int_ctx->soc;
 	uint8_t ring_id = 0;
 	uint8_t core_id = 0;
 	bool is_first_frag = 0;
+	bool isBroadcast = 0;
 	uint16_t mpdu_len = 0;
 	qdf_nbuf_t head_frag_nbuf = NULL;
 	qdf_nbuf_t frag_list_head = NULL;
@@ -1134,6 +1136,7 @@ dp_rx_process(struct dp_intr *int_ctx, void *hal_ring, uint32_t quota)
 
 		rx_desc = dp_rx_cookie_2_va_rxdma_buf(soc, rx_buf_cookie);
 
+
 		qdf_assert(rx_desc);
 		rx_bufs_reaped[rx_desc->pool_id]++;
 
@@ -1543,6 +1546,18 @@ done:
 		DP_STATS_INC_PKT(peer, rx.to_stack, 1,
 				qdf_nbuf_len(nbuf));
 
+		if (qdf_unlikely(hal_rx_msdu_end_da_is_mcbc_get(rx_tlv_hdr) &&
+					(vdev->rx_decap_type ==
+					 htt_cmn_pkt_type_ethernet))) {
+			eh = (struct ether_header *)qdf_nbuf_data(nbuf);
+			isBroadcast = (IEEE80211_IS_BROADCAST
+					(eh->ether_dhost)) ? 1 : 0 ;
+			if (isBroadcast) {
+				DP_STATS_INC_PKT(peer, rx.bcast, 1,
+						qdf_nbuf_len(nbuf));
+			}
+		}
+
 		if ((soc->process_rx_status) && likely(peer) &&
 			hal_rx_attn_first_mpdu_get(rx_tlv_hdr)) {
 			if (soc->cdp_soc.ol_ops->update_dp_stats) {

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

@@ -596,6 +596,8 @@ dp_rx_err_deliver(struct dp_soc *soc, qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr)
 	struct dp_vdev *vdev;
 	uint16_t peer_id = 0xFFFF;
 	struct dp_peer *peer = NULL;
+	struct ether_header *eh;
+	bool isBroadcast;
 
 	/*
 	 * Check if DMA completed -- msdu_done is the last bit
@@ -669,6 +671,18 @@ dp_rx_err_deliver(struct dp_soc *soc, qdf_nbuf_t nbuf, uint8_t *rx_tlv_hdr)
 	}
 	dp_rx_fill_mesh_stats(vdev, nbuf, rx_tlv_hdr, peer);
 
+	if (qdf_unlikely(hal_rx_msdu_end_da_is_mcbc_get(rx_tlv_hdr) &&
+				(vdev->rx_decap_type ==
+				htt_cmn_pkt_type_ethernet))) {
+		eh = (struct ether_header *)qdf_nbuf_data(nbuf);
+		isBroadcast = (IEEE80211_IS_BROADCAST
+				(eh->ether_dhost)) ? 1 : 0 ;
+		if (isBroadcast) {
+			DP_STATS_INC_PKT(peer, rx.bcast, 1,
+					qdf_nbuf_len(nbuf));
+		}
+	}
+
 	if (qdf_unlikely(vdev->rx_decap_type == htt_cmn_pkt_type_raw)) {
 		dp_rx_deliver_raw(vdev, nbuf, peer);
 	} else {

+ 13 - 0
dp/wifi3.0/dp_tx.c

@@ -1651,6 +1651,7 @@ qdf_nbuf_t dp_tx_send(void *vap_dev, qdf_nbuf_t nbuf)
 	qdf_mem_set(&seg_info, sizeof(seg_info), 0x0);
 
 	eh = (struct ether_header *)qdf_nbuf_data(nbuf);
+
 	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
 			"%s , skb %0x:%0x:%0x:%0x:%0x:%0x\n",
 			__func__, nbuf->data[0], nbuf->data[1], nbuf->data[2],
@@ -2343,6 +2344,10 @@ static inline void dp_tx_comp_process_tx_status(struct dp_tx_desc_s *tx_desc,
 	struct dp_soc *soc = NULL;
 	struct dp_vdev *vdev = tx_desc->vdev;
 	struct dp_peer *peer = NULL;
+	struct ether_header *eh =
+		(struct ether_header *)qdf_nbuf_data(tx_desc->nbuf);
+	bool isBroadcast;
+
 	hal_tx_comp_get_status(&tx_desc->comp, &ts);
 
 	QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
@@ -2398,6 +2403,14 @@ static inline void dp_tx_comp_process_tx_status(struct dp_tx_desc_s *tx_desc,
 		DP_STATS_INC_PKT(soc, tx.tx_invalid_peer, 1, length);
 		goto out;
 	}
+	if (qdf_likely(vdev->tx_encap_type == htt_cmn_pkt_type_ethernet)) {
+		isBroadcast = (IEEE80211_IS_BROADCAST(eh->ether_dhost)) ? 1 : 0 ;
+
+		if (isBroadcast) {
+			DP_STATS_INC_PKT(peer, tx.bcast, 1,
+					qdf_nbuf_len(tx_desc->nbuf));
+		}
+	}
 
 	dp_tx_update_peer_stats(peer, &ts, length);