Skip to content

Commit 96104ed

Browse files
Sean Heftyrolandd
authored andcommitted
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 <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 59991f9 commit 96104ed

File tree

9 files changed

+28
-0
lines changed

9 files changed

+28
-0
lines changed

drivers/infiniband/core/uverbs_cmd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,7 @@ ssize_t ib_uverbs_create_srq(struct ib_uverbs_file *file,
20132013

20142014
attr.event_handler = ib_uverbs_srq_event_handler;
20152015
attr.srq_context = file;
2016+
attr.srq_type = IB_SRQT_BASIC;
20162017
attr.attr.max_wr = cmd.max_wr;
20172018
attr.attr.max_sge = cmd.max_sge;
20182019
attr.attr.srq_limit = cmd.srq_limit;

drivers/infiniband/core/verbs.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ struct ib_srq *ib_create_srq(struct ib_pd *pd,
250250
srq->uobject = NULL;
251251
srq->event_handler = srq_init_attr->event_handler;
252252
srq->srq_context = srq_init_attr->srq_context;
253+
srq->srq_type = srq_init_attr->srq_type;
253254
atomic_inc(&pd->usecnt);
254255
atomic_set(&srq->usecnt, 0);
255256
}

drivers/infiniband/hw/ehca/ehca_qp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,9 @@ struct ib_srq *ehca_create_srq(struct ib_pd *pd,
977977
struct hcp_modify_qp_control_block *mqpcb;
978978
u64 hret, update_mask;
979979

980+
if (srq_init_attr->srq_type != IB_SRQT_BASIC)
981+
return ERR_PTR(-ENOSYS);
982+
980983
/* For common attributes, internal_create_qp() takes its info
981984
* out of qp_init_attr, so copy all common attrs there.
982985
*/

drivers/infiniband/hw/ipath/ipath_srq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
107107
u32 sz;
108108
struct ib_srq *ret;
109109

110+
if (srq_init_attr->srq_type != IB_SRQT_BASIC) {
111+
ret = ERR_PTR(-ENOSYS);
112+
goto done;
113+
}
114+
110115
if (srq_init_attr->attr.max_wr == 0) {
111116
ret = ERR_PTR(-EINVAL);
112117
goto done;

drivers/infiniband/hw/mlx4/srq.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ struct ib_srq *mlx4_ib_create_srq(struct ib_pd *pd,
8181
int err;
8282
int i;
8383

84+
if (init_attr->srq_type != IB_SRQT_BASIC)
85+
return ERR_PTR(-ENOSYS);
86+
8487
/* Sanity check SRQ size before proceeding */
8588
if (init_attr->attr.max_wr >= dev->dev->caps.max_srq_wqes ||
8689
init_attr->attr.max_sge > dev->dev->caps.max_srq_sge)

drivers/infiniband/hw/mthca/mthca_provider.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,9 @@ static struct ib_srq *mthca_create_srq(struct ib_pd *pd,
438438
struct mthca_srq *srq;
439439
int err;
440440

441+
if (init_attr->srq_type != IB_SRQT_BASIC)
442+
return ERR_PTR(-ENOSYS);
443+
441444
srq = kmalloc(sizeof *srq, GFP_KERNEL);
442445
if (!srq)
443446
return ERR_PTR(-ENOMEM);

drivers/infiniband/hw/qib/qib_srq.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ struct ib_srq *qib_create_srq(struct ib_pd *ibpd,
107107
u32 sz;
108108
struct ib_srq *ret;
109109

110+
if (srq_init_attr->srq_type != IB_SRQT_BASIC) {
111+
ret = ERR_PTR(-ENOSYS);
112+
goto done;
113+
}
114+
110115
if (srq_init_attr->attr.max_sge == 0 ||
111116
srq_init_attr->attr.max_sge > ib_qib_max_srq_sges ||
112117
srq_init_attr->attr.max_wr == 0 ||

drivers/infiniband/ulp/ipoib/ipoib_cm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,7 @@ static void ipoib_cm_create_srq(struct net_device *dev, int max_sge)
14961496
{
14971497
struct ipoib_dev_priv *priv = netdev_priv(dev);
14981498
struct ib_srq_init_attr srq_init_attr = {
1499+
.srq_type = IB_SRQT_BASIC,
14991500
.attr = {
15001501
.max_wr = ipoib_recvq_size,
15011502
.max_sge = max_sge

include/rdma/ib_verbs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ enum ib_cq_notify_flags {
523523
IB_CQ_REPORT_MISSED_EVENTS = 1 << 2,
524524
};
525525

526+
enum ib_srq_type {
527+
IB_SRQT_BASIC
528+
};
529+
526530
enum ib_srq_attr_mask {
527531
IB_SRQ_MAX_WR = 1 << 0,
528532
IB_SRQ_LIMIT = 1 << 1,
@@ -538,6 +542,7 @@ struct ib_srq_init_attr {
538542
void (*event_handler)(struct ib_event *, void *);
539543
void *srq_context;
540544
struct ib_srq_attr attr;
545+
enum ib_srq_type srq_type;
541546
};
542547

543548
struct ib_qp_cap {
@@ -888,6 +893,7 @@ struct ib_srq {
888893
struct ib_uobject *uobject;
889894
void (*event_handler)(struct ib_event *, void *);
890895
void *srq_context;
896+
enum ib_srq_type srq_type;
891897
atomic_t usecnt;
892898
};
893899

0 commit comments

Comments
 (0)