Path: blob/master/drivers/infiniband/hw/qib/qib_mad.h
15112 views
/*1* Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.2* All rights reserved.3* Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.4*5* This software is available to you under a choice of one of two6* licenses. You may choose to be licensed under the terms of the GNU7* General Public License (GPL) Version 2, available from the file8* COPYING in the main directory of this source tree, or the9* OpenIB.org BSD license below:10*11* Redistribution and use in source and binary forms, with or12* without modification, are permitted provided that the following13* conditions are met:14*15* - Redistributions of source code must retain the above16* copyright notice, this list of conditions and the following17* disclaimer.18*19* - Redistributions in binary form must reproduce the above20* copyright notice, this list of conditions and the following21* disclaimer in the documentation and/or other materials22* provided with the distribution.23*24* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,25* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF26* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND27* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS28* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN29* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN30* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE31* SOFTWARE.32*/3334#define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004)35#define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008)36#define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C)37#define IB_SMP_INVALID_FIELD cpu_to_be16(0x001C)3839struct ib_node_info {40u8 base_version;41u8 class_version;42u8 node_type;43u8 num_ports;44__be64 sys_guid;45__be64 node_guid;46__be64 port_guid;47__be16 partition_cap;48__be16 device_id;49__be32 revision;50u8 local_port_num;51u8 vendor_id[3];52} __attribute__ ((packed));5354struct ib_mad_notice_attr {55u8 generic_type;56u8 prod_type_msb;57__be16 prod_type_lsb;58__be16 trap_num;59__be16 issuer_lid;60__be16 toggle_count;6162union {63struct {64u8 details[54];65} raw_data;6667struct {68__be16 reserved;69__be16 lid; /* where violation happened */70u8 port_num; /* where violation happened */71} __attribute__ ((packed)) ntc_129_131;7273struct {74__be16 reserved;75__be16 lid; /* LID where change occurred */76u8 reserved2;77u8 local_changes; /* low bit - local changes */78__be32 new_cap_mask; /* new capability mask */79u8 reserved3;80u8 change_flags; /* low 3 bits only */81} __attribute__ ((packed)) ntc_144;8283struct {84__be16 reserved;85__be16 lid; /* lid where sys guid changed */86__be16 reserved2;87__be64 new_sys_guid;88} __attribute__ ((packed)) ntc_145;8990struct {91__be16 reserved;92__be16 lid;93__be16 dr_slid;94u8 method;95u8 reserved2;96__be16 attr_id;97__be32 attr_mod;98__be64 mkey;99u8 reserved3;100u8 dr_trunc_hop;101u8 dr_rtn_path[30];102} __attribute__ ((packed)) ntc_256;103104struct {105__be16 reserved;106__be16 lid1;107__be16 lid2;108__be32 key;109__be32 sl_qp1; /* SL: high 4 bits */110__be32 qp2; /* high 8 bits reserved */111union ib_gid gid1;112union ib_gid gid2;113} __attribute__ ((packed)) ntc_257_258;114115} details;116};117118/*119* Generic trap/notice types120*/121#define IB_NOTICE_TYPE_FATAL 0x80122#define IB_NOTICE_TYPE_URGENT 0x81123#define IB_NOTICE_TYPE_SECURITY 0x82124#define IB_NOTICE_TYPE_SM 0x83125#define IB_NOTICE_TYPE_INFO 0x84126127/*128* Generic trap/notice producers129*/130#define IB_NOTICE_PROD_CA cpu_to_be16(1)131#define IB_NOTICE_PROD_SWITCH cpu_to_be16(2)132#define IB_NOTICE_PROD_ROUTER cpu_to_be16(3)133#define IB_NOTICE_PROD_CLASS_MGR cpu_to_be16(4)134135/*136* Generic trap/notice numbers137*/138#define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129)139#define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130)140#define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131)141#define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144)142#define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145)143#define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256)144#define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257)145#define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258)146147/*148* Repress trap/notice flags149*/150#define IB_NOTICE_REPRESS_LLI_THRESH (1 << 0)151#define IB_NOTICE_REPRESS_EBO_THRESH (1 << 1)152#define IB_NOTICE_REPRESS_FLOW_UPDATE (1 << 2)153#define IB_NOTICE_REPRESS_CAP_MASK_CHG (1 << 3)154#define IB_NOTICE_REPRESS_SYS_GUID_CHG (1 << 4)155#define IB_NOTICE_REPRESS_BAD_MKEY (1 << 5)156#define IB_NOTICE_REPRESS_BAD_PKEY (1 << 6)157#define IB_NOTICE_REPRESS_BAD_QKEY (1 << 7)158159/*160* Generic trap/notice other local changes flags (trap 144).161*/162#define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */163#define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */164#define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01165166/*167* Generic trap/notice M_Key volation flags in dr_trunc_hop (trap 256).168*/169#define IB_NOTICE_TRAP_DR_NOTICE 0x80170#define IB_NOTICE_TRAP_DR_TRUNC 0x40171172struct ib_vl_weight_elem {173u8 vl; /* Only low 4 bits, upper 4 bits reserved */174u8 weight;175};176177#define IB_VLARB_LOWPRI_0_31 1178#define IB_VLARB_LOWPRI_32_63 2179#define IB_VLARB_HIGHPRI_0_31 3180#define IB_VLARB_HIGHPRI_32_63 4181182/*183* PMA class portinfo capability mask bits184*/185#define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8)186#define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9)187#define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12)188189#define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001)190#define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010)191#define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011)192#define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012)193#define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D)194#define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E)195#define IB_PMA_PORT_COUNTERS_CONG cpu_to_be16(0xFF00)196197struct ib_perf {198u8 base_version;199u8 mgmt_class;200u8 class_version;201u8 method;202__be16 status;203__be16 unused;204__be64 tid;205__be16 attr_id;206__be16 resv;207__be32 attr_mod;208u8 reserved[40];209u8 data[192];210} __attribute__ ((packed));211212struct ib_pma_classportinfo {213u8 base_version;214u8 class_version;215__be16 cap_mask;216u8 reserved[3];217u8 resp_time_value; /* only lower 5 bits */218union ib_gid redirect_gid;219__be32 redirect_tc_sl_fl; /* 8, 4, 20 bits respectively */220__be16 redirect_lid;221__be16 redirect_pkey;222__be32 redirect_qp; /* only lower 24 bits */223__be32 redirect_qkey;224union ib_gid trap_gid;225__be32 trap_tc_sl_fl; /* 8, 4, 20 bits respectively */226__be16 trap_lid;227__be16 trap_pkey;228__be32 trap_hl_qp; /* 8, 24 bits respectively */229__be32 trap_qkey;230} __attribute__ ((packed));231232struct ib_pma_portsamplescontrol {233u8 opcode;234u8 port_select;235u8 tick;236u8 counter_width; /* only lower 3 bits */237__be32 counter_mask0_9; /* 2, 10 * 3, bits */238__be16 counter_mask10_14; /* 1, 5 * 3, bits */239u8 sample_mechanisms;240u8 sample_status; /* only lower 2 bits */241__be64 option_mask;242__be64 vendor_mask;243__be32 sample_start;244__be32 sample_interval;245__be16 tag;246__be16 counter_select[15];247} __attribute__ ((packed));248249struct ib_pma_portsamplesresult {250__be16 tag;251__be16 sample_status; /* only lower 2 bits */252__be32 counter[15];253} __attribute__ ((packed));254255struct ib_pma_portsamplesresult_ext {256__be16 tag;257__be16 sample_status; /* only lower 2 bits */258__be32 extended_width; /* only upper 2 bits */259__be64 counter[15];260} __attribute__ ((packed));261262struct ib_pma_portcounters {263u8 reserved;264u8 port_select;265__be16 counter_select;266__be16 symbol_error_counter;267u8 link_error_recovery_counter;268u8 link_downed_counter;269__be16 port_rcv_errors;270__be16 port_rcv_remphys_errors;271__be16 port_rcv_switch_relay_errors;272__be16 port_xmit_discards;273u8 port_xmit_constraint_errors;274u8 port_rcv_constraint_errors;275u8 reserved1;276u8 lli_ebor_errors; /* 4, 4, bits */277__be16 reserved2;278__be16 vl15_dropped;279__be32 port_xmit_data;280__be32 port_rcv_data;281__be32 port_xmit_packets;282__be32 port_rcv_packets;283} __attribute__ ((packed));284285struct ib_pma_portcounters_cong {286u8 reserved;287u8 reserved1;288__be16 port_check_rate;289__be16 symbol_error_counter;290u8 link_error_recovery_counter;291u8 link_downed_counter;292__be16 port_rcv_errors;293__be16 port_rcv_remphys_errors;294__be16 port_rcv_switch_relay_errors;295__be16 port_xmit_discards;296u8 port_xmit_constraint_errors;297u8 port_rcv_constraint_errors;298u8 reserved2;299u8 lli_ebor_errors; /* 4, 4, bits */300__be16 reserved3;301__be16 vl15_dropped;302__be64 port_xmit_data;303__be64 port_rcv_data;304__be64 port_xmit_packets;305__be64 port_rcv_packets;306__be64 port_xmit_wait;307__be64 port_adr_events;308} __attribute__ ((packed));309310#define IB_PMA_CONG_HW_CONTROL_TIMER 0x00311#define IB_PMA_CONG_HW_CONTROL_SAMPLE 0x01312313#define QIB_XMIT_RATE_UNSUPPORTED 0x0314#define QIB_XMIT_RATE_PICO 0x7315/* number of 4nsec cycles equaling 2secs */316#define QIB_CONG_TIMER_PSINTERVAL 0x1DCD64EC317318#define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001)319#define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002)320#define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004)321#define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008)322#define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010)323#define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040)324#define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200)325#define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400)326#define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800)327#define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000)328#define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000)329#define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000)330#define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000)331332#define IB_PMA_SEL_CONG_ALL 0x01333#define IB_PMA_SEL_CONG_PORT_DATA 0x02334#define IB_PMA_SEL_CONG_XMIT 0x04335#define IB_PMA_SEL_CONG_ROUTING 0x08336337struct ib_pma_portcounters_ext {338u8 reserved;339u8 port_select;340__be16 counter_select;341__be32 reserved1;342__be64 port_xmit_data;343__be64 port_rcv_data;344__be64 port_xmit_packets;345__be64 port_rcv_packets;346__be64 port_unicast_xmit_packets;347__be64 port_unicast_rcv_packets;348__be64 port_multicast_xmit_packets;349__be64 port_multicast_rcv_packets;350} __attribute__ ((packed));351352#define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001)353#define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002)354#define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004)355#define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008)356#define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010)357#define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020)358#define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040)359#define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080)360361/*362* The PortSamplesControl.CounterMasks field is an array of 3 bit fields363* which specify the N'th counter's capabilities. See ch. 16.1.3.2.364* We support 5 counters which only count the mandatory quantities.365*/366#define COUNTER_MASK(q, n) (q << ((9 - n) * 3))367#define COUNTER_MASK0_9 \368cpu_to_be32(COUNTER_MASK(1, 0) | \369COUNTER_MASK(1, 1) | \370COUNTER_MASK(1, 2) | \371COUNTER_MASK(1, 3) | \372COUNTER_MASK(1, 4))373374375