qcacmn: Remove invalid channels from usable channel list for SAP/GO

There can be a possibility that some 6 GHz channels are enabled
for STA/CLI/NAN but disabled for SAP/GO. As part of get usable
channel list request there is no logic to validate if these 6 GHz
channels are disabled for SAP/GO, hence these channels are not
getting removed for get usable channel list request for SAP/GO.

To address this issue remove 6 GHz channels from usable channel
list, if frequency not valid for SAP/GO.

Change-Id: I8171f5d3e3747e28785e0515c87346cd53ff7712
CRs-Fixed: 3874255
This commit is contained in:
Asutosh Mohapatra 2024-07-16 07:35:11 -07:00 committed by Ravindra Konda
parent 608d3ddcb6
commit a674fdf613

View File

@ -3885,6 +3885,10 @@ reg_skip_invalid_chan_freq(struct wlan_objmgr_pdev *pdev,
bool include_indoor_channel, dfs_master_capable;
uint8_t enable_srd_chan, srd_mask = 0;
struct wlan_objmgr_psoc *psoc;
enum reg_6g_ap_type ap_pwr_type;
enum supported_6g_pwr_types ap_pwr_mode;
enum channel_state chan_state;
psoc = wlan_pdev_get_psoc(pdev);
if (!psoc) {
reg_err("invalid psoc");
@ -3911,6 +3915,17 @@ reg_skip_invalid_chan_freq(struct wlan_objmgr_pdev *pdev,
return status;
}
wlan_reg_get_cur_6g_ap_pwr_type(pdev, &ap_pwr_type);
if (ap_pwr_type == REG_INDOOR_AP)
ap_pwr_mode = REG_AP_LPI;
else if (ap_pwr_type == REG_STANDARD_POWER_AP)
ap_pwr_mode = REG_AP_SP;
else if (ap_pwr_type == REG_VERY_LOW_POWER_AP)
ap_pwr_mode = REG_AP_VLP;
else
ap_pwr_mode = REG_INVALID_PWR_MODE;
while (iface_mode_mask) {
if (iface_mode_mask & (1 << IFTYPE_AP)) {
srd_mask = 1;
@ -3923,6 +3938,7 @@ reg_skip_invalid_chan_freq(struct wlan_objmgr_pdev *pdev,
} else {
break;
}
for (chan_enum = 0; chan_enum < *no_usable_channels;
chan_enum++) {
if (iface_mode_mask & (1 << IFTYPE_NAN)) {
@ -3933,9 +3949,13 @@ reg_skip_invalid_chan_freq(struct wlan_objmgr_pdev *pdev,
if (!res_msg[chan_enum].iface_mode_mask)
reg_remove_freq(res_msg, chan_enum);
} else {
if (wlan_reg_is_freq_indoor(
chan_state = reg_get_channel_state_for_pwrmode(
pdev, res_msg[chan_enum].freq,
ap_pwr_mode);
if (!reg_is_state_allowed(chan_state) ||
(wlan_reg_is_freq_indoor(
pdev, res_msg[chan_enum].freq) &&
!include_indoor_channel) {
!include_indoor_channel)) {
res_msg[chan_enum].iface_mode_mask &=
~(iface_mode);
if (!res_msg[chan_enum].iface_mode_mask)