1255932Salfred/* 2255932Salfred * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation. 3255932Salfred * All rights reserved. 4255932Salfred * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved. 5255932Salfred * 6255932Salfred * This software is available to you under a choice of one of two 7255932Salfred * licenses. You may choose to be licensed under the terms of the GNU 8255932Salfred * General Public License (GPL) Version 2, available from the file 9255932Salfred * COPYING in the main directory of this source tree, or the 10255932Salfred * OpenIB.org BSD license below: 11255932Salfred * 12255932Salfred * Redistribution and use in source and binary forms, with or 13255932Salfred * without modification, are permitted provided that the following 14255932Salfred * conditions are met: 15255932Salfred * 16255932Salfred * - Redistributions of source code must retain the above 17255932Salfred * copyright notice, this list of conditions and the following 18255932Salfred * disclaimer. 19255932Salfred * 20255932Salfred * - Redistributions in binary form must reproduce the above 21255932Salfred * copyright notice, this list of conditions and the following 22255932Salfred * disclaimer in the documentation and/or other materials 23255932Salfred * provided with the distribution. 24255932Salfred * 25255932Salfred * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 26255932Salfred * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 27255932Salfred * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 28255932Salfred * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 29255932Salfred * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 30255932Salfred * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 31255932Salfred * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 32255932Salfred * SOFTWARE. 33255932Salfred */ 34255932Salfred 35255932Salfred#if !defined(IB_PMA_H) 36255932Salfred#define IB_PMA_H 37255932Salfred 38255932Salfred#include <rdma/ib_mad.h> 39255932Salfred 40255932Salfred/* 41255932Salfred * PMA class portinfo capability mask bits 42255932Salfred */ 43255932Salfred#define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8) 44255932Salfred#define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9) 45255932Salfred#define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12) 46255932Salfred 47255932Salfred#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001) 48255932Salfred#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010) 49255932Salfred#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011) 50255932Salfred#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012) 51255932Salfred#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D) 52255932Salfred#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E) 53255932Salfred 54255932Salfredstruct ib_pma_mad { 55255932Salfred struct ib_mad_hdr mad_hdr; 56255932Salfred u8 reserved[40]; 57255932Salfred u8 data[192]; 58255932Salfred} __packed; 59255932Salfred 60255932Salfredstruct ib_pma_portsamplescontrol { 61255932Salfred u8 opcode; 62255932Salfred u8 port_select; 63255932Salfred u8 tick; 64255932Salfred u8 counter_width; /* resv: 7:3, counter width: 2:0 */ 65255932Salfred __be32 counter_mask0_9; /* 2, 10 3-bit fields */ 66255932Salfred __be16 counter_mask10_14; /* 1, 5 3-bit fields */ 67255932Salfred u8 sample_mechanisms; 68255932Salfred u8 sample_status; /* only lower 2 bits */ 69255932Salfred __be64 option_mask; 70255932Salfred __be64 vendor_mask; 71255932Salfred __be32 sample_start; 72255932Salfred __be32 sample_interval; 73255932Salfred __be16 tag; 74255932Salfred __be16 counter_select[15]; 75255932Salfred __be32 reserved1; 76255932Salfred __be64 samples_only_option_mask; 77255932Salfred __be32 reserved2[28]; 78255932Salfred}; 79255932Salfred 80255932Salfredstruct ib_pma_portsamplesresult { 81255932Salfred __be16 tag; 82255932Salfred __be16 sample_status; /* only lower 2 bits */ 83255932Salfred __be32 counter[15]; 84255932Salfred}; 85255932Salfred 86255932Salfredstruct ib_pma_portsamplesresult_ext { 87255932Salfred __be16 tag; 88255932Salfred __be16 sample_status; /* only lower 2 bits */ 89255932Salfred __be32 extended_width; /* only upper 2 bits */ 90255932Salfred __be64 counter[15]; 91255932Salfred}; 92255932Salfred 93255932Salfredstruct ib_pma_portcounters { 94255932Salfred u8 reserved; 95255932Salfred u8 port_select; 96255932Salfred __be16 counter_select; 97255932Salfred __be16 symbol_error_counter; 98255932Salfred u8 link_error_recovery_counter; 99255932Salfred u8 link_downed_counter; 100255932Salfred __be16 port_rcv_errors; 101255932Salfred __be16 port_rcv_remphys_errors; 102255932Salfred __be16 port_rcv_switch_relay_errors; 103255932Salfred __be16 port_xmit_discards; 104255932Salfred u8 port_xmit_constraint_errors; 105255932Salfred u8 port_rcv_constraint_errors; 106255932Salfred u8 reserved1; 107255932Salfred u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */ 108255932Salfred __be16 reserved2; 109255932Salfred __be16 vl15_dropped; 110255932Salfred __be32 port_xmit_data; 111255932Salfred __be32 port_rcv_data; 112255932Salfred __be32 port_xmit_packets; 113255932Salfred __be32 port_rcv_packets; 114255932Salfred __be32 port_xmit_wait; 115255932Salfred} __packed; 116255932Salfred 117255932Salfred 118255932Salfred#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001) 119255932Salfred#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002) 120255932Salfred#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004) 121255932Salfred#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008) 122255932Salfred#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010) 123255932Salfred#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040) 124255932Salfred#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200) 125255932Salfred#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400) 126255932Salfred#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800) 127255932Salfred#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000) 128255932Salfred#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000) 129255932Salfred#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000) 130255932Salfred#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000) 131255932Salfred 132255932Salfredstruct ib_pma_portcounters_ext { 133255932Salfred u8 reserved; 134255932Salfred u8 port_select; 135255932Salfred __be16 counter_select; 136255932Salfred __be32 reserved1; 137255932Salfred __be64 port_xmit_data; 138255932Salfred __be64 port_rcv_data; 139255932Salfred __be64 port_xmit_packets; 140255932Salfred __be64 port_rcv_packets; 141255932Salfred __be64 port_unicast_xmit_packets; 142255932Salfred __be64 port_unicast_rcv_packets; 143255932Salfred __be64 port_multicast_xmit_packets; 144255932Salfred __be64 port_multicast_rcv_packets; 145255932Salfred} __packed; 146255932Salfred 147255932Salfred#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001) 148255932Salfred#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002) 149255932Salfred#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004) 150255932Salfred#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008) 151255932Salfred#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010) 152255932Salfred#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020) 153255932Salfred#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040) 154255932Salfred#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080) 155255932Salfred 156255932Salfred#endif /* IB_PMA_H */ 157