qcacmn: Populate the master channel list from firmware

Process the message WMI_REG_CHAN_LIST_CC_EVENTID. This message is used to
populate the master channel list.

Change-Id: I96d8f7ff5f71a35686ba990175c4a37995bfa6b2
CRs-Fixed 2002892
This commit is contained in:
Amar Singhal
2017-03-15 12:04:12 -07:00
committad av Sandeep Puligilla
förälder 7b56f8d67a
incheckning 9cab88d2ab
15 ändrade filer med 968 tillägg och 578 borttagningar

Visa fil

@@ -1,27 +0,0 @@
/*
* Copyright (c) 2017 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_main.h
* This file provides prototypes of the regulatory component
* functions
*/
QDF_STATUS wlan_regulatory_init(void);
QDF_STATUS wlan_regulatory_deinit(void);

Visa fil

@@ -1,218 +0,0 @@
/*
* Copyright (c) 2017 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
*/
enum channel_state {
CHANNEL_STATE_DISABLE,
CHANNEL_STATE_PASSIVE,
CHANNEL_STATE_DFS,
CHANNEL_STATE_ENABLE,
CHANNEL_STATE_INVALID,
};
enum phy_ch_width {
CH_WIDTH_20MHZ = 0,
CH_WIDTH_40MHZ,
CH_WIDTH_80MHZ,
CH_WIDTH_160MHZ,
CH_WIDTH_80P80MHZ,
CH_WIDTH_5MHZ,
CH_WIDTH_10MHZ,
CH_WIDTH_INVALID,
CH_WIDTH_MAX
};
/**
* struct ch_params
* @ch_width: channel width
* @sec_ch_offset: secondary channel offset
* @center_freq_seg0: center freq for segment 0
* @center_freq_seg1: center freq for segment 1
*/
struct ch_params {
enum phy_ch_width ch_width;
uint8_t sec_ch_offset;
uint8_t center_freq_seg0;
uint8_t center_freq_seg1;
};
struct regulatory_channel {
enum channel_state state;
uint32_t chan_flags;
uint32_t tx_power;
};
struct channel_power {
uint32_t chan_num;
uint32_t tx_power;
};
struct chan_map {
uint32_t center_freq;
uint32_t chan_num;
};
enum channel_enum {
CHAN_ENUM_1 = 1,
CHAN_ENUM_2,
CHAN_ENUM_3,
CHAN_ENUM_4,
CHAN_ENUM_5,
CHAN_ENUM_6,
CHAN_ENUM_7,
CHAN_ENUM_8,
CHAN_ENUM_9,
CHAN_ENUM_10,
CHAN_ENUM_11,
CHAN_ENUM_12,
CHAN_ENUM_13,
CHAN_ENUM_14,
CHAN_ENUM_36,
CHAN_ENUM_40,
CHAN_ENUM_44,
CHAN_ENUM_48,
CHAN_ENUM_52,
CHAN_ENUM_56,
CHAN_ENUM_60,
CHAN_ENUM_64,
CHAN_ENUM_100,
CHAN_ENUM_104,
CHAN_ENUM_108,
CHAN_ENUM_112,
CHAN_ENUM_116,
CHAN_ENUM_120,
CHAN_ENUM_124,
CHAN_ENUM_128,
CHAN_ENUM_132,
CHAN_ENUM_136,
CHAN_ENUM_140,
CHAN_ENUM_144,
CHAN_ENUM_149,
CHAN_ENUM_153,
CHAN_ENUM_157,
CHAN_ENUM_161,
CHAN_ENUM_165,
CHAN_ENUM_183,
CHAN_ENUM_184,
CHAN_ENUM_185,
CHAN_ENUM_186,
CHAN_ENUM_187,
CHAN_ENUM_188,
CHAN_ENUM_189,
CHAN_ENUM_190,
CHAN_ENUM_191,
CHAN_ENUM_192,
CHAN_ENUM_193,
CHAN_ENUM_194,
CHAN_ENUM_195,
CHAN_ENUM_196,
NUM_CHANNELS,
MIN_24GHZ_CHANNEL = CHAN_ENUM_1,
MAX_24GHZ_CHANNEL = CHAN_ENUM_14,
NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
MIN_5GHZ_CHANNEL = CHAN_ENUM_36,
MAX_5GHZ_CHANNEL = CHAN_ENUM_184,
NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
MIN_49GHZ_CHANNEL = CHAN_ENUM_183,
MAX_49GHZ_CHANNEL = CHAN_ENUM_196,
INVALID_CHANNEL = 0xBAD,
};
enum band_info {
band_2g = 0x1,
band_49g = 0x2,
band_5g_36_48 = 0x4,
band_5g_52_64 = 0x8,
band_5g_100_144 = 0x10,
band_5g_149_165 = 0x20
};
/**
* struct bonded_channel
* @start_ch: start channel
* @end_ch: end channel
*/
struct bonded_channel {
uint16_t start_ch;
uint16_t end_ch;
};
enum ht_sec_ch_offset {
NO_SEC_CH = 0,
LOW_PRIMARY_CH = 1,
HIGH_PRIMARY_CH = 3,
};
struct reg_ini_vars {
uint32_t enable_11d_support;
uint32_t userspace_ctry_priority;
enum band_info band_capability;
uint32_t dfs_enable;
uint32_t indoor_channel_support;
};
struct set_band_req {
enum band_info band;
uint32_t pdev_id;
};
struct country_info {
uint8_t country_code[REG_ALPHA2_LEN + 1];
};
struct reg_country_update {
uint8_t country_code[REG_ALPHA2_LEN + 1];
};
QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_psoc *psoc,
struct channel_power *ch_list,
uint8_t *num_chan);
void reg_read_default_country(struct wlan_objmgr_psoc *psoc,
uint8_t *country);
enum channel_state reg_get_channel_state(struct wlan_objmgr_psoc *psoc,
uint32_t ch);
enum channel_state reg_get_5g_bonded_channel_state(
struct wlan_objmgr_psoc *psoc,
uint8_t ch, enum phy_ch_width bw);
enum channel_state reg_get_2g_bonded_channel_state(
struct wlan_objmgr_psoc *psoc,
uint8_t oper_ch, uint8_t sec_ch,
enum phy_ch_width bw);
void reg_set_channel_params(struct wlan_objmgr_psoc *psoc,
uint8_t ch, struct ch_params *ch_params);
void reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
enum dfs_region *dfs_reg);
bool reg_is_dfs_ch(struct wlan_objmgr_psoc *psoc, uint8_t ch);

Visa fil

@@ -663,15 +663,15 @@ static const struct regulatory_rule reg_rules_2g[] = {
static const struct regdomain regdomains_2g[] = {
[FCCA] = {FCC, DFS_UNINIT_REGION, 0, 1, {CHAN_1_11_1} },
[WORLD] = {ETSI, DFS_UNINIT_REGION, 0, 1, {CHAN_1_13_1} },
[MKKA] = {MKK, DFS_UNINIT_REGION, 0, 2, {CHAN_1_13_1, CHAN_14_1} },
[MKKC] = {MKK, DFS_UNINIT_REGION, 0, 1, {CHAN_1_13_1} },
[ETSIC] = {ETSI, DFS_UNINIT_REGION, 0, 1, {CHAN_1_13_2} },
[WORLD_2G_1] = {FCC, DFS_UNINIT_REGION, 0, 1, {CHAN_1_11_2} },
[WORLD_2G_2] = {FCC, DFS_UNINIT_REGION, 0, 2,
[FCCA] = {CTL_FCC, DFS_UNINIT_REG, 0, 1, {CHAN_1_11_1} },
[WORLD] = {CTL_ETSI, DFS_UNINIT_REG, 0, 1, {CHAN_1_13_1} },
[MKKA] = {CTL_MKK, DFS_UNINIT_REG, 0, 2, {CHAN_1_13_1, CHAN_14_1} },
[MKKC] = {CTL_MKK, DFS_UNINIT_REG, 0, 1, {CHAN_1_13_1} },
[ETSIC] = {CTL_ETSI, DFS_UNINIT_REG, 0, 1, {CHAN_1_13_2} },
[WORLD_2G_1] = {CTL_FCC, DFS_UNINIT_REG, 0, 1, {CHAN_1_11_2} },
[WORLD_2G_2] = {CTL_FCC, DFS_UNINIT_REG, 0, 2,
{CHAN_1_11_2, CHAN_12_13_1} },
[WORLD_2G_3] = {FCC, DFS_UNINIT_REGION, 0, 3,
[WORLD_2G_3] = {CTL_FCC, DFS_UNINIT_REG, 0, 3,
{CHAN_1_11_2, CHAN_12_13_1, CHAN_14_2} },
};
@@ -745,115 +745,115 @@ static const struct regulatory_rule reg_rules_5g[] = {
static const struct regdomain regdomains_5g[] = {
[FCC1] = {FCC, DFS_FCC_REGION, 2, 3, {CHAN_5170_5250_1,
[FCC1] = {CTL_FCC, DFS_FCC_REG, 2, 3, {CHAN_5170_5250_1,
CHAN_5250_5330_1,
CHAN_5735_5835_1} },
[FCC2] = {FCC, DFS_CN_REGION, 2, 3, {CHAN_5170_5250_2,
[FCC2] = {CTL_FCC, DFS_CN_REG, 2, 3, {CHAN_5170_5250_2,
CHAN_5250_5330_1,
CHAN_5735_5835_1} },
[FCC3] = {FCC, DFS_FCC_REGION, 2, 4, {CHAN_5170_5250_2,
[FCC3] = {CTL_FCC, DFS_FCC_REG, 2, 4, {CHAN_5170_5250_2,
CHAN_5250_5330_1,
CHAN_5490_5730_1,
CHAN_5735_5835_1} },
[FCC4] = {FCC, DFS_FCC_REGION, 2, 4, {CHAN_4940_4990_1,
[FCC4] = {CTL_FCC, DFS_FCC_REG, 2, 4, {CHAN_4940_4990_1,
CHAN_5170_5250_1,
CHAN_5250_5330_1,
CHAN_5735_5835_1} },
[FCC6] = {FCC, DFS_FCC_REGION, 2, 5, {CHAN_5170_5250_2,
[FCC6] = {CTL_FCC, DFS_FCC_REG, 2, 5, {CHAN_5170_5250_2,
CHAN_5250_5330_1,
CHAN_5490_5590_1,
CHAN_5650_5730_1,
CHAN_5735_5835_1} },
[FCC8] = {FCC, DFS_FCC_REGION, 2, 4, {CHAN_5170_5250_4,
[FCC8] = {CTL_FCC, DFS_FCC_REG, 2, 4, {CHAN_5170_5250_4,
CHAN_5250_5330_1,
CHAN_5490_5730_1,
CHAN_5735_5835_1} },
[ETSI1] = {ETSI, DFS_ETSI_REGION, 5, 3, {CHAN_5170_5250_2,
[ETSI1] = {CTL_ETSI, DFS_ETSI_REG, 5, 3, {CHAN_5170_5250_2,
CHAN_5250_5330_1,
CHAN_5490_5710_1} },
[ETSI3] = {ETSI, DFS_ETSI_REGION, 5, 2, {CHAN_5170_5250_3,
[ETSI3] = {CTL_ETSI, DFS_ETSI_REG, 5, 2, {CHAN_5170_5250_3,
CHAN_5250_5330_2} },
[ETSI4] = {ETSI, DFS_ETSI_REGION, 5, 2, {CHAN_5170_5250_1,
[ETSI4] = {CTL_ETSI, DFS_ETSI_REG, 5, 2, {CHAN_5170_5250_1,
CHAN_5250_5330_3} },
[ETSI8] = {ETSI, DFS_ETSI_REGION, 20, 4, {CHAN_5170_5250_3,
[ETSI8] = {CTL_ETSI, DFS_ETSI_REG, 20, 4, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_5490_5730_2,
CHAN_5735_5835_2} },
[ETSI9] = {ETSI, DFS_ETSI_REGION, 20, 4, {CHAN_5170_5250_3,
[ETSI9] = {CTL_ETSI, DFS_ETSI_REG, 20, 4, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_5490_5670_1,
CHAN_5735_5835_3} },
[APL1] = {ETSI, DFS_UNINIT_REGION, 2, 1, {CHAN_5735_5835_2} },
[APL1] = {CTL_ETSI, DFS_UNINIT_REG, 2, 1, {CHAN_5735_5835_2} },
[APL2] = {ETSI, DFS_UNINIT_REGION, 2, 1, {CHAN_5735_5815_1} },
[APL2] = {CTL_ETSI, DFS_UNINIT_REG, 2, 1, {CHAN_5735_5815_1} },
[APL4] = {ETSI, DFS_UNINIT_REGION, 2, 2, {CHAN_5170_5250_2,
[APL4] = {CTL_ETSI, DFS_UNINIT_REG, 2, 2, {CHAN_5170_5250_2,
CHAN_5735_5835_1} },
[APL6] = {ETSI, DFS_ETSI_REGION, 2, 3, {CHAN_5170_5250_3,
[APL6] = {CTL_ETSI, DFS_ETSI_REG, 2, 3, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_5735_5835_3} },
[APL8] = {ETSI, DFS_ETSI_REGION, 2, 2, {CHAN_5250_5330_4,
[APL8] = {CTL_ETSI, DFS_ETSI_REG, 2, 2, {CHAN_5250_5330_4,
CHAN_5735_5835_2} },
[APL9] = {ETSI, DFS_KR_REGION, 2, 4, {CHAN_5170_5250_3,
[APL9] = {CTL_ETSI, DFS_KR_REG, 2, 4, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_5490_5630_1,
CHAN_5735_5815_1} },
[APL10] = {ETSI, DFS_ETSI_REGION, 2, 4, {CHAN_5170_5250_3,
[APL10] = {CTL_ETSI, DFS_ETSI_REG, 2, 4, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_5490_5710_1,
CHAN_5735_5815_1} },
[APL12] = {ETSI, DFS_ETSI_REGION, 2, 3, {CHAN_5170_5250_1,
[APL12] = {CTL_ETSI, DFS_ETSI_REG, 2, 3, {CHAN_5170_5250_1,
CHAN_5490_5570_1,
CHAN_5735_5775_1} },
[APL14] = {FCC, DFS_CN_REGION, 2, 3, {CHAN_5170_5250_2,
[APL14] = {CTL_FCC, DFS_CN_REG, 2, 3, {CHAN_5170_5250_2,
CHAN_5250_5330_1,
CHAN_5735_5835_4} },
[MKK3] = {MKK, DFS_UNINIT_REGION, 2, 1, {CHAN_5170_5250_3} },
[MKK3] = {CTL_MKK, DFS_UNINIT_REG, 2, 1, {CHAN_5170_5250_3} },
[MKK4] = {MKK, DFS_MKK_REGION, 2, 2, {CHAN_5170_5250_3,
[MKK4] = {CTL_MKK, DFS_MKK_REG, 2, 2, {CHAN_5170_5250_3,
CHAN_5250_5330_2} },
[MKK5] = {MKK, DFS_MKK_REGION, 2, 3, {CHAN_5170_5250_3,
[MKK5] = {CTL_MKK, DFS_MKK_REG, 2, 3, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_5490_5710_2} },
[MKK9] = {MKK, DFS_UNINIT_REGION, 2, 3, {CHAN_5170_5250_3,
[MKK9] = {CTL_MKK, DFS_UNINIT_REG, 2, 3, {CHAN_5170_5250_3,
CHAN_4910_4990_1,
CHAN_5030_5090_1} },
[MKK10] = {MKK, DFS_MKK_REGION, 2, 4, {CHAN_5170_5250_3,
[MKK10] = {CTL_MKK, DFS_MKK_REG, 2, 4, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_4910_4990_1,
CHAN_5030_5090_1} },
[MKK11] = {MKK, DFS_MKK_REGION, 2, 5, {CHAN_5170_5250_3,
[MKK11] = {CTL_MKK, DFS_MKK_REG, 2, 5, {CHAN_5170_5250_3,
CHAN_5250_5330_2,
CHAN_5490_5710_2,
CHAN_4910_4990_1,
CHAN_5030_5090_1} },
[WORLD_5G_1] = {FCC, DFS_UNINIT_REGION, 2, 2, {CHAN_5170_5330_1,
[WORLD_5G_1] = {CTL_FCC, DFS_UNINIT_REG, 2, 2, {CHAN_5170_5330_1,
CHAN_5735_5835_5} },
[WORLD_5G_2] = {FCC, DFS_UNINIT_REGION, 2, 3, {CHAN_5170_5330_1,
[WORLD_5G_2] = {CTL_FCC, DFS_UNINIT_REG, 2, 3, {CHAN_5170_5330_1,
CHAN_5490_5730_3,
CHAN_5735_5835_5} },
};

Visa fil

@@ -22,8 +22,8 @@
* This file contains regulatory component data structures
*/
#include "qdf_types.h"
#include "qdf_trace.h"
#ifndef __REG_DB_H
#define __REG_DB_H
#define REGULATORY_CHAN_DISABLED (1<<0)
#define REGULATORY_CHAN_NO_IR (1<<1)
@@ -48,23 +48,23 @@
#define REG_ALPHA2_LEN 2
/**
* enum dfs_region - 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 region
* @DFS_UNINIT_REG: un-initialized region
* @DFS_FCC_REG: FCC region
* @DFS_ETSI_REG: ETSI region
* @DFS_MKK_REG: MKK region
* @DFS_CN_REG: China region
* @DFS_KR_REG: Korea region
* @DFS_UNDEF_REG: Undefined region
*/
enum dfs_region {
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
enum dfs_reg {
DFS_UNINIT_REG = 0,
DFS_FCC_REG = 1,
DFS_ETSI_REG = 2,
DFS_MKK_REG = 3,
DFS_CN_REG = 4,
DFS_KR_REG = 5,
DFS_UNDEF_REG
};
/**
@@ -93,7 +93,7 @@ struct regulatory_rule {
*/
struct regdomain {
uint8_t ctl_val;
uint8_t dfs_region;
enum dfs_reg dfs_region;
uint16_t min_bw;
uint8_t num_reg_rules;
uint8_t reg_rule_id[MAX_REG_RULES];
@@ -132,15 +132,17 @@ struct reg_domain_pair {
};
/**
* enum ctl_val - CTL value
* @FCC: FCC
* @MKK: MKK
* @ETSI: ETSI
* @NO_CTL: no CTL
* enum ctl_value - CTL value
* @CTL_FCC: FCC
* @CTL_MKK: MKK
* @CTL_ETSI: ETSI
* @CTL_NONE: no CTL
*/
enum ctl_val {
FCC = 0x10,
MKK = 0x40,
ETSI = 0x30,
NO_CTL = 0xff
enum ctl_value {
CTL_FCC = 0x10,
CTL_MKK = 0x40,
CTL_ETSI = 0x30,
CTL_NONE = 0xff
};
#endif

Visa fil

@@ -1,169 +0,0 @@
/*
* Copyright (c) 2017 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_main.c
* This file provides the regulatory component initialization and
* registration functions
*/
#include "qdf_status.h"
#include "qdf_types.h"
#include "qdf_trace.h"
#include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_global_obj.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_pdev_obj.h"
#include "scheduler_api.h"
#include "reg_db.h"
#include "reg_services.h"
#include "reg_priv.h"
#include "reg_main.h"
/**
* 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
*/
static 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;
QDF_STATUS status;
soc_reg_obj =
qdf_mem_malloc(sizeof(*soc_reg_obj));
if (NULL == 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;
status = wlan_objmgr_psoc_component_obj_attach(psoc,
WLAN_UMAC_COMP_REGULATORY, soc_reg_obj,
QDF_STATUS_SUCCESS);
reg_info("reg psoc obj created with status %d", status);
return status;
}
/**
* 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
*/
static 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 *soc_reg =
wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_REGULATORY);
if (NULL == soc_reg) {
reg_err("reg psoc private obj is NULL");
return QDF_STATUS_E_FAULT;
}
status = wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_REGULATORY,
soc_reg);
if (status != QDF_STATUS_SUCCESS)
reg_err("soc_reg private obj detach failed");
reg_info("reg psoc obj deleted with status %d", status);
qdf_mem_free(soc_reg);
return status;
}
/**
* wlan_regulatory_init() - init regulatory component
*
* Return: Success or Failure
*/
QDF_STATUS wlan_regulatory_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_created_notification, NULL);
if (status != QDF_STATUS_SUCCESS) {
reg_err("Failed to register reg obj create handler");
return status;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_destroyed_notification, NULL);
if (status != QDF_STATUS_SUCCESS) {
reg_err("Failed to register reg obj delete handler");
wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_created_notification,
NULL);
return status;
}
reg_info("regulatory handlers registered with obj mgr");
return QDF_STATUS_SUCCESS;
}
/**
* wlan_regulatory_deinit() - deinit regulatory component
*
* Return: Success or Failure
*/
QDF_STATUS wlan_regulatory_deinit(void)
{
QDF_STATUS status;
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_created_notification,
NULL);
if (status != QDF_STATUS_SUCCESS)
reg_err("deregister fail for psoc create notif:%d",
status);
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_destroyed_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
reg_err("deregister fail for psoc delete notif:%d",
status);
return status;
}
reg_alert("deregistered callbacks with obj mgr successfully");
return QDF_STATUS_SUCCESS;
}

Visa fil

@@ -22,6 +22,12 @@
* This file contains regulatory component private data structures.
*/
#ifndef __REG_PRIV_H
#define __REG_PRIV_H
#include "reg_db.h"
#include "reg_services.h"
#define reg_log(level, args...) \
QDF_TRACE(QDF_MODULE_ID_REGULATORY, level, ## args)
#define reg_logfl(level, format, args...) reg_log(level, FL(format), ## args)
@@ -46,9 +52,9 @@ struct wlan_regulatory_psoc_priv_obj {
enum channel_enum nol_list[NUM_CHANNELS];
char default_country[REG_ALPHA2_LEN + 1];
char current_country[REG_ALPHA2_LEN + 1];
struct wlan_objmgr_psoc psoc_ptr;
struct wlan_objmgr_psoc *psoc_ptr;
uint32_t phybitmap;
enum dfs_region dfs_region;
enum dfs_reg dfs_region;
char country_11d[REG_ALPHA2_LEN + 1];
bool dfs_disable;
bool set_fcc_channel;
@@ -58,3 +64,5 @@ struct wlan_regulatory_psoc_priv_obj {
bool enable_11d_supp_current;
bool userspace_country_priority;
};
#endif

Visa fil

@@ -30,17 +30,10 @@
* This file defines regulatory component service functions
*/
#include "qdf_status.h"
#include "qdf_types.h"
#include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_global_obj.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_pdev_obj.h"
#include "scheduler_api.h"
#include "reg_db.h"
#include "reg_services.h"
#include "reg_priv.h"
const struct bonded_channel bonded_chan_40mhz_list[] = {
{36, 40},
{44, 48},
@@ -368,23 +361,23 @@ enum channel_state reg_get_5g_bonded_channel_state(
if (CH_WIDTH_5MHZ == bw)
bw_enabled = true;
else if (CH_WIDTH_10MHZ == bw)
bw_enabled = !(reg_channels[ch_indx].chan_flags &
REGULATORY_CHAN_NO_10MHZ);
bw_enabled = (reg_channels[ch_indx].min_bw <= 10) &&
(reg_channels[ch_indx].max_bw >= 10);
else if (CH_WIDTH_20MHZ == bw)
bw_enabled = !(reg_channels[ch_indx].chan_flags &
REGULATORY_CHAN_NO_20MHZ);
bw_enabled = (reg_channels[ch_indx].min_bw <= 20) &&
(reg_channels[ch_indx].max_bw >= 20);
else if (CH_WIDTH_40MHZ == bw)
bw_enabled = !((reg_channels[ch_indx].chan_flags &
REGULATORY_CHAN_NO_HT40) == REGULATORY_CHAN_NO_HT40);
bw_enabled = (reg_channels[ch_indx].min_bw <= 40) &&
(reg_channels[ch_indx].max_bw >= 40);
else if (CH_WIDTH_80MHZ == bw)
bw_enabled = !(reg_channels[ch_indx].chan_flags &
REGULATORY_CHAN_NO_80MHZ);
bw_enabled = (reg_channels[ch_indx].min_bw <= 80) &&
(reg_channels[ch_indx].max_bw >= 80);
else if (CH_WIDTH_160MHZ == bw)
bw_enabled = !(reg_channels[ch_indx].chan_flags &
REGULATORY_CHAN_NO_160MHZ);
bw_enabled = (reg_channels[ch_indx].min_bw <= 160) &&
(reg_channels[ch_indx].max_bw >= 160);
else if (CH_WIDTH_80P80MHZ == bw)
bw_enabled = !(reg_channels[ch_indx].chan_flags &
REGULATORY_CHAN_NO_80MHZ);
bw_enabled = (reg_channels[ch_indx].min_bw <= 80) &&
(reg_channels[ch_indx].max_bw >= 80);
if (bw_enabled)
return chan_state;
@@ -446,15 +439,14 @@ enum channel_state reg_get_2g_bonded_channel_state(
if (CH_WIDTH_5MHZ == bw)
bw_enabled = true;
else if (CH_WIDTH_10MHZ == bw)
bw_enabled = !(reg_channels[chan_idx].chan_flags &
REGULATORY_CHAN_NO_10MHZ);
bw_enabled = (reg_channels[chan_idx].min_bw <= 10) &&
(reg_channels[chan_idx].max_bw >= 10);
else if (CH_WIDTH_20MHZ == bw)
bw_enabled = !(reg_channels[chan_idx].chan_flags &
REGULATORY_CHAN_NO_20MHZ);
bw_enabled = (reg_channels[chan_idx].min_bw <= 20) &&
(reg_channels[chan_idx].max_bw >= 20);
else if (CH_WIDTH_40MHZ == bw)
bw_enabled = !((reg_channels[chan_idx].chan_flags &
REGULATORY_CHAN_NO_HT40) ==
REGULATORY_CHAN_NO_HT40);
bw_enabled = (reg_channels[chan_idx].min_bw <= 40) &&
(reg_channels[chan_idx].max_bw >= 40);
if (bw_enabled)
return chan_state;
@@ -482,7 +474,7 @@ static enum channel_state reg_combine_channel_states(
* Return: None
*/
void reg_set_channel_params(struct wlan_objmgr_psoc *psoc,
uint8_t ch, struct ch_params *ch_params)
uint8_t ch, struct ch_params_s *ch_params)
{
/*
* Set channel parameters like center frequency for a bonded channel
@@ -572,7 +564,7 @@ void reg_set_channel_params(struct wlan_objmgr_psoc *psoc,
* Return: None
*/
void reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
enum dfs_region *dfs_reg)
enum dfs_reg *dfs_reg)
{
/*
* Get the current dfs region
@@ -593,3 +585,276 @@ bool reg_is_dfs_ch(struct wlan_objmgr_psoc *psoc, uint8_t ch)
return ch_state == CHANNEL_STATE_DFS;
}
static void reg_fill_channel_info(enum channel_enum chan_enum,
struct regulatory_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].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_PASSIVE;
}
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 (20 == master_list[chan_enum].max_bw)
master_list[chan_enum].max_bw = reg_rule->max_bw;
}
static void populate_band_channels(enum channel_enum start_chan,
enum channel_enum end_chan,
struct regulatory_rule *rule_start_ptr,
uint32_t num_reg_rules,
uint16_t min_bw,
struct regulatory_channel *mas_chan_list)
{
struct regulatory_rule *found_rule_ptr;
struct regulatory_rule *cur_rule_ptr;
struct regulatory_channel;
enum channel_enum chan_enum;
uint32_t rule_num, bw;
for (chan_enum = start_chan; chan_enum <= end_chan; chan_enum++) {
found_rule_ptr = NULL;
for (bw = 20; ((bw >= 5) && (NULL == found_rule_ptr));
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 <=
channel_map[chan_enum].center_freq -
bw/2) &&
(cur_rule_ptr->end_freq >=
channel_map[chan_enum].center_freq +
bw/2) && (min_bw <= bw)) {
found_rule_ptr = cur_rule_ptr;
break;
}
}
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);
}
}
}
static void update_max_bw_per_rule(uint32_t num_reg_rules,
struct regulatory_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);
}
static void do_auto_bw_correction(uint32_t num_reg_rules,
struct regulatory_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;
}
}
}
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 regulatory_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, *cur_chan_list;
reg_info("%s: process reg chan list", __func__);
soc_reg = (struct wlan_regulatory_psoc_priv_obj *)
wlan_objmgr_psoc_get_comp_private_obj(regulat_info->psoc,
WLAN_UMAC_COMP_REGULATORY);
if (NULL == soc_reg) {
reg_err("soc_reg is NULL");
return QDF_STATUS_E_FAILURE;
}
soc_reg->offload_enabled = true;
soc_reg->phybitmap = regulat_info->phybitmap;
soc_reg->dfs_region = regulat_info->dfs_region;
qdf_mem_copy(soc_reg->default_country, regulat_info->alpha2,
REG_ALPHA2_LEN);
qdf_mem_copy(soc_reg->current_country, regulat_info->alpha2,
REG_ALPHA2_LEN);
mas_chan_list = soc_reg->master_ch_list;
cur_chan_list = soc_reg->current_ch_list;
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;
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;
update_max_bw_per_rule(num_5g_reg_rules,
reg_rule_5g, max_bw_5g);
do_auto_bw_correction(num_5g_reg_rules, reg_rule_5g, max_bw_5g);
populate_band_channels(CHAN_ENUM_1, CHAN_ENUM_14,
reg_rule_2g, num_2g_reg_rules,
min_bw_2g, mas_chan_list);
populate_band_channels(CHAN_ENUM_36, CHAN_ENUM_196,
reg_rule_5g,
num_5g_reg_rules,
min_bw_5g, mas_chan_list);
qdf_mem_copy((void *)cur_chan_list, (void *)mas_chan_list,
NUM_CHANNELS * sizeof(struct regulatory_channel));
qdf_mem_free(regulat_info->reg_rules_2g_ptr);
qdf_mem_free(regulat_info->reg_rules_5g_ptr);
qdf_mem_free(regulat_info);
return QDF_STATUS_SUCCESS;
}
/**
* 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)
{
struct wlan_regulatory_psoc_priv_obj *soc_reg_obj;
struct regulatory_channel *mas_chan_list;
enum channel_enum chan_enum;
QDF_STATUS status;
soc_reg_obj =
qdf_mem_malloc(sizeof(*soc_reg_obj));
if (NULL == 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;
mas_chan_list = soc_reg_obj->master_ch_list;
for (chan_enum = CHAN_ENUM_1; chan_enum <= CHAN_ENUM_196;
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;
}
status = wlan_objmgr_psoc_component_obj_attach(psoc,
WLAN_UMAC_COMP_REGULATORY, soc_reg_obj,
QDF_STATUS_SUCCESS);
reg_info("reg psoc obj created with status %d", status);
return status;
}
/**
* 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)
{
QDF_STATUS status;
struct wlan_regulatory_psoc_priv_obj *soc_reg =
wlan_objmgr_psoc_get_comp_private_obj(psoc,
WLAN_UMAC_COMP_REGULATORY);
if (NULL == soc_reg) {
reg_err("reg psoc private obj is NULL");
return QDF_STATUS_E_FAULT;
}
soc_reg->psoc_ptr = NULL;
status = wlan_objmgr_psoc_component_obj_detach(psoc,
WLAN_UMAC_COMP_REGULATORY,
soc_reg);
if (status != QDF_STATUS_SUCCESS)
reg_err("soc_reg private obj detach failed");
reg_info("reg psoc obj deleted with status %d", status);
qdf_mem_free(soc_reg);
return status;
}

Visa fil

@@ -0,0 +1,361 @@
/*
* Copyright (c) 2017 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_H_
#define __REG_SERVICES_H_
#include <qdf_types.h>
#include <qdf_status.h>
#include <wlan_objmgr_cmn.h>
#include <wlan_objmgr_global_obj.h>
#include <wlan_objmgr_psoc_obj.h>
#include <wlan_objmgr_pdev_obj.h>
#include "reg_db.h"
#include <reg_services_public_struct.h>
/**
* enum channel_state - channel state
* @CHANNEL_STATE_DISABLE: disabled state
* @CHANNEL_STATE_PASSIVE: passive state
* @CHANNEL_STATE_DFS: dfs state
* @CHANNEL_STATE_ENABLE: enabled state
* @CHANNEL_STATE_INVALID: invalid state
*/
enum channel_state {
CHANNEL_STATE_DISABLE,
CHANNEL_STATE_PASSIVE,
CHANNEL_STATE_DFS,
CHANNEL_STATE_ENABLE,
CHANNEL_STATE_INVALID,
};
typedef enum {
REGDOMAIN_FCC,
REGDOMAIN_ETSI,
REGDOMAIN_JAPAN,
REGDOMAIN_WORLD,
REGDOMAIN_COUNT
} v_REGDOMAIN_t;
/**
* enum phy_ch_width - channel width
* @CH_WIDTH_20MHZ: 20 mhz width
* @CH_WIDTH_40MHZ: 40 mhz width
* @CH_WIDTH_80MHZ: 80 mhz width
* @CH_WIDTH_160MHZ: 160 mhz width
* @CH_WIDTH_80P80HZ: 80+80 mhz width
* @CH_WIDTH_5MHZ: 5 mhz width
* @CH_WIDTH_10MHZ: 10 mhz width
* @CH_WIDTH_INVALID: invalid width
* @CH_WIDTH_MAX: max possible width
*/
enum phy_ch_width {
CH_WIDTH_20MHZ = 0,
CH_WIDTH_40MHZ,
CH_WIDTH_80MHZ,
CH_WIDTH_160MHZ,
CH_WIDTH_80P80MHZ,
CH_WIDTH_5MHZ,
CH_WIDTH_10MHZ,
CH_WIDTH_INVALID,
CH_WIDTH_MAX
};
/**
* struct ch_params
* @ch_width: channel width
* @sec_ch_offset: secondary channel offset
* @center_freq_seg0: center freq for segment 0
* @center_freq_seg1: center freq for segment 1
*/
struct ch_params_s {
enum phy_ch_width ch_width;
uint8_t sec_ch_offset;
uint8_t center_freq_seg0;
uint8_t center_freq_seg1;
};
/**
* struct regulatory_channel
* @center_freq: center frequency
* @chan_num: channel number
* @state: channel state
* @chan_flags: channel flags
* @tx_power: TX powers
*/
struct regulatory_channel {
uint32_t center_freq;
uint32_t chan_num;
enum channel_state state;
uint32_t chan_flags;
uint32_t tx_power;
uint16_t min_bw;
uint16_t max_bw;
};
/**
* struct channel_power
* @chan_num: channel number
* @tx_power: TX power
*/
struct channel_power {
uint32_t chan_num;
uint32_t tx_power;
};
/**
* enum channel_enum - channel enumeration
* @CHAN_ENUM_1: channel number 1
* @CHAN_ENUM_2: channel number 2
* @CHAN_ENUM_3: channel number 3
* @CHAN_ENUM_4: channel number 4
* @CHAN_ENUM_5: channel number 5
* @CHAN_ENUM_6: channel number 6
* @CHAN_ENUM_7: channel number 7
* @CHAN_ENUM_8: channel number 8
* @CHAN_ENUM_9: channel number 9
* @CHAN_ENUM_10: channel number 10
* @CHAN_ENUM_11: channel number 11
* @CHAN_ENUM_12: channel number 12
* @CHAN_ENUM_13: channel number 13
* @CHAN_ENUM_14: channel number 14
* @CHAN_ENUM_36: channel number 36
* @CHAN_ENUM_40: channel number 40
* @CHAN_ENUM_44: channel number 44
* @CHAN_ENUM_48: channel number 48
* @CHAN_ENUM_52: channel number 52
* @CHAN_ENUM_56: channel number 56
* @CHAN_ENUM_60: channel number 60
* @CHAN_ENUM_64: channel number 64
* @CHAN_ENUM_100: channel number 100
* @CHAN_ENUM_104: channel number 104
* @CHAN_ENUM_108: channel number 108
* @CHAN_ENUM_112: channel number 112
* @CHAN_ENUM_116: channel number 116
* @CHAN_ENUM_120: channel number 120
* @CHAN_ENUM_124: channel number 124
* @CHAN_ENUM_128: channel number 128
* @CHAN_ENUM_132: channel number 132
* @CHAN_ENUM_136: channel number 136
* @CHAN_ENUM_140: channel number 140
* @CHAN_ENUM_144: channel number 144
* @CHAN_ENUM_149: channel number 149
* @CHAN_ENUM_153: channel number 153
* @CHAN_ENUM_157: channel number 157
* @CHAN_ENUM_161: channel number 161
* @CHAN_ENUM_165: channel number 165
* @CHAN_ENUM_183: channel number 183
* @CHAN_ENUM_184: channel number 184
* @CHAN_ENUM_185: channel number 185
* @CHAN_ENUM_187: channel number 187
* @CHAN_ENUM_188: channel number 188
* @CHAN_ENUM_189: channel number 189
* @CHAN_ENUM_192: channel number 192
* @CHAN_ENUM_196: channel number 196
*/
enum channel_enum {
CHAN_ENUM_1,
CHAN_ENUM_2,
CHAN_ENUM_3,
CHAN_ENUM_4,
CHAN_ENUM_5,
CHAN_ENUM_6,
CHAN_ENUM_7,
CHAN_ENUM_8,
CHAN_ENUM_9,
CHAN_ENUM_10,
CHAN_ENUM_11,
CHAN_ENUM_12,
CHAN_ENUM_13,
CHAN_ENUM_14,
CHAN_ENUM_36,
CHAN_ENUM_40,
CHAN_ENUM_44,
CHAN_ENUM_48,
CHAN_ENUM_52,
CHAN_ENUM_56,
CHAN_ENUM_60,
CHAN_ENUM_64,
CHAN_ENUM_100,
CHAN_ENUM_104,
CHAN_ENUM_108,
CHAN_ENUM_112,
CHAN_ENUM_116,
CHAN_ENUM_120,
CHAN_ENUM_124,
CHAN_ENUM_128,
CHAN_ENUM_132,
CHAN_ENUM_136,
CHAN_ENUM_140,
CHAN_ENUM_144,
CHAN_ENUM_149,
CHAN_ENUM_153,
CHAN_ENUM_157,
CHAN_ENUM_161,
CHAN_ENUM_165,
CHAN_ENUM_183,
CHAN_ENUM_184,
CHAN_ENUM_185,
CHAN_ENUM_187,
CHAN_ENUM_188,
CHAN_ENUM_189,
CHAN_ENUM_192,
CHAN_ENUM_196,
NUM_CHANNELS,
MIN_24GHZ_CHANNEL = CHAN_ENUM_1,
MAX_24GHZ_CHANNEL = CHAN_ENUM_14,
NUM_24GHZ_CHANNELS = (MAX_24GHZ_CHANNEL - MIN_24GHZ_CHANNEL + 1),
MIN_5GHZ_CHANNEL = CHAN_ENUM_36,
MAX_5GHZ_CHANNEL = CHAN_ENUM_196,
NUM_5GHZ_CHANNELS = (MAX_5GHZ_CHANNEL - MIN_5GHZ_CHANNEL + 1),
MIN_49GHZ_CHANNEL = CHAN_ENUM_183,
MAX_49GHZ_CHANNEL = CHAN_ENUM_196,
INVALID_CHANNEL = 0xBAD,
};
/**
* enum country_src: country source
* @SOURCE_QUERY: source query
* @SOURCE_CORE: source regulatory core
* @SOURCE_DRIVER: source driver
* @SOURCE_USERSPACE: source userspace
* @SOURCE_11D: source 11D
*/
enum country_src {
SOURCE_UNKNOWN,
SOURCE_QUERY,
SOURCE_CORE,
SOURCE_DRIVER,
SOURCE_USERSPACE,
SOURCE_11D
};
/**
* struct regulatory: regulatory information
* @reg_domain: regulatory domain pair
* @eeprom_rd_ext: eeprom value
* @country_code: current country in integer
* @alpha2: current alpha2
* @def_country: default country alpha2
* @def_region: DFS region
* @ctl_2g: 2G CTL value
* @ctl_5g: 5G CTL value
* @reg_pair: pointer to regulatory pair
* @cc_src: country code src
* @reg_flags: kernel regulatory flags
*/
struct regulatory {
uint32_t reg_domain;
uint32_t eeprom_rd_ext;
uint16_t country_code;
uint8_t alpha2[REG_ALPHA2_LEN + 1];
uint8_t ctl_2g;
uint8_t ctl_5g;
const void *regpair;
enum country_src cc_src;
uint32_t reg_flags;
};
/**
* struct chan_map
* @start_ch: center frequency
* @chan_num: channel number
*/
struct chan_map {
uint32_t center_freq;
uint32_t chan_num;
};
/**
* struct bonded_channel
* @start_ch: start channel
* @end_ch: end channel
*/
struct bonded_channel {
uint16_t start_ch;
uint16_t end_ch;
};
/**
* enum ht_sec_ch_offset
* @NO_SEC_CH: no secondary
* @LOW_PRIMARY_CH: low primary
* @HIGH_PRIMARY_CH: high primary
*/
enum ht_sec_ch_offset {
NO_SEC_CH = 0,
LOW_PRIMARY_CH = 1,
HIGH_PRIMARY_CH = 3,
};
extern const struct chan_map channel_map[NUM_CHANNELS];
QDF_STATUS reg_get_channel_list_with_power(struct wlan_objmgr_psoc *psoc,
struct channel_power *ch_list,
uint8_t *num_chan);
void reg_read_default_country(struct wlan_objmgr_psoc *psoc,
uint8_t *country);
enum channel_state reg_get_channel_state(struct wlan_objmgr_psoc *psoc,
uint32_t ch);
enum channel_state reg_get_5g_bonded_channel_state(
struct wlan_objmgr_psoc *psoc,
uint8_t ch, enum phy_ch_width bw);
enum channel_state reg_get_2g_bonded_channel_state(
struct wlan_objmgr_psoc *psoc,
uint8_t oper_ch, uint8_t sec_ch,
enum phy_ch_width bw);
void reg_set_channel_params(struct wlan_objmgr_psoc *psoc,
uint8_t ch, struct ch_params_s *ch_params);
void reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
enum dfs_reg *dfs_reg);
bool reg_is_dfs_ch(struct wlan_objmgr_psoc *psoc, uint8_t ch);
QDF_STATUS reg_process_master_chan_list(struct cur_regulatory_info *reg_info);
QDF_STATUS wlan_regulatory_psoc_obj_created_notification(
struct wlan_objmgr_psoc *psoc,
void *arg_list);
QDF_STATUS wlan_regulatory_psoc_obj_destroyed_notification(
struct wlan_objmgr_psoc *psoc,
void *arg_list);
#endif

Visa fil

@@ -0,0 +1,100 @@
/*
* Copyright (c) 2017 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_public_struct.h
* This file contains regulatory data structures
*/
#ifndef __REG_SERVICES_PUBLIC_STRUCT_H_
#define __REG_SERVICES_PUBLIC_STRUCT_H_
#include "../../core/src/reg_db.h"
/**
* struct cur_regulatory_info
* @psoc: psoc ptr
* @alpha2: country alpha2
* @dfs_region: dfs region
* @phybitmap: phy bit map
* @min_bw_2g: minimum 2G bw
* @max_bw_2g: maximum 2G bw
* @min_bw_5g: minimum 5G bw
* @max_bw_5g: maximum 5G bw
* @num_2g_reg_rules: number 2G reg rules
* @num_5g_reg_rules: number 5G reg rules
* @reg_rules_2g_ptr: ptr to 2G reg rules
* @reg_rules_5g_ptr: ptr to 5G reg rules
*/
struct cur_regulatory_info {
struct wlan_objmgr_psoc *psoc;
uint8_t alpha2[REG_ALPHA2_LEN + 1];
enum dfs_reg dfs_region;
uint32_t phybitmap;
uint32_t min_bw_2g;
uint32_t max_bw_2g;
uint32_t min_bw_5g;
uint32_t max_bw_5g;
uint32_t num_2g_reg_rules;
uint32_t num_5g_reg_rules;
struct regulatory_rule *reg_rules_2g_ptr;
struct regulatory_rule *reg_rules_5g_ptr;
};
/**
* enum band_info
* @BAND_2G: 2G band
* @BAND_5G: 5G band
* @BAND_ALL: both bands
*/
enum band_info {
BAND_2G,
BAND_5G,
BAND_ALL,
};
/**
* struct reg_ini_vars
* @enable_11d_support: enable 11d support
* @userspace_ctry_priority: user priority
* @band_capability: band capability
* @dfs_disable: dfs disabled
* @indoor_channel_support: indoor channel support
*/
struct reg_ini_vars {
uint32_t enable_11d_support;
uint32_t userspace_ctry_priority;
enum band_info band_capability;
uint32_t dfs_disable;
uint32_t indoor_channel_support;
};
struct set_band_req {
enum band_info band;
uint32_t pdev_id;
};
struct country_info {
uint8_t country_code[REG_ALPHA2_LEN + 1];
};
struct reg_country_update {
uint8_t country_code[REG_ALPHA2_LEN + 1];
};
#endif

Visa fil

@@ -23,6 +23,13 @@
* regulatory component.
*/
#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_get_channel_list_with_power() - Provide the channel list with power
* @ch_list: pointer to the channel list.
@@ -40,7 +47,7 @@ QDF_STATUS wlan_reg_get_channel_list_with_power(struct wlan_objmgr_psoc *psoc,
* Return: None
*/
void wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
uint8_t *country);
uint8_t *country);
/**
* wlan_reg_get_channel_state() - Get channel state from regulatory
@@ -49,7 +56,7 @@ void wlan_reg_read_default_country(struct wlan_objmgr_psoc *psoc,
* Return: channel state
*/
enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_psoc *psoc,
uint32_t ch);
uint32_t ch);
/**
* wlan_reg_get_5g_bonded_channel_state() - Get 5G bonded channel state
@@ -59,8 +66,8 @@ enum channel_state wlan_reg_get_channel_state(struct wlan_objmgr_psoc *psoc,
* Return: channel state
*/
enum channel_state wlan_reg_get_5g_bonded_channel_state(
struct wlan_objmgr_psoc *psoc, uint8_t ch,
enum phy_ch_width bw);
struct wlan_objmgr_psoc *psoc, uint8_t ch,
enum phy_ch_width bw);
/**
* wlan_reg_get_2g_bonded_channel_state() - Get 2G bonded channel state
@@ -81,7 +88,7 @@ enum channel_state wlan_reg_get_2g_bonded_channel_state(
* Return: None
*/
void wlan_reg_set_channel_params(struct wlan_objmgr_psoc *psoc, uint8_t ch,
struct ch_params *ch_params);
struct ch_params_s *ch_params);
/**
* wlan_reg_get_dfs_region () - Get the current dfs region
@@ -90,7 +97,7 @@ void wlan_reg_set_channel_params(struct wlan_objmgr_psoc *psoc, uint8_t ch,
* Return: None
*/
void wlan_reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
enum dfs_region *dfs_reg);
enum dfs_reg *dfs_reg);
/**
* wlan_reg_is_dfs_ch () - Checks the channel state for DFS
@@ -99,3 +106,19 @@ void wlan_reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
* Return: true or false
*/
bool wlan_reg_is_dfs_ch(struct wlan_objmgr_psoc *psoc, uint8_t ch);
/**
* wlan_regulatory_init() - init regulatory component
*
* Return: Success or Failure
*/
QDF_STATUS wlan_regulatory_init(void);
/**
* wlan_regulatory_deinit() - deinit regulatory component
*
* Return: Success or Failure
*/
QDF_STATUS wlan_regulatory_deinit(void);
#endif

Visa fil

@@ -23,10 +23,14 @@
* interface routines
*/
#include "qdf_types.h"
#include "qdf_trace.h"
#ifndef __WLAN_REG_TGT_API_H
#define __WLAN_REG_TGT_API_H
QDF_STATUS tgt_reg_country_code_update_handler(void *handle, uint8_t *event,
uint32_t len);
QDF_STATUS tgt_reg_ch_list_update_handler(void *handle, uint8_t *event,
uint32_t len);
#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);
#endif

Visa fil

@@ -17,15 +17,19 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
#include <qdf_types.h>
#include <qdf_trace.h>
/**
* DOC: wlan_reg_ucfg_api.h
* This file provides prototypes of the regulatory component user
* config interface routines
*/
#ifndef __WLAN_REG_UCFG_API_H
#define __WLAN_REG_UCFG_API_H
#include <qdf_types.h>
#include <qdf_status.h>
#include <reg_services_public_struct.h>
typedef QDF_STATUS (*reg_event_cb)(void *status_struct);
QDF_STATUS ucfg_reg_set_band(uint8_t vdev_id, uint8_t pdev_id,
@@ -40,3 +44,5 @@ QDF_STATUS ucfg_reg_register_event_handler(uint8_t vdev_id, reg_event_cb cb,
QDF_STATUS ucfg_reg_unregister_event_handler(uint8_t vdev_id, reg_event_cb cb,
void *arg);
QDF_STATUS ucfg_reg_init_handler(uint8_t pdev_id);
#endif

Visa fil

@@ -22,16 +22,12 @@
* @brief contains regulatory service functions
*/
#include "qdf_types.h"
#include "qdf_status.h"
#include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_global_obj.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_pdev_obj.h"
#include "scheduler_api.h"
#include "reg_db.h"
#include "reg_services.h"
#include "wlan_reg_services_api.h"
#include <qdf_status.h>
#include <qdf_types.h>
#include <wlan_reg_services_api.h>
#include "../../core/src/reg_services.h"
#include "../../core/src/reg_priv.h"
/**
* wlan_reg_get_channel_list_with_power() - Provide the channel list with power
@@ -121,7 +117,7 @@ enum channel_state wlan_reg_get_2g_bonded_channel_state(
* Return: None
*/
void wlan_reg_set_channel_params(struct wlan_objmgr_psoc *psoc, uint8_t ch,
struct ch_params *ch_params)
struct ch_params_s *ch_params)
{
/*
* Set channel parameters like center frequency for a bonded channel
@@ -137,7 +133,7 @@ void wlan_reg_set_channel_params(struct wlan_objmgr_psoc *psoc, uint8_t ch,
* Return: None
*/
void wlan_reg_get_dfs_region(struct wlan_objmgr_psoc *psoc,
enum dfs_region *dfs_reg)
enum dfs_reg *dfs_reg)
{
/*
* Get the current dfs region
@@ -158,3 +154,69 @@ bool wlan_reg_is_dfs_ch(struct wlan_objmgr_psoc *psoc, uint8_t ch)
*/
return reg_is_dfs_ch(psoc, ch);
}
/**
* wlan_regulatory_init() - init regulatory component
*
* Return: Success or Failure
*/
QDF_STATUS wlan_regulatory_init(void)
{
QDF_STATUS status;
status = wlan_objmgr_register_psoc_create_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_created_notification, NULL);
if (status != QDF_STATUS_SUCCESS) {
reg_err("Failed to register reg obj create handler");
return status;
}
status = wlan_objmgr_register_psoc_destroy_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_destroyed_notification, NULL);
if (status != QDF_STATUS_SUCCESS) {
reg_err("Failed to register reg obj delete handler");
wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_created_notification,
NULL);
return status;
}
reg_info("regulatory handlers registered with obj mgr");
return QDF_STATUS_SUCCESS;
}
/**
* wlan_regulatory_deinit() - deinit regulatory component
*
* Return: Success or Failure
*/
QDF_STATUS wlan_regulatory_deinit(void)
{
QDF_STATUS status;
status = wlan_objmgr_unregister_psoc_create_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_created_notification,
NULL);
if (status != QDF_STATUS_SUCCESS)
reg_err("deregister fail for psoc create notif:%d",
status);
status = wlan_objmgr_unregister_psoc_destroy_handler(
WLAN_UMAC_COMP_REGULATORY,
wlan_regulatory_psoc_obj_destroyed_notification,
NULL);
if (status != QDF_STATUS_SUCCESS) {
reg_err("deregister fail for psoc delete notif:%d",
status);
return status;
}
reg_alert("deregistered callbacks with obj mgr successfully");
return QDF_STATUS_SUCCESS;
}

Visa fil

@@ -22,39 +22,19 @@
* @brief contains regulatory target interface definations
*/
#include "wlan_reg_tgt_api.h"
/**
* tgt_reg_country_code_update_handler() - tgt country code update handler
* @handle: pointer to the tgt handle
* @event: pointer to the event msg
* @len: event msg length
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_reg_country_code_update_handler(void *handle, uint8_t *event,
uint32_t len)
{
/*
* Convert the tlv/non tlv data to struct coutry_code_update
* and Post msg to target_if queue
*/
return 0;
}
#include <qdf_status.h>
#include <qdf_types.h>
#include <wlan_reg_tgt_api.h>
#include "../../core/src/reg_services.h"
/**
* tgt_reg_country_code_update_handler() - tgt country code update handler
* @handle: pointer to the tgt handle
* @event: pointer to the event msg
* @len: event msg length
* tgt_process_master_chan_list() - process master channel list
* @reg_info: regulatory info
*
* Return: QDF_STATUS
*/
QDF_STATUS tgt_reg_ch_list_update_handler(void *handle, uint8_t *event,
uint32_t len)
QDF_STATUS tgt_reg_process_master_chan_list(struct cur_regulatory_info
*reg_info)
{
/*
* Convert the tlv/non tlv data to struct ch_list_update
* and Post msg to target_if queue
*/
return 0;
return reg_process_master_chan_list(reg_info);
}

Visa fil

@@ -22,16 +22,9 @@
* @brief contains regulatory user config interface definations
*/
#include "qdf_types.h"
#include "qdf_status.h"
#include "wlan_objmgr_cmn.h"
#include "wlan_objmgr_global_obj.h"
#include "wlan_objmgr_psoc_obj.h"
#include "wlan_objmgr_pdev_obj.h"
#include "scheduler_api.h"
#include "reg_db.h"
#include "reg_services.h"
#include "wlan_reg_ucfg_api.h"
#include <wlan_reg_ucfg_api.h>
#include "../../core/src/reg_services.h"
/**
* ucfg_reg_set_band () - set band req handler
@@ -42,7 +35,7 @@
* Return: QDF_STATUS
*/
QDF_STATUS ucfg_reg_set_band(uint8_t vdev_id, uint8_t pdev_id,
struct set_band_req *req)
struct set_band_req *req)
{
/* Handle the set band request */
return QDF_STATUS_SUCCESS;
@@ -63,7 +56,7 @@ QDF_STATUS ucfg_reg_reset_country(uint8_t vdev_id, uint8_t pdev_id)
}
QDF_STATUS ucfg_reg_set_default_country(uint8_t vdev_id, uint8_t pdev_id,
struct country_info *cc_info)
struct country_info *cc_info)
{
/* sets the default country info */
return QDF_STATUS_SUCCESS;