diff --git a/fw/wlan_defs.h b/fw/wlan_defs.h index 591ced86231e..74fe38d38d0b 100755 --- a/fw/wlan_defs.h +++ b/fw/wlan_defs.h @@ -1295,4 +1295,263 @@ typedef enum { #undef CONFIG_160MHZ_SUPPORT_UNDEF_WAR #endif +/** MGMT RX REO Changes */ +/* Macros for having versioning info for compatibility check between host and firmware */ +#define MLO_SHMEM_MAJOR_VERSION 1 +#define MLO_SHMEM_MINOR_VERSION 1 + +/** Helper Macros for tlv header of the given tlv buffer */ +/* Size of the TLV Header which is the Tag and Length fields */ +#define MLO_SHMEM_TLV_HDR_SIZE (1 * sizeof(A_UINT32)) + +/* TLV Helper macro to get the TLV Header given the pointer to the TLV buffer. */ +#define MLO_SHMEMTLV_GET_HDR(tlv_buf) (((A_UINT32 *) (tlv_buf))[0]) + +/* TLV Helper macro to set the TLV Header given the pointer to the TLV buffer. */ +#define MLO_SHMEMTLV_SET_HDR(tlv_buf, tag, len) \ + (((A_UINT32 *)(tlv_buf))[0]) = ((tag << 16) | (len & 0x0000FFFF)) + +/* TLV Helper macro to get the TLV Tag given the TLV header. */ +#define MLO_SHMEMTLV_GET_TLVTAG(tlv_header) ((A_UINT32)((tlv_header) >> 16)) + +/* + * TLV Helper macro to get the TLV Buffer Length (minus TLV header size) + * given the TLV header. + */ +#define MLO_SHMEMTLV_GET_TLVLEN(tlv_header) \ + ((A_UINT32)((tlv_header) & 0x0000FFFF)) + +/* + * TLV Helper macro to get the TLV length from TLV structure size + * by removing TLV header size. + */ +#define MLO_SHMEMTLV_GET_STRUCT_TLVLEN(tlv_struct) \ + ((A_UINT32)(sizeof(tlv_struct)-MLO_SHMEM_TLV_HDR_SIZE)) + +/** + * Helper Macros for getting and setting the required number of bits + * from the TLV params. + */ +#define MLO_SHMEM_GET_BITS(_val,_index,_num_bits) \ + (((_val) >> (_index)) & ((1 << (_num_bits)) - 1)) + +#define MLO_SHMEM_SET_BITS(_var,_index,_num_bits,_val) \ + do { \ + (_var) &= ~(((1 << (_num_bits)) - 1) << (_index)); \ + (_var) |= (((_val) & ((1 << (_num_bits)) - 1)) << (_index)); \ + } while (0) + +/** Definition of the GLB_H_SHMEM arena tlv structures */ + +typedef enum { + MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT, + MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO, + MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO, + MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK, + MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO, + MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM, +} MLO_SHMEM_TLV_TAG_ID; + +/** Helper macro for params GET/SET of mgmt_rx_reo_snapshot */ +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_VALID_GET(mgmt_rx_reo_snapshot_low) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 0, 1) +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_VALID_SET(mgmt_rx_reo_snapshot_low, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 0, 1, value) + +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_GET(mgmt_rx_reo_snapshot_low) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_low, 1, 16) +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_SET(mgmt_rx_reo_snapshot_low, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_low, 1, 16, value) + +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET(mgmt_rx_reo_snapshot) \ + (MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17) << 15) | \ + MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15) + +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_SET(mgmt_rx_reo_snapshot, value) \ + do { \ + MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_high, 0, 17, ((value) >> 15)); \ + MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low, 17, 15, ((value) & 0x7fff)); \ + } while (0) + +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_REDUNDANT_GET(mgmt_rx_reo_snapshot_high) MLO_SHMEM_GET_BITS(mgmt_rx_reo_snapshot_high, 17, 15) +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_MGMT_PKT_CTR_REDUNDANT_SET(mgmt_rx_reo_snapshot_high, value) MLO_SHMEM_SET_BITS(mgmt_rx_reo_snapshot_high, 17, 15, value) + +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_IS_CONSISTENT(mgmt_pkt_ctr, mgmt_pkt_ctr_redundant) \ + (MLO_SHMEM_GET_BITS(mgmt_pkt_ctr, 0, 15) == MLO_SHMEM_GET_BITS(mgmt_pkt_ctr_redundant, 0, 15)) + +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_PARAM_GLOBAL_TIMESTAMP_GET_FROM_DWORDS(mgmt_rx_reo_snapshot_low,mgmt_rx_reo_snapshot_high) \ + (MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_high), 0, 17) << 15) | \ + MLO_SHMEM_GET_BITS((mgmt_rx_reo_snapshot_low), 17, 15) + +#define MLO_SHMEM_MGMT_RX_REO_SNAPSHOT_GET_ADRESS(mgmt_rx_reo_snapshot) \ + (&mgmt_rx_reo_snapshot->mgmt_rx_reo_snapshot_low) + +/* REO snapshot structure */ +typedef struct { + /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MGMT_RX_REO_SNAPSHOT */ + A_UINT32 tlv_header; + A_UINT32 reserved_alignment_padding; + /** + * mgmt_rx_reo_snapshot_low + * + * [0]: valid + * [16:1]: mgmt_pkt_ctr + * [31:17]: global_timestamp_low + */ + A_UINT32 mgmt_rx_reo_snapshot_low; + + /** + * mgmt_rx_reo_snapshot_high + * + * [16:0]: global_timestamp_high + * [31:17]: mgmt_pkt_ctr_redundant + */ + A_UINT32 mgmt_rx_reo_snapshot_high; + +} mgmt_rx_reo_snapshot; + +A_COMPILE_TIME_ASSERT(check_mgmt_rx_reo_snapshot_8byte_size_quantum, + (((sizeof(mgmt_rx_reo_snapshot) % sizeof(A_UINT64) == 0x0)))); + +A_COMPILE_TIME_ASSERT(verify_mgmt_rx_reo_snapshot_low_offset, + (A_OFFSETOF(mgmt_rx_reo_snapshot, mgmt_rx_reo_snapshot_low) % sizeof(A_UINT64) == 0)) + +typedef struct { + /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_PER_LINK_SNAPSHOT_INFO */ + A_UINT32 tlv_header; + A_UINT32 reserved_alignment_padding; + mgmt_rx_reo_snapshot fw_consumed; + mgmt_rx_reo_snapshot fw_forwarded; + mgmt_rx_reo_snapshot hw_forwarded; +} mlo_glb_rx_reo_per_link_snapshot_info; + +A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_per_link_snapshot_info_8byte_size_quantum, + (((sizeof(mlo_glb_rx_reo_per_link_snapshot_info) % sizeof(A_UINT64) == 0x0)))); + +A_COMPILE_TIME_ASSERT(verify_mlo_glb_rx_reo_per_link_snapshot_fw_consumed_offset, + (A_OFFSETOF(mlo_glb_rx_reo_per_link_snapshot_info, fw_consumed) % sizeof(A_UINT64) == 0)) + +/** Helper macro for params GET/SET of mlo_glb_rx_reo_snapshot_info */ +#define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4) +#define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value) + +#define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16) +#define MLO_SHMEM_GLB_RX_REO_SNAPSHOT_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value) + +/* Definition of the complete REO snapshot info */ +typedef struct { + /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_RX_REO_SNAPSHOT_INFO */ + A_UINT32 tlv_header; + + /** + * link_info + * + * [3:0]: no_of_links + * [19:4]: valid_link_bmap + * [31:20]: reserved + */ + A_UINT32 link_info; +/* This TLV is followed by array of mlo_glb_rx_reo_per_link_snapshot_info: + * mlo_glb_rx_reo_per_link_snapshot_info will have multiple instances + * equal to num of hw links received by no_of_link + * mlo_glb_rx_reo_per_link_snapshot_info per_link_info[]; + */ +} mlo_glb_rx_reo_snapshot_info; + +A_COMPILE_TIME_ASSERT(check_mlo_glb_rx_reo_snapshot_info_8byte_size_quantum, + (((sizeof(mlo_glb_rx_reo_snapshot_info) % sizeof(A_UINT64) == 0x0)))); + +/** Helper macro for params GET/SET of mlo_glb_link */ +#define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_GET(link_status) MLO_SHMEM_GET_BITS(link_status, 0, 8) +#define MLO_SHMEM_GLB_LINK_PARAM_LINK_STATUS_SET(link_status, value) MLO_SHMEM_SET_BITS(link_status, 0, 8, value) + +/*glb link info structures used for scratchpad memory (crash and recovery) */ +typedef struct { + /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK */ + A_UINT32 tlv_header; + /** + * link_status + * + * [7:0]: link_status + * [31:8]: reserved + */ + A_UINT32 link_status; + /* + * Based on MLO timestamp, which is global across chips - + * this will be first updated when MLO sync is completed. + */ + A_UINT32 boot_timestamp_low_us; + A_UINT32 boot_timestamp_high_us; + /* + * Based on MLO timestamp, will be updated with a configurable + * periodicity (default 1 sec) + */ + A_UINT32 health_check_timestamp_low_us; + A_UINT32 health_check_timestamp_high_us; + +} mlo_glb_link; + +A_COMPILE_TIME_ASSERT(check_mlo_glb_link_8byte_size_quantum, + (((sizeof(mlo_glb_link) % sizeof(A_UINT64) == 0x0)))); + +A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_boot_timestamp_low_offset, + (A_OFFSETOF(mlo_glb_link, boot_timestamp_low_us) % sizeof(A_UINT64) == 0)) + +A_COMPILE_TIME_ASSERT(verify_mlo_glb_link_health_check_timestamp_low_offset, + (A_OFFSETOF(mlo_glb_link, health_check_timestamp_low_us) % sizeof(A_UINT64) == 0)) + + +/** Helper macro for params GET/SET of mlo_glb_link_info */ +#define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 0, 4) +#define MLO_SHMEM_GLB_LINK_INFO_PARAM_NO_OF_LINKS_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 0, 4, value) + +#define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_GET(link_info) MLO_SHMEM_GET_BITS(link_info, 4, 16) +#define MLO_SHMEM_GLB_LINK_INFO_PARAM_VALID_LINK_BMAP_SET(link_info, value) MLO_SHMEM_SET_BITS(link_info, 4, 16, value) + +typedef struct { + /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_LINK_INFO */ + A_UINT32 tlv_header; + + /** + * link_info + * + * [3:0]: no_of_links + * [19:4]: valid_link_bmap + * [31:20]: reserved + */ + A_UINT32 link_info; +/* This TLV is followed by array of mlo_glb_link: + * mlo_glb_link will have mutiple instances equal to num of hw links + * received by no_of_link + * mlo_glb_link glb_link_info[]; + */ +} mlo_glb_link_info; + +A_COMPILE_TIME_ASSERT(check_mlo_glb_link_8byte_size_quantum, + (((sizeof(mlo_glb_link_info) % sizeof(A_UINT64) == 0x0)))); + +/** Helper macro for params GET/SET of mlo_glb_h_shmem */ +#define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 0, 16) +#define MLO_SHMEM_GLB_H_SHMEM_PARAM_MINOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 0, 16, value) + +#define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_GET(major_minor_version) MLO_SHMEM_GET_BITS(major_minor_version, 16, 16) +#define MLO_SHMEM_GLB_H_SHMEM_PARAM_MAJOR_VERSION_SET(major_minor_version, value) MLO_SHMEM_SET_BITS(major_minor_version, 16, 16, value) + +/* Definition of Global H SHMEM Arena */ +typedef struct { + /* TLV tag and len; tag equals MLO_SHMEM_TLV_STRUCT_MLO_GLB_H_SHMEM */ + A_UINT32 tlv_header; + /** + * major_minor_version + * + * [15:0]: minor version + * [31:16]: major version + */ + A_UINT32 major_minor_version; +/* This TLV is followed by TLVs + * mlo_glb_rx_reo_snapshot_info reo_snapshot; + * mlo_glb_link_info glb_info; + */ +} mlo_glb_h_shmem; + +A_COMPILE_TIME_ASSERT(check_mlo_glb_h_shmem_8byte_size_quantum, + (((sizeof(mlo_glb_h_shmem) % sizeof(A_UINT64) == 0x0)))); + + #endif /* __WLANDEFS_H__ */