/*1* Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.2* Copyright (c) 2004 Infinicon Corporation. All rights reserved.3* Copyright (c) 2004 Intel Corporation. All rights reserved.4* Copyright (c) 2004 Topspin Corporation. All rights reserved.5* Copyright (c) 2004 Voltaire Corporation. All rights reserved.6*7* This software is available to you under a choice of one of two8* licenses. You may choose to be licensed under the terms of the GNU9* General Public License (GPL) Version 2, available from the file10* COPYING in the main directory of this source tree, or the11* OpenIB.org BSD license below:12*13* Redistribution and use in source and binary forms, with or14* without modification, are permitted provided that the following15* conditions are met:16*17* - Redistributions of source code must retain the above18* copyright notice, this list of conditions and the following19* disclaimer.20*21* - Redistributions in binary form must reproduce the above22* copyright notice, this list of conditions and the following23* disclaimer in the documentation and/or other materials24* provided with the distribution.25*26* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,27* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF28* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND29* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS30* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN31* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN32* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE33* SOFTWARE.34*/3536#if !defined(IB_SMI_H)37#define IB_SMI_H3839#include <rdma/ib_mad.h>4041#define IB_SMP_DATA_SIZE 6442#define IB_SMP_MAX_PATH_HOPS 644344struct ib_smp {45u8 base_version;46u8 mgmt_class;47u8 class_version;48u8 method;49__be16 status;50u8 hop_ptr;51u8 hop_cnt;52__be64 tid;53__be16 attr_id;54__be16 resv;55__be32 attr_mod;56__be64 mkey;57__be16 dr_slid;58__be16 dr_dlid;59u8 reserved[28];60u8 data[IB_SMP_DATA_SIZE];61u8 initial_path[IB_SMP_MAX_PATH_HOPS];62u8 return_path[IB_SMP_MAX_PATH_HOPS];63} __attribute__ ((packed));6465#define IB_SMP_DIRECTION cpu_to_be16(0x8000)6667/* Subnet management attributes */68#define IB_SMP_ATTR_NOTICE cpu_to_be16(0x0002)69#define IB_SMP_ATTR_NODE_DESC cpu_to_be16(0x0010)70#define IB_SMP_ATTR_NODE_INFO cpu_to_be16(0x0011)71#define IB_SMP_ATTR_SWITCH_INFO cpu_to_be16(0x0012)72#define IB_SMP_ATTR_GUID_INFO cpu_to_be16(0x0014)73#define IB_SMP_ATTR_PORT_INFO cpu_to_be16(0x0015)74#define IB_SMP_ATTR_PKEY_TABLE cpu_to_be16(0x0016)75#define IB_SMP_ATTR_SL_TO_VL_TABLE cpu_to_be16(0x0017)76#define IB_SMP_ATTR_VL_ARB_TABLE cpu_to_be16(0x0018)77#define IB_SMP_ATTR_LINEAR_FORWARD_TABLE cpu_to_be16(0x0019)78#define IB_SMP_ATTR_RANDOM_FORWARD_TABLE cpu_to_be16(0x001A)79#define IB_SMP_ATTR_MCAST_FORWARD_TABLE cpu_to_be16(0x001B)80#define IB_SMP_ATTR_SM_INFO cpu_to_be16(0x0020)81#define IB_SMP_ATTR_VENDOR_DIAG cpu_to_be16(0x0030)82#define IB_SMP_ATTR_LED_INFO cpu_to_be16(0x0031)83#define IB_SMP_ATTR_VENDOR_MASK cpu_to_be16(0xFF00)8485struct ib_port_info {86__be64 mkey;87__be64 gid_prefix;88__be16 lid;89__be16 sm_lid;90__be32 cap_mask;91__be16 diag_code;92__be16 mkey_lease_period;93u8 local_port_num;94u8 link_width_enabled;95u8 link_width_supported;96u8 link_width_active;97u8 linkspeed_portstate; /* 4 bits, 4 bits */98u8 portphysstate_linkdown; /* 4 bits, 4 bits */99u8 mkeyprot_resv_lmc; /* 2 bits, 3, 3 */100u8 linkspeedactive_enabled; /* 4 bits, 4 bits */101u8 neighbormtu_mastersmsl; /* 4 bits, 4 bits */102u8 vlcap_inittype; /* 4 bits, 4 bits */103u8 vl_high_limit;104u8 vl_arb_high_cap;105u8 vl_arb_low_cap;106u8 inittypereply_mtucap; /* 4 bits, 4 bits */107u8 vlstallcnt_hoqlife; /* 3 bits, 5 bits */108u8 operationalvl_pei_peo_fpi_fpo; /* 4 bits, 1, 1, 1, 1 */109__be16 mkey_violations;110__be16 pkey_violations;111__be16 qkey_violations;112u8 guid_cap;113u8 clientrereg_resv_subnetto; /* 1 bit, 2 bits, 5 */114u8 resv_resptimevalue; /* 3 bits, 5 bits */115u8 localphyerrors_overrunerrors; /* 4 bits, 4 bits */116__be16 max_credit_hint;117u8 resv;118u8 link_roundtrip_latency[3];119};120121static inline u8122ib_get_smp_direction(struct ib_smp *smp)123{124return ((smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);125}126127#endif /* IB_SMI_H */128129130