Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IB/core: Add core header changes needed for OPA

This patch adds the value of the CNP opcode to the existing list of enumerated
opcodes in ib_pack.h

Add common OPA header definitions for driver
build:
- opa_port_info.h
- opa_smi.h
- hfi1_user.h

Additionally, ib_mad.h, has additional definitions
that are common to ib_drivers including:
- trap support
- cca support

The qib driver has the duplication removed in favor
those in ib_mad.h

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Reviewed-by: John, Jubin <jubin.john@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Dennis Dalessandro and committed by
Doug Ledford
d4ab3470 072bf1f7

+1055 -139
+8 -139
drivers/infiniband/hw/qib/qib_mad.h
··· 36 36 37 37 #include <rdma/ib_pma.h> 38 38 39 - #define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004) 40 - #define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008) 41 - #define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C) 42 - #define IB_SMP_INVALID_FIELD cpu_to_be16(0x001C) 39 + #define IB_SMP_UNSUP_VERSION \ 40 + cpu_to_be16(IB_MGMT_MAD_STATUS_BAD_VERSION) 43 41 44 - struct ib_node_info { 45 - u8 base_version; 46 - u8 class_version; 47 - u8 node_type; 48 - u8 num_ports; 49 - __be64 sys_guid; 50 - __be64 node_guid; 51 - __be64 port_guid; 52 - __be16 partition_cap; 53 - __be16 device_id; 54 - __be32 revision; 55 - u8 local_port_num; 56 - u8 vendor_id[3]; 57 - } __packed; 42 + #define IB_SMP_UNSUP_METHOD \ 43 + cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD) 58 44 59 - struct ib_mad_notice_attr { 60 - u8 generic_type; 61 - u8 prod_type_msb; 62 - __be16 prod_type_lsb; 63 - __be16 trap_num; 64 - __be16 issuer_lid; 65 - __be16 toggle_count; 45 + #define IB_SMP_UNSUP_METH_ATTR \ 46 + cpu_to_be16(IB_MGMT_MAD_STATUS_UNSUPPORTED_METHOD_ATTRIB) 66 47 67 - union { 68 - struct { 69 - u8 details[54]; 70 - } raw_data; 71 - 72 - struct { 73 - __be16 reserved; 74 - __be16 lid; /* where violation happened */ 75 - u8 port_num; /* where violation happened */ 76 - } __packed ntc_129_131; 77 - 78 - struct { 79 - __be16 reserved; 80 - __be16 lid; /* LID where change occurred */ 81 - u8 reserved2; 82 - u8 local_changes; /* low bit - local changes */ 83 - __be32 new_cap_mask; /* new capability mask */ 84 - u8 reserved3; 85 - u8 change_flags; /* low 3 bits only */ 86 - } __packed ntc_144; 87 - 88 - struct { 89 - __be16 reserved; 90 - __be16 lid; /* lid where sys guid changed */ 91 - __be16 reserved2; 92 - __be64 new_sys_guid; 93 - } __packed ntc_145; 94 - 95 - struct { 96 - __be16 reserved; 97 - __be16 lid; 98 - __be16 dr_slid; 99 - u8 method; 100 - u8 reserved2; 101 - __be16 attr_id; 102 - __be32 attr_mod; 103 - __be64 mkey; 104 - u8 reserved3; 105 - u8 dr_trunc_hop; 106 - u8 dr_rtn_path[30]; 107 - } __packed ntc_256; 108 - 109 - struct { 110 - __be16 reserved; 111 - __be16 lid1; 112 - __be16 lid2; 113 - __be32 key; 114 - __be32 sl_qp1; /* SL: high 4 bits */ 115 - __be32 qp2; /* high 8 bits reserved */ 116 - union ib_gid gid1; 117 - union ib_gid gid2; 118 - } __packed ntc_257_258; 119 - 120 - } details; 121 - }; 122 - 123 - /* 124 - * Generic trap/notice types 125 - */ 126 - #define IB_NOTICE_TYPE_FATAL 0x80 127 - #define IB_NOTICE_TYPE_URGENT 0x81 128 - #define IB_NOTICE_TYPE_SECURITY 0x82 129 - #define IB_NOTICE_TYPE_SM 0x83 130 - #define IB_NOTICE_TYPE_INFO 0x84 131 - 132 - /* 133 - * Generic trap/notice producers 134 - */ 135 - #define IB_NOTICE_PROD_CA cpu_to_be16(1) 136 - #define IB_NOTICE_PROD_SWITCH cpu_to_be16(2) 137 - #define IB_NOTICE_PROD_ROUTER cpu_to_be16(3) 138 - #define IB_NOTICE_PROD_CLASS_MGR cpu_to_be16(4) 139 - 140 - /* 141 - * Generic trap/notice numbers 142 - */ 143 - #define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129) 144 - #define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130) 145 - #define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131) 146 - #define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144) 147 - #define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145) 148 - #define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256) 149 - #define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257) 150 - #define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258) 151 - 152 - /* 153 - * Repress trap/notice flags 154 - */ 155 - #define IB_NOTICE_REPRESS_LLI_THRESH (1 << 0) 156 - #define IB_NOTICE_REPRESS_EBO_THRESH (1 << 1) 157 - #define IB_NOTICE_REPRESS_FLOW_UPDATE (1 << 2) 158 - #define IB_NOTICE_REPRESS_CAP_MASK_CHG (1 << 3) 159 - #define IB_NOTICE_REPRESS_SYS_GUID_CHG (1 << 4) 160 - #define IB_NOTICE_REPRESS_BAD_MKEY (1 << 5) 161 - #define IB_NOTICE_REPRESS_BAD_PKEY (1 << 6) 162 - #define IB_NOTICE_REPRESS_BAD_QKEY (1 << 7) 163 - 164 - /* 165 - * Generic trap/notice other local changes flags (trap 144). 166 - */ 167 - #define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */ 168 - #define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */ 169 - #define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01 170 - 171 - /* 172 - * Generic trap/notice M_Key volation flags in dr_trunc_hop (trap 256). 173 - */ 174 - #define IB_NOTICE_TRAP_DR_NOTICE 0x80 175 - #define IB_NOTICE_TRAP_DR_TRUNC 0x40 176 - 177 - struct ib_vl_weight_elem { 178 - u8 vl; /* Only low 4 bits, upper 4 bits reserved */ 179 - u8 weight; 180 - }; 48 + #define IB_SMP_INVALID_FIELD \ 49 + cpu_to_be16(IB_MGMT_MAD_STATUS_INVALID_ATTRIB_VALUE) 181 50 182 51 #define IB_VLARB_LOWPRI_0_31 1 183 52 #define IB_VLARB_LOWPRI_32_63 2
+138
include/rdma/ib_mad.h
··· 127 127 #define IB_DEFAULT_PKEY_PARTIAL 0x7FFF 128 128 #define IB_DEFAULT_PKEY_FULL 0xFFFF 129 129 130 + /* 131 + * Generic trap/notice types 132 + */ 133 + #define IB_NOTICE_TYPE_FATAL 0x80 134 + #define IB_NOTICE_TYPE_URGENT 0x81 135 + #define IB_NOTICE_TYPE_SECURITY 0x82 136 + #define IB_NOTICE_TYPE_SM 0x83 137 + #define IB_NOTICE_TYPE_INFO 0x84 138 + 139 + /* 140 + * Generic trap/notice producers 141 + */ 142 + #define IB_NOTICE_PROD_CA cpu_to_be16(1) 143 + #define IB_NOTICE_PROD_SWITCH cpu_to_be16(2) 144 + #define IB_NOTICE_PROD_ROUTER cpu_to_be16(3) 145 + #define IB_NOTICE_PROD_CLASS_MGR cpu_to_be16(4) 146 + 147 + /* 148 + * Generic trap/notice numbers 149 + */ 150 + #define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129) 151 + #define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130) 152 + #define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131) 153 + #define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144) 154 + #define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145) 155 + #define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256) 156 + #define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257) 157 + #define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258) 158 + 159 + /* 160 + * Repress trap/notice flags 161 + */ 162 + #define IB_NOTICE_REPRESS_LLI_THRESH (1 << 0) 163 + #define IB_NOTICE_REPRESS_EBO_THRESH (1 << 1) 164 + #define IB_NOTICE_REPRESS_FLOW_UPDATE (1 << 2) 165 + #define IB_NOTICE_REPRESS_CAP_MASK_CHG (1 << 3) 166 + #define IB_NOTICE_REPRESS_SYS_GUID_CHG (1 << 4) 167 + #define IB_NOTICE_REPRESS_BAD_MKEY (1 << 5) 168 + #define IB_NOTICE_REPRESS_BAD_PKEY (1 << 6) 169 + #define IB_NOTICE_REPRESS_BAD_QKEY (1 << 7) 170 + 171 + /* 172 + * Generic trap/notice other local changes flags (trap 144). 173 + */ 174 + #define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */ 175 + #define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */ 176 + #define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01 177 + 178 + /* 179 + * Generic trap/notice M_Key volation flags in dr_trunc_hop (trap 256). 180 + */ 181 + #define IB_NOTICE_TRAP_DR_NOTICE 0x80 182 + #define IB_NOTICE_TRAP_DR_TRUNC 0x40 183 + 130 184 enum { 131 185 IB_MGMT_MAD_HDR = 24, 132 186 IB_MGMT_MAD_DATA = 232, ··· 292 238 __be16 trap_pkey; 293 239 __be32 trap_hlqp; 294 240 __be32 trap_qkey; 241 + }; 242 + 243 + struct ib_node_info { 244 + u8 base_version; 245 + u8 class_version; 246 + u8 node_type; 247 + u8 num_ports; 248 + __be64 sys_guid; 249 + __be64 node_guid; 250 + __be64 port_guid; 251 + __be16 partition_cap; 252 + __be16 device_id; 253 + __be32 revision; 254 + u8 local_port_num; 255 + u8 vendor_id[3]; 256 + } __packed; 257 + 258 + struct ib_mad_notice_attr { 259 + u8 generic_type; 260 + u8 prod_type_msb; 261 + __be16 prod_type_lsb; 262 + __be16 trap_num; 263 + __be16 issuer_lid; 264 + __be16 toggle_count; 265 + 266 + union { 267 + struct { 268 + u8 details[54]; 269 + } raw_data; 270 + 271 + struct { 272 + __be16 reserved; 273 + __be16 lid; /* where violation happened */ 274 + u8 port_num; /* where violation happened */ 275 + } __packed ntc_129_131; 276 + 277 + struct { 278 + __be16 reserved; 279 + __be16 lid; /* LID where change occurred */ 280 + u8 reserved2; 281 + u8 local_changes; /* low bit - local changes */ 282 + __be32 new_cap_mask; /* new capability mask */ 283 + u8 reserved3; 284 + u8 change_flags; /* low 3 bits only */ 285 + } __packed ntc_144; 286 + 287 + struct { 288 + __be16 reserved; 289 + __be16 lid; /* lid where sys guid changed */ 290 + __be16 reserved2; 291 + __be64 new_sys_guid; 292 + } __packed ntc_145; 293 + 294 + struct { 295 + __be16 reserved; 296 + __be16 lid; 297 + __be16 dr_slid; 298 + u8 method; 299 + u8 reserved2; 300 + __be16 attr_id; 301 + __be32 attr_mod; 302 + __be64 mkey; 303 + u8 reserved3; 304 + u8 dr_trunc_hop; 305 + u8 dr_rtn_path[30]; 306 + } __packed ntc_256; 307 + 308 + struct { 309 + __be16 reserved; 310 + __be16 lid1; 311 + __be16 lid2; 312 + __be32 key; 313 + __be32 sl_qp1; /* SL: high 4 bits */ 314 + __be32 qp2; /* high 8 bits reserved */ 315 + union ib_gid gid1; 316 + union ib_gid gid2; 317 + } __packed ntc_257_258; 318 + 319 + } details; 320 + }; 321 + 322 + struct ib_vl_weight_elem { 323 + u8 vl; /* VL is low 5 bits, upper 3 bits reserved */ 324 + u8 weight; 295 325 }; 296 326 297 327 /**
+2
include/rdma/ib_pack.h
··· 76 76 IB_OPCODE_UC = 0x20, 77 77 IB_OPCODE_RD = 0x40, 78 78 IB_OPCODE_UD = 0x60, 79 + /* per IBTA 3.1 Table 38, A10.3.2 */ 80 + IB_OPCODE_CNP = 0x80, 79 81 80 82 /* operations -- just used to define real constants */ 81 83 IB_OPCODE_SEND_FIRST = 0x00,
+433
include/rdma/opa_port_info.h
··· 1 + /* 2 + * Copyright (c) 2014 Intel Corporation. All rights reserved. 3 + * 4 + * This software is available to you under a choice of one of two 5 + * licenses. You may choose to be licensed under the terms of the GNU 6 + * General Public License (GPL) Version 2, available from the file 7 + * COPYING in the main directory of this source tree, or the 8 + * OpenIB.org BSD license below: 9 + * 10 + * Redistribution and use in source and binary forms, with or 11 + * without modification, are permitted provided that the following 12 + * conditions are met: 13 + * 14 + * - Redistributions of source code must retain the above 15 + * copyright notice, this list of conditions and the following 16 + * disclaimer. 17 + * 18 + * - Redistributions in binary form must reproduce the above 19 + * copyright notice, this list of conditions and the following 20 + * disclaimer in the documentation and/or other materials 21 + * provided with the distribution. 22 + * 23 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 24 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 25 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 26 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 27 + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 28 + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 29 + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 30 + * SOFTWARE. 31 + */ 32 + 33 + #if !defined(OPA_PORT_INFO_H) 34 + #define OPA_PORT_INFO_H 35 + 36 + /* Temporary until HFI driver is updated */ 37 + #ifndef USE_PI_LED_ENABLE 38 + #define USE_PI_LED_ENABLE 0 39 + #endif 40 + 41 + #define OPA_PORT_LINK_MODE_NOP 0 /* No change */ 42 + #define OPA_PORT_LINK_MODE_OPA 4 /* Port mode is OPA */ 43 + 44 + #define OPA_PORT_PACKET_FORMAT_NOP 0 /* No change */ 45 + #define OPA_PORT_PACKET_FORMAT_8B 1 /* Format 8B */ 46 + #define OPA_PORT_PACKET_FORMAT_9B 2 /* Format 9B */ 47 + #define OPA_PORT_PACKET_FORMAT_10B 4 /* Format 10B */ 48 + #define OPA_PORT_PACKET_FORMAT_16B 8 /* Format 16B */ 49 + 50 + #define OPA_PORT_LTP_CRC_MODE_NONE 0 /* No change */ 51 + #define OPA_PORT_LTP_CRC_MODE_14 1 /* 14-bit LTP CRC mode (optional) */ 52 + #define OPA_PORT_LTP_CRC_MODE_16 2 /* 16-bit LTP CRC mode */ 53 + #define OPA_PORT_LTP_CRC_MODE_48 4 /* 48-bit LTP CRC mode (optional) */ 54 + #define OPA_PORT_LTP_CRC_MODE_PER_LANE 8 /* 12/16-bit per lane LTP CRC mode */ 55 + 56 + /* Link Down / Neighbor Link Down Reason; indicated as follows: */ 57 + #define OPA_LINKDOWN_REASON_NONE 0 /* No specified reason */ 58 + #define OPA_LINKDOWN_REASON_RCV_ERROR_0 1 59 + #define OPA_LINKDOWN_REASON_BAD_PKT_LEN 2 60 + #define OPA_LINKDOWN_REASON_PKT_TOO_LONG 3 61 + #define OPA_LINKDOWN_REASON_PKT_TOO_SHORT 4 62 + #define OPA_LINKDOWN_REASON_BAD_SLID 5 63 + #define OPA_LINKDOWN_REASON_BAD_DLID 6 64 + #define OPA_LINKDOWN_REASON_BAD_L2 7 65 + #define OPA_LINKDOWN_REASON_BAD_SC 8 66 + #define OPA_LINKDOWN_REASON_RCV_ERROR_8 9 67 + #define OPA_LINKDOWN_REASON_BAD_MID_TAIL 10 68 + #define OPA_LINKDOWN_REASON_RCV_ERROR_10 11 69 + #define OPA_LINKDOWN_REASON_PREEMPT_ERROR 12 70 + #define OPA_LINKDOWN_REASON_PREEMPT_VL15 13 71 + #define OPA_LINKDOWN_REASON_BAD_VL_MARKER 14 72 + #define OPA_LINKDOWN_REASON_RCV_ERROR_14 15 73 + #define OPA_LINKDOWN_REASON_RCV_ERROR_15 16 74 + #define OPA_LINKDOWN_REASON_BAD_HEAD_DIST 17 75 + #define OPA_LINKDOWN_REASON_BAD_TAIL_DIST 18 76 + #define OPA_LINKDOWN_REASON_BAD_CTRL_DIST 19 77 + #define OPA_LINKDOWN_REASON_BAD_CREDIT_ACK 20 78 + #define OPA_LINKDOWN_REASON_UNSUPPORTED_VL_MARKER 21 79 + #define OPA_LINKDOWN_REASON_BAD_PREEMPT 22 80 + #define OPA_LINKDOWN_REASON_BAD_CONTROL_FLIT 23 81 + #define OPA_LINKDOWN_REASON_EXCEED_MULTICAST_LIMIT 24 82 + #define OPA_LINKDOWN_REASON_RCV_ERROR_24 25 83 + #define OPA_LINKDOWN_REASON_RCV_ERROR_25 26 84 + #define OPA_LINKDOWN_REASON_RCV_ERROR_26 27 85 + #define OPA_LINKDOWN_REASON_RCV_ERROR_27 28 86 + #define OPA_LINKDOWN_REASON_RCV_ERROR_28 29 87 + #define OPA_LINKDOWN_REASON_RCV_ERROR_29 30 88 + #define OPA_LINKDOWN_REASON_RCV_ERROR_30 31 89 + #define OPA_LINKDOWN_REASON_EXCESSIVE_BUFFER_OVERRUN 32 90 + #define OPA_LINKDOWN_REASON_UNKNOWN 33 91 + /* 34 -reserved */ 92 + #define OPA_LINKDOWN_REASON_REBOOT 35 93 + #define OPA_LINKDOWN_REASON_NEIGHBOR_UNKNOWN 36 94 + /* 37-38 reserved */ 95 + #define OPA_LINKDOWN_REASON_FM_BOUNCE 39 96 + #define OPA_LINKDOWN_REASON_SPEED_POLICY 40 97 + #define OPA_LINKDOWN_REASON_WIDTH_POLICY 41 98 + /* 42-48 reserved */ 99 + #define OPA_LINKDOWN_REASON_DISCONNECTED 49 100 + #define OPA_LINKDOWN_REASONLOCAL_MEDIA_NOT_INSTALLED 50 101 + #define OPA_LINKDOWN_REASON_NOT_INSTALLED 51 102 + #define OPA_LINKDOWN_REASON_CHASSIS_CONFIG 52 103 + /* 53 reserved */ 104 + #define OPA_LINKDOWN_REASON_END_TO_END_NOT_INSTALLED 54 105 + /* 55 reserved */ 106 + #define OPA_LINKDOWN_REASON_POWER_POLICY 56 107 + #define OPA_LINKDOWN_REASON_LINKSPEED_POLICY 57 108 + #define OPA_LINKDOWN_REASON_LINKWIDTH_POLICY 58 109 + /* 59 reserved */ 110 + #define OPA_LINKDOWN_REASON_SWITCH_MGMT 60 111 + #define OPA_LINKDOWN_REASON_SMA_DISABLED 61 112 + /* 62 reserved */ 113 + #define OPA_LINKDOWN_REASON_TRANSIENT 63 114 + /* 64-255 reserved */ 115 + 116 + /* OPA Link Init reason; indicated as follows: */ 117 + /* 3-7; 11-15 reserved; 8-15 cleared on Polling->LinkUp */ 118 + #define OPA_LINKINIT_REASON_NOP 0 119 + #define OPA_LINKINIT_REASON_LINKUP (1 << 4) 120 + #define OPA_LINKINIT_REASON_FLAPPING (2 << 4) 121 + #define OPA_LINKINIT_REASON_CLEAR (8 << 4) 122 + #define OPA_LINKINIT_OUTSIDE_POLICY (8 << 4) 123 + #define OPA_LINKINIT_QUARANTINED (9 << 4) 124 + #define OPA_LINKINIT_INSUFIC_CAPABILITY (10 << 4) 125 + 126 + #define OPA_LINK_SPEED_NOP 0x0000 /* Reserved (1-5 Gbps) */ 127 + #define OPA_LINK_SPEED_12_5G 0x0001 /* 12.5 Gbps */ 128 + #define OPA_LINK_SPEED_25G 0x0002 /* 25.78125? Gbps (EDR) */ 129 + 130 + #define OPA_LINK_WIDTH_1X 0x0001 131 + #define OPA_LINK_WIDTH_2X 0x0002 132 + #define OPA_LINK_WIDTH_3X 0x0004 133 + #define OPA_LINK_WIDTH_4X 0x0008 134 + 135 + #define OPA_CAP_MASK3_IsSnoopSupported (1 << 7) 136 + #define OPA_CAP_MASK3_IsAsyncSC2VLSupported (1 << 6) 137 + #define OPA_CAP_MASK3_IsAddrRangeConfigSupported (1 << 5) 138 + #define OPA_CAP_MASK3_IsPassThroughSupported (1 << 4) 139 + #define OPA_CAP_MASK3_IsSharedSpaceSupported (1 << 3) 140 + /* reserved (1 << 2) */ 141 + #define OPA_CAP_MASK3_IsVLMarkerSupported (1 << 1) 142 + #define OPA_CAP_MASK3_IsVLrSupported (1 << 0) 143 + 144 + /** 145 + * new MTU values 146 + */ 147 + enum { 148 + OPA_MTU_8192 = 6, 149 + OPA_MTU_10240 = 7, 150 + }; 151 + 152 + enum { 153 + OPA_PORT_PHYS_CONF_DISCONNECTED = 0, 154 + OPA_PORT_PHYS_CONF_STANDARD = 1, 155 + OPA_PORT_PHYS_CONF_FIXED = 2, 156 + OPA_PORT_PHYS_CONF_VARIABLE = 3, 157 + OPA_PORT_PHYS_CONF_SI_PHOTO = 4 158 + }; 159 + 160 + enum port_info_field_masks { 161 + /* vl.cap */ 162 + OPA_PI_MASK_VL_CAP = 0x1F, 163 + /* port_states.ledenable_offlinereason */ 164 + OPA_PI_MASK_OFFLINE_REASON = 0x0F, 165 + OPA_PI_MASK_LED_ENABLE = 0x40, 166 + /* port_states.unsleepstate_downdefstate */ 167 + OPA_PI_MASK_UNSLEEP_STATE = 0xF0, 168 + OPA_PI_MASK_DOWNDEF_STATE = 0x0F, 169 + /* port_states.portphysstate_portstate */ 170 + OPA_PI_MASK_PORT_PHYSICAL_STATE = 0xF0, 171 + OPA_PI_MASK_PORT_STATE = 0x0F, 172 + /* port_phys_conf */ 173 + OPA_PI_MASK_PORT_PHYSICAL_CONF = 0x0F, 174 + /* collectivemask_multicastmask */ 175 + OPA_PI_MASK_COLLECT_MASK = 0x38, 176 + OPA_PI_MASK_MULTICAST_MASK = 0x07, 177 + /* mkeyprotect_lmc */ 178 + OPA_PI_MASK_MKEY_PROT_BIT = 0xC0, 179 + OPA_PI_MASK_LMC = 0x0F, 180 + /* smsl */ 181 + OPA_PI_MASK_SMSL = 0x1F, 182 + /* partenforce_filterraw */ 183 + /* Filter Raw In/Out bits 1 and 2 were removed */ 184 + OPA_PI_MASK_LINKINIT_REASON = 0xF0, 185 + OPA_PI_MASK_PARTITION_ENFORCE_IN = 0x08, 186 + OPA_PI_MASK_PARTITION_ENFORCE_OUT = 0x04, 187 + /* operational_vls */ 188 + OPA_PI_MASK_OPERATIONAL_VL = 0x1F, 189 + /* sa_qp */ 190 + OPA_PI_MASK_SA_QP = 0x00FFFFFF, 191 + /* sm_trap_qp */ 192 + OPA_PI_MASK_SM_TRAP_QP = 0x00FFFFFF, 193 + /* localphy_overrun_errors */ 194 + OPA_PI_MASK_LOCAL_PHY_ERRORS = 0xF0, 195 + OPA_PI_MASK_OVERRUN_ERRORS = 0x0F, 196 + /* clientrereg_subnettimeout */ 197 + OPA_PI_MASK_CLIENT_REREGISTER = 0x80, 198 + OPA_PI_MASK_SUBNET_TIMEOUT = 0x1F, 199 + /* port_link_mode */ 200 + OPA_PI_MASK_PORT_LINK_SUPPORTED = (0x001F << 10), 201 + OPA_PI_MASK_PORT_LINK_ENABLED = (0x001F << 5), 202 + OPA_PI_MASK_PORT_LINK_ACTIVE = (0x001F << 0), 203 + /* port_link_crc_mode */ 204 + OPA_PI_MASK_PORT_LINK_CRC_SUPPORTED = 0x0F00, 205 + OPA_PI_MASK_PORT_LINK_CRC_ENABLED = 0x00F0, 206 + OPA_PI_MASK_PORT_LINK_CRC_ACTIVE = 0x000F, 207 + /* port_mode */ 208 + OPA_PI_MASK_PORT_MODE_SECURITY_CHECK = 0x0001, 209 + OPA_PI_MASK_PORT_MODE_16B_TRAP_QUERY = 0x0002, 210 + OPA_PI_MASK_PORT_MODE_PKEY_CONVERT = 0x0004, 211 + OPA_PI_MASK_PORT_MODE_SC2SC_MAPPING = 0x0008, 212 + OPA_PI_MASK_PORT_MODE_VL_MARKER = 0x0010, 213 + OPA_PI_MASK_PORT_PASS_THROUGH = 0x0020, 214 + OPA_PI_MASK_PORT_ACTIVE_OPTOMIZE = 0x0040, 215 + /* flit_control.interleave */ 216 + OPA_PI_MASK_INTERLEAVE_DIST_SUP = (0x0003 << 12), 217 + OPA_PI_MASK_INTERLEAVE_DIST_ENABLE = (0x0003 << 10), 218 + OPA_PI_MASK_INTERLEAVE_MAX_NEST_TX = (0x001F << 5), 219 + OPA_PI_MASK_INTERLEAVE_MAX_NEST_RX = (0x001F << 0), 220 + 221 + /* port_error_action */ 222 + OPA_PI_MASK_EX_BUFFER_OVERRUN = 0x80000000, 223 + /* 7 bits reserved */ 224 + OPA_PI_MASK_FM_CFG_ERR_EXCEED_MULTICAST_LIMIT = 0x00800000, 225 + OPA_PI_MASK_FM_CFG_BAD_CONTROL_FLIT = 0x00400000, 226 + OPA_PI_MASK_FM_CFG_BAD_PREEMPT = 0x00200000, 227 + OPA_PI_MASK_FM_CFG_UNSUPPORTED_VL_MARKER = 0x00100000, 228 + OPA_PI_MASK_FM_CFG_BAD_CRDT_ACK = 0x00080000, 229 + OPA_PI_MASK_FM_CFG_BAD_CTRL_DIST = 0x00040000, 230 + OPA_PI_MASK_FM_CFG_BAD_TAIL_DIST = 0x00020000, 231 + OPA_PI_MASK_FM_CFG_BAD_HEAD_DIST = 0x00010000, 232 + /* 2 bits reserved */ 233 + OPA_PI_MASK_PORT_RCV_BAD_VL_MARKER = 0x00002000, 234 + OPA_PI_MASK_PORT_RCV_PREEMPT_VL15 = 0x00001000, 235 + OPA_PI_MASK_PORT_RCV_PREEMPT_ERROR = 0x00000800, 236 + /* 1 bit reserved */ 237 + OPA_PI_MASK_PORT_RCV_BAD_MidTail = 0x00000200, 238 + /* 1 bit reserved */ 239 + OPA_PI_MASK_PORT_RCV_BAD_SC = 0x00000080, 240 + OPA_PI_MASK_PORT_RCV_BAD_L2 = 0x00000040, 241 + OPA_PI_MASK_PORT_RCV_BAD_DLID = 0x00000020, 242 + OPA_PI_MASK_PORT_RCV_BAD_SLID = 0x00000010, 243 + OPA_PI_MASK_PORT_RCV_PKTLEN_TOOSHORT = 0x00000008, 244 + OPA_PI_MASK_PORT_RCV_PKTLEN_TOOLONG = 0x00000004, 245 + OPA_PI_MASK_PORT_RCV_BAD_PKTLEN = 0x00000002, 246 + OPA_PI_MASK_PORT_RCV_BAD_LT = 0x00000001, 247 + 248 + /* pass_through.res_drctl */ 249 + OPA_PI_MASK_PASS_THROUGH_DR_CONTROL = 0x01, 250 + 251 + /* buffer_units */ 252 + OPA_PI_MASK_BUF_UNIT_VL15_INIT = (0x00000FFF << 11), 253 + OPA_PI_MASK_BUF_UNIT_VL15_CREDIT_RATE = (0x0000001F << 6), 254 + OPA_PI_MASK_BUF_UNIT_CREDIT_ACK = (0x00000003 << 3), 255 + OPA_PI_MASK_BUF_UNIT_BUF_ALLOC = (0x00000003 << 0), 256 + 257 + /* neigh_mtu.pvlx_to_mtu */ 258 + OPA_PI_MASK_NEIGH_MTU_PVL0 = 0xF0, 259 + OPA_PI_MASK_NEIGH_MTU_PVL1 = 0x0F, 260 + 261 + /* neigh_mtu.vlstall_hoq_life */ 262 + OPA_PI_MASK_VL_STALL = (0x03 << 5), 263 + OPA_PI_MASK_HOQ_LIFE = (0x1F << 0), 264 + 265 + /* port_neigh_mode */ 266 + OPA_PI_MASK_NEIGH_MGMT_ALLOWED = (0x01 << 3), 267 + OPA_PI_MASK_NEIGH_FW_AUTH_BYPASS = (0x01 << 2), 268 + OPA_PI_MASK_NEIGH_NODE_TYPE = (0x03 << 0), 269 + 270 + /* resptime_value */ 271 + OPA_PI_MASK_RESPONSE_TIME_VALUE = 0x1F, 272 + 273 + /* mtucap */ 274 + OPA_PI_MASK_MTU_CAP = 0x0F, 275 + }; 276 + 277 + #if USE_PI_LED_ENABLE 278 + struct opa_port_states { 279 + u8 reserved; 280 + u8 ledenable_offlinereason; /* 1 res, 1 bit, 6 bits */ 281 + u8 reserved2; 282 + u8 portphysstate_portstate; /* 4 bits, 4 bits */ 283 + }; 284 + #define PI_LED_ENABLE_SUP 1 285 + #else 286 + struct opa_port_states { 287 + u8 reserved; 288 + u8 offline_reason; /* 2 res, 6 bits */ 289 + u8 reserved2; 290 + u8 portphysstate_portstate; /* 4 bits, 4 bits */ 291 + }; 292 + #define PI_LED_ENABLE_SUP 0 293 + #endif 294 + 295 + struct opa_port_state_info { 296 + struct opa_port_states port_states; 297 + u16 link_width_downgrade_tx_active; 298 + u16 link_width_downgrade_rx_active; 299 + }; 300 + 301 + struct opa_port_info { 302 + __be32 lid; 303 + __be32 flow_control_mask; 304 + 305 + struct { 306 + u8 res; /* was inittype */ 307 + u8 cap; /* 3 res, 5 bits */ 308 + __be16 high_limit; 309 + __be16 preempt_limit; 310 + u8 arb_high_cap; 311 + u8 arb_low_cap; 312 + } vl; 313 + 314 + struct opa_port_states port_states; 315 + u8 port_phys_conf; /* 4 res, 4 bits */ 316 + u8 collectivemask_multicastmask; /* 2 res, 3, 3 */ 317 + u8 mkeyprotect_lmc; /* 2 bits, 2 res, 4 bits */ 318 + u8 smsl; /* 3 res, 5 bits */ 319 + 320 + u8 partenforce_filterraw; /* bit fields */ 321 + u8 operational_vls; /* 3 res, 5 bits */ 322 + __be16 pkey_8b; 323 + __be16 pkey_10b; 324 + __be16 mkey_violations; 325 + 326 + __be16 pkey_violations; 327 + __be16 qkey_violations; 328 + __be32 sm_trap_qp; /* 8 bits, 24 bits */ 329 + 330 + __be32 sa_qp; /* 8 bits, 24 bits */ 331 + u8 neigh_port_num; 332 + u8 link_down_reason; 333 + u8 neigh_link_down_reason; 334 + u8 clientrereg_subnettimeout; /* 1 bit, 2 bits, 5 */ 335 + 336 + struct { 337 + __be16 supported; 338 + __be16 enabled; 339 + __be16 active; 340 + } link_speed; 341 + struct { 342 + __be16 supported; 343 + __be16 enabled; 344 + __be16 active; 345 + } link_width; 346 + struct { 347 + __be16 supported; 348 + __be16 enabled; 349 + __be16 tx_active; 350 + __be16 rx_active; 351 + } link_width_downgrade; 352 + __be16 port_link_mode; /* 1 res, 5 bits, 5 bits, 5 bits */ 353 + __be16 port_ltp_crc_mode; /* 4 res, 4 bits, 4 bits, 4 bits */ 354 + 355 + __be16 port_mode; /* 9 res, bit fields */ 356 + struct { 357 + __be16 supported; 358 + __be16 enabled; 359 + } port_packet_format; 360 + struct { 361 + __be16 interleave; /* 2 res, 2,2,5,5 */ 362 + struct { 363 + __be16 min_initial; 364 + __be16 min_tail; 365 + u8 large_pkt_limit; 366 + u8 small_pkt_limit; 367 + u8 max_small_pkt_limit; 368 + u8 preemption_limit; 369 + } preemption; 370 + } flit_control; 371 + 372 + __be32 reserved4; 373 + __be32 port_error_action; /* bit field */ 374 + 375 + struct { 376 + u8 egress_port; 377 + u8 res_drctl; /* 7 res, 1 */ 378 + } pass_through; 379 + __be16 mkey_lease_period; 380 + __be32 buffer_units; /* 9 res, 12, 5, 3, 3 */ 381 + 382 + __be32 reserved5; 383 + __be32 sm_lid; 384 + 385 + __be64 mkey; 386 + 387 + __be64 subnet_prefix; 388 + 389 + struct { 390 + u8 pvlx_to_mtu[OPA_MAX_VLS/2]; /* 4 bits, 4 bits */ 391 + } neigh_mtu; 392 + 393 + struct { 394 + u8 vlstall_hoqlife; /* 3 bits, 5 bits */ 395 + } xmit_q[OPA_MAX_VLS]; 396 + 397 + struct { 398 + u8 addr[16]; 399 + } ipaddr_ipv6; 400 + 401 + struct { 402 + u8 addr[4]; 403 + } ipaddr_ipv4; 404 + 405 + u32 reserved6; 406 + u32 reserved7; 407 + u32 reserved8; 408 + 409 + __be64 neigh_node_guid; 410 + 411 + __be32 ib_cap_mask; 412 + __be16 reserved9; /* was ib_cap_mask2 */ 413 + __be16 opa_cap_mask; 414 + 415 + __be32 reserved10; /* was link_roundtrip_latency */ 416 + __be16 overall_buffer_space; 417 + __be16 reserved11; /* was max_credit_hint */ 418 + 419 + __be16 diag_code; 420 + struct { 421 + u8 buffer; 422 + u8 wire; 423 + } replay_depth; 424 + u8 port_neigh_mode; 425 + u8 mtucap; /* 4 res, 4 bits */ 426 + 427 + u8 resptimevalue; /* 3 res, 5 bits */ 428 + u8 local_port_num; 429 + u8 reserved12; 430 + u8 reserved13; /* was guid_cap */ 431 + } __attribute__ ((packed)); 432 + 433 + #endif /* OPA_PORT_INFO_H */
+47
include/rdma/opa_smi.h
··· 40 40 #define OPA_SMP_DR_DATA_SIZE 1872 41 41 #define OPA_SMP_MAX_PATH_HOPS 64 42 42 43 + #define OPA_MAX_VLS 32 44 + #define OPA_MAX_SLS 32 45 + #define OPA_MAX_SCS 32 46 + 43 47 #define OPA_SMI_CLASS_VERSION 0x80 44 48 45 49 #define OPA_LID_PERMISSIVE cpu_to_be32(0xFFFFFFFF) ··· 76 72 } route; 77 73 } __packed; 78 74 75 + 76 + /* Subnet management attributes */ 77 + /* ... */ 78 + #define OPA_ATTRIB_ID_NODE_DESCRIPTION cpu_to_be16(0x0010) 79 + #define OPA_ATTRIB_ID_NODE_INFO cpu_to_be16(0x0011) 80 + #define OPA_ATTRIB_ID_PORT_INFO cpu_to_be16(0x0015) 81 + #define OPA_ATTRIB_ID_PARTITION_TABLE cpu_to_be16(0x0016) 82 + #define OPA_ATTRIB_ID_SL_TO_SC_MAP cpu_to_be16(0x0017) 83 + #define OPA_ATTRIB_ID_VL_ARBITRATION cpu_to_be16(0x0018) 84 + #define OPA_ATTRIB_ID_SM_INFO cpu_to_be16(0x0020) 85 + #define OPA_ATTRIB_ID_CABLE_INFO cpu_to_be16(0x0032) 86 + #define OPA_ATTRIB_ID_AGGREGATE cpu_to_be16(0x0080) 87 + #define OPA_ATTRIB_ID_SC_TO_SL_MAP cpu_to_be16(0x0082) 88 + #define OPA_ATTRIB_ID_SC_TO_VLR_MAP cpu_to_be16(0x0083) 89 + #define OPA_ATTRIB_ID_SC_TO_VLT_MAP cpu_to_be16(0x0084) 90 + #define OPA_ATTRIB_ID_SC_TO_VLNT_MAP cpu_to_be16(0x0085) 91 + /* ... */ 92 + #define OPA_ATTRIB_ID_PORT_STATE_INFO cpu_to_be16(0x0087) 93 + /* ... */ 94 + #define OPA_ATTRIB_ID_BUFFER_CONTROL_TABLE cpu_to_be16(0x008A) 95 + /* ... */ 96 + 97 + struct opa_node_description { 98 + u8 data[64]; 99 + } __attribute__ ((packed)); 100 + 101 + struct opa_node_info { 102 + u8 base_version; 103 + u8 class_version; 104 + u8 node_type; 105 + u8 num_ports; 106 + __be32 reserved; 107 + __be64 system_image_guid; 108 + __be64 node_guid; 109 + __be64 port_guid; 110 + __be16 partition_cap; 111 + __be16 device_id; 112 + __be32 revision; 113 + u8 local_port_num; 114 + u8 vendor_id[3]; /* network byte order */ 115 + } __attribute__ ((packed)); 116 + 117 + #define OPA_PARTITION_TABLE_BLK_SIZE 32 79 118 80 119 static inline u8 81 120 opa_get_smp_direction(struct opa_smp *smp)
+427
include/uapi/rdma/hfi/hfi1_user.h
··· 1 + /* 2 + * 3 + * This file is provided under a dual BSD/GPLv2 license. When using or 4 + * redistributing this file, you may do so under either license. 5 + * 6 + * GPL LICENSE SUMMARY 7 + * 8 + * Copyright(c) 2015 Intel Corporation. 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of version 2 of the GNU General Public License as 12 + * published by the Free Software Foundation. 13 + * 14 + * This program is distributed in the hope that it will be useful, but 15 + * WITHOUT ANY WARRANTY; without even the implied warranty of 16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 + * General Public License for more details. 18 + * 19 + * BSD LICENSE 20 + * 21 + * Copyright(c) 2015 Intel Corporation. 22 + * 23 + * Redistribution and use in source and binary forms, with or without 24 + * modification, are permitted provided that the following conditions 25 + * are met: 26 + * 27 + * - Redistributions of source code must retain the above copyright 28 + * notice, this list of conditions and the following disclaimer. 29 + * - Redistributions in binary form must reproduce the above copyright 30 + * notice, this list of conditions and the following disclaimer in 31 + * the documentation and/or other materials provided with the 32 + * distribution. 33 + * - Neither the name of Intel Corporation nor the names of its 34 + * contributors may be used to endorse or promote products derived 35 + * from this software without specific prior written permission. 36 + * 37 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 38 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 39 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 40 + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 41 + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 42 + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 43 + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 44 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 45 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 46 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 47 + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 48 + * 49 + */ 50 + 51 + /* 52 + * This file contains defines, structures, etc. that are used 53 + * to communicate between kernel and user code. 54 + */ 55 + 56 + #ifndef _LINUX__HFI1_USER_H 57 + #define _LINUX__HFI1_USER_H 58 + 59 + #include <linux/types.h> 60 + 61 + /* 62 + * This version number is given to the driver by the user code during 63 + * initialization in the spu_userversion field of hfi1_user_info, so 64 + * the driver can check for compatibility with user code. 65 + * 66 + * The major version changes when data structures change in an incompatible 67 + * way. The driver must be the same for initialization to succeed. 68 + */ 69 + #define HFI1_USER_SWMAJOR 4 70 + 71 + /* 72 + * Minor version differences are always compatible 73 + * a within a major version, however if user software is larger 74 + * than driver software, some new features and/or structure fields 75 + * may not be implemented; the user code must deal with this if it 76 + * cares, or it must abort after initialization reports the difference. 77 + */ 78 + #define HFI1_USER_SWMINOR 0 79 + 80 + /* 81 + * Set of HW and driver capability/feature bits. 82 + * These bit values are used to configure enabled/disabled HW and 83 + * driver features. The same set of bits are communicated to user 84 + * space. 85 + */ 86 + #define HFI1_CAP_DMA_RTAIL (1UL << 0) /* Use DMA'ed RTail value */ 87 + #define HFI1_CAP_SDMA (1UL << 1) /* Enable SDMA support */ 88 + #define HFI1_CAP_SDMA_AHG (1UL << 2) /* Enable SDMA AHG support */ 89 + #define HFI1_CAP_EXTENDED_PSN (1UL << 3) /* Enable Extended PSN support */ 90 + #define HFI1_CAP_HDRSUPP (1UL << 4) /* Enable Header Suppression */ 91 + /* 1UL << 5 reserved */ 92 + #define HFI1_CAP_USE_SDMA_HEAD (1UL << 6) /* DMA Hdr Q tail vs. use CSR */ 93 + #define HFI1_CAP_MULTI_PKT_EGR (1UL << 7) /* Enable multi-packet Egr buffs*/ 94 + #define HFI1_CAP_NODROP_RHQ_FULL (1UL << 8) /* Don't drop on Hdr Q full */ 95 + #define HFI1_CAP_NODROP_EGR_FULL (1UL << 9) /* Don't drop on EGR buffs full */ 96 + #define HFI1_CAP_TID_UNMAP (1UL << 10) /* Enable Expected TID caching */ 97 + #define HFI1_CAP_PRINT_UNIMPL (1UL << 11) /* Show for unimplemented feats */ 98 + #define HFI1_CAP_ALLOW_PERM_JKEY (1UL << 12) /* Allow use of permissive JKEY */ 99 + #define HFI1_CAP_NO_INTEGRITY (1UL << 13) /* Enable ctxt integrity checks */ 100 + #define HFI1_CAP_PKEY_CHECK (1UL << 14) /* Enable ctxt PKey checking */ 101 + #define HFI1_CAP_STATIC_RATE_CTRL (1UL << 15) /* Allow PBC.StaticRateControl */ 102 + #define HFI1_CAP_QSFP_ENABLED (1UL << 16) /* Enable QSFP check during LNI */ 103 + #define HFI1_CAP_SDMA_HEAD_CHECK (1UL << 17) /* SDMA head checking */ 104 + #define HFI1_CAP_EARLY_CREDIT_RETURN (1UL << 18) /* early credit return */ 105 + 106 + #define HFI1_RCVHDR_ENTSIZE_2 (1UL << 0) 107 + #define HFI1_RCVHDR_ENTSIZE_16 (1UL << 1) 108 + #define HFI1_RCVDHR_ENTSIZE_32 (1UL << 2) 109 + 110 + /* 111 + * If the unit is specified via open, HFI choice is fixed. If port is 112 + * specified, it's also fixed. Otherwise we try to spread contexts 113 + * across ports and HFIs, using different algorithms. WITHIN is 114 + * the old default, prior to this mechanism. 115 + */ 116 + #define HFI1_ALG_ACROSS 0 /* round robin contexts across HFIs, then 117 + * ports; this is the default */ 118 + #define HFI1_ALG_WITHIN 1 /* use all contexts on an HFI (round robin 119 + * active ports within), then next HFI */ 120 + #define HFI1_ALG_COUNT 2 /* number of algorithm choices */ 121 + 122 + 123 + /* User commands. */ 124 + #define HFI1_CMD_ASSIGN_CTXT 1 /* allocate HFI and context */ 125 + #define HFI1_CMD_CTXT_INFO 2 /* find out what resources we got */ 126 + #define HFI1_CMD_USER_INFO 3 /* set up userspace */ 127 + #define HFI1_CMD_TID_UPDATE 4 /* update expected TID entries */ 128 + #define HFI1_CMD_TID_FREE 5 /* free expected TID entries */ 129 + #define HFI1_CMD_CREDIT_UPD 6 /* force an update of PIO credit */ 130 + #define HFI1_CMD_SDMA_STATUS_UPD 7 /* force update of SDMA status ring */ 131 + 132 + #define HFI1_CMD_RECV_CTRL 8 /* control receipt of packets */ 133 + #define HFI1_CMD_POLL_TYPE 9 /* set the kind of polling we want */ 134 + #define HFI1_CMD_ACK_EVENT 10 /* ack & clear user status bits */ 135 + #define HFI1_CMD_SET_PKEY 11 /* set context's pkey */ 136 + #define HFI1_CMD_CTXT_RESET 12 /* reset context's HW send context */ 137 + /* separate EPROM commands from normal PSM commands */ 138 + #define HFI1_CMD_EP_INFO 64 /* read EPROM device ID */ 139 + #define HFI1_CMD_EP_ERASE_CHIP 65 /* erase whole EPROM */ 140 + #define HFI1_CMD_EP_ERASE_P0 66 /* erase EPROM partition 0 */ 141 + #define HFI1_CMD_EP_ERASE_P1 67 /* erase EPROM partition 1 */ 142 + #define HFI1_CMD_EP_READ_P0 68 /* read EPROM partition 0 */ 143 + #define HFI1_CMD_EP_READ_P1 69 /* read EPROM partition 1 */ 144 + #define HFI1_CMD_EP_WRITE_P0 70 /* write EPROM partition 0 */ 145 + #define HFI1_CMD_EP_WRITE_P1 71 /* write EPROM partition 1 */ 146 + 147 + #define _HFI1_EVENT_FROZEN_BIT 0 148 + #define _HFI1_EVENT_LINKDOWN_BIT 1 149 + #define _HFI1_EVENT_LID_CHANGE_BIT 2 150 + #define _HFI1_EVENT_LMC_CHANGE_BIT 3 151 + #define _HFI1_EVENT_SL2VL_CHANGE_BIT 4 152 + #define _HFI1_MAX_EVENT_BIT _HFI1_EVENT_SL2VL_CHANGE_BIT 153 + 154 + #define HFI1_EVENT_FROZEN (1UL << _HFI1_EVENT_FROZEN_BIT) 155 + #define HFI1_EVENT_LINKDOWN_BIT (1UL << _HFI1_EVENT_LINKDOWN_BIT) 156 + #define HFI1_EVENT_LID_CHANGE_BIT (1UL << _HFI1_EVENT_LID_CHANGE_BIT) 157 + #define HFI1_EVENT_LMC_CHANGE_BIT (1UL << _HFI1_EVENT_LMC_CHANGE_BIT) 158 + #define HFI1_EVENT_SL2VL_CHANGE_BIT (1UL << _HFI1_EVENT_SL2VL_CHANGE_BIT) 159 + 160 + /* 161 + * These are the status bits readable (in ASCII form, 64bit value) 162 + * from the "status" sysfs file. For binary compatibility, values 163 + * must remain as is; removed states can be reused for different 164 + * purposes. 165 + */ 166 + #define HFI1_STATUS_INITTED 0x1 /* basic initialization done */ 167 + /* Chip has been found and initialized */ 168 + #define HFI1_STATUS_CHIP_PRESENT 0x20 169 + /* IB link is at ACTIVE, usable for data traffic */ 170 + #define HFI1_STATUS_IB_READY 0x40 171 + /* link is configured, LID, MTU, etc. have been set */ 172 + #define HFI1_STATUS_IB_CONF 0x80 173 + /* A Fatal hardware error has occurred. */ 174 + #define HFI1_STATUS_HWERROR 0x200 175 + 176 + /* 177 + * Number of supported shared contexts. 178 + * This is the maximum number of software contexts that can share 179 + * a hardware send/receive context. 180 + */ 181 + #define HFI1_MAX_SHARED_CTXTS 8 182 + 183 + /* 184 + * Poll types 185 + */ 186 + #define HFI1_POLL_TYPE_ANYRCV 0x0 187 + #define HFI1_POLL_TYPE_URGENT 0x1 188 + 189 + /* 190 + * This structure is passed to the driver to tell it where 191 + * user code buffers are, sizes, etc. The offsets and sizes of the 192 + * fields must remain unchanged, for binary compatibility. It can 193 + * be extended, if userversion is changed so user code can tell, if needed 194 + */ 195 + struct hfi1_user_info { 196 + /* 197 + * version of user software, to detect compatibility issues. 198 + * Should be set to HFI1_USER_SWVERSION. 199 + */ 200 + __u32 userversion; 201 + __u16 pad; 202 + /* HFI selection algorithm, if unit has not selected */ 203 + __u16 hfi1_alg; 204 + /* 205 + * If two or more processes wish to share a context, each process 206 + * must set the subcontext_cnt and subcontext_id to the same 207 + * values. The only restriction on the subcontext_id is that 208 + * it be unique for a given node. 209 + */ 210 + __u16 subctxt_cnt; 211 + __u16 subctxt_id; 212 + /* 128bit UUID passed in by PSM. */ 213 + __u8 uuid[16]; 214 + }; 215 + 216 + struct hfi1_ctxt_info { 217 + __u64 runtime_flags; /* chip/drv runtime flags (HFI1_CAP_*) */ 218 + __u32 rcvegr_size; /* size of each eager buffer */ 219 + __u16 num_active; /* number of active units */ 220 + __u16 unit; /* unit (chip) assigned to caller */ 221 + __u16 ctxt; /* ctxt on unit assigned to caller */ 222 + __u16 subctxt; /* subctxt on unit assigned to caller */ 223 + __u16 rcvtids; /* number of Rcv TIDs for this context */ 224 + __u16 credits; /* number of PIO credits for this context */ 225 + __u16 numa_node; /* NUMA node of the assigned device */ 226 + __u16 rec_cpu; /* cpu # for affinity (0xffff if none) */ 227 + __u16 send_ctxt; /* send context in use by this user context */ 228 + __u16 egrtids; /* number of RcvArray entries for Eager Rcvs */ 229 + __u16 rcvhdrq_cnt; /* number of RcvHdrQ entries */ 230 + __u16 rcvhdrq_entsize; /* size (in bytes) for each RcvHdrQ entry */ 231 + __u16 sdma_ring_size; /* number of entries in SDMA request ring */ 232 + }; 233 + 234 + struct hfi1_tid_info { 235 + /* virtual address of first page in transfer */ 236 + __u64 vaddr; 237 + /* pointer to tid array. this array is big enough */ 238 + __u64 tidlist; 239 + /* number of tids programmed by this request */ 240 + __u32 tidcnt; 241 + /* length of transfer buffer programmed by this request */ 242 + __u32 length; 243 + /* 244 + * pointer to bitmap of TIDs used for this call; 245 + * checked for being large enough at open 246 + */ 247 + __u64 tidmap; 248 + }; 249 + 250 + struct hfi1_cmd { 251 + __u32 type; /* command type */ 252 + __u32 len; /* length of struct pointed to by add */ 253 + __u64 addr; /* pointer to user structure */ 254 + }; 255 + 256 + enum hfi1_sdma_comp_state { 257 + FREE = 0, 258 + QUEUED, 259 + COMPLETE, 260 + ERROR 261 + }; 262 + 263 + /* 264 + * SDMA completion ring entry 265 + */ 266 + struct hfi1_sdma_comp_entry { 267 + __u32 status; 268 + __u32 errcode; 269 + }; 270 + 271 + /* 272 + * Device status and notifications from driver to user-space. 273 + */ 274 + struct hfi1_status { 275 + __u64 dev; /* device/hw status bits */ 276 + __u64 port; /* port state and status bits */ 277 + char freezemsg[0]; 278 + }; 279 + 280 + /* 281 + * This structure is returned by the driver immediately after 282 + * open to get implementation-specific info, and info specific to this 283 + * instance. 284 + * 285 + * This struct must have explicit pad fields where type sizes 286 + * may result in different alignments between 32 and 64 bit 287 + * programs, since the 64 bit * bit kernel requires the user code 288 + * to have matching offsets 289 + */ 290 + struct hfi1_base_info { 291 + /* version of hardware, for feature checking. */ 292 + __u32 hw_version; 293 + /* version of software, for feature checking. */ 294 + __u32 sw_version; 295 + /* Job key */ 296 + __u16 jkey; 297 + __u16 padding1; 298 + /* 299 + * The special QP (queue pair) value that identifies PSM 300 + * protocol packet from standard IB packets. 301 + */ 302 + __u32 bthqp; 303 + /* PIO credit return address, */ 304 + __u64 sc_credits_addr; 305 + /* 306 + * Base address of write-only pio buffers for this process. 307 + * Each buffer has sendpio_credits*64 bytes. 308 + */ 309 + __u64 pio_bufbase_sop; 310 + /* 311 + * Base address of write-only pio buffers for this process. 312 + * Each buffer has sendpio_credits*64 bytes. 313 + */ 314 + __u64 pio_bufbase; 315 + /* address where receive buffer queue is mapped into */ 316 + __u64 rcvhdr_bufbase; 317 + /* base address of Eager receive buffers. */ 318 + __u64 rcvegr_bufbase; 319 + /* base address of SDMA completion ring */ 320 + __u64 sdma_comp_bufbase; 321 + /* 322 + * User register base for init code, not to be used directly by 323 + * protocol or applications. Always maps real chip register space. 324 + * the register addresses are: 325 + * ur_rcvhdrhead, ur_rcvhdrtail, ur_rcvegrhead, ur_rcvegrtail, 326 + * ur_rcvtidflow 327 + */ 328 + __u64 user_regbase; 329 + /* notification events */ 330 + __u64 events_bufbase; 331 + /* status page */ 332 + __u64 status_bufbase; 333 + /* rcvhdrtail update */ 334 + __u64 rcvhdrtail_base; 335 + /* 336 + * shared memory pages for subctxts if ctxt is shared; these cover 337 + * all the processes in the group sharing a single context. 338 + * all have enough space for the num_subcontexts value on this job. 339 + */ 340 + __u64 subctxt_uregbase; 341 + __u64 subctxt_rcvegrbuf; 342 + __u64 subctxt_rcvhdrbuf; 343 + }; 344 + 345 + enum sdma_req_opcode { 346 + EXPECTED = 0, 347 + EAGER 348 + }; 349 + 350 + #define HFI1_SDMA_REQ_VERSION_MASK 0xF 351 + #define HFI1_SDMA_REQ_VERSION_SHIFT 0x0 352 + #define HFI1_SDMA_REQ_OPCODE_MASK 0xF 353 + #define HFI1_SDMA_REQ_OPCODE_SHIFT 0x4 354 + #define HFI1_SDMA_REQ_IOVCNT_MASK 0xFF 355 + #define HFI1_SDMA_REQ_IOVCNT_SHIFT 0x8 356 + 357 + struct sdma_req_info { 358 + /* 359 + * bits 0-3 - version (currently unused) 360 + * bits 4-7 - opcode (enum sdma_req_opcode) 361 + * bits 8-15 - io vector count 362 + */ 363 + __u16 ctrl; 364 + /* 365 + * Number of fragments contained in this request. 366 + * User-space has already computed how many 367 + * fragment-sized packet the user buffer will be 368 + * split into. 369 + */ 370 + __u16 npkts; 371 + /* 372 + * Size of each fragment the user buffer will be 373 + * split into. 374 + */ 375 + __u16 fragsize; 376 + /* 377 + * Index of the slot in the SDMA completion ring 378 + * this request should be using. User-space is 379 + * in charge of managing its own ring. 380 + */ 381 + __u16 comp_idx; 382 + } __packed; 383 + 384 + /* 385 + * SW KDETH header. 386 + * swdata is SW defined portion. 387 + */ 388 + struct hfi1_kdeth_header { 389 + __le32 ver_tid_offset; 390 + __le16 jkey; 391 + __le16 hcrc; 392 + __le32 swdata[7]; 393 + } __packed; 394 + 395 + /* 396 + * Structure describing the headers that User space uses. The 397 + * structure above is a subset of this one. 398 + */ 399 + struct hfi1_pkt_header { 400 + __le16 pbc[4]; 401 + __be16 lrh[4]; 402 + __be32 bth[3]; 403 + struct hfi1_kdeth_header kdeth; 404 + } __packed; 405 + 406 + 407 + /* 408 + * The list of usermode accessible registers. 409 + */ 410 + enum hfi1_ureg { 411 + /* (RO) DMA RcvHdr to be used next. */ 412 + ur_rcvhdrtail = 0, 413 + /* (RW) RcvHdr entry to be processed next by host. */ 414 + ur_rcvhdrhead = 1, 415 + /* (RO) Index of next Eager index to use. */ 416 + ur_rcvegrindextail = 2, 417 + /* (RW) Eager TID to be processed next */ 418 + ur_rcvegrindexhead = 3, 419 + /* (RO) Receive Eager Offset Tail */ 420 + ur_rcvegroffsettail = 4, 421 + /* For internal use only; max register number. */ 422 + ur_maxreg, 423 + /* (RW) Receive TID flow table */ 424 + ur_rcvtidflowtable = 256 425 + }; 426 + 427 + #endif /* _LINIUX__HFI1_USER_H */