From 919ecb00a722726e6068565f03499b7587d81366 Mon Sep 17 00:00:00 2001 From: Ryan Hsu Date: Tue, 24 Jul 2018 18:59:40 -0700 Subject: [PATCH] qcacmn: add utf event exception handler for invalid pdev_id For the case in DBS, the psoc and pdev is one-to-one mapping, but firmware will send per pdev_id information to host according to the radio being tested, add a backup query to SOC_ID if the pdev_id passed along from utf_event is invalid/unsupported to work around this case. Change-Id: I67645da67a968b66b720f211a9a0815a4cc22845 CRs-fixed: 2286291 --- target_if/core/inc/target_if.h | 2 ++ target_if/ftm/src/target_if_ftm.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/target_if/core/inc/target_if.h b/target_if/core/inc/target_if.h index c852c9d0e1..dda24e8835 100644 --- a/target_if/core/inc/target_if.h +++ b/target_if/core/inc/target_if.h @@ -30,6 +30,8 @@ #include "wmi_unified_priv.h" #include "wmi_unified_param.h" +#define TGT_WMI_PDEV_ID_SOC 0 /* WMI SOC ID */ + /* ASCII "TGT\0" */ #define TGT_MAGIC 0x54575400 diff --git a/target_if/ftm/src/target_if_ftm.c b/target_if/ftm/src/target_if_ftm.c index 40a916dd8e..c27f074357 100644 --- a/target_if/ftm/src/target_if_ftm.c +++ b/target_if/ftm/src/target_if_ftm.c @@ -43,6 +43,7 @@ target_if_ftm_process_utf_event(ol_scn_t sc, uint8_t *event_buf, uint32_t len) struct wmi_host_pdev_utf_event event; struct wlan_lmac_if_ftm_rx_ops *ftm_rx_ops; QDF_STATUS status = QDF_STATUS_E_FAILURE; + uint32_t pdev_id; psoc = target_if_get_psoc_from_scn_hdl(sc); if (!psoc) { @@ -64,11 +65,18 @@ target_if_ftm_process_utf_event(ol_scn_t sc, uint8_t *event_buf, uint32_t len) return QDF_STATUS_E_INVAL; } - pdev = wlan_objmgr_get_pdev_by_id(psoc, event.pdev_id, WLAN_FTM_ID); + pdev_id = event.pdev_id; + pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, WLAN_FTM_ID); if (!pdev) { - ftm_err("null pdev"); - wlan_objmgr_psoc_release_ref(psoc, WLAN_FTM_ID); - return QDF_STATUS_E_INVAL; + pdev_id = TGT_WMI_PDEV_ID_SOC; + ftm_debug("Can't find pdev by pdev_id %d, try soc_id", + event.pdev_id); + pdev = wlan_objmgr_get_pdev_by_id(psoc, pdev_id, WLAN_FTM_ID); + if (!pdev) { + ftm_err("null pdev"); + wlan_objmgr_psoc_release_ref(psoc, WLAN_FTM_ID); + return QDF_STATUS_E_INVAL; + } } ftm_rx_ops = target_if_ftm_get_rx_ops(psoc);