1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-O 1 2 /* 3 * Copyright (c) 2014 Intel Corporation. All 4 */ 5 6 #ifndef OPA_SMI_H 7 #define OPA_SMI_H 8 9 #include <rdma/ib_mad.h> 10 #include <rdma/ib_smi.h> 11 12 #define OPA_SMP_LID_DATA_SIZE 13 #define OPA_SMP_DR_DATA_SIZE 14 #define OPA_SMP_MAX_PATH_HOPS 15 16 #define OPA_MAX_VLS 17 #define OPA_MAX_SLS 18 #define OPA_MAX_SCS 19 20 #define OPA_LID_PERMISSIVE 21 22 struct opa_smp { 23 u8 base_version; 24 u8 mgmt_class; 25 u8 class_version; 26 u8 method; 27 __be16 status; 28 u8 hop_ptr; 29 u8 hop_cnt; 30 __be64 tid; 31 __be16 attr_id; 32 __be16 resv; 33 __be32 attr_mod; 34 __be64 mkey; 35 union { 36 struct { 37 uint8_t data[OPA_SMP_L 38 } lid; 39 struct { 40 __be32 dr_slid; 41 __be32 dr_dlid; 42 u8 initial_path[O 43 u8 return_path[OP 44 u8 reserved[8]; 45 u8 data[OPA_SMP_D 46 } dr; 47 } route; 48 } __packed; 49 50 51 /* Subnet management attributes */ 52 /* ... */ 53 #define OPA_ATTRIB_ID_NODE_DESCRIPTION 54 #define OPA_ATTRIB_ID_NODE_INFO 55 #define OPA_ATTRIB_ID_PORT_INFO 56 #define OPA_ATTRIB_ID_PARTITION_TABLE 57 #define OPA_ATTRIB_ID_SL_TO_SC_MAP 58 #define OPA_ATTRIB_ID_VL_ARBITRATION 59 #define OPA_ATTRIB_ID_SM_INFO 60 #define OPA_ATTRIB_ID_CABLE_INFO 61 #define OPA_ATTRIB_ID_AGGREGATE 62 #define OPA_ATTRIB_ID_SC_TO_SL_MAP 63 #define OPA_ATTRIB_ID_SC_TO_VLR_MAP 64 #define OPA_ATTRIB_ID_SC_TO_VLT_MAP 65 #define OPA_ATTRIB_ID_SC_TO_VLNT_MAP 66 /* ... */ 67 #define OPA_ATTRIB_ID_PORT_STATE_INFO 68 /* ... */ 69 #define OPA_ATTRIB_ID_BUFFER_CONTROL_TABLE 70 /* ... */ 71 72 struct opa_node_description { 73 u8 data[64]; 74 } __packed; 75 76 struct opa_node_info { 77 u8 base_version; 78 u8 class_version; 79 u8 node_type; 80 u8 num_ports; 81 __be32 reserved; 82 __be64 system_image_guid; 83 __be64 node_guid; 84 __be64 port_guid; 85 __be16 partition_cap; 86 __be16 device_id; 87 __be32 revision; 88 u8 local_port_num; 89 u8 vendor_id[3]; /* network byt 90 } __packed; 91 92 #define OPA_PARTITION_TABLE_BLK_SIZE 32 93 94 static inline u8 95 opa_get_smp_direction(struct opa_smp *smp) 96 { 97 return ib_get_smp_direction((struct ib 98 } 99 100 static inline u8 *opa_get_smp_data(struct opa_ 101 { 102 if (smp->mgmt_class == IB_MGMT_CLASS_S 103 return smp->route.dr.data; 104 105 return smp->route.lid.data; 106 } 107 108 static inline size_t opa_get_smp_data_size(str 109 { 110 if (smp->mgmt_class == IB_MGMT_CLASS_S 111 return sizeof(smp->route.dr.da 112 113 return sizeof(smp->route.lid.data); 114 } 115 116 static inline size_t opa_get_smp_header_size(s 117 { 118 if (smp->mgmt_class == IB_MGMT_CLASS_S 119 return sizeof(*smp) - sizeof(s 120 121 return sizeof(*smp) - sizeof(smp->rout 122 } 123 124 #endif /* OPA_SMI_H */ 125
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.