Skip to content

Commit 59991f9

Browse files
Sean Heftyrolandd
authored andcommitted
RDMA/core: Add XRC domain support
XRC ("eXtended reliable connected") is an IB transport that provides better scalability by allowing senders to specify which shared receive queue (SRQ) should be used to receive a message, which essentially allows one transport context (QP connection) to serve multiple destinations (as long as they share an adapter, of course). A few new concepts are introduced to support this. This patch adds: - A new device capability flag, IB_DEVICE_XRC, which low-level drivers set to indicate that a device supports XRC. - A new object type, XRC domains (struct ib_xrcd), and new verbs ib_alloc_xrcd()/ib_dealloc_xrcd(). XRCDs are used to limit which XRC SRQs an incoming message can target. This patch is derived from work by Jack Morgenstein <[email protected]>. Signed-off-by: Sean Hefty <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 976d167 commit 59991f9

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

drivers/infiniband/core/verbs.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -920,3 +920,29 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid)
920920
return qp->device->detach_mcast(qp, gid, lid);
921921
}
922922
EXPORT_SYMBOL(ib_detach_mcast);
923+
924+
struct ib_xrcd *ib_alloc_xrcd(struct ib_device *device)
925+
{
926+
struct ib_xrcd *xrcd;
927+
928+
if (!device->alloc_xrcd)
929+
return ERR_PTR(-ENOSYS);
930+
931+
xrcd = device->alloc_xrcd(device, NULL, NULL);
932+
if (!IS_ERR(xrcd)) {
933+
xrcd->device = device;
934+
atomic_set(&xrcd->usecnt, 0);
935+
}
936+
937+
return xrcd;
938+
}
939+
EXPORT_SYMBOL(ib_alloc_xrcd);
940+
941+
int ib_dealloc_xrcd(struct ib_xrcd *xrcd)
942+
{
943+
if (atomic_read(&xrcd->usecnt))
944+
return -EBUSY;
945+
946+
return xrcd->device->dealloc_xrcd(xrcd);
947+
}
948+
EXPORT_SYMBOL(ib_dealloc_xrcd);

include/rdma/ib_verbs.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ enum ib_device_cap_flags {
112112
*/
113113
IB_DEVICE_UD_IP_CSUM = (1<<18),
114114
IB_DEVICE_UD_TSO = (1<<19),
115+
IB_DEVICE_XRC = (1<<20),
115116
IB_DEVICE_MEM_MGT_EXTENSIONS = (1<<21),
116117
IB_DEVICE_BLOCK_MULTICAST_LOOPBACK = (1<<22),
117118
};
@@ -858,6 +859,11 @@ struct ib_pd {
858859
atomic_t usecnt; /* count all resources */
859860
};
860861

862+
struct ib_xrcd {
863+
struct ib_device *device;
864+
atomic_t usecnt; /* count all resources */
865+
};
866+
861867
struct ib_ah {
862868
struct ib_device *device;
863869
struct ib_pd *pd;
@@ -1149,6 +1155,10 @@ struct ib_device {
11491155
struct ib_grh *in_grh,
11501156
struct ib_mad *in_mad,
11511157
struct ib_mad *out_mad);
1158+
struct ib_xrcd * (*alloc_xrcd)(struct ib_device *device,
1159+
struct ib_ucontext *ucontext,
1160+
struct ib_udata *udata);
1161+
int (*dealloc_xrcd)(struct ib_xrcd *xrcd);
11521162

11531163
struct ib_dma_mapping_ops *dma_ops;
11541164

@@ -2060,4 +2070,16 @@ int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
20602070
*/
20612071
int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid);
20622072

2073+
/**
2074+
* ib_alloc_xrcd - Allocates an XRC domain.
2075+
* @device: The device on which to allocate the XRC domain.
2076+
*/
2077+
struct ib_xrcd *ib_alloc_xrcd(struct ib_device *device);
2078+
2079+
/**
2080+
* ib_dealloc_xrcd - Deallocates an XRC domain.
2081+
* @xrcd: The XRC domain to deallocate.
2082+
*/
2083+
int ib_dealloc_xrcd(struct ib_xrcd *xrcd);
2084+
20632085
#endif /* IB_VERBS_H */

0 commit comments

Comments
 (0)