qcacmn: Enhance txrx_stats interface to accept multiple args

1. Enhance CDP and DP txrx_stats interface to accept multiple
   args. these agruments are passed to htt without any
   interpretation.
2. Add reset stats support

Change-Id: I65db494824d03097e20dffc828bea380b16d411f
CRs-Fixed: 2136793
This commit is contained in:
Om Prakash Tripathi
2017-08-23 22:51:28 +05:30
committed by snandini
parent d9bf209f70
commit 03efb6a7b6
4 changed files with 87 additions and 10 deletions

View File

@@ -865,6 +865,7 @@ static inline void cdp_flush_cache_rx_queue(ol_txrx_soc_handle soc)
/** /**
* cdp_txrx_stats(): function to map to host and firmware statistics * cdp_txrx_stats(): function to map to host and firmware statistics
* Deprecated, use cdp_txrx_stats_request() instead.
* @soc: soc handle * @soc: soc handle
* @vdev: virtual device * @vdev: virtual device
* @stats: statistics option * @stats: statistics option
@@ -889,6 +890,31 @@ int cdp_txrx_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
return soc->ops->cmn_drv_ops->txrx_stats(vdev, stats); return soc->ops->cmn_drv_ops->txrx_stats(vdev, stats);
} }
/**
* cdp_txrx_stats_request(): function to map to host and firmware statistics
* @soc: soc handle
* @vdev: virtual device
* @req: stats request container
*
* return: status
*/
static inline
int cdp_txrx_stats_request(ol_txrx_soc_handle soc, struct cdp_vdev *vdev,
struct cdp_txrx_stats_req *req)
{
if (!soc || !soc->ops || !soc->ops->cmn_drv_ops || !req) {
QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG,
"%s: Invalid Instance:", __func__);
QDF_ASSERT(0);
return 0;
}
if (soc->ops->cmn_drv_ops->txrx_stats_request)
return soc->ops->cmn_drv_ops->txrx_stats_request(vdev, req);
return 0;
}
/** /**
* cdp_txrx_intr_attach(): function to attach and configure interrupt * cdp_txrx_intr_attach(): function to attach and configure interrupt
* @soc: soc handle * @soc: soc handle

View File

@@ -1317,4 +1317,21 @@ struct cdp_config_params {
uint8_t tx_flow_stop_queue_threshold; uint8_t tx_flow_stop_queue_threshold;
uint8_t tx_flow_start_queue_offset; uint8_t tx_flow_start_queue_offset;
}; };
/**
* cdp_txrx_stats_req: stats request wrapper
* used to pass request information to cdp layer
* @stats: type of stats requested
* @param0: opaque argument 0 to be passed to htt
* @param1: opaque argument 1 to be passed to htt
* @param2: opaque argument 2 to be passed to htt
* @param3: opaque argument 3 to be passed to htt
*/
struct cdp_txrx_stats_req {
enum cdp_stats stats;
uint32_t param0;
uint32_t param1;
uint32_t param2;
uint32_t param3;
};
#endif #endif

View File

@@ -210,6 +210,9 @@ struct cdp_cmn_ops {
int (*txrx_stats)(struct cdp_vdev *vdev, enum cdp_stats stats); int (*txrx_stats)(struct cdp_vdev *vdev, enum cdp_stats stats);
int (*txrx_stats_request)(struct cdp_vdev *vdev,
struct cdp_txrx_stats_req *req);
QDF_STATUS (*display_stats)(void *psoc, uint16_t value); QDF_STATUS (*display_stats)(void *psoc, uint16_t value);
void (*txrx_soc_set_nss_cfg)(ol_txrx_soc_handle soc, int config); void (*txrx_soc_set_nss_cfg)(ol_txrx_soc_handle soc, int config);

View File

@@ -4796,36 +4796,47 @@ static void dp_set_pdev_dscp_tid_map_wifi3(struct cdp_pdev *pdev_handle,
/** /**
* dp_fw_stats_process(): Process TxRX FW stats request * dp_fw_stats_process(): Process TxRX FW stats request
* @vdev_handle: DP VDEV handle * @vdev_handle: DP VDEV handle
* @val: value passed by user * @req: stats request
* *
* return: int * return: int
*/ */
static int dp_fw_stats_process(struct cdp_vdev *vdev_handle, uint32_t val) static int dp_fw_stats_process(struct cdp_vdev *vdev_handle,
struct cdp_txrx_stats_req *req)
{ {
struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle;
struct dp_pdev *pdev = NULL; struct dp_pdev *pdev = NULL;
uint32_t stats = req->stats;
if (!vdev) { if (!vdev) {
DP_TRACE(NONE, "VDEV not found"); DP_TRACE(NONE, "VDEV not found");
return 1; return 1;
} }
pdev = vdev->pdev; pdev = vdev->pdev;
return dp_h2t_ext_stats_msg_send(pdev, val, 0, 0, 0, 0);
return dp_h2t_ext_stats_msg_send(pdev, stats, req->param0,
req->param1, req->param2, req->param3);
} }
/* /**
* dp_txrx_stats() - function to map to firmware and host stats * dp_txrx_stats_request - function to map to firmware and host stats
* @vdev: virtual handle * @vdev: virtual handle
* @stats: type of statistics requested * @req: stats request
* *
* Return: integer * Return: integer
*/ */
static int dp_txrx_stats(struct cdp_vdev *vdev, enum cdp_stats stats) static int dp_txrx_stats_request(struct cdp_vdev *vdev,
struct cdp_txrx_stats_req *req)
{ {
int host_stats; int host_stats;
int fw_stats; int fw_stats;
enum cdp_stats stats;
if (!vdev || !req) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"Invalid vdev/req instance");
return 0;
}
stats = req->stats;
if (stats >= CDP_TXRX_MAX_STATS) if (stats >= CDP_TXRX_MAX_STATS)
return 0; return 0;
@@ -4842,8 +4853,11 @@ static int dp_txrx_stats(struct cdp_vdev *vdev, enum cdp_stats stats)
"stats: %u fw_stats_type: %d host_stats_type: %d", "stats: %u fw_stats_type: %d host_stats_type: %d",
stats, fw_stats, host_stats); stats, fw_stats, host_stats);
if (fw_stats != TXRX_FW_STATS_INVALID) if (fw_stats != TXRX_FW_STATS_INVALID) {
return dp_fw_stats_process(vdev, fw_stats); /* update request with FW stats type */
req->stats = fw_stats;
return dp_fw_stats_process(vdev, req);
}
if ((host_stats != TXRX_HOST_STATS_INVALID) && if ((host_stats != TXRX_HOST_STATS_INVALID) &&
(host_stats <= TXRX_HOST_STATS_MAX)) (host_stats <= TXRX_HOST_STATS_MAX))
@@ -4855,6 +4869,22 @@ static int dp_txrx_stats(struct cdp_vdev *vdev, enum cdp_stats stats)
return 0; return 0;
} }
/**
* dp_txrx_stats() - function to map to firmware and host stats
* @vdev: virtual handle
* @stats: type of statistics requested
*
* Return: integer
*/
static int dp_txrx_stats(struct cdp_vdev *vdev, enum cdp_stats stats)
{
struct cdp_txrx_stats_req req = {0,};
req.stats = stats;
return dp_txrx_stats_request(vdev, &req);
}
/* /*
* dp_print_napi_stats(): NAPI stats * dp_print_napi_stats(): NAPI stats
* @soc - soc handle * @soc - soc handle
@@ -5240,6 +5270,7 @@ static struct cdp_cmn_ops dp_ops_cmn = {
.set_vdev_dscp_tid_map = dp_set_vdev_dscp_tid_map_wifi3, .set_vdev_dscp_tid_map = dp_set_vdev_dscp_tid_map_wifi3,
.set_pdev_dscp_tid_map = dp_set_pdev_dscp_tid_map_wifi3, .set_pdev_dscp_tid_map = dp_set_pdev_dscp_tid_map_wifi3,
.txrx_stats = dp_txrx_stats, .txrx_stats = dp_txrx_stats,
.txrx_stats_request = dp_txrx_stats_request,
.txrx_set_monitor_mode = dp_vdev_set_monitor_mode, .txrx_set_monitor_mode = dp_vdev_set_monitor_mode,
.display_stats = dp_txrx_dump_stats, .display_stats = dp_txrx_dump_stats,
.txrx_soc_set_nss_cfg = dp_soc_set_nss_cfg_wifi3, .txrx_soc_set_nss_cfg = dp_soc_set_nss_cfg_wifi3,