162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. 462306a36Sopenharmony_ci * All rights reserved. 562306a36Sopenharmony_ci * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef IB_PMA_H 962306a36Sopenharmony_ci#define IB_PMA_H 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <rdma/ib_mad.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* 1462306a36Sopenharmony_ci * PMA class portinfo capability mask bits 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci#define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8) 1762306a36Sopenharmony_ci#define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9) 1862306a36Sopenharmony_ci#define IB_PMA_CLASS_CAP_EXT_WIDTH_NOIETF cpu_to_be16(1 << 10) 1962306a36Sopenharmony_ci#define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12) 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001) 2262306a36Sopenharmony_ci#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010) 2362306a36Sopenharmony_ci#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011) 2462306a36Sopenharmony_ci#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012) 2562306a36Sopenharmony_ci#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D) 2662306a36Sopenharmony_ci#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E) 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_cistruct ib_pma_mad { 2962306a36Sopenharmony_ci struct ib_mad_hdr mad_hdr; 3062306a36Sopenharmony_ci u8 reserved[40]; 3162306a36Sopenharmony_ci u8 data[192]; 3262306a36Sopenharmony_ci} __packed; 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_cistruct ib_pma_portsamplescontrol { 3562306a36Sopenharmony_ci u8 opcode; 3662306a36Sopenharmony_ci u8 port_select; 3762306a36Sopenharmony_ci u8 tick; 3862306a36Sopenharmony_ci u8 counter_width; /* resv: 7:3, counter width: 2:0 */ 3962306a36Sopenharmony_ci __be32 counter_mask0_9; /* 2, 10 3-bit fields */ 4062306a36Sopenharmony_ci __be16 counter_mask10_14; /* 1, 5 3-bit fields */ 4162306a36Sopenharmony_ci u8 sample_mechanisms; 4262306a36Sopenharmony_ci u8 sample_status; /* only lower 2 bits */ 4362306a36Sopenharmony_ci __be64 option_mask; 4462306a36Sopenharmony_ci __be64 vendor_mask; 4562306a36Sopenharmony_ci __be32 sample_start; 4662306a36Sopenharmony_ci __be32 sample_interval; 4762306a36Sopenharmony_ci __be16 tag; 4862306a36Sopenharmony_ci __be16 counter_select[15]; 4962306a36Sopenharmony_ci __be32 reserved1; 5062306a36Sopenharmony_ci __be64 samples_only_option_mask; 5162306a36Sopenharmony_ci __be32 reserved2[28]; 5262306a36Sopenharmony_ci}; 5362306a36Sopenharmony_ci 5462306a36Sopenharmony_cistruct ib_pma_portsamplesresult { 5562306a36Sopenharmony_ci __be16 tag; 5662306a36Sopenharmony_ci __be16 sample_status; /* only lower 2 bits */ 5762306a36Sopenharmony_ci __be32 counter[15]; 5862306a36Sopenharmony_ci}; 5962306a36Sopenharmony_ci 6062306a36Sopenharmony_cistruct ib_pma_portsamplesresult_ext { 6162306a36Sopenharmony_ci __be16 tag; 6262306a36Sopenharmony_ci __be16 sample_status; /* only lower 2 bits */ 6362306a36Sopenharmony_ci __be32 extended_width; /* only upper 2 bits */ 6462306a36Sopenharmony_ci __be64 counter[15]; 6562306a36Sopenharmony_ci}; 6662306a36Sopenharmony_ci 6762306a36Sopenharmony_cistruct ib_pma_portcounters { 6862306a36Sopenharmony_ci u8 reserved; 6962306a36Sopenharmony_ci u8 port_select; 7062306a36Sopenharmony_ci __be16 counter_select; 7162306a36Sopenharmony_ci __be16 symbol_error_counter; 7262306a36Sopenharmony_ci u8 link_error_recovery_counter; 7362306a36Sopenharmony_ci u8 link_downed_counter; 7462306a36Sopenharmony_ci __be16 port_rcv_errors; 7562306a36Sopenharmony_ci __be16 port_rcv_remphys_errors; 7662306a36Sopenharmony_ci __be16 port_rcv_switch_relay_errors; 7762306a36Sopenharmony_ci __be16 port_xmit_discards; 7862306a36Sopenharmony_ci u8 port_xmit_constraint_errors; 7962306a36Sopenharmony_ci u8 port_rcv_constraint_errors; 8062306a36Sopenharmony_ci u8 reserved1; 8162306a36Sopenharmony_ci u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */ 8262306a36Sopenharmony_ci __be16 reserved2; 8362306a36Sopenharmony_ci __be16 vl15_dropped; 8462306a36Sopenharmony_ci __be32 port_xmit_data; 8562306a36Sopenharmony_ci __be32 port_rcv_data; 8662306a36Sopenharmony_ci __be32 port_xmit_packets; 8762306a36Sopenharmony_ci __be32 port_rcv_packets; 8862306a36Sopenharmony_ci __be32 port_xmit_wait; 8962306a36Sopenharmony_ci} __packed; 9062306a36Sopenharmony_ci 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001) 9362306a36Sopenharmony_ci#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002) 9462306a36Sopenharmony_ci#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004) 9562306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008) 9662306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010) 9762306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040) 9862306a36Sopenharmony_ci#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200) 9962306a36Sopenharmony_ci#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400) 10062306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800) 10162306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000) 10262306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000) 10362306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000) 10462306a36Sopenharmony_ci#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000) 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_cistruct ib_pma_portcounters_ext { 10762306a36Sopenharmony_ci u8 reserved; 10862306a36Sopenharmony_ci u8 port_select; 10962306a36Sopenharmony_ci __be16 counter_select; 11062306a36Sopenharmony_ci __be32 reserved1; 11162306a36Sopenharmony_ci __be64 port_xmit_data; 11262306a36Sopenharmony_ci __be64 port_rcv_data; 11362306a36Sopenharmony_ci __be64 port_xmit_packets; 11462306a36Sopenharmony_ci __be64 port_rcv_packets; 11562306a36Sopenharmony_ci __be64 port_unicast_xmit_packets; 11662306a36Sopenharmony_ci __be64 port_unicast_rcv_packets; 11762306a36Sopenharmony_ci __be64 port_multicast_xmit_packets; 11862306a36Sopenharmony_ci __be64 port_multicast_rcv_packets; 11962306a36Sopenharmony_ci} __packed; 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001) 12262306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002) 12362306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004) 12462306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008) 12562306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010) 12662306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020) 12762306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040) 12862306a36Sopenharmony_ci#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080) 12962306a36Sopenharmony_ci 13062306a36Sopenharmony_ci#endif /* IB_PMA_H */ 131