qcacmn: Remove all CONFIG_CHAN_NUM_API instances
Replace below APIs used under CONFIG_CHAN_NUM_API in DFS module with corresponding channel frequency APIs as part of regulatory cleanup effort, dfs_get_bonding_channels dfs_is_en302_502_applicable dfs_nol_timer_cleanup dfs_remove_spoof_channel_from_nol dfs_tlv_calc_freq_info dfs_print_radar_found_freq dfs_compute_radar_found_cfreq Change-Id: I962449264fa76783ea83b271ca2e5fa67dfe478c CRs-Fixed: 2916463
This commit is contained in:

gecommit door
Madan Koyyalamudi

bovenliggende
a1aa15b70c
commit
f9a9545d64
@@ -204,25 +204,6 @@ dfs_process_radar_ind_on_home_chan(struct wlan_dfs *dfs,
|
||||
*/
|
||||
void dfs_radarfound_action_generic(struct wlan_dfs *dfs, uint8_t seg_id);
|
||||
|
||||
/**
|
||||
* dfs_get_bonding_channels() - Get bonding channels.
|
||||
* @dfs: Pointer to wlan_dfs structure.
|
||||
* @curchan: Pointer to dfs_channels to know width and primary channel.
|
||||
* @segment_id: Segment id, useful for 80+80/160 MHz operating band.
|
||||
* @detector_id: Detector id, used to find if radar is detected on
|
||||
* Agile detector.
|
||||
* @channels: Pointer to save radar affected channels.
|
||||
*
|
||||
* Return: Number of channels.
|
||||
*/
|
||||
#ifdef CONFIG_CHAN_NUM_API
|
||||
uint8_t dfs_get_bonding_channels(struct wlan_dfs *dfs,
|
||||
struct dfs_channel *curchan,
|
||||
uint32_t segment_id,
|
||||
uint8_t detector_id,
|
||||
uint8_t *channels);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* dfs_get_bonding_channels_for_freq() - Get bonding channels.
|
||||
* @dfs: Pointer to wlan_dfs structure.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016-2019 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013, 2016-2019, 2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2002-2010, Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
@@ -479,56 +479,4 @@ bool dfs_is_en302_502_applicable(struct wlan_dfs *dfs)
|
||||
return(wlan_reg_is_regdmn_en302502_applicable(dfs->dfs_pdev_obj) &&
|
||||
overlap);
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_CHAN_NUM_API
|
||||
bool dfs_is_en302_502_applicable(struct wlan_dfs *dfs)
|
||||
{
|
||||
int chan_freq;
|
||||
int chan_width;
|
||||
int overlap = 0;
|
||||
struct wlan_objmgr_vdev *vdev = NULL;
|
||||
struct wlan_channel *bss_chan = NULL;
|
||||
|
||||
/* Get centre frequency */
|
||||
chan_freq = utils_dfs_chan_to_freq(
|
||||
dfs->dfs_curchan->dfs_ch_vhtop_ch_freq_seg1);
|
||||
vdev = wlan_objmgr_pdev_get_first_vdev(dfs->dfs_pdev_obj, WLAN_DFS_ID);
|
||||
if (!vdev) {
|
||||
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "vdev is NULL");
|
||||
return false;
|
||||
}
|
||||
|
||||
bss_chan = wlan_vdev_mlme_get_bss_chan(vdev);
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_DFS_ID);
|
||||
/* Grab width */
|
||||
chan_width = wlan_reg_get_bw_value(bss_chan->ch_width);
|
||||
|
||||
if (WLAN_IS_CHAN_11AC_VHT80_80(dfs->dfs_curchan)) {
|
||||
/* HT80_80 mode has 2 segments and each segment must
|
||||
* be checked for control channel first.
|
||||
*/
|
||||
overlap = dfs_check_etsi_overlap(
|
||||
chan_freq, chan_width / 2,
|
||||
ETSI_RADAR_EN302_502_FREQ_LOWER,
|
||||
ETSI_RADAR_EN302_502_FREQ_UPPER);
|
||||
|
||||
/* check for extension channel */
|
||||
chan_freq = utils_dfs_chan_to_freq(
|
||||
dfs->dfs_curchan->dfs_ch_vhtop_ch_freq_seg2);
|
||||
|
||||
overlap += dfs_check_etsi_overlap(
|
||||
chan_freq, chan_width / 2,
|
||||
ETSI_RADAR_EN302_502_FREQ_LOWER,
|
||||
ETSI_RADAR_EN302_502_FREQ_UPPER);
|
||||
} else {
|
||||
overlap = dfs_check_etsi_overlap(
|
||||
chan_freq, chan_width,
|
||||
ETSI_RADAR_EN302_502_FREQ_LOWER,
|
||||
ETSI_RADAR_EN302_502_FREQ_UPPER);
|
||||
}
|
||||
|
||||
return(wlan_reg_is_regdmn_en302502_applicable(dfs->dfs_pdev_obj) &&
|
||||
overlap);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2016-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012, 2016-2021 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
@@ -496,63 +496,6 @@ static int dfs_tlv_calc_freq_info(struct wlan_dfs *dfs,
|
||||
/* Return ev_chan_centre in MHz. */
|
||||
return chan_centre;
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_CHAN_NUM_API
|
||||
static int dfs_tlv_calc_freq_info(struct wlan_dfs *dfs,
|
||||
struct rx_radar_status *rs)
|
||||
{
|
||||
uint32_t chan_centre;
|
||||
uint32_t chan_width;
|
||||
int chan_offset;
|
||||
|
||||
/* For now, just handle up to VHT80 correctly. */
|
||||
if (!dfs->dfs_curchan) {
|
||||
dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "dfs_curchan is null");
|
||||
return 0;
|
||||
/*
|
||||
* For now, the only 11ac channel with freq1/freq2 setup is
|
||||
* VHT80. Should have a flag macro to check this!
|
||||
*/
|
||||
} else if (WLAN_IS_CHAN_11AC_VHT80(dfs->dfs_curchan)) {
|
||||
/*
|
||||
* 11AC, so cfreq1/cfreq2 are setup.
|
||||
* If it's 80+80 this won't work - need to use seg
|
||||
* appropriately!
|
||||
*/
|
||||
chan_centre = dfs_mlme_ieee2mhz(dfs->dfs_pdev_obj,
|
||||
dfs->dfs_curchan->dfs_ch_vhtop_ch_freq_seg1,
|
||||
dfs->dfs_curchan->dfs_ch_flags);
|
||||
} else {
|
||||
/*
|
||||
* HT20/HT40.
|
||||
* This is hard-coded - it should be 5 or 10 for half/quarter
|
||||
* appropriately.
|
||||
*/
|
||||
chan_width = 20;
|
||||
|
||||
/* Grab default channel centre. */
|
||||
chan_centre = dfs_chan2freq(dfs->dfs_curchan);
|
||||
|
||||
/* Calculate offset based on HT40U/HT40D and VHT40U/VHT40D. */
|
||||
if (WLAN_IS_CHAN_11N_HT40PLUS(dfs->dfs_curchan) ||
|
||||
dfs->dfs_curchan->dfs_ch_flags &
|
||||
WLAN_CHAN_VHT40PLUS)
|
||||
chan_offset = chan_width;
|
||||
else if (WLAN_IS_CHAN_11N_HT40MINUS(dfs->dfs_curchan) ||
|
||||
dfs->dfs_curchan->dfs_ch_flags &
|
||||
WLAN_CHAN_VHT40MINUS)
|
||||
chan_offset = -chan_width;
|
||||
else
|
||||
chan_offset = 0;
|
||||
|
||||
/* Calculate new _real_ channel centre. */
|
||||
chan_centre += (chan_offset / 2);
|
||||
}
|
||||
|
||||
/* Return ev_chan_centre in MHz. */
|
||||
return chan_centre;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016-2020 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2013, 2016-2021 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2002-2010, Atheros Communications Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
@@ -651,15 +651,6 @@ static void dfs_print_radar_found_freq(struct wlan_dfs *dfs)
|
||||
"bangradar on 2nd segment cfreq = %u",
|
||||
dfs->dfs_precac_secondary_freq_mhz);
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_CHAN_NUM_API
|
||||
static void dfs_print_radar_found_freq(struct wlan_dfs *dfs)
|
||||
{
|
||||
dfs_debug(dfs, WLAN_DEBUG_DFS,
|
||||
"bangradar on 2nd segment cfreq = %u",
|
||||
dfs->dfs_precac_secondary_freq);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@@ -737,36 +737,6 @@ void dfs_nol_timer_cleanup(struct wlan_dfs *dfs)
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_CHAN_NUM_API
|
||||
void dfs_nol_timer_cleanup(struct wlan_dfs *dfs)
|
||||
{
|
||||
struct dfs_nolelem *nol;
|
||||
uint8_t nol_chan;
|
||||
|
||||
while (true) {
|
||||
WLAN_DFSNOL_LOCK(dfs);
|
||||
|
||||
nol = dfs->dfs_nol;
|
||||
if (nol) {
|
||||
dfs->dfs_nol = nol->nol_next;
|
||||
dfs->dfs_nol_count--;
|
||||
nol_chan = utils_dfs_freq_to_chan(nol->nol_freq);
|
||||
WLAN_DFSNOL_UNLOCK(dfs);
|
||||
utils_dfs_reg_update_nol_ch(dfs->dfs_pdev_obj,
|
||||
&nol_chan,
|
||||
1,
|
||||
DFS_NOL_RESET);
|
||||
|
||||
qdf_timer_free(&nol->nol_timer);
|
||||
qdf_mem_free(nol);
|
||||
} else {
|
||||
WLAN_DFSNOL_UNLOCK(dfs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void dfs_nol_workqueue_cleanup(struct wlan_dfs *dfs)
|
||||
@@ -948,37 +918,4 @@ void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs)
|
||||
utils_dfs_reg_update_nol_chan_for_freq(dfs->dfs_pdev_obj,
|
||||
freq_list, nchans, DFS_NOL_RESET);
|
||||
}
|
||||
#else
|
||||
#if defined(WLAN_DFS_PARTIAL_OFFLOAD) && defined(HOST_DFS_SPOOF_TEST) && \
|
||||
defined(CONFIG_CHAN_NUM_API)
|
||||
void dfs_remove_spoof_channel_from_nol(struct wlan_dfs *dfs)
|
||||
{
|
||||
struct dfs_nolelem *nol;
|
||||
uint8_t channels[NUM_CHANNELS_160MHZ];
|
||||
int i, nchans = 0;
|
||||
|
||||
nchans = dfs_get_bonding_channels(dfs,
|
||||
&dfs->dfs_radar_found_chan,
|
||||
SEG_ID_PRIMARY,
|
||||
DETECTOR_ID_0,
|
||||
channels);
|
||||
|
||||
WLAN_DFSNOL_LOCK(dfs);
|
||||
for (i = 0; i < nchans && i < NUM_CHANNELS_160MHZ; i++) {
|
||||
nol = dfs->dfs_nol;
|
||||
while (nol) {
|
||||
if (nol->nol_freq == (uint16_t)utils_dfs_chan_to_freq(
|
||||
channels[i])) {
|
||||
OS_SET_TIMER(&nol->nol_timer, 0);
|
||||
break;
|
||||
}
|
||||
nol = nol->nol_next;
|
||||
}
|
||||
}
|
||||
WLAN_DFSNOL_UNLOCK(dfs);
|
||||
|
||||
utils_dfs_reg_update_nol_ch(dfs->dfs_pdev_obj,
|
||||
channels, nchans, DFS_NOL_RESET);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -382,68 +382,6 @@ dfs_compute_radar_found_cfreq(struct wlan_dfs *dfs,
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef CONFIG_CHAN_NUM_API
|
||||
static void
|
||||
dfs_compute_radar_found_cfreq(struct wlan_dfs *dfs,
|
||||
struct radar_found_info
|
||||
*radar_found,
|
||||
uint32_t *freq_center)
|
||||
{
|
||||
struct dfs_channel *curchan = dfs->dfs_curchan;
|
||||
/* Radar found on agile detector ID.
|
||||
* Applicable to chips that have a separate agile radar detector
|
||||
* engine.
|
||||
*/
|
||||
if (radar_found->detector_id == dfs_get_agile_detector_id(dfs)) {
|
||||
*freq_center = utils_dfs_chan_to_freq(
|
||||
dfs->dfs_agile_precac_freq);
|
||||
if (dfs->dfs_precac_chwidth == CH_WIDTH_160MHZ ||
|
||||
dfs->dfs_precac_chwidth == CH_WIDTH_80P80MHZ) {
|
||||
if (radar_found->segment_id == PRIMARY_SEG)
|
||||
*freq_center -= DFS_160MHZ_SECOND_SEG_OFFSET;
|
||||
else
|
||||
*freq_center += DFS_160MHZ_SECOND_SEG_OFFSET;
|
||||
}
|
||||
/* Radar found on primary segment by the HW. */
|
||||
} else if (radar_found->segment_id == PRIMARY_SEG) {
|
||||
*freq_center = utils_dfs_chan_to_freq(
|
||||
curchan->dfs_ch_vhtop_ch_freq_seg1);
|
||||
} else {
|
||||
/* Radar found on secondary segment by the HW when
|
||||
* preCAC was running. It (dfs_precac_enable) is specific to
|
||||
* legacy chips.
|
||||
*/
|
||||
if (dfs_is_precac_timer_running(dfs) &&
|
||||
dfs_is_legacy_precac_enabled(dfs)) {
|
||||
*freq_center = utils_dfs_chan_to_freq(
|
||||
dfs->dfs_precac_secondary_freq);
|
||||
} else {
|
||||
/* Radar found on secondary segment by the HW, when preCAC
|
||||
* was not running in legacy chips or preCAC was running
|
||||
* in Lithium chips.
|
||||
*/
|
||||
*freq_center = utils_dfs_chan_to_freq(
|
||||
curchan->dfs_ch_vhtop_ch_freq_seg2);
|
||||
if (WLAN_IS_CHAN_MODE_160(curchan)) {
|
||||
/* If center frequency of entire 160 band
|
||||
* is less than center frequency of primary
|
||||
* segment, then the center frequency of
|
||||
* secondary segment is -40 of center
|
||||
* frequency of entire 160 segment.
|
||||
*/
|
||||
if (curchan->dfs_ch_vhtop_ch_freq_seg2 <
|
||||
curchan->dfs_ch_vhtop_ch_freq_seg1)
|
||||
*freq_center -=
|
||||
DFS_160MHZ_SECOND_SEG_OFFSET;
|
||||
else
|
||||
*freq_center +=
|
||||
DFS_160MHZ_SECOND_SEG_OFFSET;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/**
|
||||
@@ -835,79 +773,6 @@ uint8_t dfs_get_bonding_channels_for_freq(struct wlan_dfs *dfs,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_CHAN_NUM_API
|
||||
uint8_t dfs_get_bonding_channels(struct wlan_dfs *dfs,
|
||||
struct dfs_channel *curchan,
|
||||
uint32_t segment_id,
|
||||
uint8_t detector_id,
|
||||
uint8_t *channels)
|
||||
{
|
||||
uint8_t center_chan;
|
||||
uint8_t nchannels = 0;
|
||||
|
||||
if (detector_id == dfs_get_agile_detector_id(dfs))
|
||||
center_chan = dfs->dfs_agile_precac_freq;
|
||||
else if (!segment_id)
|
||||
center_chan = curchan->dfs_ch_vhtop_ch_freq_seg1;
|
||||
else {
|
||||
/* When precac is running "dfs_ch_vhtop_ch_freq_seg2" is
|
||||
* zero and "dfs_precac_secondary_freq" holds the secondary
|
||||
* frequency in case of legacy chips.
|
||||
* For chips that support a separate agile detector engine,
|
||||
* "dfs_agile_precac_freq" holds the frequency that agile
|
||||
* engine operates on.
|
||||
*
|
||||
* In case of radar detected by the HW in the secondary 80
|
||||
* channel,"dfs_ch_vhtop_ch_freq_seg2" holds the secondary
|
||||
* segment center frequency in the below cases:
|
||||
* 1. preCAC timer is running in chips that support separate
|
||||
* agile engines.
|
||||
* 2. preCAC timer is not running.
|
||||
*/
|
||||
if (dfs_is_precac_timer_running(dfs) &&
|
||||
dfs_is_legacy_precac_enabled(dfs))
|
||||
center_chan = dfs->dfs_precac_secondary_freq;
|
||||
else
|
||||
center_chan = curchan->dfs_ch_vhtop_ch_freq_seg2;
|
||||
}
|
||||
|
||||
if (WLAN_IS_CHAN_MODE_20(curchan)) {
|
||||
nchannels = 1;
|
||||
channels[0] = center_chan;
|
||||
} else if (WLAN_IS_CHAN_MODE_40(curchan)) {
|
||||
nchannels = 2;
|
||||
channels[0] = center_chan - DFS_5GHZ_NEXT_CHAN_OFFSET;
|
||||
channels[1] = center_chan + DFS_5GHZ_NEXT_CHAN_OFFSET;
|
||||
} else if (WLAN_IS_CHAN_MODE_80(curchan) ||
|
||||
WLAN_IS_CHAN_MODE_80_80(curchan) ||
|
||||
detector_id == dfs_get_agile_detector_id(dfs)) {
|
||||
/* If the current channel's bandwidth is 80/80+80/160Mhz,
|
||||
* the corresponding agile Detector's bandwidth will be 80Mhz.
|
||||
* Therefore, if radar is found on the agile detector find
|
||||
* subchannels for 80Mhz bandwidth.
|
||||
*/
|
||||
nchannels = 4;
|
||||
channels[0] = center_chan - DFS_5GHZ_2ND_CHAN_OFFSET;
|
||||
channels[1] = center_chan - DFS_5GHZ_NEXT_CHAN_OFFSET;
|
||||
channels[2] = center_chan + DFS_5GHZ_NEXT_CHAN_OFFSET;
|
||||
channels[3] = center_chan + DFS_5GHZ_2ND_CHAN_OFFSET;
|
||||
} else if (WLAN_IS_CHAN_MODE_160(curchan)) {
|
||||
nchannels = 8;
|
||||
center_chan = curchan->dfs_ch_vhtop_ch_freq_seg2;
|
||||
channels[0] = center_chan - DFS_5GHZ_4TH_CHAN_OFFSET;
|
||||
channels[1] = center_chan - DFS_5GHZ_3RD_CHAN_OFFSET;
|
||||
channels[2] = center_chan - DFS_5GHZ_2ND_CHAN_OFFSET;
|
||||
channels[3] = center_chan - DFS_5GHZ_NEXT_CHAN_OFFSET;
|
||||
channels[4] = center_chan + DFS_5GHZ_NEXT_CHAN_OFFSET;
|
||||
channels[5] = center_chan + DFS_5GHZ_2ND_CHAN_OFFSET;
|
||||
channels[6] = center_chan + DFS_5GHZ_3RD_CHAN_OFFSET;
|
||||
channels[7] = center_chan + DFS_5GHZ_4TH_CHAN_OFFSET;
|
||||
}
|
||||
|
||||
return nchannels;
|
||||
}
|
||||
#endif
|
||||
|
||||
void dfs_reset_bangradar(struct wlan_dfs *dfs)
|
||||
{
|
||||
dfs->dfs_bangradar_type = DFS_NO_BANGRADAR;
|
||||
|
Verwijs in nieuw issue
Block a user