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
This commit is contained in:
Wu Gao
2019-07-23 09:51:27 +08:00
committed by nshrivas
parent e012acdedb
commit dda4a36a03
2 changed files with 71 additions and 5 deletions

View File

@@ -27,6 +27,13 @@
#define WLAN_HDD_SPECTRALSCAN_H #define WLAN_HDD_SPECTRALSCAN_H
#ifdef WLAN_CONV_SPECTRAL_ENABLE #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 * enum spectral_scan_msg_type - spectral scan registration
* @SPECTRAL_SCAN_REGISTER_REQ: spectral scan app register request * @SPECTRAL_SCAN_REGISTER_REQ: spectral scan app register request
@@ -47,6 +54,20 @@ struct spectral_scan_msg {
uint32_t pid; 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 \ #define FEATURE_SPECTRAL_SCAN_VENDOR_COMMANDS \
{ \ { \
.info.vendor_id = QCA_NL80211_VENDOR_ID, \ .info.vendor_id = QCA_NL80211_VENDOR_ID, \

View File

@@ -394,15 +394,58 @@ int wlan_hdd_cfg80211_spectral_scan_get_status(struct wiphy *wiphy,
} }
#if defined(CNSS_GENL) && defined(WLAN_CONV_SPECTRAL_ENABLE) #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) static void send_spectral_scan_reg_rsp_msg(struct hdd_context *hdd_ctx)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
struct spectral_scan_msg *rsp_msg; struct spectral_scan_msg_v *rsp_msg;
int err; int err;
skb = alloc_skb(NLMSG_SPACE(sizeof(struct spectral_scan_msg)), skb = alloc_skb(NLMSG_SPACE(sizeof(struct spectral_scan_msg_v)),
GFP_KERNEL); GFP_KERNEL);
if (!skb) { if (!skb) {
hdd_err("Skb allocation failed"); hdd_err("Skb allocation failed");
return; 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 = NLMSG_DATA(nlh);
rsp_msg->msg_type = SPECTRAL_SCAN_REGISTER_RSP; rsp_msg->msg_type = SPECTRAL_SCAN_REGISTER_RSP;
rsp_msg->pid = hdd_ctx->sscan_pid; 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)); nlh->nlmsg_len = NLMSG_LENGTH(sizeof(struct spectral_scan_msg_v));
skb_put(skb, NLMSG_SPACE(sizeof(struct spectral_scan_msg))); skb_put(skb, NLMSG_SPACE(sizeof(struct spectral_scan_msg_v)));
hdd_info("sending App Reg Response to process pid %d", hdd_info("sending App Reg Response to process pid %d",
hdd_ctx->sscan_pid); hdd_ctx->sscan_pid);