1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
3 * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
5 * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
11 #include <rdma/ib_mad.h>
14 * PMA class portinfo capability mask bits
16 #define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8)
17 #define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9)
18 #define IB_PMA_CLASS_CAP_EXT_WIDTH_NOIETF cpu_to_be16(1 << 10)
19 #define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12)
21 #define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001)
22 #define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010)
23 #define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011)
24 #define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012)
25 #define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D)
26 #define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E)
29 struct ib_mad_hdr mad_hdr;
34 struct ib_pma_portsamplescontrol {
38 u8 counter_width; /* resv: 7:3, counter width: 2:0 */
39 __be32 counter_mask0_9; /* 2, 10 3-bit fields */
40 __be16 counter_mask10_14; /* 1, 5 3-bit fields */
42 u8 sample_status; /* only lower 2 bits */
46 __be32 sample_interval;
48 __be16 counter_select[15];
50 __be64 samples_only_option_mask;
54 struct ib_pma_portsamplesresult {
56 __be16 sample_status; /* only lower 2 bits */
60 struct ib_pma_portsamplesresult_ext {
62 __be16 sample_status; /* only lower 2 bits */
63 __be32 extended_width; /* only upper 2 bits */
67 struct ib_pma_portcounters {
70 __be16 counter_select;
71 __be16 symbol_error_counter;
72 u8 link_error_recovery_counter;
73 u8 link_downed_counter;
74 __be16 port_rcv_errors;
75 __be16 port_rcv_remphys_errors;
76 __be16 port_rcv_switch_relay_errors;
77 __be16 port_xmit_discards;
78 u8 port_xmit_constraint_errors;
79 u8 port_rcv_constraint_errors;
81 u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */
84 __be32 port_xmit_data;
86 __be32 port_xmit_packets;
87 __be32 port_rcv_packets;
88 __be32 port_xmit_wait;
92 #define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001)
93 #define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002)
94 #define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004)
95 #define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008)
96 #define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010)
97 #define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040)
98 #define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200)
99 #define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400)
100 #define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800)
101 #define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000)
102 #define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000)
103 #define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000)
104 #define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000)
106 struct ib_pma_portcounters_ext {
109 __be16 counter_select;
111 __be64 port_xmit_data;
112 __be64 port_rcv_data;
113 __be64 port_xmit_packets;
114 __be64 port_rcv_packets;
115 __be64 port_unicast_xmit_packets;
116 __be64 port_unicast_rcv_packets;
117 __be64 port_multicast_xmit_packets;
118 __be64 port_multicast_rcv_packets;
121 #define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001)
122 #define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002)
123 #define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004)
124 #define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008)
125 #define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010)
126 #define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020)
127 #define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040)
128 #define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080)
130 #endif /* IB_PMA_H */