From dbb85302455e14a364608bc7719ecf120ac39f5d Mon Sep 17 00:00:00 2001 From: Soumya Bhat Date: Fri, 18 May 2018 11:01:34 +0530 Subject: [PATCH] qcacmn: Tx desc counter changes Add following Tx desc counter changes: 1. Initialize tx_desc allocated counter 2. Initialize tx desc free counter 3. Use per pool tx desc counter num_allocated to populate desc_in_use counter Change-Id: I4d80d0acfbbdd32a9f7d66e938e0a0f4e2cd7048 CRs-Fixed: 2239623 --- dp/wifi3.0/dp_main.c | 10 ++++++++++ dp/wifi3.0/dp_tx_desc.c | 26 +++++++++++++++++++++++++- dp/wifi3.0/dp_tx_desc.h | 2 -- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index a7889fca10..51da50da50 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -5241,7 +5241,17 @@ dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev) static inline void dp_print_soc_tx_stats(struct dp_soc *soc) { + uint8_t desc_pool_id; + soc->stats.tx.desc_in_use = 0; + DP_PRINT_STATS("SOC Tx Stats:\n"); + + for (desc_pool_id = 0; + desc_pool_id < wlan_cfg_get_num_tx_desc_pool(soc->wlan_cfg_ctx); + desc_pool_id++) + soc->stats.tx.desc_in_use += + soc->tx_desc[desc_pool_id].num_allocated; + DP_PRINT_STATS("Tx Descriptors In Use = %d", soc->stats.tx.desc_in_use); DP_PRINT_STATS("Invalid peer:"); diff --git a/dp/wifi3.0/dp_tx_desc.c b/dp/wifi3.0/dp_tx_desc.c index 1dbba859e8..4c86296b3c 100644 --- a/dp/wifi3.0/dp_tx_desc.c +++ b/dp/wifi3.0/dp_tx_desc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-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 @@ -38,6 +38,29 @@ do { \ #define DP_TX_DESC_PAGE_DIVIDER(soc, num_desc_per_page, pool_id) {} #endif /* DESC_PARTITION */ +/** + * dp_tx_desc_pool_counter_initialize() - Initialize counters + * @tx_desc_pool Handle to DP tx_desc_pool structure + * @num_elem Number of descriptor elements per pool + * + * Return: None + */ +#ifdef QCA_LL_TX_FLOW_CONTROL_V2 +static void +dp_tx_desc_pool_counter_initialize(struct dp_tx_desc_pool_s *tx_desc_pool, + uint16_t num_elem) +{ +} +#else +static void +dp_tx_desc_pool_counter_initialize(struct dp_tx_desc_pool_s *tx_desc_pool, + uint16_t num_elem) +{ + tx_desc_pool->num_free = num_elem; + tx_desc_pool->num_allocated = 0; +} +#endif + /** * dp_tx_desc_pool_alloc() - Allocate Tx Descriptor pool(s) * @soc Handle to DP SoC structure @@ -115,6 +138,7 @@ QDF_STATUS dp_tx_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id, count++; } + dp_tx_desc_pool_counter_initialize(tx_desc_pool, num_elem); TX_DESC_LOCK_CREATE(&tx_desc_pool->lock); return QDF_STATUS_SUCCESS; diff --git a/dp/wifi3.0/dp_tx_desc.h b/dp/wifi3.0/dp_tx_desc.h index 294e52463f..038a325b8c 100644 --- a/dp/wifi3.0/dp_tx_desc.h +++ b/dp/wifi3.0/dp_tx_desc.h @@ -274,7 +274,6 @@ static inline struct dp_tx_desc_s *dp_tx_desc_alloc(struct dp_soc *soc, soc->tx_desc[desc_pool_id].num_allocated++; soc->tx_desc[desc_pool_id].num_free--; - DP_STATS_INC(soc, tx.desc_in_use, 1); tx_desc->flags = DP_TX_DESC_FLAG_ALLOCATED; TX_DESC_LOCK_UNLOCK(&soc->tx_desc[desc_pool_id].lock); @@ -346,7 +345,6 @@ dp_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc, tx_desc->flags = 0; tx_desc->next = soc->tx_desc[desc_pool_id].freelist; soc->tx_desc[desc_pool_id].freelist = tx_desc; - DP_STATS_DEC(soc, tx.desc_in_use, 1); soc->tx_desc[desc_pool_id].num_allocated--; soc->tx_desc[desc_pool_id].num_free++;