From 1027e8ca6d436220cea67e84202f22467cfa49fa Mon Sep 17 00:00:00 2001 From: Yun Park Date: Fri, 13 Oct 2017 15:17:37 -0700 Subject: [PATCH] qcacld-3.0: Implement clearStats for TSO and NAPI statistics Implement missing clearStats for TSO and NAPI statistics. Change-Id: I384a6abcecca8276dadc647e93720e067f324aab CRs-Fixed: 2024016 --- core/dp/txrx/ol_txrx.c | 24 ++++++++++++++++++++++++ core/hdd/inc/wlan_hdd_napi.h | 2 ++ core/hdd/src/wlan_hdd_napi.c | 30 ++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_wext.c | 3 +++ 4 files changed, 59 insertions(+) diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index b25b18b137da..54e408b4476c 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -1124,7 +1124,21 @@ static void ol_txrx_stats_display_tso(ol_txrx_pdev_handle pdev) } } } + +static void ol_txrx_tso_stats_clear(ol_txrx_pdev_handle pdev) +{ + qdf_mem_zero(&pdev->stats.pub.tx.tso.tso_pkts, + sizeof(struct ol_txrx_stats_elem)); +#if defined(FEATURE_TSO) + qdf_mem_zero(&pdev->stats.pub.tx.tso.tso_info, + sizeof(struct ol_txrx_stats_tso_info)); + qdf_mem_zero(&pdev->stats.pub.tx.tso.tso_hist, + sizeof(struct ol_txrx_tso_histogram)); +#endif +} + #else + static void ol_txrx_stats_display_tso(ol_txrx_pdev_handle pdev) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, @@ -1147,6 +1161,13 @@ static void ol_txrx_tso_stats_deinit(ol_txrx_pdev_handle pdev) */ } +static void ol_txrx_tso_stats_clear(ol_txrx_pdev_handle pdev) +{ + /* + * keeping the body empty and not keeping an error print as print will + * will show up everytime during driver unload if TSO is not enabled. + */ +} #endif /* defined(FEATURE_TSO) && defined(FEATURE_TSO_DEBUG) */ /** @@ -4676,6 +4697,9 @@ static void ol_txrx_clear_stats(uint16_t value) case CDP_TXRX_PATH_STATS: ol_txrx_stats_clear(pdev); break; + case CDP_TXRX_TSO_STATS: + ol_txrx_tso_stats_clear(pdev); + break; case CDP_DUMP_TX_FLOW_POOL_INFO: ol_tx_clear_flow_pool_stats(); break; diff --git a/core/hdd/inc/wlan_hdd_napi.h b/core/hdd/inc/wlan_hdd_napi.h index 6640de0cb8f9..1a027c75f6a4 100644 --- a/core/hdd/inc/wlan_hdd_napi.h +++ b/core/hdd/inc/wlan_hdd_napi.h @@ -49,6 +49,7 @@ int hdd_napi_enabled(int id); int hdd_napi_create(void); int hdd_napi_destroy(int force); int hdd_display_napi_stats(void); +int hdd_clear_napi_stats(void); /* the following triggers napi_enable/disable as required */ int hdd_napi_event(enum qca_napi_event event, void *data); @@ -88,6 +89,7 @@ static inline int hdd_napi_enabled(int id) { return 0; } static inline int hdd_napi_create(void) { return 0; } static inline int hdd_napi_destroy(int force) { return 0; } static inline int hdd_display_napi_stats(void) { return 0; } +static inline int hdd_clear_napi_stats(void) { return 0; } static inline int hdd_napi_event(enum qca_napi_event event, void *data) { return 0; diff --git a/core/hdd/src/wlan_hdd_napi.c b/core/hdd/src/wlan_hdd_napi.c index f6c8383f75e8..d078c3d4d963 100644 --- a/core/hdd/src/wlan_hdd_napi.c +++ b/core/hdd/src/wlan_hdd_napi.c @@ -455,3 +455,33 @@ int hdd_display_napi_stats(void) return 0; } +/** + * hdd_clear_napi_stats() - clear NAPI stats + * + * Return: == 0: success; !=0: failure + */ +int hdd_clear_napi_stats(void) +{ + int i, j; + struct qca_napi_data *napid; + struct qca_napi_info *napii; + struct qca_napi_stat *napis; + + napid = hdd_napi_get_all(); + if (NULL == napid) { + hdd_err("%s unable to retrieve napi structure", __func__); + return -EFAULT; + } + + for (i = 0; i < CE_COUNT_MAX; i++) + if (napid->ce_map & (0x01 << i)) { + napii = napid->napis[i]; + for (j = 0; j < NR_CPUS; j++) { + napis = &(napii->stats[j]); + qdf_mem_zero(napis, + sizeof(struct qca_napi_stat)); + } + } + + return 0; +} diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 8744924d5031..adb83f6d733e 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -8880,6 +8880,9 @@ static int __iw_setint_getnone(struct net_device *dev, case CDP_HIF_STATS: hdd_clear_hif_stats(); break; + case CDP_NAPI_STATS: + hdd_clear_napi_stats(); + break; default: cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC), set_value);