18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. 48c2ecf20Sopenharmony_ci * All rights reserved. 58c2ecf20Sopenharmony_ci * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef IB_PMA_H 98c2ecf20Sopenharmony_ci#define IB_PMA_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <rdma/ib_mad.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* 148c2ecf20Sopenharmony_ci * PMA class portinfo capability mask bits 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci#define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8) 178c2ecf20Sopenharmony_ci#define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9) 188c2ecf20Sopenharmony_ci#define IB_PMA_CLASS_CAP_EXT_WIDTH_NOIETF cpu_to_be16(1 << 10) 198c2ecf20Sopenharmony_ci#define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12) 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001) 228c2ecf20Sopenharmony_ci#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010) 238c2ecf20Sopenharmony_ci#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011) 248c2ecf20Sopenharmony_ci#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012) 258c2ecf20Sopenharmony_ci#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D) 268c2ecf20Sopenharmony_ci#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E) 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_cistruct ib_pma_mad { 298c2ecf20Sopenharmony_ci struct ib_mad_hdr mad_hdr; 308c2ecf20Sopenharmony_ci u8 reserved[40]; 318c2ecf20Sopenharmony_ci u8 data[192]; 328c2ecf20Sopenharmony_ci} __packed; 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cistruct ib_pma_portsamplescontrol { 358c2ecf20Sopenharmony_ci u8 opcode; 368c2ecf20Sopenharmony_ci u8 port_select; 378c2ecf20Sopenharmony_ci u8 tick; 388c2ecf20Sopenharmony_ci u8 counter_width; /* resv: 7:3, counter width: 2:0 */ 398c2ecf20Sopenharmony_ci __be32 counter_mask0_9; /* 2, 10 3-bit fields */ 408c2ecf20Sopenharmony_ci __be16 counter_mask10_14; /* 1, 5 3-bit fields */ 418c2ecf20Sopenharmony_ci u8 sample_mechanisms; 428c2ecf20Sopenharmony_ci u8 sample_status; /* only lower 2 bits */ 438c2ecf20Sopenharmony_ci __be64 option_mask; 448c2ecf20Sopenharmony_ci __be64 vendor_mask; 458c2ecf20Sopenharmony_ci __be32 sample_start; 468c2ecf20Sopenharmony_ci __be32 sample_interval; 478c2ecf20Sopenharmony_ci __be16 tag; 488c2ecf20Sopenharmony_ci __be16 counter_select[15]; 498c2ecf20Sopenharmony_ci __be32 reserved1; 508c2ecf20Sopenharmony_ci __be64 samples_only_option_mask; 518c2ecf20Sopenharmony_ci __be32 reserved2[28]; 528c2ecf20Sopenharmony_ci}; 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_cistruct ib_pma_portsamplesresult { 558c2ecf20Sopenharmony_ci __be16 tag; 568c2ecf20Sopenharmony_ci __be16 sample_status; /* only lower 2 bits */ 578c2ecf20Sopenharmony_ci __be32 counter[15]; 588c2ecf20Sopenharmony_ci}; 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_cistruct ib_pma_portsamplesresult_ext { 618c2ecf20Sopenharmony_ci __be16 tag; 628c2ecf20Sopenharmony_ci __be16 sample_status; /* only lower 2 bits */ 638c2ecf20Sopenharmony_ci __be32 extended_width; /* only upper 2 bits */ 648c2ecf20Sopenharmony_ci __be64 counter[15]; 658c2ecf20Sopenharmony_ci}; 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_cistruct ib_pma_portcounters { 688c2ecf20Sopenharmony_ci u8 reserved; 698c2ecf20Sopenharmony_ci u8 port_select; 708c2ecf20Sopenharmony_ci __be16 counter_select; 718c2ecf20Sopenharmony_ci __be16 symbol_error_counter; 728c2ecf20Sopenharmony_ci u8 link_error_recovery_counter; 738c2ecf20Sopenharmony_ci u8 link_downed_counter; 748c2ecf20Sopenharmony_ci __be16 port_rcv_errors; 758c2ecf20Sopenharmony_ci __be16 port_rcv_remphys_errors; 768c2ecf20Sopenharmony_ci __be16 port_rcv_switch_relay_errors; 778c2ecf20Sopenharmony_ci __be16 port_xmit_discards; 788c2ecf20Sopenharmony_ci u8 port_xmit_constraint_errors; 798c2ecf20Sopenharmony_ci u8 port_rcv_constraint_errors; 808c2ecf20Sopenharmony_ci u8 reserved1; 818c2ecf20Sopenharmony_ci u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */ 828c2ecf20Sopenharmony_ci __be16 reserved2; 838c2ecf20Sopenharmony_ci __be16 vl15_dropped; 848c2ecf20Sopenharmony_ci __be32 port_xmit_data; 858c2ecf20Sopenharmony_ci __be32 port_rcv_data; 868c2ecf20Sopenharmony_ci __be32 port_xmit_packets; 878c2ecf20Sopenharmony_ci __be32 port_rcv_packets; 888c2ecf20Sopenharmony_ci __be32 port_xmit_wait; 898c2ecf20Sopenharmony_ci} __packed; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001) 938c2ecf20Sopenharmony_ci#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002) 948c2ecf20Sopenharmony_ci#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004) 958c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008) 968c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010) 978c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040) 988c2ecf20Sopenharmony_ci#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200) 998c2ecf20Sopenharmony_ci#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400) 1008c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800) 1018c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000) 1028c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000) 1038c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000) 1048c2ecf20Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000) 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_cistruct ib_pma_portcounters_ext { 1078c2ecf20Sopenharmony_ci u8 reserved; 1088c2ecf20Sopenharmony_ci u8 port_select; 1098c2ecf20Sopenharmony_ci __be16 counter_select; 1108c2ecf20Sopenharmony_ci __be32 reserved1; 1118c2ecf20Sopenharmony_ci __be64 port_xmit_data; 1128c2ecf20Sopenharmony_ci __be64 port_rcv_data; 1138c2ecf20Sopenharmony_ci __be64 port_xmit_packets; 1148c2ecf20Sopenharmony_ci __be64 port_rcv_packets; 1158c2ecf20Sopenharmony_ci __be64 port_unicast_xmit_packets; 1168c2ecf20Sopenharmony_ci __be64 port_unicast_rcv_packets; 1178c2ecf20Sopenharmony_ci __be64 port_multicast_xmit_packets; 1188c2ecf20Sopenharmony_ci __be64 port_multicast_rcv_packets; 1198c2ecf20Sopenharmony_ci} __packed; 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001) 1228c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002) 1238c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004) 1248c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008) 1258c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010) 1268c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020) 1278c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040) 1288c2ecf20Sopenharmony_ci#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080) 1298c2ecf20Sopenharmony_ci 1308c2ecf20Sopenharmony_ci#endif /* IB_PMA_H */ 131