From 398da54894d88521bf46d7dfe024e248c86d0b07 Mon Sep 17 00:00:00 2001 From: Subash Abhinov Kasiviswanathan Date: Tue, 27 Oct 2020 13:44:13 -0700 Subject: [PATCH] dfc: release WDA client eariler During SSR, release QMI WDA client before waiting for transaction to expire to reduce wait time. Change-Id: I1e60e3830e82f59a86d9d088840f8e1df80e6065 Acked-by: Weiyi Chen Signed-off-by: Subash Abhinov Kasiviswanathan --- core/qmi_rmnet.c | 11 +++++++++-- core/qmi_rmnet_i.h | 4 ++++ core/wda_qmi.c | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/core/qmi_rmnet.c b/core/qmi_rmnet.c index 864f2da0a4bf..3c74fd09dcff 100644 --- a/core/qmi_rmnet.c +++ b/core/qmi_rmnet.c @@ -708,6 +708,7 @@ void qmi_rmnet_change_link(struct net_device *dev, void *port, void *tcm_pt) { struct qmi_info *qmi = (struct qmi_info *)rmnet_get_qmi_pt(port); struct tcmsg *tcm = (struct tcmsg *)tcm_pt; + void *wda_data = NULL; switch (tcm->tcm_family) { case NLMSG_FLOW_ACTIVATE: @@ -750,6 +751,11 @@ void qmi_rmnet_change_link(struct net_device *dev, void *port, void *tcm_pt) return; if (tcm->tcm_handle == 0) { /* instance 0 */ rmnet_clear_powersave_format(port); + if (qmi->wda_client) + wda_data = qmi->wda_client; + else if (qmi->wda_pending) + wda_data = qmi->wda_pending; + wda_qmi_client_release(wda_data); qmi_rmnet_work_exit(port); } qmi_rmnet_delete_client(port, qmi, tcm); @@ -780,13 +786,14 @@ void qmi_rmnet_qmi_exit(void *qmi_pt, void *port) ASSERT_RTNL(); - qmi_rmnet_work_exit(port); - if (qmi->wda_client) data = qmi->wda_client; else if (qmi->wda_pending) data = qmi->wda_pending; + wda_qmi_client_release(data); + qmi_rmnet_work_exit(port); + if (data) { wda_qmi_client_exit(data); qmi->wda_client = NULL; diff --git a/core/qmi_rmnet_i.h b/core/qmi_rmnet_i.h index 924074d5c761..636a5fe966b3 100644 --- a/core/qmi_rmnet_i.h +++ b/core/qmi_rmnet_i.h @@ -224,6 +224,7 @@ wda_qmi_client_init(void *port, struct svc_info *psvc, struct qmi_info *qmi); void wda_qmi_client_exit(void *wda_data); int wda_set_powersave_mode(void *wda_data, u8 enable); void qmi_rmnet_flush_ps_wq(void); +void wda_qmi_client_release(void *wda_data); #else static inline int wda_qmi_client_init(void *port, struct svc_info *psvc, struct qmi_info *qmi) @@ -242,5 +243,8 @@ static inline int wda_set_powersave_mode(void *wda_data, u8 enable) static inline void qmi_rmnet_flush_ps_wq(void) { } +static inline void wda_qmi_client_release(void *wda_data) +{ +} #endif #endif /*_RMNET_QMI_I_H*/ diff --git a/core/wda_qmi.c b/core/wda_qmi.c index 5e3cc106b878..ab0313a3a782 100644 --- a/core/wda_qmi.c +++ b/core/wda_qmi.c @@ -461,7 +461,6 @@ void wda_qmi_client_exit(void *wda_data) data->restart_state = 1; trace_wda_client_state_down(0); - qmi_handle_release(&data->handle); destroy_workqueue(data->wda_wq); kfree(data); } @@ -471,3 +470,10 @@ int wda_set_powersave_mode(void *wda_data, uint8_t enable) trace_wda_set_powersave_mode(enable); return wda_set_powersave_mode_req(wda_data, enable); } + +void wda_qmi_client_release(void *wda_data) +{ + if (!wda_data) + return; + qmi_handle_release(&((struct wda_qmi_data *)wda_data)->handle); +}