diff --git a/fw/htt.h b/fw/htt.h index 2fdea009cece..048f33b41abc 100644 --- a/fw/htt.h +++ b/fw/htt.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2019 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -10333,6 +10333,27 @@ enum htt_dbg_ext_stats_status { (((word) & HTT_T2H_PPDU_STATS_PPDU_ID_M) >> \ HTT_T2H_PPDU_STATS_PPDU_ID_S) +/* htt_t2h_ppdu_stats_ind_hdr_t + * This struct contains the fields within the header of the + * HTT_T2H_PPDU_STATS_IND message, preceding the type-specific + * stats info. + * This struct assumes little-endian layout, and thus is only + * suitable for use within processors known to be little-endian + * (such as the target). + * In contrast, the above macros provide endian-portable methods + * to get and set the bitfields within this PPDU_STATS_IND header. + */ +typedef struct { + A_UINT32 msg_type: 8, /* bits 7:0 */ + mac_id: 2, /* bits 9:8 */ + pdev_id: 2, /* bits 11:10 */ + reserved1: 4, /* bits 15:12 */ + payload_size: 16; /* bits 31:16 */ + A_UINT32 ppdu_id; + A_UINT32 timestamp_us; + A_UINT32 reserved2; +} htt_t2h_ppdu_stats_ind_hdr_t; + /** * @brief target -> host extended statistics upload * diff --git a/fw/htt_ppdu_stats.h b/fw/htt_ppdu_stats.h index 01589e1ff87a..992c2740ed88 100644 --- a/fw/htt_ppdu_stats.h +++ b/fw/htt_ppdu_stats.h @@ -234,15 +234,39 @@ typedef struct { * tx_ppdu_stats_info is variable length, with length = * number_of_ppdu_stats * sizeof (struct htt_tx_ppdu_stats_info) */ - A_UINT32 tx_ppdu_stats_info[1/*number_of_ppdu_stats*/]; + struct htt_tx_ppdu_stats_info tx_ppdu_stats_info[1/*number_of_ppdu_stats*/]; } htt_ppdu_stats_usr_common_array_tlv_v; -typedef struct { - htt_tlv_hdr_t tlv_hdr; +#define HTT_PPDU_STATS_SCH_CMD_TLV_HDR_STRUCT \ + struct { \ + htt_tlv_hdr_t tlv_hdr; \ + /* Refer bmi_msg.h */ \ + A_UINT32 target_type; \ + } - /* Refer bmi_msg.h */ - A_UINT32 target_type; - A_UINT32 hw[1]; /* Variable length, refer to struct scheduler_cmd_status */ +typedef HTT_PPDU_STATS_SCH_CMD_TLV_HDR_STRUCT htt_ppdu_stats_sch_cmd_tlv_hdr_t; + +typedef struct { + /* + * Use a union to allow the HW-independent header portion of this struct + * to be accessed either within a hdr struct, or directly within the + * htt_ppdu_stats_sch_cmd_tlv_v struct. + * For example, the target_type field can be accessed either as + * htt_ppdu_stats_sch_cmd_tlv_v.target_type + * or + * htt_ppdu_stats_sch_cmd_tlv_v.hdr.target_type + */ + union { + htt_ppdu_stats_sch_cmd_tlv_hdr_t hdr; + HTT_PPDU_STATS_SCH_CMD_TLV_HDR_STRUCT; + }; + /* + * The hw portion of this struct contains a scheduler_command_status + * struct, whose definition is different for different target HW types. + * The target_type field within the header can, if set correctly, + * clarify which definition of scheduler_command_status is being used. + */ + A_UINT32 hw[1]; } htt_ppdu_stats_sch_cmd_tlv_v; #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_M 0x0000ffff @@ -369,15 +393,16 @@ enum HTT_PPDU_STATS_BW { typedef enum HTT_PPDU_STATS_BW HTT_PPDU_STATS_BW; enum HTT_PPDU_STATS_SEQ_TYPE { - HTT_SEQTYPE_SU = 0, - HTT_SEQTYPE_AC_MU_MIMO = 1, - HTT_SEQTYPE_AX_MU_MIMO = 2, - HTT_SEQTYPE_MU_OFDMA = 3, - HTT_SEQTYPE_UL_TRIG = 4, - HTT_SEQTYPE_BURST_BCN = 5, - HTT_SEQTYPE_UL_BSR_RESP = 6, - HTT_SEQTYPE_UL_BSR_TRIG = 7, - HTT_SEQTYPE_UL_RESP = 8, + HTT_SEQTYPE_UNSPECIFIED = 0, + HTT_SEQTYPE_SU = 1, + HTT_SEQTYPE_AC_MU_MIMO = 2, + HTT_SEQTYPE_AX_MU_MIMO = 3, + HTT_SEQTYPE_MU_OFDMA = 4, + HTT_SEQTYPE_UL_TRIG = 5, + HTT_SEQTYPE_BURST_BCN = 6, + HTT_SEQTYPE_UL_BSR_RESP = 7, + HTT_SEQTYPE_UL_BSR_TRIG = 8, + HTT_SEQTYPE_UL_RESP = 9, }; typedef enum HTT_PPDU_STATS_SEQ_TYPE HTT_PPDU_STATS_SEQ_TYPE; diff --git a/fw/htt_stats.h b/fw/htt_stats.h index f867965714b4..0d3995904d14 100644 --- a/fw/htt_stats.h +++ b/fw/htt_stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2019 The Linux Foundation. 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 @@ -393,11 +393,25 @@ typedef enum { } while (0) typedef struct { - /* BIT [11 : 0] :- tag - * BIT [23 : 12] :- length - * BIT [31 : 24] :- reserved - */ - A_UINT32 tag__length; + union { + /* BIT [11 : 0] :- tag + * BIT [23 : 12] :- length + * BIT [31 : 24] :- reserved + */ + A_UINT32 tag__length; + /* + * The following struct is not endian-portable. + * It is suitable for use within the target, which is known to be + * little-endian. + * The host should use the above endian-portable macros to access + * the tag and length bitfields in an endian-neutral manner. + */ + struct { + A_UINT32 tag: 12, /* BIT [11 : 0] */ + length: 12, /* BIT [23 : 12] */ + reserved: 8; /* BIT [31 : 24] */ + }; + }; } htt_tlv_hdr_t; #define HTT_STATS_MAX_STRING_SZ32 4