qcacmn: Avoid functions with a very long list of arguments

To avoid passing multiple parameters to MLME functions from DFS
component, use a common structure between these components and
pass the structure instead of long list of parameters.
Define the common structure in cmn_services directory to access
it in both the components.

Change-Id: I02dde0780eebbce0886685d1f72a62c84e5b4eeb
CRs-Fixed: 2146000
This commit is contained in:
Abhijit Pradhan 2017-10-08 10:33:28 +05:30 • committed by snandini
commit f9df7db9b5
6 changed files with 82 additions and 249 deletions

View file

@ -144,4 +144,67 @@ struct dfs_ioctl_params {
/* Flag to exclude all 2.4GHz channels */
#define DFS_RANDOM_CH_FLAG_NO_2GHZ_CH 0x0040 /* 0000 0000 0100 0000 */
/**
* struct wlan_dfs_caps - DFS capability structure.
* @wlan_dfs_ext_chan_ok: Can radar be detected on the extension chan?
* @wlan_dfs_combined_rssi_ok: Can use combined radar RSSI?
* @wlan_dfs_use_enhancement: This flag is used to indicate if radar
* detection scheme should use enhanced chirping
* detection algorithm. This flag also determines
* if certain radar data should be discarded to
* minimize false detection of radar.
* @wlan_strong_signal_diversiry: Strong Signal fast diversity count.
* @wlan_chip_is_bb_tlv: Chip is BB TLV?
* @wlan_chip_is_over_sampled: Is Over sampled.
* @wlan_chip_is_ht160: IS VHT160?
* @wlan_chip_is_false_detect: Is False detected?
* @wlan_fastdiv_val: Goes with wlan_strong_signal_diversiry: If we
* have fast diversity capability, read off
* Strong Signal fast diversity count set in the
* ini file, and store so we can restore the
* value when radar is disabled.
*/
struct wlan_dfs_caps {
uint32_t wlan_dfs_ext_chan_ok:1,
wlan_dfs_combined_rssi_ok:1,
wlan_dfs_use_enhancement:1,
wlan_strong_signal_diversiry:1,
wlan_chip_is_bb_tlv:1,
wlan_chip_is_over_sampled:1,
wlan_chip_is_ht160:1,
wlan_chip_is_false_detect:1;
uint32_t wlan_fastdiv_val;
};
/**
* struct wlan_dfs_phyerr_param - DFS Phyerr structure.
* @pe_firpwr: FIR pwr out threshold.
* @pe_rrssi: Radar rssi thresh.
* @pe_height: Pulse height thresh.
* @pe_prssi: Pulse rssi thresh.
* @pe_inband: Inband thresh.
* @pe_relpwr: Relative power threshold in 0.5dB steps.
* @pe_relstep: Pulse Relative step threshold in 0.5dB steps.
* @pe_maxlen: Max length of radar sign in 0.8us units.
* @pe_usefir128: Use the average in-band power measured over 128 cycles.
* @pe_blockradar: Enable to block radar check if pkt detect is done via OFDM
* weak signal detect or pkt is detected immediately after tx
* to rx transition.
* @pe_enmaxrssi: Enable to use the max rssi instead of the last rssi during
* fine gain changes for radar detection.
*/
struct wlan_dfs_phyerr_param {
int32_t pe_firpwr;
int32_t pe_rrssi;
int32_t pe_height;
int32_t pe_prssi;
int32_t pe_inband;
uint32_t pe_relpwr;
uint32_t pe_relstep;
uint32_t pe_maxlen;
bool pe_usefir128;
bool pe_blockradar;
bool pe_enmaxrssi;
};
#endif /* _DFS_IOCTL_H_ */

View file

@ -41,38 +41,6 @@ enum {
DFS_NOL_CLIST_CMD_UPDATE = 0x1,
};
/**
* struct wlan_dfs_caps - DFS capability structure.
* @wlan_dfs_ext_chan_ok: Can radar be detected on the extension chan?
* @wlan_dfs_combined_rssi_ok: Can use combined radar RSSI?
* @wlan_dfs_use_enhancement: This flag is used to indicate if radar
* detection scheme should use enhanced chirping
* detection algorithm. This flag also determines
* if certain radar data should be discarded to
* minimize false detection of radar.
* @wlan_strong_signal_diversiry: Strong Signal fast diversity count.
* @wlan_chip_is_bb_tlv: Chip is BB TLV?
* @wlan_chip_is_over_sampled: Is Over sampled.
* @wlan_chip_is_ht160: IS VHT160?
* @wlan_chip_is_false_detect: Is False detected?
* @wlan_fastdiv_val: Goes with wlan_strong_signal_diversiry: If we
* have fast diversity capability, read off
* Strong Signal fast diversity count set in the
* ini file, and store so we can restore the
* value when radar is disabled.
*/
struct wlan_dfs_caps {
uint32_t wlan_dfs_ext_chan_ok:1,
wlan_dfs_combined_rssi_ok:1,
wlan_dfs_use_enhancement:1,
wlan_strong_signal_diversiry:1,
wlan_chip_is_bb_tlv:1,
wlan_chip_is_over_sampled:1,
wlan_chip_is_ht160:1,
wlan_chip_is_false_detect:1;
uint32_t wlan_fastdiv_val;
};
/**
* struct dfs_pulse - DFS pulses.
* @rp_numpulses: Num of pulses in radar burst.
@ -156,37 +124,6 @@ struct dfs_nol_chan_entry {
uint32_t nol_timeout_ms;
};
/**
* struct wlan_dfs_phyerr_param - DFS Phyerr structure.
* @pe_firpwr: FIR pwr out threshold.
* @pe_rrssi: Radar rssi thresh.
* @pe_height: Pulse height thresh.
* @pe_prssi: Pulse rssi thresh.
* @pe_inband: Inband thresh.
* @pe_relpwr: Relative power threshold in 0.5dB steps.
* @pe_relstep: Pulse Relative step threshold in 0.5dB steps.
* @pe_maxlen: Max length of radar sign in 0.8us units.
* @pe_usefir128: Use the average in-band power measured over 128 cycles.
* @pe_blockradar: Enable to block radar check if pkt detect is done via OFDM
* weak signal detect or pkt is detected immediately after tx
* to rx transition.
* @pe_enmaxrssi: Enable to use the max rssi instead of the last rssi during
* fine gain changes for radar detection.
*/
struct wlan_dfs_phyerr_param {
int32_t pe_firpwr;
int32_t pe_rrssi;
int32_t pe_height;
int32_t pe_prssi;
int32_t pe_inband;
uint32_t pe_relpwr;
uint32_t pe_relstep;
uint32_t pe_maxlen;
bool pe_usefir128;
bool pe_blockradar;
bool pe_enmaxrssi;
};
/**
* wlan_dfs_phyerr_init_noval() - Fill wlan_dfs_phyerr_param with 0xFF.
* @pe: Pointer to wlan_dfs_phyerr_param structure.

View file

@ -164,10 +164,6 @@ int dfs_main_attach(struct wlan_dfs *dfs)
{
int i, n;
struct wlan_dfs_radar_tab_info radar_info;
bool ext_chan, combined_rssi, use_enhancement, strong_signal_diversiry;
bool chip_is_bb_tlv, chip_is_over_sampled, chip_is_ht160;
bool chip_is_false_detect;
uint32_t fastdiv_val;
if (!dfs) {
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs is NULL");
@ -188,26 +184,7 @@ int dfs_main_attach(struct wlan_dfs *dfs)
*/
qdf_mem_zero(&radar_info, sizeof(radar_info));
lmac_get_caps(dfs->dfs_pdev_obj,
&ext_chan,
&combined_rssi,
&use_enhancement,
&strong_signal_diversiry,
&chip_is_bb_tlv,
&chip_is_over_sampled,
&chip_is_ht160,
&chip_is_false_detect,
&fastdiv_val);
dfs->dfs_caps.wlan_dfs_ext_chan_ok = ext_chan;
dfs->dfs_caps.wlan_dfs_combined_rssi_ok = combined_rssi;
dfs->dfs_caps.wlan_dfs_use_enhancement = use_enhancement;
dfs->dfs_caps.wlan_strong_signal_diversiry = strong_signal_diversiry;
dfs->dfs_caps.wlan_chip_is_bb_tlv = chip_is_bb_tlv;
dfs->dfs_caps.wlan_chip_is_over_sampled = chip_is_over_sampled;
dfs->dfs_caps.wlan_chip_is_ht160 = chip_is_ht160;
dfs->dfs_caps.wlan_chip_is_false_detect = chip_is_false_detect;
dfs->dfs_caps.wlan_fastdiv_val = fastdiv_val;
lmac_get_caps(dfs->dfs_pdev_obj, &(dfs->dfs_caps));
dfs_clear_stats(dfs);
dfs->dfs_event_log_on = 1;
@ -633,15 +610,7 @@ void dfs_radar_enable(struct wlan_dfs *dfs, int no_cac, uint32_t opmode)
pe.pe_maxlen);
lmac_dfs_enable(dfs->dfs_pdev_obj, &is_fastclk,
pe.pe_firpwr,
pe.pe_rrssi,
pe.pe_height,
pe.pe_prssi,
pe.pe_inband,
pe.pe_relpwr,
pe.pe_relstep,
pe.pe_maxlen,
dfs->dfsdomain);
&pe, dfs->dfsdomain);
dfs_debug(dfs, WLAN_DEBUG_DFS,
"Enabled radar detection on channel %d",
dfs->dfs_curchan->dfs_ch_freq);
@ -1062,15 +1031,7 @@ int dfs_set_thresholds(struct wlan_dfs *dfs, const uint32_t threshtype,
* format.
*/
lmac_dfs_enable(dfs->dfs_pdev_obj, &is_fastclk,
pe.pe_firpwr,
pe.pe_rrssi,
pe.pe_height,
pe.pe_prssi,
pe.pe_inband,
pe.pe_relpwr,
pe.pe_relstep,
pe.pe_maxlen,
dfs->dfsdomain);
&pe, dfs->dfsdomain);
return 1;
}
@ -1080,15 +1041,7 @@ int dfs_get_thresholds(struct wlan_dfs *dfs,
{
qdf_mem_zero(param, sizeof(*param));
lmac_dfs_get_thresholds(dfs->dfs_pdev_obj,
&(param->pe_firpwr),
&(param->pe_rrssi),
&(param->pe_height),
&(param->pe_prssi),
&(param->pe_inband),
&(param->pe_relpwr),
&(param->pe_relstep),
&(param->pe_maxlen));
lmac_dfs_get_thresholds(dfs->dfs_pdev_obj, param);
return 1;
}

View file

@ -31,34 +31,10 @@
/**
* lmac_get_caps() - Get DFS capabilities.
* @pdev: Pointer to PDEV structure.
* @ext_chan: Can radar be detected on the extension chan?
* @combined_rssi: Can use combined radar RSSI?
* @use_enhancement: This flag is used to indicate if radar
* detection scheme should use enhanced chirping
* detection algorithm. This flag also determines
* if certain radar data should be discarded to
* minimize false detection of radar.
* @strong_signal_diversiry: Strong Signal fast diversity count.
* @chip_is_bb_tlv: Chip is BB TLV?
* @chip_is_over_sampled: Is Over sampled.
* @chip_is_ht160: IS VHT160?
* @chip_is_false_detect: Is False detected?
* @fastdiv_val: Goes with wlan_strong_signal_diversiry: If we
* have fast diversity capability, read off
* Strong Signal fast diversity count set in the
* ini file, and store so we can restore the
* value when radar is disabled.
* @dfs_caps: Pointer to dfs_caps structure
*/
void lmac_get_caps(struct wlan_objmgr_pdev *pdev,
bool *ext_chan,
bool *combined_rssi,
bool *use_enhancement,
bool *strong_signal_diversiry,
bool *chip_is_bb_tlv,
bool *chip_is_over_sampled,
bool *chip_is_ht160,
bool *chip_is_false_detect,
uint32_t *fastdiv_val);
struct wlan_dfs_caps *dfs_caps);
/**
* lmac_get_tsf64() - Get tsf64 value.
@ -79,49 +55,21 @@ void lmac_dfs_disable(struct wlan_objmgr_pdev *pdev, int no_cac);
* lmac_dfs_enable() - Enable DFS.
* @pdev: Pointer to PDEV structure.
* @is_fastclk: fastclk value.
* @pe_firpwr: FIR pwr out threshold.
* @pe_rrssi: Radar rssi thresh.
* @pe_height: Pulse height thresh.
* @pe_prssi: Pulse rssi thresh.
* @pe_inband: Inband thresh.
* @pe_relpwr: Relative power threshold in 0.5dB steps.
* @pe_relstep: Pulse Relative step threshold in 0.5dB steps.
* @pe_maxlen: Max length of radar sign in 0.8us units.
* @param: Pointer to wlan_dfs_phyerr_param structure.
* @dfsdomain: DFS domain.
*/
void lmac_dfs_enable(struct wlan_objmgr_pdev *pdev,
int *is_fastclk,
int32_t pe_firpwr,
int32_t pe_rrssi,
int32_t pe_height,
int32_t pe_prssi,
int32_t pe_inband,
uint32_t pe_relpwr,
uint32_t pe_relstep,
uint32_t pe_maxlen,
struct wlan_dfs_phyerr_param *param,
int dfsdomain);
/**
* lmac_dfs_get_thresholds() - Get thresholds.
* @pdev: Pointer to PDEV structure.
* @pe_firpwr: FIR pwr out threshold.
* @pe_rrssi: Radar rssi thresh.
* @pe_height: Pulse height thresh.
* @pe_prssi: Pulse rssi thresh.
* @pe_inband: Inband thresh.
* @pe_relpwr: Relative power threshold in 0.5dB steps.
* @pe_relstep: Pulse Relative step threshold in 0.5dB steps.
* @pe_maxlen: Max length of radar sign in 0.8us units.
* @param: Pointer to wlan_dfs_phyerr_param structure.
*/
void lmac_dfs_get_thresholds(struct wlan_objmgr_pdev *pdev,
int32_t *pe_firpwr,
int32_t *pe_rrssi,
int32_t *pe_height,
int32_t *pe_prssi,
int32_t *pe_inband,
uint32_t *pe_relpwr,
uint32_t *pe_relstep,
uint32_t *pe_maxlen);
struct wlan_dfs_phyerr_param *param);
/**
* lmac_is_mode_offload() - Check the radio for offload.

View file

@ -26,15 +26,7 @@
#include <wlan_reg_services_api.h>
void lmac_get_caps(struct wlan_objmgr_pdev *pdev,
bool *ext_chan,
bool *combined_rssi,
bool *use_enhancement,
bool *strong_signal_diversiry,
bool *chip_is_bb_tlv,
bool *chip_is_over_sampled,
bool *chip_is_ht160,
bool *chip_is_false_detect,
uint32_t *fastdiv_val)
struct wlan_dfs_caps *dfs_caps)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
@ -44,16 +36,7 @@ void lmac_get_caps(struct wlan_objmgr_pdev *pdev,
dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops;
if (dfs_tx_ops->dfs_get_caps)
dfs_tx_ops->dfs_get_caps(pdev,
ext_chan,
combined_rssi,
use_enhancement,
strong_signal_diversiry,
chip_is_bb_tlv,
chip_is_over_sampled,
chip_is_ht160,
chip_is_false_detect,
fastdiv_val);
dfs_tx_ops->dfs_get_caps(pdev, dfs_caps);
}
uint64_t lmac_get_tsf64(struct wlan_objmgr_pdev *pdev)
@ -87,14 +70,7 @@ void lmac_dfs_disable(struct wlan_objmgr_pdev *pdev, int no_cac)
void lmac_dfs_enable(struct wlan_objmgr_pdev *pdev,
int *is_fastclk,
int32_t pe_firpwr,
int32_t pe_rrssi,
int32_t pe_height,
int32_t pe_prssi,
int32_t pe_inband,
uint32_t pe_relpwr,
uint32_t pe_relstep,
uint32_t pe_maxlen,
struct wlan_dfs_phyerr_param *param,
int dfsdomain)
{
struct wlan_objmgr_psoc *psoc;
@ -107,26 +83,12 @@ void lmac_dfs_enable(struct wlan_objmgr_pdev *pdev,
if (dfs_tx_ops->dfs_enable)
dfs_tx_ops->dfs_enable(pdev,
is_fastclk,
pe_firpwr,
pe_rrssi,
pe_height,
pe_prssi,
pe_inband,
pe_relpwr,
pe_relstep,
pe_maxlen,
param,
dfsdomain);
}
void lmac_dfs_get_thresholds(struct wlan_objmgr_pdev *pdev,
int32_t *pe_firpwr,
int32_t *pe_rrssi,
int32_t *pe_height,
int32_t *pe_prssi,
int32_t *pe_inband,
uint32_t *pe_relpwr,
uint32_t *pe_relstep,
uint32_t *pe_maxlen)
struct wlan_dfs_phyerr_param *param)
{
struct wlan_objmgr_psoc *psoc;
struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops;
@ -136,15 +98,7 @@ void lmac_dfs_get_thresholds(struct wlan_objmgr_pdev *pdev,
dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops;
if (dfs_tx_ops->dfs_get_thresholds)
dfs_tx_ops->dfs_get_thresholds(pdev,
pe_firpwr,
pe_rrssi,
pe_height,
pe_prssi,
pe_inband,
pe_relpwr,
pe_relstep,
pe_maxlen);
dfs_tx_ops->dfs_get_thresholds(pdev, param);
}
bool lmac_is_mode_offload(struct wlan_objmgr_pdev *pdev)

View file

@ -448,39 +448,17 @@ struct wlan_lmac_if_reg_tx_ops {
struct wlan_lmac_if_dfs_tx_ops {
QDF_STATUS (*dfs_enable)(struct wlan_objmgr_pdev *pdev,
int *is_fastclk,
int32_t pe_firpwr,
int32_t pe_rrssi,
int32_t pe_height,
int32_t pe_prssi,
int32_t pe_inband,
uint32_t pe_relpwr,
uint32_t pe_relstep,
uint32_t pe_maxlen,
struct wlan_dfs_phyerr_param *param,
uint32_t dfsdomain);
QDF_STATUS (*dfs_get_caps)(struct wlan_objmgr_pdev *pdev,
bool *wlan_dfs_ext_chan_ok,
bool *wlan_dfs_combined_rssi_ok,
bool *wlan_dfs_use_enhancement,
bool *wlan_strong_signal_diversiry,
bool *wlan_chip_is_bb_tlv,
bool *wlan_chip_is_over_sampled,
bool *wlan_chip_is_ht160,
bool *wlan_chip_is_false_detect,
uint32_t *wlan_fastdiv_val);
struct wlan_dfs_caps *dfs_caps);
QDF_STATUS (*dfs_disable)(struct wlan_objmgr_pdev *pdev,
int no_cac);
QDF_STATUS (*dfs_gettsf64)(struct wlan_objmgr_pdev *pdev,
uint64_t *tsf64);
QDF_STATUS (*dfs_set_use_cac_prssi)(struct wlan_objmgr_pdev *pdev);
QDF_STATUS (*dfs_get_thresholds)(struct wlan_objmgr_pdev *pdev,
int32_t *pe_firpwr,
int32_t *pe_rrssi,
int32_t *pe_height,
int32_t *pe_prssi,
int32_t *pe_inband,
uint32_t *pe_relpwr,
uint32_t *pe_relstep,
uint32_t *pe_maxlen);
struct wlan_dfs_phyerr_param *param);
QDF_STATUS (*dfs_get_ext_busy)(struct wlan_objmgr_pdev *pdev,
int *dfs_ext_chan_busy);
QDF_STATUS (*dfs_get_target_type)(struct wlan_objmgr_pdev *pdev,