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

committed by
snandini

parent
318d20fc69
commit
e37387598e
@@ -1410,13 +1410,13 @@ target_if_init_spectral_simulation_ops(struct target_if_spectral_ops *p_sops)
|
||||
* use of record and replay of samples would concern higher
|
||||
* level sample processing rather than lower level delivery.
|
||||
*/
|
||||
p_sops->is_spectral_enabled = tif_spectral_sim_is_spectral_enabled;
|
||||
p_sops->is_spectral_active = tif_spectral_sim_is_spectral_active;
|
||||
p_sops->start_spectral_scan = tif_spectral_sim_start_spectral_scan;
|
||||
p_sops->stop_spectral_scan = tif_spectral_sim_stop_spectral_scan;
|
||||
p_sops->is_spectral_enabled = target_if_spectral_sops_sim_is_enabled;
|
||||
p_sops->is_spectral_active = target_if_spectral_sops_sim_is_active;
|
||||
p_sops->start_spectral_scan = target_if_spectral_sops_sim_start_scan;
|
||||
p_sops->stop_spectral_scan = target_if_spectral_sops_sim_stop_scan;
|
||||
p_sops->configure_spectral =
|
||||
tif_spectral_sim_configure_params;
|
||||
p_sops->get_spectral_config = tif_spectral_sim_get_params;
|
||||
target_if_spectral_sops_sim_configure_params;
|
||||
p_sops->get_spectral_config = target_if_spectral_sops_sim_get_params;
|
||||
}
|
||||
|
||||
#else
|
||||
|
@@ -30,28 +30,29 @@
|
||||
|
||||
/* Helper functions */
|
||||
|
||||
int tif_populate_reportset_fromfile(ath_spectralsim_reportset * reportset,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80);
|
||||
static int populate_report_static_gen2(ath_spectralsim_report *report,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80);
|
||||
static int populate_report_static_gen3(ath_spectralsim_report *report,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80);
|
||||
static void depopulate_report(ath_spectralsim_report *report);
|
||||
static int target_if_populate_report_static_gen2(
|
||||
struct spectralsim_report *report,
|
||||
enum phy_ch_width width, bool is_80_80);
|
||||
static int target_if_populate_report_static_gen3(
|
||||
struct spectralsim_report *report,
|
||||
enum phy_ch_width width, bool is_80_80);
|
||||
static void target_if_depopulate_report(
|
||||
struct spectralsim_report *report);
|
||||
|
||||
static int populate_reportset_static(ath_spectralsim_context *simctx,
|
||||
ath_spectralsim_reportset *reportset,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80);
|
||||
static void depopulate_reportset(ath_spectralsim_reportset *reportset);
|
||||
static int target_if_populate_reportset_static(
|
||||
struct spectralsim_context *simctx,
|
||||
struct spectralsim_reportset *reportset,
|
||||
enum phy_ch_width width, bool is_80_80);
|
||||
static void target_if_depopulate_reportset(
|
||||
struct spectralsim_reportset *
|
||||
reportset);
|
||||
|
||||
static int populate_simdata(ath_spectralsim_context *simctx);
|
||||
static void depopulate_simdata(ath_spectralsim_context *simctx);
|
||||
static OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler);
|
||||
static int target_if_populate_simdata(struct spectralsim_context *simctx);
|
||||
static void target_if_depopulate_simdata(struct spectralsim_context *simctx);
|
||||
static OS_TIMER_FUNC(target_if_spectral_sim_phyerrdelivery_handler);
|
||||
|
||||
/* Static configuration.
|
||||
/*
|
||||
* Static configuration.
|
||||
* For now, we will be having a single configuration per BW, and a single
|
||||
* report per configuration (since we need the data only for ensuring correct
|
||||
* format handling).
|
||||
@@ -59,22 +60,34 @@ static OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler);
|
||||
* Extend this for more functionality if required in the future.
|
||||
*/
|
||||
|
||||
/* Statically populate simulation data for one report. */
|
||||
static int populate_report_static_gen2(ath_spectralsim_report *report,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80)
|
||||
/**
|
||||
* target_if_populate_report_static_gen2() - Statically populate simulation
|
||||
* data for one report for generation 2 chipsets
|
||||
* @report: Pointer to spectral report data instance
|
||||
* @width : Channel bandwidth enumeration
|
||||
* @is_80_80: Whether the channel is operating in 80-80 mode
|
||||
*
|
||||
* Statically populate simulation data for one report for generation 2 chipsets
|
||||
*
|
||||
* Return: 0 on success, negative error code on failure
|
||||
*/
|
||||
static int
|
||||
target_if_populate_report_static_gen2(
|
||||
struct spectralsim_report *report,
|
||||
enum phy_ch_width width, bool is_80_80)
|
||||
{
|
||||
qdf_assert_always(report);
|
||||
|
||||
switch (width) {
|
||||
case CH_WIDTH_20MHZ:
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_20_gen2));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate memory for "
|
||||
"report data\n");
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate memory "
|
||||
"for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -91,12 +104,13 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
|
||||
break;
|
||||
case CH_WIDTH_40MHZ:
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_40_gen2));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate memory for "
|
||||
"report data\n");
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate memory "
|
||||
"for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -113,12 +127,13 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
|
||||
break;
|
||||
case CH_WIDTH_80MHZ:
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_80_gen2));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate memory for "
|
||||
"report data\n");
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate memory "
|
||||
"for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -136,11 +151,12 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
|
||||
case CH_WIDTH_160MHZ:
|
||||
if (is_80_80) {
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_80_80_gen2));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate "
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate "
|
||||
"memory for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
@@ -150,18 +166,21 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
|
||||
reportdata_80_80_gen2, report->datasize);
|
||||
|
||||
qdf_mem_copy(&report->rfqual_info,
|
||||
&rfqual_info_80_80, sizeof(report->rfqual_info));
|
||||
&rfqual_info_80_80,
|
||||
sizeof(report->rfqual_info));
|
||||
|
||||
qdf_mem_copy(&report->chan_info,
|
||||
&chan_info_80_80, sizeof(report->chan_info));
|
||||
&chan_info_80_80,
|
||||
sizeof(report->chan_info));
|
||||
|
||||
} else {
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_160_gen2));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate "
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate "
|
||||
"memory for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
@@ -171,7 +190,8 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
|
||||
reportdata_160_gen2, report->datasize);
|
||||
|
||||
qdf_mem_copy(&report->rfqual_info,
|
||||
&rfqual_info_160, sizeof(report->rfqual_info));
|
||||
&rfqual_info_160,
|
||||
sizeof(report->rfqual_info));
|
||||
|
||||
qdf_mem_copy(&report->chan_info,
|
||||
&chan_info_160, sizeof(report->chan_info));
|
||||
@@ -188,17 +208,28 @@ bad:
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
/* Statically populate simulation data for one report. */
|
||||
static int populate_report_static_gen3(ath_spectralsim_report *report,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80)
|
||||
/**
|
||||
* target_if_populate_report_static_gen3() - Statically populate simulation
|
||||
* data for one report for generation 3 chipsets
|
||||
* @report: Pointer to spectral report data instance
|
||||
* @width : Channel bandwidth enumeration
|
||||
* @is_80_80: Whether the channel is operating in 80-80 mode
|
||||
*
|
||||
* Statically populate simulation data for one report for generation 3 chipsets
|
||||
*
|
||||
* Return: 0 on success, negative error code on failure
|
||||
*/
|
||||
static int
|
||||
target_if_populate_report_static_gen3(
|
||||
struct spectralsim_report *report,
|
||||
enum phy_ch_width width, bool is_80_80)
|
||||
{
|
||||
qdf_assert_always(report);
|
||||
|
||||
switch (width) {
|
||||
case CH_WIDTH_20MHZ:
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_20_gen3));
|
||||
|
||||
if (!report->data) {
|
||||
@@ -220,7 +251,7 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
|
||||
break;
|
||||
case CH_WIDTH_40MHZ:
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_40_gen3));
|
||||
|
||||
if (!report->data) {
|
||||
@@ -242,12 +273,13 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
|
||||
break;
|
||||
case CH_WIDTH_80MHZ:
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_80_gen3));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate memory for "
|
||||
"report data\n");
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate memory "
|
||||
"for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
|
||||
@@ -265,11 +297,12 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
|
||||
case CH_WIDTH_160MHZ:
|
||||
if (is_80_80) {
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_80_80_gen3));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate "
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate "
|
||||
"memory for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
@@ -279,18 +312,21 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
|
||||
reportdata_80_80_gen3, report->datasize);
|
||||
|
||||
qdf_mem_copy(&report->rfqual_info,
|
||||
&rfqual_info_80_80, sizeof(report->rfqual_info));
|
||||
&rfqual_info_80_80,
|
||||
sizeof(report->rfqual_info));
|
||||
|
||||
qdf_mem_copy(&report->chan_info,
|
||||
&chan_info_80_80, sizeof(report->chan_info));
|
||||
&chan_info_80_80,
|
||||
sizeof(report->chan_info));
|
||||
|
||||
} else {
|
||||
report->data = NULL;
|
||||
report->data = (u_int8_t *)
|
||||
report->data = (uint8_t *)
|
||||
qdf_mem_malloc(sizeof(reportdata_160_gen3));
|
||||
|
||||
if (!report->data) {
|
||||
qdf_print("Spectral simulation: Could not allocate "
|
||||
qdf_print
|
||||
("Spectral simulation: Could not allocate "
|
||||
"memory for report data\n");
|
||||
goto bad;
|
||||
}
|
||||
@@ -300,7 +336,8 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
|
||||
reportdata_160_gen3, report->datasize);
|
||||
|
||||
qdf_mem_copy(&report->rfqual_info,
|
||||
&rfqual_info_160, sizeof(report->rfqual_info));
|
||||
&rfqual_info_160,
|
||||
sizeof(report->rfqual_info));
|
||||
|
||||
qdf_mem_copy(&report->chan_info,
|
||||
&chan_info_160, sizeof(report->chan_info));
|
||||
@@ -317,7 +354,18 @@ bad:
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
static void depopulate_report(ath_spectralsim_report *report)
|
||||
/**
|
||||
* target_if_depopulate_report() - Free the given instances of
|
||||
* struct spectralsim_report
|
||||
* @report: instance of struct spectralsim_report
|
||||
*
|
||||
* Free the given instances of struct spectralsim_report
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void
|
||||
target_if_depopulate_report(
|
||||
struct spectralsim_report *report)
|
||||
{
|
||||
if (!report)
|
||||
return;
|
||||
@@ -329,14 +377,26 @@ static void depopulate_report(ath_spectralsim_report *report)
|
||||
}
|
||||
}
|
||||
|
||||
/* Statically populate simulation data for a given configuration. */
|
||||
static int populate_reportset_static(ath_spectralsim_context *simctx,
|
||||
ath_spectralsim_reportset *reportset,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80)
|
||||
/**
|
||||
* target_if_populate_reportset_static() - Statically populate simulation data
|
||||
* for a given configuration
|
||||
* @simctx: Pointer to struct spectralsim_context
|
||||
* @reportset: Set of spectral report data instances
|
||||
* @width : Channel bandwidth enumeration
|
||||
* @is_80_80: Whether the channel is operating in 80+80 mode
|
||||
*
|
||||
* Statically populate simulation data for a given configuration
|
||||
*
|
||||
* Return: 0 on success, negative error code on failure
|
||||
*/
|
||||
static int
|
||||
target_if_populate_reportset_static(
|
||||
struct spectralsim_context *simctx,
|
||||
struct spectralsim_reportset *reportset,
|
||||
enum phy_ch_width width, bool is_80_80)
|
||||
{
|
||||
int ret = 0;
|
||||
ath_spectralsim_report *report = NULL;
|
||||
struct spectralsim_report *report = NULL;
|
||||
|
||||
qdf_assert_always(reportset);
|
||||
|
||||
@@ -344,8 +404,8 @@ static int populate_reportset_static(ath_spectralsim_context *simctx,
|
||||
reportset->curr_report = NULL;
|
||||
|
||||
/* For now, we populate only one report */
|
||||
report = (ath_spectralsim_report *)
|
||||
qdf_mem_malloc(sizeof(ath_spectralsim_report));
|
||||
report = (struct spectralsim_report *)
|
||||
qdf_mem_malloc(sizeof(struct spectralsim_report));
|
||||
|
||||
if (!report) {
|
||||
qdf_print("Spectral simulation: Could not allocate memory "
|
||||
@@ -392,10 +452,10 @@ static int populate_reportset_static(ath_spectralsim_context *simctx,
|
||||
case CH_WIDTH_160MHZ:
|
||||
if (is_80_80) {
|
||||
qdf_mem_copy(&reportset->config,
|
||||
&config_80_80_1, sizeof(reportset->config));
|
||||
&config_80_80_1,
|
||||
sizeof(reportset->config));
|
||||
|
||||
ret = simctx->populate_report_static(
|
||||
report,
|
||||
ret = simctx->populate_report_static(report,
|
||||
CH_WIDTH_160MHZ,
|
||||
1);
|
||||
if (ret != 0)
|
||||
@@ -407,8 +467,7 @@ static int populate_reportset_static(ath_spectralsim_context *simctx,
|
||||
qdf_mem_copy(&reportset->config,
|
||||
&config_160_1, sizeof(reportset->config));
|
||||
|
||||
ret = simctx->populate_report_static(
|
||||
report,
|
||||
ret = simctx->populate_report_static(report,
|
||||
CH_WIDTH_160MHZ,
|
||||
0);
|
||||
if (ret != 0)
|
||||
@@ -428,14 +487,25 @@ static int populate_reportset_static(ath_spectralsim_context *simctx,
|
||||
return 0;
|
||||
|
||||
bad:
|
||||
depopulate_reportset(reportset);
|
||||
target_if_depopulate_reportset(reportset);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
static void depopulate_reportset(ath_spectralsim_reportset *reportset)
|
||||
/**
|
||||
* target_if_depopulate_reportset() - Free all the instances of
|
||||
* struct spectralsim_reportset
|
||||
* @report: head pointer to struct spectralsim_reportset linked list
|
||||
*
|
||||
* Free all the instances of struct spectralsim_reportset
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void
|
||||
target_if_depopulate_reportset(
|
||||
struct spectralsim_reportset *reportset)
|
||||
{
|
||||
ath_spectralsim_report *curr_report = NULL;
|
||||
ath_spectralsim_report *next_report = NULL;
|
||||
struct spectralsim_report *curr_report = NULL;
|
||||
struct spectralsim_report *next_report = NULL;
|
||||
|
||||
if (!reportset)
|
||||
return;
|
||||
@@ -444,64 +514,53 @@ static void depopulate_reportset(ath_spectralsim_reportset *reportset)
|
||||
|
||||
while (curr_report) {
|
||||
next_report = curr_report->next;
|
||||
depopulate_report(curr_report);
|
||||
target_if_depopulate_report(curr_report);
|
||||
qdf_mem_free(curr_report);
|
||||
curr_report = next_report;
|
||||
}
|
||||
}
|
||||
|
||||
/* Populate simulation data for a given bandwidth by loading from a file.
|
||||
* This is a place-holder only. To be implemented in the future on a need
|
||||
* basis.
|
||||
/**
|
||||
* target_if_populate_simdata() - Populate simulation data
|
||||
* @simctx: Pointer to struct spectralsim_context
|
||||
*
|
||||
* A different file per bandwidth is suggested for better segregation of data
|
||||
* sets (since data is likely to be very different across BWs).
|
||||
* Populate simulation data
|
||||
*
|
||||
* Return: 0 on success, negative error code on failure
|
||||
*/
|
||||
int tif_populate_reportset_fromfile(ath_spectralsim_reportset *reportset,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80)
|
||||
static int
|
||||
target_if_populate_simdata(
|
||||
struct spectralsim_context *simctx)
|
||||
{
|
||||
qdf_print("%s: To be implemented if required\n", __func__);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Populate simulation data */
|
||||
static int populate_simdata(ath_spectralsim_context *simctx)
|
||||
{
|
||||
/* For now, we use static population. Switch to loading from a file if
|
||||
/*
|
||||
* For now, we use static population. Switch to loading from a file if
|
||||
* needed in the future.
|
||||
*/
|
||||
|
||||
simctx->bw20_headreportset = NULL;
|
||||
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
|
||||
simctx->bw20_headreportset,
|
||||
CH_WIDTH_20MHZ,
|
||||
0);
|
||||
CH_WIDTH_20MHZ, 0);
|
||||
|
||||
simctx->bw40_headreportset = NULL;
|
||||
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
|
||||
simctx->bw40_headreportset,
|
||||
CH_WIDTH_40MHZ,
|
||||
0);
|
||||
CH_WIDTH_40MHZ, 0);
|
||||
|
||||
simctx->bw80_headreportset = NULL;
|
||||
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
|
||||
simctx->bw80_headreportset,
|
||||
CH_WIDTH_80MHZ,
|
||||
0);
|
||||
CH_WIDTH_80MHZ, 0);
|
||||
|
||||
simctx->bw160_headreportset = NULL;
|
||||
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
|
||||
simctx->bw160_headreportset,
|
||||
CH_WIDTH_160MHZ,
|
||||
0);
|
||||
CH_WIDTH_160MHZ, 0);
|
||||
|
||||
simctx->bw80_80_headreportset = NULL;
|
||||
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
|
||||
simctx->bw80_80_headreportset,
|
||||
CH_WIDTH_160MHZ,
|
||||
1);
|
||||
CH_WIDTH_160MHZ, 1);
|
||||
|
||||
simctx->curr_reportset = NULL;
|
||||
|
||||
@@ -515,7 +574,17 @@ static int populate_simdata(ath_spectralsim_context *simctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void depopulate_simdata(ath_spectralsim_context *simctx)
|
||||
/**
|
||||
* target_if_depopulate_simdata() - De-populate simulation data
|
||||
* @simctx: Pointer to struct spectralsim_context
|
||||
*
|
||||
* De-populate simulation data
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static void
|
||||
target_if_depopulate_simdata(
|
||||
struct spectralsim_context *simctx)
|
||||
{
|
||||
if (!simctx)
|
||||
return;
|
||||
@@ -527,15 +596,20 @@ static void depopulate_simdata(ath_spectralsim_context *simctx)
|
||||
SPECTRAL_SIM_REPORTSET_DEPOPLFREE_LIST(simctx->bw80_80_headreportset);
|
||||
}
|
||||
|
||||
/**
|
||||
* target_if_spectral_sim_phyerrdelivery_handler() - Phyerr delivery handler
|
||||
*
|
||||
* Return: none
|
||||
*/
|
||||
static
|
||||
OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
|
||||
OS_TIMER_FUNC(target_if_spectral_sim_phyerrdelivery_handler)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
ath_spectralsim_reportset *curr_reportset = NULL;
|
||||
ath_spectralsim_report *curr_report = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_reportset *curr_reportset = NULL;
|
||||
struct spectralsim_report *curr_report = NULL;
|
||||
struct target_if_spectral_acs_stats acs_stats;
|
||||
u_int64_t curr_tsf64 = 0;
|
||||
uint64_t curr_tsf64 = 0;
|
||||
struct target_if_spectral_ops *p_sops;
|
||||
|
||||
OS_GET_TIMER_ARG(spectral, struct target_if_spectral *);
|
||||
@@ -544,7 +618,7 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
|
||||
p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
if (!simctx->is_active)
|
||||
@@ -558,7 +632,8 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
|
||||
|
||||
qdf_assert_always(curr_reportset->headreport);
|
||||
|
||||
/* We use a simulation TSF since in offload architectures we can't
|
||||
/*
|
||||
* We use a simulation TSF since in offload architectures we can't
|
||||
* expect to
|
||||
* get an accurate current TSF from HW.
|
||||
* In case of TSF wrap over, we'll use it as-is for now since the
|
||||
@@ -573,8 +648,7 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
|
||||
curr_report->datasize,
|
||||
&curr_report->rfqual_info,
|
||||
&curr_report->chan_info,
|
||||
curr_tsf64,
|
||||
&acs_stats);
|
||||
curr_tsf64, &acs_stats);
|
||||
|
||||
simctx->ssim_count++;
|
||||
|
||||
@@ -585,7 +659,7 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
|
||||
|
||||
if (curr_reportset->config.ss_count != 0 &&
|
||||
simctx->ssim_count == curr_reportset->config.ss_count) {
|
||||
tif_spectral_sim_stop_spectral_scan(spectral);
|
||||
target_if_spectral_sops_sim_stop_scan(spectral);
|
||||
} else {
|
||||
qdf_timer_start(&simctx->ssim_pherrdelivery_timer,
|
||||
simctx->ssim_period_ms);
|
||||
@@ -594,14 +668,15 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
|
||||
|
||||
/* Module services */
|
||||
|
||||
int target_if_spectral_sim_attach(struct target_if_spectral *spectral)
|
||||
int
|
||||
target_if_spectral_sim_attach(struct target_if_spectral *spectral)
|
||||
{
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)
|
||||
qdf_mem_malloc(sizeof(ath_spectralsim_context));
|
||||
simctx = (struct spectralsim_context *)
|
||||
qdf_mem_malloc(sizeof(struct spectralsim_context));
|
||||
|
||||
if (!simctx) {
|
||||
qdf_print("Spectral simulation: Could not allocate memory for "
|
||||
@@ -614,11 +689,13 @@ int target_if_spectral_sim_attach(struct target_if_spectral *spectral)
|
||||
spectral->simctx = simctx;
|
||||
|
||||
if (spectral->spectral_gen == SPECTRAL_GEN2)
|
||||
simctx->populate_report_static = populate_report_static_gen2;
|
||||
simctx->populate_report_static =
|
||||
target_if_populate_report_static_gen2;
|
||||
else if (spectral->spectral_gen == SPECTRAL_GEN3)
|
||||
simctx->populate_report_static = populate_report_static_gen3;
|
||||
simctx->populate_report_static =
|
||||
target_if_populate_report_static_gen3;
|
||||
|
||||
if (populate_simdata(simctx) != 0) {
|
||||
if (target_if_populate_simdata(simctx) != 0) {
|
||||
qdf_mem_free(simctx);
|
||||
spectral->simctx = NULL;
|
||||
qdf_print("Spectral simulation attach failed\n");
|
||||
@@ -627,72 +704,75 @@ int target_if_spectral_sim_attach(struct target_if_spectral *spectral)
|
||||
|
||||
qdf_timer_init(NULL,
|
||||
&simctx->ssim_pherrdelivery_timer,
|
||||
spectral_sim_phyerrdelivery_handler,
|
||||
(void *)(spectral),
|
||||
QDF_TIMER_TYPE_WAKE_APPS);
|
||||
target_if_spectral_sim_phyerrdelivery_handler,
|
||||
(void *)(spectral), QDF_TIMER_TYPE_WAKE_APPS);
|
||||
|
||||
qdf_print("Spectral simulation attached\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void target_if_spectral_sim_detach(struct target_if_spectral *spectral)
|
||||
void
|
||||
target_if_spectral_sim_detach(struct target_if_spectral *spectral)
|
||||
{
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
qdf_timer_free(&simctx->ssim_pherrdelivery_timer);
|
||||
|
||||
depopulate_simdata(simctx);
|
||||
target_if_depopulate_simdata(simctx);
|
||||
qdf_mem_free(simctx);
|
||||
spectral->simctx = NULL;
|
||||
|
||||
qdf_print("Spectral simulation detached\n");
|
||||
}
|
||||
|
||||
u_int32_t tif_spectral_sim_is_spectral_active(void *arg)
|
||||
uint32_t
|
||||
target_if_spectral_sops_sim_is_active(void *arg)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
|
||||
spectral = (struct target_if_spectral *)arg;
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
return simctx->is_active;
|
||||
}
|
||||
EXPORT_SYMBOL(tif_spectral_sim_is_spectral_active);
|
||||
EXPORT_SYMBOL(target_if_spectral_sops_sim_is_active);
|
||||
|
||||
u_int32_t tif_spectral_sim_is_spectral_enabled(void *arg)
|
||||
uint32_t
|
||||
target_if_spectral_sops_sim_is_enabled(void *arg)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
|
||||
spectral = (struct target_if_spectral *)arg;
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
return simctx->is_enabled;
|
||||
}
|
||||
EXPORT_SYMBOL(tif_spectral_sim_is_spectral_enabled);
|
||||
EXPORT_SYMBOL(target_if_spectral_sops_sim_is_enabled);
|
||||
|
||||
u_int32_t tif_spectral_sim_start_spectral_scan(void *arg)
|
||||
uint32_t
|
||||
target_if_spectral_sops_sim_start_scan(void *arg)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
|
||||
spectral = (struct target_if_spectral *)arg;
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
if (!simctx->curr_reportset) {
|
||||
@@ -718,7 +798,8 @@ u_int32_t tif_spectral_sim_start_spectral_scan(void *arg)
|
||||
simctx->ssim_starting_tsf64 = 0;
|
||||
simctx->ssim_count = 0;
|
||||
|
||||
/* TODO: Support high resolution timer in microseconds if required, so
|
||||
/*
|
||||
* TODO: Support high resolution timer in microseconds if required, so
|
||||
* that
|
||||
* we can support default periods such as ~200 us. For now, we use 1
|
||||
* millisecond since the current use case for the simulation is to
|
||||
@@ -732,17 +813,18 @@ u_int32_t tif_spectral_sim_start_spectral_scan(void *arg)
|
||||
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL(tif_spectral_sim_start_spectral_scan);
|
||||
EXPORT_SYMBOL(target_if_spectral_sops_sim_start_scan);
|
||||
|
||||
u_int32_t tif_spectral_sim_stop_spectral_scan(void *arg)
|
||||
uint32_t
|
||||
target_if_spectral_sops_sim_stop_scan(void *arg)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
|
||||
spectral = (struct target_if_spectral *)arg;
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
qdf_timer_stop(&simctx->ssim_pherrdelivery_timer);
|
||||
@@ -756,24 +838,11 @@ u_int32_t tif_spectral_sim_stop_spectral_scan(void *arg)
|
||||
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL(tif_spectral_sim_stop_spectral_scan);
|
||||
|
||||
u_int32_t tif_spectral_sim_configure_params(
|
||||
void *arg,
|
||||
struct spectral_config *params)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
enum wlan_phymode phymode;
|
||||
u_int8_t bw;
|
||||
ath_spectralsim_reportset *des_headreportset = NULL;
|
||||
ath_spectralsim_reportset *temp_reportset = NULL;
|
||||
bool is_invalid_width = false;
|
||||
struct wlan_objmgr_vdev *vdev = NULL;
|
||||
|
||||
qdf_assert_always(params);
|
||||
EXPORT_SYMBOL(target_if_spectral_sops_sim_stop_scan);
|
||||
|
||||
#ifdef SPECTRAL_SIM_DUMP_PARAM_DATA
|
||||
static void
|
||||
target_if_log_sim_spectral_params(struct spectral_config *params)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
@@ -822,8 +891,7 @@ u_int32_t tif_spectral_sim_configure_params(
|
||||
params->ss_rpt_mode,
|
||||
params->ss_bin_scale,
|
||||
params->ss_dbm_adj,
|
||||
params->ss_chn_mask,
|
||||
params->ss_nf_temp_data);
|
||||
params->ss_chn_mask, params->ss_nf_temp_data);
|
||||
|
||||
for (i = 0; i < AH_MAX_CHAINS * 2; i++)
|
||||
qdf_print("ss_nf_cal[%d]=%hhd\n", i, params->ss_nf_cal[i]);
|
||||
@@ -833,12 +901,34 @@ u_int32_t tif_spectral_sim_configure_params(
|
||||
|
||||
qdf_print("\n");
|
||||
}
|
||||
#else
|
||||
|
||||
static void
|
||||
target_if_log_sim_spectral_params(struct spectral_config *params)
|
||||
{
|
||||
}
|
||||
#endif /* SPECTRAL_SIM_DUMP_PARAM_DATA */
|
||||
|
||||
uint32_t
|
||||
target_if_spectral_sops_sim_configure_params(
|
||||
void *arg,
|
||||
struct spectral_config *params)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
enum wlan_phymode phymode;
|
||||
uint8_t bw;
|
||||
struct spectralsim_reportset *des_headreportset = NULL;
|
||||
struct spectralsim_reportset *temp_reportset = NULL;
|
||||
bool is_invalid_width = false;
|
||||
struct wlan_objmgr_vdev *vdev = NULL;
|
||||
|
||||
qdf_assert_always(params);
|
||||
target_if_log_sim_spectral_params(params);
|
||||
spectral = (struct target_if_spectral *)arg;
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
vdev = target_if_spectral_get_vdev(spectral);
|
||||
@@ -879,8 +969,8 @@ u_int32_t tif_spectral_sim_configure_params(
|
||||
" proceeding with param config.\n");
|
||||
is_invalid_width = true;
|
||||
default:
|
||||
qdf_print("Spectral simulation: Unknown width %u...asserting\n"
|
||||
, bw);
|
||||
qdf_print("Spectral simulation: Unknown width %u...asserting\n",
|
||||
bw);
|
||||
qdf_assert_always(0);
|
||||
break;
|
||||
}
|
||||
@@ -927,25 +1017,26 @@ u_int32_t tif_spectral_sim_configure_params(
|
||||
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL(tif_spectral_sim_configure_params);
|
||||
EXPORT_SYMBOL(target_if_spectral_sops_sim_configure_params);
|
||||
|
||||
u_int32_t tif_spectral_sim_get_params(
|
||||
void *arg,
|
||||
struct spectral_config *params)
|
||||
uint32_t
|
||||
target_if_spectral_sops_sim_get_params(
|
||||
void *arg, struct spectral_config *params)
|
||||
{
|
||||
struct target_if_spectral *spectral = NULL;
|
||||
ath_spectralsim_context *simctx = NULL;
|
||||
struct spectralsim_context *simctx = NULL;
|
||||
|
||||
qdf_assert_always(params);
|
||||
|
||||
spectral = (struct target_if_spectral *)arg;
|
||||
qdf_assert_always(spectral);
|
||||
|
||||
simctx = (ath_spectralsim_context *)spectral->simctx;
|
||||
simctx = (struct spectralsim_context *)spectral->simctx;
|
||||
qdf_assert_always(simctx);
|
||||
|
||||
if (!simctx->curr_reportset) {
|
||||
qdf_print("Spectral simulation: No configured reportset found.\n");
|
||||
qdf_print
|
||||
("Spectral simulation: No configured reportset found.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -953,6 +1044,6 @@ u_int32_t tif_spectral_sim_get_params(
|
||||
|
||||
return 1;
|
||||
}
|
||||
EXPORT_SYMBOL(tif_spectral_sim_get_params);
|
||||
EXPORT_SYMBOL(target_if_spectral_sops_sim_get_params);
|
||||
|
||||
#endif /* QCA_SUPPORT_SPECTRAL_SIMULATION */
|
||||
|
@@ -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
|
||||
@@ -24,83 +24,100 @@
|
||||
#include "target_if_spectral.h"
|
||||
|
||||
/**
|
||||
* @brief Initialize Spectral Simulation functionality
|
||||
* @details
|
||||
* target_if_spectral_sim_attach() - Initialize Spectral Simulation
|
||||
* functionality
|
||||
* @spectral - pointer to spectral internal data structure
|
||||
*
|
||||
* Setup data structures to be used for serving out data corresponding to
|
||||
* various bandwidths and configurations.
|
||||
*
|
||||
* @param spectral - ath_spectral structure
|
||||
* @return Integer status value. 0:Success, -1:Failure
|
||||
* Return: Integer status value. 0:Success, -1:Failure
|
||||
*/
|
||||
int target_if_spectral_sim_attach(struct target_if_spectral *spectral);
|
||||
|
||||
/**
|
||||
* @brief De-initialize Spectral Simulation functionality
|
||||
* @details
|
||||
* target_if_spectral_sim_detach() - De-initialize Spectral Simulation
|
||||
* functionality
|
||||
* @spectral - pointer to spectral internal data structure
|
||||
*
|
||||
* Free up data structures used for serving out data corresponding to various
|
||||
* bandwidths and configurations.
|
||||
*
|
||||
* @param spectral - ath_spectral structure
|
||||
* Return: None
|
||||
*/
|
||||
void target_if_spectral_sim_detach(struct target_if_spectral *spectral);
|
||||
|
||||
/**
|
||||
* @brief Check if Spectral (simulated) is active
|
||||
* target_if_spectral_sops_sim_is_active() - Check if Spectral(simulated) is
|
||||
* active
|
||||
* @arg - pointer to spectral internal data structure
|
||||
*
|
||||
* @param arg - pointer to ath_spectral structure
|
||||
* @return Integer status value. 0: Not active, 1: Active
|
||||
* Check if Spectral (simulated) is active
|
||||
*
|
||||
* Return: Integer status value. 0: Not active, 1: Active
|
||||
*/
|
||||
u_int32_t tif_spectral_sim_is_spectral_active(void *arg);
|
||||
uint32_t target_if_spectral_sops_sim_is_active(void *arg);
|
||||
|
||||
/**
|
||||
* @brief Check if Spectral (simulated) is enabled
|
||||
* target_if_spectral_sops_sim_is_enabled() - Check if Spectral(simulated) is
|
||||
* enabled
|
||||
* @arg - pointer to spectral internal data structure
|
||||
*
|
||||
* @param arg - pointer to ath_spectral structure
|
||||
* @return Integer status value. 0: Not enabled, 1: Enabled
|
||||
* Check if Spectral(simulated) is enabled
|
||||
*
|
||||
* Return: Integer status value. 0: Not enabled, 1: Enabled
|
||||
*/
|
||||
u_int32_t tif_spectral_sim_is_spectral_enabled(void *arg);
|
||||
uint32_t target_if_spectral_sops_sim_is_enabled(void *arg);
|
||||
|
||||
/**
|
||||
* @brief Start Spectral simulation
|
||||
* target_if_spectral_sops_sim_start_scan() - Start Spectral simulation
|
||||
* @arg - pointer to spectral internal data structure
|
||||
*
|
||||
* @param arg - pointer to ath_spectral structure
|
||||
* @return Integer status value. 0: Failure, 1: Success
|
||||
* Start Spectral simulation
|
||||
*
|
||||
* Return: Integer status value. 0: Failure, 1: Success
|
||||
*/
|
||||
u_int32_t tif_spectral_sim_start_spectral_scan(void *arg);
|
||||
uint32_t target_if_spectral_sops_sim_start_scan(void *arg);
|
||||
|
||||
/**
|
||||
* @brief Stop Spectral simulation
|
||||
* target_if_spectral_sops_sim_stop_scan() - Stop Spectral simulation
|
||||
* @arg - pointer to spectral internal data structure
|
||||
*
|
||||
* @param arg - pointer to ath_spectral structure
|
||||
* @return Integer status value. 0: Failure, 1: Success
|
||||
* Stop Spectral simulation
|
||||
*
|
||||
* Return: Integer status value. 0: Failure, 1: Success
|
||||
*/
|
||||
u_int32_t tif_spectral_sim_stop_spectral_scan(void *arg);
|
||||
uint32_t target_if_spectral_sops_sim_stop_scan(void *arg);
|
||||
|
||||
/**
|
||||
* @brief Configure Spectral parameters into simulation
|
||||
* @details
|
||||
* target_if_spectral_sops_sim_configure_params() - Configure Spectral
|
||||
* parameters into simulation
|
||||
* arg - pointer to ath_spectral structure
|
||||
* params - pointer to struct spectral_config structure bearing Spectral
|
||||
* configuration
|
||||
*
|
||||
* Internally, this function actually searches if a record set with the desired
|
||||
* configuration has been loaded. If so, it points to the record set for
|
||||
* later usage when the simulation is started. If not, it returns an error.
|
||||
*
|
||||
* @param arg - pointer to ath_spectral structure
|
||||
* @param params - pointer to struct spectral_config structure bearing Spectral
|
||||
* configuration
|
||||
* @return Integer status value. 0: Failure, 1: Success
|
||||
* Return: Integer status value. 0: Failure, 1: Success
|
||||
*/
|
||||
u_int32_t tif_spectral_sim_configure_params(
|
||||
uint32_t target_if_spectral_sops_sim_configure_params(
|
||||
void *arg,
|
||||
struct spectral_config *params);
|
||||
|
||||
/**
|
||||
* @brief Get Spectral parameters configured into simulation
|
||||
*
|
||||
* @param arg - pointer to ath_spectral structure
|
||||
* @param params - pointer to struct spectral_config structure which should be
|
||||
* target_if_spectral_sops_sim_get_params() - Get Spectral parameters configured
|
||||
* into simulation
|
||||
* arg - pointer to ath_spectral structure
|
||||
* params - pointer to struct spectral_config structure which should be
|
||||
* populated with Spectral configuration
|
||||
* @return Integer status value. 0: Failure, 1: Success
|
||||
*
|
||||
* Get Spectral parameters configured into simulation
|
||||
*
|
||||
* Return: Integer status value. 0: Failure, 1: Success
|
||||
*/
|
||||
u_int32_t tif_spectral_sim_get_params(
|
||||
uint32_t target_if_spectral_sops_sim_get_params(
|
||||
void *arg,
|
||||
struct spectral_config *params);
|
||||
|
||||
|
@@ -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
|
||||
@@ -24,67 +24,97 @@
|
||||
#include "target_if_spectral.h"
|
||||
|
||||
/* #define SPECTRAL_SIM_DUMP_PARAM_DATA 1 */
|
||||
/* Spectral report data instance. Usable in a linked list.
|
||||
* - In the case of Direct Attach chipsets, one instance should correspond to
|
||||
/**
|
||||
* struct spectralsim_report - Linked list node of spectal simulation report
|
||||
* Spectral report data instance. Usable in a linked list.
|
||||
* In the case of Direct Attach chipsets, one instance should correspond to
|
||||
* one PHY Data Error frame received from the HW.
|
||||
* XXX Direct Attach support to be implemented if needed. Any modifications
|
||||
* required here can be made at the time of implementation.
|
||||
* - In the case of 802.11ac offload chipsets, one instance should correspond to
|
||||
* In the case of 802.11ac offload chipsets, one instance should correspond to
|
||||
* one report received from HW, inclusive of all TLVs.
|
||||
*
|
||||
* @rfqual_info: RF measurement information
|
||||
* @chan_info: Channel information
|
||||
* @datasize: Length of report data
|
||||
* @data: Pointer to report data
|
||||
* @next: Pointer to next node in the struct spectralsim_report
|
||||
*/
|
||||
typedef struct _ath_spectralsim_report {
|
||||
struct spectralsim_report {
|
||||
/* 11ac onwards only */
|
||||
struct target_if_spectral_rfqual_info rfqual_info;
|
||||
/* 11ac onwards only */
|
||||
struct target_if_spectral_chan_info chan_info;
|
||||
u_int32_t datasize;
|
||||
u_int8_t *data;
|
||||
struct _ath_spectralsim_report *next;
|
||||
} ath_spectralsim_report;
|
||||
uint32_t datasize;
|
||||
uint8_t *data;
|
||||
struct spectralsim_report *next;
|
||||
};
|
||||
|
||||
/* Set of Spectral report data instances corresponding to one particular
|
||||
* configuration. Usable in a linked list.
|
||||
/**
|
||||
* struct spectralsim_reportset - Set of Spectral report data instances
|
||||
* corresponding to one particular configuration. Usable in a linked list.
|
||||
* @config: Spectral config parameters
|
||||
* @headreport: Pointer to the linked list of struct spectralsim_report
|
||||
* @curr_report: Pointer to current node in the linked list of
|
||||
* struct spectralsim_report
|
||||
* @next: Pointer to next node in the struct spectralsim_reportset
|
||||
*/
|
||||
typedef struct _ath_spectralsim_reportset {
|
||||
struct spectralsim_reportset {
|
||||
struct spectral_config config;
|
||||
ath_spectralsim_report *headreport;
|
||||
ath_spectralsim_report *curr_report;
|
||||
struct _ath_spectralsim_reportset *next;
|
||||
} ath_spectralsim_reportset;
|
||||
struct spectralsim_report *headreport;
|
||||
struct spectralsim_report *curr_report;
|
||||
struct spectralsim_reportset *next;
|
||||
};
|
||||
|
||||
/* Main structure for Spectral simulation. All data and controls get linked
|
||||
* here.
|
||||
/*
|
||||
* struct spectralsim_context - Main structure for Spectral simulation.
|
||||
* All data and controls get linked here.
|
||||
*
|
||||
* For each width (20/40/80/160/80+80), we will have a linked list of
|
||||
* ath_spectralsim_reportset nodes. Each ath_spectralsim_reportset will have a
|
||||
* linked list of ath_spectralsim_report nodes. When the user requests for a
|
||||
* spectralsim_reportset nodes. Each struct spectralsim_reportset will have a
|
||||
* linked list of struct spectralsim_report nodes. When the user requests for a
|
||||
* given PHY mode and Spectral configuration, we find the appropriate
|
||||
* ath_spectralsim_reportset, and then serve ath_spectralsim_report instances
|
||||
* spectralsim_reportset, and then serve struct spectralsim_report instances
|
||||
* from the linked list. If required report count is higher than size of linked
|
||||
* list (or infinite), we repeatedly cycle through the linked list. There can
|
||||
* be more elaborate data structures devised taking care of a large number of
|
||||
* possibilities, but we stick to a simple scheme given limited simulation
|
||||
* needs.
|
||||
*
|
||||
* @bw20_headreportset : Linked list of spectralsim_reportset for 20MHz width
|
||||
* @bw20_headreportset : Linked list of spectralsim_reportset for 40MHz width
|
||||
* @bw20_headreportset : Linked list of spectralsim_reportset for 80MHz width
|
||||
* @bw20_headreportset : Linked list of spectralsim_reportset for 160MHz width
|
||||
* @bw20_headreportset : Linked list of spectralsim_reportset for 80_80MHz width
|
||||
* @curr_reportset : Pointer to current node in the linked list of
|
||||
* struct spectralsim_reportset
|
||||
* @is_enabled : Whether the simulated spectral scan is set as enabled
|
||||
* @is_active : Whether the simulated spectral scan is set as active
|
||||
* @ssim_pherrdelivery_timer : Simulated Phyerr delivery timer
|
||||
* @ssim_starting_tsf64 : Starting 64-bit TSF value for spectral simulation
|
||||
* @ssim_period_ms : Simulated Phyerr delivery period in ms
|
||||
* @ssim_count : Number of simulated spectral samples to deliver
|
||||
* @populate_report_static : Pointer to function to populate static spectral
|
||||
* report data
|
||||
*/
|
||||
typedef struct _ath_spectralsim_context {
|
||||
ath_spectralsim_reportset *bw20_headreportset;
|
||||
ath_spectralsim_reportset *bw40_headreportset;
|
||||
ath_spectralsim_reportset *bw80_headreportset;
|
||||
ath_spectralsim_reportset *bw160_headreportset;
|
||||
ath_spectralsim_reportset *bw80_80_headreportset;
|
||||
struct spectralsim_context {
|
||||
struct spectralsim_reportset *bw20_headreportset;
|
||||
struct spectralsim_reportset *bw40_headreportset;
|
||||
struct spectralsim_reportset *bw80_headreportset;
|
||||
struct spectralsim_reportset *bw160_headreportset;
|
||||
struct spectralsim_reportset *bw80_80_headreportset;
|
||||
|
||||
ath_spectralsim_reportset *curr_reportset;
|
||||
struct spectralsim_reportset *curr_reportset;
|
||||
bool is_enabled;
|
||||
bool is_active;
|
||||
|
||||
qdf_timer_t ssim_pherrdelivery_timer;
|
||||
u_int64_t ssim_starting_tsf64;
|
||||
u_int32_t ssim_period_ms; /* TODO: Support in microseconds */
|
||||
u_int32_t ssim_count;
|
||||
int (*populate_report_static)(ath_spectralsim_report *report,
|
||||
enum phy_ch_width width,
|
||||
bool is_80_80);
|
||||
} ath_spectralsim_context;
|
||||
uint64_t ssim_starting_tsf64;
|
||||
uint32_t ssim_period_ms; /* TODO: Support in microseconds */
|
||||
uint32_t ssim_count;
|
||||
int (*populate_report_static)(struct spectralsim_report *report,
|
||||
enum phy_ch_width width, bool is_80_80);
|
||||
};
|
||||
|
||||
/* Helper Macros */
|
||||
|
||||
@@ -92,21 +122,21 @@ typedef struct _ath_spectralsim_context {
|
||||
#define SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, reportset, width, \
|
||||
is_80_80) \
|
||||
{ \
|
||||
(reportset) = (ath_spectralsim_reportset *) \
|
||||
qdf_mem_malloc(sizeof(ath_spectralsim_reportset)); \
|
||||
(reportset) = (struct spectralsim_reportset *) \
|
||||
qdf_mem_malloc(sizeof(struct spectralsim_reportset)); \
|
||||
\
|
||||
if ((reportset) == NULL) { \
|
||||
qdf_print("Spectral simulation: Could not allocate memory " \
|
||||
"for report set\n"); \
|
||||
depopulate_simdata((simctx)); \
|
||||
target_if_depopulate_simdata((simctx)); \
|
||||
return -EPERM; \
|
||||
} \
|
||||
\
|
||||
qdf_mem_zero((reportset), sizeof(ath_spectralsim_reportset)); \
|
||||
qdf_mem_zero((reportset), sizeof(struct spectralsim_reportset)); \
|
||||
\
|
||||
if (populate_reportset_static( \
|
||||
if (target_if_populate_reportset_static( \
|
||||
(simctx), (reportset), (width), (is_80_80)) != 0) { \
|
||||
depopulate_simdata((simctx)); \
|
||||
target_if_depopulate_simdata((simctx)); \
|
||||
return -EPERM; \
|
||||
} \
|
||||
\
|
||||
@@ -116,14 +146,14 @@ typedef struct _ath_spectralsim_context {
|
||||
/* Depopulate and free list of report sets */
|
||||
#define SPECTRAL_SIM_REPORTSET_DEPOPLFREE_LIST(reportset) \
|
||||
{ \
|
||||
ath_spectralsim_reportset *curr_reportset = NULL; \
|
||||
ath_spectralsim_reportset *next_reportset = NULL; \
|
||||
struct spectralsim_reportset *curr_reportset = NULL; \
|
||||
struct spectralsim_reportset *next_reportset = NULL; \
|
||||
\
|
||||
curr_reportset = (reportset); \
|
||||
\
|
||||
while (curr_reportset) { \
|
||||
next_reportset = curr_reportset->next; \
|
||||
depopulate_reportset(curr_reportset); \
|
||||
target_if_depopulate_reportset(curr_reportset); \
|
||||
qdf_mem_free(curr_reportset); \
|
||||
curr_reportset = next_reportset; \
|
||||
} \
|
||||
@@ -135,6 +165,7 @@ typedef struct _ath_spectralsim_context {
|
||||
|
||||
/* 20 MHz */
|
||||
|
||||
/* Report data for 20MHz bandwidth for generation 2 chipsets */
|
||||
static uint8_t reportdata_20_gen2[] = {
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
0xbb, /* Signature */
|
||||
@@ -159,6 +190,7 @@ static uint8_t reportdata_20_gen2[] = {
|
||||
1, 1, 0, 2, 1, 2, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0,
|
||||
};
|
||||
|
||||
/* Report data for 20MHz bandwidth for generation 3 chipsets */
|
||||
static uint8_t reportdata_20_gen3[] = {
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
0x12, 0x34, 0x56, 0x78, /* fft_timestamp */
|
||||
@@ -187,6 +219,7 @@ static uint8_t reportdata_20_gen3[] = {
|
||||
1, 1, 0, 2, 1, 2, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
/* RF measurement information for 20 MHz bandwidth */
|
||||
static struct target_if_spectral_rfqual_info rfqual_info_20 = {
|
||||
.rssi_comb = 1,
|
||||
|
||||
@@ -216,12 +249,14 @@ static struct target_if_spectral_rfqual_info rfqual_info_20 = {
|
||||
.noise_floor[3] = -90,
|
||||
};
|
||||
|
||||
/* Channel information for 20 MHz bandwidth */
|
||||
static struct target_if_spectral_chan_info chan_info_20 = {
|
||||
.center_freq1 = 5180,
|
||||
.center_freq2 = 0,
|
||||
.chan_width = 20,
|
||||
};
|
||||
|
||||
/* Spectral config parameters for 20 MHz bandwidth */
|
||||
static struct spectral_config config_20_1 = {
|
||||
.ss_fft_period = 1,
|
||||
.ss_period = 35,
|
||||
@@ -261,6 +296,7 @@ static struct spectral_config config_20_1 = {
|
||||
|
||||
/* 40 MHz */
|
||||
|
||||
/* Report data for 40MHz bandwidth for generation 2 chipsets */
|
||||
static uint8_t reportdata_40_gen2[] = {
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
0xbb, /* Signature */
|
||||
@@ -288,6 +324,7 @@ static uint8_t reportdata_40_gen2[] = {
|
||||
0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0,
|
||||
};
|
||||
|
||||
/* Report data for 40MHz bandwidth for generation 3 chipsets */
|
||||
static uint8_t reportdata_40_gen3[] = {
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
0x12, 0x34, 0x56, 0x78, /* fft_timestamp */
|
||||
@@ -319,6 +356,7 @@ static uint8_t reportdata_40_gen3[] = {
|
||||
0, 0, 0, 1, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
/* RF measurement information for 40 MHz bandwidth */
|
||||
static struct target_if_spectral_rfqual_info rfqual_info_40 = {
|
||||
.rssi_comb = 1,
|
||||
|
||||
@@ -348,12 +386,14 @@ static struct target_if_spectral_rfqual_info rfqual_info_40 = {
|
||||
.noise_floor[3] = -90,
|
||||
};
|
||||
|
||||
/* Channel information for 40 MHz bandwidth */
|
||||
static struct target_if_spectral_chan_info chan_info_40 = {
|
||||
.center_freq1 = 5180,
|
||||
.center_freq2 = 0,
|
||||
.chan_width = 40,
|
||||
};
|
||||
|
||||
/* Spectral config parameters for 40 MHz bandwidth */
|
||||
static struct spectral_config config_40_1 = {
|
||||
.ss_fft_period = 1,
|
||||
.ss_period = 35,
|
||||
@@ -393,6 +433,7 @@ static struct spectral_config config_40_1 = {
|
||||
|
||||
/* 80 MHz */
|
||||
|
||||
/* Report data for 80MHz bandwidth for generation 2 chipsets */
|
||||
static uint8_t reportdata_80_gen2[] = {
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
0xbb, /* Signature */
|
||||
@@ -425,6 +466,7 @@ static uint8_t reportdata_80_gen2[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
/* Report data for 80MHz bandwidth for generation 3 chipsets */
|
||||
static uint8_t reportdata_80_gen3[] = {
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
0x12, 0x34, 0x56, 0x78, /* fft_timestamp */
|
||||
@@ -461,6 +503,7 @@ static uint8_t reportdata_80_gen3[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
/* RF measurement information for 80 MHz bandwidth */
|
||||
static struct target_if_spectral_rfqual_info rfqual_info_80 = {
|
||||
.rssi_comb = 16,
|
||||
|
||||
@@ -490,12 +533,14 @@ static struct target_if_spectral_rfqual_info rfqual_info_80 = {
|
||||
.noise_floor[3] = -90,
|
||||
};
|
||||
|
||||
/* Channel information for 80 MHz bandwidth */
|
||||
static struct target_if_spectral_chan_info chan_info_80 = {
|
||||
.center_freq1 = 5210,
|
||||
.center_freq2 = 0,
|
||||
.chan_width = 80,
|
||||
};
|
||||
|
||||
/* Spectral config parameters for 80 MHz bandwidth */
|
||||
static struct spectral_config config_80_1 = {
|
||||
.ss_fft_period = 1,
|
||||
.ss_period = 35,
|
||||
@@ -535,6 +580,7 @@ static struct spectral_config config_80_1 = {
|
||||
|
||||
/* 160 MHz */
|
||||
|
||||
/* Report data for 160MHz bandwidth for generation 2 chipsets */
|
||||
static uint8_t reportdata_160_gen2[] = {
|
||||
/* Segment 1 */
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
@@ -601,6 +647,7 @@ static uint8_t reportdata_160_gen2[] = {
|
||||
0,
|
||||
};
|
||||
|
||||
/* Report data for 160MHz bandwidth for generation 3 chipsets */
|
||||
static uint8_t reportdata_160_gen3[] = {
|
||||
/* Segment 1 */
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
@@ -673,6 +720,7 @@ static uint8_t reportdata_160_gen3[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
/* RF measurement information for 160 MHz bandwidth */
|
||||
static struct target_if_spectral_rfqual_info rfqual_info_160 = {
|
||||
.rssi_comb = 3,
|
||||
|
||||
@@ -702,12 +750,14 @@ static struct target_if_spectral_rfqual_info rfqual_info_160 = {
|
||||
.noise_floor[3] = -90,
|
||||
};
|
||||
|
||||
/* Channel information for 160 MHz bandwidth */
|
||||
static struct target_if_spectral_chan_info chan_info_160 = {
|
||||
.center_freq1 = 5250,
|
||||
.center_freq2 = 0,
|
||||
.chan_width = 160,
|
||||
};
|
||||
|
||||
/* Spectral config parameters for 160 MHz bandwidth */
|
||||
static struct spectral_config config_160_1 = {
|
||||
.ss_fft_period = 1,
|
||||
.ss_period = 35,
|
||||
@@ -747,6 +797,7 @@ static struct spectral_config config_160_1 = {
|
||||
|
||||
/* 80+80 MHz */
|
||||
|
||||
/* Report data for 80_80MHz bandwidth for generation 2 chipsets */
|
||||
static uint8_t reportdata_80_80_gen2[] = {
|
||||
/* Segment 1 */
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
@@ -813,6 +864,7 @@ static uint8_t reportdata_80_80_gen2[] = {
|
||||
0,
|
||||
};
|
||||
|
||||
/* Report data for 80_80MHz bandwidth for generation 3 chipsets */
|
||||
static uint8_t reportdata_80_80_gen3[] = {
|
||||
/* Segment 1 */
|
||||
#ifdef BIG_ENDIAN_HOST
|
||||
@@ -885,6 +937,7 @@ static uint8_t reportdata_80_80_gen3[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
};
|
||||
|
||||
/* RF measurement information for 80_80 MHz bandwidth */
|
||||
static struct target_if_spectral_rfqual_info rfqual_info_80_80 = {
|
||||
.rssi_comb = 1,
|
||||
|
||||
@@ -914,12 +967,14 @@ static struct target_if_spectral_rfqual_info rfqual_info_80_80 = {
|
||||
.noise_floor[3] = -90,
|
||||
};
|
||||
|
||||
/* Channel information for 80_80 MHz bandwidth */
|
||||
static struct target_if_spectral_chan_info chan_info_80_80 = {
|
||||
.center_freq1 = 5210,
|
||||
.center_freq2 = 5530,
|
||||
.chan_width = 160,
|
||||
};
|
||||
|
||||
/* Spectral config parameters for 80_80 MHz bandwidth */
|
||||
static struct spectral_config config_80_80_1 = {
|
||||
.ss_fft_period = 1,
|
||||
.ss_period = 35,
|
||||
|
Reference in New Issue
Block a user