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:
Shiva Krishna Pittala
2018-01-25 20:36:53 +05:30
committed by snandini
parent 318d20fc69
commit e37387598e
4 changed files with 1072 additions and 909 deletions

View File

@@ -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 * use of record and replay of samples would concern higher
* level sample processing rather than lower level delivery. * level sample processing rather than lower level delivery.
*/ */
p_sops->is_spectral_enabled = tif_spectral_sim_is_spectral_enabled; p_sops->is_spectral_enabled = target_if_spectral_sops_sim_is_enabled;
p_sops->is_spectral_active = tif_spectral_sim_is_spectral_active; p_sops->is_spectral_active = target_if_spectral_sops_sim_is_active;
p_sops->start_spectral_scan = tif_spectral_sim_start_spectral_scan; p_sops->start_spectral_scan = target_if_spectral_sops_sim_start_scan;
p_sops->stop_spectral_scan = tif_spectral_sim_stop_spectral_scan; p_sops->stop_spectral_scan = target_if_spectral_sops_sim_stop_scan;
p_sops->configure_spectral = p_sops->configure_spectral =
tif_spectral_sim_configure_params; target_if_spectral_sops_sim_configure_params;
p_sops->get_spectral_config = tif_spectral_sim_get_params; p_sops->get_spectral_config = target_if_spectral_sops_sim_get_params;
} }
#else #else

View File

@@ -30,28 +30,29 @@
/* Helper functions */ /* Helper functions */
int tif_populate_reportset_fromfile(ath_spectralsim_reportset * reportset, static int target_if_populate_report_static_gen2(
enum phy_ch_width width, struct spectralsim_report *report,
bool is_80_80); enum phy_ch_width width, bool is_80_80);
static int populate_report_static_gen2(ath_spectralsim_report *report, static int target_if_populate_report_static_gen3(
enum phy_ch_width width, struct spectralsim_report *report,
bool is_80_80); enum phy_ch_width width, bool is_80_80);
static int populate_report_static_gen3(ath_spectralsim_report *report, static void target_if_depopulate_report(
enum phy_ch_width width, struct spectralsim_report *report);
bool is_80_80);
static void depopulate_report(ath_spectralsim_report *report);
static int populate_reportset_static(ath_spectralsim_context *simctx, static int target_if_populate_reportset_static(
ath_spectralsim_reportset *reportset, struct spectralsim_context *simctx,
enum phy_ch_width width, struct spectralsim_reportset *reportset,
bool is_80_80); enum phy_ch_width width, bool is_80_80);
static void depopulate_reportset(ath_spectralsim_reportset *reportset); static void target_if_depopulate_reportset(
struct spectralsim_reportset *
reportset);
static int populate_simdata(ath_spectralsim_context *simctx); static int target_if_populate_simdata(struct spectralsim_context *simctx);
static void depopulate_simdata(ath_spectralsim_context *simctx); static void target_if_depopulate_simdata(struct spectralsim_context *simctx);
static OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler); 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 * 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 * report per configuration (since we need the data only for ensuring correct
* format handling). * format handling).
@@ -59,22 +60,34 @@ static OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler);
* Extend this for more functionality if required in the future. * 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, * target_if_populate_report_static_gen2() - Statically populate simulation
enum phy_ch_width width, * data for one report for generation 2 chipsets
bool is_80_80) * @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); qdf_assert_always(report);
switch (width) { switch (width) {
case CH_WIDTH_20MHZ: case CH_WIDTH_20MHZ:
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_20_gen2)); qdf_mem_malloc(sizeof(reportdata_20_gen2));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate memory for " qdf_print
"report data\n"); ("Spectral simulation: Could not allocate memory "
"for report data\n");
goto bad; goto bad;
} }
@@ -91,12 +104,13 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
break; break;
case CH_WIDTH_40MHZ: case CH_WIDTH_40MHZ:
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_40_gen2)); qdf_mem_malloc(sizeof(reportdata_40_gen2));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate memory for " qdf_print
"report data\n"); ("Spectral simulation: Could not allocate memory "
"for report data\n");
goto bad; goto bad;
} }
@@ -113,12 +127,13 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
break; break;
case CH_WIDTH_80MHZ: case CH_WIDTH_80MHZ:
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_80_gen2)); qdf_mem_malloc(sizeof(reportdata_80_gen2));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate memory for " qdf_print
"report data\n"); ("Spectral simulation: Could not allocate memory "
"for report data\n");
goto bad; goto bad;
} }
@@ -136,11 +151,12 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
case CH_WIDTH_160MHZ: case CH_WIDTH_160MHZ:
if (is_80_80) { if (is_80_80) {
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_80_80_gen2)); qdf_mem_malloc(sizeof(reportdata_80_80_gen2));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate " qdf_print
("Spectral simulation: Could not allocate "
"memory for report data\n"); "memory for report data\n");
goto bad; goto bad;
} }
@@ -150,18 +166,21 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
reportdata_80_80_gen2, report->datasize); reportdata_80_80_gen2, report->datasize);
qdf_mem_copy(&report->rfqual_info, 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, qdf_mem_copy(&report->chan_info,
&chan_info_80_80, sizeof(report->chan_info)); &chan_info_80_80,
sizeof(report->chan_info));
} else { } else {
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_160_gen2)); qdf_mem_malloc(sizeof(reportdata_160_gen2));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate " qdf_print
("Spectral simulation: Could not allocate "
"memory for report data\n"); "memory for report data\n");
goto bad; goto bad;
} }
@@ -171,7 +190,8 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
reportdata_160_gen2, report->datasize); reportdata_160_gen2, report->datasize);
qdf_mem_copy(&report->rfqual_info, 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, qdf_mem_copy(&report->chan_info,
&chan_info_160, sizeof(report->chan_info)); &chan_info_160, sizeof(report->chan_info));
@@ -184,21 +204,32 @@ static int populate_report_static_gen2(ath_spectralsim_report *report,
return 0; return 0;
bad: bad:
return -EPERM; return -EPERM;
} }
/* Statically populate simulation data for one report. */ /**
static int populate_report_static_gen3(ath_spectralsim_report *report, * target_if_populate_report_static_gen3() - Statically populate simulation
enum phy_ch_width width, * data for one report for generation 3 chipsets
bool is_80_80) * @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); qdf_assert_always(report);
switch (width) { switch (width) {
case CH_WIDTH_20MHZ: case CH_WIDTH_20MHZ:
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_20_gen3)); qdf_mem_malloc(sizeof(reportdata_20_gen3));
if (!report->data) { if (!report->data) {
@@ -220,7 +251,7 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
break; break;
case CH_WIDTH_40MHZ: case CH_WIDTH_40MHZ:
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_40_gen3)); qdf_mem_malloc(sizeof(reportdata_40_gen3));
if (!report->data) { if (!report->data) {
@@ -242,12 +273,13 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
break; break;
case CH_WIDTH_80MHZ: case CH_WIDTH_80MHZ:
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_80_gen3)); qdf_mem_malloc(sizeof(reportdata_80_gen3));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate memory for " qdf_print
"report data\n"); ("Spectral simulation: Could not allocate memory "
"for report data\n");
goto bad; goto bad;
} }
@@ -265,11 +297,12 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
case CH_WIDTH_160MHZ: case CH_WIDTH_160MHZ:
if (is_80_80) { if (is_80_80) {
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_80_80_gen3)); qdf_mem_malloc(sizeof(reportdata_80_80_gen3));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate " qdf_print
("Spectral simulation: Could not allocate "
"memory for report data\n"); "memory for report data\n");
goto bad; goto bad;
} }
@@ -279,18 +312,21 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
reportdata_80_80_gen3, report->datasize); reportdata_80_80_gen3, report->datasize);
qdf_mem_copy(&report->rfqual_info, 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, qdf_mem_copy(&report->chan_info,
&chan_info_80_80, sizeof(report->chan_info)); &chan_info_80_80,
sizeof(report->chan_info));
} else { } else {
report->data = NULL; report->data = NULL;
report->data = (u_int8_t *) report->data = (uint8_t *)
qdf_mem_malloc(sizeof(reportdata_160_gen3)); qdf_mem_malloc(sizeof(reportdata_160_gen3));
if (!report->data) { if (!report->data) {
qdf_print("Spectral simulation: Could not allocate " qdf_print
("Spectral simulation: Could not allocate "
"memory for report data\n"); "memory for report data\n");
goto bad; goto bad;
} }
@@ -300,7 +336,8 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
reportdata_160_gen3, report->datasize); reportdata_160_gen3, report->datasize);
qdf_mem_copy(&report->rfqual_info, 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, qdf_mem_copy(&report->chan_info,
&chan_info_160, sizeof(report->chan_info)); &chan_info_160, sizeof(report->chan_info));
@@ -313,11 +350,22 @@ static int populate_report_static_gen3(ath_spectralsim_report *report,
return 0; return 0;
bad: bad:
return -EPERM; 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) if (!report)
return; 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, * target_if_populate_reportset_static() - Statically populate simulation data
ath_spectralsim_reportset *reportset, * for a given configuration
enum phy_ch_width width, * @simctx: Pointer to struct spectralsim_context
bool is_80_80) * @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; int ret = 0;
ath_spectralsim_report *report = NULL; struct spectralsim_report *report = NULL;
qdf_assert_always(reportset); qdf_assert_always(reportset);
@@ -344,8 +404,8 @@ static int populate_reportset_static(ath_spectralsim_context *simctx,
reportset->curr_report = NULL; reportset->curr_report = NULL;
/* For now, we populate only one report */ /* For now, we populate only one report */
report = (ath_spectralsim_report *) report = (struct spectralsim_report *)
qdf_mem_malloc(sizeof(ath_spectralsim_report)); qdf_mem_malloc(sizeof(struct spectralsim_report));
if (!report) { if (!report) {
qdf_print("Spectral simulation: Could not allocate memory " 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: case CH_WIDTH_160MHZ:
if (is_80_80) { if (is_80_80) {
qdf_mem_copy(&reportset->config, qdf_mem_copy(&reportset->config,
&config_80_80_1, sizeof(reportset->config)); &config_80_80_1,
sizeof(reportset->config));
ret = simctx->populate_report_static( ret = simctx->populate_report_static(report,
report,
CH_WIDTH_160MHZ, CH_WIDTH_160MHZ,
1); 1);
if (ret != 0) if (ret != 0)
@@ -407,8 +467,7 @@ static int populate_reportset_static(ath_spectralsim_context *simctx,
qdf_mem_copy(&reportset->config, qdf_mem_copy(&reportset->config,
&config_160_1, sizeof(reportset->config)); &config_160_1, sizeof(reportset->config));
ret = simctx->populate_report_static( ret = simctx->populate_report_static(report,
report,
CH_WIDTH_160MHZ, CH_WIDTH_160MHZ,
0); 0);
if (ret != 0) if (ret != 0)
@@ -427,15 +486,26 @@ static int populate_reportset_static(ath_spectralsim_context *simctx,
return 0; return 0;
bad: bad:
depopulate_reportset(reportset); target_if_depopulate_reportset(reportset);
return -EPERM; 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; struct spectralsim_report *curr_report = NULL;
ath_spectralsim_report *next_report = NULL; struct spectralsim_report *next_report = NULL;
if (!reportset) if (!reportset)
return; return;
@@ -444,64 +514,53 @@ static void depopulate_reportset(ath_spectralsim_reportset *reportset)
while (curr_report) { while (curr_report) {
next_report = curr_report->next; next_report = curr_report->next;
depopulate_report(curr_report); target_if_depopulate_report(curr_report);
qdf_mem_free(curr_report); qdf_mem_free(curr_report);
curr_report = next_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 * target_if_populate_simdata() - Populate simulation data
* basis. * @simctx: Pointer to struct spectralsim_context
* *
* A different file per bandwidth is suggested for better segregation of data * Populate simulation data
* sets (since data is likely to be very different across BWs). *
* Return: 0 on success, negative error code on failure
*/ */
int tif_populate_reportset_fromfile(ath_spectralsim_reportset *reportset, static int
enum phy_ch_width width, target_if_populate_simdata(
bool is_80_80) struct spectralsim_context *simctx)
{ {
qdf_print("%s: To be implemented if required\n", __func__); /*
* For now, we use static population. Switch to loading from a file if
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
* needed in the future. * needed in the future.
*/ */
simctx->bw20_headreportset = NULL; simctx->bw20_headreportset = NULL;
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
simctx->bw20_headreportset, simctx->bw20_headreportset,
CH_WIDTH_20MHZ, CH_WIDTH_20MHZ, 0);
0);
simctx->bw40_headreportset = NULL; simctx->bw40_headreportset = NULL;
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
simctx->bw40_headreportset, simctx->bw40_headreportset,
CH_WIDTH_40MHZ, CH_WIDTH_40MHZ, 0);
0);
simctx->bw80_headreportset = NULL; simctx->bw80_headreportset = NULL;
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
simctx->bw80_headreportset, simctx->bw80_headreportset,
CH_WIDTH_80MHZ, CH_WIDTH_80MHZ, 0);
0);
simctx->bw160_headreportset = NULL; simctx->bw160_headreportset = NULL;
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
simctx->bw160_headreportset, simctx->bw160_headreportset,
CH_WIDTH_160MHZ, CH_WIDTH_160MHZ, 0);
0);
simctx->bw80_80_headreportset = NULL; simctx->bw80_80_headreportset = NULL;
SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx,
simctx->bw80_80_headreportset, simctx->bw80_80_headreportset,
CH_WIDTH_160MHZ, CH_WIDTH_160MHZ, 1);
1);
simctx->curr_reportset = NULL; simctx->curr_reportset = NULL;
@@ -515,7 +574,17 @@ static int populate_simdata(ath_spectralsim_context *simctx)
return 0; 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) if (!simctx)
return; return;
@@ -527,15 +596,20 @@ static void depopulate_simdata(ath_spectralsim_context *simctx)
SPECTRAL_SIM_REPORTSET_DEPOPLFREE_LIST(simctx->bw80_80_headreportset); SPECTRAL_SIM_REPORTSET_DEPOPLFREE_LIST(simctx->bw80_80_headreportset);
} }
/**
* target_if_spectral_sim_phyerrdelivery_handler() - Phyerr delivery handler
*
* Return: none
*/
static static
OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler) OS_TIMER_FUNC(target_if_spectral_sim_phyerrdelivery_handler)
{ {
struct target_if_spectral *spectral = NULL; struct target_if_spectral *spectral = NULL;
ath_spectralsim_context *simctx = NULL; struct spectralsim_context *simctx = NULL;
ath_spectralsim_reportset *curr_reportset = NULL; struct spectralsim_reportset *curr_reportset = NULL;
ath_spectralsim_report *curr_report = NULL; struct spectralsim_report *curr_report = NULL;
struct target_if_spectral_acs_stats acs_stats; 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; struct target_if_spectral_ops *p_sops;
OS_GET_TIMER_ARG(spectral, struct target_if_spectral *); 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); p_sops = GET_TARGET_IF_SPECTRAL_OPS(spectral);
qdf_assert_always(spectral); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
if (!simctx->is_active) if (!simctx->is_active)
@@ -558,7 +632,8 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
qdf_assert_always(curr_reportset->headreport); 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 * expect to
* get an accurate current TSF from HW. * get an accurate current TSF from HW.
* In case of TSF wrap over, we'll use it as-is for now since the * 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->datasize,
&curr_report->rfqual_info, &curr_report->rfqual_info,
&curr_report->chan_info, &curr_report->chan_info,
curr_tsf64, curr_tsf64, &acs_stats);
&acs_stats);
simctx->ssim_count++; simctx->ssim_count++;
@@ -585,7 +659,7 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
if (curr_reportset->config.ss_count != 0 && if (curr_reportset->config.ss_count != 0 &&
simctx->ssim_count == curr_reportset->config.ss_count) { simctx->ssim_count == curr_reportset->config.ss_count) {
tif_spectral_sim_stop_spectral_scan(spectral); target_if_spectral_sops_sim_stop_scan(spectral);
} else { } else {
qdf_timer_start(&simctx->ssim_pherrdelivery_timer, qdf_timer_start(&simctx->ssim_pherrdelivery_timer,
simctx->ssim_period_ms); simctx->ssim_period_ms);
@@ -594,14 +668,15 @@ OS_TIMER_FUNC(spectral_sim_phyerrdelivery_handler)
/* Module services */ /* 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); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *) simctx = (struct spectralsim_context *)
qdf_mem_malloc(sizeof(ath_spectralsim_context)); qdf_mem_malloc(sizeof(struct spectralsim_context));
if (!simctx) { if (!simctx) {
qdf_print("Spectral simulation: Could not allocate memory for " 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; spectral->simctx = simctx;
if (spectral->spectral_gen == SPECTRAL_GEN2) 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) 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); qdf_mem_free(simctx);
spectral->simctx = NULL; spectral->simctx = NULL;
qdf_print("Spectral simulation attach failed\n"); 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, qdf_timer_init(NULL,
&simctx->ssim_pherrdelivery_timer, &simctx->ssim_pherrdelivery_timer,
spectral_sim_phyerrdelivery_handler, target_if_spectral_sim_phyerrdelivery_handler,
(void *)(spectral), (void *)(spectral), QDF_TIMER_TYPE_WAKE_APPS);
QDF_TIMER_TYPE_WAKE_APPS);
qdf_print("Spectral simulation attached\n"); qdf_print("Spectral simulation attached\n");
return 0; 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); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
qdf_timer_free(&simctx->ssim_pherrdelivery_timer); qdf_timer_free(&simctx->ssim_pherrdelivery_timer);
depopulate_simdata(simctx); target_if_depopulate_simdata(simctx);
qdf_mem_free(simctx); qdf_mem_free(simctx);
spectral->simctx = NULL; spectral->simctx = NULL;
qdf_print("Spectral simulation detached\n"); 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; struct target_if_spectral *spectral = NULL;
ath_spectralsim_context *simctx = NULL; struct spectralsim_context *simctx = NULL;
spectral = (struct target_if_spectral *)arg; spectral = (struct target_if_spectral *)arg;
qdf_assert_always(spectral); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
return simctx->is_active; 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; struct target_if_spectral *spectral = NULL;
ath_spectralsim_context *simctx = NULL; struct spectralsim_context *simctx = NULL;
spectral = (struct target_if_spectral *)arg; spectral = (struct target_if_spectral *)arg;
qdf_assert_always(spectral); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
return simctx->is_enabled; 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; struct target_if_spectral *spectral = NULL;
ath_spectralsim_context *simctx = NULL; struct spectralsim_context *simctx = NULL;
spectral = (struct target_if_spectral *)arg; spectral = (struct target_if_spectral *)arg;
qdf_assert_always(spectral); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
if (!simctx->curr_reportset) { 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_starting_tsf64 = 0;
simctx->ssim_count = 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 * that
* we can support default periods such as ~200 us. For now, we use 1 * 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 * 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; 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; struct target_if_spectral *spectral = NULL;
ath_spectralsim_context *simctx = NULL; struct spectralsim_context *simctx = NULL;
spectral = (struct target_if_spectral *)arg; spectral = (struct target_if_spectral *)arg;
qdf_assert_always(spectral); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
qdf_timer_stop(&simctx->ssim_pherrdelivery_timer); qdf_timer_stop(&simctx->ssim_pherrdelivery_timer);
@@ -756,25 +838,12 @@ u_int32_t tif_spectral_sim_stop_spectral_scan(void *arg)
return 1; return 1;
} }
EXPORT_SYMBOL(tif_spectral_sim_stop_spectral_scan); EXPORT_SYMBOL(target_if_spectral_sops_sim_stop_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);
#ifdef SPECTRAL_SIM_DUMP_PARAM_DATA #ifdef SPECTRAL_SIM_DUMP_PARAM_DATA
{ static void
target_if_log_sim_spectral_params(struct spectral_config *params)
{
int i = 0; int i = 0;
qdf_print("\n"); qdf_print("\n");
@@ -822,8 +891,7 @@ u_int32_t tif_spectral_sim_configure_params(
params->ss_rpt_mode, params->ss_rpt_mode,
params->ss_bin_scale, params->ss_bin_scale,
params->ss_dbm_adj, params->ss_dbm_adj,
params->ss_chn_mask, params->ss_chn_mask, params->ss_nf_temp_data);
params->ss_nf_temp_data);
for (i = 0; i < AH_MAX_CHAINS * 2; i++) for (i = 0; i < AH_MAX_CHAINS * 2; i++)
qdf_print("ss_nf_cal[%d]=%hhd\n", i, params->ss_nf_cal[i]); qdf_print("ss_nf_cal[%d]=%hhd\n", i, params->ss_nf_cal[i]);
@@ -832,13 +900,35 @@ u_int32_t tif_spectral_sim_configure_params(
qdf_print("ss_nf_pwr[%d]=%hhd\n", i, params->ss_nf_pwr[i]); qdf_print("ss_nf_pwr[%d]=%hhd\n", i, params->ss_nf_pwr[i]);
qdf_print("\n"); qdf_print("\n");
} }
#else
static void
target_if_log_sim_spectral_params(struct spectral_config *params)
{
}
#endif /* SPECTRAL_SIM_DUMP_PARAM_DATA */ #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; spectral = (struct target_if_spectral *)arg;
qdf_assert_always(spectral); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
vdev = target_if_spectral_get_vdev(spectral); vdev = target_if_spectral_get_vdev(spectral);
@@ -879,8 +969,8 @@ u_int32_t tif_spectral_sim_configure_params(
" proceeding with param config.\n"); " proceeding with param config.\n");
is_invalid_width = true; is_invalid_width = true;
default: default:
qdf_print("Spectral simulation: Unknown width %u...asserting\n" qdf_print("Spectral simulation: Unknown width %u...asserting\n",
, bw); bw);
qdf_assert_always(0); qdf_assert_always(0);
break; break;
} }
@@ -927,25 +1017,26 @@ u_int32_t tif_spectral_sim_configure_params(
return 1; 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( uint32_t
void *arg, target_if_spectral_sops_sim_get_params(
struct spectral_config *params) void *arg, struct spectral_config *params)
{ {
struct target_if_spectral *spectral = NULL; struct target_if_spectral *spectral = NULL;
ath_spectralsim_context *simctx = NULL; struct spectralsim_context *simctx = NULL;
qdf_assert_always(params); qdf_assert_always(params);
spectral = (struct target_if_spectral *)arg; spectral = (struct target_if_spectral *)arg;
qdf_assert_always(spectral); qdf_assert_always(spectral);
simctx = (ath_spectralsim_context *)spectral->simctx; simctx = (struct spectralsim_context *)spectral->simctx;
qdf_assert_always(simctx); qdf_assert_always(simctx);
if (!simctx->curr_reportset) { if (!simctx->curr_reportset) {
qdf_print("Spectral simulation: No configured reportset found.\n"); qdf_print
("Spectral simulation: No configured reportset found.\n");
return 0; return 0;
} }
@@ -953,6 +1044,6 @@ u_int32_t tif_spectral_sim_get_params(
return 1; return 1;
} }
EXPORT_SYMBOL(tif_spectral_sim_get_params); EXPORT_SYMBOL(target_if_spectral_sops_sim_get_params);
#endif /* QCA_SUPPORT_SPECTRAL_SIMULATION */ #endif /* QCA_SUPPORT_SPECTRAL_SIMULATION */

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
@@ -24,83 +24,100 @@
#include "target_if_spectral.h" #include "target_if_spectral.h"
/** /**
* @brief Initialize Spectral Simulation functionality * target_if_spectral_sim_attach() - Initialize Spectral Simulation
* @details * functionality
* @spectral - pointer to spectral internal data structure
*
* Setup data structures to be used for serving out data corresponding to * Setup data structures to be used for serving out data corresponding to
* various bandwidths and configurations. * 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); int target_if_spectral_sim_attach(struct target_if_spectral *spectral);
/** /**
* @brief De-initialize Spectral Simulation functionality * target_if_spectral_sim_detach() - De-initialize Spectral Simulation
* @details * functionality
* @spectral - pointer to spectral internal data structure
*
* Free up data structures used for serving out data corresponding to various * Free up data structures used for serving out data corresponding to various
* bandwidths and configurations. * bandwidths and configurations.
* *
* @param spectral - ath_spectral structure * Return: None
*/ */
void target_if_spectral_sim_detach(struct target_if_spectral *spectral); 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 * Check if Spectral (simulated) is active
* @return Integer status value. 0: Not active, 1: 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 * Check if Spectral(simulated) is enabled
* @return Integer status value. 0: Not enabled, 1: 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 * Start Spectral simulation
* @return Integer status value. 0: Failure, 1: Success *
* 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 * Stop Spectral simulation
* @return Integer status value. 0: Failure, 1: Success *
* 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 * target_if_spectral_sops_sim_configure_params() - Configure Spectral
* @details * 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 * 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 * 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. * later usage when the simulation is started. If not, it returns an error.
* *
* @param arg - pointer to ath_spectral structure * Return: Integer status value. 0: Failure, 1: Success
* @param params - pointer to struct spectral_config structure bearing Spectral
* configuration
* @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, void *arg,
struct spectral_config *params); struct spectral_config *params);
/** /**
* @brief Get Spectral parameters configured into simulation * target_if_spectral_sops_sim_get_params() - Get Spectral parameters configured
* * into simulation
* @param arg - pointer to ath_spectral structure * arg - pointer to ath_spectral structure
* @param params - pointer to struct spectral_config structure which should be * params - pointer to struct spectral_config structure which should be
* populated with Spectral configuration * 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, void *arg,
struct spectral_config *params); struct spectral_config *params);

View File

@@ -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 * Permission to use, copy, modify, and/or distribute this software for
@@ -24,67 +24,97 @@
#include "target_if_spectral.h" #include "target_if_spectral.h"
/* #define SPECTRAL_SIM_DUMP_PARAM_DATA 1 */ /* #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. * one PHY Data Error frame received from the HW.
* XXX Direct Attach support to be implemented if needed. Any modifications * XXX Direct Attach support to be implemented if needed. Any modifications
* required here can be made at the time of implementation. * 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. * 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 */ /* 11ac onwards only */
struct target_if_spectral_rfqual_info rfqual_info; struct target_if_spectral_rfqual_info rfqual_info;
/* 11ac onwards only */ /* 11ac onwards only */
struct target_if_spectral_chan_info chan_info; struct target_if_spectral_chan_info chan_info;
u_int32_t datasize; uint32_t datasize;
u_int8_t *data; uint8_t *data;
struct _ath_spectralsim_report *next; struct spectralsim_report *next;
} ath_spectralsim_report; };
/* 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; struct spectral_config config;
ath_spectralsim_report *headreport; struct spectralsim_report *headreport;
ath_spectralsim_report *curr_report; struct spectralsim_report *curr_report;
struct _ath_spectralsim_reportset *next; struct spectralsim_reportset *next;
} ath_spectralsim_reportset; };
/* 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 * 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 * spectralsim_reportset nodes. Each struct spectralsim_reportset will have a
* linked list of ath_spectralsim_report nodes. When the user requests for a * linked list of struct spectralsim_report nodes. When the user requests for a
* given PHY mode and Spectral configuration, we find the appropriate * 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 * 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 * 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 * be more elaborate data structures devised taking care of a large number of
* possibilities, but we stick to a simple scheme given limited simulation * possibilities, but we stick to a simple scheme given limited simulation
* needs. * 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 { struct spectralsim_context {
ath_spectralsim_reportset *bw20_headreportset; struct spectralsim_reportset *bw20_headreportset;
ath_spectralsim_reportset *bw40_headreportset; struct spectralsim_reportset *bw40_headreportset;
ath_spectralsim_reportset *bw80_headreportset; struct spectralsim_reportset *bw80_headreportset;
ath_spectralsim_reportset *bw160_headreportset; struct spectralsim_reportset *bw160_headreportset;
ath_spectralsim_reportset *bw80_80_headreportset; struct spectralsim_reportset *bw80_80_headreportset;
ath_spectralsim_reportset *curr_reportset; struct spectralsim_reportset *curr_reportset;
bool is_enabled; bool is_enabled;
bool is_active; bool is_active;
qdf_timer_t ssim_pherrdelivery_timer; qdf_timer_t ssim_pherrdelivery_timer;
u_int64_t ssim_starting_tsf64; uint64_t ssim_starting_tsf64;
u_int32_t ssim_period_ms; /* TODO: Support in microseconds */ uint32_t ssim_period_ms; /* TODO: Support in microseconds */
u_int32_t ssim_count; uint32_t ssim_count;
int (*populate_report_static)(ath_spectralsim_report *report, int (*populate_report_static)(struct spectralsim_report *report,
enum phy_ch_width width, enum phy_ch_width width, bool is_80_80);
bool is_80_80); };
} ath_spectralsim_context;
/* Helper Macros */ /* Helper Macros */
@@ -92,21 +122,21 @@ typedef struct _ath_spectralsim_context {
#define SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, reportset, width, \ #define SPECTRAL_SIM_REPORTSET_ALLOCPOPL_SINGLE(simctx, reportset, width, \
is_80_80) \ is_80_80) \
{ \ { \
(reportset) = (ath_spectralsim_reportset *) \ (reportset) = (struct spectralsim_reportset *) \
qdf_mem_malloc(sizeof(ath_spectralsim_reportset)); \ qdf_mem_malloc(sizeof(struct spectralsim_reportset)); \
\ \
if ((reportset) == NULL) { \ if ((reportset) == NULL) { \
qdf_print("Spectral simulation: Could not allocate memory " \ qdf_print("Spectral simulation: Could not allocate memory " \
"for report set\n"); \ "for report set\n"); \
depopulate_simdata((simctx)); \ target_if_depopulate_simdata((simctx)); \
return -EPERM; \ 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) { \ (simctx), (reportset), (width), (is_80_80)) != 0) { \
depopulate_simdata((simctx)); \ target_if_depopulate_simdata((simctx)); \
return -EPERM; \ return -EPERM; \
} \ } \
\ \
@@ -116,14 +146,14 @@ typedef struct _ath_spectralsim_context {
/* Depopulate and free list of report sets */ /* Depopulate and free list of report sets */
#define SPECTRAL_SIM_REPORTSET_DEPOPLFREE_LIST(reportset) \ #define SPECTRAL_SIM_REPORTSET_DEPOPLFREE_LIST(reportset) \
{ \ { \
ath_spectralsim_reportset *curr_reportset = NULL; \ struct spectralsim_reportset *curr_reportset = NULL; \
ath_spectralsim_reportset *next_reportset = NULL; \ struct spectralsim_reportset *next_reportset = NULL; \
\ \
curr_reportset = (reportset); \ curr_reportset = (reportset); \
\ \
while (curr_reportset) { \ while (curr_reportset) { \
next_reportset = curr_reportset->next; \ next_reportset = curr_reportset->next; \
depopulate_reportset(curr_reportset); \ target_if_depopulate_reportset(curr_reportset); \
qdf_mem_free(curr_reportset); \ qdf_mem_free(curr_reportset); \
curr_reportset = next_reportset; \ curr_reportset = next_reportset; \
} \ } \
@@ -135,6 +165,7 @@ typedef struct _ath_spectralsim_context {
/* 20 MHz */ /* 20 MHz */
/* Report data for 20MHz bandwidth for generation 2 chipsets */
static uint8_t reportdata_20_gen2[] = { static uint8_t reportdata_20_gen2[] = {
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
0xbb, /* Signature */ 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, 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[] = { static uint8_t reportdata_20_gen3[] = {
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
0x12, 0x34, 0x56, 0x78, /* fft_timestamp */ 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, 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 = { static struct target_if_spectral_rfqual_info rfqual_info_20 = {
.rssi_comb = 1, .rssi_comb = 1,
@@ -214,14 +247,16 @@ static struct target_if_spectral_rfqual_info rfqual_info_20 = {
.noise_floor[1] = -90, .noise_floor[1] = -90,
.noise_floor[2] = -90, .noise_floor[2] = -90,
.noise_floor[3] = -90, .noise_floor[3] = -90,
}; };
/* Channel information for 20 MHz bandwidth */
static struct target_if_spectral_chan_info chan_info_20 = { static struct target_if_spectral_chan_info chan_info_20 = {
.center_freq1 = 5180, .center_freq1 = 5180,
.center_freq2 = 0, .center_freq2 = 0,
.chan_width = 20, .chan_width = 20,
}; };
/* Spectral config parameters for 20 MHz bandwidth */
static struct spectral_config config_20_1 = { static struct spectral_config config_20_1 = {
.ss_fft_period = 1, .ss_fft_period = 1,
.ss_period = 35, .ss_period = 35,
@@ -257,10 +292,11 @@ static struct spectral_config config_20_1 = {
.ss_nf_pwr[4] = 0, .ss_nf_pwr[4] = 0,
.ss_nf_pwr[5] = 0, .ss_nf_pwr[5] = 0,
.ss_nf_temp_data = 0, .ss_nf_temp_data = 0,
}; };
/* 40 MHz */ /* 40 MHz */
/* Report data for 40MHz bandwidth for generation 2 chipsets */
static uint8_t reportdata_40_gen2[] = { static uint8_t reportdata_40_gen2[] = {
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
0xbb, /* Signature */ 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, 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[] = { static uint8_t reportdata_40_gen3[] = {
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
0x12, 0x34, 0x56, 0x78, /* fft_timestamp */ 0x12, 0x34, 0x56, 0x78, /* fft_timestamp */
@@ -319,6 +356,7 @@ static uint8_t reportdata_40_gen3[] = {
0, 0, 0, 1, 0, 0, 0, 0, 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 = { static struct target_if_spectral_rfqual_info rfqual_info_40 = {
.rssi_comb = 1, .rssi_comb = 1,
@@ -346,14 +384,16 @@ static struct target_if_spectral_rfqual_info rfqual_info_40 = {
.noise_floor[1] = -90, .noise_floor[1] = -90,
.noise_floor[2] = -90, .noise_floor[2] = -90,
.noise_floor[3] = -90, .noise_floor[3] = -90,
}; };
/* Channel information for 40 MHz bandwidth */
static struct target_if_spectral_chan_info chan_info_40 = { static struct target_if_spectral_chan_info chan_info_40 = {
.center_freq1 = 5180, .center_freq1 = 5180,
.center_freq2 = 0, .center_freq2 = 0,
.chan_width = 40, .chan_width = 40,
}; };
/* Spectral config parameters for 40 MHz bandwidth */
static struct spectral_config config_40_1 = { static struct spectral_config config_40_1 = {
.ss_fft_period = 1, .ss_fft_period = 1,
.ss_period = 35, .ss_period = 35,
@@ -389,10 +429,11 @@ static struct spectral_config config_40_1 = {
.ss_nf_pwr[4] = 0, .ss_nf_pwr[4] = 0,
.ss_nf_pwr[5] = 0, .ss_nf_pwr[5] = 0,
.ss_nf_temp_data = 0, .ss_nf_temp_data = 0,
}; };
/* 80 MHz */ /* 80 MHz */
/* Report data for 80MHz bandwidth for generation 2 chipsets */
static uint8_t reportdata_80_gen2[] = { static uint8_t reportdata_80_gen2[] = {
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
0xbb, /* Signature */ 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, 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[] = { static uint8_t reportdata_80_gen3[] = {
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
0x12, 0x34, 0x56, 0x78, /* fft_timestamp */ 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, 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 = { static struct target_if_spectral_rfqual_info rfqual_info_80 = {
.rssi_comb = 16, .rssi_comb = 16,
@@ -488,14 +531,16 @@ static struct target_if_spectral_rfqual_info rfqual_info_80 = {
.noise_floor[1] = -90, .noise_floor[1] = -90,
.noise_floor[2] = -90, .noise_floor[2] = -90,
.noise_floor[3] = -90, .noise_floor[3] = -90,
}; };
/* Channel information for 80 MHz bandwidth */
static struct target_if_spectral_chan_info chan_info_80 = { static struct target_if_spectral_chan_info chan_info_80 = {
.center_freq1 = 5210, .center_freq1 = 5210,
.center_freq2 = 0, .center_freq2 = 0,
.chan_width = 80, .chan_width = 80,
}; };
/* Spectral config parameters for 80 MHz bandwidth */
static struct spectral_config config_80_1 = { static struct spectral_config config_80_1 = {
.ss_fft_period = 1, .ss_fft_period = 1,
.ss_period = 35, .ss_period = 35,
@@ -531,10 +576,11 @@ static struct spectral_config config_80_1 = {
.ss_nf_pwr[4] = 0, .ss_nf_pwr[4] = 0,
.ss_nf_pwr[5] = 0, .ss_nf_pwr[5] = 0,
.ss_nf_temp_data = 0, .ss_nf_temp_data = 0,
}; };
/* 160 MHz */ /* 160 MHz */
/* Report data for 160MHz bandwidth for generation 2 chipsets */
static uint8_t reportdata_160_gen2[] = { static uint8_t reportdata_160_gen2[] = {
/* Segment 1 */ /* Segment 1 */
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
@@ -601,6 +647,7 @@ static uint8_t reportdata_160_gen2[] = {
0, 0,
}; };
/* Report data for 160MHz bandwidth for generation 3 chipsets */
static uint8_t reportdata_160_gen3[] = { static uint8_t reportdata_160_gen3[] = {
/* Segment 1 */ /* Segment 1 */
#ifdef BIG_ENDIAN_HOST #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, 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 = { static struct target_if_spectral_rfqual_info rfqual_info_160 = {
.rssi_comb = 3, .rssi_comb = 3,
@@ -700,14 +748,16 @@ static struct target_if_spectral_rfqual_info rfqual_info_160 = {
.noise_floor[1] = -90, .noise_floor[1] = -90,
.noise_floor[2] = -90, .noise_floor[2] = -90,
.noise_floor[3] = -90, .noise_floor[3] = -90,
}; };
/* Channel information for 160 MHz bandwidth */
static struct target_if_spectral_chan_info chan_info_160 = { static struct target_if_spectral_chan_info chan_info_160 = {
.center_freq1 = 5250, .center_freq1 = 5250,
.center_freq2 = 0, .center_freq2 = 0,
.chan_width = 160, .chan_width = 160,
}; };
/* Spectral config parameters for 160 MHz bandwidth */
static struct spectral_config config_160_1 = { static struct spectral_config config_160_1 = {
.ss_fft_period = 1, .ss_fft_period = 1,
.ss_period = 35, .ss_period = 35,
@@ -743,10 +793,11 @@ static struct spectral_config config_160_1 = {
.ss_nf_pwr[4] = 0, .ss_nf_pwr[4] = 0,
.ss_nf_pwr[5] = 0, .ss_nf_pwr[5] = 0,
.ss_nf_temp_data = 0, .ss_nf_temp_data = 0,
}; };
/* 80+80 MHz */ /* 80+80 MHz */
/* Report data for 80_80MHz bandwidth for generation 2 chipsets */
static uint8_t reportdata_80_80_gen2[] = { static uint8_t reportdata_80_80_gen2[] = {
/* Segment 1 */ /* Segment 1 */
#ifdef BIG_ENDIAN_HOST #ifdef BIG_ENDIAN_HOST
@@ -813,6 +864,7 @@ static uint8_t reportdata_80_80_gen2[] = {
0, 0,
}; };
/* Report data for 80_80MHz bandwidth for generation 3 chipsets */
static uint8_t reportdata_80_80_gen3[] = { static uint8_t reportdata_80_80_gen3[] = {
/* Segment 1 */ /* Segment 1 */
#ifdef BIG_ENDIAN_HOST #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, 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 = { static struct target_if_spectral_rfqual_info rfqual_info_80_80 = {
.rssi_comb = 1, .rssi_comb = 1,
@@ -912,14 +965,16 @@ static struct target_if_spectral_rfqual_info rfqual_info_80_80 = {
.noise_floor[1] = -90, .noise_floor[1] = -90,
.noise_floor[2] = -90, .noise_floor[2] = -90,
.noise_floor[3] = -90, .noise_floor[3] = -90,
}; };
/* Channel information for 80_80 MHz bandwidth */
static struct target_if_spectral_chan_info chan_info_80_80 = { static struct target_if_spectral_chan_info chan_info_80_80 = {
.center_freq1 = 5210, .center_freq1 = 5210,
.center_freq2 = 5530, .center_freq2 = 5530,
.chan_width = 160, .chan_width = 160,
}; };
/* Spectral config parameters for 80_80 MHz bandwidth */
static struct spectral_config config_80_80_1 = { static struct spectral_config config_80_80_1 = {
.ss_fft_period = 1, .ss_fft_period = 1,
.ss_period = 35, .ss_period = 35,
@@ -955,7 +1010,7 @@ static struct spectral_config config_80_80_1 = {
.ss_nf_pwr[4] = 0, .ss_nf_pwr[4] = 0,
.ss_nf_pwr[5] = 0, .ss_nf_pwr[5] = 0,
.ss_nf_temp_data = 0, .ss_nf_temp_data = 0,
}; };
#endif /* QCA_SUPPORT_SPECTRAL_SIMULATION */ #endif /* QCA_SUPPORT_SPECTRAL_SIMULATION */
#endif /* _SPECTRAL_SIM_INTERNAL_H_ */ #endif /* _SPECTRAL_SIM_INTERNAL_H_ */