qcacmn: Add API to dump mgmt frame in hex

Add API to dump mgmt frame in hex

Change-Id: I444ed40714184d14025a72aa8a08856a6dae3a68
CRs-Fixed: 3841017
这个提交包含在:
Abhishek Singh
2024-06-12 12:57:22 +05:30
提交者 Ravindra Konda
父节点 75b9be8f82
当前提交 908cf6b29c
修改 2 个文件,包含 188 行新增2 行删除

查看文件

@@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -60,6 +60,16 @@
#define mgmttxrx_nofl_debug(params...) \ #define mgmttxrx_nofl_debug(params...) \
QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_MGMT_TXRX, params) QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_MGMT_TXRX, params)
/**
* mgmt_txrx_frame_hex_dump() - Print the type and dump the rx tx frame
* @frame_data: The base address of the mgmt frame data to be logged.
* @frame_len: The size of the frame to be logged.
* @is_tx: is tx frame
*
* Return: None
*/
void mgmt_txrx_frame_hex_dump(void *frame_data, int frame_len, bool is_tx);
/** /**
* enum mgmt_subtype - enum of mgmt. subtypes * enum mgmt_subtype - enum of mgmt. subtypes
* @MGMT_SUBTYPE_ASSOC_REQ: association request frame * @MGMT_SUBTYPE_ASSOC_REQ: association request frame

查看文件

@@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* *
* Permission to use, copy, modify, and/or distribute this software for * Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the * any purpose with or without fee is hereby granted, provided that the
@@ -1011,6 +1011,182 @@ mgmt_txrx_get_frm_type(uint8_t mgmt_subtype, uint8_t *mpdu_data_ptr)
return frm_type; return frm_type;
} }
static uint8_t *mgmt_txrx_get_frm_type_string(enum mgmt_frame_type frm_type)
{
switch (frm_type) {
CASE_RETURN_STRING(MGMT_ASSOC_REQ);
CASE_RETURN_STRING(MGMT_ASSOC_RESP);
CASE_RETURN_STRING(MGMT_REASSOC_REQ);
CASE_RETURN_STRING(MGMT_REASSOC_RESP);
CASE_RETURN_STRING(MGMT_PROBE_REQ);
CASE_RETURN_STRING(MGMT_PROBE_RESP);
CASE_RETURN_STRING(MGMT_BEACON);
CASE_RETURN_STRING(MGMT_ATIM);
CASE_RETURN_STRING(MGMT_DISASSOC);
CASE_RETURN_STRING(MGMT_AUTH);
CASE_RETURN_STRING(MGMT_DEAUTH);
CASE_RETURN_STRING(MGMT_ACTION_MEAS_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_MEAS_REPORT);
CASE_RETURN_STRING(MGMT_ACTION_TPC_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_TPC_REPORT);
CASE_RETURN_STRING(MGMT_ACTION_CHAN_SWITCH);
CASE_RETURN_STRING(MGMT_ACTION_QOS_ADD_TS_REQ);
CASE_RETURN_STRING(MGMT_ACTION_QOS_ADD_TS_RSP);
CASE_RETURN_STRING(MGMT_ACTION_QOS_DEL_TS_REQ);
CASE_RETURN_STRING(MGMT_ACTION_QOS_SCHEDULE);
CASE_RETURN_STRING(MGMT_ACTION_QOS_MAP_CONFIGURE);
CASE_RETURN_STRING(MGMT_ACTION_DLS_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_DLS_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_DLS_TEARDOWN);
CASE_RETURN_STRING(MGMT_ACTION_BA_ADDBA_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_BA_ADDBA_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_BA_DELBA);
CASE_RETURN_STRING(MGMT_ACTION_2040_BSS_COEXISTENCE);
CASE_RETURN_STRING(MGMT_ACTION_CATEGORY_VENDOR_SPECIFIC);
CASE_RETURN_STRING(MGMT_ACTION_CATEGORY_VENDOR_SPECIFIC_PROTECTED);
CASE_RETURN_STRING(MGMT_ACTION_EXT_CHANNEL_SWITCH_ID);
CASE_RETURN_STRING(MGMT_ACTION_VENDOR_SPECIFIC);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_DISCRESP);
CASE_RETURN_STRING(MGMT_ACTION_RRM_RADIO_MEASURE_REQ);
CASE_RETURN_STRING(MGMT_ACTION_RRM_RADIO_MEASURE_RPT);
CASE_RETURN_STRING(MGMT_ACTION_RRM_LINK_MEASUREMENT_REQ);
CASE_RETURN_STRING(MGMT_ACTION_RRM_LINK_MEASUREMENT_RPT);
CASE_RETURN_STRING(MGMT_ACTION_RRM_NEIGHBOR_REQ);
CASE_RETURN_STRING(MGMT_ACTION_RRM_NEIGHBOR_RPT);
CASE_RETURN_STRING(MGMT_ACTION_FT_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_FT_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_FT_CONFIRM);
CASE_RETURN_STRING(MGMT_ACTION_FT_ACK);
CASE_RETURN_STRING(MGMT_ACTION_HT_NOTIFY_CHANWIDTH);
CASE_RETURN_STRING(MGMT_ACTION_HT_SMPS);
CASE_RETURN_STRING(MGMT_ACTION_HT_PSMP);
CASE_RETURN_STRING(MGMT_ACTION_HT_PCO_PHASE);
CASE_RETURN_STRING(MGMT_ACTION_HT_CSI);
CASE_RETURN_STRING(MGMT_ACTION_HT_NONCOMPRESSED_BF);
CASE_RETURN_STRING(MGMT_ACTION_HT_COMPRESSED_BF);
CASE_RETURN_STRING(MGMT_ACTION_HT_ASEL_IDX_FEEDBACK);
CASE_RETURN_STRING(MGMT_ACTION_SA_QUERY_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_SA_QUERY_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_PDPA_GAS_INIT_REQ);
CASE_RETURN_STRING(MGMT_ACTION_PDPA_GAS_INIT_RSP);
CASE_RETURN_STRING(MGMT_ACTION_PDPA_GAS_COMEBACK_REQ);
CASE_RETURN_STRING(MGMT_ACTION_PDPA_GAS_COMEBACK_RSP);
CASE_RETURN_STRING(MGMT_ACTION_WNM_BSS_TM_QUERY);
CASE_RETURN_STRING(MGMT_ACTION_WNM_BSS_TM_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_WNM_BSS_TM_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_WNM_NOTIF_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_WNM_NOTIF_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_WNM_FMS_REQ);
CASE_RETURN_STRING(MGMT_ACTION_WNM_FMS_RESP);
CASE_RETURN_STRING(MGMT_ACTION_WNM_TFS_REQ);
CASE_RETURN_STRING(MGMT_ACTION_WNM_TFS_RESP);
CASE_RETURN_STRING(MGMT_ACTION_WNM_TFS_NOTIFY);
CASE_RETURN_STRING(MGMT_ACTION_WNM_SLEEP_REQ);
CASE_RETURN_STRING(MGMT_ACTION_WNM_SLEEP_RESP);
CASE_RETURN_STRING(MGMT_ACTION_WNM_TIM_REQ);
CASE_RETURN_STRING(MGMT_ACTION_WNM_TIM_RESP);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_SETUP_REQ);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_SETUP_RSP);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_SETUP_CNF);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_TEARDOWN);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_PEER_TRAFFIC_IND);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_CH_SWITCH_REQ);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_CH_SWITCH_RSP);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_PEER_PSM_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_PEER_PSM_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_PEER_TRAFFIC_RSP);
CASE_RETURN_STRING(MGMT_ACTION_TDLS_DIS_REQ);
CASE_RETURN_STRING(MGMT_ACTION_MESH_LINK_METRIC_REPORT);
CASE_RETURN_STRING(MGMT_ACTION_MESH_HWMP_PATH_SELECTION);
CASE_RETURN_STRING(MGMT_ACTION_MESH_GATE_ANNOUNCEMENT);
CASE_RETURN_STRING(MGMT_ACTION_MESH_CONGESTION_CONTROL_NOTIFICATION);
CASE_RETURN_STRING(MGMT_ACTION_MESH_MCCA_SETUP_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_MESH_MCCA_SETUP_REPLY);
CASE_RETURN_STRING(MGMT_ACTION_MESH_MCCA_ADVERTISEMENT_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_MESH_MCCA_ADVERTISEMENT);
CASE_RETURN_STRING(MGMT_ACTION_MESH_MCCA_TEARDOWN);
CASE_RETURN_STRING(MGMT_ACTION_MESH_TBTT_ADJUSTMENT_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_MESH_TBTT_ADJUSTMENT_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_SP_MESH_PEERING_OPEN);
CASE_RETURN_STRING(MGMT_ACTION_SP_MESH_PEERING_CONFIRM);
CASE_RETURN_STRING(MGMT_ACTION_SP_MESH_PEERING_CLOSE);
CASE_RETURN_STRING(MGMT_ACTION_SP_MGK_INFORM);
CASE_RETURN_STRING(MGMT_ACTION_SP_MGK_ACK);
CASE_RETURN_STRING(MGMT_ACTION_WMM_QOS_SETUP_REQ);
CASE_RETURN_STRING(MGMT_ACTION_WMM_QOS_SETUP_RESP);
CASE_RETURN_STRING(MGMT_ACTION_WMM_QOS_TEARDOWN);
CASE_RETURN_STRING(MGMT_ACTION_VHT_COMPRESSED_BF);
CASE_RETURN_STRING(MGMT_ACTION_VHT_GID_NOTIF);
CASE_RETURN_STRING(MGMT_ACTION_VHT_OPMODE_NOTIF);
CASE_RETURN_STRING(MGMT_ACTION_GAS_INITIAL_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_GAS_INITIAL_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_GAS_COMEBACK_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_GAS_COMEBACK_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_FST_SETUP_REQ);
CASE_RETURN_STRING(MGMT_ACTION_FST_SETUP_RSP);
CASE_RETURN_STRING(MGMT_ACTION_FST_TEAR_DOWN);
CASE_RETURN_STRING(MGMT_ACTION_FST_ACK_REQ);
CASE_RETURN_STRING(MGMT_ACTION_FST_ACK_RSP);
CASE_RETURN_STRING(MGMT_ACTION_FST_ON_CHANNEL_TUNNEL);
CASE_RETURN_STRING(MGMT_ACTION_SCS_REQ);
CASE_RETURN_STRING(MGMT_ACTION_SCS_RSP);
CASE_RETURN_STRING(MGMT_ACTION_GROUP_MEMBERSHIP_REQ);
CASE_RETURN_STRING(MGMT_ACTION_GROUP_MEMBERSHIP_RSP);
CASE_RETURN_STRING(MGMT_ACTION_MCSC_REQ);
CASE_RETURN_STRING(MGMT_ACTION_MCSC_RSP);
CASE_RETURN_STRING(MGMT_FRAME_TYPE_ALL);
CASE_RETURN_STRING(MGMT_CTRL_FRAME);
CASE_RETURN_STRING(MGMT_ACTION_TWT_SETUP);
CASE_RETURN_STRING(MGMT_ACTION_TWT_TEARDOWN);
CASE_RETURN_STRING(MGMT_ACTION_TWT_INFORMATION);
CASE_RETURN_STRING(MGMT_ACTION_EHT_T2LM_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_EHT_T2LM_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_EHT_T2LM_TEARDOWN);
CASE_RETURN_STRING(MGMT_ACTION_EHT_EPCS_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_EHT_EPCS_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_EHT_EPCS_TEARDOWN);
CASE_RETURN_STRING(MGMT_ACTION_FTM_REQUEST);
CASE_RETURN_STRING(MGMT_ACTION_FTM_RESPONSE);
CASE_RETURN_STRING(MGMT_ACTION_FILS_DISCOVERY);
default:
break;
}
return (uint8_t *)"MGMT_UNKNOWN";
}
void mgmt_txrx_frame_hex_dump(void *frame_data, int frame_len, bool is_tx)
{
struct ieee80211_frame *wh;
uint8_t mgmt_type, mgmt_subtype;
enum mgmt_frame_type frm_type;
uint8_t *mpdu_data_ptr = NULL;
if (frame_len < sizeof(struct ieee80211_frame)) {
mgmt_txrx_debug("frame len %d less than hdr size", frame_len);
return;
}
wh = (struct ieee80211_frame *)frame_data;
mgmt_type = (wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK;
mgmt_subtype = (wh)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
if (mgmt_type != IEEE80211_FC0_TYPE_MGT) {
mgmt_txrx_debug("frame type %d not mgmt type", mgmt_type);
return;
}
/* mpdu_data_ptr is pointer to action header */
mpdu_data_ptr = (uint8_t *)frame_data + sizeof(struct ieee80211_frame);
frm_type = mgmt_txrx_get_frm_type(mgmt_subtype, mpdu_data_ptr);
mgmttxrx_nofl_debug("%s MGMT: %s(%d) seq %d len %d:",
is_tx ? "TX" : "RX",
mgmt_txrx_get_frm_type_string(frm_type), frm_type,
le16toh(*(uint16_t *)wh->i_seq) >>
WLAN_SEQ_SEQ_SHIFT, frame_len);
qdf_trace_hex_dump(QDF_MODULE_ID_MGMT_TXRX, QDF_TRACE_LEVEL_DEBUG,
frame_data, frame_len);
}
#ifdef WLAN_IOT_SIM_SUPPORT #ifdef WLAN_IOT_SIM_SUPPORT
static QDF_STATUS simulation_frame_update(struct wlan_objmgr_psoc *psoc, static QDF_STATUS simulation_frame_update(struct wlan_objmgr_psoc *psoc,
qdf_nbuf_t buf, qdf_nbuf_t buf,