From patchwork Fri Aug 19 02:14:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hefty, Sean" X-Patchwork-Id: 1078412 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7J2DW3l026514 for ; Fri, 19 Aug 2011 02:14:05 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355Ab1HSCOD (ORCPT ); Thu, 18 Aug 2011 22:14:03 -0400 Received: from mga03.intel.com ([143.182.124.21]:55431 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751599Ab1HSCOC convert rfc822-to-8bit (ORCPT ); Thu, 18 Aug 2011 22:14:02 -0400 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 18 Aug 2011 19:14:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.68,248,1312182000"; d="scan'208";a="40078674" Received: from azsmsx601.amr.corp.intel.com ([10.2.121.193]) by azsmga001.ch.intel.com with ESMTP; 18 Aug 2011 19:14:02 -0700 Received: from fmsmsx102.amr.corp.intel.com (10.19.9.53) by azsmsx601.amr.corp.intel.com (10.2.121.193) with Microsoft SMTP Server (TLS) id 8.2.255.0; Thu, 18 Aug 2011 19:14:01 -0700 Received: from fmsmsx151.amr.corp.intel.com ([169.254.6.155]) by FMSMSX102.amr.corp.intel.com ([169.254.2.60]) with mapi id 14.01.0323.003; Thu, 18 Aug 2011 19:14:01 -0700 From: "Hefty, Sean" To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: "Hefty, Sean" Subject: [PATCH 3/20 v2] rdma/core: Add XRC SRQ type Thread-Topic: [PATCH 3/20 v2] rdma/core: Add XRC SRQ type Thread-Index: AcxeD7WXC0JDN1DrRW2MnPIy8NnUVw== Date: Fri, 19 Aug 2011 02:14:00 +0000 Message-ID: <1828884A29C6694DAF28B7E6B8A8237316E419E4@FMSMSX151.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.22.254.139] MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 19 Aug 2011 02:14:05 +0000 (UTC) XRC defines an SRQ that is specifically used by XRC connections. Expand the SRQ code to support XRC SRQs. An XRC SRQ is currently restricted to XRC use only according to the IB XRC Annex. Portions of this patch were derived from work by Jack Morgenstein Signed-off-by: Sean Hefty --- drivers/infiniband/core/verbs.c | 21 ++++++++++++++++++++- include/rdma/ib_verbs.h | 18 +++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index cbe85dd..25c1c1e 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -251,6 +251,12 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd, srq->event_handler = srq_init_attr->event_handler; srq->srq_context = srq_init_attr->srq_context; srq->srq_type = srq_init_attr->srq_type; + if (srq->srq_type == IB_SRQT_XRC) { + srq->ext.xrc.xrcd = srq_init_attr->ext.xrc.xrcd; + srq->ext.xrc.cq = srq_init_attr->ext.xrc.cq; + atomic_inc(&srq->ext.xrc.xrcd->usecnt); + atomic_inc(&srq->ext.xrc.cq->usecnt); + } atomic_inc(&pd->usecnt); atomic_set(&srq->usecnt, 0); } @@ -280,16 +286,29 @@ EXPORT_SYMBOL(ib_query_srq); int ib_destroy_srq(struct ib_srq *srq) { struct ib_pd *pd; + enum ib_srq_type srq_type; + struct ib_xrcd *uninitialized_var(xrcd); + struct ib_cq *uninitialized_var(cq); int ret; if (atomic_read(&srq->usecnt)) return -EBUSY; pd = srq->pd; + srq_type = srq->srq_type; + if (srq_type == IB_SRQT_XRC) { + xrcd = srq->ext.xrc.xrcd; + cq = srq->ext.xrc.cq; + } ret = srq->device->destroy_srq(srq); - if (!ret) + if (!ret) { atomic_dec(&pd->usecnt); + if (srq_type == IB_SRQT_XRC) { + atomic_dec(&xrcd->usecnt); + atomic_dec(&cq->usecnt); + } + } return ret; } diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 1374a66..2a85461 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -523,7 +523,8 @@ enum ib_cq_notify_flags { }; enum ib_srq_type { - IB_SRQT_BASIC + IB_SRQT_BASIC, + IB_SRQT_XRC }; enum ib_srq_attr_mask { @@ -542,6 +543,13 @@ struct ib_srq_init_attr { void *srq_context; struct ib_srq_attr attr; enum ib_srq_type srq_type; + + union { + struct { + struct ib_xrcd *xrcd; + struct ib_cq *cq; + } xrc; + } ext; }; struct ib_qp_cap { @@ -894,6 +902,14 @@ struct ib_srq { void *srq_context; enum ib_srq_type srq_type; atomic_t usecnt; + + union { + struct { + struct ib_xrcd *xrcd; + struct ib_cq *cq; + u32 srq_num; + } xrc; + } ext; }; struct ib_qp {