From dda4a36a03ff0496f998052c1fd5b08fc038f994 Mon Sep 17 00:00:00 2001 From: Wu Gao Date: Tue, 23 Jul 2019 09:51:27 +0800 Subject: [PATCH] qcacld-3.0: Add version information in SPECTRAL_SCAN_REGISTER_RSP Spectral tool is required to compatible with different version of spectral, so add version information in SPECTRAL_SCAN_REGISTER_RSP. Change-Id: Id766d95463e511209c752a428761fe7f1380c53e CRs-Fixed: 2495259 --- core/hdd/inc/wlan_hdd_spectralscan.h | 21 +++++++++++ core/hdd/src/wlan_hdd_spectralscan.c | 55 +++++++++++++++++++++++++--- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_spectralscan.h b/core/hdd/inc/wlan_hdd_spectralscan.h index 39aad2eb410f..18aee6f04466 100644 --- a/core/hdd/inc/wlan_hdd_spectralscan.h +++ b/core/hdd/inc/wlan_hdd_spectralscan.h @@ -27,6 +27,13 @@ #define WLAN_HDD_SPECTRALSCAN_H #ifdef WLAN_CONV_SPECTRAL_ENABLE + +#define SPECTRAL_VERSION_1 1 +#define SPECTRAL_VERSION_2 2 +#define SPECTRAL_VERSION_3 3 +#define SPECTRAL_SUB_VERSION_0 0 +#define SPECTRAL_SUB_VERSION_1 1 + /* * enum spectral_scan_msg_type - spectral scan registration * @SPECTRAL_SCAN_REGISTER_REQ: spectral scan app register request @@ -47,6 +54,20 @@ struct spectral_scan_msg { uint32_t pid; }; +/** + * struct spectral_scan_msg_v - spectral scan request message included version + * @msg_type: message type + * @pid: process id + * @version: version information + * @sub_version: sub version information + */ +struct spectral_scan_msg_v { + uint32_t msg_type; + uint32_t pid; + uint32_t version; + uint32_t sub_version; +}; + #define FEATURE_SPECTRAL_SCAN_VENDOR_COMMANDS \ { \ .info.vendor_id = QCA_NL80211_VENDOR_ID, \ diff --git a/core/hdd/src/wlan_hdd_spectralscan.c b/core/hdd/src/wlan_hdd_spectralscan.c index 09855c11df13..8b68706c8216 100644 --- a/core/hdd/src/wlan_hdd_spectralscan.c +++ b/core/hdd/src/wlan_hdd_spectralscan.c @@ -394,15 +394,58 @@ int wlan_hdd_cfg80211_spectral_scan_get_status(struct wiphy *wiphy, } #if defined(CNSS_GENL) && defined(WLAN_CONV_SPECTRAL_ENABLE) +static void spectral_get_version(struct wlan_objmgr_pdev *pdev, + uint32_t *version, + uint32_t *sub_version) +{ + struct spectral_cp_request sscan_req; + QDF_STATUS status; + + if (!pdev || !version || !sub_version) { + hdd_err("invalid param"); + return; + } + + sscan_req.ss_mode = SPECTRAL_SCAN_MODE_NORMAL; + sscan_req.req_id = SPECTRAL_GET_CAPABILITY_INFO; + status = ucfg_spectral_control(pdev, &sscan_req); + if (QDF_IS_STATUS_ERROR(status)) { + *version = SPECTRAL_VERSION_2; + *sub_version = SPECTRAL_SUB_VERSION_0; + hdd_err("get spectral cap fail"); + return; + } + + switch (sscan_req.caps_req.sscan_caps.hw_gen) { + case 0: + *version = SPECTRAL_VERSION_1; + *sub_version = SPECTRAL_SUB_VERSION_0; + break; + case 1: + *version = SPECTRAL_VERSION_2; + *sub_version = SPECTRAL_SUB_VERSION_1; + break; + case 2: + *version = SPECTRAL_VERSION_3; + *sub_version = SPECTRAL_SUB_VERSION_0; + break; + default: + *version = SPECTRAL_VERSION_2; + *sub_version = SPECTRAL_SUB_VERSION_0; + hdd_err("invalid hw gen"); + break; + } +} + static void send_spectral_scan_reg_rsp_msg(struct hdd_context *hdd_ctx) { struct sk_buff *skb; struct nlmsghdr *nlh; - struct spectral_scan_msg *rsp_msg; + struct spectral_scan_msg_v *rsp_msg; int err; - skb = alloc_skb(NLMSG_SPACE(sizeof(struct spectral_scan_msg)), - GFP_KERNEL); + skb = alloc_skb(NLMSG_SPACE(sizeof(struct spectral_scan_msg_v)), + GFP_KERNEL); if (!skb) { hdd_err("Skb allocation failed"); return; @@ -417,9 +460,11 @@ static void send_spectral_scan_reg_rsp_msg(struct hdd_context *hdd_ctx) rsp_msg = NLMSG_DATA(nlh); rsp_msg->msg_type = SPECTRAL_SCAN_REGISTER_RSP; rsp_msg->pid = hdd_ctx->sscan_pid; + spectral_get_version(hdd_ctx->pdev, &rsp_msg->version, + &rsp_msg->sub_version); - nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct spectral_scan_msg)); - skb_put(skb, NLMSG_SPACE(sizeof(struct spectral_scan_msg))); + nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct spectral_scan_msg_v)); + skb_put(skb, NLMSG_SPACE(sizeof(struct spectral_scan_msg_v))); hdd_info("sending App Reg Response to process pid %d", hdd_ctx->sscan_pid);