From 6add3db0d6cb5a4eead077106bd1b7cd2c230a84 Mon Sep 17 00:00:00 2001 From: Aditya Sathish Date: Tue, 10 Apr 2018 19:43:34 +0530 Subject: [PATCH] qcacmn: Fix Multicast RX Bytes and TX Packet Value in Node Stats Fix for setting the right length when incrementing Rx Multicast Bytes value Fix for incrementing the Tx multicast packet value by correctly returning the peer pointer to the stats function. Change-Id: I46d59b7a71936d6eefdcba4419d0737f70aa4d48 CRs-Fixed: 2220973 --- dp/wifi3.0/dp_main.c | 13 +++++++++++++ dp/wifi3.0/dp_rx.c | 30 +++++++++++++----------------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index ca0124484b97..7c2d77bc7f13 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -6744,6 +6744,19 @@ static void dp_peer_teardown_wifi3(struct cdp_vdev *vdev_hdl, void *peer_hdl) struct dp_peer *peer = (struct dp_peer *) peer_hdl; struct dp_soc *soc = (struct dp_soc *) vdev->pdev->soc; + /* + * For BSS peer, new peer is not created on alloc_node if the + * peer with same address already exists , instead refcnt is + * increased for existing peer. Correspondingly in delete path, + * only refcnt is decreased; and peer is only deleted , when all + * references are deleted. So delete_in_progress should not be set + * for bss_peer, unless only 2 reference remains (peer map reference + * and peer hash table reference). + */ + if (peer->bss_peer && (qdf_atomic_read(&peer->ref_cnt) > 2)) { + return; + } + peer->delete_in_progress = true; dp_peer_delete_ast_entries(soc, peer); } diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 68b1059065a2..1cc8e26812f1 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -1035,7 +1035,7 @@ static void dp_rx_msdu_stats_update(struct dp_soc *soc, uint32_t sgi, mcs, tid, nss, bw, reception_type, pkt_type; struct dp_vdev *vdev = peer->vdev; struct ether_header *eh; - bool is_broadcast = false; + uint16_t msdu_len = qdf_nbuf_len(nbuf); peer_id = DP_PEER_METADATA_PEER_ID_GET( hal_rx_mpdu_peer_meta_data_get(rx_tlv_hdr)); @@ -1043,14 +1043,19 @@ static void dp_rx_msdu_stats_update(struct dp_soc *soc, is_not_amsdu = qdf_nbuf_is_rx_chfrag_start(nbuf) & qdf_nbuf_is_rx_chfrag_end(nbuf); - DP_STATS_INC_PKT(peer, rx.rcvd_reo[ring_id], 1, - hal_rx_msdu_start_msdu_len_get(rx_tlv_hdr)); - + DP_STATS_INC_PKT(peer, rx.rcvd_reo[ring_id], 1, msdu_len); DP_STATS_INCC(peer, rx.non_amsdu_cnt, 1, is_not_amsdu); DP_STATS_INCC(peer, rx.amsdu_cnt, 1, !is_not_amsdu); - DP_STATS_INCC_PKT(peer, rx.multicast, 1, qdf_nbuf_len(nbuf), - hal_rx_msdu_end_da_is_mcbc_get(rx_tlv_hdr)); + 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); + if (IEEE80211_IS_BROADCAST(eh->ether_dhost)) { + DP_STATS_INC_PKT(peer, rx.bcast, 1, msdu_len); + } else { + DP_STATS_INC_PKT(peer, rx.multicast, 1, msdu_len); + } + } /* * currently we can return from here as we have similar stats @@ -1107,15 +1112,6 @@ static void dp_rx_msdu_stats_update(struct dp_soc *soc, DP_STATS_INCC(peer, rx.pkt_type[pkt_type].mcs_count[mcs], 1, ((mcs <= MAX_MCS) && (pkt_type == DOT11_AX))); - 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); - is_broadcast = - IEEE80211_IS_BROADCAST(eh->ether_dhost) ? true : false; - if (is_broadcast) - DP_STATS_INC_PKT(peer, rx.bcast, 1, qdf_nbuf_len(nbuf)); - } - if ((soc->process_rx_status) && hal_rx_attn_first_mpdu_get(rx_tlv_hdr)) { if (soc->cdp_soc.ol_ops->update_dp_stats) { @@ -1522,8 +1518,6 @@ done: dp_rx_cksum_offload(nbuf, rx_tlv_hdr); - dp_rx_msdu_stats_update(soc, nbuf, rx_tlv_hdr, peer, ring_id); - /* * HW structures call this L3 header padding -- * even though this is actually the offset from @@ -1549,6 +1543,8 @@ done: l2_hdr_offset); } + dp_rx_msdu_stats_update(soc, nbuf, rx_tlv_hdr, peer, ring_id); + if (qdf_unlikely(vdev->mesh_vdev)) { if (dp_rx_filter_mesh_packets(vdev, nbuf, rx_tlv_hdr)