qcacld-3.0: Add phy regulatory frequency range check

If phy regulatory capability doesn't support high or low
frequency indicated by MACRO such as HIGH_5GHZ_FREQ,
LOW_5GHZ_FREQ, we should not hard code to the MACRO.
The change adds new mlme API wlan_mlme_get_phy_max_freq_range
to get phy regulatory ranges from target info.

Change-Id: I95f48296ca093c20b1391d7657204eecfb418908
CRs-Fixed: 3376402
This commit is contained in:
Liangwei Dong
2023-01-10 15:24:17 +08:00
committed by Madan Koyyalamudi
szülő bea97be080
commit 4a18155583
4 fájl változott, egészen pontosan 140 új sor hozzáadva és 25 régi sor törölve

Fájl megtekintése

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. 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
@@ -3661,6 +3661,23 @@ QDF_STATUS mlme_clear_mcs_rate(struct wlan_objmgr_vdev *vdev);
*/
bool wlan_mlme_is_sta_mon_conc_supported(struct wlan_objmgr_psoc *psoc);
/**
* wlan_mlme_get_phy_max_freq_range() - Get phy supported max channel
* frequency range
* @psoc: psoc for country information
* @low_2ghz_chan: 2.4 GHz low channel frequency
* @high_2ghz_chan: 2.4 GHz high channel frequency
* @low_5ghz_chan: 5 GHz low channel frequency
* @high_5ghz_chan: 5 GHz high channel frequency
*
* Return: QDF status
*/
QDF_STATUS wlan_mlme_get_phy_max_freq_range(struct wlan_objmgr_psoc *psoc,
uint32_t *low_2ghz_chan,
uint32_t *high_2ghz_chan,
uint32_t *low_5ghz_chan,
uint32_t *high_5ghz_chan);
#ifdef FEATURE_WDS
/**
* wlan_mlme_get_wds_mode() - Check wds mode supported

Fájl megtekintése

@@ -138,6 +138,31 @@ uint8_t ucfg_get_tx_power(struct wlan_objmgr_psoc *psoc, uint8_t band)
return wlan_mlme_get_tx_power(psoc, band);
}
/**
* ucfg_mlme_get_phy_max_freq_range() - Get phy supported max channel
* frequency range
* @psoc: psoc for country information
* @low_2ghz_chan: 2.4 GHz low channel frequency
* @high_2ghz_chan: 2.4 GHz high channel frequency
* @low_5ghz_chan: 5 GHz low channel frequency
* @high_5ghz_chan: 5 GHz high channel frequency
*
* Return: QDF status
*/
static inline
QDF_STATUS ucfg_mlme_get_phy_max_freq_range(struct wlan_objmgr_psoc *psoc,
uint32_t *low_2ghz_chan,
uint32_t *high_2ghz_chan,
uint32_t *low_5ghz_chan,
uint32_t *high_5ghz_chan)
{
return wlan_mlme_get_phy_max_freq_range(psoc,
low_2ghz_chan,
high_2ghz_chan,
low_5ghz_chan,
high_5ghz_chan);
}
/**
* ucfg_mlme_get_ht_cap_info() - Get the HT cap info config
* @psoc: pointer to psoc object

Fájl megtekintése

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. 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
@@ -34,6 +34,7 @@
#include <../../core/src/wlan_cm_vdev_api.h>
#include "wlan_psoc_mlme_api.h"
#include "wlan_action_oui_main.h"
#include "target_if.h"
/* quota in milliseconds */
#define MCC_DUTY_CYCLE 70
@@ -5948,6 +5949,86 @@ bool mlme_get_user_ps(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id)
return usr_ps_enable;
}
QDF_STATUS wlan_mlme_get_phy_max_freq_range(struct wlan_objmgr_psoc *psoc,
uint32_t *low_2ghz_chan,
uint32_t *high_2ghz_chan,
uint32_t *low_5ghz_chan,
uint32_t *high_5ghz_chan)
{
uint32_t i;
uint32_t reg_low_2ghz_chan;
uint32_t reg_high_2ghz_chan;
uint32_t reg_low_5ghz_chan;
uint32_t reg_high_5ghz_chan;
struct target_psoc_info *info;
struct wlan_psoc_host_mac_phy_caps *mac_phy_cap;
struct wlan_psoc_host_hal_reg_cap_ext *reg_cap_ext;
info = wlan_psoc_get_tgt_if_handle(psoc);
if (!info) {
mlme_legacy_err("target_psoc_info is null");
return QDF_STATUS_E_FAILURE;
}
mac_phy_cap = info->info.mac_phy_cap;
reg_cap_ext = &mac_phy_cap->reg_cap_ext;
reg_low_2ghz_chan = reg_cap_ext->low_2ghz_chan;
reg_high_2ghz_chan = reg_cap_ext->high_2ghz_chan;
reg_low_5ghz_chan = reg_cap_ext->low_5ghz_chan;
reg_high_5ghz_chan = reg_cap_ext->high_5ghz_chan;
for (i = 1; i < PSOC_MAX_MAC_PHY_CAP; i++) {
mac_phy_cap = &info->info.mac_phy_cap[i];
reg_cap_ext = &mac_phy_cap->reg_cap_ext;
if (reg_cap_ext->low_2ghz_chan) {
reg_low_2ghz_chan = reg_low_2ghz_chan ?
QDF_MIN(reg_cap_ext->low_2ghz_chan,
reg_low_2ghz_chan) :
reg_cap_ext->low_2ghz_chan;
}
if (reg_cap_ext->high_2ghz_chan) {
reg_high_2ghz_chan = reg_high_2ghz_chan ?
QDF_MAX(reg_cap_ext->high_2ghz_chan,
reg_high_2ghz_chan) :
reg_cap_ext->high_2ghz_chan;
}
if (reg_cap_ext->low_5ghz_chan) {
reg_low_5ghz_chan = reg_low_5ghz_chan ?
QDF_MIN(reg_cap_ext->low_5ghz_chan,
reg_low_5ghz_chan) :
reg_cap_ext->low_5ghz_chan;
}
if (reg_cap_ext->high_5ghz_chan) {
reg_high_5ghz_chan = reg_high_5ghz_chan ?
QDF_MAX(reg_cap_ext->high_5ghz_chan,
reg_high_5ghz_chan) :
reg_cap_ext->high_5ghz_chan;
}
}
/* For old hw, no reg_cap_ext reported from service ready ext,
* fill the low/high with default of regulatory.
*/
if (!reg_low_2ghz_chan && !reg_high_2ghz_chan &&
!reg_low_5ghz_chan && !reg_high_5ghz_chan) {
mlme_legacy_debug("no reg_cap_ext in mac_phy_cap");
reg_low_2ghz_chan = TWOG_STARTING_FREQ - 10;
reg_high_2ghz_chan = TWOG_CHAN_14_IN_MHZ + 10;
reg_low_5ghz_chan = FIVEG_STARTING_FREQ - 10;
reg_high_5ghz_chan = SIXG_CHAN_233_IN_MHZ + 10;
}
if (!wlan_reg_is_6ghz_supported(psoc)) {
mlme_legacy_debug("disabling 6ghz channels");
reg_high_5ghz_chan = FIVEG_CHAN_177_IN_MHZ + 10;
}
mlme_legacy_debug("%d %d %d %d", reg_low_2ghz_chan, reg_high_2ghz_chan,
reg_low_5ghz_chan, reg_high_5ghz_chan);
*low_2ghz_chan = reg_low_2ghz_chan;
*high_2ghz_chan = reg_high_2ghz_chan;
*low_5ghz_chan = reg_low_5ghz_chan;
*high_5ghz_chan = reg_high_5ghz_chan;
return QDF_STATUS_SUCCESS;
}
#ifdef WLAN_FEATURE_P2P_P2P_STA
bool
wlan_mlme_get_p2p_p2p_conc_support(struct wlan_objmgr_psoc *psoc)