From 4fe1d4b0ee268abf6f7ca89a5008d763c9f21b79 Mon Sep 17 00:00:00 2001 From: Sandeep Puligilla Date: Thu, 14 Dec 2017 21:08:42 -0800 Subject: [PATCH] qcacmn: Fix spectral scan compilation errors Fix spectral scan component compilation errors on MCL build system. Change-Id: I903431fba923859e796e0786354608cac2841b0c CRs-Fixed: 2160819 --- .../spectral/src/wlan_cfg80211_spectral.c | 4 +- spectral/core/spectral_cmn_api_i.h | 19 ++ spectral/core/spectral_common.c | 14 +- spectral/core/spectral_defs_i.h | 4 +- spectral/core/spectral_offload.c | 1 + .../dispatcher/inc/wlan_spectral_utils_api.h | 32 ++ target_if/spectral/target_if_spectral.c | 92 +++-- target_if/spectral/target_if_spectral.h | 323 +++++++++++++++++- .../spectral/target_if_spectral_netlink.c | 6 +- .../spectral/target_if_spectral_phyerr.c | 21 +- target_if/spectral/target_if_spectral_sim.c | 2 +- target_if/spectral/target_if_spectral_sim.h | 2 +- .../spectral/target_if_spectral_sim_int.h | 2 +- 13 files changed, 464 insertions(+), 58 deletions(-) diff --git a/os_if/linux/spectral/src/wlan_cfg80211_spectral.c b/os_if/linux/spectral/src/wlan_cfg80211_spectral.c index 57e465f30d..d317bf87cc 100644 --- a/os_if/linux/spectral/src/wlan_cfg80211_spectral.c +++ b/os_if/linux/spectral/src/wlan_cfg80211_spectral.c @@ -296,7 +296,7 @@ int wlan_cfg80211_spectral_scan_config_and_start(struct wiphy *wiphy, uint64_t cookie; struct sk_buff *skb; uint32_t spectral_dbg_level; - uint32_t scan_req_type; + uint32_t scan_req_type = 0; if (wlan_cfg80211_nla_parse( tb, @@ -636,7 +636,7 @@ int wlan_cfg80211_spectral_scan_get_status(struct wiphy *wiphy, const void *data, int data_len) { - struct spectral_scan_state sscan_state; + struct spectral_scan_state sscan_state = { 0 }; struct sk_buff *skb; skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 2 * sizeof(u32) + diff --git a/spectral/core/spectral_cmn_api_i.h b/spectral/core/spectral_cmn_api_i.h index 1fb7586886..20766f738f 100644 --- a/spectral/core/spectral_cmn_api_i.h +++ b/spectral/core/spectral_cmn_api_i.h @@ -104,6 +104,25 @@ int spectral_control_cmn( u_int32_t insize, void *outdata, u_int32_t *outsize); +/** + * spectral_control_ol(): Offload handler for demultiplexing requests from + * higher layer + * @pdev: reference to global pdev object + * @id: spectral config command id + * @indata: reference to input data + * @insize: input data size + * @outdata: reference to output data + * @outsize: reference to output data size + * + * This function processes the spectral config command + * and appropriate handlers are invoked. + * + * Return: 0 success else failure + */ +int spectral_control_ol( + struct wlan_objmgr_pdev *pdev, u_int id, + void *indata, u_int32_t insize, void *outdata, u_int32_t *outsize); + /** * spectral_get_spectral_ctx_from_pdev() - API to get spectral context object * from pdev diff --git a/spectral/core/spectral_common.c b/spectral/core/spectral_common.c index a0e6ee7439..4edfe38c58 100644 --- a/spectral/core/spectral_common.c +++ b/spectral/core/spectral_common.c @@ -22,9 +22,11 @@ #include "spectral_ol_api_i.h" #include #include +#ifdef CONFIG_WIN #include -#include #include +#endif /*CONFIG_WIN*/ +#include #include /** @@ -48,7 +50,7 @@ * * Return: Pointer to vdev on success, NULL on failure */ -struct wlan_objmgr_vdev* +static struct wlan_objmgr_vdev* spectral_get_vdev(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_vdev *vdev = NULL; @@ -497,10 +499,12 @@ wlan_spectral_psoc_obj_create_handler(struct wlan_objmgr_psoc *psoc, void *arg) } qdf_mem_zero(sc, sizeof(struct spectral_context)); sc->psoc_obj = psoc; - if (wlan_objmgr_psoc_get_dev_type(psoc) == WLAN_DEV_DA) - spectral_ctx_init_da(sc); - else if (wlan_objmgr_psoc_get_dev_type(psoc) == WLAN_DEV_OL) + if (wlan_objmgr_psoc_get_dev_type(psoc) == WLAN_DEV_OL) spectral_ctx_init_ol(sc); +#ifdef CONFIG_WIN + else if (wlan_objmgr_psoc_get_dev_type(psoc) == WLAN_DEV_DA) + spectral_ctx_init_da(sc); +#endif wlan_objmgr_psoc_component_obj_attach(psoc, WLAN_UMAC_COMP_SPECTRAL, (void *)sc, QDF_STATUS_SUCCESS); diff --git a/spectral/core/spectral_defs_i.h b/spectral/core/spectral_defs_i.h index 315e7ee486..986c567d8f 100644 --- a/spectral/core/spectral_defs_i.h +++ b/spectral/core/spectral_defs_i.h @@ -30,7 +30,9 @@ #include #include #include +#ifdef CONFIG_WIN #include +#endif /*CONFIG_WIN*/ #include #define spectral_log(level, args...) \ @@ -91,7 +93,7 @@ struct spectral_context { void *indata, u_int32_t insize, void *outdata, u_int32_t *outsize); int (*sptrlc_ucfg_phyerr_config)(struct wlan_objmgr_pdev *pdev, - struct ath_diag *ad); + void *ad); void * (*sptrlc_pdev_spectral_init)(struct wlan_objmgr_pdev *pdev); void (*sptrlc_pdev_spectral_deinit)(struct wlan_objmgr_pdev *pdev); int (*sptrlc_set_spectral_config)( diff --git a/spectral/core/spectral_offload.c b/spectral/core/spectral_offload.c index 2b5b6a2b4d..e7a21fed0a 100644 --- a/spectral/core/spectral_offload.c +++ b/spectral/core/spectral_offload.c @@ -18,6 +18,7 @@ */ #include "spectral_cmn_api_i.h" +#include "spectral_ol_api_i.h" int spectral_control_ol( struct wlan_objmgr_pdev *pdev, diff --git a/spectral/dispatcher/inc/wlan_spectral_utils_api.h b/spectral/dispatcher/inc/wlan_spectral_utils_api.h index beef773b22..be3427294b 100644 --- a/spectral/dispatcher/inc/wlan_spectral_utils_api.h +++ b/spectral/dispatcher/inc/wlan_spectral_utils_api.h @@ -81,9 +81,41 @@ struct spectral_legacy_cbacks { uint16_t *sec20chan_freq); }; +/** + * spectral_register_legacy_cb - Register legacy callbacks + * @psoc: psoc object + * @legacy_cbacks: legacy callback structure + * + * Return: SUCCESS, + * Failure + */ QDF_STATUS spectral_register_legacy_cb(struct wlan_objmgr_psoc *psoc, struct spectral_legacy_cbacks *legacy_cbacks); +/** + * spectral_vdev_get_chan_freq - Get vdev channel frequency + * @vdev: vdev object + * + * Return: vdev operating frequency + */ +int16_t spectral_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev); + +/** + * spectral_vdev_get_ch_width - Get vdev channel band width + * @vdev: vdev object + * + * Return: phy channel width + */ enum phy_ch_width spectral_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev); +/** + * spectral_vdev_get_sec20chan_freq_mhz - Get vdev secondary channel frequncy + * @vdev: vdev object + * @sec20chan_freq: secondary channel frequency + * + * Return: secondary channel freq + */ +int spectral_vdev_get_sec20chan_freq_mhz(struct wlan_objmgr_vdev *vdev, + uint16_t *sec20chan_freq); + #endif /* _WLAN_SPECTRAL_UTILS_API_H_*/ diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index 118313b835..586bcfd3fe 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -25,7 +25,10 @@ #include #include #include +#ifdef CONFIG_WIN #include +#endif /*CONFIG_WIN*/ +#include #include /** @@ -35,6 +38,7 @@ * module. */ struct target_if_spectral_ops spectral_ops; +int spectral_debug_level = ATH_DEBUG_SPECTRAL; /** * target_if_spectral_get_vdev() - Get pointer to vdev to be used for Spectral @@ -86,7 +90,7 @@ target_if_spectral_get_vdev(struct target_if_spectral *spectral) * * Return: QDF_STATUS_SUCCESS on success, negative error code on failure */ -int target_if_send_vdev_spectral_configure_cmd( +static int target_if_send_vdev_spectral_configure_cmd( struct target_if_spectral *spectral, struct spectral_config *param) { @@ -144,7 +148,7 @@ int target_if_send_vdev_spectral_configure_cmd( * * Return: QDF_STATUS_SUCCESS on success, negative error code on failure */ -int target_if_send_vdev_spectral_enable_cmd( +static int target_if_send_vdev_spectral_enable_cmd( struct target_if_spectral *spectral, u_int8_t is_spectral_active_valid, u_int8_t is_spectral_active, @@ -191,7 +195,7 @@ int target_if_send_vdev_spectral_enable_cmd( * * Return: QDF_STATUS_SUCCESS on success, negative error code on failure */ -int target_if_spectral_info_init_defaults(struct target_if_spectral *spectral) +static int target_if_spectral_info_init_defaults(struct target_if_spectral *spectral) { struct target_if_spectral_param_state_info *info = &spectral->ol_info; struct wlan_objmgr_vdev *vdev = NULL; @@ -280,7 +284,7 @@ int target_if_spectral_info_init_defaults(struct target_if_spectral *spectral) * * Return: 0 on success, negative error code on failure */ -int ol_spectral_info_read(struct target_if_spectral *spectral, +static int ol_spectral_info_read(struct target_if_spectral *spectral, enum ol_spectral_info_spec specifier, void *output, int output_len) @@ -533,7 +537,7 @@ int ol_spectral_info_read(struct target_if_spectral *spectral, * * Return: 0 on success, negative error code on failure */ -int ol_spectral_info_write(struct target_if_spectral *spectral, +static int ol_spectral_info_write(struct target_if_spectral *spectral, enum ol_spectral_info_spec specifier, void *input, int input_len) @@ -1163,7 +1167,7 @@ void init_spectral_capability(struct target_if_spectral *spectral) * * Return: None */ -void target_if_init_spectral_ops_common(void) +static void target_if_init_spectral_ops_common(void) { struct target_if_spectral_ops *p_sops = &spectral_ops; @@ -1171,7 +1175,7 @@ void target_if_init_spectral_ops_common(void) p_sops->get_capability = target_if_spectral_get_capability; p_sops->set_rxfilter = target_if_spectral_set_rxfilter; p_sops->get_rxfilter = target_if_spectral_get_rxfilter; -#if QCA_SUPPORT_SPECTRAL_SIMULATION +#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION /* Spectral simulation is currently intended for platform transitions * where underlying HW support may not be available for some time. * Hence, we do not currently provide a runtime switch to turn the @@ -1217,7 +1221,7 @@ void target_if_init_spectral_ops_common(void) * * Return: None */ -void target_if_init_spectral_ops_gen2(void) +static void target_if_init_spectral_ops_gen2(void) { struct target_if_spectral_ops *p_sops = &spectral_ops; @@ -1230,7 +1234,7 @@ void target_if_init_spectral_ops_gen2(void) * * Return: None */ -void target_if_init_spectral_ops_gen3(void) +static void target_if_init_spectral_ops_gen3(void) { struct target_if_spectral_ops *p_sops = &spectral_ops; @@ -1244,7 +1248,7 @@ void target_if_init_spectral_ops_gen3(void) * * Return: None */ -void target_if_init_spectral_ops(struct target_if_spectral *spectral) +static void target_if_init_spectral_ops(struct target_if_spectral *spectral) { target_if_init_spectral_ops_common(); if (spectral->spectral_gen == SPECTRAL_GEN2) @@ -1401,7 +1405,7 @@ static int null_spectral_process_phyerr( * * Return: None */ -void target_if_spectral_init_dummy_function_table( +static void target_if_spectral_init_dummy_function_table( struct target_if_spectral *ps) { struct target_if_spectral_ops *p_sops = GET_TIF_SPECTRAL_OPS(ps); @@ -1435,7 +1439,7 @@ void target_if_spectral_init_dummy_function_table( * * Return: None */ -void target_if_spectral_register_funcs( +static void target_if_spectral_register_funcs( struct target_if_spectral *spectral, struct target_if_spectral_ops *p) { @@ -1468,7 +1472,7 @@ void target_if_spectral_register_funcs( * * Return: None */ -void target_if_spectral_clear_stats(struct target_if_spectral *spectral) +static void target_if_spectral_clear_stats(struct target_if_spectral *spectral) { struct target_if_spectral_ops *p_sops = GET_TIF_SPECTRAL_OPS(spectral); @@ -1485,7 +1489,8 @@ void target_if_spectral_clear_stats(struct target_if_spectral *spectral) * * Return: True if HW supports Spectral, false if HW does not support Spectral */ -int target_if_spectral_check_hw_capability(struct target_if_spectral *spectral) +static int target_if_spectral_check_hw_capability( + struct target_if_spectral *spectral) { struct target_if_spectral_ops *p_sops = NULL; struct spectral_caps *pcap = NULL; @@ -1586,7 +1591,7 @@ static void target_if_spectral_detach(struct target_if_spectral *spectral) qdf_print("spectral detach\n"); qdf_spinlock_destroy(&spectral->ol_info.osps_lock); -#if QCA_SUPPORT_SPECTRAL_SIMULATION +#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION target_if_spectral_sim_detach(spectral); #endif /* QCA_SUPPORT_SPECTRAL_SIMULATION */ @@ -1615,16 +1620,19 @@ void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) { struct target_if_spectral_ops *p_sops = NULL; struct target_if_spectral *spectral = NULL; +#ifdef CONFIG_WIN struct ol_ath_softc_net80211 *scn = NULL; +#endif struct pdev_osif_priv *osif_priv = NULL; osif_priv = wlan_pdev_get_ospriv(pdev); +#ifdef CONFIG_WIN scn = (struct ol_ath_softc_net80211 *)osif_priv->legacy_osif_priv; if (!scn) { qdf_print("%s: scn is NULL!\n", __func__); return NULL; } - +#endif spectral = (struct target_if_spectral *)qdf_mem_malloc( sizeof(struct target_if_spectral)); if (!spectral) { @@ -1666,7 +1674,7 @@ void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) /* Set the default values for spectral parameters */ target_if_spectral_init_param_defaults(spectral); - +#ifdef CONFIG_WIN if ((scn->soc->target_type == TARGET_TYPE_QCA8074) || ( scn->soc->target_type == TARGET_TYPE_QCA6290)) { spectral->spectral_gen = SPECTRAL_GEN3; @@ -1683,8 +1691,15 @@ void *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(SPECTRAL_PHYERR_TLV_GEN2); } - -#if QCA_SUPPORT_SPECTRAL_SIMULATION +#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 +#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION if (target_if_spectral_sim_attach(spectral)) { qdf_mem_free(spectral); return NULL; @@ -1707,7 +1722,7 @@ void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) spectral->is_160_format = false; spectral->is_lb_edge_extrabins_format = false; spectral->is_rb_edge_extrabins_format = false; - +#ifdef CONFIG_WIN if (scn->soc->target_type == TARGET_TYPE_QCA9984 || scn->soc->target_type == TARGET_TYPE_QCA9888) { spectral->is_160_format = true; @@ -1721,6 +1736,11 @@ void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) if (scn->soc->target_type == TARGET_TYPE_QCA9984 || scn->soc->target_type == TARGET_TYPE_QCA9888) spectral->is_sec80_rssi_war_required = true; +#else + spectral->is_160_format = true; + spectral->is_lb_edge_extrabins_format = true; + spectral->is_rb_edge_extrabins_format = true; +#endif } return spectral; @@ -1733,7 +1753,7 @@ void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) * * Return: None */ -static void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev) +void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev) { struct target_if_spectral *spectral = NULL; @@ -1743,6 +1763,8 @@ static void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev) return; } target_if_spectral_detach(spectral); + + return; } /** @@ -1755,7 +1777,7 @@ static void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev) * * Return: 1 on success, 0 on failure */ -static int target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev, +int target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev, const u_int32_t threshtype, const u_int32_t value) { @@ -1911,7 +1933,7 @@ static void init_upper_lower_flags(struct target_if_spectral *spectral) * * Return: 1 on success, 0 on failure. */ -static void target_if_get_spectral_config(struct wlan_objmgr_pdev *pdev, +void target_if_get_spectral_config(struct wlan_objmgr_pdev *pdev, struct spectral_config *param) { struct target_if_spectral_ops *p_sops = NULL; @@ -1935,7 +1957,7 @@ static void target_if_get_spectral_config(struct wlan_objmgr_pdev *pdev, * * Return: 0 on success, 1 on failure */ -static int target_if_spectral_scan_enable_params( +int target_if_spectral_scan_enable_params( struct target_if_spectral *spectral, struct spectral_config *spectral_params) { @@ -1987,7 +2009,7 @@ static int target_if_spectral_scan_enable_params( spectral->rb_edge_extrabins = 4; } - if (spectral->ch_width == IEEE80211_CWM_WIDTH20) { + if (spectral->ch_width == CH_WIDTH_20MHZ) { /* qdf_print("SPECTRAL : (11AC) 20MHz Channel Width * (Channel = %d)\n", current_channel); */ @@ -2006,7 +2028,7 @@ static int target_if_spectral_scan_enable_params( current_channel; spectral->classifier_params.upper_chan_in_mhz = 0; - } else if (spectral->ch_width == IEEE80211_CWM_WIDTH40) { + } else if (spectral->ch_width == CH_WIDTH_40MHZ) { /* qdf_print("SPECTRAL : (11AC) 40MHz Channel Width * (Channel = %d)\n", current_channel); */ @@ -2034,7 +2056,7 @@ static int target_if_spectral_scan_enable_params( extension_channel; } - } else if (spectral->ch_width == IEEE80211_CWM_WIDTH80) { + } else if (spectral->ch_width == CH_WIDTH_80MHZ) { /* qdf_print("SPECTRAL : (11AC) 80MHz Channel Width * (Channel = %d)\n", current_channel); */ @@ -2070,7 +2092,7 @@ static int target_if_spectral_scan_enable_params( extension_channel; } - } else if (spectral->ch_width == IEEE80211_CWM_WIDTH160) { + } else if (spectral->ch_width == CH_WIDTH_160MHZ) { /* qdf_print("SPECTRAL : (11AC) 160MHz Channel Width * (Channel = %d)\n", current_channel); */ @@ -2243,7 +2265,7 @@ static int target_if_spectral_scan_enable_params( * * Return: 0 in case of success, -1 on failure */ -static int target_if_start_spectral_scan(struct wlan_objmgr_pdev *pdev) +int target_if_start_spectral_scan(struct wlan_objmgr_pdev *pdev) { struct target_if_spectral_ops *p_sops = NULL; struct target_if_spectral *spectral = NULL; @@ -2315,7 +2337,7 @@ void target_if_stop_spectral_scan(struct wlan_objmgr_pdev *pdev) * * Return: True if Spectral is active, false if Spectral is not active */ -static bool target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev) +bool target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev) { struct target_if_spectral *spectral = NULL; struct target_if_spectral_ops *p_sops = NULL; @@ -2331,7 +2353,7 @@ static bool target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev) * * Return: True if Spectral is enabled, false if Spectral is not enabled */ -static bool target_if_is_spectral_enabled(struct wlan_objmgr_pdev *pdev) +bool target_if_is_spectral_enabled(struct wlan_objmgr_pdev *pdev) { struct target_if_spectral *spectral = NULL; struct target_if_spectral_ops *p_sops = NULL; @@ -2348,7 +2370,7 @@ static bool target_if_is_spectral_enabled(struct wlan_objmgr_pdev *pdev) * * Return: 0 in case of success */ -static int target_if_set_debug_level(struct wlan_objmgr_pdev *pdev, +int target_if_set_debug_level(struct wlan_objmgr_pdev *pdev, u_int32_t debug_level) { spectral_debug_level = (ATH_DEBUG_SPECTRAL << debug_level); @@ -2361,7 +2383,7 @@ static int target_if_set_debug_level(struct wlan_objmgr_pdev *pdev, * * Return: Current debug level */ -static u_int32_t target_if_get_debug_level(struct wlan_objmgr_pdev *pdev) +u_int32_t target_if_get_debug_level(struct wlan_objmgr_pdev *pdev) { return spectral_debug_level; } @@ -2373,7 +2395,7 @@ static u_int32_t target_if_get_debug_level(struct wlan_objmgr_pdev *pdev) * * Return: void */ -static void target_if_get_spectral_capinfo( +void target_if_get_spectral_capinfo( struct wlan_objmgr_pdev *pdev, void *outdata) { @@ -2391,7 +2413,7 @@ static void target_if_get_spectral_capinfo( * * Return: void */ -static void target_if_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev, +void target_if_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev, void *outdata) { struct target_if_spectral *spectral = NULL; diff --git a/target_if/spectral/target_if_spectral.h b/target_if/spectral/target_if_spectral.h index f75d1a515b..618130d040 100644 --- a/target_if/spectral/target_if_spectral.h +++ b/target_if/spectral/target_if_spectral.h @@ -23,12 +23,11 @@ #include #include #include +#include #include #include #include -extern int spectral_debug_level; - #ifdef WIN32 #pragma pack(push, target_if_spectral, 1) #define __ATTRIB_PACK @@ -771,7 +770,7 @@ struct target_if_spectral { bool is_lb_edge_extrabins_format; bool is_rb_edge_extrabins_format; bool is_sec80_rssi_war_required; -#if QCA_SUPPORT_SPECTRAL_SIMULATION +#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION void *simctx; #endif enum spectral_gen spectral_gen; @@ -843,6 +842,15 @@ struct target_if_samp_msg_params { #endif /* VERSION CHECK */ #endif /* SPECTRAL_USE_NETLINK_SOCKETS defined */ +#if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE) +void target_if_spectral_nl_data_ready(struct sock *sk, int len); +#else +void target_if_spectral_nl_data_ready(struct sk_buff *skb); +#endif +int target_if_spectral_dump_fft(u_int8_t *pfft, int fftlen); +void target_if_dbg_print_SAMP_param(struct target_if_samp_msg_params *p); +uint32_t target_if_get_offset_swar_sec80(uint32_t channel_width); + void target_if_sptrl_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); extern struct net init_net; int target_if_spectral_init_netlink(struct target_if_spectral *spectral); @@ -1024,6 +1032,315 @@ void target_if_spectral_process_phyerr( tsf64, acs_stats); } +/** + * tgt_if_is_spectral_enabled() - Get whether Spectral is enabled + * @arg: Pointer to handle for Spectral target_if internal private data + * + * Return: True if Spectral is enabled, false if Spectral is not enabled + */ +u_int32_t tgt_if_is_spectral_enabled(void *arg); + +/** + * tgt_if_is_spectral_active() - Get whether Spectral is active + * @arg: Pointer to handle for Spectral target_if internal private data + * + * Return: True if Spectral is active, false if Spectral is not active + */ +u_int32_t tgt_if_is_spectral_active(void *arg); + +/** + * tgt_if_start_spectral_scan() - Start Spectral scan + * @arg: Pointer to handle for Spectral target_if internal private data + * + * Return: 1 on success, 0 on failure + */ +u_int32_t tgt_if_start_spectral_scan(void *arg); + +/** + * tgt_if_stop_spectral_scan() - Stop Spectral scan + * @arg: Pointer to handle for Spectral target_if internal private data + * + * Return: 1 on success, 0 on failure + */ +u_int32_t tgt_if_stop_spectral_scan(void *arg); + +/** + * target_if_spectral_get_extension_channel() - Get the current Extension + * channel (in MHz) + * @arg: Pointer to handle for Spectral target_if internal private data + * + * Return: Current Extension channel (in MHz) on success, 0 on failure or if + * extension channel is not present. + */ +u_int32_t target_if_spectral_get_extension_channel(void *arg); + +/** + * target_if_spectral_get_current_channel() - Get the current channel (in MHz) + * @arg: Pointer to handle for Spectral target_if internal private data + * + * Return: Current channel (in MHz) on success, 0 on failure + */ +u_int32_t target_if_spectral_get_current_channel(void *arg); + + +/** + * target_if_spectral_reset_hw() - Reset the hardware + * @arg: Pointer to handle for Spectral target_if internal private data + * + * This is only a placeholder since it is not currently required in the offload + * case. + * + * Return: 0 + */ +u_int32_t target_if_spectral_reset_hw(void *arg); + +/** + * target_if_spectral_get_chain_noise_floor() - Get the Chain noise floor from + * Noisefloor history buffer + * @arg: Pointer to handle for Spectral target_if internal private data + * @nf_buf: Pointer to buffer into which chain Noise Floor data should be copied + * + * This is only a placeholder since it is not currently required in the offload + * case. + * + * Return: 0 + */ +u_int32_t target_if_spectral_get_chain_noise_floor(void *arg, int16_t *nf_buf); + +/** + * target_if_spectral_get_ext_noisefloor() - Get the extension channel + * noisefloor + * @arg: Pointer to handle for Spectral target_if internal private data + * + * This is only a placeholder since it is not currently required in the offload + * case. + * + * Return: 0 + */ +int8_t target_if_spectral_get_ext_noisefloor(void *arg); + +/** + * target_if_spectral_get_ctl_noisefloor() - Get the control channel noisefloor + * @arg: Pointer to handle for Spectral target_if internal private data + * + * This is only a placeholder since it is not currently required in the offload + * case. + * + * Return: 0 + */ +int8_t target_if_spectral_get_ctl_noisefloor(void *arg); + +/** + * target_if_spectral_get_capability() - Get whether a given Spectral hardware + * capability is available + * @arg: Pointer to handle for Spectral target_if internal private data + * @type: Spectral hardware capability type + * + * Return: True if the capability is available, false if the capability is not + * available + */ +u_int32_t target_if_spectral_get_capability( + void *arg, SPECTRAL_CAPABILITY_TYPE type); + +/** + * target_if_spectral_set_rxfilter() - Set the RX Filter before Spectral start + * @arg: Pointer to handle for Spectral target_if internal private data + * @rxfilter: Rx filter to be used + * + * Note: This is only a placeholder function. It is not currently required since + * FW should be taking care of setting the required filters. + * + * Return: 0 + */ +u_int32_t target_if_spectral_set_rxfilter(void *arg, int rxfilter); + +/** + * target_if_spectral_configure_params() - Configure user supplied Spectral + * parameters + * @arg: Pointer to handle for Spectral target_if internal private data + * @params: Spectral parameters + * + * Return: 1 on success, 0 on failure. + */ +u_int32_t target_if_spectral_configure_params( + void *arg, struct spectral_config *params); + +/** + * target_if_spectral_get_rxfilter() - Get the current RX Filter settings + * @arg: Pointer to handle for Spectral target_if internal private data + * + * Note: This is only a placeholder function. It is not currently required since + * FW should be taking care of setting the required filters. + * + * Return: 0 + */ +u_int32_t target_if_spectral_get_rxfilter(void *arg); + +/** + * target_if_pdev_spectral_deinit() - De-initialize target_if Spectral + * functionality for the given pdev + * @pdev: Pointer to pdev object + * + * Return: None + */ +void target_if_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev); + +/** + * target_if_set_spectral_config() - Set spectral config + * @pdev: Pointer to pdev object + * @threshtype: config type + * @value: config value + * + * API to set spectral configurations + * + * Return: 1 on success, 0 on failure + */ +int target_if_set_spectral_config(struct wlan_objmgr_pdev *pdev, + const u_int32_t threshtype, + const u_int32_t value); + +/** + * target_if_pdev_spectral_init() - Initialize target_if Spectral + * functionality for the given pdev + * @pdev: Pointer to pdev object + * + * Return: On success, pointer to Spectral target_if internal private data, on + * failure, NULL + */ +void *target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev); + +/** + * target_if_spectral_get_params() - Get user configured Spectral parameters + * @arg: Pointer to handle for Spectral target_if internal private data + * @params: Pointer to buffer into which Spectral parameters should be copied + * + * Return: 1 on success, 0 on failure. + */ +u_int32_t target_if_spectral_get_params( + void *arg, struct spectral_config *params); + +/** + * init_spectral_capability() - Initialize Spectral capability + * @spectral: Pointer to Spectral target_if internal private data + * + * This is a workaround. + * + * Return: None + */ +void init_spectral_capability( + struct target_if_spectral *spectral); + +/** + * target_if_start_spectral_scan() - Start spectral scan + * @pdev: Pointer to pdev object + * + * API to start spectral scan + * + * Return: 0 in case of success, -1 on failure + */ +int target_if_start_spectral_scan(struct wlan_objmgr_pdev *pdev); +/** + * target_if_get_spectral_config() - Get spectral configuration + * @pdev: Pointer to pdev object + * @param: Pointer to spectral_config structure in which the configuration + * should be returned + * + * API to get the current spectral configuration + * + * Return: 1 on success, 0 on failure. + */ +void target_if_get_spectral_config(struct wlan_objmgr_pdev *pdev, + struct spectral_config *param); + +/** + * target_if_spectral_scan_enable_params() - Enable use of desired Spectral + * parameters + * @spectral: Pointer to Spectral target_if internal private data + * @spectral_params: Pointer to Spectral parameters + * + * Enable use of desired Spectral parameters by configuring them into HW, and + * starting Spectral scan + * + * Return: 0 on success, 1 on failure + */ +int target_if_spectral_scan_enable_params( + struct target_if_spectral *spectral, struct spectral_config *spectral_params); + +/** + * target_if_is_spectral_active() - Get whether Spectral is active + * @pdev: Pointer to pdev object + * + * Return: True if Spectral is active, false if Spectral is not active + */ +bool target_if_is_spectral_active(struct wlan_objmgr_pdev *pdev); + +/** + * target_if_is_spectral_enabled() - Get whether Spectral is enabled + * @pdev: Pointer to pdev object + * + * Return: True if Spectral is enabled, false if Spectral is not enabled + */ +bool target_if_is_spectral_enabled(struct wlan_objmgr_pdev *pdev); + +/** + * target_if_set_debug_level() - Set debug level for Spectral + * @pdev: Pointer to pdev object + * @debug_level: Debug level + * + * Return: 0 in case of success + */ +int target_if_set_debug_level(struct wlan_objmgr_pdev *pdev, + u_int32_t debug_level); + +/** + * target_if_get_debug_level() - Get debug level for Spectral + * @pdev: Pointer to pdev object + * + * Return: Current debug level + */ +u_int32_t target_if_get_debug_level(struct wlan_objmgr_pdev *pdev); + + +/** + * target_if_get_spectral_capinfo() - Get Spectral capability information + * @pdev: Pointer to pdev object + * @outdata: Buffer into which data should be copied + * + * Return: void + */ +void target_if_get_spectral_capinfo( + struct wlan_objmgr_pdev *pdev, + void *outdata); + + +/** + * target_if_get_spectral_diagstats() - Get Spectral diagnostic statistics + * @pdev: Pointer to pdev object + * @outdata: Buffer into which data should be copied + * + * Return: void + */ +void target_if_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev, + void *outdata); + +/* + * target_if_spectral_send_tlv_to_host - target_if_spectral_send_tlv_to_host + * @spectral: Send the TLV information to Host + * @data: Pointer to the TLV + * @datalen: tlv length + * + * Return: Success/Failure + * + */ +int target_if_spectral_send_tlv_to_host( + struct target_if_spectral *spectral, + u_int8_t *data, u_int32_t datalen); + +void target_if_register_wmi_spectral_cmd_ops( + struct wlan_objmgr_pdev *pdev, + struct wmi_spectral_cmd_ops *cmd_ops); + + #ifdef WIN32 #pragma pack(pop, target_if_spectral) #endif diff --git a/target_if/spectral/target_if_spectral_netlink.c b/target_if/spectral/target_if_spectral_netlink.c index 95fd0b0f64..d3b9f89048 100644 --- a/target_if/spectral/target_if_spectral_netlink.c +++ b/target_if/spectral/target_if_spectral_netlink.c @@ -25,6 +25,8 @@ #include #include #include +#include + #ifdef SPECTRAL_USE_NETLINK_SOCKETS struct sock *target_if_spectral_nl_sock; @@ -247,7 +249,7 @@ void target_if_spectral_create_samp_msg( temp_samp_msg_len = sizeof(SPECTRAL_SAMP_MSG) - (MAX_NUM_BINS * sizeof(u_int8_t)); temp_samp_msg_len += (params->pwr_count * sizeof(u_int8_t)); - if (spectral->ch_width == IEEE80211_CWM_WIDTH160) + if (spectral->ch_width == CH_WIDTH_160MHZ) temp_samp_msg_len += (params->pwr_count_sec80 * sizeof(u_int8_t)); bin_pwr_data = params->bin_pwr_data; @@ -337,7 +339,7 @@ void target_if_spectral_create_samp_msg( spec_samp_msg.vhtop_ch_freq_seg2 = params->vhtop_ch_freq_seg2; - if (spectral->ch_width == IEEE80211_CWM_WIDTH160) { + if (spectral->ch_width == CH_WIDTH_160MHZ) { spec_samp_msg.samp_data.spectral_rssi_sec80 = params->rssi_sec80; spec_samp_msg.samp_data.noise_floor_sec80 = params->noise_floor_sec80; diff --git a/target_if/spectral/target_if_spectral_phyerr.c b/target_if/spectral/target_if_spectral_phyerr.c index a3d6009ac6..edbf233a32 100644 --- a/target_if/spectral/target_if_spectral_phyerr.c +++ b/target_if/spectral/target_if_spectral_phyerr.c @@ -26,7 +26,12 @@ #include #include #include +#ifdef CONFIG_WIN #include +#endif /*CONFIG_WIN*/ +#include +extern int spectral_debug_level; + /* START of spectral GEN II HW specific function declarations */ static int dump_summary_report_gen2( SPECTRAL_PHYERR_TLV_GEN2 *ptlv, @@ -206,16 +211,16 @@ uint32_t target_if_get_offset_swar_sec80(uint32_t channel_width) uint32_t offset = 0; switch (channel_width) { - case IEEE80211_CWM_WIDTH20: + case CH_WIDTH_20MHZ: offset = OFFSET_CH_WIDTH_20; break; - case IEEE80211_CWM_WIDTH40: + case CH_WIDTH_40MHZ: offset = OFFSET_CH_WIDTH_40; break; - case IEEE80211_CWM_WIDTH80: + case CH_WIDTH_80MHZ: offset = OFFSET_CH_WIDTH_80; break; - case IEEE80211_CWM_WIDTH160: + case CH_WIDTH_160MHZ: offset = OFFSET_CH_WIDTH_160; break; default: @@ -890,7 +895,7 @@ int spectral_process_phyerr_gen2( acs_stats->nfc_ext_rssi = extension_rssi; if (spectral->is_160_format && - spectral->ch_width == IEEE80211_CWM_WIDTH160) { + spectral->ch_width == CH_WIDTH_160MHZ) { /* We expect to see one more Search FFT report, and it should * be equal in size to the current one. */ @@ -1293,7 +1298,7 @@ int spectral_dump_fft_report_gen3( return 0; } -int consume_searchfft_report_gen3( +static int consume_searchfft_report_gen3( struct target_if_spectral *spectral, struct phyerr_info *pinfo) { @@ -1469,7 +1474,7 @@ int consume_searchfft_report_gen3( acs_stats->nfc_ctl_rssi = control_rssi; acs_stats->nfc_ext_rssi = extension_rssi; - if (spectral->ch_width == IEEE80211_CWM_WIDTH160) { + if (spectral->ch_width == CH_WIDTH_160MHZ) { /* We expect to see one more Search FFT report, and it should be * equal in size to the current one. */ @@ -1595,7 +1600,9 @@ int spectral_process_phyerr_gen3( "purpose\n"); qdf_print("Dalalength of buffer = 0x%x(%d)\n", datalen, datalen); +#ifdef CONFIG_WIN RAWSIM_PKT_HEXDUMP(data, datalen); +#endif } /* Peek into the data to figure out whether diff --git a/target_if/spectral/target_if_spectral_sim.c b/target_if/spectral/target_if_spectral_sim.c index 1dec3796bc..e93cdada7e 100644 --- a/target_if/spectral/target_if_spectral_sim.c +++ b/target_if/spectral/target_if_spectral_sim.c @@ -17,7 +17,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#if QCA_SUPPORT_SPECTRAL_SIMULATION +#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION #include "target_if_spectral.h" #include "target_if_spectral_sim.h" #include "target_if_spectral_sim_int.h" diff --git a/target_if/spectral/target_if_spectral_sim.h b/target_if/spectral/target_if_spectral_sim.h index d0e94111b3..0723254ed1 100644 --- a/target_if/spectral/target_if_spectral_sim.h +++ b/target_if/spectral/target_if_spectral_sim.h @@ -20,7 +20,7 @@ #ifndef _SPECTRAL_SIM_H_ #define _SPECTRAL_SIM_H_ -#if QCA_SUPPORT_SPECTRAL_SIMULATION +#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION #include "target_if_spectral.h" /** diff --git a/target_if/spectral/target_if_spectral_sim_int.h b/target_if/spectral/target_if_spectral_sim_int.h index 49c305a7c5..d91c6e85c8 100644 --- a/target_if/spectral/target_if_spectral_sim_int.h +++ b/target_if/spectral/target_if_spectral_sim_int.h @@ -20,7 +20,7 @@ #ifndef _SPECTRAL_SIM_INTERNAL_H_ #define _SPECTRAL_SIM_INTERNAL_H_ -#if QCA_SUPPORT_SPECTRAL_SIMULATION +#ifdef QCA_SUPPORT_SPECTRAL_SIMULATION #include "target_if_spectral.h" /* #define SPECTRAL_SIM_DUMP_PARAM_DATA 1 */