qcacmn: Callback functions for legacy spectral apis
Use table of function pointers for legacy api calls instead of calling legacy apis directely CRs-Fixed: 2146231 Change-Id: Ia5840208d0de5bd4e78c1d27b8ffdc0cf6cbf298
This commit is contained in:

committed by
snandini

parent
d8c6a467dd
commit
e0c7fbdb93
@@ -28,9 +28,6 @@
|
||||
#include <wlan_cfg80211.h>
|
||||
#include <wlan_osif_priv.h>
|
||||
#include <qdf_mem.h>
|
||||
#ifdef WLAN_POLICY_MGR_ENABLE
|
||||
#include <wlan_policy_mgr_api.h>
|
||||
#endif
|
||||
#include <wlan_spectral_ucfg_api.h>
|
||||
#include <wlan_cfg80211_spectral.h>
|
||||
#include <spectral_ioctl.h>
|
||||
@@ -105,7 +102,7 @@ static void wlan_spectral_intit_config(struct spectral_config *config_req)
|
||||
config_req->ss_pwr_format = SPECTRAL_PHYERR_PARAM_NOVAL;
|
||||
config_req->ss_rpt_mode = SPECTRAL_PHYERR_PARAM_NOVAL;
|
||||
config_req->ss_bin_scale = SPECTRAL_PHYERR_PARAM_NOVAL;
|
||||
config_req->ss_dBm_adj = SPECTRAL_PHYERR_PARAM_NOVAL;
|
||||
config_req->ss_dbm_adj = SPECTRAL_PHYERR_PARAM_NOVAL;
|
||||
config_req->ss_chn_mask = SPECTRAL_PHYERR_PARAM_NOVAL;
|
||||
}
|
||||
|
||||
@@ -378,7 +375,7 @@ int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy,
|
||||
[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_BIN_SCALE]);
|
||||
|
||||
if (tb[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_DBM_ADJ])
|
||||
config_req.ss_dBm_adj = nla_get_u32(tb
|
||||
config_req.ss_dbm_adj = nla_get_u32(tb
|
||||
[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_DBM_ADJ]);
|
||||
|
||||
if (tb[QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_CHN_MASK])
|
||||
@@ -521,7 +518,7 @@ int wlan_cfg80211_spectral_scan_get_config(struct wiphy *wiphy,
|
||||
config_buf.ss_bin_scale) ||
|
||||
nla_put_u32(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_DBM_ADJ,
|
||||
config_buf.ss_dBm_adj) ||
|
||||
config_buf.ss_dbm_adj) ||
|
||||
nla_put_u32(skb,
|
||||
QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CONFIG_CHN_MASK,
|
||||
config_buf.ss_chn_mask) ||
|
||||
|
@@ -131,5 +131,56 @@ struct spectral_context *spectral_get_spectral_ctx_from_pdev(
|
||||
return sc;
|
||||
}
|
||||
|
||||
/**
|
||||
* spectral_get_spectral_ctx_from_pscoc() - API to get spectral context object
|
||||
* from psoc
|
||||
* @psoc : Reference to psoc global object
|
||||
*
|
||||
* This API used to get spectral context object from global psoc reference.
|
||||
* Null check should be done before invoking this inline function.
|
||||
*
|
||||
* Return : Reference to spectral_context object
|
||||
*/
|
||||
static inline
|
||||
struct spectral_context *spectral_get_spectral_ctx_from_psoc(
|
||||
struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct spectral_context *sc = NULL;
|
||||
|
||||
if (psoc) {
|
||||
sc = wlan_objmgr_psoc_get_comp_private_obj(
|
||||
psoc,
|
||||
WLAN_UMAC_COMP_SPECTRAL);
|
||||
}
|
||||
|
||||
return sc;
|
||||
}
|
||||
|
||||
/**
|
||||
* spectral_get_spectral_ctx_from_vdev() - API to get spectral context object
|
||||
* from vdev
|
||||
* @vdev : Reference to vdev global object
|
||||
*
|
||||
* This API used to get spectral context object from global vdev reference.
|
||||
* Null check should be done before invoking this inline function.
|
||||
*
|
||||
* Return : Reference to spectral_context object
|
||||
*/
|
||||
static inline
|
||||
struct spectral_context *spectral_get_spectral_ctx_from_vdev(
|
||||
struct wlan_objmgr_vdev *vdev)
|
||||
{
|
||||
struct wlan_objmgr_psoc *psoc = NULL;
|
||||
struct spectral_context *sc = NULL;
|
||||
|
||||
psoc = wlan_vdev_get_psoc(vdev);
|
||||
if (psoc) {
|
||||
sc = wlan_objmgr_psoc_get_comp_private_obj(
|
||||
psoc,
|
||||
WLAN_UMAC_COMP_SPECTRAL);
|
||||
}
|
||||
|
||||
return sc;
|
||||
}
|
||||
#endif /* _SPECTRAL_CMN_API_I_H_*/
|
||||
|
||||
|
@@ -65,6 +65,7 @@ spectral_get_vdev(struct wlan_objmgr_pdev *pdev)
|
||||
return vdev;
|
||||
}
|
||||
|
||||
#ifndef CONFIG_MCL
|
||||
static void spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
wlan_cfg80211_register_spectral_cmd_handler(
|
||||
@@ -92,6 +93,11 @@ static void spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
|
||||
SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX,
|
||||
wlan_cfg80211_spectral_scan_get_status);
|
||||
}
|
||||
#else
|
||||
static void spectral_register_cfg80211_handlers(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
int spectral_control_cmn(
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
@@ -433,7 +439,7 @@ case SPECTRAL_GET_DEBUG_LEVEL:
|
||||
if (!vdev)
|
||||
return -ENOENT;
|
||||
|
||||
chan_width = wlan_vdev_get_ch_width(vdev);
|
||||
chan_width = spectral_vdev_get_ch_width(vdev);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
|
||||
|
||||
if (!outdata || !outsize ||
|
||||
|
@@ -24,10 +24,12 @@
|
||||
#include <wlan_objmgr_global_obj.h>
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include <wlan_objmgr_pdev_obj.h>
|
||||
#include <wlan_objmgr_vdev_obj.h>
|
||||
#include <qdf_list.h>
|
||||
#include <qdf_timer.h>
|
||||
#include <qdf_util.h>
|
||||
#include <wlan_spectral_public_structs.h>
|
||||
#include <wlan_spectral_utils_api.h>
|
||||
#include <if_athioctl.h>
|
||||
#include <spectral_ioctl.h>
|
||||
|
||||
@@ -84,6 +86,7 @@ struct wmi_spectral_cmd_ops;
|
||||
*/
|
||||
struct spectral_context {
|
||||
struct wlan_objmgr_psoc *psoc_obj;
|
||||
struct spectral_legacy_cbacks legacy_cbacks;
|
||||
int (*sptrlc_spectral_control)(struct wlan_objmgr_pdev *pdev, u_int id,
|
||||
void *indata, u_int32_t insize,
|
||||
void *outdata, u_int32_t *outsize);
|
||||
|
@@ -67,4 +67,23 @@ void wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops);
|
||||
void wlan_register_wmi_spectral_cmd_ops(
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
struct wmi_spectral_cmd_ops *cmd_ops);
|
||||
|
||||
/**
|
||||
* struct spectral_legacy_cbacks - Spectral legacy callbacks
|
||||
* @vdev_get_chan_freq: Get channel frequency
|
||||
* @vdev_get_ch_width: Get channel width
|
||||
* @vdev_get_sec20chan_freq_mhz: Get seconadry 20 frequency
|
||||
*/
|
||||
struct spectral_legacy_cbacks {
|
||||
int16_t (*vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev);
|
||||
enum phy_ch_width (*vdev_get_ch_width)(struct wlan_objmgr_vdev *vdev);
|
||||
int (*vdev_get_sec20chan_freq_mhz)(struct wlan_objmgr_vdev *vdev,
|
||||
uint16_t *sec20chan_freq);
|
||||
};
|
||||
|
||||
QDF_STATUS spectral_register_legacy_cb(struct wlan_objmgr_psoc *psoc,
|
||||
struct spectral_legacy_cbacks *legacy_cbacks);
|
||||
|
||||
enum phy_ch_width spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev);
|
||||
|
||||
#endif /* _WLAN_SPECTRAL_UTILS_API_H_*/
|
||||
|
@@ -82,6 +82,53 @@ QDF_STATUS wlan_spectral_deinit(void)
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS spectral_register_legacy_cb(struct wlan_objmgr_psoc *psoc,
|
||||
struct spectral_legacy_cbacks *legacy_cbacks)
|
||||
{
|
||||
struct spectral_context *sc;
|
||||
|
||||
sc = spectral_get_spectral_ctx_from_psoc(psoc);
|
||||
if (!sc) {
|
||||
spectral_err("Invalid Context");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
sc->legacy_cbacks.vdev_get_chan_freq =
|
||||
legacy_cbacks->vdev_get_chan_freq;
|
||||
sc->legacy_cbacks.vdev_get_ch_width =
|
||||
legacy_cbacks->vdev_get_ch_width;
|
||||
sc->legacy_cbacks.vdev_get_sec20chan_freq_mhz =
|
||||
legacy_cbacks->vdev_get_sec20chan_freq_mhz;
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
EXPORT_SYMBOL(spectral_register_legacy_cb);
|
||||
|
||||
int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
|
||||
{
|
||||
struct spectral_context *sc;
|
||||
|
||||
sc = spectral_get_spectral_ctx_from_vdev(vdev);
|
||||
return sc->legacy_cbacks.vdev_get_chan_freq(vdev);
|
||||
}
|
||||
|
||||
enum phy_ch_width spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev)
|
||||
{
|
||||
struct spectral_context *sc;
|
||||
|
||||
sc = spectral_get_spectral_ctx_from_vdev(vdev);
|
||||
return sc->legacy_cbacks.vdev_get_ch_width(vdev);
|
||||
}
|
||||
|
||||
int spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
|
||||
uint16_t *sec20chan_freq)
|
||||
{
|
||||
struct spectral_context *sc;
|
||||
|
||||
sc = spectral_get_spectral_ctx_from_vdev(vdev);
|
||||
return sc->legacy_cbacks.vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq);
|
||||
}
|
||||
|
||||
void wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
|
||||
{
|
||||
struct wlan_lmac_if_sptrl_rx_ops *sptrl_rx_ops = &rx_ops->sptrl_rx_ops;
|
||||
@@ -89,6 +136,10 @@ void wlan_lmac_if_sptrl_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops)
|
||||
/* Spectral rx ops */
|
||||
sptrl_rx_ops->sptrlro_send_phydata = tgt_send_phydata;
|
||||
sptrl_rx_ops->sptrlro_get_target_handle = tgt_get_target_handle;
|
||||
sptrl_rx_ops->sptrlro_vdev_get_chan_freq = spectral_vdev_get_chan_freq;
|
||||
sptrl_rx_ops->sptrlro_vdev_get_ch_width = spectral_vdev_get_ch_width;
|
||||
sptrl_rx_ops->sptrlro_vdev_get_sec20chan_freq_mhz =
|
||||
spectral_vdev_get_sec20chan_freq_mhz;
|
||||
}
|
||||
|
||||
void wlan_register_wmi_spectral_cmd_ops(
|
||||
|
@@ -940,7 +940,7 @@ u_int32_t target_if_spectral_get_extension_channel(void *arg)
|
||||
if (!vdev)
|
||||
return 0;
|
||||
|
||||
if (wlan_vdev_get_sec20chan_freq_mhz(vdev, &sec20chan_freq) < 0) {
|
||||
if (target_if_vdev_get_sec20chan_freq_mhz(vdev, &sec20chan_freq) < 0) {
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
|
||||
return 0;
|
||||
}
|
||||
@@ -974,7 +974,7 @@ u_int32_t target_if_spectral_get_current_channel(void *arg)
|
||||
if (!vdev)
|
||||
return 0;
|
||||
|
||||
chan_freq = wlan_vdev_get_chan_freq(vdev);
|
||||
chan_freq = target_if_vdev_get_chan_freq(vdev);
|
||||
if (chan_freq < 0) {
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
|
||||
return 0;
|
||||
@@ -1967,7 +1967,7 @@ static int target_if_spectral_scan_enable_params(
|
||||
if (!vdev)
|
||||
return 1;
|
||||
|
||||
spectral->ch_width = wlan_vdev_get_ch_width(vdev);
|
||||
spectral->ch_width = target_if_vdev_get_ch_width(vdev);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_SPECTRAL_ID);
|
||||
|
||||
if (spectral->ch_width == CH_WIDTH_INVALID)
|
||||
|
@@ -939,6 +939,40 @@ struct target_if_spectral *get_target_if_spectral_handle_from_pdev(
|
||||
return spectral;
|
||||
}
|
||||
|
||||
static inline
|
||||
int16_t target_if_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev)
|
||||
{
|
||||
struct wlan_objmgr_psoc *psoc = NULL;
|
||||
|
||||
psoc = wlan_vdev_get_psoc(vdev);
|
||||
|
||||
return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_chan_freq(
|
||||
vdev);
|
||||
}
|
||||
|
||||
static inline
|
||||
enum phy_ch_width target_if_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev)
|
||||
{
|
||||
struct wlan_objmgr_psoc *psoc = NULL;
|
||||
|
||||
psoc = wlan_vdev_get_psoc(vdev);
|
||||
|
||||
return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_ch_width(
|
||||
vdev);
|
||||
}
|
||||
|
||||
static inline
|
||||
int target_if_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev,
|
||||
uint16_t *sec20chan_freq)
|
||||
{
|
||||
struct wlan_objmgr_psoc *psoc = NULL;
|
||||
|
||||
psoc = wlan_vdev_get_psoc(vdev);
|
||||
|
||||
return psoc->soc_cb.rx_ops.sptrl_rx_ops.
|
||||
sptrlro_vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq);
|
||||
}
|
||||
|
||||
/**
|
||||
* target_if_spectral_set_rxchainmask() - Set Spectral Rx chainmask
|
||||
* @pdev: Pointer to pdev
|
||||
|
@@ -848,7 +848,7 @@ u_int32_t tif_spectral_sim_configure_params(
|
||||
return 0;
|
||||
}
|
||||
|
||||
bw = wlan_vdev_get_ch_width(vdev);
|
||||
bw = target_if_vdev_get_ch_width(vdev);
|
||||
|
||||
switch (bw) {
|
||||
case CH_WIDTH_20MHZ:
|
||||
|
@@ -760,6 +760,12 @@ struct wlan_lmac_if_sptrl_rx_ops {
|
||||
int (*sptrlro_send_phydata)(struct wlan_objmgr_pdev *pdev,
|
||||
struct sock *sock, qdf_nbuf_t nbuf);
|
||||
void * (*sptrlro_get_target_handle)(struct wlan_objmgr_pdev *pdev);
|
||||
int16_t (*sptrlro_vdev_get_chan_freq)(struct wlan_objmgr_vdev *vdev);
|
||||
enum phy_ch_width (*sptrlro_vdev_get_ch_width)(
|
||||
struct wlan_objmgr_vdev *vdev);
|
||||
int (*sptrlro_vdev_get_sec20chan_freq_mhz)(
|
||||
struct wlan_objmgr_vdev *vdev,
|
||||
uint16_t *sec20chan_freq);
|
||||
};
|
||||
#endif /* WLAN_CONV_SPECTRAL_ENABLE */
|
||||
|
||||
|
Reference in New Issue
Block a user