1219820Sjeff/* 2219820Sjeff * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved. 3219820Sjeff * Copyright (c) 2004 Infinicon Corporation. All rights reserved. 4219820Sjeff * Copyright (c) 2004 Intel Corporation. All rights reserved. 5219820Sjeff * Copyright (c) 2004 Topspin Corporation. All rights reserved. 6219820Sjeff * Copyright (c) 2004 Voltaire Corporation. All rights reserved. 7219820Sjeff * 8219820Sjeff * This software is available to you under a choice of one of two 9219820Sjeff * licenses. You may choose to be licensed under the terms of the GNU 10219820Sjeff * General Public License (GPL) Version 2, available from the file 11219820Sjeff * COPYING in the main directory of this source tree, or the 12219820Sjeff * OpenIB.org BSD license below: 13219820Sjeff * 14219820Sjeff * Redistribution and use in source and binary forms, with or 15219820Sjeff * without modification, are permitted provided that the following 16219820Sjeff * conditions are met: 17219820Sjeff * 18219820Sjeff * - Redistributions of source code must retain the above 19219820Sjeff * copyright notice, this list of conditions and the following 20219820Sjeff * disclaimer. 21219820Sjeff * 22219820Sjeff * - Redistributions in binary form must reproduce the above 23219820Sjeff * copyright notice, this list of conditions and the following 24219820Sjeff * disclaimer in the documentation and/or other materials 25219820Sjeff * provided with the distribution. 26219820Sjeff * 27219820Sjeff * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 28219820Sjeff * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 29219820Sjeff * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 30219820Sjeff * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 31219820Sjeff * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 32219820Sjeff * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 33219820Sjeff * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 34219820Sjeff * SOFTWARE. 35219820Sjeff */ 36219820Sjeff 37219820Sjeff#if !defined(IB_SMI_H) 38219820Sjeff#define IB_SMI_H 39219820Sjeff 40219820Sjeff#include <rdma/ib_mad.h> 41273135Shselasky#include <asm/byteorder.h> 42219820Sjeff 43219820Sjeff#define IB_SMP_DATA_SIZE 64 44219820Sjeff#define IB_SMP_MAX_PATH_HOPS 64 45219820Sjeff 46219820Sjeffstruct ib_smp { 47219820Sjeff u8 base_version; 48219820Sjeff u8 mgmt_class; 49219820Sjeff u8 class_version; 50219820Sjeff u8 method; 51219820Sjeff __be16 status; 52219820Sjeff u8 hop_ptr; 53219820Sjeff u8 hop_cnt; 54219820Sjeff __be64 tid; 55219820Sjeff __be16 attr_id; 56219820Sjeff __be16 resv; 57219820Sjeff __be32 attr_mod; 58219820Sjeff __be64 mkey; 59219820Sjeff __be16 dr_slid; 60219820Sjeff __be16 dr_dlid; 61219820Sjeff u8 reserved[28]; 62219820Sjeff u8 data[IB_SMP_DATA_SIZE]; 63219820Sjeff u8 initial_path[IB_SMP_MAX_PATH_HOPS]; 64219820Sjeff u8 return_path[IB_SMP_MAX_PATH_HOPS]; 65219820Sjeff} __attribute__ ((packed)); 66219820Sjeff 67219820Sjeff#define IB_SMP_DIRECTION cpu_to_be16(0x8000) 68219820Sjeff 69219820Sjeff/* Subnet management attributes */ 70219820Sjeff#define IB_SMP_ATTR_NOTICE cpu_to_be16(0x0002) 71219820Sjeff#define IB_SMP_ATTR_NODE_DESC cpu_to_be16(0x0010) 72219820Sjeff#define IB_SMP_ATTR_NODE_INFO cpu_to_be16(0x0011) 73219820Sjeff#define IB_SMP_ATTR_SWITCH_INFO cpu_to_be16(0x0012) 74219820Sjeff#define IB_SMP_ATTR_GUID_INFO cpu_to_be16(0x0014) 75219820Sjeff#define IB_SMP_ATTR_PORT_INFO cpu_to_be16(0x0015) 76219820Sjeff#define IB_SMP_ATTR_PKEY_TABLE cpu_to_be16(0x0016) 77219820Sjeff#define IB_SMP_ATTR_SL_TO_VL_TABLE cpu_to_be16(0x0017) 78219820Sjeff#define IB_SMP_ATTR_VL_ARB_TABLE cpu_to_be16(0x0018) 79219820Sjeff#define IB_SMP_ATTR_LINEAR_FORWARD_TABLE cpu_to_be16(0x0019) 80219820Sjeff#define IB_SMP_ATTR_RANDOM_FORWARD_TABLE cpu_to_be16(0x001A) 81219820Sjeff#define IB_SMP_ATTR_MCAST_FORWARD_TABLE cpu_to_be16(0x001B) 82219820Sjeff#define IB_SMP_ATTR_SM_INFO cpu_to_be16(0x0020) 83219820Sjeff#define IB_SMP_ATTR_VENDOR_DIAG cpu_to_be16(0x0030) 84219820Sjeff#define IB_SMP_ATTR_LED_INFO cpu_to_be16(0x0031) 85219820Sjeff#define IB_SMP_ATTR_VENDOR_MASK cpu_to_be16(0xFF00) 86219820Sjeff 87219820Sjeffstruct ib_port_info { 88219820Sjeff __be64 mkey; 89219820Sjeff __be64 gid_prefix; 90219820Sjeff __be16 lid; 91219820Sjeff __be16 sm_lid; 92219820Sjeff __be32 cap_mask; 93219820Sjeff __be16 diag_code; 94219820Sjeff __be16 mkey_lease_period; 95219820Sjeff u8 local_port_num; 96219820Sjeff u8 link_width_enabled; 97219820Sjeff u8 link_width_supported; 98219820Sjeff u8 link_width_active; 99219820Sjeff u8 linkspeed_portstate; /* 4 bits, 4 bits */ 100219820Sjeff u8 portphysstate_linkdown; /* 4 bits, 4 bits */ 101219820Sjeff u8 mkeyprot_resv_lmc; /* 2 bits, 3, 3 */ 102219820Sjeff u8 linkspeedactive_enabled; /* 4 bits, 4 bits */ 103219820Sjeff u8 neighbormtu_mastersmsl; /* 4 bits, 4 bits */ 104219820Sjeff u8 vlcap_inittype; /* 4 bits, 4 bits */ 105219820Sjeff u8 vl_high_limit; 106219820Sjeff u8 vl_arb_high_cap; 107219820Sjeff u8 vl_arb_low_cap; 108219820Sjeff u8 inittypereply_mtucap; /* 4 bits, 4 bits */ 109219820Sjeff u8 vlstallcnt_hoqlife; /* 3 bits, 5 bits */ 110219820Sjeff u8 operationalvl_pei_peo_fpi_fpo; /* 4 bits, 1, 1, 1, 1 */ 111219820Sjeff __be16 mkey_violations; 112219820Sjeff __be16 pkey_violations; 113219820Sjeff __be16 qkey_violations; 114219820Sjeff u8 guid_cap; 115219820Sjeff u8 clientrereg_resv_subnetto; /* 1 bit, 2 bits, 5 */ 116219820Sjeff u8 resv_resptimevalue; /* 3 bits, 5 bits */ 117219820Sjeff u8 localphyerrors_overrunerrors; /* 4 bits, 4 bits */ 118219820Sjeff __be16 max_credit_hint; 119219820Sjeff u8 resv; 120219820Sjeff u8 link_roundtrip_latency[3]; 121219820Sjeff}; 122219820Sjeff 123219820Sjeffstatic inline u8 124219820Sjeffib_get_smp_direction(struct ib_smp *smp) 125219820Sjeff{ 126219820Sjeff return ((smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION); 127219820Sjeff} 128219820Sjeff 129219820Sjeff#endif /* IB_SMI_H */ 130