From 8570f5c3f5ec95083c3198e7b4780df9c0356639 Mon Sep 17 00:00:00 2001 From: Sai Pavan Akhil Remella Date: Tue, 22 Feb 2022 00:08:05 +0530 Subject: [PATCH 1/5] qcacmn: Use global OC table for lookup while updating RNR db Operating class field used in RNR IE is of global operating class. When getting frequency from RNR IE region specific operating class is used for lookup instead of global. Added changes to search operating class from global OC table. Change-Id: I200ab46187fed91cc66cd954b062c8d8ac44f631 CRs-Fixed: 3131600 --- umac/scan/core/src/wlan_scan_cache_db.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/umac/scan/core/src/wlan_scan_cache_db.c b/umac/scan/core/src/wlan_scan_cache_db.c index edf276c0191f..05e87bb3f809 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.c +++ b/umac/scan/core/src/wlan_scan_cache_db.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -132,7 +133,7 @@ static void scm_add_rnr_channel_db(struct wlan_objmgr_psoc *psoc, continue; chan_freq = wlan_reg_chan_opclass_to_freq(rnr_bss->channel_number, rnr_bss->operating_class, - false); + true); channel = scm_get_chan_meta(psoc, chan_freq); if (!channel) { scm_debug("Failed to get chan Meta freq %d", chan_freq); From 8e8bcdca6422700f02f6ae1396cd1221c86c7d88 Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Mon, 7 Mar 2022 09:54:27 +0800 Subject: [PATCH 2/5] qcacmn: fetch profile_data from right position Since structure wmi_wlan_profile_t includes tlv header, it has to consider the tlv header in each iteration. Change-Id: I2928f89a14646fceb93729f508b817c173eff1a2 CRs-Fixed: 3136679 --- wmi/src/wmi_unified_tlv.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 23487b0be26b..8e72ec1519df 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -10695,7 +10696,6 @@ static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, { WMI_WLAN_PROFILE_DATA_EVENTID_param_tlvs *param_buf; wmi_wlan_profile_t *ev; - uint8_t *buf_ptr; param_buf = (WMI_WLAN_PROFILE_DATA_EVENTID_param_tlvs *)evt_buf; if (!param_buf) { @@ -10703,12 +10703,7 @@ static QDF_STATUS extract_profile_data_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_E_INVAL; } - buf_ptr = (uint8_t *)param_buf->profile_ctx; - buf_ptr = buf_ptr + sizeof(wmi_wlan_profile_ctx_t) + WMI_TLV_HDR_SIZE; - - buf_ptr = buf_ptr + (sizeof(wmi_wlan_profile_t) * idx); - ev = (wmi_wlan_profile_t *)buf_ptr; - + ev = ¶m_buf->profile_data[idx]; profile_data->id = ev->id; profile_data->cnt = ev->cnt; profile_data->tot = ev->tot; From 48de2db910fac9ce50a54ae91b121ff2a2d8a358 Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Thu, 17 Feb 2022 11:58:08 +0530 Subject: [PATCH 3/5] qcacmn: Add support for tx flags for packet capture mode Fill tx flags in radiotap header based on tx status for tx packets capture in packet capture component. Change-Id: I52da01a2c0677d32bfb05a1f3095a0e6df084fca CRs-Fixed: 3132140 --- qdf/linux/src/qdf_nbuf.c | 57 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/qdf/linux/src/qdf_nbuf.c b/qdf/linux/src/qdf_nbuf.c index 9340d33d774c..1b9889112d3f 100644 --- a/qdf/linux/src/qdf_nbuf.c +++ b/qdf/linux/src/qdf_nbuf.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2014-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -72,6 +73,10 @@ #define RADIOTAP_VHT_BW_80 4 #define RADIOTAP_VHT_BW_160 11 +/* tx status */ +#define RADIOTAP_TX_STATUS_FAIL 1 +#define RADIOTAP_TX_STATUS_NOACK 2 + /* channel number to freq conversion */ #define CHANNEL_NUM_14 14 #define CHANNEL_NUM_15 15 @@ -4437,6 +4442,7 @@ qdf_nbuf_update_radiotap_he_mu_other_flags(struct mon_rx_status *rx_status, * Number after '+' indicates maximum possible increase due to alignment */ +#define RADIOTAP_TX_FLAGS_LEN (2 + 1) #define RADIOTAP_VHT_FLAGS_LEN (12 + 1) #define RADIOTAP_HE_FLAGS_LEN (12 + 1) #define RADIOTAP_HE_MU_FLAGS_LEN (8 + 1) @@ -4455,6 +4461,7 @@ qdf_nbuf_update_radiotap_he_mu_other_flags(struct mon_rx_status *rx_status, (sizeof(struct qdf_radiotap_ext2)) #define RADIOTAP_HEADER_LEN (sizeof(struct ieee80211_radiotap_header) + \ RADIOTAP_FIXED_HEADER_LEN + \ + RADIOTAP_TX_FLAGS_LEN + \ RADIOTAP_HT_FLAGS_LEN + \ RADIOTAP_VHT_FLAGS_LEN + \ RADIOTAP_AMPDU_STATUS_LEN + \ @@ -4512,6 +4519,41 @@ static unsigned int qdf_nbuf_update_radiotap_ampdu_flags( (rx_status->rssi_comb + rx_status->chan_noise_floor) #endif +/** + * qdf_nbuf_update_radiotap_tx_flags() - Update radiotap header tx flags + * @rx_status: Pointer to rx_status. + * @rtap_buf: Buf to which tx info has to be updated. + * @rtap_len: Current length of radiotap buffer + * + * Return: Length of radiotap after tx flags updated. + */ +static unsigned int qdf_nbuf_update_radiotap_tx_flags( + struct mon_rx_status *rx_status, + uint8_t *rtap_buf, + uint32_t rtap_len) +{ + /* + * IEEE80211_RADIOTAP_TX_FLAGS u16 + */ + + uint16_t tx_flags = 0; + + rtap_len = qdf_align(rtap_len, 2); + + switch (rx_status->tx_status) { + case RADIOTAP_TX_STATUS_FAIL: + tx_flags |= IEEE80211_RADIOTAP_F_TX_FAIL; + break; + case RADIOTAP_TX_STATUS_NOACK: + tx_flags |= IEEE80211_RADIOTAP_F_TX_NOACK; + break; + } + put_unaligned_le16(tx_flags, &rtap_buf[rtap_len]); + rtap_len += 2; + + return rtap_len; +} + /** * qdf_nbuf_update_radiotap() - Update radiotap header from rx_status * @rx_status: Pointer to rx_status. @@ -4605,6 +4647,21 @@ unsigned int qdf_nbuf_update_radiotap(struct mon_rx_status *rx_status, return 0; } + /* update tx flags for pkt capture*/ + if (rx_status->add_rtap_ext) { + length = rtap_len; + rthdr->it_present |= + cpu_to_le32(1 << IEEE80211_RADIOTAP_TX_FLAGS); + rtap_len = qdf_nbuf_update_radiotap_tx_flags(rx_status, + rtap_buf, + rtap_len); + + if ((rtap_len - length) > RADIOTAP_TX_FLAGS_LEN) { + qdf_print("length is greater than RADIOTAP_TX_FLAGS_LEN"); + return 0; + } + } + if (rx_status->ht_flags) { length = rtap_len; /* IEEE80211_RADIOTAP_VHT u8, u8, u8 */ From e2e7af2eafb95ffc22a06fd303281c3929b326b7 Mon Sep 17 00:00:00 2001 From: chunquan Date: Fri, 25 Feb 2022 10:10:32 +0800 Subject: [PATCH 4/5] qcacmn: Fetch thermal_stats in array range Since lvl_idx maybe get value large than param_buf->num_temp_range_stats, then out of bounds will happen when read array of wmi_tt_stats. Change-Id: I85b29216272952102dca41792c290baf285a8e31 CRs-Fixed: 3136333 --- wmi/src/wmi_unified_tlv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 8e72ec1519df..5ee0bf55b03d 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -11500,6 +11500,13 @@ populate_thermal_stats(WMI_THERM_THROT_STATS_EVENTID_param_tlvs *param_buf, WMI_THERMAL_STATS_TEMP_THRESH_LEVEL_MAX : tt_stats_event->therm_throt_levels; + if (*therm_throt_levels > param_buf->num_temp_range_stats) { + wmi_err("therm_throt_levels:%u oob num_temp_range_stats:%u", + *therm_throt_levels, + param_buf->num_temp_range_stats); + return; + } + wmi_tt_stats = param_buf->temp_range_stats; if (!wmi_tt_stats) { wmi_err("wmi_tt_stats Null"); From 557abe142625494d3e1c9bb2f109c45f82d7b9a1 Mon Sep 17 00:00:00 2001 From: Vulupala Shashank Reddy Date: Sat, 11 Dec 2021 21:06:12 +0530 Subject: [PATCH 5/5] qcacmn: Fix TWT rx frames capture in packet capture mode Currently the TWT rx frames are dropped in tgt_mgmt_txrx_rx_frame_handler considering them as unspecified packets as action category for TWT is not defined. Define TWT action category so that the TWT frames will not be considered as unspecified frames and dropped while processing. Change-Id: I2d9c01e89029bcbb379a5a9c77a7d101de155d6a CRs-Fixed: 3087275 --- .../dispatcher/inc/wlan_mgmt_txrx_utils_api.h | 19 ++++++++++ .../dispatcher/src/wlan_mgmt_txrx_tgt_api.c | 37 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h b/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h index eced22e3cc70..907f628d3999 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h +++ b/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -142,6 +143,7 @@ enum mgmt_action_category { ACTION_CATEGORY_RVS = 19, ACTION_CATEGORY_UNPROT_DMG = 20, ACTION_CATEGORY_VHT = 21, + ACTION_CATEGORY_USIG = 22, ACTION_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, ACTION_CATEGORY_VENDOR_SPECIFIC = 127, }; @@ -471,6 +473,17 @@ enum vht_actioncode { VHT_ACTION_OPMODE_NOTIF, }; +/** + * enum twt_actioncode - twt action frames + * @TWT_SETUP: twt set up action frame + * @TWT_INFORMATION: twt information action frame + */ +enum twt_actioncode { + TWT_SETUP = 6, + TWT_TEARDOWN = 7, + TWT_INFORMATION = 11, +}; + /** * struct action_frm_hdr - action frame header * @action_category: action category @@ -601,6 +614,9 @@ struct action_frm_hdr { * @MGMT_ACTION_MCSC_RSP: MCSC response frame * @MGMT_FRAME_TYPE_ALL: mgmt frame type for all type of frames * @MGMT_CTRL_FRAME: Control Frames + * @MGMT_ACTION_TWT_SETUP: TWT setup frame + * @MGMT_ACTION_TWT_TEARDOWN: TWT teardown frame + * @MGMT_ACTION_TWT_INFORMATION: TWT information frame * @MGMT_MAX_FRAME_TYPE: max. mgmt frame types */ enum mgmt_frame_type { @@ -726,6 +742,9 @@ enum mgmt_frame_type { MGMT_ACTION_MCSC_RSP, MGMT_FRAME_TYPE_ALL, MGMT_CTRL_FRAME, + MGMT_ACTION_TWT_SETUP, + MGMT_ACTION_TWT_TEARDOWN, + MGMT_ACTION_TWT_INFORMATION, MGMT_MAX_FRAME_TYPE, }; diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c index 7c85bfab2f95..1f5dc3e8b2a7 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c +++ b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_tgt_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2022 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 @@ -756,6 +757,38 @@ mgmt_get_rvs_action_subtype(uint8_t action_code) return frm_type; } +/** + * mgmt_get_twt_action_subtype() - gets twt action subtype + * @action_code: action code + * + * This function returns the subtype for twt action + * category. + * + * Return: mgmt frame type + */ +static enum mgmt_frame_type +mgmt_get_twt_action_subtype(uint8_t action_code) +{ + enum mgmt_frame_type frm_type; + + switch (action_code) { + case TWT_SETUP: + frm_type = MGMT_ACTION_TWT_SETUP; + break; + case TWT_TEARDOWN: + frm_type = MGMT_ACTION_TWT_TEARDOWN; + break; + case TWT_INFORMATION: + frm_type = MGMT_ACTION_TWT_INFORMATION; + break; + default: + frm_type = MGMT_FRM_UNSPECIFIED; + break; + } + + return frm_type; +} + /** * mgmt_txrx_get_action_frm_subtype() - gets action frm subtype * @mpdu_data_ptr: pointer to mpdu data @@ -839,6 +872,10 @@ mgmt_txrx_get_action_frm_subtype(uint8_t *mpdu_data_ptr) frm_type = mgmt_get_rvs_action_subtype(action_hdr->action_code); break; + case ACTION_CATEGORY_USIG: + frm_type = + mgmt_get_twt_action_subtype(action_hdr->action_code); + break; default: frm_type = MGMT_FRM_UNSPECIFIED; break;