summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGovind Singh <govinds@qti.qualcomm.com>2015-09-22 15:40:45 +0530
committerAnjaneedevi Kapparapu <akappa@codeaurora.org>2015-10-01 16:20:26 +0530
commit560df20e8e819e4023bf38bacaa26d5790bf3bc5 (patch)
treec7f420b9e9196af04d784bddd08fc42d2a2b0ab9
parent352249ead5d09e895f12558b96ee9879b1845ef8 (diff)
qcacld-2.0: Check Invalid txrx_fw_stats
Discard invalid txrx_fw_stats in HOST driver to have coherent Runtime PM uses count. Wrong value requested in txrx_fw_stats result in increment of Runtime PM uses count, which will never be decremented in future. Change-Id: I2170897cbe93fc66a5e44835c28680c7f9c0178b CRs-Fixed: 912059
-rw-r--r--CORE/HDD/src/wlan_hdd_hostapd.c5
-rw-r--r--CORE/HDD/src/wlan_hdd_wext.c4
-rw-r--r--CORE/SERVICES/WMA/wma.c78
-rw-r--r--CORE/SERVICES/WMA/wma.h1
4 files changed, 56 insertions, 32 deletions
diff --git a/CORE/HDD/src/wlan_hdd_hostapd.c b/CORE/HDD/src/wlan_hdd_hostapd.c
index 4da5349d18fa..a787022bdbef 100644
--- a/CORE/HDD/src/wlan_hdd_hostapd.c
+++ b/CORE/HDD/src/wlan_hdd_hostapd.c
@@ -2958,6 +2958,11 @@ static __iw_softap_setparam(struct net_device *dev,
case QCASAP_TXRX_FWSTATS_RESET:
{
hddLog(LOG1, "WE_TXRX_FWSTATS_RESET val %d", set_value);
+ if (set_value != WMA_FW_TXRX_FWSTATS_RESET) {
+ hddLog(LOGE, "Invalid arg %d in FWSTATS_RESET IOCTL",
+ set_value);
+ return -EINVAL;
+ }
ret = process_wma_set_command((int)pHostapdAdapter->sessionId,
(int)WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
set_value, VDEV_CMD);
diff --git a/CORE/HDD/src/wlan_hdd_wext.c b/CORE/HDD/src/wlan_hdd_wext.c
index 2b61d6b6b6c4..3dc6bee974ac 100644
--- a/CORE/HDD/src/wlan_hdd_wext.c
+++ b/CORE/HDD/src/wlan_hdd_wext.c
@@ -6705,6 +6705,10 @@ static int __iw_setint_getnone(struct net_device *dev,
case WE_TXRX_FWSTATS_RESET:
{
hddLog(LOG1, "WE_TXRX_FWSTATS_RESET val %d", set_value);
+ if (set_value != WMA_FW_TXRX_FWSTATS_RESET) {
+ hddLog(LOGE, "Invalid arg %d in FWSTATS_RESET IOCTL",
+ set_value);
+ }
ret = process_wma_set_command((int)pAdapter->sessionId,
(int)WMA_VDEV_TXRX_FWSTATS_RESET_CMDID,
set_value, VDEV_CMD);
diff --git a/CORE/SERVICES/WMA/wma.c b/CORE/SERVICES/WMA/wma.c
index e03968c66a18..33abf8721a17 100644
--- a/CORE/SERVICES/WMA/wma.c
+++ b/CORE/SERVICES/WMA/wma.c
@@ -12446,47 +12446,61 @@ static int32_t wma_set_txrx_fw_stats_level(tp_wma_handle wma_handle,
}
vos_mem_zero(&req, sizeof(req));
req.print.verbose = 1;
- if (value <= WMA_FW_TX_PPDU_STATS)
+ switch (value) {
+ case WMA_FW_PHY_STATS:
+ case WMA_FW_RX_REORDER_STATS:
+ case WMA_FW_RX_RC_STATS:
+ case WMA_FW_TX_PPDU_STATS:
req.stats_type_upload_mask = 1 << (value - 1);
- else if (value == WMA_FW_TX_CONCISE_STATS) {
+ break;
+ case WMA_FW_TX_CONCISE_STATS:
/*
* Stats request 5 is the same as stats request 4,
* but with only a concise printout.
*/
req.print.concise = 1;
req.stats_type_upload_mask = 1 << (WMA_FW_TX_PPDU_STATS - 1);
- } else if (value == WMA_FW_TX_RC_STATS) {
+ break;
+ case WMA_FW_TX_RC_STATS:
req.stats_type_upload_mask = 1 << (WMA_FW_TX_CONCISE_STATS - 1);
- /*
- * This part of the code is a bit confusing.
- * For the statistics command iwpriv wlan0 txrx_fw_stats <n>,
- * for all n <= 4, there is 1:1 mapping of WMA defined value (n)
- * with f/w required stats_type_upload_mask.
- * For n <= 4, stats_type_upload_mask = 1 << (n - 1)
- * With the introduction of WMA_FW_TX_CONCISE_STATS, this changed
- * & the code has a special case handling, where for n = 5,
- * stats_type_upload_mask = 1 << (n - 2).
- * However per current code, there is no way to set the value of
- * stats_type_upload_mask for n > 5.
- * In the mean-time for dumping Remote Ring Buffer information,
- * f/w expects stats_type_upload_mask = 1 << 12.
- * However going by CLI command arguments, n should be 7.
- * There seems to be no apparent correlation between 7 & 12.
- * To fix this properly, one needs to fix the WMA defines appropriately
- * and always let n have a 1:1 correspondence with the bitmask expected by f/w.
- * Do not want to disturb the existing code now, but extending this code,
- * so that CLI argument "n" has 1:1 correpondence with f/w bitmask.
- * With this approach, for remote ring information, the statistics
- * command should be:
- * iwpriv wlan0 txrx_fw_stats 12
- */
- /* FIXME : Fix all the values in the appropriate way. */
- } else if (value == WMA_FW_RX_REM_RING_BUF) {
+ break;
+ case WMA_FW_RX_REM_RING_BUF:
+ /*
+ * This part of the code is a bit confusing.
+ * For the statistics command iwpriv wlan0 txrx_fw_stats <n>,
+ * for all n <= 4, there is 1:1 mapping of WMA defined value (n)
+ * with f/w required stats_type_upload_mask.
+ * For n <= 4, stats_type_upload_mask = 1 << (n - 1)
+ * With the introduction of WMA_FW_TX_CONCISE_STATS,
+ * there is a need for special handling, where for n = 5,
+ * stats_type_upload_mask = 1 << (n - 2).
+ * However per current code, there is no way to set the value of
+ * stats_type_upload_mask for n > 5.
+ * In the mean-time for dumping Remote Ring Buffer information,
+ * f/w expects stats_type_upload_mask = 1 << 12.
+ * However going by CLI command arguments, n should be 7.
+ * There seems to be no apparent correlation between 7 & 12.
+ * To fix this properly, one needs to fix the WMA defines
+ * appropriately and always let n have a 1:1
+ * correspondence with the bitmask expected by f/w.
+ * Do not want to disturb the existing code now,
+ * but extending this code, so that CLI argument "n" has
+ * 1:1 correspondence with f/w bitmask.
+ * With this approach, for remote ring information,
+ * the statistics command should be:
+ * iwpriv wlan0 txrx_fw_stats 12
+ */
+ /* FIXME : Fix all the values in the appropriate way. */
req.stats_type_upload_mask = 1 << WMA_FW_RX_REM_RING_BUF;
- } else if (value == WMA_FW_RX_TXBF_MUSU_NDPA) {
- req.stats_type_upload_mask = 1 << WMA_FW_RX_TXBF_MUSU_NDPA;
- }
-
+ break;
+ case WMA_FW_RX_TXBF_MUSU_NDPA:
+ req.stats_type_upload_mask = 1 << WMA_FW_RX_TXBF_MUSU_NDPA;
+ break;
+ default:
+ WMA_LOGE("Invalid txrx_fw_stats requested id:%d",
+ value);
+ return -EINVAL;
+ }
ol_txrx_fw_stats_get(vdev, &req);
return 0;
diff --git a/CORE/SERVICES/WMA/wma.h b/CORE/SERVICES/WMA/wma.h
index 605e815c3a46..7516eda758a6 100644
--- a/CORE/SERVICES/WMA/wma.h
+++ b/CORE/SERVICES/WMA/wma.h
@@ -1209,6 +1209,7 @@ u_int16_t get_regdmn_5g(u_int32_t reg_dmn);
#define WMA_FW_TX_RC_STATS 0x6
#define WMA_FW_RX_REM_RING_BUF 0xc
#define WMA_FW_RX_TXBF_MUSU_NDPA 0xf
+#define WMA_FW_TXRX_FWSTATS_RESET 0x1f
/*
* Setting the Tx Comp Timeout to 1 secs.