Skip to content

Commit 1f9a5e3

Browse files
authored
Merge pull request #1628 from shefty/svcrec
librdmacm: Allow using SA to resolve IB addresses
2 parents c307ee5 + 4b83401 commit 1f9a5e3

17 files changed

+787
-8
lines changed

debian/librdmacm1.symbols

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ librdmacm.so.1 librdmacm1 #MINVER#
44
RDMACM_1.1@RDMACM_1.1 16
55
RDMACM_1.2@RDMACM_1.2 23
66
RDMACM_1.3@RDMACM_1.3 31
7+
RDMACM_1.4@RDMACM_1.4 60
78
raccept@RDMACM_1.0 1.0.16
89
rbind@RDMACM_1.0 1.0.16
910
rclose@RDMACM_1.0 1.0.16
@@ -43,12 +44,15 @@ librdmacm.so.1 librdmacm1 #MINVER#
4344
rdma_listen@RDMACM_1.0 1.0.15
4445
rdma_migrate_id@RDMACM_1.0 1.0.15
4546
rdma_notify@RDMACM_1.0 1.0.15
47+
rdma_query_addrinfo@RDMACM_1.4 60
4648
rdma_reject@RDMACM_1.0 1.0.15
4749
rdma_reject_ece@RDMACM_1.3 31
4850
rdma_resolve_addr@RDMACM_1.0 1.0.15
51+
rdma_resolve_addrinfo@RDMACM_1.4 60
4952
rdma_resolve_route@RDMACM_1.0 1.0.15
5053
rdma_set_local_ece@RDMACM_1.3 31
5154
rdma_set_option@RDMACM_1.0 1.0.15
55+
rdma_write_cm_event@RDMACM_1.4 60
5256
rfcntl@RDMACM_1.0 1.0.16
5357
rgetpeername@RDMACM_1.0 1.0.16
5458
rgetsockname@RDMACM_1.0 1.0.16

kernel-headers/rdma/ib_user_sa.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,18 @@ struct ib_user_path_rec {
7474
__u8 preference;
7575
};
7676

77+
struct ib_user_service_rec {
78+
__be64 id;
79+
__u8 gid[16];
80+
__be16 pkey;
81+
__u8 reserved[2];
82+
__be32 lease;
83+
__u8 key[16];
84+
__u8 name[64];
85+
__u8 data_8[16];
86+
__be16 data_16[8];
87+
__be32 data_32[4];
88+
__be64 data_64[2];
89+
};
90+
7791
#endif /* IB_USER_SA_H */

kernel-headers/rdma/rdma_user_cm.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ enum {
6767
RDMA_USER_CM_CMD_QUERY,
6868
RDMA_USER_CM_CMD_BIND,
6969
RDMA_USER_CM_CMD_RESOLVE_ADDR,
70-
RDMA_USER_CM_CMD_JOIN_MCAST
70+
RDMA_USER_CM_CMD_JOIN_MCAST,
71+
RDMA_USER_CM_CMD_RESOLVE_IB_SERVICE
7172
};
7273

7374
/* See IBTA Annex A11, servies ID bytes 4 & 5 */
@@ -147,7 +148,8 @@ struct rdma_ucm_resolve_route {
147148
enum {
148149
RDMA_USER_CM_QUERY_ADDR,
149150
RDMA_USER_CM_QUERY_PATH,
150-
RDMA_USER_CM_QUERY_GID
151+
RDMA_USER_CM_QUERY_GID,
152+
RDMA_USER_CM_QUERY_IB_SERVICE
151153
};
152154

153155
struct rdma_ucm_query {
@@ -187,6 +189,11 @@ struct rdma_ucm_query_path_resp {
187189
struct ib_path_rec_data path_data[];
188190
};
189191

192+
struct rdma_ucm_query_ib_service_resp {
193+
__u32 num_service_recs;
194+
struct ib_user_service_rec recs[];
195+
};
196+
190197
struct rdma_ucm_conn_param {
191198
__u32 qp_num;
192199
__u32 qkey;
@@ -338,4 +345,21 @@ struct rdma_ucm_migrate_resp {
338345
__u32 events_reported;
339346
};
340347

348+
enum {
349+
RDMA_USER_CM_IB_SERVICE_FLAG_ID = 1 << 0,
350+
RDMA_USER_CM_IB_SERVICE_FLAG_NAME = 1 << 1,
351+
};
352+
353+
#define RDMA_USER_CM_IB_SERVICE_NAME_SIZE 64
354+
struct rdma_ucm_ib_service {
355+
__u64 service_id;
356+
__u8 service_name[RDMA_USER_CM_IB_SERVICE_NAME_SIZE];
357+
__u32 flags;
358+
__u32 reserved;
359+
};
360+
361+
struct rdma_ucm_resolve_ib_service {
362+
__u32 id;
363+
struct rdma_ucm_ib_service ibs;
364+
};
341365
#endif /* RDMA_USER_CM_H */

librdmacm/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ publish_headers(infiniband
1111

1212
rdma_library(rdmacm librdmacm.map
1313
# See Documentation/versioning.md
14-
1 1.3.${PACKAGE_VERSION}
14+
1 1.4.${PACKAGE_VERSION}
1515
acm.c
1616
addrinfo.c
1717
cma.c

librdmacm/addrinfo.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,13 @@ int rdma_getaddrinfo(const char *node, const char *service,
248248
if (ret)
249249
return ret;
250250

251+
if (hints && hints->ai_flags & RAI_SA) {
252+
if (node || (hints->ai_flags & RAI_DNS))
253+
return ERR(EOPNOTSUPP);
254+
255+
return ucma_getaddrinfo_sa(service, res);
256+
}
257+
251258
rai = calloc(1, sizeof(*rai));
252259
if (!rai)
253260
return ERR(ENOMEM);

0 commit comments

Comments
 (0)