From: sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: [PATCH 4/8] rdmacm: Add functionality to allocate an XRCD
Date: Tue, 1 Jul 2014 23:11:15 -0700 [thread overview]
Message-ID: <1404281479-6755-5-git-send-email-sean.hefty@intel.com> (raw)
In-Reply-To: <1404281479-6755-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
From: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
XRC QPs and SRQs are associated by an XRC domain. Provide a
call to allocate an XRCD, similar to how the rdmacm allocates
a PD for the user.
Signed-off-by: Sean Hefty <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
src/cma.c | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/src/cma.c b/src/cma.c
index 192d9ed..52d81ff 100644
--- a/src/cma.c
+++ b/src/cma.c
@@ -76,6 +76,7 @@ do { \
struct cma_device {
struct ibv_context *verbs;
struct ibv_pd *pd;
+ struct ibv_xrcd *xrcd;
uint64_t guid;
int port_cnt;
int refcnt;
@@ -439,9 +440,28 @@ out:
static void ucma_put_device(struct cma_device *cma_dev)
{
pthread_mutex_lock(&mut);
- if (!--cma_dev->refcnt)
+ if (!--cma_dev->refcnt) {
ibv_dealloc_pd(cma_dev->pd);
+ if (cma_dev->xrcd)
+ ibv_close_xrcd(cma_dev->xrcd);
+ }
+ pthread_mutex_unlock(&mut);
+}
+
+static struct ibv_xrcd *ucma_get_xrcd(struct cma_device *cma_dev)
+{
+ struct ibv_xrcd_init_attr attr;
+
+ pthread_mutex_lock(&mut);
+ if (!cma_dev->xrcd) {
+ memset(&attr, 0, sizeof attr);
+ attr.comp_mask = IBV_XRCD_INIT_ATTR_FD | IBV_XRCD_INIT_ATTR_OFLAGS;
+ attr.fd = -1;
+ attr.oflags = O_CREAT;
+ cma_dev->xrcd = ibv_open_xrcd(cma_dev->verbs, &attr);
+ }
pthread_mutex_unlock(&mut);
+ return cma_dev->xrcd;
}
static void ucma_insert_id(struct cma_id_private *id_priv)
--
1.7.3
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2014-07-02 6:11 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-02 6:11 [PATCH 0/8] librdmacm: Add support for XRC QPs sean.hefty-ral2JQCrhuEAvxtiuMwx3w
[not found] ` <1404281479-6755-1-git-send-email-sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2014-07-02 6:11 ` [PATCH 1/8] librdmacm: Remove NULL checks after calling alloca sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-07-02 6:11 ` [PATCH 2/8] librdmacm: Use SRQ in rdma_create_qp sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-07-02 6:11 ` [PATCH 3/8] build: Add build support for XRC sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-07-02 6:11 ` sean.hefty-ral2JQCrhuEAvxtiuMwx3w [this message]
2014-07-02 6:11 ` [PATCH 5/8] rdmacm: Add support for allocating XRC SRQs sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-07-02 6:11 ` [PATCH 6/8] rdmacm: Add support for XRC QPs sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-07-02 6:11 ` [PATCH 7/8] rdmacm: Update addrinfo with XRC support sean.hefty-ral2JQCrhuEAvxtiuMwx3w
2014-07-02 6:11 ` [PATCH 8/8] example/rdma_xclient/server: Update XRC support in sample programs sean.hefty-ral2JQCrhuEAvxtiuMwx3w
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1404281479-6755-5-git-send-email-sean.hefty@intel.com \
--to=sean.hefty-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox