qcacmn: Configure spectral module for Gen2

-Initialize the default Configuration as
gen2 for spectral module on MCL.
-Add support to general netlink socket.

Change-Id: Iab06f66d18c4791f0ff5483781634df2a7268ddb
CRs-Fixed: 2183870
This commit is contained in:
Sandeep Puligilla
2018-01-26 12:36:08 -08:00
committed by snandini
parent 101778698b
commit cd793f38a3
8 changed files with 113 additions and 21 deletions

View File

@@ -22,6 +22,9 @@
#include <net/netlink.h>
#include <wlan_objmgr_pdev_obj.h>
#include <linux/version.h>
#include <linux/module.h>
#include <linux/kernel.h>
/* NETLINK related declarations */
#if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
@@ -51,4 +54,14 @@ extern struct net init_net;
*/
void os_if_spectral_netlink_init(struct wlan_objmgr_pdev *pdev);
/**
* os_if_spectral_prep_skb() - Prepare socket buffer
* @pdev : Pointer to pdev
*
* Prepare socket buffer to send the data to application layer
*
* Return: NLMSG_DATA of the created skb or NULL if no memory
*/
void *os_if_spectral_prep_skb(struct wlan_objmgr_pdev *pdev);
#endif /* _OS_IF_SPECTRAL_NETLINK_H */

View File

@@ -20,9 +20,16 @@
#include <os_if_spectral_netlink.h>
#include <spectral_cmn_api_i.h>
#include <spectral_defs_i.h>
#include <wlan_nlink_srv.h>
#include <wlan_nlink_common.h>
#ifdef CNSS_GENL
#include <net/cnss_nl.h>
#endif
struct sock *os_if_spectral_nl_sock;
#ifndef CNSS_GENL
static atomic_t spectral_nl_users = ATOMIC_INIT(0);
#endif
#if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
void
@@ -39,6 +46,7 @@ os_if_spectral_nl_data_ready(struct sk_buff *skb)
}
#endif /* VERSION */
#ifndef CNSS_GENL
/**
* os_if_spectral_init_nl_cfg() - Initialize netlink kernel
* configuration parameters
@@ -62,7 +70,6 @@ os_if_spectral_init_nl_cfg(struct netlink_kernel_cfg *cfg)
{
}
#endif
/**
* os_if_spectral_create_nl_sock() - Create Netlink socket
* @cfg : Pointer to netlink_kernel_cfg
@@ -200,15 +207,21 @@ os_if_spectral_destroy_netlink(struct wlan_objmgr_pdev *pdev)
}
return 0;
}
#else
static int
os_if_spectral_init_nl(struct wlan_objmgr_pdev *pdev)
{
return 0;
}
static int
os_if_spectral_destroy_netlink(struct wlan_objmgr_pdev *pdev)
{
return 0;
}
#endif
/**
* os_if_spectral_prep_skb() - Prepare socket buffer
* @pdev : Pointer to pdev
*
* Prepare socket buffer to send the data to application layer
*
* Return: NLMSG_DATA of the created skb or NULL if no memory
*/
void *
os_if_spectral_prep_skb(struct wlan_objmgr_pdev *pdev)
{
@@ -249,6 +262,7 @@ os_if_spectral_prep_skb(struct wlan_objmgr_pdev *pdev)
NLMSG_SPACE(sizeof(struct spectral_samp_msg));
spectral_nlh->nlmsg_pid = 0;
spectral_nlh->nlmsg_flags = 0;
spectral_nlh->nlmsg_type = WLAN_NL_MSG_SPECTRAL_SCAN;
return NLMSG_DATA(spectral_nlh);
}
@@ -285,6 +299,7 @@ os_if_init_spectral_skb_pid_portid(struct sk_buff *skb)
}
#endif
/**
* os_if_spectral_nl_unicast_msg() - Sends unicast Spectral message to user
* space
@@ -292,6 +307,7 @@ os_if_init_spectral_skb_pid_portid(struct sk_buff *skb)
*
* Return: void
*/
#ifndef CNSS_GENL
static int
os_if_spectral_nl_unicast_msg(struct wlan_objmgr_pdev *pdev)
{
@@ -334,7 +350,43 @@ os_if_spectral_nl_unicast_msg(struct wlan_objmgr_pdev *pdev)
return status;
}
#else
static int
os_if_spectral_nl_unicast_msg(struct wlan_objmgr_pdev *pdev)
{
struct pdev_spectral *ps = NULL;
int status;
if (!pdev) {
spectral_err("PDEV is NULL!");
return -EINVAL;
}
ps = wlan_objmgr_pdev_get_comp_private_obj(pdev,
WLAN_UMAC_COMP_SPECTRAL);
if (!ps) {
spectral_err("PDEV SPECTRAL object is NULL!");
return -EINVAL;
}
if (!ps->skb) {
spectral_err("Socket buffer is null");
return -EINVAL;
}
spectral_debug("spectral unicast message");
os_if_init_spectral_skb_pid_portid(ps->skb);
status = nl_srv_ucast(ps->skb, ps->spectral_pid, MSG_DONTWAIT,
WLAN_NL_MSG_SPECTRAL_SCAN, CLD80211_MCGRP_OEM_MSGS);
if (status < 0)
spectral_err("failed to send to spectral scan app");
return status;
}
#endif
/**
* os_if_spectral_nl_bcast_msg() - Sends broadcast Spectral message to user
* space

View File

@@ -13,6 +13,7 @@ include $(obj)/$(DEPTH)/os/linux/Makefile-linux.common
INCS += -I$(HAL) -I$(HAL)/$(OS) -I$(ATH) -I$(ATH_RATE) -I$(ATH_PKTLOG) -I$(WLAN) -I$(IF_WLAN) -I$(ATH_SPECTRAL) -I$(ATHEROSPATH) -I$(obj)/$(DEPTH)/../../apps/spectral/common
INCS += -I$(obj)/$(DEPTH)/cmn_dev/umac/cmn_services/inc -I$(obj)/$(DEPTH)/cmn_dev/umac/cmn_services/obj_mgr/inc
INCS += -I$(obj)/$(DEPTH)/cmn_dev/umac/cmn_services/cmn_defs/inc
INCS += -I$(obj)/$(DEPTH)/cmn_dev/utils/nlink/inc
INCS += -I$(obj)/$(DEPTH)/cmn_dev/umac/scan/dispatcher/inc
INCS += -I$(obj)/$(DEPTH)/cmn_dev/umac/cmn_services/cmn_defs/inc
INCS += -I$(obj)/$(DEPTH)/cmn_dev/umac/global_umac_dispatcher/lmac_if/inc

View File

@@ -43,4 +43,16 @@ int ucfg_spectral_control(struct wlan_objmgr_pdev *pdev,
void *indata,
uint32_t insize, void *outdata, uint32_t *outsize);
/**
* ucfg_spectral_scan_set_ppid() - configure pid of spectral tool
* @pdev: Pointer to pdev
* @ppid: Spectral tool pid
*
* Configure pid of spectral tool
*
* Return: None
*/
void ucfg_spectral_scan_set_ppid(struct wlan_objmgr_pdev *pdev,
uint32_t ppid);
#endif /* _WLAN_SPECTRAL_UCFG_API_H_ */

View File

@@ -44,3 +44,23 @@ ucfg_spectral_control(struct wlan_objmgr_pdev *pdev,
indata, insize, outdata, outsize);
}
EXPORT_SYMBOL(ucfg_spectral_control);
void ucfg_spectral_scan_set_ppid(struct wlan_objmgr_pdev *pdev, uint32_t ppid)
{
struct pdev_spectral *ps = NULL;
if (!pdev) {
spectral_err("PDEV is NULL!");
return;
}
ps = wlan_objmgr_pdev_get_comp_private_obj(pdev,
WLAN_UMAC_COMP_SPECTRAL);
if (!ps) {
spectral_err("spectral context is NULL!");
return;
}
ps->spectral_pid = ppid;
spectral_debug("spectral ppid: %d", ppid);
return;
}

View File

@@ -1967,7 +1967,9 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN3;
spectral->tag_sscan_fft_exp = TLV_TAG_SEARCH_FFT_REPORT_GEN3;
spectral->tlvhdr_size = SPECTRAL_PHYERR_TLVSIZE_GEN3;
} else {
} else
#else
{
spectral->spectral_gen = SPECTRAL_GEN2;
spectral->hdr_sig_exp = SPECTRAL_PHYERR_SIGNATURE_GEN2;
spectral->tag_sscan_summary_exp =
@@ -1975,13 +1977,6 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
spectral->tag_sscan_fft_exp = TLV_TAG_SEARCH_FFT_REPORT_GEN2;
spectral->tlvhdr_size = sizeof(struct spectral_phyerr_tlv_gen2);
}
#else
spectral->spectral_gen = SPECTRAL_GEN3;
spectral->hdr_sig_exp = SPECTRAL_PHYERR_SIGNATURE_GEN3;
spectral->tag_sscan_summary_exp =
TLV_TAG_SPECTRAL_SUMMARY_REPORT_GEN3;
spectral->tag_sscan_fft_exp = TLV_TAG_SEARCH_FFT_REPORT_GEN3;
spectral->tlvhdr_size = SPECTRAL_PHYERR_TLVSIZE_GEN3;
#endif
if (target_if_spectral_attach_simulation(spectral) < 0)
@@ -2022,9 +2017,6 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev)
spectral->is_sec80_rssi_war_required = true;
spectral->use_nl_bcast = true;
#else
spectral->is_160_format = true;
spectral->is_lb_edge_extrabins_format = true;
spectral->is_rb_edge_extrabins_format = true;
spectral->use_nl_bcast = false;
#endif
}

View File

@@ -243,6 +243,7 @@ target_if_spectral_create_samp_msg(struct target_if_spectral *spectral,
target_if_spectral_process_noise_pwr_report(
spectral, spec_samp_msg);
spectral_debug("Recieved sample message");
if (spectral->send_phy_data(spectral->pdev_obj) == 0)
spectral->spectral_sent_msg++;

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
@@ -106,6 +106,7 @@ typedef enum eAniNlModuleTypes {
WLAN_NL_MSG_SVC,
WLAN_NL_MSG_CNSS_DIAG = ANI_NL_MSG_BASE + 0x0B, /* Value needs to be 27 */
ANI_NL_MSG_LOG,
WLAN_NL_MSG_SPECTRAL_SCAN,
ANI_NL_MSG_MAX
} tAniNlModTypes, tWlanNlModTypes;