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
This commit is contained in:
Soumya Bhat
2018-05-18 11:01:34 +05:30
committed by nshrivas
parent 993a384744
commit dbb8530245
3 changed files with 35 additions and 3 deletions

View File

@@ -5241,7 +5241,17 @@ dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev)
static inline void static inline void
dp_print_soc_tx_stats(struct dp_soc *soc) 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"); 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", DP_PRINT_STATS("Tx Descriptors In Use = %d",
soc->stats.tx.desc_in_use); soc->stats.tx.desc_in_use);
DP_PRINT_STATS("Invalid peer:"); DP_PRINT_STATS("Invalid peer:");

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * 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) {} #define DP_TX_DESC_PAGE_DIVIDER(soc, num_desc_per_page, pool_id) {}
#endif /* DESC_PARTITION */ #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) * dp_tx_desc_pool_alloc() - Allocate Tx Descriptor pool(s)
* @soc Handle to DP SoC structure * @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++; count++;
} }
dp_tx_desc_pool_counter_initialize(tx_desc_pool, num_elem);
TX_DESC_LOCK_CREATE(&tx_desc_pool->lock); TX_DESC_LOCK_CREATE(&tx_desc_pool->lock);
return QDF_STATUS_SUCCESS; return QDF_STATUS_SUCCESS;

View File

@@ -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_allocated++;
soc->tx_desc[desc_pool_id].num_free--; 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->flags = DP_TX_DESC_FLAG_ALLOCATED;
TX_DESC_LOCK_UNLOCK(&soc->tx_desc[desc_pool_id].lock); 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->flags = 0;
tx_desc->next = soc->tx_desc[desc_pool_id].freelist; tx_desc->next = soc->tx_desc[desc_pool_id].freelist;
soc->tx_desc[desc_pool_id].freelist = tx_desc; 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_allocated--;
soc->tx_desc[desc_pool_id].num_free++; soc->tx_desc[desc_pool_id].num_free++;