18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2014-2020 Intel Corporation.  All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef OPA_PORT_INFO_H
78c2ecf20Sopenharmony_ci#define OPA_PORT_INFO_H
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <rdma/opa_smi.h>
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define OPA_PORT_LINK_MODE_NOP	0		/* No change */
128c2ecf20Sopenharmony_ci#define OPA_PORT_LINK_MODE_OPA	4		/* Port mode is OPA */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define OPA_PORT_PACKET_FORMAT_NOP	0		/* No change */
158c2ecf20Sopenharmony_ci#define OPA_PORT_PACKET_FORMAT_8B	1		/* Format 8B */
168c2ecf20Sopenharmony_ci#define OPA_PORT_PACKET_FORMAT_9B	2		/* Format 9B */
178c2ecf20Sopenharmony_ci#define OPA_PORT_PACKET_FORMAT_10B	4		/* Format 10B */
188c2ecf20Sopenharmony_ci#define OPA_PORT_PACKET_FORMAT_16B	8		/* Format 16B */
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define OPA_PORT_LTP_CRC_MODE_NONE	0	/* No change */
218c2ecf20Sopenharmony_ci#define OPA_PORT_LTP_CRC_MODE_14	1	/* 14-bit LTP CRC mode (optional) */
228c2ecf20Sopenharmony_ci#define OPA_PORT_LTP_CRC_MODE_16	2	/* 16-bit LTP CRC mode */
238c2ecf20Sopenharmony_ci#define OPA_PORT_LTP_CRC_MODE_48	4	/* 48-bit LTP CRC mode (optional) */
248c2ecf20Sopenharmony_ci#define OPA_PORT_LTP_CRC_MODE_PER_LANE  8	/* 12/16-bit per lane LTP CRC mode */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci/* Link Down / Neighbor Link Down Reason; indicated as follows: */
278c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_NONE				0	/* No specified reason */
288c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_0				1
298c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_PKT_LEN				2
308c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_PKT_TOO_LONG			3
318c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_PKT_TOO_SHORT			4
328c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_SLID				5
338c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_DLID				6
348c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_L2				7
358c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_SC				8
368c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_8				9
378c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_MID_TAIL			10
388c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_10			11
398c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_PREEMPT_ERROR			12
408c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_PREEMPT_VL15			13
418c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_VL_MARKER			14
428c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_14			15
438c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_15			16
448c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_HEAD_DIST			17
458c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_TAIL_DIST			18
468c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_CTRL_DIST			19
478c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_CREDIT_ACK			20
488c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_UNSUPPORTED_VL_MARKER		21
498c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_PREEMPT				22
508c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_BAD_CONTROL_FLIT			23
518c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_EXCEED_MULTICAST_LIMIT		24
528c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_24			25
538c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_25			26
548c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_26			27
558c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_27			28
568c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_28			29
578c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_29			30
588c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_RCV_ERROR_30			31
598c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_EXCESSIVE_BUFFER_OVERRUN		32
608c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_UNKNOWN				33
618c2ecf20Sopenharmony_ci/* 34 -reserved */
628c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_REBOOT				35
638c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_NEIGHBOR_UNKNOWN			36
648c2ecf20Sopenharmony_ci/* 37-38 reserved */
658c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_FM_BOUNCE				39
668c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_SPEED_POLICY			40
678c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_WIDTH_POLICY			41
688c2ecf20Sopenharmony_ci/* 42-48 reserved */
698c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_DISCONNECTED			49
708c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_LOCAL_MEDIA_NOT_INSTALLED		50
718c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_NOT_INSTALLED			51
728c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_CHASSIS_CONFIG			52
738c2ecf20Sopenharmony_ci/* 53 reserved */
748c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_END_TO_END_NOT_INSTALLED		54
758c2ecf20Sopenharmony_ci/* 55 reserved */
768c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_POWER_POLICY			56
778c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_LINKSPEED_POLICY			57
788c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_LINKWIDTH_POLICY			58
798c2ecf20Sopenharmony_ci/* 59 reserved */
808c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_SWITCH_MGMT				60
818c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_SMA_DISABLED			61
828c2ecf20Sopenharmony_ci/* 62 reserved */
838c2ecf20Sopenharmony_ci#define OPA_LINKDOWN_REASON_TRANSIENT				63
848c2ecf20Sopenharmony_ci/* 64-255 reserved */
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* OPA Link Init reason; indicated as follows: */
878c2ecf20Sopenharmony_ci/* 3-7; 11-15 reserved; 8-15 cleared on Polling->LinkUp */
888c2ecf20Sopenharmony_ci#define OPA_LINKINIT_REASON_NOP                 0
898c2ecf20Sopenharmony_ci#define OPA_LINKINIT_REASON_LINKUP              (1 << 4)
908c2ecf20Sopenharmony_ci#define OPA_LINKINIT_REASON_FLAPPING            (2 << 4)
918c2ecf20Sopenharmony_ci#define OPA_LINKINIT_REASON_CLEAR               (8 << 4)
928c2ecf20Sopenharmony_ci#define OPA_LINKINIT_OUTSIDE_POLICY             (8 << 4)
938c2ecf20Sopenharmony_ci#define OPA_LINKINIT_QUARANTINED                (9 << 4)
948c2ecf20Sopenharmony_ci#define OPA_LINKINIT_INSUFIC_CAPABILITY         (10 << 4)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define OPA_LINK_SPEED_NOP              0x0000  /*  Reserved (1-5 Gbps) */
978c2ecf20Sopenharmony_ci#define OPA_LINK_SPEED_12_5G            0x0001  /*  12.5 Gbps */
988c2ecf20Sopenharmony_ci#define OPA_LINK_SPEED_25G              0x0002  /*  25.78125?  Gbps (EDR) */
998c2ecf20Sopenharmony_ci
1008c2ecf20Sopenharmony_ci#define OPA_LINK_WIDTH_1X            0x0001
1018c2ecf20Sopenharmony_ci#define OPA_LINK_WIDTH_2X            0x0002
1028c2ecf20Sopenharmony_ci#define OPA_LINK_WIDTH_3X            0x0004
1038c2ecf20Sopenharmony_ci#define OPA_LINK_WIDTH_4X            0x0008
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsEthOnFabricSupported      (1 << 13)
1068c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsSnoopSupported            (1 << 7)
1078c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsAsyncSC2VLSupported       (1 << 6)
1088c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsAddrRangeConfigSupported  (1 << 5)
1098c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsPassThroughSupported      (1 << 4)
1108c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsSharedSpaceSupported      (1 << 3)
1118c2ecf20Sopenharmony_ci/* reserved (1 << 2) */
1128c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsVLMarkerSupported         (1 << 1)
1138c2ecf20Sopenharmony_ci#define OPA_CAP_MASK3_IsVLrSupported              (1 << 0)
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_cienum {
1168c2ecf20Sopenharmony_ci	OPA_PORT_PHYS_CONF_DISCONNECTED = 0,
1178c2ecf20Sopenharmony_ci	OPA_PORT_PHYS_CONF_STANDARD     = 1,
1188c2ecf20Sopenharmony_ci	OPA_PORT_PHYS_CONF_FIXED        = 2,
1198c2ecf20Sopenharmony_ci	OPA_PORT_PHYS_CONF_VARIABLE     = 3,
1208c2ecf20Sopenharmony_ci	OPA_PORT_PHYS_CONF_SI_PHOTO     = 4
1218c2ecf20Sopenharmony_ci};
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_cienum port_info_field_masks {
1248c2ecf20Sopenharmony_ci	/* vl.cap */
1258c2ecf20Sopenharmony_ci	OPA_PI_MASK_VL_CAP                        = 0x1F,
1268c2ecf20Sopenharmony_ci	/* port_states.ledenable_offlinereason */
1278c2ecf20Sopenharmony_ci	OPA_PI_MASK_OFFLINE_REASON                = 0x0F,
1288c2ecf20Sopenharmony_ci	OPA_PI_MASK_LED_ENABLE                    = 0x40,
1298c2ecf20Sopenharmony_ci	/* port_states.unsleepstate_downdefstate */
1308c2ecf20Sopenharmony_ci	OPA_PI_MASK_UNSLEEP_STATE                 = 0xF0,
1318c2ecf20Sopenharmony_ci	OPA_PI_MASK_DOWNDEF_STATE                 = 0x0F,
1328c2ecf20Sopenharmony_ci	/* port_states.portphysstate_portstate */
1338c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_PHYSICAL_STATE           = 0xF0,
1348c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_STATE                    = 0x0F,
1358c2ecf20Sopenharmony_ci	/* port_phys_conf */
1368c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_PHYSICAL_CONF            = 0x0F,
1378c2ecf20Sopenharmony_ci	/* collectivemask_multicastmask */
1388c2ecf20Sopenharmony_ci	OPA_PI_MASK_COLLECT_MASK                  = 0x38,
1398c2ecf20Sopenharmony_ci	OPA_PI_MASK_MULTICAST_MASK                = 0x07,
1408c2ecf20Sopenharmony_ci	/* mkeyprotect_lmc */
1418c2ecf20Sopenharmony_ci	OPA_PI_MASK_MKEY_PROT_BIT                 = 0xC0,
1428c2ecf20Sopenharmony_ci	OPA_PI_MASK_LMC                           = 0x0F,
1438c2ecf20Sopenharmony_ci	/* smsl */
1448c2ecf20Sopenharmony_ci	OPA_PI_MASK_SMSL                          = 0x1F,
1458c2ecf20Sopenharmony_ci	/* partenforce_filterraw */
1468c2ecf20Sopenharmony_ci	/* Filter Raw In/Out bits 1 and 2 were removed */
1478c2ecf20Sopenharmony_ci	OPA_PI_MASK_LINKINIT_REASON               = 0xF0,
1488c2ecf20Sopenharmony_ci	OPA_PI_MASK_PARTITION_ENFORCE_IN          = 0x08,
1498c2ecf20Sopenharmony_ci	OPA_PI_MASK_PARTITION_ENFORCE_OUT         = 0x04,
1508c2ecf20Sopenharmony_ci	/* operational_vls */
1518c2ecf20Sopenharmony_ci	OPA_PI_MASK_OPERATIONAL_VL                = 0x1F,
1528c2ecf20Sopenharmony_ci	/* sa_qp */
1538c2ecf20Sopenharmony_ci	OPA_PI_MASK_SA_QP                         = 0x00FFFFFF,
1548c2ecf20Sopenharmony_ci	/* sm_trap_qp */
1558c2ecf20Sopenharmony_ci	OPA_PI_MASK_SM_TRAP_QP                    = 0x00FFFFFF,
1568c2ecf20Sopenharmony_ci	/* localphy_overrun_errors */
1578c2ecf20Sopenharmony_ci	OPA_PI_MASK_LOCAL_PHY_ERRORS              = 0xF0,
1588c2ecf20Sopenharmony_ci	OPA_PI_MASK_OVERRUN_ERRORS                = 0x0F,
1598c2ecf20Sopenharmony_ci	/* clientrereg_subnettimeout */
1608c2ecf20Sopenharmony_ci	OPA_PI_MASK_CLIENT_REREGISTER             = 0x80,
1618c2ecf20Sopenharmony_ci	OPA_PI_MASK_SUBNET_TIMEOUT                = 0x1F,
1628c2ecf20Sopenharmony_ci	/* port_link_mode */
1638c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_LINK_SUPPORTED           = (0x001F << 10),
1648c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_LINK_ENABLED             = (0x001F <<  5),
1658c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_LINK_ACTIVE              = (0x001F <<  0),
1668c2ecf20Sopenharmony_ci	/* port_link_crc_mode */
1678c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_LINK_CRC_SUPPORTED       = 0x0F00,
1688c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_LINK_CRC_ENABLED         = 0x00F0,
1698c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_LINK_CRC_ACTIVE          = 0x000F,
1708c2ecf20Sopenharmony_ci	/* port_mode */
1718c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_MODE_SECURITY_CHECK      = 0x0001,
1728c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_MODE_16B_TRAP_QUERY      = 0x0002,
1738c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_MODE_PKEY_CONVERT        = 0x0004,
1748c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_MODE_SC2SC_MAPPING       = 0x0008,
1758c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_MODE_VL_MARKER           = 0x0010,
1768c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_PASS_THROUGH             = 0x0020,
1778c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_ACTIVE_OPTOMIZE          = 0x0040,
1788c2ecf20Sopenharmony_ci	/* flit_control.interleave */
1798c2ecf20Sopenharmony_ci	OPA_PI_MASK_INTERLEAVE_DIST_SUP           = (0x0003 << 12),
1808c2ecf20Sopenharmony_ci	OPA_PI_MASK_INTERLEAVE_DIST_ENABLE        = (0x0003 << 10),
1818c2ecf20Sopenharmony_ci	OPA_PI_MASK_INTERLEAVE_MAX_NEST_TX        = (0x001F <<  5),
1828c2ecf20Sopenharmony_ci	OPA_PI_MASK_INTERLEAVE_MAX_NEST_RX        = (0x001F <<  0),
1838c2ecf20Sopenharmony_ci
1848c2ecf20Sopenharmony_ci	/* port_error_action */
1858c2ecf20Sopenharmony_ci	OPA_PI_MASK_EX_BUFFER_OVERRUN                  = 0x80000000,
1868c2ecf20Sopenharmony_ci		/* 7 bits reserved */
1878c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_ERR_EXCEED_MULTICAST_LIMIT  = 0x00800000,
1888c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_BAD_CONTROL_FLIT            = 0x00400000,
1898c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_BAD_PREEMPT                 = 0x00200000,
1908c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_UNSUPPORTED_VL_MARKER       = 0x00100000,
1918c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_BAD_CRDT_ACK                = 0x00080000,
1928c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_BAD_CTRL_DIST               = 0x00040000,
1938c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_BAD_TAIL_DIST               = 0x00020000,
1948c2ecf20Sopenharmony_ci	OPA_PI_MASK_FM_CFG_BAD_HEAD_DIST               = 0x00010000,
1958c2ecf20Sopenharmony_ci		/* 2 bits reserved */
1968c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_VL_MARKER             = 0x00002000,
1978c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_PREEMPT_VL15              = 0x00001000,
1988c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_PREEMPT_ERROR             = 0x00000800,
1998c2ecf20Sopenharmony_ci		/* 1 bit reserved */
2008c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_MidTail               = 0x00000200,
2018c2ecf20Sopenharmony_ci		/* 1 bit reserved */
2028c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_SC                    = 0x00000080,
2038c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_L2                    = 0x00000040,
2048c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_DLID                  = 0x00000020,
2058c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_SLID                  = 0x00000010,
2068c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_PKTLEN_TOOSHORT           = 0x00000008,
2078c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_PKTLEN_TOOLONG            = 0x00000004,
2088c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_PKTLEN                = 0x00000002,
2098c2ecf20Sopenharmony_ci	OPA_PI_MASK_PORT_RCV_BAD_LT                    = 0x00000001,
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci	/* pass_through.res_drctl */
2128c2ecf20Sopenharmony_ci	OPA_PI_MASK_PASS_THROUGH_DR_CONTROL       = 0x01,
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci	/* buffer_units */
2158c2ecf20Sopenharmony_ci	OPA_PI_MASK_BUF_UNIT_VL15_INIT            = (0x00000FFF  << 11),
2168c2ecf20Sopenharmony_ci	OPA_PI_MASK_BUF_UNIT_VL15_CREDIT_RATE     = (0x0000001F  <<  6),
2178c2ecf20Sopenharmony_ci	OPA_PI_MASK_BUF_UNIT_CREDIT_ACK           = (0x00000003  <<  3),
2188c2ecf20Sopenharmony_ci	OPA_PI_MASK_BUF_UNIT_BUF_ALLOC            = (0x00000003  <<  0),
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_ci	/* neigh_mtu.pvlx_to_mtu */
2218c2ecf20Sopenharmony_ci	OPA_PI_MASK_NEIGH_MTU_PVL0                = 0xF0,
2228c2ecf20Sopenharmony_ci	OPA_PI_MASK_NEIGH_MTU_PVL1                = 0x0F,
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	/* neigh_mtu.vlstall_hoq_life */
2258c2ecf20Sopenharmony_ci	OPA_PI_MASK_VL_STALL                      = (0x03 << 5),
2268c2ecf20Sopenharmony_ci	OPA_PI_MASK_HOQ_LIFE                      = (0x1F << 0),
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	/* port_neigh_mode */
2298c2ecf20Sopenharmony_ci	OPA_PI_MASK_NEIGH_MGMT_ALLOWED            = (0x01 << 3),
2308c2ecf20Sopenharmony_ci	OPA_PI_MASK_NEIGH_FW_AUTH_BYPASS          = (0x01 << 2),
2318c2ecf20Sopenharmony_ci	OPA_PI_MASK_NEIGH_NODE_TYPE               = (0x03 << 0),
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci	/* resptime_value */
2348c2ecf20Sopenharmony_ci	OPA_PI_MASK_RESPONSE_TIME_VALUE           = 0x1F,
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	/* mtucap */
2378c2ecf20Sopenharmony_ci	OPA_PI_MASK_MTU_CAP                       = 0x0F,
2388c2ecf20Sopenharmony_ci};
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cistruct opa_port_states {
2418c2ecf20Sopenharmony_ci	u8     reserved;
2428c2ecf20Sopenharmony_ci	u8     ledenable_offlinereason;   /* 1 res, 1 bit, 6 bits */
2438c2ecf20Sopenharmony_ci	u8     reserved2;
2448c2ecf20Sopenharmony_ci	u8     portphysstate_portstate;   /* 4 bits, 4 bits */
2458c2ecf20Sopenharmony_ci};
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_cistruct opa_port_state_info {
2488c2ecf20Sopenharmony_ci	struct opa_port_states port_states;
2498c2ecf20Sopenharmony_ci	__be16 link_width_downgrade_tx_active;
2508c2ecf20Sopenharmony_ci	__be16 link_width_downgrade_rx_active;
2518c2ecf20Sopenharmony_ci};
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_cistruct opa_port_info {
2548c2ecf20Sopenharmony_ci	__be32 lid;
2558c2ecf20Sopenharmony_ci	__be32 flow_control_mask;
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci	struct {
2588c2ecf20Sopenharmony_ci		u8     res;                       /* was inittype */
2598c2ecf20Sopenharmony_ci		u8     cap;                       /* 3 res, 5 bits */
2608c2ecf20Sopenharmony_ci		__be16 high_limit;
2618c2ecf20Sopenharmony_ci		__be16 preempt_limit;
2628c2ecf20Sopenharmony_ci		u8     arb_high_cap;
2638c2ecf20Sopenharmony_ci		u8     arb_low_cap;
2648c2ecf20Sopenharmony_ci	} vl;
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ci	struct opa_port_states  port_states;
2678c2ecf20Sopenharmony_ci	u8     port_phys_conf;                    /* 4 res, 4 bits */
2688c2ecf20Sopenharmony_ci	u8     collectivemask_multicastmask;      /* 2 res, 3, 3 */
2698c2ecf20Sopenharmony_ci	u8     mkeyprotect_lmc;                   /* 2 bits, 2 res, 4 bits */
2708c2ecf20Sopenharmony_ci	u8     smsl;                              /* 3 res, 5 bits */
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci	u8     partenforce_filterraw;             /* bit fields */
2738c2ecf20Sopenharmony_ci	u8     operational_vls;                    /* 3 res, 5 bits */
2748c2ecf20Sopenharmony_ci	__be16 pkey_8b;
2758c2ecf20Sopenharmony_ci	__be16 pkey_10b;
2768c2ecf20Sopenharmony_ci	__be16 mkey_violations;
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci	__be16 pkey_violations;
2798c2ecf20Sopenharmony_ci	__be16 qkey_violations;
2808c2ecf20Sopenharmony_ci	__be32 sm_trap_qp;                        /* 8 bits, 24 bits */
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci	__be32 sa_qp;                             /* 8 bits, 24 bits */
2838c2ecf20Sopenharmony_ci	u8     neigh_port_num;
2848c2ecf20Sopenharmony_ci	u8     link_down_reason;
2858c2ecf20Sopenharmony_ci	u8     neigh_link_down_reason;
2868c2ecf20Sopenharmony_ci	u8     clientrereg_subnettimeout;	  /* 1 bit, 2 bits, 5 */
2878c2ecf20Sopenharmony_ci
2888c2ecf20Sopenharmony_ci	struct {
2898c2ecf20Sopenharmony_ci		__be16 supported;
2908c2ecf20Sopenharmony_ci		__be16 enabled;
2918c2ecf20Sopenharmony_ci		__be16 active;
2928c2ecf20Sopenharmony_ci	} link_speed;
2938c2ecf20Sopenharmony_ci	struct {
2948c2ecf20Sopenharmony_ci		__be16 supported;
2958c2ecf20Sopenharmony_ci		__be16 enabled;
2968c2ecf20Sopenharmony_ci		__be16 active;
2978c2ecf20Sopenharmony_ci	} link_width;
2988c2ecf20Sopenharmony_ci	struct {
2998c2ecf20Sopenharmony_ci		__be16 supported;
3008c2ecf20Sopenharmony_ci		__be16 enabled;
3018c2ecf20Sopenharmony_ci		__be16 tx_active;
3028c2ecf20Sopenharmony_ci		__be16 rx_active;
3038c2ecf20Sopenharmony_ci	} link_width_downgrade;
3048c2ecf20Sopenharmony_ci	__be16 port_link_mode;                  /* 1 res, 5 bits, 5 bits, 5 bits */
3058c2ecf20Sopenharmony_ci	__be16 port_ltp_crc_mode;               /* 4 res, 4 bits, 4 bits, 4 bits */
3068c2ecf20Sopenharmony_ci
3078c2ecf20Sopenharmony_ci	__be16 port_mode;                       /* 9 res, bit fields */
3088c2ecf20Sopenharmony_ci	struct {
3098c2ecf20Sopenharmony_ci		__be16 supported;
3108c2ecf20Sopenharmony_ci		__be16 enabled;
3118c2ecf20Sopenharmony_ci	} port_packet_format;
3128c2ecf20Sopenharmony_ci	struct {
3138c2ecf20Sopenharmony_ci		__be16 interleave;  /* 2 res, 2,2,5,5 */
3148c2ecf20Sopenharmony_ci		struct {
3158c2ecf20Sopenharmony_ci			__be16 min_initial;
3168c2ecf20Sopenharmony_ci			__be16 min_tail;
3178c2ecf20Sopenharmony_ci			u8     large_pkt_limit;
3188c2ecf20Sopenharmony_ci			u8     small_pkt_limit;
3198c2ecf20Sopenharmony_ci			u8     max_small_pkt_limit;
3208c2ecf20Sopenharmony_ci			u8     preemption_limit;
3218c2ecf20Sopenharmony_ci		} preemption;
3228c2ecf20Sopenharmony_ci	} flit_control;
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ci	__be32 reserved4;
3258c2ecf20Sopenharmony_ci	__be32 port_error_action; /* bit field */
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci	struct {
3288c2ecf20Sopenharmony_ci		u8 egress_port;
3298c2ecf20Sopenharmony_ci		u8 res_drctl;                    /* 7 res, 1 */
3308c2ecf20Sopenharmony_ci	} pass_through;
3318c2ecf20Sopenharmony_ci	__be16 mkey_lease_period;
3328c2ecf20Sopenharmony_ci	__be32 buffer_units;                     /* 9 res, 12, 5, 3, 3 */
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci	__be32 reserved5;
3358c2ecf20Sopenharmony_ci	__be32 sm_lid;
3368c2ecf20Sopenharmony_ci
3378c2ecf20Sopenharmony_ci	__be64 mkey;
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci	__be64 subnet_prefix;
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_ci	struct {
3428c2ecf20Sopenharmony_ci		u8 pvlx_to_mtu[OPA_MAX_VLS/2]; /* 4 bits, 4 bits */
3438c2ecf20Sopenharmony_ci	} neigh_mtu;
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci	struct {
3468c2ecf20Sopenharmony_ci		u8 vlstall_hoqlife;             /* 3 bits, 5 bits */
3478c2ecf20Sopenharmony_ci	} xmit_q[OPA_MAX_VLS];
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci	struct {
3508c2ecf20Sopenharmony_ci		u8 addr[16];
3518c2ecf20Sopenharmony_ci	} ipaddr_ipv6;
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ci	struct {
3548c2ecf20Sopenharmony_ci		u8 addr[4];
3558c2ecf20Sopenharmony_ci	} ipaddr_ipv4;
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci	u32    reserved6;
3588c2ecf20Sopenharmony_ci	u32    reserved7;
3598c2ecf20Sopenharmony_ci	u32    reserved8;
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ci	__be64 neigh_node_guid;
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci	__be32 ib_cap_mask;
3648c2ecf20Sopenharmony_ci	__be16 reserved9;                    /* was ib_cap_mask2 */
3658c2ecf20Sopenharmony_ci	__be16 opa_cap_mask;
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci	__be32 reserved10;                   /* was link_roundtrip_latency */
3688c2ecf20Sopenharmony_ci	__be16 overall_buffer_space;
3698c2ecf20Sopenharmony_ci	__be16 reserved11;                   /* was max_credit_hint */
3708c2ecf20Sopenharmony_ci
3718c2ecf20Sopenharmony_ci	__be16 diag_code;
3728c2ecf20Sopenharmony_ci	struct {
3738c2ecf20Sopenharmony_ci		u8 buffer;
3748c2ecf20Sopenharmony_ci		u8 wire;
3758c2ecf20Sopenharmony_ci	} replay_depth;
3768c2ecf20Sopenharmony_ci	u8     port_neigh_mode;
3778c2ecf20Sopenharmony_ci	u8     mtucap;                          /* 4 res, 4 bits */
3788c2ecf20Sopenharmony_ci
3798c2ecf20Sopenharmony_ci	u8     resptimevalue;		        /* 3 res, 5 bits */
3808c2ecf20Sopenharmony_ci	u8     local_port_num;
3818c2ecf20Sopenharmony_ci	u8     reserved12;
3828c2ecf20Sopenharmony_ci	u8     reserved13;                       /* was guid_cap */
3838c2ecf20Sopenharmony_ci} __packed;
3848c2ecf20Sopenharmony_ci
3858c2ecf20Sopenharmony_ci#endif /* OPA_PORT_INFO_H */
386