1 /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
3 * Copyright (c) 2014 Intel Corporation. All rights reserved.
9 #include <rdma/ib_mad.h>
10 #include <rdma/ib_smi.h>
12 #define OPA_SMP_LID_DATA_SIZE 2016
13 #define OPA_SMP_DR_DATA_SIZE 1872
14 #define OPA_SMP_MAX_PATH_HOPS 64
16 #define OPA_MAX_VLS 32
17 #define OPA_MAX_SLS 32
18 #define OPA_MAX_SCS 32
20 #define OPA_LID_PERMISSIVE cpu_to_be32(0xFFFFFFFF)
37 uint8_t data
[OPA_SMP_LID_DATA_SIZE
];
42 u8 initial_path
[OPA_SMP_MAX_PATH_HOPS
];
43 u8 return_path
[OPA_SMP_MAX_PATH_HOPS
];
45 u8 data
[OPA_SMP_DR_DATA_SIZE
];
51 /* Subnet management attributes */
53 #define OPA_ATTRIB_ID_NODE_DESCRIPTION cpu_to_be16(0x0010)
54 #define OPA_ATTRIB_ID_NODE_INFO cpu_to_be16(0x0011)
55 #define OPA_ATTRIB_ID_PORT_INFO cpu_to_be16(0x0015)
56 #define OPA_ATTRIB_ID_PARTITION_TABLE cpu_to_be16(0x0016)
57 #define OPA_ATTRIB_ID_SL_TO_SC_MAP cpu_to_be16(0x0017)
58 #define OPA_ATTRIB_ID_VL_ARBITRATION cpu_to_be16(0x0018)
59 #define OPA_ATTRIB_ID_SM_INFO cpu_to_be16(0x0020)
60 #define OPA_ATTRIB_ID_CABLE_INFO cpu_to_be16(0x0032)
61 #define OPA_ATTRIB_ID_AGGREGATE cpu_to_be16(0x0080)
62 #define OPA_ATTRIB_ID_SC_TO_SL_MAP cpu_to_be16(0x0082)
63 #define OPA_ATTRIB_ID_SC_TO_VLR_MAP cpu_to_be16(0x0083)
64 #define OPA_ATTRIB_ID_SC_TO_VLT_MAP cpu_to_be16(0x0084)
65 #define OPA_ATTRIB_ID_SC_TO_VLNT_MAP cpu_to_be16(0x0085)
67 #define OPA_ATTRIB_ID_PORT_STATE_INFO cpu_to_be16(0x0087)
69 #define OPA_ATTRIB_ID_BUFFER_CONTROL_TABLE cpu_to_be16(0x008A)
72 struct opa_node_description
{
76 struct opa_node_info
{
82 __be64 system_image_guid
;
89 u8 vendor_id
[3]; /* network byte order */
92 #define OPA_PARTITION_TABLE_BLK_SIZE 32
95 opa_get_smp_direction(struct opa_smp
*smp
)
97 return ib_get_smp_direction((struct ib_smp
*)smp
);
100 static inline u8
*opa_get_smp_data(struct opa_smp
*smp
)
102 if (smp
->mgmt_class
== IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE
)
103 return smp
->route
.dr
.data
;
105 return smp
->route
.lid
.data
;
108 static inline size_t opa_get_smp_data_size(struct opa_smp
*smp
)
110 if (smp
->mgmt_class
== IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE
)
111 return sizeof(smp
->route
.dr
.data
);
113 return sizeof(smp
->route
.lid
.data
);
116 static inline size_t opa_get_smp_header_size(struct opa_smp
*smp
)
118 if (smp
->mgmt_class
== IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE
)
119 return sizeof(*smp
) - sizeof(smp
->route
.dr
.data
);
121 return sizeof(*smp
) - sizeof(smp
->route
.lid
.data
);
124 #endif /* OPA_SMI_H */