Path: blob/main/sys/ofed/include/rdma/opa_port_info.h
39482 views
/*-1* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.02*3* Copyright (c) 2014 Intel Corporation. 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#if !defined(OPA_PORT_INFO_H)35#define OPA_PORT_INFO_H3637#define OPA_PORT_LINK_MODE_NOP 0 /* No change */38#define OPA_PORT_LINK_MODE_OPA 4 /* Port mode is OPA */3940#define OPA_PORT_PACKET_FORMAT_NOP 0 /* No change */41#define OPA_PORT_PACKET_FORMAT_8B 1 /* Format 8B */42#define OPA_PORT_PACKET_FORMAT_9B 2 /* Format 9B */43#define OPA_PORT_PACKET_FORMAT_10B 4 /* Format 10B */44#define OPA_PORT_PACKET_FORMAT_16B 8 /* Format 16B */4546#define OPA_PORT_LTP_CRC_MODE_NONE 0 /* No change */47#define OPA_PORT_LTP_CRC_MODE_14 1 /* 14-bit LTP CRC mode (optional) */48#define OPA_PORT_LTP_CRC_MODE_16 2 /* 16-bit LTP CRC mode */49#define OPA_PORT_LTP_CRC_MODE_48 4 /* 48-bit LTP CRC mode (optional) */50#define OPA_PORT_LTP_CRC_MODE_PER_LANE 8 /* 12/16-bit per lane LTP CRC mode */5152/* Link Down / Neighbor Link Down Reason; indicated as follows: */53#define OPA_LINKDOWN_REASON_NONE 0 /* No specified reason */54#define OPA_LINKDOWN_REASON_RCV_ERROR_0 155#define OPA_LINKDOWN_REASON_BAD_PKT_LEN 256#define OPA_LINKDOWN_REASON_PKT_TOO_LONG 357#define OPA_LINKDOWN_REASON_PKT_TOO_SHORT 458#define OPA_LINKDOWN_REASON_BAD_SLID 559#define OPA_LINKDOWN_REASON_BAD_DLID 660#define OPA_LINKDOWN_REASON_BAD_L2 761#define OPA_LINKDOWN_REASON_BAD_SC 862#define OPA_LINKDOWN_REASON_RCV_ERROR_8 963#define OPA_LINKDOWN_REASON_BAD_MID_TAIL 1064#define OPA_LINKDOWN_REASON_RCV_ERROR_10 1165#define OPA_LINKDOWN_REASON_PREEMPT_ERROR 1266#define OPA_LINKDOWN_REASON_PREEMPT_VL15 1367#define OPA_LINKDOWN_REASON_BAD_VL_MARKER 1468#define OPA_LINKDOWN_REASON_RCV_ERROR_14 1569#define OPA_LINKDOWN_REASON_RCV_ERROR_15 1670#define OPA_LINKDOWN_REASON_BAD_HEAD_DIST 1771#define OPA_LINKDOWN_REASON_BAD_TAIL_DIST 1872#define OPA_LINKDOWN_REASON_BAD_CTRL_DIST 1973#define OPA_LINKDOWN_REASON_BAD_CREDIT_ACK 2074#define OPA_LINKDOWN_REASON_UNSUPPORTED_VL_MARKER 2175#define OPA_LINKDOWN_REASON_BAD_PREEMPT 2276#define OPA_LINKDOWN_REASON_BAD_CONTROL_FLIT 2377#define OPA_LINKDOWN_REASON_EXCEED_MULTICAST_LIMIT 2478#define OPA_LINKDOWN_REASON_RCV_ERROR_24 2579#define OPA_LINKDOWN_REASON_RCV_ERROR_25 2680#define OPA_LINKDOWN_REASON_RCV_ERROR_26 2781#define OPA_LINKDOWN_REASON_RCV_ERROR_27 2882#define OPA_LINKDOWN_REASON_RCV_ERROR_28 2983#define OPA_LINKDOWN_REASON_RCV_ERROR_29 3084#define OPA_LINKDOWN_REASON_RCV_ERROR_30 3185#define OPA_LINKDOWN_REASON_EXCESSIVE_BUFFER_OVERRUN 3286#define OPA_LINKDOWN_REASON_UNKNOWN 3387/* 34 -reserved */88#define OPA_LINKDOWN_REASON_REBOOT 3589#define OPA_LINKDOWN_REASON_NEIGHBOR_UNKNOWN 3690/* 37-38 reserved */91#define OPA_LINKDOWN_REASON_FM_BOUNCE 3992#define OPA_LINKDOWN_REASON_SPEED_POLICY 4093#define OPA_LINKDOWN_REASON_WIDTH_POLICY 4194/* 42-48 reserved */95#define OPA_LINKDOWN_REASON_DISCONNECTED 4996#define OPA_LINKDOWN_REASON_LOCAL_MEDIA_NOT_INSTALLED 5097#define OPA_LINKDOWN_REASON_NOT_INSTALLED 5198#define OPA_LINKDOWN_REASON_CHASSIS_CONFIG 5299/* 53 reserved */100#define OPA_LINKDOWN_REASON_END_TO_END_NOT_INSTALLED 54101/* 55 reserved */102#define OPA_LINKDOWN_REASON_POWER_POLICY 56103#define OPA_LINKDOWN_REASON_LINKSPEED_POLICY 57104#define OPA_LINKDOWN_REASON_LINKWIDTH_POLICY 58105/* 59 reserved */106#define OPA_LINKDOWN_REASON_SWITCH_MGMT 60107#define OPA_LINKDOWN_REASON_SMA_DISABLED 61108/* 62 reserved */109#define OPA_LINKDOWN_REASON_TRANSIENT 63110/* 64-255 reserved */111112/* OPA Link Init reason; indicated as follows: */113/* 3-7; 11-15 reserved; 8-15 cleared on Polling->LinkUp */114#define OPA_LINKINIT_REASON_NOP 0115#define OPA_LINKINIT_REASON_LINKUP (1 << 4)116#define OPA_LINKINIT_REASON_FLAPPING (2 << 4)117#define OPA_LINKINIT_REASON_CLEAR (8 << 4)118#define OPA_LINKINIT_OUTSIDE_POLICY (8 << 4)119#define OPA_LINKINIT_QUARANTINED (9 << 4)120#define OPA_LINKINIT_INSUFIC_CAPABILITY (10 << 4)121122#define OPA_LINK_SPEED_NOP 0x0000 /* Reserved (1-5 Gbps) */123#define OPA_LINK_SPEED_12_5G 0x0001 /* 12.5 Gbps */124#define OPA_LINK_SPEED_25G 0x0002 /* 25.78125? Gbps (EDR) */125126#define OPA_LINK_WIDTH_1X 0x0001127#define OPA_LINK_WIDTH_2X 0x0002128#define OPA_LINK_WIDTH_3X 0x0004129#define OPA_LINK_WIDTH_4X 0x0008130131#define OPA_CAP_MASK3_IsSnoopSupported (1 << 7)132#define OPA_CAP_MASK3_IsAsyncSC2VLSupported (1 << 6)133#define OPA_CAP_MASK3_IsAddrRangeConfigSupported (1 << 5)134#define OPA_CAP_MASK3_IsPassThroughSupported (1 << 4)135#define OPA_CAP_MASK3_IsSharedSpaceSupported (1 << 3)136/* reserved (1 << 2) */137#define OPA_CAP_MASK3_IsVLMarkerSupported (1 << 1)138#define OPA_CAP_MASK3_IsVLrSupported (1 << 0)139140/**141* new MTU values142*/143enum {144OPA_MTU_8192 = 6,145OPA_MTU_10240 = 7,146};147148enum {149OPA_PORT_PHYS_CONF_DISCONNECTED = 0,150OPA_PORT_PHYS_CONF_STANDARD = 1,151OPA_PORT_PHYS_CONF_FIXED = 2,152OPA_PORT_PHYS_CONF_VARIABLE = 3,153OPA_PORT_PHYS_CONF_SI_PHOTO = 4154};155156enum port_info_field_masks {157/* vl.cap */158OPA_PI_MASK_VL_CAP = 0x1F,159/* port_states.ledenable_offlinereason */160OPA_PI_MASK_OFFLINE_REASON = 0x0F,161OPA_PI_MASK_LED_ENABLE = 0x40,162/* port_states.unsleepstate_downdefstate */163OPA_PI_MASK_UNSLEEP_STATE = 0xF0,164OPA_PI_MASK_DOWNDEF_STATE = 0x0F,165/* port_states.portphysstate_portstate */166OPA_PI_MASK_PORT_PHYSICAL_STATE = 0xF0,167OPA_PI_MASK_PORT_STATE = 0x0F,168/* port_phys_conf */169OPA_PI_MASK_PORT_PHYSICAL_CONF = 0x0F,170/* collectivemask_multicastmask */171OPA_PI_MASK_COLLECT_MASK = 0x38,172OPA_PI_MASK_MULTICAST_MASK = 0x07,173/* mkeyprotect_lmc */174OPA_PI_MASK_MKEY_PROT_BIT = 0xC0,175OPA_PI_MASK_LMC = 0x0F,176/* smsl */177OPA_PI_MASK_SMSL = 0x1F,178/* partenforce_filterraw */179/* Filter Raw In/Out bits 1 and 2 were removed */180OPA_PI_MASK_LINKINIT_REASON = 0xF0,181OPA_PI_MASK_PARTITION_ENFORCE_IN = 0x08,182OPA_PI_MASK_PARTITION_ENFORCE_OUT = 0x04,183/* operational_vls */184OPA_PI_MASK_OPERATIONAL_VL = 0x1F,185/* sa_qp */186OPA_PI_MASK_SA_QP = 0x00FFFFFF,187/* sm_trap_qp */188OPA_PI_MASK_SM_TRAP_QP = 0x00FFFFFF,189/* localphy_overrun_errors */190OPA_PI_MASK_LOCAL_PHY_ERRORS = 0xF0,191OPA_PI_MASK_OVERRUN_ERRORS = 0x0F,192/* clientrereg_subnettimeout */193OPA_PI_MASK_CLIENT_REREGISTER = 0x80,194OPA_PI_MASK_SUBNET_TIMEOUT = 0x1F,195/* port_link_mode */196OPA_PI_MASK_PORT_LINK_SUPPORTED = (0x001F << 10),197OPA_PI_MASK_PORT_LINK_ENABLED = (0x001F << 5),198OPA_PI_MASK_PORT_LINK_ACTIVE = (0x001F << 0),199/* port_link_crc_mode */200OPA_PI_MASK_PORT_LINK_CRC_SUPPORTED = 0x0F00,201OPA_PI_MASK_PORT_LINK_CRC_ENABLED = 0x00F0,202OPA_PI_MASK_PORT_LINK_CRC_ACTIVE = 0x000F,203/* port_mode */204OPA_PI_MASK_PORT_MODE_SECURITY_CHECK = 0x0001,205OPA_PI_MASK_PORT_MODE_16B_TRAP_QUERY = 0x0002,206OPA_PI_MASK_PORT_MODE_PKEY_CONVERT = 0x0004,207OPA_PI_MASK_PORT_MODE_SC2SC_MAPPING = 0x0008,208OPA_PI_MASK_PORT_MODE_VL_MARKER = 0x0010,209OPA_PI_MASK_PORT_PASS_THROUGH = 0x0020,210OPA_PI_MASK_PORT_ACTIVE_OPTOMIZE = 0x0040,211/* flit_control.interleave */212OPA_PI_MASK_INTERLEAVE_DIST_SUP = (0x0003 << 12),213OPA_PI_MASK_INTERLEAVE_DIST_ENABLE = (0x0003 << 10),214OPA_PI_MASK_INTERLEAVE_MAX_NEST_TX = (0x001F << 5),215OPA_PI_MASK_INTERLEAVE_MAX_NEST_RX = (0x001F << 0),216217/* port_error_action */218OPA_PI_MASK_EX_BUFFER_OVERRUN = 0x80000000,219/* 7 bits reserved */220OPA_PI_MASK_FM_CFG_ERR_EXCEED_MULTICAST_LIMIT = 0x00800000,221OPA_PI_MASK_FM_CFG_BAD_CONTROL_FLIT = 0x00400000,222OPA_PI_MASK_FM_CFG_BAD_PREEMPT = 0x00200000,223OPA_PI_MASK_FM_CFG_UNSUPPORTED_VL_MARKER = 0x00100000,224OPA_PI_MASK_FM_CFG_BAD_CRDT_ACK = 0x00080000,225OPA_PI_MASK_FM_CFG_BAD_CTRL_DIST = 0x00040000,226OPA_PI_MASK_FM_CFG_BAD_TAIL_DIST = 0x00020000,227OPA_PI_MASK_FM_CFG_BAD_HEAD_DIST = 0x00010000,228/* 2 bits reserved */229OPA_PI_MASK_PORT_RCV_BAD_VL_MARKER = 0x00002000,230OPA_PI_MASK_PORT_RCV_PREEMPT_VL15 = 0x00001000,231OPA_PI_MASK_PORT_RCV_PREEMPT_ERROR = 0x00000800,232/* 1 bit reserved */233OPA_PI_MASK_PORT_RCV_BAD_MidTail = 0x00000200,234/* 1 bit reserved */235OPA_PI_MASK_PORT_RCV_BAD_SC = 0x00000080,236OPA_PI_MASK_PORT_RCV_BAD_L2 = 0x00000040,237OPA_PI_MASK_PORT_RCV_BAD_DLID = 0x00000020,238OPA_PI_MASK_PORT_RCV_BAD_SLID = 0x00000010,239OPA_PI_MASK_PORT_RCV_PKTLEN_TOOSHORT = 0x00000008,240OPA_PI_MASK_PORT_RCV_PKTLEN_TOOLONG = 0x00000004,241OPA_PI_MASK_PORT_RCV_BAD_PKTLEN = 0x00000002,242OPA_PI_MASK_PORT_RCV_BAD_LT = 0x00000001,243244/* pass_through.res_drctl */245OPA_PI_MASK_PASS_THROUGH_DR_CONTROL = 0x01,246247/* buffer_units */248OPA_PI_MASK_BUF_UNIT_VL15_INIT = (0x00000FFF << 11),249OPA_PI_MASK_BUF_UNIT_VL15_CREDIT_RATE = (0x0000001F << 6),250OPA_PI_MASK_BUF_UNIT_CREDIT_ACK = (0x00000003 << 3),251OPA_PI_MASK_BUF_UNIT_BUF_ALLOC = (0x00000003 << 0),252253/* neigh_mtu.pvlx_to_mtu */254OPA_PI_MASK_NEIGH_MTU_PVL0 = 0xF0,255OPA_PI_MASK_NEIGH_MTU_PVL1 = 0x0F,256257/* neigh_mtu.vlstall_hoq_life */258OPA_PI_MASK_VL_STALL = (0x03 << 5),259OPA_PI_MASK_HOQ_LIFE = (0x1F << 0),260261/* port_neigh_mode */262OPA_PI_MASK_NEIGH_MGMT_ALLOWED = (0x01 << 3),263OPA_PI_MASK_NEIGH_FW_AUTH_BYPASS = (0x01 << 2),264OPA_PI_MASK_NEIGH_NODE_TYPE = (0x03 << 0),265266/* resptime_value */267OPA_PI_MASK_RESPONSE_TIME_VALUE = 0x1F,268269/* mtucap */270OPA_PI_MASK_MTU_CAP = 0x0F,271};272273struct opa_port_states {274u8 reserved;275u8 ledenable_offlinereason; /* 1 res, 1 bit, 6 bits */276u8 reserved2;277u8 portphysstate_portstate; /* 4 bits, 4 bits */278};279280struct opa_port_state_info {281struct opa_port_states port_states;282__be16 link_width_downgrade_tx_active;283__be16 link_width_downgrade_rx_active;284};285286struct opa_port_info {287__be32 lid;288__be32 flow_control_mask;289290struct {291u8 res; /* was inittype */292u8 cap; /* 3 res, 5 bits */293__be16 high_limit;294__be16 preempt_limit;295u8 arb_high_cap;296u8 arb_low_cap;297} vl;298299struct opa_port_states port_states;300u8 port_phys_conf; /* 4 res, 4 bits */301u8 collectivemask_multicastmask; /* 2 res, 3, 3 */302u8 mkeyprotect_lmc; /* 2 bits, 2 res, 4 bits */303u8 smsl; /* 3 res, 5 bits */304305u8 partenforce_filterraw; /* bit fields */306u8 operational_vls; /* 3 res, 5 bits */307__be16 pkey_8b;308__be16 pkey_10b;309__be16 mkey_violations;310311__be16 pkey_violations;312__be16 qkey_violations;313__be32 sm_trap_qp; /* 8 bits, 24 bits */314315__be32 sa_qp; /* 8 bits, 24 bits */316u8 neigh_port_num;317u8 link_down_reason;318u8 neigh_link_down_reason;319u8 clientrereg_subnettimeout; /* 1 bit, 2 bits, 5 */320321struct {322__be16 supported;323__be16 enabled;324__be16 active;325} link_speed;326struct {327__be16 supported;328__be16 enabled;329__be16 active;330} link_width;331struct {332__be16 supported;333__be16 enabled;334__be16 tx_active;335__be16 rx_active;336} link_width_downgrade;337__be16 port_link_mode; /* 1 res, 5 bits, 5 bits, 5 bits */338__be16 port_ltp_crc_mode; /* 4 res, 4 bits, 4 bits, 4 bits */339340__be16 port_mode; /* 9 res, bit fields */341struct {342__be16 supported;343__be16 enabled;344} port_packet_format;345struct {346__be16 interleave; /* 2 res, 2,2,5,5 */347struct {348__be16 min_initial;349__be16 min_tail;350u8 large_pkt_limit;351u8 small_pkt_limit;352u8 max_small_pkt_limit;353u8 preemption_limit;354} preemption;355} flit_control;356357__be32 reserved4;358__be32 port_error_action; /* bit field */359360struct {361u8 egress_port;362u8 res_drctl; /* 7 res, 1 */363} pass_through;364__be16 mkey_lease_period;365__be32 buffer_units; /* 9 res, 12, 5, 3, 3 */366367__be32 reserved5;368__be32 sm_lid;369370__be64 mkey;371372__be64 subnet_prefix;373374struct {375u8 pvlx_to_mtu[OPA_MAX_VLS/2]; /* 4 bits, 4 bits */376} neigh_mtu;377378struct {379u8 vlstall_hoqlife; /* 3 bits, 5 bits */380} xmit_q[OPA_MAX_VLS];381382struct {383u8 addr[16];384} ipaddr_ipv6;385386struct {387u8 addr[4];388} ipaddr_ipv4;389390u32 reserved6;391u32 reserved7;392u32 reserved8;393394__be64 neigh_node_guid;395396__be32 ib_cap_mask;397__be16 reserved9; /* was ib_cap_mask2 */398__be16 opa_cap_mask;399400__be32 reserved10; /* was link_roundtrip_latency */401__be16 overall_buffer_space;402__be16 reserved11; /* was max_credit_hint */403404__be16 diag_code;405struct {406u8 buffer;407u8 wire;408} replay_depth;409u8 port_neigh_mode;410u8 mtucap; /* 4 res, 4 bits */411412u8 resptimevalue; /* 3 res, 5 bits */413u8 local_port_num;414u8 reserved12;415u8 reserved13; /* was guid_cap */416} __attribute__ ((packed));417418#endif /* OPA_PORT_INFO_H */419420421