mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04:00
qcacmn: Add common, build_chan_list and priv_objs regdb files
Create below regdb files in core component and move the code from reg_services.c file. These files has the common code used by both WIN and MCL. reg_common_services.c: this file has regdb common APIs used by both WIN and MCL. reg_build_chan_list.c: this file has APIs to build master and current channel list. reg_priv_objs.c: this file has the APIs to create regulatory private PSOC and pdev objects. Change-Id: I891b14fac7a4eddf2697d2ecdc0ac4a82046f532 CRs-Fixed: 2349173
This commit is contained in:
parent
65572e5538
commit
c8c709f6d4
18 changed files with 4338 additions and 243 deletions
901
umac/regulatory/core/src/reg_build_chan_list.c
Normal file
901
umac/regulatory/core/src/reg_build_chan_list.c
Normal file
|
|
@ -0,0 +1,901 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2019 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 copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: reg_build_chan_list.c
|
||||
* This file defines the API to build master and current channel list.
|
||||
*/
|
||||
|
||||
#include <wlan_cmn.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include <wlan_objmgr_pdev_obj.h>
|
||||
#include "reg_priv_objs.h"
|
||||
#include "reg_getset.h"
|
||||
#include "reg_callbacks.h"
|
||||
#include "reg_services_common.h"
|
||||
#include "reg_db.h"
|
||||
#include "reg_db_parser.h"
|
||||
#include "reg_host_11d.h"
|
||||
#include <scheduler_api.h>
|
||||
#include "reg_build_chan_list.h"
|
||||
#include <qdf_platform.h>
|
||||
|
||||
#define CHAN_12_CENT_FREQ 2467
|
||||
#define MAX_PWR_FCC_CHAN_12 8
|
||||
#define CHAN_13_CENT_FREQ 2472
|
||||
#define MAX_PWR_FCC_CHAN_13 2
|
||||
#define CHAN_144_CENT_FREQ 5720
|
||||
|
||||
/**
|
||||
* reg_fill_channel_info() - Populate TX power, antenna gain, channel state,
|
||||
* channel flags, min and max bandwidth to master channel list.
|
||||
* @chan_enum: Channel enum.
|
||||
* @reg_rule: Pointer to regulatory rule which has tx power and antenna gain.
|
||||
* @master_list: Pointer to master channel list.
|
||||
* @min_bw: minimum bandwidth to be used for given channel.
|
||||
*/
|
||||
static void reg_fill_channel_info(enum channel_enum chan_enum,
|
||||
struct cur_reg_rule *reg_rule,
|
||||
struct regulatory_channel *master_list,
|
||||
uint16_t min_bw)
|
||||
{
|
||||
master_list[chan_enum].chan_flags &= ~REGULATORY_CHAN_DISABLED;
|
||||
|
||||
master_list[chan_enum].tx_power = reg_rule->reg_power;
|
||||
master_list[chan_enum].ant_gain = reg_rule->ant_gain;
|
||||
master_list[chan_enum].state = CHANNEL_STATE_ENABLE;
|
||||
|
||||
if (reg_rule->flags & REGULATORY_CHAN_NO_IR) {
|
||||
master_list[chan_enum].chan_flags |= REGULATORY_CHAN_NO_IR;
|
||||
master_list[chan_enum].state = CHANNEL_STATE_DFS;
|
||||
}
|
||||
|
||||
if (reg_rule->flags & REGULATORY_CHAN_RADAR) {
|
||||
master_list[chan_enum].chan_flags |= REGULATORY_CHAN_RADAR;
|
||||
master_list[chan_enum].state = CHANNEL_STATE_DFS;
|
||||
}
|
||||
|
||||
if (reg_rule->flags & REGULATORY_CHAN_INDOOR_ONLY)
|
||||
master_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_INDOOR_ONLY;
|
||||
|
||||
if (reg_rule->flags & REGULATORY_CHAN_NO_OFDM)
|
||||
master_list[chan_enum].chan_flags |= REGULATORY_CHAN_NO_OFDM;
|
||||
|
||||
master_list[chan_enum].min_bw = min_bw;
|
||||
if (master_list[chan_enum].max_bw == 20)
|
||||
master_list[chan_enum].max_bw = reg_rule->max_bw;
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_populate_band_channels() - For all the valid regdb channels in the master
|
||||
* channel list, find the regulatory rules and call reg_fill_channel_info() to
|
||||
* populate master channel list with txpower, antennagain, BW info, etc.
|
||||
* @start_chan: Start channel enum.
|
||||
* @end_chan: End channel enum.
|
||||
* @rule_start_ptr: Pointer to regulatory rules.
|
||||
* @num_reg_rules: Number of regulatory rules.
|
||||
* @min_reg_bw: Minimum regulatory bandwidth.
|
||||
* @mas_chan_list: Pointer to master channel list.
|
||||
*/
|
||||
static void reg_populate_band_channels(enum channel_enum start_chan,
|
||||
enum channel_enum end_chan,
|
||||
struct cur_reg_rule *rule_start_ptr,
|
||||
uint32_t num_reg_rules,
|
||||
uint16_t min_reg_bw,
|
||||
struct regulatory_channel *mas_chan_list)
|
||||
{
|
||||
struct cur_reg_rule *found_rule_ptr;
|
||||
struct cur_reg_rule *cur_rule_ptr;
|
||||
struct regulatory_channel;
|
||||
enum channel_enum chan_enum;
|
||||
uint32_t rule_num, bw;
|
||||
uint16_t max_bw;
|
||||
uint16_t min_bw;
|
||||
|
||||
for (chan_enum = start_chan; chan_enum <= end_chan; chan_enum++) {
|
||||
found_rule_ptr = NULL;
|
||||
|
||||
max_bw = QDF_MIN((uint16_t)20, channel_map[chan_enum].max_bw);
|
||||
min_bw = QDF_MAX(min_reg_bw, channel_map[chan_enum].min_bw);
|
||||
|
||||
if (channel_map[chan_enum].chan_num == INVALID_CHANNEL_NUM)
|
||||
continue;
|
||||
|
||||
for (bw = max_bw; bw >= min_bw; bw = bw / 2) {
|
||||
for (rule_num = 0, cur_rule_ptr = rule_start_ptr;
|
||||
rule_num < num_reg_rules;
|
||||
cur_rule_ptr++, rule_num++) {
|
||||
if ((cur_rule_ptr->start_freq <=
|
||||
mas_chan_list[chan_enum].center_freq -
|
||||
bw / 2) &&
|
||||
(cur_rule_ptr->end_freq >=
|
||||
mas_chan_list[chan_enum].center_freq +
|
||||
bw / 2) && (min_bw <= bw)) {
|
||||
found_rule_ptr = cur_rule_ptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found_rule_ptr)
|
||||
break;
|
||||
}
|
||||
|
||||
if (found_rule_ptr) {
|
||||
mas_chan_list[chan_enum].max_bw = bw;
|
||||
reg_fill_channel_info(chan_enum, found_rule_ptr,
|
||||
mas_chan_list, min_bw);
|
||||
/* Disable 2.4 Ghz channels that dont have 20 mhz bw */
|
||||
if (start_chan == MIN_24GHZ_CHANNEL &&
|
||||
mas_chan_list[chan_enum].max_bw < 20) {
|
||||
mas_chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
mas_chan_list[chan_enum].state =
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_update_max_bw_per_rule() - Update max bandwidth value for given regrules.
|
||||
* @num_reg_rules: Number of regulatory rules.
|
||||
* @reg_rule_start: Pointer to regulatory rules.
|
||||
* @max_bw: Maximum bandwidth
|
||||
*/
|
||||
static void reg_update_max_bw_per_rule(uint32_t num_reg_rules,
|
||||
struct cur_reg_rule *reg_rule_start,
|
||||
uint16_t max_bw)
|
||||
{
|
||||
uint32_t count;
|
||||
|
||||
for (count = 0; count < num_reg_rules; count++)
|
||||
reg_rule_start[count].max_bw =
|
||||
min(reg_rule_start[count].max_bw, max_bw);
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_do_auto_bw_correction() - Calculate and update the maximum bandwidth
|
||||
* value.
|
||||
* @num_reg_rules: Number of regulatory rules.
|
||||
* @reg_rule_ptr: Pointer to regulatory rules.
|
||||
* @max_bw: Maximum bandwidth
|
||||
*/
|
||||
static void reg_do_auto_bw_correction(uint32_t num_reg_rules,
|
||||
struct cur_reg_rule *reg_rule_ptr,
|
||||
uint16_t max_bw)
|
||||
{
|
||||
uint32_t count;
|
||||
uint16_t new_bw;
|
||||
|
||||
for (count = 0; count < num_reg_rules - 1; count++) {
|
||||
if ((reg_rule_ptr[count].end_freq ==
|
||||
reg_rule_ptr[count + 1].start_freq) &&
|
||||
((reg_rule_ptr[count].max_bw +
|
||||
reg_rule_ptr[count + 1].max_bw) <= max_bw)) {
|
||||
new_bw = reg_rule_ptr[count].max_bw +
|
||||
reg_rule_ptr[count + 1].max_bw;
|
||||
reg_rule_ptr[count].max_bw = new_bw;
|
||||
reg_rule_ptr[count + 1].max_bw = new_bw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_dfs_channels() - disable the DFS channels if
|
||||
* dfs_enable set to false.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @dfs_enabled: if false, then disable the DFS channels.
|
||||
*/
|
||||
static void reg_modify_chan_list_for_dfs_channels(
|
||||
struct regulatory_channel *chan_list, bool dfs_enabled)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
|
||||
if (dfs_enabled)
|
||||
return;
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
if (chan_list[chan_enum].state == CHANNEL_STATE_DFS) {
|
||||
chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_indoor_channels() - Disable the indoor channels if
|
||||
* indoor_chan_enabled flag is set to false.
|
||||
* @pdev_priv_obj: Pointer to regulatory private pdev structure.
|
||||
*/
|
||||
static void reg_modify_chan_list_for_indoor_channels(
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
struct regulatory_channel *chan_list = pdev_priv_obj->cur_chan_list;
|
||||
|
||||
if (pdev_priv_obj->indoor_chan_enabled)
|
||||
return;
|
||||
|
||||
if (!pdev_priv_obj->force_ssc_disable_indoor_channel) {
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
if (REGULATORY_CHAN_INDOOR_ONLY &
|
||||
chan_list[chan_enum].chan_flags) {
|
||||
chan_list[chan_enum].state =
|
||||
CHANNEL_STATE_DISABLE;
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
if (pdev_priv_obj->sap_state) {
|
||||
if (REGULATORY_CHAN_INDOOR_ONLY &
|
||||
chan_list[chan_enum].chan_flags) {
|
||||
chan_list[chan_enum].state =
|
||||
CHANNEL_STATE_DISABLE;
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
}
|
||||
} else {
|
||||
if (REGULATORY_CHAN_INDOOR_ONLY &
|
||||
chan_list[chan_enum].chan_flags) {
|
||||
chan_list[chan_enum].state =
|
||||
CHANNEL_STATE_DFS;
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_NO_IR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_band() - Based on the input band value, either
|
||||
* disable 2GHz or 5GHz channels.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @band_val: Input band value.
|
||||
*/
|
||||
static void reg_modify_chan_list_for_band(struct regulatory_channel *chan_list,
|
||||
enum band_info band_val)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
|
||||
if (band_val == BAND_2G) {
|
||||
for (chan_enum = MIN_5GHZ_CHANNEL;
|
||||
chan_enum <= MAX_5GHZ_CHANNEL; chan_enum++) {
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
|
||||
}
|
||||
}
|
||||
|
||||
if (band_val == BAND_5G) {
|
||||
for (chan_enum = MIN_24GHZ_CHANNEL;
|
||||
chan_enum <= MAX_24GHZ_CHANNEL; chan_enum++) {
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_fcc_channel() - Set maximum FCC txpower for channel
|
||||
* 12 and 13 if set_fcc_channel flag is set to true.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @set_fcc_channel: If this flag is set to true, then set the max FCC txpower
|
||||
* for channel 12 and 13.
|
||||
*/
|
||||
static void reg_modify_chan_list_for_fcc_channel(
|
||||
struct regulatory_channel *chan_list, bool set_fcc_channel)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
|
||||
if (!set_fcc_channel)
|
||||
return;
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
if (chan_list[chan_enum].center_freq == CHAN_12_CENT_FREQ)
|
||||
chan_list[chan_enum].tx_power = MAX_PWR_FCC_CHAN_12;
|
||||
|
||||
if (chan_list[chan_enum].center_freq == CHAN_13_CENT_FREQ)
|
||||
chan_list[chan_enum].tx_power = MAX_PWR_FCC_CHAN_13;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_chan_144() - Disable channel 144 if en_chan_144 flag
|
||||
* is set to false.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @en_chan_144: if false, then disable channel 144.
|
||||
*/
|
||||
static void reg_modify_chan_list_for_chan_144(
|
||||
struct regulatory_channel *chan_list, bool en_chan_144)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
|
||||
if (en_chan_144)
|
||||
return;
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
if (chan_list[chan_enum].center_freq == CHAN_144_CENT_FREQ) {
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_nol_list() - Disable the channel if nol_chan flag is
|
||||
* set.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
*/
|
||||
static void reg_modify_chan_list_for_nol_list(
|
||||
struct regulatory_channel *chan_list)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
if (chan_list[chan_enum].nol_chan) {
|
||||
chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_find_low_limit_chan_enum() - Find low limit 2G and 5G channel enums.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @low_freq: low limit frequency.
|
||||
* @low_limit: pointer to output low limit enum.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void reg_find_low_limit_chan_enum(
|
||||
struct regulatory_channel *chan_list, uint32_t low_freq,
|
||||
uint32_t *low_limit)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
uint16_t min_bw;
|
||||
uint16_t max_bw;
|
||||
uint32_t center_freq;
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
min_bw = chan_list[chan_enum].min_bw;
|
||||
max_bw = chan_list[chan_enum].max_bw;
|
||||
center_freq = chan_list[chan_enum].center_freq;
|
||||
|
||||
if ((center_freq - min_bw / 2) >= low_freq) {
|
||||
if ((center_freq - max_bw / 2) < low_freq) {
|
||||
if (max_bw <= 20)
|
||||
max_bw = ((center_freq - low_freq) * 2);
|
||||
if (max_bw < min_bw)
|
||||
max_bw = min_bw;
|
||||
chan_list[chan_enum].max_bw = max_bw;
|
||||
}
|
||||
*low_limit = chan_enum;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_find_high_limit_chan_enum() - Find high limit 2G and 5G channel enums.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @high_freq: high limit frequency.
|
||||
* @high_limit: pointer to output high limit enum.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void reg_find_high_limit_chan_enum(
|
||||
struct regulatory_channel *chan_list, uint32_t high_freq,
|
||||
uint32_t *high_limit)
|
||||
{
|
||||
enum channel_enum chan_enum;
|
||||
uint16_t min_bw;
|
||||
uint16_t max_bw;
|
||||
uint32_t center_freq;
|
||||
|
||||
for (chan_enum = NUM_CHANNELS - 1; chan_enum >= 0; chan_enum--) {
|
||||
min_bw = chan_list[chan_enum].min_bw;
|
||||
max_bw = chan_list[chan_enum].max_bw;
|
||||
center_freq = chan_list[chan_enum].center_freq;
|
||||
|
||||
if (center_freq + min_bw / 2 <= high_freq) {
|
||||
if ((center_freq + max_bw / 2) > high_freq) {
|
||||
if (max_bw <= 20)
|
||||
max_bw = ((high_freq -
|
||||
center_freq) * 2);
|
||||
if (max_bw < min_bw)
|
||||
max_bw = min_bw;
|
||||
chan_list[chan_enum].max_bw = max_bw;
|
||||
}
|
||||
*high_limit = chan_enum;
|
||||
break;
|
||||
}
|
||||
|
||||
if (chan_enum == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_freq_range() - Modify channel list for the given low
|
||||
* and high frequency range.
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @low_freq_2g: Low frequency 2G.
|
||||
* @high_freq_2g: High frequency 2G.
|
||||
* @low_freq_5g: Low frequency 5G.
|
||||
* @high_freq_5g: High frequency 5G.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
static void
|
||||
reg_modify_chan_list_for_freq_range(struct regulatory_channel *chan_list,
|
||||
uint32_t low_freq_2g,
|
||||
uint32_t high_freq_2g,
|
||||
uint32_t low_freq_5g,
|
||||
uint32_t high_freq_5g)
|
||||
{
|
||||
uint32_t low_limit_2g = NUM_CHANNELS;
|
||||
uint32_t high_limit_2g = NUM_CHANNELS;
|
||||
uint32_t low_limit_5g = NUM_CHANNELS;
|
||||
uint32_t high_limit_5g = NUM_CHANNELS;
|
||||
enum channel_enum chan_enum;
|
||||
bool chan_in_range;
|
||||
|
||||
reg_find_low_limit_chan_enum(chan_list, low_freq_2g, &low_limit_2g);
|
||||
reg_find_low_limit_chan_enum(chan_list, low_freq_5g, &low_limit_5g);
|
||||
reg_find_high_limit_chan_enum(chan_list, high_freq_2g, &high_limit_2g);
|
||||
reg_find_high_limit_chan_enum(chan_list, high_freq_5g, &high_limit_5g);
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
chan_in_range = false;
|
||||
if ((low_limit_2g <= chan_enum) &&
|
||||
(high_limit_2g >= chan_enum) &&
|
||||
(low_limit_2g != NUM_CHANNELS) &&
|
||||
(high_limit_2g != NUM_CHANNELS))
|
||||
chan_in_range = true;
|
||||
|
||||
if ((low_limit_5g <= chan_enum) &&
|
||||
(high_limit_5g >= chan_enum) &&
|
||||
(low_limit_5g != NUM_CHANNELS) &&
|
||||
(high_limit_5g != NUM_CHANNELS))
|
||||
chan_in_range = true;
|
||||
|
||||
if (!chan_in_range) {
|
||||
chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void reg_init_pdev_mas_chan_list(
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
|
||||
struct mas_chan_params *mas_chan_params)
|
||||
{
|
||||
qdf_mem_copy(pdev_priv_obj->mas_chan_list,
|
||||
mas_chan_params->mas_chan_list,
|
||||
NUM_CHANNELS * sizeof(struct regulatory_channel));
|
||||
|
||||
pdev_priv_obj->dfs_region = mas_chan_params->dfs_region;
|
||||
|
||||
pdev_priv_obj->phybitmap = mas_chan_params->phybitmap;
|
||||
|
||||
pdev_priv_obj->reg_dmn_pair = mas_chan_params->reg_dmn_pair;
|
||||
pdev_priv_obj->ctry_code = mas_chan_params->ctry_code;
|
||||
|
||||
pdev_priv_obj->def_region_domain = mas_chan_params->reg_dmn_pair;
|
||||
pdev_priv_obj->def_country_code = mas_chan_params->ctry_code;
|
||||
|
||||
qdf_mem_copy(pdev_priv_obj->default_country,
|
||||
mas_chan_params->default_country, REG_ALPHA2_LEN + 1);
|
||||
|
||||
qdf_mem_copy(pdev_priv_obj->current_country,
|
||||
mas_chan_params->current_country, REG_ALPHA2_LEN + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* reg_modify_chan_list_for_cached_channels() - If num_cache_channels are
|
||||
* non-zero, then disable the pdev channels which is given in
|
||||
* cache_disable_chan_list.
|
||||
* @pdev_priv_obj: Pointer to regulatory pdev private object.
|
||||
*/
|
||||
#ifdef DISABLE_CHANNEL_LIST
|
||||
static void reg_modify_chan_list_for_cached_channels(
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
||||
{
|
||||
uint32_t i, j;
|
||||
uint32_t num_cache_channels = pdev_priv_obj->num_cache_channels;
|
||||
struct regulatory_channel *chan_list = pdev_priv_obj->cur_chan_list;
|
||||
struct regulatory_channel *cache_chan_list =
|
||||
pdev_priv_obj->cache_disable_chan_list;
|
||||
|
||||
if (!num_cache_channels)
|
||||
return;
|
||||
|
||||
if (pdev_priv_obj->disable_cached_channels) {
|
||||
for (i = 0; i < num_cache_channels; i++)
|
||||
for (j = 0; j < NUM_CHANNELS; j++)
|
||||
if (cache_chan_list[i].chan_num ==
|
||||
chan_list[j].chan_num) {
|
||||
chan_list[j].state =
|
||||
CHANNEL_STATE_DISABLE;
|
||||
chan_list[j].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
static void reg_modify_chan_list_for_cached_channels(
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
void reg_compute_pdev_current_chan_list(
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
||||
{
|
||||
qdf_mem_copy(pdev_priv_obj->cur_chan_list, pdev_priv_obj->mas_chan_list,
|
||||
NUM_CHANNELS * sizeof(struct regulatory_channel));
|
||||
|
||||
reg_modify_chan_list_for_freq_range(pdev_priv_obj->cur_chan_list,
|
||||
pdev_priv_obj->range_2g_low,
|
||||
pdev_priv_obj->range_2g_high,
|
||||
pdev_priv_obj->range_5g_low,
|
||||
pdev_priv_obj->range_5g_high);
|
||||
|
||||
reg_modify_chan_list_for_band(pdev_priv_obj->cur_chan_list,
|
||||
pdev_priv_obj->band_capability);
|
||||
|
||||
reg_modify_chan_list_for_dfs_channels(pdev_priv_obj->cur_chan_list,
|
||||
pdev_priv_obj->dfs_enabled);
|
||||
|
||||
reg_modify_chan_list_for_nol_list(pdev_priv_obj->cur_chan_list);
|
||||
|
||||
reg_modify_chan_list_for_indoor_channels(pdev_priv_obj);
|
||||
|
||||
reg_modify_chan_list_for_fcc_channel(pdev_priv_obj->cur_chan_list,
|
||||
pdev_priv_obj->set_fcc_channel);
|
||||
|
||||
reg_modify_chan_list_for_chan_144(pdev_priv_obj->cur_chan_list,
|
||||
pdev_priv_obj->en_chan_144);
|
||||
|
||||
reg_modify_chan_list_for_cached_channels(pdev_priv_obj);
|
||||
}
|
||||
|
||||
void reg_reset_reg_rules(struct reg_rule_info *reg_rules)
|
||||
{
|
||||
qdf_mem_zero(reg_rules, sizeof(*reg_rules));
|
||||
}
|
||||
|
||||
void reg_save_reg_rules_to_pdev(
|
||||
struct reg_rule_info *psoc_reg_rules,
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj)
|
||||
{
|
||||
uint32_t reg_rule_len;
|
||||
struct reg_rule_info *pdev_reg_rules;
|
||||
|
||||
qdf_spin_lock_bh(&pdev_priv_obj->reg_rules_lock);
|
||||
|
||||
pdev_reg_rules = &pdev_priv_obj->reg_rules;
|
||||
reg_reset_reg_rules(pdev_reg_rules);
|
||||
|
||||
pdev_reg_rules->num_of_reg_rules = psoc_reg_rules->num_of_reg_rules;
|
||||
if (!pdev_reg_rules->num_of_reg_rules) {
|
||||
qdf_spin_unlock_bh(&pdev_priv_obj->reg_rules_lock);
|
||||
reg_err("no reg rules in psoc");
|
||||
return;
|
||||
}
|
||||
|
||||
reg_rule_len = pdev_reg_rules->num_of_reg_rules *
|
||||
sizeof(struct cur_reg_rule);
|
||||
qdf_mem_copy(pdev_reg_rules->reg_rules, psoc_reg_rules->reg_rules,
|
||||
reg_rule_len);
|
||||
|
||||
qdf_mem_copy(pdev_reg_rules->alpha2, pdev_priv_obj->current_country,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
pdev_reg_rules->dfs_region = pdev_priv_obj->dfs_region;
|
||||
|
||||
qdf_spin_unlock_bh(&pdev_priv_obj->reg_rules_lock);
|
||||
}
|
||||
|
||||
void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
|
||||
void *object, void *arg)
|
||||
{
|
||||
struct wlan_objmgr_pdev *pdev = (struct wlan_objmgr_pdev *)object;
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
enum direction *dir = arg;
|
||||
uint32_t pdev_id;
|
||||
struct wlan_lmac_if_reg_tx_ops *reg_tx_ops;
|
||||
struct reg_rule_info *psoc_reg_rules;
|
||||
|
||||
psoc_priv_obj = (struct wlan_regulatory_psoc_priv_obj *)
|
||||
wlan_objmgr_psoc_get_comp_private_obj(
|
||||
psoc, WLAN_UMAC_COMP_REGULATORY);
|
||||
|
||||
if (!psoc_priv_obj) {
|
||||
reg_err("psoc priv obj is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
pdev_priv_obj = reg_get_pdev_obj(pdev);
|
||||
|
||||
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
|
||||
reg_err("reg pdev priv obj is NULL");
|
||||
return;
|
||||
}
|
||||
|
||||
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
||||
reg_init_pdev_mas_chan_list(
|
||||
pdev_priv_obj,
|
||||
&psoc_priv_obj->mas_chan_params[pdev_id]);
|
||||
psoc_reg_rules = &psoc_priv_obj->mas_chan_params[pdev_id].reg_rules;
|
||||
reg_save_reg_rules_to_pdev(psoc_reg_rules, pdev_priv_obj);
|
||||
reg_compute_pdev_current_chan_list(pdev_priv_obj);
|
||||
|
||||
reg_tx_ops = reg_get_psoc_tx_ops(psoc);
|
||||
if (reg_tx_ops->fill_umac_legacy_chanlist) {
|
||||
reg_tx_ops->fill_umac_legacy_chanlist(
|
||||
pdev, pdev_priv_obj->cur_chan_list);
|
||||
} else {
|
||||
if (*dir == NORTHBOUND)
|
||||
reg_send_scheduler_msg_nb(psoc, pdev);
|
||||
else
|
||||
reg_send_scheduler_msg_sb(psoc, pdev);
|
||||
}
|
||||
}
|
||||
|
||||
QDF_STATUS reg_process_master_chan_list(
|
||||
struct cur_regulatory_info *regulat_info)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *soc_reg;
|
||||
uint32_t num_2g_reg_rules, num_5g_reg_rules;
|
||||
struct cur_reg_rule *reg_rule_2g, *reg_rule_5g;
|
||||
uint16_t min_bw_2g, max_bw_2g, min_bw_5g, max_bw_5g;
|
||||
struct regulatory_channel *mas_chan_list;
|
||||
struct wlan_objmgr_psoc *psoc;
|
||||
enum channel_enum chan_enum;
|
||||
wlan_objmgr_ref_dbgid dbg_id;
|
||||
enum direction dir;
|
||||
uint8_t phy_id;
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
struct wlan_lmac_if_reg_tx_ops *tx_ops;
|
||||
struct reg_rule_info *reg_rules;
|
||||
QDF_STATUS status;
|
||||
|
||||
psoc = regulat_info->psoc;
|
||||
soc_reg = reg_get_psoc_obj(psoc);
|
||||
|
||||
if (!IS_VALID_PSOC_REG_OBJ(soc_reg)) {
|
||||
reg_err("psoc reg component is NULL");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
tx_ops = reg_get_psoc_tx_ops(psoc);
|
||||
phy_id = regulat_info->phy_id;
|
||||
|
||||
if (reg_ignore_default_country(soc_reg, regulat_info)) {
|
||||
status = reg_set_curr_country(soc_reg, regulat_info, tx_ops);
|
||||
if (QDF_IS_STATUS_SUCCESS(status)) {
|
||||
reg_debug("WLAN restart - Ignore default CC for phy_id: %u",
|
||||
phy_id);
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
reg_debug("process reg master chan list");
|
||||
|
||||
if (soc_reg->offload_enabled) {
|
||||
dbg_id = WLAN_REGULATORY_NB_ID;
|
||||
dir = NORTHBOUND;
|
||||
} else {
|
||||
dbg_id = WLAN_REGULATORY_SB_ID;
|
||||
dir = SOUTHBOUND;
|
||||
}
|
||||
|
||||
if (regulat_info->status_code != REG_SET_CC_STATUS_PASS) {
|
||||
reg_err("Setting country code failed, status code is %d",
|
||||
regulat_info->status_code);
|
||||
|
||||
pdev = wlan_objmgr_get_pdev_by_id(psoc, phy_id, dbg_id);
|
||||
if (!pdev) {
|
||||
reg_err("pdev is NULL");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
wlan_objmgr_pdev_release_ref(pdev, dbg_id);
|
||||
|
||||
if (tx_ops->set_country_failed)
|
||||
tx_ops->set_country_failed(pdev);
|
||||
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
mas_chan_list = soc_reg->mas_chan_params[phy_id].mas_chan_list;
|
||||
|
||||
reg_init_channel_map(regulat_info->dfs_region);
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS;
|
||||
chan_enum++) {
|
||||
mas_chan_list[chan_enum].chan_num =
|
||||
channel_map[chan_enum].chan_num;
|
||||
mas_chan_list[chan_enum].center_freq =
|
||||
channel_map[chan_enum].center_freq;
|
||||
mas_chan_list[chan_enum].chan_flags =
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
mas_chan_list[chan_enum].state =
|
||||
CHANNEL_STATE_DISABLE;
|
||||
mas_chan_list[chan_enum].nol_chan = false;
|
||||
}
|
||||
|
||||
soc_reg->num_phy = regulat_info->num_phy;
|
||||
soc_reg->mas_chan_params[phy_id].phybitmap =
|
||||
regulat_info->phybitmap;
|
||||
soc_reg->mas_chan_params[phy_id].dfs_region =
|
||||
regulat_info->dfs_region;
|
||||
soc_reg->mas_chan_params[phy_id].ctry_code =
|
||||
regulat_info->ctry_code;
|
||||
soc_reg->mas_chan_params[phy_id].reg_dmn_pair =
|
||||
regulat_info->reg_dmn_pair;
|
||||
qdf_mem_copy(soc_reg->mas_chan_params[phy_id].current_country,
|
||||
regulat_info->alpha2,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
qdf_mem_copy(soc_reg->cur_country,
|
||||
regulat_info->alpha2,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
reg_debug("set cur_country %.2s", soc_reg->cur_country);
|
||||
|
||||
min_bw_2g = regulat_info->min_bw_2g;
|
||||
max_bw_2g = regulat_info->max_bw_2g;
|
||||
reg_rule_2g = regulat_info->reg_rules_2g_ptr;
|
||||
num_2g_reg_rules = regulat_info->num_2g_reg_rules;
|
||||
reg_update_max_bw_per_rule(num_2g_reg_rules,
|
||||
reg_rule_2g, max_bw_2g);
|
||||
|
||||
min_bw_5g = regulat_info->min_bw_5g;
|
||||
max_bw_5g = regulat_info->max_bw_5g;
|
||||
reg_rule_5g = regulat_info->reg_rules_5g_ptr;
|
||||
num_5g_reg_rules = regulat_info->num_5g_reg_rules;
|
||||
reg_update_max_bw_per_rule(num_5g_reg_rules,
|
||||
reg_rule_5g, max_bw_5g);
|
||||
|
||||
reg_rules = &soc_reg->mas_chan_params[phy_id].reg_rules;
|
||||
reg_reset_reg_rules(reg_rules);
|
||||
|
||||
reg_rules->num_of_reg_rules = num_5g_reg_rules + num_2g_reg_rules;
|
||||
if (reg_rules->num_of_reg_rules > MAX_REG_RULES) {
|
||||
reg_err("number of reg rules exceeds limit");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (reg_rules->num_of_reg_rules) {
|
||||
if (num_2g_reg_rules)
|
||||
qdf_mem_copy(reg_rules->reg_rules,
|
||||
reg_rule_2g, num_2g_reg_rules *
|
||||
sizeof(struct cur_reg_rule));
|
||||
if (num_5g_reg_rules)
|
||||
qdf_mem_copy(reg_rules->reg_rules +
|
||||
num_2g_reg_rules, reg_rule_5g,
|
||||
num_5g_reg_rules *
|
||||
sizeof(struct cur_reg_rule));
|
||||
}
|
||||
|
||||
if (num_5g_reg_rules != 0)
|
||||
reg_do_auto_bw_correction(num_5g_reg_rules,
|
||||
reg_rule_5g, max_bw_5g);
|
||||
|
||||
if (num_2g_reg_rules != 0)
|
||||
reg_populate_band_channels(MIN_24GHZ_CHANNEL, MAX_24GHZ_CHANNEL,
|
||||
reg_rule_2g, num_2g_reg_rules,
|
||||
min_bw_2g, mas_chan_list);
|
||||
|
||||
if (num_5g_reg_rules != 0)
|
||||
reg_populate_band_channels(MIN_5GHZ_CHANNEL, MAX_5GHZ_CHANNEL,
|
||||
reg_rule_5g, num_5g_reg_rules,
|
||||
min_bw_5g, mas_chan_list);
|
||||
|
||||
if (num_5g_reg_rules != 0)
|
||||
reg_populate_band_channels(MIN_49GHZ_CHANNEL,
|
||||
MAX_49GHZ_CHANNEL,
|
||||
reg_rule_5g, num_5g_reg_rules,
|
||||
min_bw_5g, mas_chan_list);
|
||||
|
||||
if (soc_reg->new_user_ctry_pending[phy_id]) {
|
||||
soc_reg->new_user_ctry_pending[phy_id] = false;
|
||||
soc_reg->cc_src = SOURCE_USERSPACE;
|
||||
soc_reg->user_ctry_set = true;
|
||||
reg_debug("new user country is set");
|
||||
reg_run_11d_state_machine(psoc);
|
||||
} else if (soc_reg->new_init_ctry_pending[phy_id]) {
|
||||
soc_reg->new_init_ctry_pending[phy_id] = false;
|
||||
soc_reg->cc_src = SOURCE_USERSPACE;
|
||||
reg_debug("new init country is set");
|
||||
} else if (soc_reg->new_11d_ctry_pending[phy_id]) {
|
||||
soc_reg->new_11d_ctry_pending[phy_id] = false;
|
||||
soc_reg->cc_src = SOURCE_11D;
|
||||
soc_reg->user_ctry_set = false;
|
||||
reg_run_11d_state_machine(psoc);
|
||||
} else if (soc_reg->world_country_pending[phy_id]) {
|
||||
soc_reg->world_country_pending[phy_id] = false;
|
||||
soc_reg->cc_src = SOURCE_CORE;
|
||||
soc_reg->user_ctry_set = false;
|
||||
reg_run_11d_state_machine(psoc);
|
||||
} else {
|
||||
if (soc_reg->cc_src == SOURCE_UNKNOWN &&
|
||||
soc_reg->num_phy == phy_id + 1)
|
||||
soc_reg->cc_src = SOURCE_DRIVER;
|
||||
|
||||
qdf_mem_copy(soc_reg->mas_chan_params[phy_id].default_country,
|
||||
regulat_info->alpha2,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
|
||||
soc_reg->mas_chan_params[phy_id].def_country_code =
|
||||
regulat_info->ctry_code;
|
||||
soc_reg->mas_chan_params[phy_id].def_region_domain =
|
||||
regulat_info->reg_dmn_pair;
|
||||
|
||||
if (soc_reg->cc_src == SOURCE_DRIVER) {
|
||||
qdf_mem_copy(soc_reg->def_country,
|
||||
regulat_info->alpha2,
|
||||
REG_ALPHA2_LEN + 1);
|
||||
|
||||
soc_reg->def_country_code = regulat_info->ctry_code;
|
||||
soc_reg->def_region_domain =
|
||||
regulat_info->reg_dmn_pair;
|
||||
|
||||
if (reg_is_world_alpha2(regulat_info->alpha2)) {
|
||||
soc_reg->cc_src = SOURCE_CORE;
|
||||
reg_run_11d_state_machine(psoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pdev = wlan_objmgr_get_pdev_by_id(psoc, phy_id, dbg_id);
|
||||
if (pdev) {
|
||||
reg_propagate_mas_chan_list_to_pdev(psoc, pdev, &dir);
|
||||
wlan_objmgr_pdev_release_ref(pdev, dbg_id);
|
||||
reg_reset_reg_rules(reg_rules);
|
||||
}
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
|
||||
struct regulatory_channel *chan_list)
|
||||
{
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
|
||||
pdev_priv_obj = reg_get_pdev_obj(pdev);
|
||||
|
||||
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
|
||||
reg_err("reg pdev private obj is NULL");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
qdf_mem_copy(chan_list, pdev_priv_obj->cur_chan_list,
|
||||
NUM_CHANNELS * sizeof(struct regulatory_channel));
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
98
umac/regulatory/core/src/reg_build_chan_list.h
Normal file
98
umac/regulatory/core/src/reg_build_chan_list.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2019 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 copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: reg_build_chan_list.h
|
||||
* This file provides prototypes of the regulatory component to build master
|
||||
* and current channel list.
|
||||
*/
|
||||
|
||||
#ifndef __REG_BUILD_CHAN_LIST_H__
|
||||
#define __REG_BUILD_CHAN_LIST_H__
|
||||
|
||||
/**
|
||||
* reg_reset_reg_rules() - provides the reg domain rules info
|
||||
* @reg_rules: reg rules pointer
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void reg_reset_reg_rules(struct reg_rule_info *reg_rules);
|
||||
|
||||
/**
|
||||
* reg_init_pdev_mas_chan_list() - Initialize pdev master channel list
|
||||
* @pdev_priv_obj: Pointer to regdb pdev private object.
|
||||
* @mas_chan_params: Master channel params.
|
||||
*/
|
||||
void reg_init_pdev_mas_chan_list(
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
|
||||
struct mas_chan_params *mas_chan_params);
|
||||
|
||||
/**
|
||||
* reg_save_reg_rules_to_pdev() - Save psoc reg-rules to pdev.
|
||||
* @pdev_priv_obj: Pointer to regdb pdev private object.
|
||||
*/
|
||||
void reg_save_reg_rules_to_pdev(
|
||||
struct reg_rule_info *psoc_reg_rules,
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj);
|
||||
|
||||
/**
|
||||
* reg_compute_pdev_current_chan_list() - Compute pdev current channel list.
|
||||
* @pdev_priv_obj: Pointer to regdb pdev private object.
|
||||
*/
|
||||
void reg_compute_pdev_current_chan_list(
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj);
|
||||
|
||||
/**
|
||||
* reg_propagate_mas_chan_list_to_pdev() - Propagate master channel list to pdev
|
||||
* @psoc: Pointer to psoc object.
|
||||
* @object: Void pointer to pdev object.
|
||||
* @arg: Pointer to direction.
|
||||
*/
|
||||
void reg_propagate_mas_chan_list_to_pdev(struct wlan_objmgr_psoc *psoc,
|
||||
void *object, void *arg);
|
||||
|
||||
/**
|
||||
* reg_process_master_chan_list() - Compute master channel list based on the
|
||||
* regulatory rules.
|
||||
* @reg_info: Pointer to regulatory info
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info *reg_info);
|
||||
|
||||
QDF_STATUS reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
|
||||
struct regulatory_channel *chan_list);
|
||||
|
||||
/**
|
||||
* reg_update_nol_history_ch() - Set nol-history flag for the channels in the
|
||||
* list.
|
||||
*
|
||||
* @pdev: Pdev ptr.
|
||||
* @ch_list: Input channel list.
|
||||
* @num_ch: Number of channels.
|
||||
* @nol_history_ch: NOL-History flag.
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *chan_list,
|
||||
uint8_t num_chan,
|
||||
bool nol_history_chan);
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include <qdf_types.h>
|
||||
#include <qdf_trace.h>
|
||||
#include <wlan_cmn.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
#include "reg_db.h"
|
||||
|
||||
enum country_code {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -25,48 +25,6 @@
|
|||
#ifndef __REG_DB_H
|
||||
#define __REG_DB_H
|
||||
|
||||
#define REGULATORY_CHAN_DISABLED (1<<0)
|
||||
#define REGULATORY_CHAN_NO_IR (1<<1)
|
||||
#define REGULATORY_CHAN_RADAR (1<<3)
|
||||
#define REGULATORY_CHAN_NO_OFDM (1<<6)
|
||||
#define REGULATORY_CHAN_INDOOR_ONLY (1<<9)
|
||||
|
||||
#define REGULATORY_CHAN_NO_HT40 (1<<4)
|
||||
#define REGULATORY_CHAN_NO_80MHZ (1<<7)
|
||||
#define REGULATORY_CHAN_NO_160MHZ (1<<8)
|
||||
#define REGULATORY_CHAN_NO_20MHZ (1<<11)
|
||||
#define REGULATORY_CHAN_NO_10MHZ (1<<12)
|
||||
|
||||
#define REGULATORY_PHYMODE_NO11A (1<<0)
|
||||
#define REGULATORY_PHYMODE_NO11B (1<<1)
|
||||
#define REGULATORY_PHYMODE_NO11G (1<<2)
|
||||
#define REGULATORY_CHAN_NO11N (1<<3)
|
||||
#define REGULATORY_PHYMODE_NO11AC (1<<4)
|
||||
#define REGULATORY_PHYMODE_NO11AX (1<<5)
|
||||
|
||||
#define MAX_REG_RULES 10
|
||||
#define REG_ALPHA2_LEN 2
|
||||
|
||||
/**
|
||||
* enum dfs_reg - DFS region
|
||||
* @DFS_UNINIT_REGION: un-initialized region
|
||||
* @DFS_FCC_REGION: FCC region
|
||||
* @DFS_ETSI_REGION: ETSI region
|
||||
* @DFS_MKK_REGION: MKK region
|
||||
* @DFS_CN_REGION: China region
|
||||
* @DFS_KR_REGION: Korea region
|
||||
* @DFS_UNDEF_REGION: Undefined region
|
||||
*/
|
||||
enum dfs_reg {
|
||||
DFS_UNINIT_REGION = 0,
|
||||
DFS_FCC_REGION = 1,
|
||||
DFS_ETSI_REGION = 2,
|
||||
DFS_MKK_REGION = 3,
|
||||
DFS_CN_REGION = 4,
|
||||
DFS_KR_REGION = 5,
|
||||
DFS_UNDEF_REGION = 0xFFFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* struct regulatory_rule
|
||||
* @start_freq: start frequency
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -23,10 +23,14 @@
|
|||
*/
|
||||
|
||||
#include <qdf_types.h>
|
||||
#include <wlan_cmn.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
#include "reg_db.h"
|
||||
#include "reg_db_parser.h"
|
||||
#include <qdf_mem.h>
|
||||
#include "reg_priv.h"
|
||||
#include "reg_services.h"
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include "reg_priv_objs.h"
|
||||
#include "reg_getset.h"
|
||||
|
||||
QDF_STATUS reg_is_country_code_valid(uint8_t *alpha2)
|
||||
{
|
||||
|
|
@ -37,7 +41,7 @@ QDF_STATUS reg_is_country_code_valid(uint8_t *alpha2)
|
|||
|
||||
for (i = 0; i < num_countries; i++) {
|
||||
if ((g_all_countries[i].alpha2[0] == alpha2[0]) &&
|
||||
(g_all_countries[i].alpha2[1] == alpha2[1]))
|
||||
(g_all_countries[i].alpha2[1] == alpha2[1]))
|
||||
return QDF_STATUS_SUCCESS;
|
||||
else
|
||||
continue;
|
||||
|
|
@ -46,11 +50,9 @@ QDF_STATUS reg_is_country_code_valid(uint8_t *alpha2)
|
|||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
QDF_STATUS reg_regrules_assign(uint8_t dmn_id_2g,
|
||||
uint8_t dmn_id_5g,
|
||||
uint8_t ant_gain_2g,
|
||||
uint8_t ant_gain_5g,
|
||||
struct cur_regulatory_info *reg_info)
|
||||
QDF_STATUS reg_regrules_assign(uint8_t dmn_id_2g, uint8_t dmn_id_5g,
|
||||
uint8_t ant_gain_2g, uint8_t ant_gain_5g,
|
||||
struct cur_regulatory_info *reg_info)
|
||||
|
||||
{
|
||||
uint8_t k;
|
||||
|
|
@ -88,8 +90,8 @@ QDF_STATUS reg_regrules_assign(uint8_t dmn_id_2g,
|
|||
}
|
||||
|
||||
QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha2,
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair)
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair)
|
||||
{
|
||||
uint16_t i, j;
|
||||
int num_countries;
|
||||
|
|
@ -100,7 +102,7 @@ QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha2,
|
|||
|
||||
for (i = 0; i < num_countries; i++) {
|
||||
if ((g_all_countries[i].alpha2[0] == alpha2[0]) &&
|
||||
(g_all_countries[i].alpha2[1] == alpha2[1]))
|
||||
(g_all_countries[i].alpha2[1] == alpha2[1]))
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -127,7 +129,7 @@ QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha2,
|
|||
}
|
||||
|
||||
QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id,
|
||||
uint16_t *regdmn_pair)
|
||||
uint16_t *regdmn_pair)
|
||||
{
|
||||
uint16_t j;
|
||||
int num_reg_dmn;
|
||||
|
|
@ -150,8 +152,8 @@ QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id,
|
|||
}
|
||||
|
||||
QDF_STATUS reg_get_rdpair_from_country_code(uint16_t cc,
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair)
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair)
|
||||
{
|
||||
uint16_t i, j;
|
||||
int num_countries;
|
||||
|
|
@ -244,8 +246,8 @@ static inline QDF_STATUS reg_get_reginfo_form_country_code_and_regdmn_pair(
|
|||
ant_gain_2g, ant_gain_5g, reg_info);
|
||||
|
||||
if (err == QDF_STATUS_E_FAILURE) {
|
||||
reg_err("%s : No rule found for country index = %d regdmn_pair = %d\n",
|
||||
__func__, country_index, regdmn_pair);
|
||||
reg_err("%s : No rule found for country index = %d regdmn_pair = %d",
|
||||
__func__, country_index, regdmn_pair);
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -323,21 +325,16 @@ static inline QDF_STATUS reg_get_reginfo_form_regdmn_pair(
|
|||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/* Given a country code the function finds current regulatory information */
|
||||
QDF_STATUS reg_get_cur_reginfo(struct cur_regulatory_info *reg_info,
|
||||
uint16_t country_index,
|
||||
uint16_t regdmn_pair)
|
||||
uint16_t country_index,
|
||||
uint16_t regdmn_pair)
|
||||
{
|
||||
if ((country_index != (uint16_t)(-1)) &&
|
||||
(regdmn_pair != (uint16_t)(-1)))
|
||||
(regdmn_pair != (uint16_t)(-1)))
|
||||
return reg_get_reginfo_form_country_code_and_regdmn_pair(
|
||||
reg_info,
|
||||
country_index,
|
||||
regdmn_pair);
|
||||
reg_info, country_index, regdmn_pair);
|
||||
else if (regdmn_pair != (uint16_t)(-1))
|
||||
return reg_get_reginfo_form_regdmn_pair(
|
||||
reg_info,
|
||||
regdmn_pair);
|
||||
return reg_get_reginfo_form_regdmn_pair(reg_info, regdmn_pair);
|
||||
else
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -22,7 +22,8 @@
|
|||
* This file contains regulatory data base parser function declarations
|
||||
*/
|
||||
|
||||
#include <reg_services_public_struct.h>
|
||||
#ifndef __REG_DB_PARSER_H
|
||||
#define __REG_DB_PARSER_H
|
||||
|
||||
extern const struct country_code_to_reg_domain g_all_countries[];
|
||||
extern const struct reg_domain_pair g_reg_dmn_pairs[];
|
||||
|
|
@ -31,25 +32,71 @@ extern const struct regdomain regdomains_2g[];
|
|||
extern const struct regulatory_rule reg_rules_5g[];
|
||||
extern const struct regdomain regdomains_5g[];
|
||||
|
||||
/**
|
||||
* reg_is_country_code_valid() - Check if the given country code is valid
|
||||
* @alpha2: Country string
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_is_country_code_valid(uint8_t *alpha2);
|
||||
|
||||
QDF_STATUS reg_regrules_assign(uint8_t dmn_id_2g,
|
||||
uint8_t dmn_id_5g,
|
||||
uint8_t ant_gain_2g,
|
||||
uint8_t ant_gain_5g,
|
||||
struct cur_regulatory_info *reg_info);
|
||||
/**
|
||||
* reg_regrules_assign() - Get 2GHz and 5GHz regulatory rules from regdomain
|
||||
* structure.
|
||||
* @dmn_id_2g: 2GHz regdomain ID
|
||||
* @dmn_id_5g: 5GHz regdomain ID
|
||||
* @ant_gain_2g: 2GHz antenna gain
|
||||
* @ant_gain_5g: 5GHz antenna gain
|
||||
* @reg_info: Pointer to current regulatory info structure
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_regrules_assign(uint8_t dmn_id_2g, uint8_t dmn_id_5g,
|
||||
uint8_t ant_gain_2g, uint8_t ant_gain_5g,
|
||||
struct cur_regulatory_info *reg_info);
|
||||
|
||||
/**
|
||||
* reg_get_cur_reginfo() - Get current regulatory info for a given country code
|
||||
* @reg_info: Pointer to current regulatory info structure
|
||||
* @country_index: Country code index in the country code table
|
||||
* @regdmn_pair: Regdomain pair ID
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_get_cur_reginfo(struct cur_regulatory_info *reg_info,
|
||||
uint16_t country_index,
|
||||
uint16_t regdmn_pair);
|
||||
uint16_t country_index, uint16_t regdmn_pair);
|
||||
|
||||
/**
|
||||
* reg_get_rdpair_from_country_iso() - Get regdomain pair ID from country string
|
||||
* @alpha: Pointer to country code string
|
||||
* @country_index: Pointer to save country code index
|
||||
* @regdmn_pair: Pointer to save regdomain pair ID index
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_get_rdpair_from_country_iso(uint8_t *alpha,
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair);
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair);
|
||||
|
||||
/**
|
||||
* reg_get_rdpair_from_country_code() - Get regdomain pair ID from country code
|
||||
* @cc: Country code
|
||||
* @country_index: Pointer to save country code index
|
||||
* @regdmn_pair: Pointer to save regdomain pair ID index
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_get_rdpair_from_country_code(uint16_t cc,
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair);
|
||||
uint16_t *country_index,
|
||||
uint16_t *regdmn_pair);
|
||||
|
||||
/**
|
||||
* reg_get_rdpair_from_regdmn_id() - Get regdomain pair ID from regdomain ID
|
||||
* @regdmn_id: Regdomain ID
|
||||
* @regdmn_pair: Pointer to save regdomain pair ID index
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_get_rdpair_from_regdmn_id(uint16_t regdmn_id,
|
||||
uint16_t *regdmn_pair);
|
||||
uint16_t *regdmn_pair);
|
||||
#endif
|
||||
|
|
|
|||
303
umac/regulatory/core/src/reg_priv_objs.c
Normal file
303
umac/regulatory/core/src/reg_priv_objs.c
Normal file
|
|
@ -0,0 +1,303 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2019 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 copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: reg_priv_objs.c
|
||||
* This file defines the APIs to create regulatory private PSOC and PDEV
|
||||
* objects.
|
||||
*/
|
||||
|
||||
#include <wlan_cmn.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include <wlan_objmgr_pdev_obj.h>
|
||||
#include <qdf_lock.h>
|
||||
#include "reg_priv_objs.h"
|
||||
#include "reg_getset.h"
|
||||
#include "reg_services_common.h"
|
||||
#include "reg_build_chan_list.h"
|
||||
#include "reg_host_11d.h"
|
||||
|
||||
struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj(
|
||||
struct wlan_objmgr_psoc *psoc)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
|
||||
if (!psoc) {
|
||||
reg_alert("psoc is NULL");
|
||||
return NULL;
|
||||
}
|
||||
psoc_priv_obj = wlan_objmgr_psoc_get_comp_private_obj(
|
||||
psoc, WLAN_UMAC_COMP_REGULATORY);
|
||||
|
||||
return psoc_priv_obj;
|
||||
}
|
||||
|
||||
struct wlan_regulatory_pdev_priv_obj *reg_get_pdev_obj(
|
||||
struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_reg;
|
||||
|
||||
if (!pdev) {
|
||||
reg_alert("pdev is NULL");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pdev_reg = wlan_objmgr_pdev_get_comp_private_obj(
|
||||
pdev, WLAN_UMAC_COMP_REGULATORY);
|
||||
|
||||
return pdev_reg;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_regulatory_psoc_obj_created_notification(
|
||||
struct wlan_objmgr_psoc *psoc, void *arg_list)
|
||||
{
|
||||
struct wlan_regulatory_psoc_priv_obj *soc_reg_obj;
|
||||
struct regulatory_channel *mas_chan_list;
|
||||
enum channel_enum chan_enum;
|
||||
QDF_STATUS status;
|
||||
uint8_t i;
|
||||
uint8_t pdev_cnt;
|
||||
|
||||
soc_reg_obj = qdf_mem_malloc(sizeof(*soc_reg_obj));
|
||||
if (!soc_reg_obj) {
|
||||
reg_alert("Mem alloc failed for reg psoc priv obj");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
|
||||
soc_reg_obj->offload_enabled = false;
|
||||
soc_reg_obj->psoc_ptr = psoc;
|
||||
soc_reg_obj->dfs_enabled = true;
|
||||
soc_reg_obj->band_capability = BAND_ALL;
|
||||
soc_reg_obj->enable_11d_supp = false;
|
||||
soc_reg_obj->indoor_chan_enabled = true;
|
||||
soc_reg_obj->force_ssc_disable_indoor_channel = false;
|
||||
soc_reg_obj->master_vdev_cnt = 0;
|
||||
soc_reg_obj->vdev_cnt_11d = 0;
|
||||
soc_reg_obj->restart_beaconing = CH_AVOID_RULE_RESTART;
|
||||
soc_reg_obj->enable_srd_chan_in_master_mode = false;
|
||||
soc_reg_obj->enable_11d_in_world_mode = false;
|
||||
soc_reg_obj->def_pdev_id = -1;
|
||||
|
||||
for (i = 0; i < MAX_STA_VDEV_CNT; i++)
|
||||
soc_reg_obj->vdev_ids_11d[i] = INVALID_VDEV_ID;
|
||||
|
||||
qdf_spinlock_create(&soc_reg_obj->cbk_list_lock);
|
||||
|
||||
for (pdev_cnt = 0; pdev_cnt < PSOC_MAX_PHY_REG_CAP; pdev_cnt++) {
|
||||
mas_chan_list =
|
||||
soc_reg_obj->mas_chan_params[pdev_cnt].mas_chan_list;
|
||||
|
||||
for (chan_enum = 0; chan_enum < NUM_CHANNELS; chan_enum++) {
|
||||
mas_chan_list[chan_enum].chan_flags |=
|
||||
REGULATORY_CHAN_DISABLED;
|
||||
mas_chan_list[chan_enum].state = CHANNEL_STATE_DISABLE;
|
||||
mas_chan_list[chan_enum].nol_chan = false;
|
||||
}
|
||||
}
|
||||
|
||||
status = wlan_objmgr_psoc_component_obj_attach(
|
||||
psoc, WLAN_UMAC_COMP_REGULATORY, soc_reg_obj,
|
||||
QDF_STATUS_SUCCESS);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
qdf_spinlock_destroy(&soc_reg_obj->cbk_list_lock);
|
||||
qdf_mem_free(soc_reg_obj);
|
||||
reg_err("Obj attach failed");
|
||||
return status;
|
||||
}
|
||||
|
||||
reg_debug("reg psoc obj created with status %d", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification(
|
||||
struct wlan_objmgr_psoc *psoc, void *arg_list)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
|
||||
psoc_priv_obj = reg_get_psoc_obj(psoc);
|
||||
if (!psoc_priv_obj) {
|
||||
reg_err("reg psoc private obj is NULL");
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
psoc_priv_obj->psoc_ptr = NULL;
|
||||
qdf_spinlock_destroy(&psoc_priv_obj->cbk_list_lock);
|
||||
|
||||
status = wlan_objmgr_psoc_component_obj_detach(
|
||||
psoc, WLAN_UMAC_COMP_REGULATORY, psoc_priv_obj);
|
||||
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
reg_err("psoc_priv_obj private obj detach failed");
|
||||
|
||||
reg_debug("reg psoc obj detached with status %d", status);
|
||||
|
||||
qdf_mem_free(psoc_priv_obj);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
|
||||
struct wlan_objmgr_pdev *pdev, void *arg_list)
|
||||
{
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap_ptr;
|
||||
struct wlan_objmgr_psoc *parent_psoc;
|
||||
uint32_t pdev_id;
|
||||
uint32_t cnt;
|
||||
uint32_t range_2g_low, range_2g_high;
|
||||
uint32_t range_5g_low, range_5g_high;
|
||||
QDF_STATUS status;
|
||||
struct reg_rule_info *psoc_reg_rules;
|
||||
|
||||
pdev_priv_obj = qdf_mem_malloc(sizeof(*pdev_priv_obj));
|
||||
if (!pdev_priv_obj) {
|
||||
reg_alert("Mem alloc failed for pdev priv obj");
|
||||
return QDF_STATUS_E_NOMEM;
|
||||
}
|
||||
|
||||
parent_psoc = wlan_pdev_get_psoc(pdev);
|
||||
pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
|
||||
|
||||
psoc_priv_obj = reg_get_psoc_obj(parent_psoc);
|
||||
if (!psoc_priv_obj) {
|
||||
reg_err("reg psoc private obj is NULL");
|
||||
qdf_mem_free(pdev_priv_obj);
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
if (psoc_priv_obj->def_pdev_id == -1)
|
||||
psoc_priv_obj->def_pdev_id = pdev_id;
|
||||
else
|
||||
reg_err("reg cannot handle more than one pdev");
|
||||
|
||||
pdev_priv_obj->pdev_ptr = pdev;
|
||||
pdev_priv_obj->dfs_enabled = psoc_priv_obj->dfs_enabled;
|
||||
pdev_priv_obj->set_fcc_channel = false;
|
||||
pdev_priv_obj->band_capability = psoc_priv_obj->band_capability;
|
||||
pdev_priv_obj->indoor_chan_enabled =
|
||||
psoc_priv_obj->indoor_chan_enabled;
|
||||
pdev_priv_obj->en_chan_144 = true;
|
||||
|
||||
qdf_spinlock_create(&pdev_priv_obj->reg_rules_lock);
|
||||
|
||||
reg_cap_ptr = psoc_priv_obj->reg_cap;
|
||||
pdev_priv_obj->force_ssc_disable_indoor_channel =
|
||||
psoc_priv_obj->force_ssc_disable_indoor_channel;
|
||||
|
||||
for (cnt = 0; cnt < PSOC_MAX_PHY_REG_CAP; cnt++) {
|
||||
if (!reg_cap_ptr) {
|
||||
qdf_mem_free(pdev_priv_obj);
|
||||
reg_err("reg cap ptr is NULL");
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
if (reg_cap_ptr->phy_id == pdev_id)
|
||||
break;
|
||||
reg_cap_ptr++;
|
||||
}
|
||||
|
||||
if (cnt == PSOC_MAX_PHY_REG_CAP) {
|
||||
qdf_mem_free(pdev_priv_obj);
|
||||
reg_err("extended capabilities not found for pdev");
|
||||
return QDF_STATUS_E_FAULT;
|
||||
}
|
||||
|
||||
range_2g_low = reg_cap_ptr->low_2ghz_chan;
|
||||
range_2g_high = reg_cap_ptr->high_2ghz_chan;
|
||||
range_5g_low = reg_cap_ptr->low_5ghz_chan;
|
||||
range_5g_high = reg_cap_ptr->high_5ghz_chan;
|
||||
|
||||
pdev_priv_obj->range_2g_low = range_2g_low;
|
||||
pdev_priv_obj->range_2g_high = range_2g_high;
|
||||
pdev_priv_obj->range_5g_low = range_5g_low;
|
||||
pdev_priv_obj->range_5g_high = range_5g_high;
|
||||
pdev_priv_obj->wireless_modes = reg_cap_ptr->wireless_modes;
|
||||
|
||||
reg_init_pdev_mas_chan_list(pdev_priv_obj,
|
||||
&psoc_priv_obj->mas_chan_params[pdev_id]);
|
||||
|
||||
reg_compute_pdev_current_chan_list(pdev_priv_obj);
|
||||
|
||||
psoc_reg_rules = &psoc_priv_obj->mas_chan_params[pdev_id].reg_rules;
|
||||
reg_save_reg_rules_to_pdev(psoc_reg_rules, pdev_priv_obj);
|
||||
|
||||
reg_reset_reg_rules(psoc_reg_rules);
|
||||
|
||||
status = wlan_objmgr_pdev_component_obj_attach(
|
||||
pdev, WLAN_UMAC_COMP_REGULATORY, pdev_priv_obj,
|
||||
QDF_STATUS_SUCCESS);
|
||||
if (QDF_IS_STATUS_ERROR(status)) {
|
||||
reg_err("Obj attach failed");
|
||||
qdf_mem_free(pdev_priv_obj);
|
||||
return status;
|
||||
}
|
||||
if (!psoc_priv_obj->is_11d_offloaded)
|
||||
reg_11d_host_scan_init(parent_psoc);
|
||||
|
||||
reg_debug("reg pdev obj created with status %d", status);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
QDF_STATUS wlan_regulatory_pdev_obj_destroyed_notification(
|
||||
struct wlan_objmgr_pdev *pdev, void *arg_list)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
|
||||
struct wlan_regulatory_psoc_priv_obj *psoc_priv_obj;
|
||||
|
||||
pdev_priv_obj = reg_get_pdev_obj(pdev);
|
||||
|
||||
if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
|
||||
reg_err("reg pdev private obj is NULL");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
psoc_priv_obj = reg_get_psoc_obj(wlan_pdev_get_psoc(pdev));
|
||||
if (!IS_VALID_PSOC_REG_OBJ(psoc_priv_obj)) {
|
||||
reg_err("reg psoc private obj is NULL");
|
||||
return QDF_STATUS_E_FAILURE;
|
||||
}
|
||||
|
||||
if (!psoc_priv_obj->is_11d_offloaded)
|
||||
reg_11d_host_scan_deinit(wlan_pdev_get_psoc(pdev));
|
||||
|
||||
pdev_priv_obj->pdev_ptr = NULL;
|
||||
|
||||
status = wlan_objmgr_pdev_component_obj_detach(
|
||||
pdev, WLAN_UMAC_COMP_REGULATORY, pdev_priv_obj);
|
||||
|
||||
if (status != QDF_STATUS_SUCCESS)
|
||||
reg_err("reg pdev private obj detach failed");
|
||||
|
||||
reg_debug("reg pdev obj deleted with status %d", status);
|
||||
|
||||
qdf_spin_lock_bh(&pdev_priv_obj->reg_rules_lock);
|
||||
reg_reset_reg_rules(&pdev_priv_obj->reg_rules);
|
||||
qdf_spin_unlock_bh(&pdev_priv_obj->reg_rules_lock);
|
||||
|
||||
qdf_spinlock_destroy(&pdev_priv_obj->reg_rules_lock);
|
||||
|
||||
qdf_mem_free(pdev_priv_obj);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -18,18 +18,12 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* DOC: reg_priv.h
|
||||
* DOC: reg_priv_objs.h
|
||||
* This file contains regulatory component private data structures.
|
||||
*/
|
||||
|
||||
#ifndef __REG_PRIV_H
|
||||
#define __REG_PRIV_H
|
||||
|
||||
#include "reg_db.h"
|
||||
#include "reg_services.h"
|
||||
#ifdef HOST_11D_SCAN
|
||||
#include <qdf_mc_timer.h>
|
||||
#endif
|
||||
#ifndef __REG_PRIV_OBJS_H
|
||||
#define __REG_PRIV_OBJS_H
|
||||
|
||||
#define reg_alert(params...) \
|
||||
QDF_TRACE_FATAL(QDF_MODULE_ID_REGULATORY, params)
|
||||
|
|
@ -57,6 +51,31 @@
|
|||
#define reg_nofl_debug(params...) \
|
||||
QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_REGULATORY, params)
|
||||
|
||||
/**
|
||||
* typedef reg_chan_change_callback() - Regulatory channel change callback
|
||||
* @psoc: Pointer to psoc
|
||||
* @pdev: Pointer to pdev
|
||||
* @chan_list: Pointer to regulatory channel list
|
||||
* @avoid_freq_ind: Pointer to avoid frequencies
|
||||
* @arg: list of arguments
|
||||
*/
|
||||
typedef void (*reg_chan_change_callback)(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_objmgr_pdev *pdev,
|
||||
struct regulatory_channel *chan_list,
|
||||
struct avoid_freq_ind_data *avoid_freq_ind,
|
||||
void *arg);
|
||||
|
||||
/**
|
||||
* struct chan_change_cbk_entry - Channel change callback entry
|
||||
* @cbk: Callback
|
||||
* @arg: Arguments
|
||||
*/
|
||||
struct chan_change_cbk_entry {
|
||||
reg_chan_change_callback cbk;
|
||||
void *arg;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wlan_regulatory_psoc_priv_obj - wlan regulatory psoc private object
|
||||
* @new_user_ctry_pending: In this array, element[phy_id] is true if any user
|
||||
|
|
@ -151,4 +170,73 @@ struct wlan_regulatory_pdev_priv_obj {
|
|||
qdf_spinlock_t reg_rules_lock;
|
||||
};
|
||||
|
||||
/**
|
||||
* reg_get_psoc_obj() - Provides the reg component object pointer
|
||||
* @psoc: pointer to psoc object.
|
||||
*
|
||||
* Return: reg component object pointer
|
||||
*/
|
||||
struct wlan_regulatory_psoc_priv_obj *reg_get_psoc_obj(
|
||||
struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* reg_get_pdev_obj() - Provides the reg component object pointer
|
||||
* @psoc: pointer to psoc object.
|
||||
*
|
||||
* Return: reg component object pointer
|
||||
*/
|
||||
struct wlan_regulatory_pdev_priv_obj *reg_get_pdev_obj(
|
||||
struct wlan_objmgr_pdev *pdev);
|
||||
|
||||
/**
|
||||
* wlan_regulatory_psoc_obj_created_notification() - PSOC obj create callback
|
||||
* @psoc: PSOC object
|
||||
* @arg_list: Variable argument list
|
||||
*
|
||||
* This callback is registered with object manager during initialization to
|
||||
* get notified when the object is created.
|
||||
*
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS wlan_regulatory_psoc_obj_created_notification(
|
||||
struct wlan_objmgr_psoc *psoc, void *arg_list);
|
||||
|
||||
/**
|
||||
* wlan_regulatory_psoc_obj_destroyed_notification() - PSOC obj delete callback
|
||||
* @psoc: PSOC object
|
||||
* @arg_list: Variable argument list
|
||||
*
|
||||
* This callback is registered with object manager during initialization to
|
||||
* get notified when the object is deleted.
|
||||
*
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification(
|
||||
struct wlan_objmgr_psoc *psoc, void *arg_list);
|
||||
|
||||
/**
|
||||
* wlan_regulatory_pdev_obj_created_notification() - PDEV obj create callback
|
||||
* @pdev: pdev object
|
||||
* @arg_list: Variable argument list
|
||||
*
|
||||
* This callback is registered with object manager during initialization to
|
||||
* get notified when the pdev object is created.
|
||||
*
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS wlan_regulatory_pdev_obj_created_notification(
|
||||
struct wlan_objmgr_pdev *pdev, void *arg_list);
|
||||
|
||||
/**
|
||||
* wlan_regulatory_pdev_obj_destroyed_notification() - PDEV obj destroy callback
|
||||
* @pdev: pdev object
|
||||
* @arg_list: Variable argument list
|
||||
*
|
||||
* This callback is registered with object manager during initialization to
|
||||
* get notified when the pdev object is destroyed.
|
||||
*
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS wlan_regulatory_pdev_obj_destroyed_notification(
|
||||
struct wlan_objmgr_pdev *pdev, void *arg_list);
|
||||
#endif
|
||||
1958
umac/regulatory/core/src/reg_services_common.c
Normal file
1958
umac/regulatory/core/src/reg_services_common.c
Normal file
File diff suppressed because it is too large
Load diff
500
umac/regulatory/core/src/reg_services_common.h
Normal file
500
umac/regulatory/core/src/reg_services_common.h
Normal file
|
|
@ -0,0 +1,500 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2019 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 copyright notice and this permission notice appear in all
|
||||
* copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* DOC: reg_services.h
|
||||
* This file provides prototypes of the regulatory component
|
||||
* service functions
|
||||
*/
|
||||
|
||||
#ifndef __REG_SERVICES_COMMON_H_
|
||||
#define __REG_SERVICES_COMMON_H_
|
||||
|
||||
#define IS_VALID_PSOC_REG_OBJ(psoc_priv_obj) (psoc_priv_obj)
|
||||
#define IS_VALID_PDEV_REG_OBJ(pdev_priv_obj) (pdev_priv_obj)
|
||||
|
||||
#define REG_MIN_24GHZ_CH_NUM channel_map[MIN_24GHZ_CHANNEL].chan_num
|
||||
#define REG_MAX_24GHZ_CH_NUM channel_map[MAX_24GHZ_CHANNEL].chan_num
|
||||
#define REG_MIN_5GHZ_CH_NUM channel_map[MIN_5GHZ_CHANNEL].chan_num
|
||||
#define REG_MAX_5GHZ_CH_NUM channel_map[MAX_5GHZ_CHANNEL].chan_num
|
||||
|
||||
#define REG_IS_24GHZ_CH(chan_num) \
|
||||
(((chan_num) >= REG_MIN_24GHZ_CH_NUM) && \
|
||||
((chan_num) <= REG_MAX_24GHZ_CH_NUM))
|
||||
|
||||
#define REG_MIN_24GHZ_CH_FREQ channel_map[MIN_24GHZ_CHANNEL].center_freq
|
||||
#define REG_MAX_24GHZ_CH_FREQ channel_map[MAX_24GHZ_CHANNEL].center_freq
|
||||
|
||||
#define REG_IS_24GHZ_CH_FREQ(freq) \
|
||||
(((freq) >= REG_MIN_24GHZ_CH_FREQ) && \
|
||||
((freq) <= REG_MAX_24GHZ_CH_FREQ))
|
||||
|
||||
#ifndef CONFIG_LEGACY_CHAN_ENUM
|
||||
#define REG_MIN_49GHZ_CH_FREQ channel_map[MIN_49GHZ_CHANNEL].center_freq
|
||||
#define REG_MAX_49GHZ_CH_FREQ channel_map[MAX_49GHZ_CHANNEL].center_freq
|
||||
|
||||
#define REG_IS_49GHZ_FREQ(freq) \
|
||||
(((freq) >= REG_MIN_49GHZ_CH_FREQ) && \
|
||||
((freq) <= REG_MAX_49GHZ_CH_FREQ))
|
||||
#endif
|
||||
|
||||
#define REG_IS_5GHZ_CH(chan_num) \
|
||||
(((chan_num) >= REG_MIN_5GHZ_CH_NUM) && \
|
||||
((chan_num) <= REG_MAX_5GHZ_CH_NUM))
|
||||
|
||||
#define REG_IS_5GHZ_FREQ(freq) \
|
||||
(((freq) >= channel_map[MIN_5GHZ_CHANNEL].center_freq) && \
|
||||
((freq) <= channel_map[MAX_5GHZ_CHANNEL].center_freq))
|
||||
|
||||
#define REG_CH_NUM(ch_enum) channel_map[ch_enum].chan_num
|
||||
#define REG_CH_TO_FREQ(ch_enum) channel_map[ch_enum].center_freq
|
||||
|
||||
/* EEPROM setting is a country code */
|
||||
#define COUNTRY_ERD_FLAG 0x8000
|
||||
|
||||
extern const struct chan_map *channel_map;
|
||||
|
||||
/**
|
||||
* reg_get_chan_enum() - Get channel enum for given channel number
|
||||
* @chan_num: Channel number
|
||||
*
|
||||
* Return: Channel enum
|
||||
*/
|
||||
enum channel_enum reg_get_chan_enum(uint32_t chan_num);
|
||||
|
||||
/**
|
||||
* reg_get_channel_list_with_power() - Provides the channel list with power
|
||||
* @pdev: Pointer to pdev
|
||||
* @ch_list: Pointer to the channel list.
|
||||
* @num_chan: Pointer to save number of channels
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev,
|
||||
struct channel_power *ch_list,
|
||||
uint8_t *num_chan);
|
||||
|
||||
/**
|
||||
* reg_get_channel_state() - Get channel state from regulatory
|
||||
* @pdev: Pointer to pdev
|
||||
* @ch: channel number.
|
||||
*
|
||||
* Return: channel state
|
||||
*/
|
||||
enum channel_state reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t ch);
|
||||
|
||||
/**
|
||||
* reg_get_5g_bonded_channel_state() - Get channel state for 5G bonded channel
|
||||
* @pdev: Pointer to pdev
|
||||
* @ch: channel number.
|
||||
* @bw: channel band width
|
||||
*
|
||||
* Return: channel state
|
||||
*/
|
||||
enum channel_state reg_get_5g_bonded_channel_state(
|
||||
struct wlan_objmgr_pdev *pdev, uint8_t ch,
|
||||
enum phy_ch_width bw);
|
||||
|
||||
/**
|
||||
* reg_get_2g_bonded_channel_state() - Get channel state for 2G bonded channel
|
||||
* @ch: channel number.
|
||||
* @pdev: Pointer to pdev
|
||||
* @oper_ch: Primary channel number
|
||||
* @sec_ch: Secondary channel number
|
||||
* @bw: channel band width
|
||||
*
|
||||
* Return: channel state
|
||||
*/
|
||||
enum channel_state reg_get_2g_bonded_channel_state(
|
||||
struct wlan_objmgr_pdev *pdev, uint8_t oper_ch, uint8_t sec_ch,
|
||||
enum phy_ch_width bw);
|
||||
|
||||
/**
|
||||
* reg_set_channel_params () - Sets channel parameteres for given bandwidth
|
||||
* @pdev: Pointer to pdev
|
||||
* @ch: channel number.
|
||||
* @sec_ch_2g: Secondary 2G channel
|
||||
* @ch_params: pointer to the channel parameters.
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void reg_set_channel_params(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t ch, uint8_t sec_ch_2g,
|
||||
struct ch_params *ch_params);
|
||||
|
||||
/**
|
||||
* reg_read_default_country() - Get the default regulatory country
|
||||
* @psoc: The physical SoC to get default country from
|
||||
* @country_code: the buffer to populate the country code into
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_read_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country_code);
|
||||
|
||||
/**
|
||||
* reg_get_current_dfs_region () - Get the current dfs region
|
||||
* @pdev: Pointer to pdev
|
||||
* @dfs_reg: pointer to dfs region
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void reg_get_current_dfs_region(struct wlan_objmgr_pdev *pdev,
|
||||
enum dfs_reg *dfs_reg);
|
||||
|
||||
/**
|
||||
* reg_get_channel_reg_power() - Get the txpower for the given channel
|
||||
* @pdev: Pointer to pdev
|
||||
* @chan_num: Channel number
|
||||
*
|
||||
* Return: txpower
|
||||
*/
|
||||
uint32_t reg_get_channel_reg_power(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_num);
|
||||
|
||||
/**
|
||||
* reg_get_channel_freq() - Get the channel frequency
|
||||
* @pdev: Pointer to pdev
|
||||
* @chan_num: Channel number
|
||||
*
|
||||
* Return: frequency
|
||||
*/
|
||||
uint32_t reg_get_channel_freq(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_num);
|
||||
|
||||
/**
|
||||
* reg_get_bw_value() - give bandwidth value
|
||||
* bw: bandwidth enum
|
||||
*
|
||||
* Return: uint16_t
|
||||
*/
|
||||
uint16_t reg_get_bw_value(enum phy_ch_width bw);
|
||||
|
||||
/**
|
||||
* reg_set_dfs_region () - Set the current dfs region
|
||||
* @pdev: Pointer to pdev
|
||||
* @dfs_reg: pointer to dfs region
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void reg_set_dfs_region(struct wlan_objmgr_pdev *pdev,
|
||||
enum dfs_reg dfs_reg);
|
||||
|
||||
/**
|
||||
* reg_chan_to_band() - Get band from channel number
|
||||
* @chan_num: channel number
|
||||
*
|
||||
* Return: band info
|
||||
*/
|
||||
enum band_info reg_chan_to_band(uint32_t chan_num);
|
||||
|
||||
/**
|
||||
* reg_program_chan_list() - Set user country code and populate the channel list
|
||||
* @pdev: Pointer to pdev
|
||||
* @rd: Pointer to cc_regdmn_s structure
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_program_chan_list(struct wlan_objmgr_pdev *pdev,
|
||||
struct cc_regdmn_s *rd);
|
||||
|
||||
/**
|
||||
* reg_update_nol_ch () - Updates NOL channels in current channel list
|
||||
* @pdev: pointer to pdev object
|
||||
* @ch_list: pointer to NOL channel list
|
||||
* @num_ch: No.of channels in list
|
||||
* @update_nol: set/reset the NOL status
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void reg_update_nol_ch(struct wlan_objmgr_pdev *pdev, uint8_t *chan_list,
|
||||
uint8_t num_chan, bool nol_chan);
|
||||
|
||||
/**
|
||||
* reg_is_dfs_ch () - Checks the channel state for DFS
|
||||
* @pdev: pdev ptr
|
||||
* @chan: channel
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan);
|
||||
|
||||
/**
|
||||
* reg_freq_to_chan() - Get channel number from frequency.
|
||||
* @pdev: Pointer to pdev
|
||||
* @freq: Channel frequency
|
||||
*
|
||||
* Return: Channel number
|
||||
*/
|
||||
uint32_t reg_freq_to_chan(struct wlan_objmgr_pdev *pdev, uint32_t freq);
|
||||
|
||||
/**
|
||||
* reg_chan_to_freq() - Get frequency from channel number
|
||||
* @pdev: Pointer to pdev
|
||||
* @chan_num: Channel number
|
||||
*
|
||||
* Return: Channel frequency
|
||||
*/
|
||||
uint32_t reg_chan_to_freq(struct wlan_objmgr_pdev *pdev, uint32_t chan_num);
|
||||
|
||||
/**
|
||||
* reg_chan_is_49ghz() - Check if the input channel number is 4.9GHz
|
||||
* @pdev: Pdev pointer
|
||||
* @chan_num: Input channel number
|
||||
*
|
||||
* Return: true if the channel is 4.9GHz else false.
|
||||
*/
|
||||
bool reg_chan_is_49ghz(struct wlan_objmgr_pdev *pdev, uint8_t chan_num);
|
||||
|
||||
/**
|
||||
* reg_program_default_cc() - Program default country code
|
||||
* @pdev: Pdev pointer
|
||||
* @regdmn: Regdomain value
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_program_default_cc(struct wlan_objmgr_pdev *pdev,
|
||||
uint16_t regdmn);
|
||||
|
||||
/**
|
||||
* reg_get_current_cc() - Get current country code
|
||||
* @pdev: Pdev pointer
|
||||
* @regdmn: Pointer to get current country values
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_get_current_cc(struct wlan_objmgr_pdev *pdev,
|
||||
struct cc_regdmn_s *rd);
|
||||
|
||||
/**
|
||||
* reg_get_curr_band() - Get current band
|
||||
* @pdev: Pdev pointer
|
||||
* @band: Pointer to save the current band
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS reg_get_curr_band(struct wlan_objmgr_pdev *pdev,
|
||||
enum band_info *band);
|
||||
|
||||
/**
|
||||
* reg_set_regdb_offloaded() - set/clear regulatory offloaded flag
|
||||
*
|
||||
* @psoc: psoc pointer
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS reg_set_regdb_offloaded(struct wlan_objmgr_psoc *psoc, bool val);
|
||||
|
||||
/**
|
||||
* reg_get_curr_regdomain() - Get current regdomain in use
|
||||
* @pdev: pdev pointer
|
||||
* @cur_regdmn: Current regdomain info
|
||||
*
|
||||
* Return: QDF status
|
||||
*/
|
||||
QDF_STATUS reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
|
||||
struct cur_regdmn_info *cur_regdmn);
|
||||
|
||||
/**
|
||||
* reg_modify_chan_144() - Enable/Disable channel 144
|
||||
* @pdev: pdev pointer
|
||||
* @en_chan_144: flag to disable/enable channel 144
|
||||
*
|
||||
* Return: Success or Failure
|
||||
*/
|
||||
QDF_STATUS reg_modify_chan_144(struct wlan_objmgr_pdev *pdev, bool en_chan_144);
|
||||
|
||||
/**
|
||||
* reg_get_en_chan_144() - get en_chan_144 flag value
|
||||
* @pdev: pdev pointer
|
||||
*
|
||||
* Return: en_chan_144 flag value
|
||||
*/
|
||||
bool reg_get_en_chan_144(struct wlan_objmgr_pdev *pdev);
|
||||
|
||||
/**
|
||||
* reg_get_hal_reg_cap() - Get HAL REG capabilities
|
||||
* @psoc: psoc for country information
|
||||
*
|
||||
* Return: hal reg cap pointer
|
||||
*/
|
||||
struct wlan_psoc_host_hal_reg_capabilities_ext *reg_get_hal_reg_cap(
|
||||
struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* reg_set_hal_reg_cap() - Set HAL REG capabilities
|
||||
* @psoc: psoc for country information
|
||||
* @reg_cap: Regulatory caps pointer
|
||||
* @phy_cnt: number of phy
|
||||
*
|
||||
* Return: hal reg cap pointer
|
||||
*/
|
||||
QDF_STATUS reg_set_hal_reg_cap(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
struct wlan_psoc_host_hal_reg_capabilities_ext *reg_cap,
|
||||
uint16_t phy_cnt);
|
||||
|
||||
/**
|
||||
* reg_chan_in_range() - Check if the given channel is in pdev's channel range
|
||||
* @chan_list: Pointer to regulatory channel list.
|
||||
* @low_freq_2g: Low frequency 2G.
|
||||
* @high_freq_2g: High frequency 2G.
|
||||
* @low_freq_5g: Low frequency 5G.
|
||||
* @high_freq_5g: High frequency 5G.
|
||||
* @ch_enum: Channel enum.
|
||||
*
|
||||
* Return: true if ch_enum is with in pdev's channel range, else false.
|
||||
*/
|
||||
bool reg_chan_in_range(struct regulatory_channel *chan_list,
|
||||
uint32_t low_freq_2g, uint32_t high_freq_2g,
|
||||
uint32_t low_freq_5g, uint32_t high_freq_5g,
|
||||
enum channel_enum ch_enum);
|
||||
|
||||
/**
|
||||
* reg_init_channel_map() - Initialize the channel list based on the dfs region.
|
||||
* @dfs_region: Dfs region
|
||||
*/
|
||||
void reg_init_channel_map(enum dfs_reg dfs_region);
|
||||
|
||||
/**
|
||||
* reg_get_psoc_tx_ops() - Get regdb tx ops
|
||||
* @psoc: Pointer to psoc structure
|
||||
*/
|
||||
struct wlan_lmac_if_reg_tx_ops *reg_get_psoc_tx_ops(
|
||||
struct wlan_objmgr_psoc *psoc);
|
||||
|
||||
/**
|
||||
* reg_update_nol_history_ch() - Set nol-history flag for the channels in the
|
||||
* list.
|
||||
* @pdev: Pdev ptr.
|
||||
* @ch_list: Input channel list.
|
||||
* @num_ch: Number of channels.
|
||||
* @nol_history_ch: NOL-History flag.
|
||||
*
|
||||
* Return: void
|
||||
*/
|
||||
void reg_update_nol_history_ch(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t *chan_list,
|
||||
uint8_t num_chan,
|
||||
bool nol_history_chan);
|
||||
|
||||
/**
|
||||
* reg_is_24ghz_ch() - Check if the given channel number is 2.4GHz
|
||||
* @chan: Channel number
|
||||
*
|
||||
* Return: true if channel number is 2.4GHz, else false
|
||||
*/
|
||||
bool reg_is_24ghz_ch(uint32_t chan);
|
||||
|
||||
/**
|
||||
* reg_is_5ghz_ch() - Check if the given channel number is 5GHz
|
||||
* @chan: Channel number
|
||||
*
|
||||
* Return: true if channel number is 5GHz, else false
|
||||
*/
|
||||
bool reg_is_5ghz_ch(uint32_t chan);
|
||||
|
||||
/**
|
||||
* reg_is_24ghz_ch_freq() - Check if the given channel frequency is 2.4GHz
|
||||
* @freq: Channel frequency
|
||||
*
|
||||
* Return: true if channel frequency is 2.4GHz, else false
|
||||
*/
|
||||
bool reg_is_24ghz_ch_freq(uint32_t freq);
|
||||
|
||||
/**
|
||||
* reg_is_5ghz_ch_freq() - Check if the given channel frequency is 5GHz
|
||||
* @freq: Channel frequency
|
||||
*
|
||||
* Return: true if channel frequency is 5GHz, else false
|
||||
*/
|
||||
bool reg_is_5ghz_ch_freq(uint32_t chan);
|
||||
|
||||
#ifndef CONFIG_LEGACY_CHAN_ENUM
|
||||
/**
|
||||
* reg_is_49ghz_freq() - Check if the given channel frequency is 4.9GHz
|
||||
* @freq: Channel frequency
|
||||
*
|
||||
* Return: true if channel frequency is 4.9GHz, else false
|
||||
*/
|
||||
bool reg_is_49ghz_freq(uint32_t freq);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* reg_ch_num() - Get channel number from channel enum
|
||||
* @ch_enum: Channel enum
|
||||
*
|
||||
* Return: channel number
|
||||
*/
|
||||
uint32_t reg_ch_num(uint32_t ch_enum);
|
||||
|
||||
/**
|
||||
* reg_ch_to_freq() - Get channel frequency from channel enum
|
||||
* @ch_enum: Channel enum
|
||||
*
|
||||
* Return: channel frequency
|
||||
*/
|
||||
uint32_t reg_ch_to_freq(uint32_t ch_enum);
|
||||
|
||||
/**
|
||||
* reg_is_same_band_channels() - Check if given channel numbers have same band
|
||||
* @chan_num1: Channel number1
|
||||
* @chan_num2: Channel number2
|
||||
*
|
||||
* Return: true if both the channels has the same band.
|
||||
*/
|
||||
bool reg_is_same_band_channels(uint32_t chan_num1, uint32_t chan_num2);
|
||||
|
||||
/**
|
||||
* reg_is_channel_valid_5g_sbs() Check if the given channel is 5G SBS.
|
||||
* @curchan: current channel
|
||||
* @newchan:new channel
|
||||
*
|
||||
* Return: true if the given channel is a valid 5G SBS
|
||||
*/
|
||||
bool reg_is_channel_valid_5g_sbs(uint32_t curchan, uint32_t newchan);
|
||||
|
||||
/**
|
||||
* reg_min_24ghz_ch_num() - Get minimum 2.4GHz channel number
|
||||
*
|
||||
* Return: Minimum 2.4GHz channel number
|
||||
*/
|
||||
uint32_t reg_min_24ghz_ch_num(void);
|
||||
|
||||
/**
|
||||
* reg_max_24ghz_ch_num() - Get maximum 2.4GHz channel number
|
||||
*
|
||||
* Return: Maximum 2.4GHz channel number
|
||||
*/
|
||||
uint32_t reg_max_24ghz_ch_num(void);
|
||||
|
||||
/**
|
||||
* reg_min_5ghz_ch_num() - Get minimum 5GHz channel number
|
||||
*
|
||||
* Return: Minimum 5GHz channel number
|
||||
*/
|
||||
uint32_t reg_min_5ghz_ch_num(void);
|
||||
|
||||
/**
|
||||
* reg_max_5ghz_ch_num() - Get maximum 5GHz channel number
|
||||
*
|
||||
* Return: Maximum 5GHz channel number
|
||||
*/
|
||||
uint32_t reg_max_5ghz_ch_num(void);
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 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
|
||||
|
|
@ -24,9 +24,6 @@
|
|||
#ifndef __REG_SERVICES_PUBLIC_STRUCT_H_
|
||||
#define __REG_SERVICES_PUBLIC_STRUCT_H_
|
||||
|
||||
#include "../../core/src/reg_db.h"
|
||||
#include "wlan_cmn.h"
|
||||
|
||||
#define REG_SBS_SEPARATION_THRESHOLD 100
|
||||
#define REG_MAX_CHANNELS_PER_OPERATING_CLASS 25
|
||||
#define REG_MAX_SUPP_OPER_CLASSES 32
|
||||
|
|
@ -35,6 +32,47 @@
|
|||
#define INVALID_VDEV_ID 0xFF
|
||||
#define INVALID_CHANNEL_NUM 0xBAD
|
||||
#define CH_AVOID_MAX_RANGE 4
|
||||
#define REG_ALPHA2_LEN 2
|
||||
#define MAX_REG_RULES 10
|
||||
|
||||
#define REGULATORY_CHAN_DISABLED BIT(0)
|
||||
#define REGULATORY_CHAN_NO_IR BIT(1)
|
||||
#define REGULATORY_CHAN_RADAR BIT(3)
|
||||
#define REGULATORY_CHAN_NO_OFDM BIT(6)
|
||||
#define REGULATORY_CHAN_INDOOR_ONLY BIT(9)
|
||||
|
||||
#define REGULATORY_CHAN_NO_HT40 BIT(4)
|
||||
#define REGULATORY_CHAN_NO_80MHZ BIT(7)
|
||||
#define REGULATORY_CHAN_NO_160MHZ BIT(8)
|
||||
#define REGULATORY_CHAN_NO_20MHZ BIT(11)
|
||||
#define REGULATORY_CHAN_NO_10MHZ BIT(12)
|
||||
|
||||
#define REGULATORY_PHYMODE_NO11A BIT(0)
|
||||
#define REGULATORY_PHYMODE_NO11B BIT(1)
|
||||
#define REGULATORY_PHYMODE_NO11G BIT(2)
|
||||
#define REGULATORY_CHAN_NO11N BIT(3)
|
||||
#define REGULATORY_PHYMODE_NO11AC BIT(4)
|
||||
#define REGULATORY_PHYMODE_NO11AX BIT(5)
|
||||
|
||||
/**
|
||||
* enum dfs_reg - DFS region
|
||||
* @DFS_UNINIT_REGION: un-initialized region
|
||||
* @DFS_FCC_REGION: FCC region
|
||||
* @DFS_ETSI_REGION: ETSI region
|
||||
* @DFS_MKK_REGION: MKK region
|
||||
* @DFS_CN_REGION: China region
|
||||
* @DFS_KR_REGION: Korea region
|
||||
* @DFS_UNDEF_REGION: Undefined region
|
||||
*/
|
||||
enum dfs_reg {
|
||||
DFS_UNINIT_REGION = 0,
|
||||
DFS_FCC_REGION = 1,
|
||||
DFS_ETSI_REGION = 2,
|
||||
DFS_MKK_REGION = 3,
|
||||
DFS_CN_REGION = 4,
|
||||
DFS_KR_REGION = 5,
|
||||
DFS_UNDEF_REGION = 0xFFFF,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_LEGACY_CHAN_ENUM
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 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
|
||||
|
|
@ -26,46 +26,137 @@
|
|||
#ifndef __WLAN_REG_SERVICES_API_H
|
||||
#define __WLAN_REG_SERVICES_API_H
|
||||
|
||||
#include "../../core/src/reg_services.h"
|
||||
#include <reg_services_public_struct.h>
|
||||
/**
|
||||
* wlan_reg_min_24ghz_ch_num() - Get minimum 2.4GHz channel number
|
||||
*
|
||||
* Return: Minimum 2.4GHz channel number
|
||||
*/
|
||||
#define WLAN_REG_MIN_24GHZ_CH_NUM wlan_reg_min_24ghz_ch_num()
|
||||
uint32_t wlan_reg_min_24ghz_ch_num(void);
|
||||
|
||||
/**
|
||||
* wlan_reg_max_24ghz_ch_num() - Get maximum 2.4GHz channel number
|
||||
*
|
||||
* Return: Maximum 2.4GHz channel number
|
||||
*/
|
||||
#define WLAN_REG_MAX_24GHZ_CH_NUM wlan_reg_max_24ghz_ch_num()
|
||||
uint32_t wlan_reg_max_24ghz_ch_num(void);
|
||||
|
||||
#define WLAN_REG_MIN_24GHZ_CH_NUM REG_MIN_24GHZ_CH_NUM
|
||||
#define WLAN_REG_MAX_24GHZ_CH_NUM REG_MAX_24GHZ_CH_NUM
|
||||
#define WLAN_REG_MIN_5GHZ_CH_NUM REG_MIN_5GHZ_CH_NUM
|
||||
#define WLAN_REG_MAX_5GHZ_CH_NUM REG_MAX_5GHZ_CH_NUM
|
||||
/**
|
||||
* wlan_reg_min_5ghz_ch_num() - Get minimum 5GHz channel number
|
||||
*
|
||||
* Return: Minimum 5GHz channel number
|
||||
*/
|
||||
#define WLAN_REG_MIN_5GHZ_CH_NUM wlan_reg_min_5ghz_ch_num()
|
||||
uint32_t wlan_reg_min_5ghz_ch_num(void);
|
||||
|
||||
#define WLAN_REG_IS_24GHZ_CH(chan) REG_IS_24GHZ_CH(chan)
|
||||
#define WLAN_REG_IS_5GHZ_CH(chan) REG_IS_5GHZ_CH(chan)
|
||||
/**
|
||||
* wlan_reg_max_5ghz_ch_num() - Get maximum 5GHz channel number
|
||||
*
|
||||
* Return: Maximum 5GHz channel number
|
||||
*/
|
||||
#define WLAN_REG_MAX_5GHZ_CH_NUM wlan_reg_max_5ghz_ch_num()
|
||||
uint32_t wlan_reg_max_5ghz_ch_num(void);
|
||||
|
||||
#define WLAN_REG_IS_24GHZ_CH_FREQ(freq) REG_IS_24GHZ_CH_FREQ(freq)
|
||||
#define WLAN_REG_IS_5GHZ_CH_FREQ(freq) REG_IS_5GHZ_FREQ(freq)
|
||||
/**
|
||||
* wlan_reg_is_24ghz_ch() - Check if the given channel number is 2.4GHz
|
||||
* @chan: Channel number
|
||||
*
|
||||
* Return: true if channel number is 2.4GHz, else false
|
||||
*/
|
||||
#define WLAN_REG_IS_24GHZ_CH(chan) wlan_reg_is_24ghz_ch(chan)
|
||||
bool wlan_reg_is_24ghz_ch(uint32_t chan);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_5ghz_ch() - Check if the given channel number is 5GHz
|
||||
* @chan: Channel number
|
||||
*
|
||||
* Return: true if channel number is 5GHz, else false
|
||||
*/
|
||||
#define WLAN_REG_IS_5GHZ_CH(chan) wlan_reg_is_5ghz_ch(chan)
|
||||
bool wlan_reg_is_5ghz_ch(uint32_t chan);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_24ghz_ch_freq() - Check if the given channel frequency is 2.4GHz
|
||||
* @freq: Channel frequency
|
||||
*
|
||||
* Return: true if channel frequency is 2.4GHz, else false
|
||||
*/
|
||||
#define WLAN_REG_IS_24GHZ_CH_FREQ(freq) wlan_reg_is_24ghz_ch_freq(freq)
|
||||
bool wlan_reg_is_24ghz_ch_freq(uint32_t freq);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_5ghz_ch_freq() - Check if the given channel frequency is 5GHz
|
||||
* @freq: Channel frequency
|
||||
*
|
||||
* Return: true if channel frequency is 5GHz, else false
|
||||
*/
|
||||
#define WLAN_REG_IS_5GHZ_CH_FREQ(freq) wlan_reg_is_5ghz_ch_freq(freq)
|
||||
bool wlan_reg_is_5ghz_ch_freq(uint32_t freq);
|
||||
|
||||
#ifndef CONFIG_LEGACY_CHAN_ENUM
|
||||
#define WLAN_REG_IS_49GHZ_FREQ(freq) REG_IS_49GHZ_FREQ(freq)
|
||||
/**
|
||||
* wlan_reg_is_49ghz_freq() - Check if the given channel frequency is 4.9GHz
|
||||
* @freq: Channel frequency
|
||||
*
|
||||
* Return: true if channel frequency is 4.9GHz, else false
|
||||
*/
|
||||
#define WLAN_REG_IS_49GHZ_FREQ(freq) wlan_reg_is_49ghz_freq(freq)
|
||||
bool wlan_reg_is_49ghz_freq(uint32_t freq);
|
||||
#endif
|
||||
|
||||
#define WLAN_REG_CH_NUM(ch_enum) REG_CH_NUM(ch_enum)
|
||||
#define WLAN_REG_CH_TO_FREQ(ch_enum) REG_CH_TO_FREQ(ch_enum)
|
||||
/**
|
||||
* wlan_reg_ch_num() - Get channel number from channel enum
|
||||
* @ch_enum: Channel enum
|
||||
*
|
||||
* Return: channel number
|
||||
*/
|
||||
#define WLAN_REG_CH_NUM(ch_enum) wlan_reg_ch_num(ch_enum)
|
||||
uint32_t wlan_reg_ch_num(uint32_t ch_enum);
|
||||
|
||||
/**
|
||||
* wlan_reg_ch_to_freq() - Get channel frequency from channel enum
|
||||
* @ch_enum: Channel enum
|
||||
*
|
||||
* Return: channel frequency
|
||||
*/
|
||||
#define WLAN_REG_CH_TO_FREQ(ch_enum) wlan_reg_ch_to_freq(ch_enum)
|
||||
uint32_t wlan_reg_ch_to_freq(uint32_t ch_enum);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_same_band_channels() - Check if given channel numbers have same
|
||||
* band
|
||||
* @chan_num1: Channel number1
|
||||
* @chan_num2: Channel number2
|
||||
*
|
||||
* Return: true if both the channels has the same band.
|
||||
*/
|
||||
#define WLAN_REG_IS_SAME_BAND_CHANNELS(chan_num1, chan_num2) \
|
||||
(chan_num1 && chan_num2 && \
|
||||
(WLAN_REG_IS_5GHZ_CH(chan_num1) == WLAN_REG_IS_5GHZ_CH(chan_num2)))
|
||||
|
||||
wlan_reg_is_same_band_channels(chan_num1, chan_num2)
|
||||
bool wlan_reg_is_same_band_channels(uint32_t chan_num1, uint32_t chan_num2);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_channel_valid_5g_sbs() Check if the given channel is 5G SBS.
|
||||
* @curchan: current channel
|
||||
* @newchan:new channel
|
||||
*
|
||||
* Return: true if the given channel is a valid 5G SBS
|
||||
*/
|
||||
#define WLAN_REG_IS_CHANNEL_VALID_5G_SBS(curchan, newchan) \
|
||||
(curchan > newchan ? \
|
||||
REG_CH_TO_FREQ(reg_get_chan_enum(curchan)) \
|
||||
- REG_CH_TO_FREQ(reg_get_chan_enum(newchan)) \
|
||||
> REG_SBS_SEPARATION_THRESHOLD : \
|
||||
REG_CH_TO_FREQ(reg_get_chan_enum(newchan)) \
|
||||
- REG_CH_TO_FREQ(reg_get_chan_enum(curchan)) \
|
||||
> REG_SBS_SEPARATION_THRESHOLD)
|
||||
wlan_reg_is_channel_valid_5g_sbs(curchan, newchan)
|
||||
bool wlan_reg_is_channel_valid_5g_sbs(uint32_t curchan, uint32_t newchan);
|
||||
|
||||
#define WLAN_REG_INVALID_CHANNEL_ID
|
||||
#define WLAN_REG_GET_24_END_CHAN_NUM 14
|
||||
|
||||
#define WLAN_REG_CHAN_TO_BAND(chan_num) reg_chan_to_band(chan_num)
|
||||
/**
|
||||
* wlan_reg_chan_to_band() - Get band from channel number
|
||||
* @chan_num: channel number
|
||||
*
|
||||
* Return: band info
|
||||
*/
|
||||
#define WLAN_REG_CHAN_TO_BAND(chan_num) wlan_reg_chan_to_band(chan_num)
|
||||
enum band_info wlan_reg_chan_to_band(uint32_t chan_num);
|
||||
|
||||
/**
|
||||
* wlan_reg_get_channel_list_with_power() - Provide the channel list with power
|
||||
|
|
@ -86,6 +177,7 @@ QDF_STATUS wlan_reg_get_channel_list_with_power(struct wlan_objmgr_pdev *pdev,
|
|||
QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country);
|
||||
|
||||
#ifdef CONFIG_MCL_REGDB
|
||||
/**
|
||||
* wlan_reg_read_current_country() - Read the current country for the regdomain
|
||||
* @country: pointer to the country code.
|
||||
|
|
@ -95,15 +187,6 @@ QDF_STATUS wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
|
|||
QDF_STATUS wlan_reg_read_current_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country);
|
||||
|
||||
/**
|
||||
* wlan_reg_get_channel_state() - Get channel state from regulatory
|
||||
* @ch: channel number.
|
||||
*
|
||||
* Return: channel state
|
||||
*/
|
||||
enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t ch);
|
||||
|
||||
/**
|
||||
* wlan_reg_chan_has_dfs_attribute() - check channel has dfs attribute flag
|
||||
* @ch: channel number.
|
||||
|
|
@ -115,6 +198,61 @@ enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
|
|||
bool
|
||||
wlan_reg_chan_has_dfs_attribute(struct wlan_objmgr_pdev *pdev, uint32_t ch);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_etsi13_srd_chan () - Checks if the ch is ETSI13 srd ch or not
|
||||
* @pdev: pdev ptr
|
||||
* @chan_num: channel
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_etsi13_srd_chan(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t chan_num);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_etsi13_regdmn() - Checks if current reg domain is ETSI13 or not
|
||||
* @pdev: pdev ptr
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_etsi13_srd_chan_allowed_master_mode() - Checks if regdmn is
|
||||
* ETSI13 and SRD channels are allowed in master mode or not.
|
||||
*
|
||||
* @pdev: pdev ptr
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev
|
||||
*pdev);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* wlan_reg_is_world() - reg is world mode
|
||||
* @country: The country information
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_world(uint8_t *country);
|
||||
|
||||
/**
|
||||
* wlan_reg_get_chan_enum() - Get channel enum for given channel number
|
||||
* @chan_num: Channel number
|
||||
*
|
||||
* Return: Channel enum
|
||||
*/
|
||||
enum channel_enum wlan_reg_get_chan_enum(uint32_t chan_num);
|
||||
|
||||
/**
|
||||
* wlan_reg_get_channel_state() - Get channel state from regulatory
|
||||
* @ch: channel number.
|
||||
*
|
||||
* Return: channel state
|
||||
*/
|
||||
enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t ch);
|
||||
|
||||
/**
|
||||
* wlan_reg_get_5g_bonded_channel_state() - Get 5G bonded channel state
|
||||
* @pdev: The physical dev to program country code or regdomain
|
||||
|
|
@ -354,35 +492,6 @@ bool wlan_reg_is_dfs_ch(struct wlan_objmgr_pdev *pdev, uint32_t chan);
|
|||
*/
|
||||
bool wlan_reg_is_dsrc_chan(struct wlan_objmgr_pdev *pdev, uint8_t chan_num);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_etsi13_srd_chan () - Checks if the ch is ETSI13 srd ch or not
|
||||
* @pdev: pdev ptr
|
||||
* @chan_num: channel
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_etsi13_srd_chan(struct wlan_objmgr_pdev *pdev,
|
||||
uint8_t chan_num);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_etsi13_regdmn() - Checks if current reg domain is ETSI13 or not
|
||||
* @pdev: pdev ptr
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_etsi13_regdmn(struct wlan_objmgr_pdev *pdev);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_etsi13_srd_chan_allowed_master_mode() - Checks if regdmn is
|
||||
* ETSI13 and SRD channels are allowed in master mode or not.
|
||||
*
|
||||
* @pdev: pdev ptr
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_etsi13_srd_chan_allowed_master_mode(struct wlan_objmgr_pdev
|
||||
*pdev);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_passive_or_disable_ch () - Checks chan state for passive
|
||||
* and disabled
|
||||
|
|
@ -421,13 +530,6 @@ uint32_t wlan_reg_freq_to_chan(struct wlan_objmgr_pdev *pdev,
|
|||
*/
|
||||
uint32_t wlan_reg_chan_to_freq(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan);
|
||||
/**
|
||||
* wlan_reg_is_world() - reg is world mode
|
||||
* @country: The country information
|
||||
*
|
||||
* Return: true or false
|
||||
*/
|
||||
bool wlan_reg_is_world(uint8_t *country);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_us() - reg is us country
|
||||
|
|
@ -477,8 +579,7 @@ QDF_STATUS wlan_reg_set_11d_country(struct wlan_objmgr_pdev *pdev,
|
|||
* Return: true or false
|
||||
*/
|
||||
void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk,
|
||||
void *arg);
|
||||
void *cbk, void *arg);
|
||||
|
||||
/**
|
||||
* wlan_reg_unregister_chan_change_callback () - remove chan change cbk
|
||||
|
|
@ -488,7 +589,7 @@ void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
|||
* Return: true or false
|
||||
*/
|
||||
void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk);
|
||||
void *cbk);
|
||||
|
||||
/**
|
||||
* wlan_reg_is_11d_offloaded() - 11d offloaded supported
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -26,10 +26,6 @@
|
|||
#ifndef __WLAN_REG_TGT_API_H
|
||||
#define __WLAN_REG_TGT_API_H
|
||||
|
||||
#include <qdf_types.h>
|
||||
#include <qdf_status.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
|
||||
QDF_STATUS tgt_reg_process_master_chan_list(struct cur_regulatory_info
|
||||
*reg_info);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -26,11 +26,6 @@
|
|||
#ifndef __WLAN_REG_UCFG_API_H
|
||||
#define __WLAN_REG_UCFG_API_H
|
||||
|
||||
#include <qdf_types.h>
|
||||
#include <qdf_status.h>
|
||||
#include "../../core/src/reg_services.h"
|
||||
#include <reg_services_public_struct.h>
|
||||
|
||||
typedef QDF_STATUS (*reg_event_cb)(void *status_struct);
|
||||
|
||||
/**
|
||||
|
|
@ -274,8 +269,7 @@ QDF_STATUS ucfg_reg_get_regd_rules(struct wlan_objmgr_pdev *pdev,
|
|||
* Return: void
|
||||
*/
|
||||
void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk,
|
||||
void *arg);
|
||||
void *cbk, void *arg);
|
||||
|
||||
/**
|
||||
* ucfg_reg_unregister_chan_change_callback () - remove chan change cbk
|
||||
|
|
@ -285,7 +279,7 @@ void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
|||
* Return: void
|
||||
*/
|
||||
void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk);
|
||||
void *cbk);
|
||||
|
||||
/**
|
||||
* ucfg_reg_get_cc_and_src () - get country code and src
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -25,10 +25,21 @@
|
|||
|
||||
#include <qdf_status.h>
|
||||
#include <qdf_types.h>
|
||||
#include <wlan_cmn.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
#include <wlan_reg_services_api.h>
|
||||
#include "../../core/src/reg_services.h"
|
||||
#include "../../core/src/reg_priv.h"
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include <wlan_objmgr_pdev_obj.h>
|
||||
#include "../../core/src/reg_priv_objs.h"
|
||||
#include "../../core/src/reg_getset.h"
|
||||
#include "../../core/src/reg_services_common.h"
|
||||
#include "../../core/src/reg_db.h"
|
||||
#include "../../core/src/reg_db_parser.h"
|
||||
#include <../../core/src/reg_build_chan_list.h>
|
||||
#include <../../core/src/reg_opclass.h>
|
||||
#include <../../core/src/reg_callbacks.h>
|
||||
#include <../../core/src/reg_host_11d.h>
|
||||
#include <wlan_objmgr_global_obj.h>
|
||||
|
||||
/**
|
||||
* wlan_reg_get_channel_list_with_power() - Provide the channel list with power
|
||||
|
|
@ -510,17 +521,18 @@ bool wlan_reg_is_us(uint8_t *country)
|
|||
}
|
||||
|
||||
void wlan_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk,
|
||||
void *arg)
|
||||
void *cbk, void *arg)
|
||||
{
|
||||
reg_register_chan_change_callback(psoc, cbk, arg);
|
||||
reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk,
|
||||
arg);
|
||||
|
||||
}
|
||||
|
||||
void wlan_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk)
|
||||
void *cbk)
|
||||
{
|
||||
reg_unregister_chan_change_callback(psoc, cbk);
|
||||
reg_unregister_chan_change_callback(psoc,
|
||||
(reg_chan_change_callback)cbk);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_11d_offloaded(struct wlan_objmgr_psoc *psoc)
|
||||
|
|
@ -613,3 +625,86 @@ QDF_STATUS wlan_reg_get_curr_regdomain(struct wlan_objmgr_pdev *pdev,
|
|||
{
|
||||
return reg_get_curr_regdomain(pdev, cur_regdmn);
|
||||
}
|
||||
|
||||
uint32_t wlan_reg_min_24ghz_ch_num(void)
|
||||
{
|
||||
return reg_min_24ghz_ch_num();
|
||||
}
|
||||
|
||||
uint32_t wlan_reg_max_24ghz_ch_num(void)
|
||||
{
|
||||
return reg_max_24ghz_ch_num();
|
||||
}
|
||||
|
||||
uint32_t wlan_reg_min_5ghz_ch_num(void)
|
||||
{
|
||||
return reg_min_5ghz_ch_num();
|
||||
}
|
||||
|
||||
uint32_t wlan_reg_max_5ghz_ch_num(void)
|
||||
{
|
||||
return reg_max_5ghz_ch_num();
|
||||
}
|
||||
|
||||
bool wlan_reg_is_24ghz_ch(uint32_t chan)
|
||||
{
|
||||
return reg_is_24ghz_ch(chan);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_5ghz_ch(uint32_t chan)
|
||||
{
|
||||
return reg_is_5ghz_ch(chan);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_24ghz_ch_freq(uint32_t freq)
|
||||
{
|
||||
return reg_is_24ghz_ch_freq(freq);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_5ghz_ch_freq(uint32_t freq)
|
||||
{
|
||||
return reg_is_5ghz_ch_freq(freq);
|
||||
}
|
||||
|
||||
#ifndef CONFIG_LEGACY_CHAN_ENUM
|
||||
bool wlan_reg_is_49ghz_freq(uint32_t freq)
|
||||
{
|
||||
return reg_is_49ghz_freq(freq);
|
||||
}
|
||||
#endif
|
||||
|
||||
uint32_t wlan_reg_ch_num(uint32_t ch_enum)
|
||||
{
|
||||
return reg_ch_num(ch_enum);
|
||||
}
|
||||
|
||||
uint32_t wlan_reg_ch_to_freq(uint32_t ch_enum)
|
||||
{
|
||||
return reg_ch_to_freq(ch_enum);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_same_band_channels(uint32_t chan_num1, uint32_t chan_num2)
|
||||
{
|
||||
return reg_is_same_band_channels(chan_num1, chan_num2);
|
||||
}
|
||||
|
||||
bool wlan_reg_is_channel_valid_5g_sbs(uint32_t curchan, uint32_t newchan)
|
||||
{
|
||||
return reg_is_channel_valid_5g_sbs(curchan, newchan);
|
||||
}
|
||||
|
||||
enum band_info wlan_reg_chan_to_band(uint32_t chan_num)
|
||||
{
|
||||
return reg_chan_to_band(chan_num);
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_reg_get_chan_enum() - Get channel enum for given channel number
|
||||
* @chan_num: Channel number
|
||||
*
|
||||
* Return: Channel enum
|
||||
*/
|
||||
enum channel_enum wlan_reg_get_chan_enum(uint32_t chan_num)
|
||||
{
|
||||
return reg_get_chan_enum(chan_num);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -24,8 +24,16 @@
|
|||
|
||||
#include <qdf_status.h>
|
||||
#include <qdf_types.h>
|
||||
#include <wlan_cmn.h>
|
||||
#include <reg_services_public_struct.h>
|
||||
#include <wlan_reg_tgt_api.h>
|
||||
#include "../../core/src/reg_services.h"
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include <../../core/src/reg_priv_objs.h>
|
||||
#include <../../core/src/reg_getset.h>
|
||||
#include <../../core/src/reg_services_common.h>
|
||||
#include <../../core/src/reg_lte.h>
|
||||
#include <../../core/src/reg_build_chan_list.h>
|
||||
#include <../../core/src/reg_host_11d.h>
|
||||
|
||||
/**
|
||||
* tgt_process_master_chan_list() - process master channel list
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2019 The Linux Foundation. All rights reserved.
|
||||
*
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for
|
||||
|
|
@ -22,8 +22,16 @@
|
|||
* @brief contains regulatory user config interface definations
|
||||
*/
|
||||
|
||||
#include <wlan_objmgr_vdev_obj.h>
|
||||
#include <wlan_reg_ucfg_api.h>
|
||||
#include "../../core/src/reg_services.h"
|
||||
#include <wlan_objmgr_psoc_obj.h>
|
||||
#include <../../core/src/reg_priv_objs.h>
|
||||
#include <../../core/src/reg_getset.h>
|
||||
#include <../../core/src/reg_services_common.h>
|
||||
#include <../../core/src/reg_lte.h>
|
||||
#include <../../core/src/reg_host_11d.h>
|
||||
#include <../../core/src/reg_build_chan_list.h>
|
||||
#include <../../core/src/reg_callbacks.h>
|
||||
#include <qdf_module.h>
|
||||
|
||||
QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb,
|
||||
|
|
@ -108,6 +116,7 @@ QDF_STATUS ucfg_reg_get_current_cc(struct wlan_objmgr_pdev *pdev,
|
|||
return reg_get_current_cc(pdev, rd);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_MCL_REGDB
|
||||
/**
|
||||
* ucfg_reg_set_band() - Sets the band information for the PDEV
|
||||
* @pdev: The physical pdev to set the band for
|
||||
|
|
@ -134,30 +143,6 @@ QDF_STATUS ucfg_reg_notify_sap_event(struct wlan_objmgr_pdev *pdev,
|
|||
return reg_notify_sap_event(pdev, sap_state);
|
||||
}
|
||||
|
||||
#ifdef DISABLE_CHANNEL_LIST
|
||||
/**
|
||||
* ucfg_reg_cache_channel_state() - Cache the current state of the channles
|
||||
* @pdev: The physical dev to cache the channels for
|
||||
* @channel_list: List of the channels for which states needs to be cached
|
||||
* @num_channels: Number of channels in the list
|
||||
*
|
||||
*/
|
||||
void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t *channel_list, uint32_t num_channels)
|
||||
{
|
||||
reg_cache_channel_state(pdev, channel_list, num_channels);
|
||||
}
|
||||
|
||||
/**
|
||||
* ucfg_reg_restore_cached_channels() - Cache the current state of the channles
|
||||
* @pdev: The physical dev to cache the channels for
|
||||
*/
|
||||
void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
reg_restore_cached_channels(pdev);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ucfg_reg_set_fcc_constraint() - apply fcc constraints on channels 12/13
|
||||
* @pdev: The physical pdev to reduce tx power for
|
||||
|
|
@ -173,25 +158,12 @@ QDF_STATUS ucfg_reg_set_fcc_constraint(struct wlan_objmgr_pdev *pdev,
|
|||
return reg_set_fcc_constraint(pdev, fcc_constraint);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ucfg_reg_get_default_country() - Get the default regulatory country
|
||||
* @psoc: The physical SoC to get default country from
|
||||
* @country_code: the buffer to populate the country code into
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country_code)
|
||||
{
|
||||
return reg_read_default_country(psoc, country_code);
|
||||
}
|
||||
|
||||
QDF_STATUS ucfg_reg_get_current_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country_code)
|
||||
{
|
||||
return reg_read_current_country(psoc, country_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* ucfg_reg_set_default_country() - Set the default regulatory country
|
||||
* @psoc: The physical SoC to set default country for
|
||||
|
|
@ -204,6 +176,20 @@ QDF_STATUS ucfg_reg_set_default_country(struct wlan_objmgr_psoc *psoc,
|
|||
{
|
||||
return reg_set_default_country(psoc, country);
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ucfg_reg_get_default_country() - Get the default regulatory country
|
||||
* @psoc: The physical SoC to get default country from
|
||||
* @country_code: the buffer to populate the country code into
|
||||
*
|
||||
* Return: QDF_STATUS
|
||||
*/
|
||||
QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc,
|
||||
uint8_t *country_code)
|
||||
{
|
||||
return reg_read_default_country(psoc, country_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* ucfg_reg_set_country() - Set the current regulatory country
|
||||
|
|
@ -249,16 +235,17 @@ QDF_STATUS ucfg_reg_get_curr_band(struct wlan_objmgr_pdev *pdev,
|
|||
}
|
||||
|
||||
void ucfg_reg_register_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk,
|
||||
void *arg)
|
||||
void *cbk, void *arg)
|
||||
{
|
||||
reg_register_chan_change_callback(psoc, cbk, arg);
|
||||
reg_register_chan_change_callback(psoc, (reg_chan_change_callback)cbk,
|
||||
arg);
|
||||
}
|
||||
|
||||
void ucfg_reg_unregister_chan_change_callback(struct wlan_objmgr_psoc *psoc,
|
||||
reg_chan_change_callback cbk)
|
||||
void *cbk)
|
||||
{
|
||||
reg_unregister_chan_change_callback(psoc, cbk);
|
||||
reg_unregister_chan_change_callback(psoc,
|
||||
(reg_chan_change_callback)cbk);
|
||||
}
|
||||
|
||||
enum country_src ucfg_reg_get_cc_and_src(struct wlan_objmgr_psoc *psoc,
|
||||
|
|
@ -298,3 +285,27 @@ QDF_STATUS ucfg_reg_set_hal_reg_cap(struct wlan_objmgr_psoc *psoc,
|
|||
return reg_set_hal_reg_cap(psoc, hal_reg_cap, phy_cnt);
|
||||
}
|
||||
qdf_export_symbol(ucfg_reg_set_hal_reg_cap);
|
||||
|
||||
#ifdef DISABLE_CHANNEL_LIST
|
||||
/**
|
||||
* ucfg_reg_cache_channel_state() - Cache the current state of the channles
|
||||
* @pdev: The physical dev to cache the channels for
|
||||
* @channel_list: List of the channels for which states needs to be cached
|
||||
* @num_channels: Number of channels in the list
|
||||
*
|
||||
*/
|
||||
void ucfg_reg_cache_channel_state(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t *channel_list, uint32_t num_channels)
|
||||
{
|
||||
reg_cache_channel_state(pdev, channel_list, num_channels);
|
||||
}
|
||||
|
||||
/**
|
||||
* ucfg_reg_restore_cached_channels() - Cache the current state of the channles
|
||||
* @pdev: The physical dev to cache the channels for
|
||||
*/
|
||||
void ucfg_reg_restore_cached_channels(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
reg_restore_cached_channels(pdev);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2012-2019 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
|
||||
|
|
@ -270,7 +270,7 @@ static uint32_t wifi_pos_get_valid_channels(uint8_t *channels, uint32_t num_ch,
|
|||
uint32_t i, num_valid_channels = 0;
|
||||
|
||||
for (i = 0; i < num_ch; i++) {
|
||||
if (INVALID_CHANNEL == reg_get_chan_enum(channels[i]))
|
||||
if (wlan_reg_get_chan_enum(channels[i]) == INVALID_CHANNEL)
|
||||
continue;
|
||||
valid_channel_list[num_valid_channels++] = channels[i];
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue