qcacmn: Fix the coding convention issues in Spectral target_if layer
Current target_if spectral layer code is not following coding convention rules in some places. Change-Id: I1c0e78c6cdbe97db657c341d74582567a29a86b0 CRs-Fixed: 2151555
This commit is contained in:

committed by
snandini

parent
6273adc01a
commit
318d20fc69
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011,2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2011,2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -68,7 +68,7 @@
|
||||
#define SPECTRAL_PARAM_STOP (22)
|
||||
#define SPECTRAL_PARAM_ENABLE (23)
|
||||
|
||||
#ifdef ATH_SPECTRAL_USE_EMU_DEFAULTS
|
||||
#ifdef SPECTRAL_USE_EMU_DEFAULTS
|
||||
/* Use defaults from emulation */
|
||||
#define SPECTRAL_SCAN_ACTIVE_DEFAULT (0x0)
|
||||
#define SPECTRAL_SCAN_ENABLE_DEFAULT (0x0)
|
||||
@@ -91,7 +91,8 @@
|
||||
#define SPECTRAL_SCAN_DBM_ADJ_DEFAULT (0x0)
|
||||
#define SPECTRAL_SCAN_CHN_MASK_DEFAULT (0x1)
|
||||
#else
|
||||
/* Static default values for spectral state and configuration.
|
||||
/*
|
||||
* Static default values for spectral state and configuration.
|
||||
* These definitions should be treated as temporary. Ideally,
|
||||
* we should get the defaults from firmware - this will be discussed.
|
||||
*
|
||||
@@ -118,12 +119,27 @@
|
||||
#define SPECTRAL_SCAN_BIN_SCALE_DEFAULT (1)
|
||||
#define SPECTRAL_SCAN_DBM_ADJ_DEFAULT (1)
|
||||
#define SPECTRAL_SCAN_CHN_MASK_DEFAULT (1)
|
||||
#endif /* ATH_SPECTRAL_USE_EMU_DEFAULTS */
|
||||
#endif /* SPECTRAL_USE_EMU_DEFAULTS */
|
||||
|
||||
/* The below two definitions apply only to pre-11ac chipsets */
|
||||
#define SPECTRAL_SCAN_SHORT_REPORT_DEFAULT (1)
|
||||
#define SPECTRAL_SCAN_FFT_PERIOD_DEFAULT (1)
|
||||
|
||||
/**
|
||||
* enum wlan_cfg80211_spectral_vendorcmd_handler_idx - Indices to cfg80211
|
||||
* spectral vendor command handlers
|
||||
* @SPECTRAL_SCAN_START_HANDLER_IDX: Index to SPECTRAL_SCAN_START handler
|
||||
* @SPECTRAL_SCAN_STOP_HANDLER_IDX: Index to SPECTRAL_SCAN_STOP handler
|
||||
* @SPECTRAL_SCAN_GET_CONFIG_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CONFIG
|
||||
* handler
|
||||
* @SPECTRAL_SCAN_GET_DIAG_STATS_HANDLER_IDX: Index to
|
||||
* SPECTRAL_SCAN_GET_DIAG_STATS handler
|
||||
* @SPECTRAL_SCAN_GET_CAP_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_CAP handler
|
||||
* @SPECTRAL_SCAN_GET_STATUS_HANDLER_IDX: Index to SPECTRAL_SCAN_GET_STATUS
|
||||
* handler
|
||||
* @SPECTRAL_SCAN_VENDOR_CMD_HANDLER_MAX: Number of cfg80211 spectral
|
||||
* vendor command handlers supported
|
||||
*/
|
||||
enum wlan_cfg80211_spectral_vendorcmd_handler_idx {
|
||||
SPECTRAL_SCAN_START_HANDLER_IDX,
|
||||
SPECTRAL_SCAN_STOP_HANDLER_IDX,
|
||||
@@ -136,33 +152,33 @@ enum wlan_cfg80211_spectral_vendorcmd_handler_idx {
|
||||
|
||||
/**
|
||||
* enum spectral_debug - Spectral debug level
|
||||
* @ATH_DEBUG_SPECTRAL: Minimal SPECTRAL debug
|
||||
* @ATH_DEBUG_SPECTRAL1: Normal SPECTRAL debug
|
||||
* @ATH_DEBUG_SPECTRAL2: Maximal SPECTRAL debug
|
||||
* @ATH_DEBUG_SPECTRAL3: Matched filterID display
|
||||
* @ATH_DEBUG_SPECTRAL4: One time dump of FFT report
|
||||
* @DEBUG_SPECTRAL: Minimal SPECTRAL debug
|
||||
* @DEBUG_SPECTRAL1: Normal SPECTRAL debug
|
||||
* @DEBUG_SPECTRAL2: Maximal SPECTRAL debug
|
||||
* @DEBUG_SPECTRAL3: Matched filterID display
|
||||
* @DEBUG_SPECTRAL4: One time dump of FFT report
|
||||
*/
|
||||
enum spectral_debug {
|
||||
ATH_DEBUG_SPECTRAL = 0x00000100,
|
||||
ATH_DEBUG_SPECTRAL1 = 0x00000200,
|
||||
ATH_DEBUG_SPECTRAL2 = 0x00000400,
|
||||
ATH_DEBUG_SPECTRAL3 = 0x00000800,
|
||||
ATH_DEBUG_SPECTRAL4 = 0x00001000,
|
||||
DEBUG_SPECTRAL = 0x00000100,
|
||||
DEBUG_SPECTRAL1 = 0x00000200,
|
||||
DEBUG_SPECTRAL2 = 0x00000400,
|
||||
DEBUG_SPECTRAL3 = 0x00000800,
|
||||
DEBUG_SPECTRAL4 = 0x00001000,
|
||||
};
|
||||
|
||||
/**
|
||||
* enum SPECTRAL_CAPABILITY_TYPE - Spectral capability type
|
||||
* enum spectral_capability_type - Spectral capability type
|
||||
* @SPECTRAL_CAP_PHYDIAG: Phydiag capability
|
||||
* @SPECTRAL_CAP_RADAR: Radar detection capability
|
||||
* @SPECTRAL_CAP_SPECTRAL_SCAN: Spectral capability
|
||||
* @SPECTRAL_CAP_ADVNCD_SPECTRAL_SCAN: Advanced spectral capability
|
||||
*/
|
||||
typedef enum {
|
||||
enum spectral_capability_type {
|
||||
SPECTRAL_CAP_PHYDIAG,
|
||||
SPECTRAL_CAP_RADAR,
|
||||
SPECTRAL_CAP_SPECTRAL_SCAN,
|
||||
SPECTRAL_CAP_ADVNCD_SPECTRAL_SCAN,
|
||||
} SPECTRAL_CAPABILITY_TYPE;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct spectral_chan_stats - channel status info
|
||||
@@ -176,14 +192,14 @@ typedef enum {
|
||||
* @maxregpower_sec80: Max regulatory power of secondary 80 Mhz
|
||||
*/
|
||||
struct spectral_chan_stats {
|
||||
int cycle_count;
|
||||
int channel_load;
|
||||
int per;
|
||||
int noisefloor;
|
||||
u_int16_t comp_usablity;
|
||||
int8_t maxregpower;
|
||||
u_int16_t comp_usablity_sec80;
|
||||
int8_t maxregpower_sec80;
|
||||
int cycle_count;
|
||||
int channel_load;
|
||||
int per;
|
||||
int noisefloor;
|
||||
uint16_t comp_usablity;
|
||||
int8_t maxregpower;
|
||||
uint16_t comp_usablity_sec80;
|
||||
int8_t maxregpower_sec80;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -199,11 +215,11 @@ struct spectral_chan_stats {
|
||||
* mismatches in Search FFT report
|
||||
*/
|
||||
struct spectral_diag_stats {
|
||||
u_int64_t spectral_mismatch;
|
||||
u_int64_t spectral_sec80_sfft_insufflen;
|
||||
u_int64_t spectral_no_sec80_sfft;
|
||||
u_int64_t spectral_vhtseg1id_mismatch;
|
||||
u_int64_t spectral_vhtseg2id_mismatch;
|
||||
uint64_t spectral_mismatch;
|
||||
uint64_t spectral_sec80_sfft_insufflen;
|
||||
uint64_t spectral_no_sec80_sfft;
|
||||
uint64_t spectral_vhtseg1id_mismatch;
|
||||
uint64_t spectral_vhtseg2id_mismatch;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -214,14 +230,14 @@ struct spectral_diag_stats {
|
||||
* @advncd_spectral_cap: Advanced spectral capability
|
||||
*/
|
||||
struct spectral_caps {
|
||||
u_int8_t phydiag_cap;
|
||||
u_int8_t radar_cap;
|
||||
u_int8_t spectral_cap;
|
||||
u_int8_t advncd_spectral_cap;
|
||||
uint8_t phydiag_cap;
|
||||
uint8_t radar_cap;
|
||||
uint8_t spectral_cap;
|
||||
uint8_t advncd_spectral_cap;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct spectral_config
|
||||
* struct spectral_config - spectral config parameters
|
||||
* @ss_fft_period: Skip interval for FFT reports
|
||||
* @ss_period: Spectral scan period
|
||||
* @ss_count: # of reports to return from ss_active
|
||||
@@ -279,30 +295,30 @@ struct spectral_caps {
|
||||
* @ss_nf_temp_data: temperature data taken during nf scan
|
||||
*/
|
||||
struct spectral_config {
|
||||
u_int16_t ss_fft_period;
|
||||
u_int16_t ss_period;
|
||||
u_int16_t ss_count;
|
||||
u_int16_t ss_short_report;
|
||||
u_int8_t radar_bin_thresh_sel;
|
||||
u_int16_t ss_spectral_pri;
|
||||
u_int16_t ss_fft_size;
|
||||
u_int16_t ss_gc_ena;
|
||||
u_int16_t ss_restart_ena;
|
||||
u_int16_t ss_noise_floor_ref;
|
||||
u_int16_t ss_init_delay;
|
||||
u_int16_t ss_nb_tone_thr;
|
||||
u_int16_t ss_str_bin_thr;
|
||||
u_int16_t ss_wb_rpt_mode;
|
||||
u_int16_t ss_rssi_rpt_mode;
|
||||
u_int16_t ss_rssi_thr;
|
||||
u_int16_t ss_pwr_format;
|
||||
u_int16_t ss_rpt_mode;
|
||||
u_int16_t ss_bin_scale;
|
||||
u_int16_t ss_dbm_adj;
|
||||
u_int16_t ss_chn_mask;
|
||||
int8_t ss_nf_cal[AH_MAX_CHAINS * 2];
|
||||
int8_t ss_nf_pwr[AH_MAX_CHAINS * 2];
|
||||
int32_t ss_nf_temp_data;
|
||||
uint16_t ss_fft_period;
|
||||
uint16_t ss_period;
|
||||
uint16_t ss_count;
|
||||
uint16_t ss_short_report;
|
||||
uint8_t radar_bin_thresh_sel;
|
||||
uint16_t ss_spectral_pri;
|
||||
uint16_t ss_fft_size;
|
||||
uint16_t ss_gc_ena;
|
||||
uint16_t ss_restart_ena;
|
||||
uint16_t ss_noise_floor_ref;
|
||||
uint16_t ss_init_delay;
|
||||
uint16_t ss_nb_tone_thr;
|
||||
uint16_t ss_str_bin_thr;
|
||||
uint16_t ss_wb_rpt_mode;
|
||||
uint16_t ss_rssi_rpt_mode;
|
||||
uint16_t ss_rssi_thr;
|
||||
uint16_t ss_pwr_format;
|
||||
uint16_t ss_rpt_mode;
|
||||
uint16_t ss_bin_scale;
|
||||
uint16_t ss_dbm_adj;
|
||||
uint16_t ss_chn_mask;
|
||||
int8_t ss_nf_cal[AH_MAX_CHAINS * 2];
|
||||
int8_t ss_nf_pwr[AH_MAX_CHAINS * 2];
|
||||
int32_t ss_nf_temp_data;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -315,11 +331,17 @@ struct spectral_scan_state {
|
||||
uint8_t is_enabled;
|
||||
};
|
||||
|
||||
typedef enum _dcs_int_type {
|
||||
/**
|
||||
* enum dcs_int_type - Interference type indicated by DCS
|
||||
* @SPECTRAL_DCS_INT_NONE: No interference
|
||||
* @SPECTRAL_DCS_INT_CW: CW interference
|
||||
* @SPECTRAL_DCS_INT_WIFI: WLAN interference
|
||||
*/
|
||||
enum dcs_int_type {
|
||||
SPECTRAL_DCS_INT_NONE,
|
||||
SPECTRAL_DCS_INT_CW,
|
||||
SPECTRAL_DCS_INT_WIFI
|
||||
} DCS_INT_TYPE;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct INTERF_RSP - Interference record
|
||||
@@ -331,9 +353,9 @@ typedef enum _dcs_int_type {
|
||||
* @advncd_spectral_cap: Advanced spectral capability
|
||||
*/
|
||||
struct INTERF_RSP {
|
||||
u_int8_t interf_type;
|
||||
u_int16_t interf_min_freq;
|
||||
u_int16_t interf_max_freq;
|
||||
uint8_t interf_type;
|
||||
uint16_t interf_min_freq;
|
||||
uint16_t interf_max_freq;
|
||||
} __ATTRIB_PACKED;
|
||||
|
||||
/**
|
||||
@@ -342,25 +364,25 @@ struct INTERF_RSP {
|
||||
* @interf: Array of interference records
|
||||
*/
|
||||
struct INTERF_SRC_RSP {
|
||||
u_int16_t count;
|
||||
uint16_t count;
|
||||
struct INTERF_RSP interf[MAX_INTERF];
|
||||
} __ATTRIB_PACKED;
|
||||
|
||||
/**
|
||||
* struct spectral_classifier_params -
|
||||
* struct spectral_classifier_params - spectral classifier parameters
|
||||
* @spectral_20_40_mode: Is AP in 20/40 mode?
|
||||
* @spectral_dc_index: DC index
|
||||
* @spectral_dc_in_mhz: DC in MHz
|
||||
* @upper_chan_in_mhz: Upper channel in MHz
|
||||
* @lower_chan_in_mhz: Lower channel in MHz
|
||||
*/
|
||||
typedef struct spectral_classifier_params {
|
||||
struct spectral_classifier_params {
|
||||
int spectral_20_40_mode;
|
||||
int spectral_dc_index;
|
||||
int spectral_dc_in_mhz;
|
||||
int upper_chan_in_mhz;
|
||||
int lower_chan_in_mhz;
|
||||
} __ATTRIB_PACKED SPECTRAL_CLASSIFIER_PARAMS;
|
||||
} __ATTRIB_PACKED;
|
||||
|
||||
/**
|
||||
* struct spectral_samp_data - Spectral Analysis Messaging Protocol Data format
|
||||
@@ -403,32 +425,33 @@ typedef struct spectral_classifier_params {
|
||||
* segment
|
||||
* @ch_width: Channel width 20/40/80/160 MHz
|
||||
*/
|
||||
typedef struct spectral_samp_data {
|
||||
int16_t spectral_data_len;
|
||||
int16_t spectral_data_len_sec80;
|
||||
int16_t spectral_rssi;
|
||||
int16_t spectral_rssi_sec80;
|
||||
int8_t spectral_combined_rssi;
|
||||
int8_t spectral_upper_rssi;
|
||||
int8_t spectral_lower_rssi;
|
||||
int8_t spectral_chain_ctl_rssi[MAX_SPECTRAL_CHAINS];
|
||||
int8_t spectral_chain_ext_rssi[MAX_SPECTRAL_CHAINS];
|
||||
u_int8_t spectral_max_scale;
|
||||
int16_t spectral_bwinfo;
|
||||
int32_t spectral_tstamp;
|
||||
int16_t spectral_max_index;
|
||||
int16_t spectral_max_index_sec80;
|
||||
int16_t spectral_max_mag;
|
||||
int16_t spectral_max_mag_sec80;
|
||||
u_int8_t spectral_max_exp;
|
||||
int32_t spectral_last_tstamp;
|
||||
int16_t spectral_upper_max_index;
|
||||
int16_t spectral_lower_max_index;
|
||||
u_int8_t spectral_nb_upper;
|
||||
u_int8_t spectral_nb_lower;
|
||||
struct spectral_classifier_params classifier_params;
|
||||
u_int16_t bin_pwr_count;
|
||||
/* For 11ac chipsets prior to AR900B version 2.0, a max of 512 bins are
|
||||
struct spectral_samp_data {
|
||||
int16_t spectral_data_len;
|
||||
int16_t spectral_data_len_sec80;
|
||||
int16_t spectral_rssi;
|
||||
int16_t spectral_rssi_sec80;
|
||||
int8_t spectral_combined_rssi;
|
||||
int8_t spectral_upper_rssi;
|
||||
int8_t spectral_lower_rssi;
|
||||
int8_t spectral_chain_ctl_rssi[MAX_SPECTRAL_CHAINS];
|
||||
int8_t spectral_chain_ext_rssi[MAX_SPECTRAL_CHAINS];
|
||||
uint8_t spectral_max_scale;
|
||||
int16_t spectral_bwinfo;
|
||||
int32_t spectral_tstamp;
|
||||
int16_t spectral_max_index;
|
||||
int16_t spectral_max_index_sec80;
|
||||
int16_t spectral_max_mag;
|
||||
int16_t spectral_max_mag_sec80;
|
||||
uint8_t spectral_max_exp;
|
||||
int32_t spectral_last_tstamp;
|
||||
int16_t spectral_upper_max_index;
|
||||
int16_t spectral_lower_max_index;
|
||||
uint8_t spectral_nb_upper;
|
||||
uint8_t spectral_nb_lower;
|
||||
struct spectral_classifier_params classifier_params;
|
||||
uint16_t bin_pwr_count;
|
||||
/*
|
||||
* For 11ac chipsets prior to AR900B version 2.0, a max of 512 bins are
|
||||
* delivered. However, there can be additional bins reported for
|
||||
* AR900B version 2.0 and QCA9984 as described next:
|
||||
*
|
||||
@@ -444,16 +467,16 @@ typedef struct spectral_samp_data {
|
||||
* then 8 more bins (4 more on left side and 4 more on right side)
|
||||
* are added.
|
||||
*/
|
||||
u_int8_t lb_edge_extrabins;
|
||||
u_int8_t rb_edge_extrabins;
|
||||
u_int16_t bin_pwr_count_sec80;
|
||||
u_int8_t bin_pwr[MAX_NUM_BINS];
|
||||
u_int8_t bin_pwr_sec80[MAX_NUM_BINS];
|
||||
struct INTERF_SRC_RSP interf_list;
|
||||
int16_t noise_floor;
|
||||
int16_t noise_floor_sec80;
|
||||
u_int32_t ch_width;
|
||||
} __ATTRIB_PACKED SPECTRAL_SAMP_DATA;
|
||||
uint8_t lb_edge_extrabins;
|
||||
uint8_t rb_edge_extrabins;
|
||||
uint16_t bin_pwr_count_sec80;
|
||||
uint8_t bin_pwr[MAX_NUM_BINS];
|
||||
uint8_t bin_pwr_sec80[MAX_NUM_BINS];
|
||||
struct INTERF_SRC_RSP interf_list;
|
||||
int16_t noise_floor;
|
||||
int16_t noise_floor_sec80;
|
||||
uint32_t ch_width;
|
||||
} __ATTRIB_PACKED;
|
||||
|
||||
/**
|
||||
* struct spectral_samp_msg - Spectral SAMP message
|
||||
@@ -467,17 +490,17 @@ typedef struct spectral_samp_data {
|
||||
* @macaddr: Indicates the device interface
|
||||
* @samp_data: SAMP Data
|
||||
*/
|
||||
typedef struct spectral_samp_msg {
|
||||
u_int32_t signature;
|
||||
u_int16_t freq;
|
||||
u_int16_t vhtop_ch_freq_seg1;
|
||||
u_int16_t vhtop_ch_freq_seg2;
|
||||
u_int16_t freq_loading;
|
||||
u_int16_t dcs_enabled;
|
||||
DCS_INT_TYPE int_type;
|
||||
u_int8_t macaddr[6];
|
||||
SPECTRAL_SAMP_DATA samp_data;
|
||||
} __ATTRIB_PACKED SPECTRAL_SAMP_MSG;
|
||||
struct spectral_samp_msg {
|
||||
uint32_t signature;
|
||||
uint16_t freq;
|
||||
uint16_t vhtop_ch_freq_seg1;
|
||||
uint16_t vhtop_ch_freq_seg2;
|
||||
uint16_t freq_loading;
|
||||
uint16_t dcs_enabled;
|
||||
enum dcs_int_type int_type;
|
||||
uint8_t macaddr[6];
|
||||
struct spectral_samp_data samp_data;
|
||||
} __ATTRIB_PACKED;
|
||||
|
||||
#ifdef WIN32
|
||||
#pragma pack(pop, spectral)
|
||||
@@ -486,5 +509,4 @@ typedef struct spectral_samp_msg {
|
||||
#undef __ATTRIB_PACKED
|
||||
#endif
|
||||
|
||||
#endif /* _WLAN_SPECTRAL_PUBLIC_STRUCTS_H_ */
|
||||
|
||||
#endif /* _WLAN_SPECTRAL_PUBLIC_STRUCTS_H_ */
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011,2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2011,2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -27,83 +27,134 @@
|
||||
#include <wlan_osif_priv.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
|
||||
|
||||
#ifdef SPECTRAL_USE_NETLINK_SOCKETS
|
||||
struct sock *target_if_spectral_nl_sock;
|
||||
static atomic_t spectral_nl_users = ATOMIC_INIT(0);
|
||||
|
||||
#if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
|
||||
void target_if_spectral_nl_data_ready(struct sock *sk, int len)
|
||||
void
|
||||
target_if_spectral_nl_data_ready(struct sock *sk, int len)
|
||||
{
|
||||
qdf_print("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
|
||||
#else
|
||||
void target_if_spectral_nl_data_ready(struct sk_buff *skb)
|
||||
void
|
||||
target_if_spectral_nl_data_ready(struct sk_buff *skb)
|
||||
{
|
||||
qdf_print("%s %d\n", __func__, __LINE__);
|
||||
}
|
||||
#endif /* VERSION */
|
||||
|
||||
#endif /* VERSION */
|
||||
|
||||
int target_if_spectral_init_netlink(struct target_if_spectral *spectral)
|
||||
{
|
||||
/**
|
||||
* target_if_spectral_init_nl_cfg() - Initialize netlink kernel
|
||||
* configuration parameters
|
||||
* @spectral : Pointer to netlink_kernel_cfg
|
||||
*
|
||||
* Initialize netlink kernel configuration parameters required
|
||||
* for spectral module
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
#if KERNEL_VERSION(3, 6, 0) <= LINUX_VERSION_CODE
|
||||
|
||||
struct netlink_kernel_cfg cfg = {
|
||||
.groups = 1,
|
||||
.input = target_if_spectral_nl_data_ready,
|
||||
};
|
||||
static void
|
||||
target_if_spectral_init_nl_cfg(struct netlink_kernel_cfg *cfg)
|
||||
{
|
||||
cfg->groups = 1;
|
||||
cfg->input = target_if_spectral_nl_data_ready;
|
||||
}
|
||||
#else
|
||||
static void
|
||||
target_if_spectral_init_nl_cfg(struct netlink_kernel_cfg *cfg)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* target_if_spectral_create_nl_sock() - Create Netlink socket
|
||||
* @spectral : Pointer to netlink_kernel_cfg
|
||||
*
|
||||
* Create Netlink socket required for spectral module
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
#if KERNEL_VERSION(3, 7, 0) <= LINUX_VERSION_CODE
|
||||
static void
|
||||
target_if_spectral_create_nl_sock(struct netlink_kernel_cfg *cfg)
|
||||
{
|
||||
target_if_spectral_nl_sock =
|
||||
(struct sock *)netlink_kernel_create(&init_net,
|
||||
NETLINK_ATHEROS, cfg);
|
||||
}
|
||||
#elif KERNEL_VERSION(3, 6, 0) <= LINUX_VERSION_CODE
|
||||
static void
|
||||
target_if_spectral_create_nl_sock(struct netlink_kernel_cfg *cfg)
|
||||
{
|
||||
target_if_spectral_nl_sock =
|
||||
(struct sock *)netlink_kernel_create(&init_net,
|
||||
NETLINK_ATHEROS,
|
||||
THIS_MODULE, cfg);
|
||||
}
|
||||
#elif (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
|
||||
static void
|
||||
target_if_spectral_create_nl_sock(struct netlink_kernel_cfg *cfg)
|
||||
{
|
||||
target_if_spectral_nl_sock =
|
||||
(struct sock *)netlink_kernel_create(
|
||||
NETLINK_ATHEROS, 1,
|
||||
&target_if_spectral_nl_data_ready,
|
||||
THIS_MODULE);
|
||||
}
|
||||
#else
|
||||
#if (KERNEL_VERSION(3, 10, 0) <= LINUX_VERSION_CODE)
|
||||
static void
|
||||
target_if_spectral_create_nl_sock(struct netlink_kernel_cfg *cfg)
|
||||
{
|
||||
memset(cfg, 0, sizeof(*cfg));
|
||||
cfg->groups = 1;
|
||||
cfg->input = &target_if_spectral_nl_data_ready;
|
||||
target_if_spectral_nl_sock =
|
||||
(struct sock *)netlink_kernel_create(&init_net,
|
||||
NETLINK_ATHEROS, cfg);
|
||||
}
|
||||
#else
|
||||
static void
|
||||
target_if_spectral_create_nl_sock(struct netlink_kernel_cfg *cfg)
|
||||
{
|
||||
target_if_spectral_nl_sock =
|
||||
(struct sock *)netlink_kernel_create(
|
||||
&init_net,
|
||||
NETLINK_ATHEROS, 1,
|
||||
&target_if_spectral_nl_data_ready,
|
||||
NULL, THIS_MODULE);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int
|
||||
target_if_spectral_init_netlink(struct target_if_spectral *spectral)
|
||||
{
|
||||
struct netlink_kernel_cfg cfg;
|
||||
|
||||
memset(&cfg, 0, sizeof(cfg));
|
||||
|
||||
target_if_spectral_init_nl_cfg(&cfg);
|
||||
|
||||
if (!spectral) {
|
||||
qdf_print("%s: sc_spectral is NULL\n", __func__);
|
||||
return -EIO;
|
||||
qdf_print("%s: sc_spectral is NULL\n", __func__);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
spectral->spectral_sent_msg = 0;
|
||||
|
||||
if (!target_if_spectral_nl_sock) {
|
||||
#if KERNEL_VERSION(3, 7, 0) <= LINUX_VERSION_CODE
|
||||
target_if_spectral_nl_sock = (struct sock *)netlink_kernel_create(
|
||||
&init_net,
|
||||
NETLINK_ATHEROS,
|
||||
&cfg);
|
||||
#elif KERNEL_VERSION(3, 6, 0) <= LINUX_VERSION_CODE
|
||||
target_if_spectral_nl_sock = (struct sock *)netlink_kernel_create(
|
||||
&init_net,
|
||||
NETLINK_ATHEROS,
|
||||
THIS_MODULE,
|
||||
&cfg);
|
||||
#elif (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
|
||||
target_if_spectral_nl_sock = (
|
||||
struct sock *)netlink_kernel_create(NETLINK_ATHEROS,
|
||||
1,
|
||||
&target_if_spectral_nl_data_ready,
|
||||
THIS_MODULE);
|
||||
#else
|
||||
#if (KERNEL_VERSION(3, 10, 0) <= LINUX_VERSION_CODE)
|
||||
struct netlink_kernel_cfg cfg;
|
||||
target_if_spectral_create_nl_sock(&cfg);
|
||||
|
||||
memset(&cfg, 0, sizeof(cfg));
|
||||
cfg.groups = 1;
|
||||
cfg.input = &target_if_spectral_nl_data_ready;
|
||||
target_if_spectral_nl_sock = (struct sock *)netlink_kernel_create(
|
||||
&init_net, NETLINK_ATHEROS, &cfg);
|
||||
#else
|
||||
target_if_spectral_nl_sock = (struct sock *)netlink_kernel_create(
|
||||
&init_net,
|
||||
NETLINK_ATHEROS,
|
||||
1,
|
||||
&target_if_spectral_nl_data_ready,
|
||||
NULL,
|
||||
THIS_MODULE);
|
||||
#endif
|
||||
#endif
|
||||
if (!target_if_spectral_nl_sock) {
|
||||
qdf_print("%s NETLINK_KERNEL_CREATE FAILED\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (!target_if_spectral_nl_sock) {
|
||||
qdf_print("%s NETLINK_KERNEL_CREATE FAILED\n",
|
||||
__func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
atomic_inc(&spectral_nl_users);
|
||||
spectral->spectral_sock = target_if_spectral_nl_sock;
|
||||
@@ -119,38 +170,26 @@ int target_if_spectral_init_netlink(struct target_if_spectral *spectral)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int target_if_spectral_destroy_netlink(struct target_if_spectral *spectral)
|
||||
int
|
||||
target_if_spectral_destroy_netlink(struct target_if_spectral *spectral)
|
||||
{
|
||||
spectral->spectral_sock = NULL;
|
||||
if (atomic_dec_and_test(&spectral_nl_users)) {
|
||||
sock_release(target_if_spectral_nl_sock->sk_socket);
|
||||
target_if_spectral_nl_sock = NULL;
|
||||
sock_release(target_if_spectral_nl_sock->sk_socket);
|
||||
target_if_spectral_nl_sock = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
|
||||
static void spectral_process_noise_pwr_report(
|
||||
static void
|
||||
target_if_spectral_process_noise_pwr_report(
|
||||
struct target_if_spectral *spectral,
|
||||
const SPECTRAL_SAMP_MSG *spec_samp_msg)
|
||||
const struct spectral_samp_msg *spec_samp_msg)
|
||||
{
|
||||
int i, done;
|
||||
|
||||
/*
|
||||
* qdf_print(
|
||||
* "%s: #%d/%d datalen=%d tstamp=%x last_tstamp=%x "
|
||||
* "rssi=%d nb_lower=%d peak=%d\n",
|
||||
* __func__, spectral->noise_pwr_reports_recv,
|
||||
* spectral->noise_pwr_reports_reqd,
|
||||
* spec_samp_msg->samp_data.spectral_data_len,
|
||||
* spec_samp_msg->samp_data.spectral_tstamp,
|
||||
* spec_samp_msg->samp_data.spectral_last_tstamp,
|
||||
* spec_samp_msg->samp_data.spectral_lower_rssi,
|
||||
* spec_samp_msg->samp_data.spectral_nb_lower,
|
||||
* spec_samp_msg->samp_data.spectral_lower_max_index);
|
||||
*/
|
||||
|
||||
qdf_spin_lock(&spectral->noise_pwr_reports_lock);
|
||||
|
||||
if (!spectral->noise_pwr_reports_reqd) {
|
||||
@@ -159,55 +198,41 @@ static void spectral_process_noise_pwr_report(
|
||||
}
|
||||
|
||||
if (spectral->noise_pwr_reports_recv <
|
||||
spectral->noise_pwr_reports_reqd) {
|
||||
spectral->noise_pwr_reports_reqd) {
|
||||
spectral->noise_pwr_reports_recv++;
|
||||
|
||||
/*
|
||||
* qdf_print(
|
||||
* "#%d/%d: rssi=%3d,%3d,%3d %3d,%3d,%3d\n",
|
||||
* spectral->noise_pwr_reports_recv,
|
||||
* spectral->noise_pwr_reports_reqd,
|
||||
* spec_samp_msg->samp_data.spectral_chain_ctl_rssi[0],
|
||||
* spec_samp_msg->samp_data.spectral_chain_ctl_rssi[1],
|
||||
* spec_samp_msg->samp_data.spectral_chain_ctl_rssi[2],
|
||||
* spec_samp_msg->samp_data.spectral_chain_ext_rssi[0],
|
||||
* spec_samp_msg->samp_data.spectral_chain_ext_rssi[1],
|
||||
* spec_samp_msg->samp_data.spectral_chain_ext_rssi[2]);
|
||||
*/
|
||||
for (i = 0; i < HOST_MAX_ANTENNA; i++) {
|
||||
uint32_t index;
|
||||
|
||||
for (i = 0; i < ATH_HOST_MAX_ANTENNA; i++) {
|
||||
uint32_t index;
|
||||
|
||||
if (spectral->noise_pwr_chain_ctl[i]) {
|
||||
index = spectral->noise_pwr_chain_ctl[i]->rptcount++;
|
||||
spectral->noise_pwr_chain_ctl[i]->pwr[index] =
|
||||
spec_samp_msg->samp_data.spectral_chain_ctl_rssi[i];
|
||||
if (spectral->noise_pwr_chain_ctl[i]) {
|
||||
index =
|
||||
spectral->noise_pwr_chain_ctl[i]->
|
||||
rptcount++;
|
||||
spectral->noise_pwr_chain_ctl[i]->pwr[index] =
|
||||
spec_samp_msg->samp_data.
|
||||
spectral_chain_ctl_rssi[i];
|
||||
}
|
||||
if (spectral->noise_pwr_chain_ext[i]) {
|
||||
index =
|
||||
spectral->noise_pwr_chain_ext[i]->
|
||||
rptcount++;
|
||||
spectral->noise_pwr_chain_ext[i]->pwr[index] =
|
||||
spec_samp_msg->samp_data.
|
||||
spectral_chain_ext_rssi[i];
|
||||
}
|
||||
}
|
||||
if (spectral->noise_pwr_chain_ext[i]) {
|
||||
index = spectral->noise_pwr_chain_ext[i]->rptcount++;
|
||||
spectral->noise_pwr_chain_ext[i]->pwr[index] =
|
||||
spec_samp_msg->samp_data.spectral_chain_ext_rssi[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
done = (spectral->noise_pwr_reports_recv >=
|
||||
spectral->noise_pwr_reports_reqd);
|
||||
spectral->noise_pwr_reports_reqd);
|
||||
|
||||
qdf_spin_unlock(&spectral->noise_pwr_reports_lock);
|
||||
|
||||
if (done) {
|
||||
qdf_spin_lock(&spectral->ath_spectral_lock);
|
||||
qdf_spin_lock(&spectral->spectral_lock);
|
||||
target_if_stop_spectral_scan(spectral->pdev_obj);
|
||||
spectral->sc_spectral_scan = 0;
|
||||
qdf_spin_unlock(&spectral->ath_spectral_lock);
|
||||
|
||||
/*
|
||||
* qdf_print(
|
||||
* "%s: done: %d/%d recv - set sc_spectral_scan = 0\n",
|
||||
* __func__, spectral->noise_pwr_reports_recv,
|
||||
* spectral->noise_pwr_reports_reqd);
|
||||
*/
|
||||
qdf_spin_unlock(&spectral->spectral_lock);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,89 +244,102 @@ static void spectral_process_noise_pwr_report(
|
||||
*
|
||||
*/
|
||||
|
||||
void target_if_spectral_create_samp_msg(
|
||||
struct target_if_spectral *spectral,
|
||||
struct target_if_samp_msg_params *params)
|
||||
#ifdef SPECTRAL_CLASSIFIER_IN_KERNEL
|
||||
static void
|
||||
target_if_spectral_init_interf_list(
|
||||
struct spectral_samp_data *data,
|
||||
struct target_if_samp_msg_params *params)
|
||||
{
|
||||
if (params->interf_list.count)
|
||||
OS_MEMCPY(&data->interf_list,
|
||||
¶ms->interf_list, sizeof(struct INTERF_SRC_RSP));
|
||||
else
|
||||
data->interf_list.count = 0;
|
||||
}
|
||||
#else
|
||||
static void
|
||||
target_if_spectral_init_interf_list(
|
||||
struct spectral_samp_data *data,
|
||||
struct target_if_samp_msg_params *params)
|
||||
{
|
||||
data->interf_list.count = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
target_if_spectral_create_samp_msg(struct target_if_spectral *spectral,
|
||||
struct target_if_samp_msg_params *params)
|
||||
{
|
||||
/*
|
||||
* XXX : Non-Rentrant. Will be an issue with dual concurrent
|
||||
* operation on multi-processor system
|
||||
*/
|
||||
|
||||
int temp_samp_msg_len = 0;
|
||||
int temp_samp_msg_len = 0;
|
||||
|
||||
static SPECTRAL_SAMP_MSG spec_samp_msg;
|
||||
static struct spectral_samp_msg spec_samp_msg;
|
||||
|
||||
SPECTRAL_SAMP_MSG *msg = NULL;
|
||||
SPECTRAL_SAMP_DATA *data = NULL;
|
||||
u_int8_t *bin_pwr_data = NULL;
|
||||
SPECTRAL_CLASSIFIER_PARAMS *cp = NULL;
|
||||
SPECTRAL_CLASSIFIER_PARAMS *pcp = NULL;
|
||||
struct target_if_spectral_ops *p_sops = NULL;
|
||||
struct spectral_samp_msg *msg = NULL;
|
||||
struct spectral_samp_data *data = NULL;
|
||||
uint8_t *bin_pwr_data = NULL;
|
||||
struct spectral_classifier_params *cp = NULL;
|
||||
struct spectral_classifier_params *pcp = NULL;
|
||||
struct target_if_spectral_ops *p_sops = NULL;
|
||||
struct target_if_spectral_skb_event *sp_skb_event = NULL;
|
||||
|
||||
#ifdef SPECTRAL_USE_NETLINK_SOCKETS
|
||||
static int samp_msg_index;
|
||||
#endif
|
||||
|
||||
p_sops = GET_TIF_SPECTRAL_OPS(spectral);
|
||||
p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
|
||||
|
||||
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));
|
||||
temp_samp_msg_len = sizeof(struct spectral_samp_msg) -
|
||||
(MAX_NUM_BINS * sizeof(uint8_t));
|
||||
temp_samp_msg_len += (params->pwr_count * sizeof(uint8_t));
|
||||
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;
|
||||
temp_samp_msg_len +=
|
||||
(params->pwr_count_sec80 * sizeof(uint8_t));
|
||||
bin_pwr_data = params->bin_pwr_data;
|
||||
|
||||
memset(&spec_samp_msg, 0, sizeof(SPECTRAL_SAMP_MSG));
|
||||
memset(&spec_samp_msg, 0, sizeof(struct spectral_samp_msg));
|
||||
|
||||
data = &spec_samp_msg.samp_data;
|
||||
|
||||
spec_samp_msg.signature = SPECTRAL_SIGNATURE;
|
||||
spec_samp_msg.freq = params->freq;
|
||||
spec_samp_msg.freq_loading = params->freq_loading;
|
||||
spec_samp_msg.samp_data.spectral_data_len = params->datalen;
|
||||
spec_samp_msg.samp_data.spectral_rssi = params->rssi;
|
||||
spec_samp_msg.samp_data.ch_width = spectral->ch_width;
|
||||
spec_samp_msg.signature = SPECTRAL_SIGNATURE;
|
||||
spec_samp_msg.freq = params->freq;
|
||||
spec_samp_msg.freq_loading = params->freq_loading;
|
||||
spec_samp_msg.samp_data.spectral_data_len = params->datalen;
|
||||
spec_samp_msg.samp_data.spectral_rssi = params->rssi;
|
||||
spec_samp_msg.samp_data.ch_width = spectral->ch_width;
|
||||
|
||||
spec_samp_msg.samp_data.spectral_combined_rssi =
|
||||
(u_int8_t)params->rssi;
|
||||
spec_samp_msg.samp_data.spectral_upper_rssi = params->upper_rssi;
|
||||
spec_samp_msg.samp_data.spectral_lower_rssi = params->lower_rssi;
|
||||
spec_samp_msg.samp_data.spectral_combined_rssi =
|
||||
(uint8_t)params->rssi;
|
||||
spec_samp_msg.samp_data.spectral_upper_rssi = params->upper_rssi;
|
||||
spec_samp_msg.samp_data.spectral_lower_rssi = params->lower_rssi;
|
||||
|
||||
OS_MEMCPY(
|
||||
spec_samp_msg.samp_data.spectral_chain_ctl_rssi,
|
||||
params->chain_ctl_rssi,
|
||||
sizeof(params->chain_ctl_rssi));
|
||||
OS_MEMCPY(
|
||||
spec_samp_msg.samp_data.spectral_chain_ext_rssi,
|
||||
params->chain_ext_rssi,
|
||||
sizeof(params->chain_ext_rssi));
|
||||
OS_MEMCPY(spec_samp_msg.samp_data.spectral_chain_ctl_rssi,
|
||||
params->chain_ctl_rssi, sizeof(params->chain_ctl_rssi));
|
||||
OS_MEMCPY(spec_samp_msg.samp_data.spectral_chain_ext_rssi,
|
||||
params->chain_ext_rssi, sizeof(params->chain_ext_rssi));
|
||||
|
||||
spec_samp_msg.samp_data.spectral_bwinfo = params->bwinfo;
|
||||
spec_samp_msg.samp_data.spectral_tstamp = params->tstamp;
|
||||
spec_samp_msg.samp_data.spectral_max_index = params->max_index;
|
||||
spec_samp_msg.samp_data.spectral_bwinfo = params->bwinfo;
|
||||
spec_samp_msg.samp_data.spectral_tstamp = params->tstamp;
|
||||
spec_samp_msg.samp_data.spectral_max_index = params->max_index;
|
||||
|
||||
/* Classifier in user space needs access to these */
|
||||
spec_samp_msg.samp_data.spectral_lower_max_index =
|
||||
params->max_lower_index;
|
||||
spec_samp_msg.samp_data.spectral_upper_max_index =
|
||||
params->max_upper_index;
|
||||
spec_samp_msg.samp_data.spectral_nb_lower =
|
||||
params->nb_lower;
|
||||
spec_samp_msg.samp_data.spectral_nb_upper = params->nb_upper;
|
||||
spec_samp_msg.samp_data.spectral_last_tstamp =
|
||||
params->last_tstamp;
|
||||
spec_samp_msg.samp_data.spectral_max_mag = params->max_mag;
|
||||
spec_samp_msg.samp_data.bin_pwr_count =
|
||||
params->pwr_count;
|
||||
spec_samp_msg.samp_data.lb_edge_extrabins =
|
||||
spectral->lb_edge_extrabins;
|
||||
spec_samp_msg.samp_data.rb_edge_extrabins =
|
||||
spectral->rb_edge_extrabins;
|
||||
spec_samp_msg.samp_data.spectral_combined_rssi = params->rssi;
|
||||
spec_samp_msg.samp_data.spectral_max_scale = params->max_exp;
|
||||
spec_samp_msg.samp_data.spectral_lower_max_index =
|
||||
params->max_lower_index;
|
||||
spec_samp_msg.samp_data.spectral_upper_max_index =
|
||||
params->max_upper_index;
|
||||
spec_samp_msg.samp_data.spectral_nb_lower = params->nb_lower;
|
||||
spec_samp_msg.samp_data.spectral_nb_upper = params->nb_upper;
|
||||
spec_samp_msg.samp_data.spectral_last_tstamp = params->last_tstamp;
|
||||
spec_samp_msg.samp_data.spectral_max_mag = params->max_mag;
|
||||
spec_samp_msg.samp_data.bin_pwr_count = params->pwr_count;
|
||||
spec_samp_msg.samp_data.lb_edge_extrabins = spectral->lb_edge_extrabins;
|
||||
spec_samp_msg.samp_data.rb_edge_extrabins = spectral->rb_edge_extrabins;
|
||||
spec_samp_msg.samp_data.spectral_combined_rssi = params->rssi;
|
||||
spec_samp_msg.samp_data.spectral_max_scale = params->max_exp;
|
||||
|
||||
#ifdef SPECTRAL_USE_NETLINK_SOCKETS
|
||||
|
||||
@@ -320,201 +358,222 @@ void target_if_spectral_create_samp_msg(
|
||||
*/
|
||||
|
||||
spec_samp_msg.samp_data.noise_floor = params->noise_floor;
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
|
||||
/* Classifier in user space needs access to these */
|
||||
cp = &spec_samp_msg.samp_data.classifier_params;
|
||||
cp = &spec_samp_msg.samp_data.classifier_params;
|
||||
pcp = ¶ms->classifier_params;
|
||||
|
||||
OS_MEMCPY(cp, pcp, sizeof(SPECTRAL_CLASSIFIER_PARAMS));
|
||||
OS_MEMCPY(cp, pcp, sizeof(struct spectral_classifier_params));
|
||||
|
||||
SPECTRAL_MSG_COPY_CHAR_ARRAY(
|
||||
&data->bin_pwr[0],
|
||||
bin_pwr_data,
|
||||
params->pwr_count);
|
||||
SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(&data->bin_pwr[0],
|
||||
bin_pwr_data, params->pwr_count);
|
||||
|
||||
#ifdef SPECTRAL_USE_NETLINK_SOCKETS
|
||||
spec_samp_msg.vhtop_ch_freq_seg1 =
|
||||
params->vhtop_ch_freq_seg1;
|
||||
spec_samp_msg.vhtop_ch_freq_seg2 =
|
||||
params->vhtop_ch_freq_seg2;
|
||||
spec_samp_msg.vhtop_ch_freq_seg1 = params->vhtop_ch_freq_seg1;
|
||||
spec_samp_msg.vhtop_ch_freq_seg2 = params->vhtop_ch_freq_seg2;
|
||||
|
||||
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;
|
||||
spec_samp_msg.samp_data.spectral_rssi_sec80 =
|
||||
params->rssi_sec80;
|
||||
spec_samp_msg.samp_data.noise_floor_sec80 =
|
||||
params->noise_floor_sec80;
|
||||
|
||||
spec_samp_msg.samp_data.spectral_data_len_sec80 =
|
||||
params->datalen_sec80;
|
||||
spec_samp_msg.samp_data.spectral_max_index_sec80 =
|
||||
params->max_index_sec80;
|
||||
spec_samp_msg.samp_data.spectral_max_mag_sec80 =
|
||||
params->max_mag_sec80;
|
||||
spec_samp_msg.samp_data.bin_pwr_count_sec80 =
|
||||
params->pwr_count_sec80;
|
||||
SPECTRAL_MSG_COPY_CHAR_ARRAY(&data->bin_pwr_sec80[0],
|
||||
(params->bin_pwr_data_sec80),
|
||||
params->pwr_count_sec80);
|
||||
spec_samp_msg.samp_data.spectral_data_len_sec80 =
|
||||
params->datalen_sec80;
|
||||
spec_samp_msg.samp_data.spectral_max_index_sec80 =
|
||||
params->max_index_sec80;
|
||||
spec_samp_msg.samp_data.spectral_max_mag_sec80 =
|
||||
params->max_mag_sec80;
|
||||
spec_samp_msg.samp_data.bin_pwr_count_sec80 =
|
||||
params->pwr_count_sec80;
|
||||
SPECTRAL_MESSAGE_COPY_CHAR_ARRAY(&data->bin_pwr_sec80[0],
|
||||
(params->bin_pwr_data_sec80),
|
||||
params->pwr_count_sec80);
|
||||
|
||||
/* Note: REVERSE_ORDER is not a known use case for secondary 80 data at
|
||||
* this point.
|
||||
*/
|
||||
/*
|
||||
* Note: REVERSE_ORDER is not a known use case for
|
||||
* secondary 80 data at this point.
|
||||
*/
|
||||
}
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
|
||||
#ifdef SPECTRAL_CLASSIFIER_IN_KERNEL
|
||||
if (params->interf_list.count)
|
||||
OS_MEMCPY(
|
||||
&data->interf_list,
|
||||
¶ms->interf_list,
|
||||
sizeof(struct INTERF_SRC_RSP));
|
||||
else
|
||||
#endif
|
||||
data->interf_list.count = 0;
|
||||
target_if_spectral_init_interf_list(data, params);
|
||||
|
||||
#ifdef SPECTRAL_USE_NETLINK_SOCKETS
|
||||
target_if_spectral_prep_skb(spectral);
|
||||
if (spectral->spectral_skb) {
|
||||
p_sops->get_mac_address(spectral, spec_samp_msg.macaddr);
|
||||
spectral->spectral_nlh =
|
||||
(struct nlmsghdr *)spectral->spectral_skb->data;
|
||||
memcpy(NLMSG_DATA(spectral->spectral_nlh),
|
||||
&spec_samp_msg,
|
||||
sizeof(SPECTRAL_SAMP_MSG));
|
||||
msg = (SPECTRAL_SAMP_MSG *)NLMSG_DATA(spectral->spectral_nlh);
|
||||
/* Broadcast spectral data only if it is a edma supported device */
|
||||
if (!spectral->sc_spectral_non_edma)
|
||||
target_if_spectral_bcast_msg(spectral);
|
||||
samp_msg_index++;
|
||||
p_sops->get_mac_address(spectral, spec_samp_msg.macaddr);
|
||||
spectral->spectral_nlh =
|
||||
(struct nlmsghdr *)spectral->spectral_skb->data;
|
||||
memcpy(NLMSG_DATA(spectral->spectral_nlh),
|
||||
&spec_samp_msg, sizeof(struct spectral_samp_msg));
|
||||
msg = (struct spectral_samp_msg *)NLMSG_DATA(
|
||||
spectral->spectral_nlh);
|
||||
/*
|
||||
* Broadcast spectral data only
|
||||
* if it is a edma supported device
|
||||
*/
|
||||
if (!spectral->sc_spectral_non_edma)
|
||||
target_if_spectral_bcast_msg(spectral);
|
||||
samp_msg_index++;
|
||||
}
|
||||
|
||||
/* Check if the device is non-edma and follow the required broadcast
|
||||
/*
|
||||
* Check if the device is non-edma and follow the required broadcast
|
||||
* path if true
|
||||
*/
|
||||
if (spectral->sc_spectral_non_edma) {
|
||||
/* Allocating memory for the queue entity to hold the spectral socket
|
||||
* buffer
|
||||
*/
|
||||
sp_skb_event = (struct target_if_spectral_skb_event
|
||||
*)qdf_mem_malloc(sizeof(struct target_if_spectral_skb_event));
|
||||
|
||||
if (sp_skb_event) {
|
||||
OS_MEMZERO(
|
||||
sp_skb_event,
|
||||
sizeof(struct target_if_spectral_skb_event));
|
||||
sp_skb_event->sp_skb = spectral->spectral_skb;
|
||||
sp_skb_event->sp_nlh = spectral->spectral_nlh;
|
||||
spectral->spectral_skb = NULL;
|
||||
spectral->spectral_nlh = NULL;
|
||||
|
||||
/* Queue spectral socket buffers to be broadcasted outside irq
|
||||
* lock
|
||||
/*
|
||||
* Allocating memory for the queue entity to
|
||||
* hold the spectral socket buffer
|
||||
*/
|
||||
qdf_spin_lock(&spectral->spectral_skbqlock);
|
||||
STAILQ_INSERT_TAIL(
|
||||
&spectral->spectral_skbq,
|
||||
sp_skb_event,
|
||||
spectral_skb_list);
|
||||
qdf_spin_unlock(&spectral->spectral_skbqlock);
|
||||
}
|
||||
sp_skb_event = (struct target_if_spectral_skb_event
|
||||
*)qdf_mem_malloc(
|
||||
sizeof(
|
||||
struct target_if_spectral_skb_event));
|
||||
|
||||
if (sp_skb_event) {
|
||||
OS_MEMZERO(sp_skb_event,
|
||||
sizeof(struct target_if_spectral_skb_event));
|
||||
sp_skb_event->sp_skb = spectral->spectral_skb;
|
||||
sp_skb_event->sp_nlh = spectral->spectral_nlh;
|
||||
spectral->spectral_skb = NULL;
|
||||
spectral->spectral_nlh = NULL;
|
||||
|
||||
/*
|
||||
* Queue spectral socket buffers to be broadcasted
|
||||
* outside irq lock
|
||||
*/
|
||||
qdf_spin_lock(&spectral->spectral_skbqlock);
|
||||
STAILQ_INSERT_TAIL(&spectral->spectral_skbq,
|
||||
sp_skb_event, spectral_skb_list);
|
||||
qdf_spin_unlock(&spectral->spectral_skbqlock);
|
||||
}
|
||||
}
|
||||
#else
|
||||
/*
|
||||
* call the indicate function to pass the data to the net layer
|
||||
* Windows will pass to a spectral WIN32 service
|
||||
*/
|
||||
msg = (SPECTRAL_SAMP_MSG *)qdf_mem_malloc(sizeof(SPECTRAL_SAMP_MSG));
|
||||
msg = (struct spectral_samp_msg *)qdf_mem_malloc(
|
||||
sizeof(struct spectral_samp_msg));
|
||||
if (msg) {
|
||||
OS_MEMCPY(msg, &spec_samp_msg, sizeof(SPECTRAL_SAMP_MSG));
|
||||
ath_spectral_indicate(
|
||||
params->sc,
|
||||
(void *)msg,
|
||||
sizeof(SPECTRAL_SAMP_MSG));
|
||||
OS_FREE(msg);
|
||||
msg = NULL;
|
||||
OS_MEMCPY(msg, &spec_samp_msg,
|
||||
sizeof(struct spectral_samp_msg));
|
||||
ath_spectral_indicate(params->sc, (void *)msg,
|
||||
sizeof(struct spectral_samp_msg));
|
||||
OS_FREE(msg);
|
||||
msg = NULL;
|
||||
} else {
|
||||
qdf_print("No buffer\n");
|
||||
qdf_print("No buffer\n");
|
||||
}
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
|
||||
if (spectral->sc_spectral_noise_pwr_cal)
|
||||
spectral_process_noise_pwr_report(spectral, &spec_samp_msg);
|
||||
target_if_spectral_process_noise_pwr_report(
|
||||
spectral, &spec_samp_msg);
|
||||
}
|
||||
|
||||
#ifdef SPECTRAL_USE_NETLINK_SOCKETS
|
||||
|
||||
void target_if_spectral_prep_skb(struct target_if_spectral *spectral)
|
||||
void
|
||||
target_if_spectral_prep_skb(struct target_if_spectral *spectral)
|
||||
{
|
||||
spectral->spectral_skb = dev_alloc_skb(MAX_SPECTRAL_PAYLOAD);
|
||||
|
||||
if (spectral->spectral_skb) {
|
||||
skb_put(spectral->spectral_skb, MAX_SPECTRAL_PAYLOAD);
|
||||
spectral->spectral_nlh =
|
||||
(struct nlmsghdr *)spectral->spectral_skb->data;
|
||||
skb_put(spectral->spectral_skb, MAX_SPECTRAL_PAYLOAD);
|
||||
spectral->spectral_nlh =
|
||||
(struct nlmsghdr *)spectral->spectral_skb->data;
|
||||
|
||||
OS_MEMZERO(spectral->spectral_nlh, sizeof(*spectral->spectral_nlh));
|
||||
OS_MEMZERO(spectral->spectral_nlh,
|
||||
sizeof(*spectral->spectral_nlh));
|
||||
|
||||
/* Possible bug that size of SPECTRAL_SAMP_MSG and SPECTRAL_MSG
|
||||
* differ by 3 bytes so we miss 3 bytes
|
||||
*/
|
||||
/*
|
||||
* Possible bug that size of struct spectral_samp_msg and
|
||||
* SPECTRAL_MSG differ by 3 bytes so we miss 3 bytes
|
||||
*/
|
||||
|
||||
spectral->spectral_nlh->nlmsg_len =
|
||||
NLMSG_SPACE(sizeof(SPECTRAL_SAMP_MSG));
|
||||
spectral->spectral_nlh->nlmsg_pid = 0;
|
||||
spectral->spectral_nlh->nlmsg_flags = 0;
|
||||
spectral->spectral_nlh->nlmsg_len =
|
||||
NLMSG_SPACE(sizeof(struct spectral_samp_msg));
|
||||
spectral->spectral_nlh->nlmsg_pid = 0;
|
||||
spectral->spectral_nlh->nlmsg_flags = 0;
|
||||
} else {
|
||||
spectral->spectral_skb = NULL;
|
||||
spectral->spectral_nlh = NULL;
|
||||
spectral->spectral_skb = NULL;
|
||||
spectral->spectral_nlh = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void target_if_spectral_unicast_msg(struct target_if_spectral *spectral)
|
||||
#if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
|
||||
static inline void
|
||||
target_if_init_spectral_skb_dst_pid(
|
||||
struct target_if_spectral *spectral)
|
||||
{
|
||||
NETLINK_CB(spectral->spectral_skb).dst_pid =
|
||||
spectral->spectral_pid;
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
target_if_init_spectral_skb_dst_pid(
|
||||
struct target_if_spectral *spectral)
|
||||
{
|
||||
}
|
||||
#endif /* VERSION - field depracated by newer kernel */
|
||||
|
||||
#if KERNEL_VERSION(3, 7, 0) > LINUX_VERSION_CODE
|
||||
static inline void
|
||||
target_if_init_spectral_skb_pid_portid(
|
||||
struct target_if_spectral *spectral)
|
||||
{
|
||||
NETLINK_CB(spectral->spectral_skb).pid = 0; /* from kernel */
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
target_if_init_spectral_skb_pid_portid(
|
||||
struct target_if_spectral *spectral)
|
||||
{
|
||||
NETLINK_CB(spectral->spectral_skb).portid = 0; /* from kernel */
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
target_if_spectral_unicast_msg(struct target_if_spectral *spectral)
|
||||
{
|
||||
if (!spectral) {
|
||||
qdf_print("%s Spectral is NULL\n", __func__);
|
||||
return;
|
||||
qdf_print("%s Spectral is NULL\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!spectral->spectral_sock) {
|
||||
qdf_print("%s Spectral Socket is invalid\n", __func__);
|
||||
dev_kfree_skb(spectral->spectral_skb);
|
||||
spectral->spectral_skb = NULL;
|
||||
return;
|
||||
qdf_print("%s Spectral Socket is invalid\n", __func__);
|
||||
dev_kfree_skb(spectral->spectral_skb);
|
||||
spectral->spectral_skb = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
if (spectral->spectral_skb) {
|
||||
#if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE)
|
||||
NETLINK_CB(spectral->spectral_skb).dst_pid = spectral->spectral_pid;
|
||||
#endif /* VERSION - field depracated by newer kernel */
|
||||
#if KERNEL_VERSION(3, 7, 0) > LINUX_VERSION_CODE
|
||||
NETLINK_CB(spectral->spectral_skb).pid = 0; /* from kernel */
|
||||
#else
|
||||
NETLINK_CB(spectral->spectral_skb).portid = 0; /* from kernel */
|
||||
#endif
|
||||
/* to mcast group 1<<0 */
|
||||
NETLINK_CB(spectral->spectral_skb).dst_group = 0;
|
||||
target_if_init_spectral_skb_dst_pid(spectral);
|
||||
|
||||
netlink_unicast(
|
||||
spectral->spectral_sock,
|
||||
spectral->spectral_skb,
|
||||
spectral->spectral_pid,
|
||||
MSG_DONTWAIT);
|
||||
target_if_init_spectral_skb_pid_portid(spectral);
|
||||
|
||||
/* to mcast group 1<<0 */
|
||||
NETLINK_CB(spectral->spectral_skb).dst_group = 0;
|
||||
|
||||
netlink_unicast(spectral->spectral_sock,
|
||||
spectral->spectral_skb,
|
||||
spectral->spectral_pid, MSG_DONTWAIT);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Function : target_if_spectral_bcast_msg
|
||||
* Description : Passes the Spectral Message to Host
|
||||
* Input : Pointer to spectral
|
||||
* Output : Void
|
||||
*
|
||||
*/
|
||||
void target_if_spectral_bcast_msg(struct target_if_spectral *spectral)
|
||||
void
|
||||
target_if_spectral_bcast_msg(struct target_if_spectral *spectral)
|
||||
{
|
||||
#if (KERNEL_VERSION(2, 6, 31) >= LINUX_VERSION_CODE)
|
||||
fd_set write_set;
|
||||
#endif
|
||||
SPECTRAL_SAMP_MSG *msg = NULL;
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
struct spectral_samp_msg *msg = NULL;
|
||||
struct nlmsghdr *nlh = NULL;
|
||||
int status;
|
||||
|
||||
#if (KERNEL_VERSION(2, 6, 31) >= LINUX_VERSION_CODE)
|
||||
@@ -522,7 +581,7 @@ void target_if_spectral_bcast_msg(struct target_if_spectral *spectral)
|
||||
#endif
|
||||
|
||||
if (!spectral)
|
||||
return;
|
||||
return;
|
||||
|
||||
if (!spectral->spectral_sock) {
|
||||
dev_kfree_skb(spectral->spectral_skb);
|
||||
@@ -531,15 +590,13 @@ void target_if_spectral_bcast_msg(struct target_if_spectral *spectral)
|
||||
}
|
||||
|
||||
if (!spectral->spectral_skb)
|
||||
return;
|
||||
return;
|
||||
|
||||
nlh = (struct nlmsghdr *)spectral->spectral_skb->data;
|
||||
msg = (SPECTRAL_SAMP_MSG *)NLMSG_DATA(spectral->spectral_nlh);
|
||||
/* print_samp_msg (msg, sc); */
|
||||
status = target_if_send_phydata(
|
||||
spectral->pdev_obj,
|
||||
spectral->spectral_sock,
|
||||
spectral->spectral_skb);
|
||||
msg = (struct spectral_samp_msg *)NLMSG_DATA(spectral->spectral_nlh);
|
||||
status = target_if_send_phydata(spectral->pdev_obj,
|
||||
spectral->spectral_sock,
|
||||
spectral->spectral_skb);
|
||||
if (status == 0)
|
||||
spectral->spectral_sent_msg++;
|
||||
|
||||
@@ -548,31 +605,29 @@ void target_if_spectral_bcast_msg(struct target_if_spectral *spectral)
|
||||
spectral->spectral_skb = NULL;
|
||||
}
|
||||
|
||||
void target_if_spectral_skb_dequeue(unsigned long data)
|
||||
void
|
||||
target_if_spectral_skb_dequeue(void *data)
|
||||
{
|
||||
struct target_if_spectral *spectral =
|
||||
(struct target_if_spectral *)data;
|
||||
struct target_if_spectral *spectral = (struct target_if_spectral *)data;
|
||||
struct target_if_spectral_skb_event *sp_skb_event = NULL;
|
||||
|
||||
qdf_spin_lock(&spectral->spectral_skbqlock);
|
||||
/* Deque all the spectral socket buffers queued */
|
||||
while (!STAILQ_EMPTY(&spectral->spectral_skbq)) {
|
||||
sp_skb_event = STAILQ_FIRST(&spectral->spectral_skbq);
|
||||
if (sp_skb_event) {
|
||||
spectral->spectral_skb = sp_skb_event->sp_skb;
|
||||
spectral->spectral_nlh = sp_skb_event->sp_nlh;
|
||||
STAILQ_REMOVE_HEAD(
|
||||
&spectral->spectral_skbq,
|
||||
spectral_skb_list);
|
||||
qdf_spin_unlock(&spectral->spectral_skbqlock);
|
||||
OS_FREE(sp_skb_event);
|
||||
/* Broadcast spectral data after dequeing */
|
||||
target_if_spectral_bcast_msg(spectral);
|
||||
qdf_spin_lock(&spectral->spectral_skbqlock);
|
||||
}
|
||||
sp_skb_event = STAILQ_FIRST(&spectral->spectral_skbq);
|
||||
if (sp_skb_event) {
|
||||
spectral->spectral_skb = sp_skb_event->sp_skb;
|
||||
spectral->spectral_nlh = sp_skb_event->sp_nlh;
|
||||
STAILQ_REMOVE_HEAD(&spectral->spectral_skbq,
|
||||
spectral_skb_list);
|
||||
qdf_spin_unlock(&spectral->spectral_skbqlock);
|
||||
OS_FREE(sp_skb_event);
|
||||
/* Broadcast spectral data after dequeing */
|
||||
target_if_spectral_bcast_msg(spectral);
|
||||
qdf_spin_lock(&spectral->spectral_skbqlock);
|
||||
}
|
||||
}
|
||||
qdf_spin_unlock(&spectral->spectral_skbqlock);
|
||||
}
|
||||
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
|
||||
#endif /* SPECTRAL_USE_NETLINK_SOCKETS */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015,2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2015,2017-2018 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
@@ -541,7 +541,7 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
|
||||
OS_GET_TIMER_ARG(spectral, struct target_if_spectral *);
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
p_sops = GET_TIF_SPECTRAL_OPS(spectral);
|
||||
p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
|
Reference in New Issue
Block a user