From 455e425f0d6d45b1846cd907276c785f3263aada Mon Sep 17 00:00:00 2001 From: Nisha Menon Date: Wed, 10 Feb 2021 21:22:26 -0800 Subject: [PATCH] qcacld-3.0: GETSTATSSTAINFO does not return the mcbc count GETSTATSSTAINFO and GETSTAINFO cmds return the correct mcbc counters in SAP+STA case with IPA disabled since the host updates these stats during dp_rx processing. With IPA is enabled the hdd callback invoked from the IPA driver needs to update the counters if broadcast or multicast pkts are received in exception path. Change-Id: I450bf809fab559be8f2fbd172c49fd7e8858ee5c CRs-Fixed: 2875804 --- core/hdd/inc/wlan_hdd_softap_tx_rx.h | 17 ++++++++++++++++- core/hdd/src/wlan_hdd_ipa.c | 2 ++ core/hdd/src/wlan_hdd_softap_tx_rx.c | 28 ++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_sta_info.h | 2 ++ core/hdd/src/wlan_hdd_station_info.c | 16 +++++++++++++--- 5 files changed, 61 insertions(+), 4 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_softap_tx_rx.h b/core/hdd/inc/wlan_hdd_softap_tx_rx.h index 4de6f7a2aeb6..b93317c98a2c 100644 --- a/core/hdd/inc/wlan_hdd_softap_tx_rx.h +++ b/core/hdd/inc/wlan_hdd_softap_tx_rx.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2021 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 @@ -204,6 +204,21 @@ void hdd_softap_tx_resume_cb(void *adapter_context, bool tx_resume) } #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */ +/** + * hdd_ipa_update_rx_mcbc_stats() - Update broadcast multicast stats + * @adapter: pointer to hdd adapter + * @skb: pointer to netbuf + * + * Check if multicast or broadcast pkt was received and increment + * the stats accordingly. This is required only if IPA is enabled + * as in case of regular Rx path mcast/bcast stats are processed + * in the dp layer. + * + * Return: None + */ +void hdd_ipa_update_rx_mcbc_stats(struct hdd_adapter *adapter, + struct sk_buff *skb); + #ifdef SAP_DHCP_FW_IND /** * hdd_post_dhcp_ind() - Send DHCP START/STOP indication to FW diff --git a/core/hdd/src/wlan_hdd_ipa.c b/core/hdd/src/wlan_hdd_ipa.c index 87edbd5c8316..0a55d2b82a8b 100644 --- a/core/hdd/src/wlan_hdd_ipa.c +++ b/core/hdd/src/wlan_hdd_ipa.c @@ -455,6 +455,8 @@ void hdd_ipa_send_nbuf_to_network(qdf_nbuf_t nbuf, qdf_netdev_t dev) return; } + hdd_ipa_update_rx_mcbc_stats(adapter, nbuf); + if ((adapter->device_mode == QDF_SAP_MODE) && (qdf_nbuf_is_ipv4_dhcp_pkt(nbuf) == true)) { /* Send DHCP Indication to FW */ diff --git a/core/hdd/src/wlan_hdd_softap_tx_rx.c b/core/hdd/src/wlan_hdd_softap_tx_rx.c index deffda607878..f8f0f588c4b9 100644 --- a/core/hdd/src/wlan_hdd_softap_tx_rx.c +++ b/core/hdd/src/wlan_hdd_softap_tx_rx.c @@ -420,6 +420,34 @@ static void hdd_softap_notify_dhcp_ind(void *context, struct sk_buff *netbuf) hdd_post_dhcp_ind(adapter, dest_mac_addr, WMA_DHCP_STOP_IND); } +void hdd_ipa_update_rx_mcbc_stats(struct hdd_adapter *adapter, + struct sk_buff *skb) +{ + struct hdd_station_info *hdd_sta_info; + struct qdf_mac_addr *src_mac; + qdf_ether_header_t *eh; + + src_mac = (struct qdf_mac_addr *)(skb->data + + QDF_NBUF_SRC_MAC_OFFSET); + + hdd_sta_info = hdd_get_sta_info_by_mac( + &adapter->sta_info_list, + src_mac->bytes, + STA_INFO_SOFTAP_IPA_RX_PKT_CALLBACK); + if (!hdd_sta_info) + return; + + if (qdf_nbuf_data_is_ipv4_mcast_pkt(skb->data)) + hdd_sta_info->rx_mc_bc_cnt++; + + eh = (qdf_ether_header_t *)qdf_nbuf_data(skb); + if (QDF_IS_ADDR_BROADCAST(eh->ether_dhost)) + hdd_sta_info->rx_mc_bc_cnt++; + + hdd_put_sta_info_ref(&adapter->sta_info_list, &hdd_sta_info, + true, STA_INFO_SOFTAP_IPA_RX_PKT_CALLBACK); +} + int hdd_softap_inspect_dhcp_packet(struct hdd_adapter *adapter, struct sk_buff *skb, enum qdf_proto_dir dir) diff --git a/core/hdd/src/wlan_hdd_sta_info.h b/core/hdd/src/wlan_hdd_sta_info.h index 410901ff60d8..20d0152e89b0 100644 --- a/core/hdd/src/wlan_hdd_sta_info.h +++ b/core/hdd/src/wlan_hdd_sta_info.h @@ -107,6 +107,7 @@ enum dhcp_nego_status { * @STA_INFO_CLEAR_CACHED_STA_INFO: Clear the cached sta info * @STA_INFO_ATTACH_DETACH: Station info attach/detach * @STA_INFO_SHOW: Station info show + * @STA_INFO_SOFTAP_IPA_RX_PKT_CALLBACK: Update rx mcbc stats for IPA case * */ /* @@ -144,6 +145,7 @@ typedef enum { STA_INFO_CLEAR_CACHED_STA_INFO = 27, STA_INFO_ATTACH_DETACH = 28, STA_INFO_SHOW = 29, + STA_INFO_SOFTAP_IPA_RX_PKT_CALLBACK = 30, STA_INFO_ID_MAX, } wlan_sta_info_dbgid; diff --git a/core/hdd/src/wlan_hdd_station_info.c b/core/hdd/src/wlan_hdd_station_info.c index b8a631fa2646..1253c99f9ad1 100644 --- a/core/hdd/src/wlan_hdd_station_info.c +++ b/core/hdd/src/wlan_hdd_station_info.c @@ -37,6 +37,7 @@ #include "wlan_mlme_ucfg_api.h" #include "wlan_hdd_sta_info.h" #include "wlan_hdd_object_manager.h" +#include "wlan_ipa_ucfg_api.h" #include #include @@ -1624,7 +1625,12 @@ int32_t hdd_cfg80211_get_station_cmd(struct wiphy *wiphy, * @adapter: pointer to adapter * @stainfo: station information * - * This function gets peer statistics information + * This function gets peer statistics information. If IPA is + * enabled the Rx bcast/mcast count is updated in the + * exception callback invoked by the IPA driver. In case of + * back pressure the packets may get routed to the sw path and + * where eventually the peer mcast/bcast pkt counts are updated in + * dp rx process handling. * * Return : 0 on success and errno on failure */ @@ -1649,8 +1655,12 @@ static int hdd_get_peer_stats(struct hdd_adapter *adapter, } stainfo->rx_retry_cnt = peer_stats->rx.rx_retries; - stainfo->rx_mc_bc_cnt = peer_stats->rx.multicast.num + - peer_stats->rx.bcast.num; + if (!ucfg_ipa_is_enabled()) + stainfo->rx_mc_bc_cnt = peer_stats->rx.multicast.num + + peer_stats->rx.bcast.num; + else + stainfo->rx_mc_bc_cnt += peer_stats->rx.multicast.num + + peer_stats->rx.bcast.num; qdf_mem_free(peer_stats); peer_stats = NULL;