]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
rdma/core: Add SRQ type
authorSean Hefty <sean.hefty@intel.com>
Mon, 23 May 2011 23:31:36 +0000 (16:31 -0700)
committerSean Hefty <sean.hefty@intel.com>
Mon, 22 Aug 2011 18:39:58 +0000 (11:39 -0700)
Currently, there is only a single type of SRQ, but with XRC support
we will add a second.  Prepare for this by defining an SRQ type and
setting all current users to IB_SRQT_BASIC.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/ehca/ehca_qp.c
drivers/infiniband/hw/ipath/ipath_srq.c
drivers/infiniband/hw/mlx4/srq.c
drivers/infiniband/hw/mthca/mthca_provider.c
drivers/infiniband/hw/qib/qib_srq.c
drivers/infiniband/ulp/ipoib/ipoib_cm.c
include/rdma/ib_verbs.h

index c42699285f8eb0d67745c359afadc6e125e7815d..48d21d09afe7dc746034c4696c4687e7370d1bd8 100644 (file)
@@ -2013,6 +2013,7 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file,
 
        attr.event_handler  = ib_uverbs_srq_event_handler;
        attr.srq_context    = file;
+       attr.srq_type       = IB_SRQT_BASIC;
        attr.attr.max_wr    = cmd.max_wr;
        attr.attr.max_sge   = cmd.max_sge;
        attr.attr.srq_limit = cmd.srq_limit;
index 5e03ab78fc8e3e18827c528ffbe8565394699341..cbe85ddaf89804b76b9761c555c70665196aa495 100644 (file)
@@ -250,6 +250,7 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd,
                srq->uobject       = NULL;
                srq->event_handler = srq_init_attr->event_handler;
                srq->srq_context   = srq_init_attr->srq_context;
+               srq->srq_type      = srq_init_attr->srq_type;
                atomic_inc(&pd->usecnt);
                atomic_set(&srq->usecnt, 0);
        }
index 32fb34201aba1b27d0ee2910ba70d958f46d5eb2..964f85520798b81605cf65ea516ef5465e7dc8ad 100644 (file)
@@ -977,6 +977,9 @@ struct ib_srq *ehca_create_srq(struct ib_pd *pd,
        struct hcp_modify_qp_control_block *mqpcb;
        u64 hret, update_mask;
 
+       if (srq_init_attr->srq_type != IB_SRQT_BASIC)
+               return ERR_PTR(-ENOSYS);
+
        /* For common attributes, internal_create_qp() takes its info
         * out of qp_init_attr, so copy all common attrs there.
         */
index 386e2c717c53b4b03707c8a21fd027cf8121199f..26271984b71741ba5ac556822529aeef9533e766 100644 (file)
@@ -107,6 +107,11 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
        u32 sz;
        struct ib_srq *ret;
 
+       if (srq_init_attr->srq_type != IB_SRQT_BASIC) {
+               ret = ERR_PTR(-ENOSYS);
+               goto done;
+       }
+
        if (srq_init_attr->attr.max_wr == 0) {
                ret = ERR_PTR(-EINVAL);
                goto done;
index 818b7ecace5e3c812b7f7500ba44a13ac46ef397..4f7f7600d27ca1ffed61b84407942ef78a036329 100644 (file)
@@ -81,6 +81,9 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
        int err;
        int i;
 
+       if (init_attr->srq_type != IB_SRQT_BASIC)
+               return ERR_PTR(-ENOSYS);
+
        /* Sanity check SRQ size before proceeding */
        if (init_attr->attr.max_wr  >= dev->dev->caps.max_srq_wqes ||
            init_attr->attr.max_sge >  dev->dev->caps.max_srq_sge)
index 1e0b4b6074ad00443bd274eb5047ad126e6732d8..784fd5de84a276ddaac0cf890996fb82f3ce5f6a 100644 (file)
@@ -474,6 +474,9 @@ static struct ib_srq *mthca_create_srq(struct ib_pd *pd,
        struct mthca_srq *srq;
        int err;
 
+       if (init_attr->srq_type != IB_SRQT_BASIC)
+               return ERR_PTR(-ENOSYS);
+
        srq = kmalloc(sizeof *srq, GFP_KERNEL);
        if (!srq)
                return ERR_PTR(-ENOMEM);
index c3ec8efc2ed810b2b0823a9cc4beec979b20886f..d6235931a1ba867afdd87806317891122ff38f51 100644 (file)
@@ -107,6 +107,11 @@ struct ib_srq *qib_create_srq(struct ib_pd *ibpd,
        u32 sz;
        struct ib_srq *ret;
 
+       if (srq_init_attr->srq_type != IB_SRQT_BASIC) {
+               ret = ERR_PTR(-ENOSYS);
+               goto done;
+       }
+
        if (srq_init_attr->attr.max_sge == 0 ||
            srq_init_attr->attr.max_sge > ib_qib_max_srq_sges ||
            srq_init_attr->attr.max_wr == 0 ||
index 39913a065f99d833bcced4257c794c26341235b4..ef003cc54a4306772a60380b577e2ad5fc0c5ecd 100644 (file)
@@ -1496,6 +1496,7 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
 {
        struct ipoib_dev_priv *priv = netdev_priv(dev);
        struct ib_srq_init_attr srq_init_attr = {
+               .srq_type = IB_SRQT_BASIC,
                .attr = {
                        .max_wr  = ipoib_recvq_size,
                        .max_sge = max_sge
index 760662f0ec6cd3793ae135a8a8365bab260b602e..1374a6614282fd6992f76f06befd8b4081b858d6 100644 (file)
@@ -522,6 +522,10 @@ enum ib_cq_notify_flags {
        IB_CQ_REPORT_MISSED_EVENTS      = 1 << 2,
 };
 
+enum ib_srq_type {
+       IB_SRQT_BASIC
+};
+
 enum ib_srq_attr_mask {
        IB_SRQ_MAX_WR   = 1 << 0,
        IB_SRQ_LIMIT    = 1 << 1,
@@ -537,6 +541,7 @@ struct ib_srq_init_attr {
        void                  (*event_handler)(struct ib_event *, void *);
        void                   *srq_context;
        struct ib_srq_attr      attr;
+       enum ib_srq_type        srq_type;
 };
 
 struct ib_qp_cap {
@@ -887,6 +892,7 @@ struct ib_srq {
        struct ib_uobject      *uobject;
        void                  (*event_handler)(struct ib_event *, void *);
        void                   *srq_context;
+       enum ib_srq_type        srq_type;
        atomic_t                usecnt;
 };