diff --git a/core/dp/txrx/ol_tx_send.c b/core/dp/txrx/ol_tx_send.c index b097182da4b7..a55ab61aaae5 100644 --- a/core/dp/txrx/ol_tx_send.c +++ b/core/dp/txrx/ol_tx_send.c @@ -1297,36 +1297,56 @@ ol_tx_inspect_handler(ol_txrx_pdev_handle pdev, #ifdef QCA_COMPUTE_TX_DELAY /** - * @brief updates the compute interval period for TSM stats. - * @details - * @param interval - interval for stats computation + * ol_tx_set_compute_interval - updates the compute interval + * period for TSM stats. + * @soc_hdl: Datapath soc handle + * @pdev_id: id of data path pdev handle + * @param interval: interval for stats computation + * + * Return: None */ -void ol_tx_set_compute_interval(struct cdp_pdev *ppdev, uint32_t interval) +void ol_tx_set_compute_interval(struct cdp_soc_t *soc_hdl, + uint8_t pdev_id, uint32_t interval) { - struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev; + struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); + ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); + + if (!pdev) { + ol_txrx_err("pdev is NULL"); + return; + } pdev->tx_delay.avg_period_ticks = qdf_system_msecs_to_ticks(interval); } /** - * @brief Return the uplink (transmitted) packet count and loss count. - * @details + * ol_tx_packet_count() - Return the uplink (transmitted) packet count + and loss count. + * @soc_hdl: soc handle + * @pdev_id: pdev identifier + * @out_packet_count - number of packets transmitted + * @out_packet_loss_count - number of packets lost + * @category - access category of interest + * * This function will be called for getting uplink packet count and * loss count for given stream (access category) a regular interval. * This also resets the counters hence, the value returned is packets * counted in last 5(default) second interval. These counter are * incremented per access category in ol_tx_completion_handler() - * - * @param category - access category of interest - * @param out_packet_count - number of packets transmitted - * @param out_packet_loss_count - number of packets lost */ void -ol_tx_packet_count(struct cdp_pdev *ppdev, +ol_tx_packet_count(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, uint16_t *out_packet_count, uint16_t *out_packet_loss_count, int category) { - struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev; + struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); + ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); + + if (!pdev) { + ol_txrx_err("pdev is NULL"); + return; + } + *out_packet_count = pdev->packet_count[category]; *out_packet_loss_count = pdev->packet_loss_count[category]; pdev->packet_count[category] = 0; @@ -1351,17 +1371,23 @@ static uint32_t ol_tx_delay_avg(uint64_t sum, uint32_t num) } void -ol_tx_delay(struct cdp_pdev *ppdev, +ol_tx_delay(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, uint32_t *queue_delay_microsec, uint32_t *tx_delay_microsec, int category) { - struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev; + struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); + ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); int index; uint32_t avg_delay_ticks; struct ol_tx_delay_data *data; qdf_assert(category >= 0 && category < QCA_TX_DELAY_NUM_CATEGORIES); + if (!pdev) { + ol_txrx_err("pdev is NULL"); + return; + } + qdf_spin_lock_bh(&pdev->tx_delay.mutex); index = 1 - pdev->tx_delay.cats[category].in_progress_idx; @@ -1398,15 +1424,21 @@ ol_tx_delay(struct cdp_pdev *ppdev, } void -ol_tx_delay_hist(struct cdp_pdev *ppdev, +ol_tx_delay_hist(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, uint16_t *report_bin_values, int category) { - struct ol_txrx_pdev_t *pdev = (struct ol_txrx_pdev_t *)ppdev; + struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); + ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); int index, i, j; struct ol_tx_delay_data *data; qdf_assert(category >= 0 && category < QCA_TX_DELAY_NUM_CATEGORIES); + if (!pdev) { + ol_txrx_err("pdev is NULL"); + return; + } + qdf_spin_lock_bh(&pdev->tx_delay.mutex); index = 1 - pdev->tx_delay.cats[category].in_progress_idx; diff --git a/core/dp/txrx/ol_tx_send.h b/core/dp/txrx/ol_tx_send.h index 666c5ee30cfd..480c6c03b7a6 100644 --- a/core/dp/txrx/ol_tx_send.h +++ b/core/dp/txrx/ol_tx_send.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2011, 2014-2019 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 @@ -86,16 +86,19 @@ ol_tx_send_nonstd(struct ol_txrx_pdev_t *pdev, #ifdef QCA_COMPUTE_TX_DELAY /** * ol_tx_set_compute_interval() - update compute interval period for TSM stats - * @ppdev: physical device instance + * @soc_hdl: Datapath soc handle + * @pdev_id: id of data path pdev handle * @interval: interval for stats computation * * Return: NONE */ -void ol_tx_set_compute_interval(struct cdp_pdev *ppdev, uint32_t interval); +void ol_tx_set_compute_interval(struct cdp_soc_t *soc_hdl, + uint8_t pdev_id, uint32_t interval); /** * ol_tx_packet_count() - Return the uplink (transmitted) packet counts - * @ppdev: physical device instance + * @soc_hdl: Datapath soc handle + * @pdev_id: id of data path pdev handle * @out_packet_count: number of packets transmitted * @out_packet_loss_count: number of packets lost * @category: access category of interest @@ -109,13 +112,14 @@ void ol_tx_set_compute_interval(struct cdp_pdev *ppdev, uint32_t interval); * Return: NONE */ void -ol_tx_packet_count(struct cdp_pdev *ppdev, +ol_tx_packet_count(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, uint16_t *out_packet_count, uint16_t *out_packet_loss_count, int category); /** * ol_tx_delay() - get tx packet delay - * @ppdev: physical device instance + * @soc_hdl: Datapath soc handle + * @pdev_id: id of data path pdev handle * @queue_delay_microsec: tx packet delay within queue, usec * @tx_delay_microsec: tx packet delay, usec * @category: packet category @@ -123,20 +127,21 @@ ol_tx_packet_count(struct cdp_pdev *ppdev, * Return: NONE */ void -ol_tx_delay(struct cdp_pdev *ppdev, +ol_tx_delay(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, uint32_t *queue_delay_microsec, uint32_t *tx_delay_microsec, int category); /** * ol_tx_delay_hist() - get tx packet delay histogram - * @ppdev: physical device instance + * @soc_hdl: Datapath soc handle + * @pdev_id: id of data path pdev handle * @report_bin_values: bin * @category: packet category * * Return: NONE */ void -ol_tx_delay_hist(struct cdp_pdev *ppdev, +ol_tx_delay_hist(struct cdp_soc_t *soc_hdl, uint8_t pdev_id, uint16_t *report_bin_values, int category); #endif /* QCA_COMPUTE_TX_DELAY */ diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index a299c304b7c9..cac05c956609 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -2791,17 +2791,11 @@ static QDF_STATUS wma_set_tsm_interval(struct add_ts_param *req) * */ uint32_t interval_milliseconds; - struct cdp_pdev *pdev = cds_get_context(QDF_MODULE_ID_TXRX); - - if (!pdev) { - WMA_LOGE("%s: Failed to get pdev", __func__); - return QDF_STATUS_E_FAILURE; - } interval_milliseconds = (req->tsm_interval * 1024) / 1000; cdp_tx_set_compute_interval(cds_get_context(QDF_MODULE_ID_SOC), - pdev, + WMI_PDEV_ID_SOC, interval_milliseconds); return QDF_STATUS_SUCCESS; } @@ -2874,25 +2868,18 @@ QDF_STATUS wma_process_tsm_stats_req(tp_wma_handle wma_handler, * than required by TSM, hence different (6) size array used */ uint16_t bin_values[QCA_TX_DELAY_HIST_REPORT_BINS] = { 0, }; - struct cdp_pdev *pdev = cds_get_context(QDF_MODULE_ID_TXRX); void *soc = cds_get_context(QDF_MODULE_ID_SOC); - if (!pdev) { - WMA_LOGE("%s: Failed to get pdev", __func__); - qdf_mem_free(pTsmStatsMsg); - return QDF_STATUS_E_INVAL; - } - /* get required values from data path APIs */ cdp_tx_delay(soc, - pdev, + WMI_PDEV_ID_SOC, &queue_delay_microsec, &tx_delay_microsec, tid); cdp_tx_delay_hist(soc, - pdev, + WMI_PDEV_ID_SOC, bin_values, tid); cdp_tx_packet_count(soc, - pdev, + WMI_PDEV_ID_SOC, &packet_count, &packet_loss_count, tid);