From a3e8c05e5325b89daf5227ec2a5da8ba2be1c1f1 Mon Sep 17 00:00:00 2001 From: Jyoti Kumari Date: Tue, 8 Dec 2020 20:08:13 +0530 Subject: [PATCH] qcacld-3.0: Use proper API to calculate opclass in OCI frame Operating class is not calculated properly due to which bandwidth is getting mismatched in OCI frame. Because of this ref sta is getting disconnected with SAP. Replace wlan_reg_dmn_get_opclass_from_channel() with lim_op_class_from_bandwidth() to calculate opclass. Change-Id: Ic1d7e59692362130bf1b8205585b5ecd182d4dff CRs-Fixed: 2806146 --- .../src/pe/lim/lim_send_management_frames.c | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) 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 d628e342bcab..456eacd6be23 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -5116,14 +5116,28 @@ static void lim_fill_oci_params(struct mac_context *mac, struct pe_session *session, tDot11fIEoci *oci) { - uint8_t country_code[CDS_COUNTRY_CODE_LEN + 1]; + uint8_t ch_offset; uint8_t prim_ch_num = wlan_reg_freq_to_chan(mac->pdev, session->curr_op_freq); - - wlan_reg_read_current_country(mac->psoc, country_code); - oci->op_class = wlan_reg_dmn_get_opclass_from_channel(country_code, - prim_ch_num, - session->ch_width); + if (session->ch_width == CH_WIDTH_80MHZ) { + ch_offset = BW80; + } else { + switch (session->htSecondaryChannelOffset) { + case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY: + ch_offset = BW40_HIGH_PRIMARY; + break; + case PHY_DOUBLE_CHANNEL_LOW_PRIMARY: + ch_offset = BW40_LOW_PRIMARY; + break; + default: + ch_offset = BW20; + break; + } + } + oci->op_class = lim_op_class_from_bandwidth(mac, + session->curr_op_freq, + session->ch_width, + ch_offset); oci->prim_ch_num = prim_ch_num; oci->freq_seg_1_ch_num = session->ch_center_freq_seg1; oci->present = 1;