^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef IB_PMA_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define IB_PMA_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <rdma/ib_mad.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * PMA class portinfo capability mask bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define IB_PMA_CLASS_CAP_EXT_WIDTH_NOIETF cpu_to_be16(1 << 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct ib_pma_mad {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct ib_mad_hdr mad_hdr;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) u8 reserved[40];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) u8 data[192];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) struct ib_pma_portsamplescontrol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) u8 opcode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) u8 port_select;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) u8 tick;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) u8 counter_width; /* resv: 7:3, counter width: 2:0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) __be32 counter_mask0_9; /* 2, 10 3-bit fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) __be16 counter_mask10_14; /* 1, 5 3-bit fields */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) u8 sample_mechanisms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) u8 sample_status; /* only lower 2 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) __be64 option_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) __be64 vendor_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) __be32 sample_start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) __be32 sample_interval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) __be16 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) __be16 counter_select[15];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) __be32 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) __be64 samples_only_option_mask;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) __be32 reserved2[28];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) struct ib_pma_portsamplesresult {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) __be16 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) __be16 sample_status; /* only lower 2 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) __be32 counter[15];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) struct ib_pma_portsamplesresult_ext {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) __be16 tag;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) __be16 sample_status; /* only lower 2 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) __be32 extended_width; /* only upper 2 bits */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) __be64 counter[15];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) struct ib_pma_portcounters {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) u8 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) u8 port_select;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) __be16 counter_select;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) __be16 symbol_error_counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) u8 link_error_recovery_counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) u8 link_downed_counter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) __be16 port_rcv_errors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) __be16 port_rcv_remphys_errors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) __be16 port_rcv_switch_relay_errors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) __be16 port_xmit_discards;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) u8 port_xmit_constraint_errors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) u8 port_rcv_constraint_errors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) u8 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) __be16 reserved2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) __be16 vl15_dropped;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) __be32 port_xmit_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) __be32 port_rcv_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) __be32 port_xmit_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) __be32 port_rcv_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) __be32 port_xmit_wait;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) #define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) #define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) #define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) #define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) #define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) #define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) #define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) #define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) #define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) #define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) #define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) #define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) struct ib_pma_portcounters_ext {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) u8 reserved;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) u8 port_select;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) __be16 counter_select;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) __be32 reserved1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) __be64 port_xmit_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) __be64 port_rcv_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) __be64 port_xmit_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) __be64 port_rcv_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) __be64 port_unicast_xmit_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) __be64 port_unicast_rcv_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) __be64 port_multicast_xmit_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) __be64 port_multicast_rcv_packets;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) } __packed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) #define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) #define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) #define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) #define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) #define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) #define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) #define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) #endif /* IB_PMA_H */