From 3e31e2babdfbd5dc42c51c0ab65941a453d0b542 Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Tue, 13 Aug 2019 19:00:08 +0530 Subject: [PATCH] qcacmn: Add support for checksum from FW for pktlog If the FW sends a pktlog checksum in the FW ready event, store that in pl_dev and use it as buf_hdr.version in the pktlog buffer header. Also, use a new magic value to identify the checksum in the buf_hdr.version field. If the FW does not send the checksum, then the existing magic number and standard version number would be maintained. Change-Id: Ib08c093a9b54495a2c5b7e0e163207f2b1eb4ce2 CRs-Fixed: 2508828 --- target_if/core/inc/target_if.h | 21 +++++++++++++++++++ .../init_deinit/src/init_event_handler.c | 16 ++++++++++++++ wmi/inc/wmi_unified_param.h | 5 +++++ wmi/src/wmi_unified_tlv.c | 1 + 4 files changed, 43 insertions(+) diff --git a/target_if/core/inc/target_if.h b/target_if/core/inc/target_if.h index b28d08d7e9a8..e057891ec829 100644 --- a/target_if/core/inc/target_if.h +++ b/target_if/core/inc/target_if.h @@ -215,6 +215,7 @@ struct tgt_info { * @sw_version_check: Checks the SW version * @smart_log_enable: Enable Smart Logs feature * @cfr_support_enable: CFR support enable + * @set_pktlog_checksum: Set the pktlog checksum from FW ready event to pl_dev */ struct target_ops { QDF_STATUS (*ext_resource_config_enable) @@ -275,6 +276,8 @@ struct target_ops { void (*cfr_support_enable) (struct wlan_objmgr_psoc *psoc, struct target_psoc_info *tgt_info, uint8_t *event); + void (*set_pktlog_checksum) + (struct wlan_objmgr_pdev *pdev, uint32_t checksum); }; @@ -1770,6 +1773,24 @@ static inline void target_if_cfr_support_enable(struct wlan_objmgr_psoc *psoc, tgt_hdl->tif_ops->cfr_support_enable(psoc, tgt_hdl, evt_buf); } +/** + * target_if_set_pktlog_checksum - Set pktlog checksum + * @pdev: pdev object + * @tgt_hdl: target_psoc_info pointer + * @checksum: checksum received from FW + * + * API to set pktlog checksum + * + * Return: none + */ +static inline void target_if_set_pktlog_checksum(struct wlan_objmgr_pdev *pdev, + struct target_psoc_info *tgt_hdl, uint32_t checksum) +{ + if ((tgt_hdl->tif_ops) && + (tgt_hdl->tif_ops->set_pktlog_checksum)) + tgt_hdl->tif_ops->set_pktlog_checksum(pdev, checksum); +} + /** * target_if_atf_cfg_enable - Enable ATF config * @psoc: psoc object diff --git a/target_if/init_deinit/src/init_event_handler.c b/target_if/init_deinit/src/init_event_handler.c index a244c12a6157..7ec5b73f69fb 100644 --- a/target_if/init_deinit/src/init_event_handler.c +++ b/target_if/init_deinit/src/init_event_handler.c @@ -446,6 +446,22 @@ static int init_deinit_ready_event_handler(ol_scn_t scn_handle, } num_radios = target_psoc_get_num_radios(tgt_hdl); + + if (ready_ev.pktlog_defs_checksum) { + for (i = 0; i < num_radios; i++) { + pdev = wlan_objmgr_get_pdev_by_id(psoc, i, + WLAN_INIT_DEINIT_ID); + if (!pdev) { + target_if_err(" PDEV %d is NULL", i); + return -EINVAL; + } + target_if_set_pktlog_checksum(pdev, tgt_hdl, + ready_ev. + pktlog_defs_checksum); + wlan_objmgr_pdev_release_ref(pdev, WLAN_INIT_DEINIT_ID); + } + } + /* * For non-legacy HW, MAC addr list is extracted. */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index cc9c4d558c2d..5c737b059544 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -7108,6 +7108,10 @@ struct coex_config_params { * radar detection, concurrently with using another radio * chain for non-160 MHz regular operation. * @max_ast_index: Max number of AST entries that FW could allocate. + * @pktlog_defs_checksum: checksum computed from the definitions of the enums + * and structs used within pktlog traces. This is sent + * from the FW as part of FW ready event and needs + * to be embedded in the pktlog buffer header as version. */ struct wmi_host_ready_ev_param { uint32_t status; @@ -7117,6 +7121,7 @@ struct wmi_host_ready_ev_param { uint32_t num_extra_peer; bool agile_capability; uint32_t max_ast_index; + uint32_t pktlog_defs_checksum; }; enum bcn_offload_control_param { diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index ec2c18beb964..0577f99571b2 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -8443,6 +8443,7 @@ static QDF_STATUS extract_ready_event_params_tlv(wmi_unified_t wmi_handle, * as per aDFS FR */ ev_param->max_ast_index = ev->max_ast_index; + ev_param->pktlog_defs_checksum = ev->pktlog_defs_checksum; ev_param->agile_capability = 1; return QDF_STATUS_SUCCESS;