qcacld-3.0: Add 320MHz support for SAP module

As part of 11BE 320MHz bandwidth support, add 320MHz support for
SAP module, including 320MHz ACS support.

Change-Id: If26d9e62b16bbecbb1ea10c70f42e9a8464a70c7
CRs-Fixed: 2935873
This commit is contained in:
Jia Ding
2021-03-02 14:49:43 +08:00
committed by Madan Koyyalamudi
parent ecc86fe2c6
commit 96a5992852
3 changed files with 280 additions and 1 deletions

View File

@@ -82,6 +82,18 @@
* Function Declarations and Documentation
* -------------------------------------------------------------------------*/
#ifdef WLAN_FEATURE_11BE
static inline bool sap_acs_cfg_is_chwidth_320mhz(uint16_t width)
{
return width == CH_WIDTH_320MHZ;
}
#else
static inline bool sap_acs_cfg_is_chwidth_320mhz(uint16_t width)
{
return false;
}
#endif
/**
* sap_config_acs_result : Generate ACS result params based on ch constraints
* @sap_ctx: pointer to SAP context data struct
@@ -114,7 +126,8 @@ void sap_config_acs_result(mac_handle_t mac_handle,
sap_ctx->acs_cfg->vht_seg0_center_ch_freq = 0;
if (sap_ctx->acs_cfg->ch_width == CH_WIDTH_80P80MHZ ||
(sap_ctx->acs_cfg->ch_width == CH_WIDTH_160MHZ))
(sap_ctx->acs_cfg->ch_width == CH_WIDTH_160MHZ) ||
sap_acs_cfg_is_chwidth_320mhz(sap_ctx->acs_cfg->ch_width))
sap_ctx->acs_cfg->vht_seg1_center_ch_freq =
ch_params.mhz_freq_seg1;
else

View File

@@ -1826,6 +1826,242 @@ static void sap_sort_chl_weight_160_mhz(struct mac_context *mac_ctx,
}
}
#ifdef WLAN_FEATURE_11BE
/**
* sap_sort_chl_weight_320_mhz() - to sort the channels with the least weight
* @pSpectInfoParams: Pointer to the tSapChSelSpectInfo structure
*
* Function to sort the channels with the least weight first for 320MHz channels
*
* Return: none
*/
static void sap_sort_chl_weight_320_mhz(struct mac_context *mac_ctx,
tSapChSelSpectInfo *pSpectInfoParams)
{
uint8_t i, j;
tSapSpectChInfo *pSpectInfo;
uint8_t minIdx;
struct ch_params acs_ch_params;
int8_t center_freq_diff;
uint32_t combined_weight;
uint32_t min_ch_weight;
pSpectInfo = pSpectInfoParams->pSpectCh;
for (j = 0; j < pSpectInfoParams->numSpectChans; j++) {
if (pSpectInfo[j].weight_calc_done)
continue;
acs_ch_params.ch_width = CH_WIDTH_320MHZ;
wlan_reg_set_channel_params_for_freq(mac_ctx->pdev,
pSpectInfo[j].chan_freq,
0, &acs_ch_params);
/* Check if the freq supports 320 Mhz */
if (acs_ch_params.ch_width != CH_WIDTH_320MHZ) {
pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j].weight_calc_done = true;
continue;
}
center_freq_diff = acs_ch_params.mhz_freq_seg1 -
pSpectInfo[j].chan_freq;
/* This channel frequency does not have all channels */
if (center_freq_diff != 150) {
pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j].weight_calc_done = true;
continue;
}
/* no other freq left for 320 Mhz operation in spectrum */
if (j + 15 > pSpectInfoParams->numSpectChans)
continue;
/* Check whether all frequencies are present for 160 Mhz */
if (!(((pSpectInfo[j].chan_freq + 20) ==
pSpectInfo[j + 1].chan_freq) &&
((pSpectInfo[j].chan_freq + 40) ==
pSpectInfo[j + 2].chan_freq) &&
((pSpectInfo[j].chan_freq + 60) ==
pSpectInfo[j + 3].chan_freq) &&
((pSpectInfo[j].chan_freq + 80) ==
pSpectInfo[j + 4].chan_freq) &&
((pSpectInfo[j].chan_freq + 100) ==
pSpectInfo[j + 5].chan_freq) &&
((pSpectInfo[j].chan_freq + 120) ==
pSpectInfo[j + 6].chan_freq) &&
((pSpectInfo[j].chan_freq + 140) ==
pSpectInfo[j + 7].chan_freq) &&
((pSpectInfo[j].chan_freq + 160) ==
pSpectInfo[j + 8].chan_freq) &&
((pSpectInfo[j].chan_freq + 180) ==
pSpectInfo[j + 9].chan_freq) &&
((pSpectInfo[j].chan_freq + 200) ==
pSpectInfo[j + 10].chan_freq) &&
((pSpectInfo[j].chan_freq + 220) ==
pSpectInfo[j + 11].chan_freq) &&
((pSpectInfo[j].chan_freq + 240) ==
pSpectInfo[j + 12].chan_freq) &&
((pSpectInfo[j].chan_freq + 260) ==
pSpectInfo[j + 13].chan_freq) &&
((pSpectInfo[j].chan_freq + 280) ==
pSpectInfo[j + 14].chan_freq) &&
((pSpectInfo[j].chan_freq + 300) ==
pSpectInfo[j + 15].chan_freq))) {
/*
* some channels does not exist in pSectInfo array,
* skip this channel and those in the same ETH320 width
*/
pSpectInfo[j].weight = SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j].weight_calc_done = true;
if ((pSpectInfo[j].chan_freq + 20) ==
pSpectInfo[j + 1].chan_freq) {
pSpectInfo[j + 1].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 1].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 40) ==
pSpectInfo[j + 2].chan_freq) {
pSpectInfo[j + 2].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 2].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 60) ==
pSpectInfo[j + 3].chan_freq) {
pSpectInfo[j + 3].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 3].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 80) ==
pSpectInfo[j + 4].chan_freq) {
pSpectInfo[j + 4].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 4].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 100) ==
pSpectInfo[j + 5].chan_freq) {
pSpectInfo[j + 5].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 5].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 120) ==
pSpectInfo[j + 6].chan_freq) {
pSpectInfo[j + 6].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 6].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 140) ==
pSpectInfo[j + 7].chan_freq) {
pSpectInfo[j + 7].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 7].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 160) ==
pSpectInfo[j + 8].chan_freq) {
pSpectInfo[j + 8].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 8].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 180) ==
pSpectInfo[j + 9].chan_freq) {
pSpectInfo[j + 9].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 9].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 200) ==
pSpectInfo[j + 10].chan_freq) {
pSpectInfo[j + 10].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 10].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 220) ==
pSpectInfo[j + 11].chan_freq) {
pSpectInfo[j + 11].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 11].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 240) ==
pSpectInfo[j + 12].chan_freq) {
pSpectInfo[j + 12].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 12].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 260) ==
pSpectInfo[j + 13].chan_freq) {
pSpectInfo[j + 13].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 13].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 280) ==
pSpectInfo[j + 14].chan_freq) {
pSpectInfo[j + 14].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 14].weight_calc_done = true;
}
if ((pSpectInfo[j].chan_freq + 300) ==
pSpectInfo[j + 15].chan_freq) {
pSpectInfo[j + 15].weight =
SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + 15].weight_calc_done = true;
}
continue;
}
/* We have 16 channels to calculate cumulative weight */
combined_weight = pSpectInfo[j].weight +
pSpectInfo[j + 1].weight +
pSpectInfo[j + 2].weight +
pSpectInfo[j + 3].weight +
pSpectInfo[j + 4].weight +
pSpectInfo[j + 5].weight +
pSpectInfo[j + 6].weight +
pSpectInfo[j + 7].weight +
pSpectInfo[j + 8].weight +
pSpectInfo[j + 9].weight +
pSpectInfo[j + 10].weight +
pSpectInfo[j + 11].weight +
pSpectInfo[j + 12].weight +
pSpectInfo[j + 13].weight +
pSpectInfo[j + 14].weight +
pSpectInfo[j + 15].weight;
min_ch_weight = pSpectInfo[j].weight;
minIdx = 0;
for (i = 0; i < 16; i++) {
if (min_ch_weight > pSpectInfo[j + i].weight) {
min_ch_weight = pSpectInfo[j + i].weight;
minIdx = i;
}
pSpectInfo[j + i].weight = SAP_ACS_WEIGHT_MAX * 16;
pSpectInfo[j + i].weight_calc_done = true;
}
pSpectInfo[j + minIdx].weight = combined_weight;
sap_debug("best freq = %d for 320mhz center freq %d combined weight = %d",
pSpectInfo[j + minIdx].chan_freq,
acs_ch_params.mhz_freq_seg1,
combined_weight);
}
sap_sort_chl_weight(pSpectInfoParams);
pSpectInfo = pSpectInfoParams->pSpectCh;
for (j = 0; j < (pSpectInfoParams->numSpectChans); j++) {
sap_debug_rl("freq = %d weight = %d rssi = %d bss count = %d",
pSpectInfo->chan_freq, pSpectInfo->weight,
pSpectInfo->rssiAgr, pSpectInfo->bssCount);
pSpectInfo++;
}
}
#endif /* WLAN_FEATURE_11BE */
/**
* sap_allocate_max_weight_ht40_24_g() - allocate max weight for 40Mhz
* to all 2.4Ghz channels
@@ -2182,6 +2418,11 @@ static void sap_sort_chl_weight_all(struct mac_context *mac_ctx,
case CH_WIDTH_160MHZ:
sap_sort_chl_weight_160_mhz(mac_ctx, pSpectInfoParams);
break;
#ifdef WLAN_FEATURE_11BE
case CH_WIDTH_320MHZ:
sap_sort_chl_weight_320_mhz(mac_ctx, pSpectInfoParams);
break;
#endif
case CH_WIDTH_20MHZ:
default:
/* Sorting the channels as per weights as 20MHz channels */

View File

@@ -1225,6 +1225,27 @@ QDF_STATUS wlansap_deauth_sta(struct sap_context *sap_ctx,
params);
}
#ifdef WLAN_FEATURE_11BE
static enum phy_ch_width
wlansap_get_target_eht_phy_ch_width(void)
{
uint32_t max_fw_bw = sme_get_eht_ch_width();
if (max_fw_bw == WNI_CFG_EHT_CHANNEL_WIDTH_160MHZ)
return CH_WIDTH_160MHZ;
else if (max_fw_bw == WNI_CFG_EHT_CHANNEL_WIDTH_320MHZ)
return CH_WIDTH_320MHZ;
else
return CH_WIDTH_80MHZ;
}
#else /* !WLAN_FEATURE_11BE */
static enum phy_ch_width
wlansap_get_target_eht_phy_ch_width(void)
{
return CH_WIDTH_20MHZ;
}
#endif /* WLAN_FEATURE_11BE */
enum phy_ch_width
wlansap_get_csa_chanwidth_from_phymode(struct sap_context *sap_context,
uint32_t chan_freq,
@@ -1260,6 +1281,10 @@ wlansap_get_csa_chanwidth_from_phymode(struct sap_context *sap_context,
ch_width = CH_WIDTH_160MHZ;
else
ch_width = CH_WIDTH_80MHZ;
ch_width = QDF_MAX(
wlansap_get_target_eht_phy_ch_width(),
ch_width);
} else if (sap_context->csr_roamProfile.phyMode ==
eCSR_DOT11_MODE_11n ||
sap_context->csr_roamProfile.phyMode ==