diff --git a/components/mlme/core/src/wlan_mlme_main.c b/components/mlme/core/src/wlan_mlme_main.c index fba9927b8f..de73d3ea20 100644 --- a/components/mlme/core/src/wlan_mlme_main.c +++ b/components/mlme/core/src/wlan_mlme_main.c @@ -1592,6 +1592,8 @@ static void mlme_init_sap_cfg(struct wlan_objmgr_psoc *psoc, cfg_get(psoc, CFG_IS_SAP_BCAST_DEAUTH_ENABLED); sap_cfg->is_6g_sap_fd_enabled = cfg_get(psoc, CFG_6G_SAP_FILS_DISCOVERY_ENABLED); + sap_cfg->disable_bcn_prot = + cfg_get(psoc, CFG_DISABLE_SAP_BCN_PROT); } static void mlme_init_obss_ht40_cfg(struct wlan_objmgr_psoc *psoc, diff --git a/components/mlme/dispatcher/inc/cfg_mlme_sap.h b/components/mlme/dispatcher/inc/cfg_mlme_sap.h index bd5187de4e..913c4643ed 100644 --- a/components/mlme/dispatcher/inc/cfg_mlme_sap.h +++ b/components/mlme/dispatcher/inc/cfg_mlme_sap.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-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 @@ -746,6 +746,28 @@ 0, \ "disable mcs13 support") +/* + * + * disable_sap_bcn_prot - Disable beacon protection for SAP + * @Min: 0 + * @Max: 1 + * @Default: 0 + * + * This ini is used to disable beacon protection in SAP only + * for non-6 GHz or non-11be cases where BP is not mandatory. + * + * Related: None + * + * Supported Feature: SAP + * + * Usage: External + * + * + */ +#define CFG_DISABLE_SAP_BCN_PROT CFG_INI_BOOL(\ + "disable_sap_bcn_prot", \ + "0", \ + "Disable beacon protection for SAP") #define CFG_SAP_ALL \ CFG_SAP_SAE \ CFG(CFG_AP_ENABLE_RANDOM_BSSID) \ @@ -780,6 +802,7 @@ CFG(CFG_GO_11AC_OVERRIDE) \ CFG(CFG_IS_SAP_BCAST_DEAUTH_ENABLED) \ CFG(CFG_6G_SAP_FILS_DISCOVERY_ENABLED) \ - CFG(CFG_DISABLE_MCS13_SUPPORT) + CFG(CFG_DISABLE_MCS13_SUPPORT) \ + CFG(CFG_DISABLE_SAP_BCN_PROT) #endif /* __CFG_MLME_SAP_H */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 3c88094566..fe404468e6 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -4173,4 +4173,14 @@ QDF_STATUS wlan_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc, uint32_t *periodic_display_time); +/** + * wlan_mlme_is_bcn_prot_disabled_for_sap() - Is beacon protection config + * disabled for SAP interface + * + * @psoc: pointer to psoc object + * + * Return: is beacon protection disabled + */ +bool +wlan_mlme_is_bcn_prot_disabled_for_sap(struct wlan_objmgr_psoc *psoc); #endif /* _WLAN_MLME_API_H_ */ diff --git a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h index b390cfdc13..4541f57eae 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_public_struct.h @@ -742,6 +742,7 @@ struct wlan_mlme_wps_params { * @sap_sae_enabled: enable sae in sap mode * @is_sap_bcast_deauth_enabled: enable bcast deauth for sap * @is_6g_sap_fd_enabled: enable fils discovery on sap + * @disable_bcn_prot: disable beacon protection for sap */ struct wlan_mlme_cfg_sap { uint16_t beacon_interval; @@ -777,6 +778,7 @@ struct wlan_mlme_cfg_sap { bool sap_sae_enabled; bool is_sap_bcast_deauth_enabled; bool is_6g_sap_fd_enabled; + bool disable_bcn_prot; }; /** diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index 35940a89f5..c7d0c7d2d0 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -6663,3 +6663,15 @@ wlan_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } + +bool +wlan_mlme_is_bcn_prot_disabled_for_sap(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) + return cfg_default(CFG_DISABLE_SAP_BCN_PROT); + + return mlme_obj->cfg.sap_cfg.disable_bcn_prot; +} diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h index 42911bc54b..2231d42556 100644 --- a/core/mac/src/include/parser_api.h +++ b/core/mac/src/include/parser_api.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-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 @@ -1822,4 +1822,20 @@ void populate_dot11f_rnr_tbtt_info_7(struct mac_context *mac_ctx, void populate_dot11f_edca_pifs_param_set( struct mac_context *mac, tDot11fIEqcn_ie *qcn_ie); + +/** + * populate_dot11f_bcn_prot_caps() - populate Beacon protection extended caps + * + * @mac_ctx: Global MAC context. + * @pe_session: Pointer to the PE session. + * @dot11f: Pointer to the extended capabilities of the session. + * + * Populate the Beacon protection extended capabilities based on the target and + * INI support. + * + * Return: QDF_STATUS Success or Failure + */ +QDF_STATUS populate_dot11f_bcn_prot_extcaps(struct mac_context *mac_ctx, + struct pe_session *pe_session, + tDot11fIEExtCap *dot11f); #endif /* __PARSE_H__ */ diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 04d701bf06..30bae66caa 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -1021,6 +1021,7 @@ lim_send_probe_rsp_mgmt_frame(struct mac_context *mac_ctx, if (extracted_ext_cap_flag) lim_merge_extcap_struct(&frm->ExtCap, &extracted_ext_cap, true); + populate_dot11f_bcn_prot_extcaps(mac_ctx, pe_session, &frm->ExtCap); status = dot11f_get_packed_probe_response_size(mac_ctx, frm, &payload); if (DOT11F_FAILED(status)) { @@ -1884,7 +1885,7 @@ lim_send_assoc_rsp_mgmt_frame(struct mac_context *mac_ctx, if (extracted_flag) lim_merge_extcap_struct(&(frm.ExtCap), &extracted_ext_cap, true); - + populate_dot11f_bcn_prot_extcaps(mac_ctx, pe_session, &(frm.ExtCap)); if (sta && lim_is_sta_eht_capable(sta) && lim_is_mlo_conn(pe_session, sta) && lim_is_session_eht_capable(pe_session) && diff --git a/core/mac/src/pe/sch/sch_api.c b/core/mac/src/pe/sch/sch_api.c index 9d96236644..b42da1f6a3 100644 --- a/core/mac/src/pe/sch/sch_api.c +++ b/core/mac/src/pe/sch/sch_api.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2011-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 @@ -774,10 +774,13 @@ uint32_t lim_send_probe_rsp_template_to_hal(struct mac_context *mac, * dot11f get packed payload size. */ prb_rsp_frm = &pe_session->probeRespFrame; - if (extcap_present) + if (extcap_present) { lim_merge_extcap_struct(&prb_rsp_frm->ExtCap, &extracted_extcap, true); + populate_dot11f_bcn_prot_extcaps(mac, pe_session, + &prb_rsp_frm->ExtCap); + } nStatus = dot11f_get_packed_probe_response_size(mac, &pe_session->probeRespFrame, &nPayload); diff --git a/core/mac/src/pe/sch/sch_beacon_gen.c b/core/mac/src/pe/sch/sch_beacon_gen.c index 7faaa27389..b7b9451a56 100644 --- a/core/mac/src/pe/sch/sch_beacon_gen.c +++ b/core/mac/src/pe/sch/sch_beacon_gen.c @@ -1,6 +1,6 @@ /* * Copyright (c) 2012-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 @@ -894,10 +894,13 @@ sch_set_fixed_beacon_fields(struct mac_context *mac_ctx, struct pe_session *sess pe_debug("extcap not extracted"); } /* merge extcap IE */ - if (extcap_present) + if (extcap_present) { lim_merge_extcap_struct(&bcn_2->ExtCap, &extracted_extcap, true); + populate_dot11f_bcn_prot_extcaps(mac_ctx, session, + &bcn_2->ExtCap); + } } if (session->vhtCapability && session->gLimOperatingMode.present) { diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index e0deb7c90a..849e403556 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -11896,4 +11896,34 @@ void populate_dot11f_6g_rnr(struct mac_context *mac_ctx, wlan_vdev_get_id(co_session->vdev), dot11f->op_class, dot11f->channel_num); } + +QDF_STATUS populate_dot11f_bcn_prot_extcaps(struct mac_context *mac_ctx, + struct pe_session *pe_session, + tDot11fIEExtCap *dot11f) +{ + struct s_ext_cap *p_ext_cap; + + /* + * Some legacy STA might not connect with SAP broadcasting + * EXTCAP with size greater than 8bytes. + * In such cases, disable the beacon protection only if + * a) disable_sap_bcn_prot ini is set + * b) The SAP is not operating in 6 GHz or 11be profile + * where BP is mandatory. + */ + if (pe_session->opmode != QDF_SAP_MODE || + !wlan_mlme_is_bcn_prot_disabled_for_sap(mac_ctx->psoc) || + WLAN_REG_IS_6GHZ_CHAN_FREQ(pe_session->curr_op_freq) || + pe_session->dot11mode > MLME_DOT11_MODE_11AX_ONLY) + return QDF_STATUS_SUCCESS; + + p_ext_cap = (struct s_ext_cap *)dot11f->bytes; + if (!dot11f->present || !p_ext_cap->beacon_protection_enable) + return QDF_STATUS_SUCCESS; + + p_ext_cap->beacon_protection_enable = 0; + dot11f->num_bytes = lim_compute_ext_cap_ie_length(dot11f); + + return QDF_STATUS_SUCCESS; +} /* parser_api.c ends here. */