1 #ifndef _UAPI_RDMA_NETLINK_H 2 #define _UAPI_RDMA_NETLINK_H 3 4 #include <linux/types.h> 5 6 enum { 7 RDMA_NL_RDMA_CM = 1, 8 RDMA_NL_IWCM, 9 RDMA_NL_RSVD, 10 RDMA_NL_LS, /* RDMA Local Services */ 11 RDMA_NL_NLDEV, /* RDMA device interface */ 12 RDMA_NL_NUM_CLIENTS 13 }; 14 15 enum { 16 RDMA_NL_GROUP_CM = 1, 17 RDMA_NL_GROUP_IWPM, 18 RDMA_NL_GROUP_LS, 19 RDMA_NL_NUM_GROUPS 20 }; 21 22 #define RDMA_NL_GET_CLIENT(type) ((type & (((1 << 6) - 1) << 10)) >> 10) 23 #define RDMA_NL_GET_OP(type) (type & ((1 << 10) - 1)) 24 #define RDMA_NL_GET_TYPE(client, op) ((client << 10) + op) 25 26 enum { 27 RDMA_NL_RDMA_CM_ID_STATS = 0, 28 RDMA_NL_RDMA_CM_NUM_OPS 29 }; 30 31 enum { 32 RDMA_NL_RDMA_CM_ATTR_SRC_ADDR = 1, 33 RDMA_NL_RDMA_CM_ATTR_DST_ADDR, 34 RDMA_NL_RDMA_CM_NUM_ATTR, 35 }; 36 37 /* iwarp port mapper op-codes */ 38 enum { 39 RDMA_NL_IWPM_REG_PID = 0, 40 RDMA_NL_IWPM_ADD_MAPPING, 41 RDMA_NL_IWPM_QUERY_MAPPING, 42 RDMA_NL_IWPM_REMOVE_MAPPING, 43 RDMA_NL_IWPM_REMOTE_INFO, 44 RDMA_NL_IWPM_HANDLE_ERR, 45 RDMA_NL_IWPM_MAPINFO, 46 RDMA_NL_IWPM_MAPINFO_NUM, 47 RDMA_NL_IWPM_NUM_OPS 48 }; 49 50 struct rdma_cm_id_stats { 51 __u32 qp_num; 52 __u32 bound_dev_if; 53 __u32 port_space; 54 __s32 pid; 55 __u8 cm_state; 56 __u8 node_type; 57 __u8 port_num; 58 __u8 qp_type; 59 }; 60 61 enum { 62 IWPM_NLA_REG_PID_UNSPEC = 0, 63 IWPM_NLA_REG_PID_SEQ, 64 IWPM_NLA_REG_IF_NAME, 65 IWPM_NLA_REG_IBDEV_NAME, 66 IWPM_NLA_REG_ULIB_NAME, 67 IWPM_NLA_REG_PID_MAX 68 }; 69 70 enum { 71 IWPM_NLA_RREG_PID_UNSPEC = 0, 72 IWPM_NLA_RREG_PID_SEQ, 73 IWPM_NLA_RREG_IBDEV_NAME, 74 IWPM_NLA_RREG_ULIB_NAME, 75 IWPM_NLA_RREG_ULIB_VER, 76 IWPM_NLA_RREG_PID_ERR, 77 IWPM_NLA_RREG_PID_MAX 78 79 }; 80 81 enum { 82 IWPM_NLA_MANAGE_MAPPING_UNSPEC = 0, 83 IWPM_NLA_MANAGE_MAPPING_SEQ, 84 IWPM_NLA_MANAGE_ADDR, 85 IWPM_NLA_MANAGE_MAPPED_LOC_ADDR, 86 IWPM_NLA_RMANAGE_MAPPING_ERR, 87 IWPM_NLA_RMANAGE_MAPPING_MAX 88 }; 89 90 #define IWPM_NLA_MANAGE_MAPPING_MAX 3 91 #define IWPM_NLA_QUERY_MAPPING_MAX 4 92 #define IWPM_NLA_MAPINFO_SEND_MAX 3 93 94 enum { 95 IWPM_NLA_QUERY_MAPPING_UNSPEC = 0, 96 IWPM_NLA_QUERY_MAPPING_SEQ, 97 IWPM_NLA_QUERY_LOCAL_ADDR, 98 IWPM_NLA_QUERY_REMOTE_ADDR, 99 IWPM_NLA_RQUERY_MAPPED_LOC_ADDR, 100 IWPM_NLA_RQUERY_MAPPED_REM_ADDR, 101 IWPM_NLA_RQUERY_MAPPING_ERR, 102 IWPM_NLA_RQUERY_MAPPING_MAX 103 }; 104 105 enum { 106 IWPM_NLA_MAPINFO_REQ_UNSPEC = 0, 107 IWPM_NLA_MAPINFO_ULIB_NAME, 108 IWPM_NLA_MAPINFO_ULIB_VER, 109 IWPM_NLA_MAPINFO_REQ_MAX 110 }; 111 112 enum { 113 IWPM_NLA_MAPINFO_UNSPEC = 0, 114 IWPM_NLA_MAPINFO_LOCAL_ADDR, 115 IWPM_NLA_MAPINFO_MAPPED_ADDR, 116 IWPM_NLA_MAPINFO_MAX 117 }; 118 119 enum { 120 IWPM_NLA_MAPINFO_NUM_UNSPEC = 0, 121 IWPM_NLA_MAPINFO_SEQ, 122 IWPM_NLA_MAPINFO_SEND_NUM, 123 IWPM_NLA_MAPINFO_ACK_NUM, 124 IWPM_NLA_MAPINFO_NUM_MAX 125 }; 126 127 enum { 128 IWPM_NLA_ERR_UNSPEC = 0, 129 IWPM_NLA_ERR_SEQ, 130 IWPM_NLA_ERR_CODE, 131 IWPM_NLA_ERR_MAX 132 }; 133 134 /* 135 * Local service operations: 136 * RESOLVE - The client requests the local service to resolve a path. 137 * SET_TIMEOUT - The local service requests the client to set the timeout. 138 * IP_RESOLVE - The client requests the local service to resolve an IP to GID. 139 */ 140 enum { 141 RDMA_NL_LS_OP_RESOLVE = 0, 142 RDMA_NL_LS_OP_SET_TIMEOUT, 143 RDMA_NL_LS_OP_IP_RESOLVE, 144 RDMA_NL_LS_NUM_OPS 145 }; 146 147 /* Local service netlink message flags */ 148 #define RDMA_NL_LS_F_ERR 0x0100 /* Failed response */ 149 150 /* 151 * Local service resolve operation family header. 152 * The layout for the resolve operation: 153 * nlmsg header 154 * family header 155 * attributes 156 */ 157 158 /* 159 * Local service path use: 160 * Specify how the path(s) will be used. 161 * ALL - For connected CM operation (6 pathrecords) 162 * UNIDIRECTIONAL - For unidirectional UD (1 pathrecord) 163 * GMP - For miscellaneous GMP like operation (at least 1 reversible 164 * pathrecord) 165 */ 166 enum { 167 LS_RESOLVE_PATH_USE_ALL = 0, 168 LS_RESOLVE_PATH_USE_UNIDIRECTIONAL, 169 LS_RESOLVE_PATH_USE_GMP, 170 LS_RESOLVE_PATH_USE_MAX 171 }; 172 173 #define LS_DEVICE_NAME_MAX 64 174 175 struct rdma_ls_resolve_header { 176 __u8 device_name[LS_DEVICE_NAME_MAX]; 177 __u8 port_num; 178 __u8 path_use; 179 }; 180 181 struct rdma_ls_ip_resolve_header { 182 __u32 ifindex; 183 }; 184 185 /* Local service attribute type */ 186 #define RDMA_NLA_F_MANDATORY (1 << 13) 187 #define RDMA_NLA_TYPE_MASK (~(NLA_F_NESTED | NLA_F_NET_BYTEORDER | \ 188 RDMA_NLA_F_MANDATORY)) 189 190 /* 191 * Local service attributes: 192 * Attr Name Size Byte order 193 * ----------------------------------------------------- 194 * PATH_RECORD struct ib_path_rec_data 195 * TIMEOUT u32 cpu 196 * SERVICE_ID u64 cpu 197 * DGID u8[16] BE 198 * SGID u8[16] BE 199 * TCLASS u8 200 * PKEY u16 cpu 201 * QOS_CLASS u16 cpu 202 * IPV4 u32 BE 203 * IPV6 u8[16] BE 204 */ 205 enum { 206 LS_NLA_TYPE_UNSPEC = 0, 207 LS_NLA_TYPE_PATH_RECORD, 208 LS_NLA_TYPE_TIMEOUT, 209 LS_NLA_TYPE_SERVICE_ID, 210 LS_NLA_TYPE_DGID, 211 LS_NLA_TYPE_SGID, 212 LS_NLA_TYPE_TCLASS, 213 LS_NLA_TYPE_PKEY, 214 LS_NLA_TYPE_QOS_CLASS, 215 LS_NLA_TYPE_IPV4, 216 LS_NLA_TYPE_IPV6, 217 LS_NLA_TYPE_MAX 218 }; 219 220 /* Local service DGID/SGID attribute: big endian */ 221 struct rdma_nla_ls_gid { 222 __u8 gid[16]; 223 }; 224 225 enum rdma_nldev_command { 226 RDMA_NLDEV_CMD_UNSPEC, 227 228 RDMA_NLDEV_CMD_GET, /* can dump */ 229 RDMA_NLDEV_CMD_SET, 230 RDMA_NLDEV_CMD_NEW, 231 RDMA_NLDEV_CMD_DEL, 232 233 RDMA_NLDEV_CMD_PORT_GET, /* can dump */ 234 RDMA_NLDEV_CMD_PORT_SET, 235 RDMA_NLDEV_CMD_PORT_NEW, 236 RDMA_NLDEV_CMD_PORT_DEL, 237 238 RDMA_NLDEV_NUM_OPS 239 }; 240 241 enum rdma_nldev_attr { 242 /* don't change the order or add anything between, this is ABI! */ 243 RDMA_NLDEV_ATTR_UNSPEC, 244 245 /* Identifier for ib_device */ 246 RDMA_NLDEV_ATTR_DEV_INDEX, /* u32 */ 247 248 RDMA_NLDEV_ATTR_DEV_NAME, /* string */ 249 /* 250 * Device index together with port index are identifiers 251 * for port/link properties. 252 * 253 * For RDMA_NLDEV_CMD_GET commamnd, port index will return number 254 * of available ports in ib_device, while for port specific operations, 255 * it will be real port index as it appears in sysfs. Port index follows 256 * sysfs notation and starts from 1 for the first port. 257 */ 258 RDMA_NLDEV_ATTR_PORT_INDEX, /* u32 */ 259 260 /* 261 * Device and port capabilities 262 */ 263 RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */ 264 265 /* 266 * FW version 267 */ 268 RDMA_NLDEV_ATTR_FW_VERSION, /* string */ 269 270 /* 271 * Node GUID (in host byte order) associated with the RDMA device. 272 */ 273 RDMA_NLDEV_ATTR_NODE_GUID, /* u64 */ 274 275 /* 276 * System image GUID (in host byte order) associated with 277 * this RDMA device and other devices which are part of a 278 * single system. 279 */ 280 RDMA_NLDEV_ATTR_SYS_IMAGE_GUID, /* u64 */ 281 282 /* 283 * Subnet prefix (in host byte order) 284 */ 285 RDMA_NLDEV_ATTR_SUBNET_PREFIX, /* u64 */ 286 287 /* 288 * Local Identifier (LID), 289 * According to IB specification, It is 16-bit address assigned 290 * by the Subnet Manager. Extended to be 32-bit for OmniPath users. 291 */ 292 RDMA_NLDEV_ATTR_LID, /* u32 */ 293 RDMA_NLDEV_ATTR_SM_LID, /* u32 */ 294 295 /* 296 * LID mask control (LMC) 297 */ 298 RDMA_NLDEV_ATTR_LMC, /* u8 */ 299 300 RDMA_NLDEV_ATTR_PORT_STATE, /* u8 */ 301 RDMA_NLDEV_ATTR_PORT_PHYS_STATE, /* u8 */ 302 303 RDMA_NLDEV_ATTR_DEV_NODE_TYPE, /* u8 */ 304 305 RDMA_NLDEV_ATTR_MAX 306 }; 307 #endif /* _UAPI_RDMA_NETLINK_H */ 308