From 3634b110185cf2d51ec5bf2103d82f1b152d328c Mon Sep 17 00:00:00 2001 From: Shashikala Prabhu Date: Fri, 24 Feb 2023 16:17:56 +0530 Subject: [PATCH] qcacmn: Add H2T command to trigger MLO UMAC reset Add H2T command to trigger MLO UMAC reset for the given SOCs. Change-Id: Ic205c7eb5c401006a03628c1e591ef5833459516 CRs-Fixed: 3416804 --- dp/wifi3.0/dp_htt.c | 91 +++++++++++++++++++++++++++++++++++++++++++++ dp/wifi3.0/dp_htt.h | 15 ++++++++ 2 files changed, 106 insertions(+) diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index 59a42aed81..afa6923508 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -5238,4 +5238,95 @@ QDF_STATUS dp_htt_umac_reset_send_setup_cmd( dp_info("HTT_H2T_MSG_TYPE_UMAC_HANG_RECOVERY_PREREQUISITE_SETUP sent"); return status; } + +QDF_STATUS dp_htt_umac_reset_send_start_pre_reset_cmd( + struct dp_soc *soc, bool is_initiator, bool is_umac_hang) +{ + struct htt_soc *htt_handle = soc->htt_handle; + uint32_t len; + qdf_nbuf_t msg; + u_int32_t *msg_word; + QDF_STATUS status; + uint8_t *htt_logger_bufp; + struct dp_htt_htc_pkt *pkt; + + len = HTT_MSG_BUF_SIZE( + HTT_H2T_UMAC_HANG_RECOVERY_START_PRE_RESET_BYTES); + + msg = qdf_nbuf_alloc(soc->osdev, + len, + /* reserve room for the HTC header */ + HTC_HEADER_LEN + HTC_HDR_ALIGNMENT_PADDING, + 4, + TRUE); + if (!msg) + return QDF_STATUS_E_NOMEM; + + /* + * Set the length of the message. + * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added + * separately during the below call to qdf_nbuf_push_head. + * The contribution from the HTC header is added separately inside HTC. + */ + if (!qdf_nbuf_put_tail( + msg, HTT_H2T_UMAC_HANG_RECOVERY_START_PRE_RESET_BYTES)) { + dp_htt_err("Failed to expand head"); + qdf_nbuf_free(msg); + return QDF_STATUS_E_FAILURE; + } + + /* fill in the message contents */ + msg_word = (uint32_t *)qdf_nbuf_data(msg); + + /* Rewind beyond alignment pad to get to the HTC header reserved area */ + qdf_nbuf_push_head(msg, HTC_HDR_ALIGNMENT_PADDING); + htt_logger_bufp = (uint8_t *)msg_word; + + qdf_mem_zero(msg_word, + HTT_H2T_UMAC_HANG_RECOVERY_START_PRE_RESET_BYTES); + + HTT_H2T_MSG_TYPE_SET( + *msg_word, + HTT_H2T_MSG_TYPE_UMAC_HANG_RECOVERY_SOC_START_PRE_RESET); + + HTT_H2T_UMAC_HANG_RECOVERY_START_PRE_RESET_IS_INITIATOR_SET( + *msg_word, is_initiator); + + HTT_H2T_UMAC_HANG_RECOVERY_START_PRE_RESET_IS_UMAC_HANG_SET( + *msg_word, is_umac_hang); + + pkt = htt_htc_pkt_alloc(htt_handle); + if (!pkt) { + qdf_err("Fail to allocate dp_htt_htc_pkt buffer"); + qdf_assert(0); + qdf_nbuf_free(msg); + return QDF_STATUS_E_NOMEM; + } + + pkt->soc_ctxt = NULL; /* not used during send-done callback */ + + SET_HTC_PACKET_INFO_TX(&pkt->htc_pkt, + dp_htt_h2t_send_complete_free_netbuf, + qdf_nbuf_data(msg), + qdf_nbuf_len(msg), + htt_handle->htc_endpoint, + /* tag for no FW response msg */ + HTC_TX_PACKET_TAG_RUNTIME_PUT); + + SET_HTC_PACKET_NET_BUF_CONTEXT(&pkt->htc_pkt, msg); + + status = DP_HTT_SEND_HTC_PKT( + htt_handle, pkt, + HTT_H2T_MSG_TYPE_UMAC_HANG_RECOVERY_SOC_START_PRE_RESET, + htt_logger_bufp); + + if (QDF_IS_STATUS_ERROR(status)) { + qdf_nbuf_free(msg); + htt_htc_pkt_free(htt_handle, pkt); + return status; + } + + dp_info("HTT_H2T_MSG_TYPE_UMAC_HANG_RECOVERY_SOC_START_PRE_RESET sent"); + return status; +} #endif diff --git a/dp/wifi3.0/dp_htt.h b/dp/wifi3.0/dp_htt.h index 70db51eabc..3d2703be84 100644 --- a/dp/wifi3.0/dp_htt.h +++ b/dp/wifi3.0/dp_htt.h @@ -1084,6 +1084,21 @@ struct dp_htt_umac_reset_setup_cmd_params { QDF_STATUS dp_htt_umac_reset_send_setup_cmd( struct dp_soc *soc, const struct dp_htt_umac_reset_setup_cmd_params *setup_params); + +/** + * dp_htt_umac_reset_send_start_pre_reset_cmd() - Send the HTT UMAC reset start + * pre reset command + * @soc: dp soc object + * @is_initiator: Indicates whether the target needs to execute the + * UMAC-recovery in context of the Initiator or Non-Initiator. The value zero + * indicates this target is Non-Initiator. + * @is_umac_hang: Indicates whether MLO UMAC recovery executed in context of + * UMAC hang or Target recovery. + * + * Return: Success when HTT message is sent, error on failure + */ +QDF_STATUS dp_htt_umac_reset_send_start_pre_reset_cmd( + struct dp_soc *soc, bool is_initiator, bool is_umac_hang); #endif /**