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 */ 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; 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); diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 23487b0be26b..5ee0bf55b03d 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; @@ -11505,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");