From 43194935627485b509327929688b5405dbd5810e Mon Sep 17 00:00:00 2001 From: Ruben Columbus Date: Fri, 24 May 2019 09:56:52 -0700 Subject: [PATCH] qcacmn: ring backpressure handler rxhost ring backpressure: identifying rings causing rx backpressure after being notified by FW message. Adding logs to be able to see at what state the ap was after a backpressure event was triggered. Adding radio stats (261) as well as napi stats for better state description. Change-Id: I395450be6faaf959f91729516a7b229c5b3396ce --- dp/wifi3.0/dp_htt.c | 68 ++++++++++++++++++++++++++++++++++++++++++++ dp/wifi3.0/dp_main.c | 2 +- dp/wifi3.0/dp_rx.h | 1 + 3 files changed, 70 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index c10607d673..87bc8967be 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -26,6 +26,7 @@ #include "htt_stats.h" #include "htt_ppdu_stats.h" #include "dp_htt.h" +#include "dp_rx.h" #include "qdf_mem.h" /* qdf_mem_malloc,free */ #include "cdp_txrx_cmn_struct.h" @@ -3488,6 +3489,57 @@ dp_pktlog_msg_handler(struct htt_soc *soc, { } #endif + +static void dp_htt_alert_print(enum htt_t2h_msg_type msg_type, + u_int8_t pdev_id, u_int8_t ring_id, + u_int16_t hp_idx, u_int16_t tp_idx, + u_int32_t bkp_time, char *ring_stype) +{ + dp_alert("msg_type: %d pdev_id: %d ring_type: %s ", + msg_type, pdev_id, ring_stype); + dp_alert("ring_id: %d hp_idx: %d tp_idx: %d bkpressure_time_ms: %d ", + ring_id, hp_idx, tp_idx, bkp_time); +} + +static void dp_htt_bkp_event_alert(u_int32_t *msg_word) +{ + u_int8_t ring_type; + u_int8_t pdev_id; + u_int8_t ring_id; + u_int16_t hp_idx; + u_int16_t tp_idx; + u_int32_t bkp_time; + enum htt_t2h_msg_type msg_type; + + msg_type = HTT_T2H_MSG_TYPE_GET(*msg_word); + ring_type = HTT_T2H_RX_BKPRESSURE_RING_TYPE_GET(*msg_word); + pdev_id = HTT_T2H_RX_BKPRESSURE_PDEV_ID_GET(*msg_word); + pdev_id = DP_HW2SW_MACID(pdev_id); + ring_id = HTT_T2H_RX_BKPRESSURE_RINGID_GET(*msg_word); + hp_idx = HTT_T2H_RX_BKPRESSURE_HEAD_IDX_GET(*(msg_word + 1)); + tp_idx = HTT_T2H_RX_BKPRESSURE_TAIL_IDX_GET(*(msg_word + 1)); + bkp_time = HTT_T2H_RX_BKPRESSURE_TIME_MS_GET(*(msg_word + 2)); + + switch (ring_type) { + case HTT_SW_RING_TYPE_UMAC: + dp_htt_alert_print(msg_type, pdev_id, ring_id, hp_idx, tp_idx, + bkp_time, "HTT_SW_RING_TYPE_LMAC"); + break; + case HTT_SW_RING_TYPE_LMAC: + dp_htt_alert_print(msg_type, pdev_id, ring_id, hp_idx, tp_idx, + bkp_time, "HTT_SW_RING_TYPE_LMAC"); + break; + case HTT_SW_RING_TYPE_MAX: + dp_htt_alert_print(msg_type, pdev_id, ring_id, hp_idx, tp_idx, + bkp_time, "HTT_SW_RING_TYPE_MAX"); + break; + default: + dp_htt_alert_print(msg_type, pdev_id, ring_id, hp_idx, tp_idx, + bkp_time, "UNKNOWN"); + break; + } +} + /* * dp_htt_t2h_msg_handler() - Generic Target to host Msg/event handler * @context: Opaque context (HTT SOC handle) @@ -3517,6 +3569,22 @@ static void dp_htt_t2h_msg_handler(void *context, HTC_PACKET *pkt) htt_event_record(soc->htt_logger_handle, msg_type, (uint8_t *)msg_word); switch (msg_type) { + case HTT_T2H_MSG_TYPE_BKPRESSURE_EVENT_IND: + { + u_int8_t pdev_id; + struct dp_soc *dpsoc; + struct dp_pdev *pdev; + + pdev_id = HTT_T2H_RX_BKPRESSURE_PDEV_ID_GET(*msg_word); + pdev_id = DP_HW2SW_MACID(pdev_id); + dpsoc = (struct dp_soc *)soc->dp_soc; + pdev = (struct dp_pdev *)dpsoc->pdev_list[pdev_id]; + + dp_htt_bkp_event_alert(msg_word); + dp_print_ring_stats(pdev); + dp_print_napi_stats(pdev->soc); + break; + } case HTT_T2H_MSG_TYPE_PEER_MAP: { u_int8_t mac_addr_deswizzle_buf[QDF_MAC_ADDR_SIZE]; diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 8b93963bb2..0f4c2cd0a5 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -6988,7 +6988,7 @@ char *dp_srng_get_str_from_hal_ring_type(enum hal_ring_type ring_type) * dp_print_napi_stats(): NAPI stats * @soc - soc handle */ -static void dp_print_napi_stats(struct dp_soc *soc) +void dp_print_napi_stats(struct dp_soc *soc) { hif_print_napi_stats(soc->hif_handle); } diff --git a/dp/wifi3.0/dp_rx.h b/dp/wifi3.0/dp_rx.h index 7e7a1eb9c8..138222e877 100644 --- a/dp/wifi3.0/dp_rx.h +++ b/dp/wifi3.0/dp_rx.h @@ -443,6 +443,7 @@ QDF_STATUS dp_rx_pdev_attach(struct dp_pdev *pdev); void dp_rx_pdev_detach(struct dp_pdev *pdev); +void dp_print_napi_stats(struct dp_soc *soc); uint32_t dp_rx_process(struct dp_intr *int_ctx, hal_ring_handle_t hal_ring_hdl,