diff options
author | Sean Hefty <sean.hefty@intel.com> | 2011-05-23 19:31:36 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-10-13 12:13:26 -0400 |
commit | 96104eda01695a26da2c8f7423ec0ba3509c8c97 (patch) | |
tree | 04e38bfe564245ebd9a62738d54a111b2d24da4a | |
parent | 59991f94eb32e954aa767f659eb642461e9e8b37 (diff) |
RDMA/core: Add SRQ type field
Currently, there is only a single ("basic") 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>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/core/uverbs_cmd.c | 1 | ||||
-rw-r--r-- | drivers/infiniband/core/verbs.c | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/ehca/ehca_qp.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_srq.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/srq.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_provider.c | 3 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_srq.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_cm.c | 1 | ||||
-rw-r--r-- | include/rdma/ib_verbs.h | 6 |
9 files changed, 28 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c index c42699285f8e..48d21d09afe7 100644 --- a/drivers/infiniband/core/uverbs_cmd.c +++ b/drivers/infiniband/core/uverbs_cmd.c | |||
@@ -2013,6 +2013,7 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file, | |||
2013 | 2013 | ||
2014 | attr.event_handler = ib_uverbs_srq_event_handler; | 2014 | attr.event_handler = ib_uverbs_srq_event_handler; |
2015 | attr.srq_context = file; | 2015 | attr.srq_context = file; |
2016 | attr.srq_type = IB_SRQT_BASIC; | ||
2016 | attr.attr.max_wr = cmd.max_wr; | 2017 | attr.attr.max_wr = cmd.max_wr; |
2017 | attr.attr.max_sge = cmd.max_sge; | 2018 | attr.attr.max_sge = cmd.max_sge; |
2018 | attr.attr.srq_limit = cmd.srq_limit; | 2019 | attr.attr.srq_limit = cmd.srq_limit; |
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 5e03ab78fc8e..cbe85ddaf898 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c | |||
@@ -250,6 +250,7 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd, | |||
250 | srq->uobject = NULL; | 250 | srq->uobject = NULL; |
251 | srq->event_handler = srq_init_attr->event_handler; | 251 | srq->event_handler = srq_init_attr->event_handler; |
252 | srq->srq_context = srq_init_attr->srq_context; | 252 | srq->srq_context = srq_init_attr->srq_context; |
253 | srq->srq_type = srq_init_attr->srq_type; | ||
253 | atomic_inc(&pd->usecnt); | 254 | atomic_inc(&pd->usecnt); |
254 | atomic_set(&srq->usecnt, 0); | 255 | atomic_set(&srq->usecnt, 0); |
255 | } | 256 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index 32fb34201aba..964f85520798 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -977,6 +977,9 @@ struct ib_srq *ehca_create_srq(struct ib_pd *pd, | |||
977 | struct hcp_modify_qp_control_block *mqpcb; | 977 | struct hcp_modify_qp_control_block *mqpcb; |
978 | u64 hret, update_mask; | 978 | u64 hret, update_mask; |
979 | 979 | ||
980 | if (srq_init_attr->srq_type != IB_SRQT_BASIC) | ||
981 | return ERR_PTR(-ENOSYS); | ||
982 | |||
980 | /* For common attributes, internal_create_qp() takes its info | 983 | /* For common attributes, internal_create_qp() takes its info |
981 | * out of qp_init_attr, so copy all common attrs there. | 984 | * out of qp_init_attr, so copy all common attrs there. |
982 | */ | 985 | */ |
diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c index 386e2c717c53..26271984b717 100644 --- a/drivers/infiniband/hw/ipath/ipath_srq.c +++ b/drivers/infiniband/hw/ipath/ipath_srq.c | |||
@@ -107,6 +107,11 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd, | |||
107 | u32 sz; | 107 | u32 sz; |
108 | struct ib_srq *ret; | 108 | struct ib_srq *ret; |
109 | 109 | ||
110 | if (srq_init_attr->srq_type != IB_SRQT_BASIC) { | ||
111 | ret = ERR_PTR(-ENOSYS); | ||
112 | goto done; | ||
113 | } | ||
114 | |||
110 | if (srq_init_attr->attr.max_wr == 0) { | 115 | if (srq_init_attr->attr.max_wr == 0) { |
111 | ret = ERR_PTR(-EINVAL); | 116 | ret = ERR_PTR(-EINVAL); |
112 | goto done; | 117 | goto done; |
diff --git a/drivers/infiniband/hw/mlx4/srq.c b/drivers/infiniband/hw/mlx4/srq.c index 818b7ecace5e..4f7f7600d27c 100644 --- a/drivers/infiniband/hw/mlx4/srq.c +++ b/drivers/infiniband/hw/mlx4/srq.c | |||
@@ -81,6 +81,9 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd, | |||
81 | int err; | 81 | int err; |
82 | int i; | 82 | int i; |
83 | 83 | ||
84 | if (init_attr->srq_type != IB_SRQT_BASIC) | ||
85 | return ERR_PTR(-ENOSYS); | ||
86 | |||
84 | /* Sanity check SRQ size before proceeding */ | 87 | /* Sanity check SRQ size before proceeding */ |
85 | if (init_attr->attr.max_wr >= dev->dev->caps.max_srq_wqes || | 88 | if (init_attr->attr.max_wr >= dev->dev->caps.max_srq_wqes || |
86 | init_attr->attr.max_sge > dev->dev->caps.max_srq_sge) | 89 | init_attr->attr.max_sge > dev->dev->caps.max_srq_sge) |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 365fe0e14192..cb9a0b976804 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -438,6 +438,9 @@ static struct ib_srq *mthca_create_srq(struct ib_pd *pd, | |||
438 | struct mthca_srq *srq; | 438 | struct mthca_srq *srq; |
439 | int err; | 439 | int err; |
440 | 440 | ||
441 | if (init_attr->srq_type != IB_SRQT_BASIC) | ||
442 | return ERR_PTR(-ENOSYS); | ||
443 | |||
441 | srq = kmalloc(sizeof *srq, GFP_KERNEL); | 444 | srq = kmalloc(sizeof *srq, GFP_KERNEL); |
442 | if (!srq) | 445 | if (!srq) |
443 | return ERR_PTR(-ENOMEM); | 446 | return ERR_PTR(-ENOMEM); |
diff --git a/drivers/infiniband/hw/qib/qib_srq.c b/drivers/infiniband/hw/qib/qib_srq.c index c3ec8efc2ed8..d6235931a1ba 100644 --- a/drivers/infiniband/hw/qib/qib_srq.c +++ b/drivers/infiniband/hw/qib/qib_srq.c | |||
@@ -107,6 +107,11 @@ struct ib_srq *qib_create_srq(struct ib_pd *ibpd, | |||
107 | u32 sz; | 107 | u32 sz; |
108 | struct ib_srq *ret; | 108 | struct ib_srq *ret; |
109 | 109 | ||
110 | if (srq_init_attr->srq_type != IB_SRQT_BASIC) { | ||
111 | ret = ERR_PTR(-ENOSYS); | ||
112 | goto done; | ||
113 | } | ||
114 | |||
110 | if (srq_init_attr->attr.max_sge == 0 || | 115 | if (srq_init_attr->attr.max_sge == 0 || |
111 | srq_init_attr->attr.max_sge > ib_qib_max_srq_sges || | 116 | srq_init_attr->attr.max_sge > ib_qib_max_srq_sges || |
112 | srq_init_attr->attr.max_wr == 0 || | 117 | srq_init_attr->attr.max_wr == 0 || |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 39913a065f99..ef003cc54a43 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c | |||
@@ -1496,6 +1496,7 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge) | |||
1496 | { | 1496 | { |
1497 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 1497 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
1498 | struct ib_srq_init_attr srq_init_attr = { | 1498 | struct ib_srq_init_attr srq_init_attr = { |
1499 | .srq_type = IB_SRQT_BASIC, | ||
1499 | .attr = { | 1500 | .attr = { |
1500 | .max_wr = ipoib_recvq_size, | 1501 | .max_wr = ipoib_recvq_size, |
1501 | .max_sge = max_sge | 1502 | .max_sge = max_sge |
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index d2a5c9b991d1..d0c2dc034054 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h | |||
@@ -523,6 +523,10 @@ enum ib_cq_notify_flags { | |||
523 | IB_CQ_REPORT_MISSED_EVENTS = 1 << 2, | 523 | IB_CQ_REPORT_MISSED_EVENTS = 1 << 2, |
524 | }; | 524 | }; |
525 | 525 | ||
526 | enum ib_srq_type { | ||
527 | IB_SRQT_BASIC | ||
528 | }; | ||
529 | |||
526 | enum ib_srq_attr_mask { | 530 | enum ib_srq_attr_mask { |
527 | IB_SRQ_MAX_WR = 1 << 0, | 531 | IB_SRQ_MAX_WR = 1 << 0, |
528 | IB_SRQ_LIMIT = 1 << 1, | 532 | IB_SRQ_LIMIT = 1 << 1, |
@@ -538,6 +542,7 @@ struct ib_srq_init_attr { | |||
538 | void (*event_handler)(struct ib_event *, void *); | 542 | void (*event_handler)(struct ib_event *, void *); |
539 | void *srq_context; | 543 | void *srq_context; |
540 | struct ib_srq_attr attr; | 544 | struct ib_srq_attr attr; |
545 | enum ib_srq_type srq_type; | ||
541 | }; | 546 | }; |
542 | 547 | ||
543 | struct ib_qp_cap { | 548 | struct ib_qp_cap { |
@@ -888,6 +893,7 @@ struct ib_srq { | |||
888 | struct ib_uobject *uobject; | 893 | struct ib_uobject *uobject; |
889 | void (*event_handler)(struct ib_event *, void *); | 894 | void (*event_handler)(struct ib_event *, void *); |
890 | void *srq_context; | 895 | void *srq_context; |
896 | enum ib_srq_type srq_type; | ||
891 | atomic_t usecnt; | 897 | atomic_t usecnt; |
892 | }; | 898 | }; |
893 | 899 | ||