aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorMatan Barak <matanb@mellanox.com>2015-06-11 09:35:21 -0400
committerDoug Ledford <dledford@redhat.com>2015-06-12 14:49:10 -0400
commit8e37210b38fb7d6aa06aebde763316ee955d44c0 (patch)
tree2ef8854af886906e1901e7c6f0b93a28ae515c6e /drivers/infiniband
parentbcf4c1ea583cd213f0bafdbeb11d80f83c5f10e6 (diff)
IB/core: Change ib_create_cq to use struct ib_cq_init_attr
Currently, ib_create_cq uses cqe and comp_vecotr instead of the extendible ib_cq_init_attr struct. Earlier patches already changed the vendors to work with ib_cq_init_attr. This patch changes the consumers too. Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/mad.c4
-rw-r--r--drivers/infiniband/core/verbs.c6
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c5
-rw-r--r--drivers/infiniband/hw/mlx4/mad.c4
-rw-r--r--drivers/infiniband/hw/mlx4/main.c4
-rw-r--r--drivers/infiniband/hw/mlx5/main.c6
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_verbs.c8
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c5
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.c5
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c9
-rw-r--r--drivers/infiniband/ulp/srpt/ib_srpt.c4
11 files changed, 44 insertions, 16 deletions
diff --git a/drivers/infiniband/core/mad.c b/drivers/infiniband/core/mad.c
index 600af266838c..533c0b2e7a63 100644
--- a/drivers/infiniband/core/mad.c
+++ b/drivers/infiniband/core/mad.c
@@ -2923,6 +2923,7 @@ static int ib_mad_port_open(struct ib_device *device,
2923 unsigned long flags; 2923 unsigned long flags;
2924 char name[sizeof "ib_mad123"]; 2924 char name[sizeof "ib_mad123"];
2925 int has_smi; 2925 int has_smi;
2926 struct ib_cq_init_attr cq_attr = {};
2926 2927
2927 /* Create new device info */ 2928 /* Create new device info */
2928 port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL); 2929 port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
@@ -2943,9 +2944,10 @@ static int ib_mad_port_open(struct ib_device *device,
2943 if (has_smi) 2944 if (has_smi)
2944 cq_size *= 2; 2945 cq_size *= 2;
2945 2946
2947 cq_attr.cqe = cq_size;
2946 port_priv->cq = ib_create_cq(port_priv->device, 2948 port_priv->cq = ib_create_cq(port_priv->device,
2947 ib_mad_thread_completion_handler, 2949 ib_mad_thread_completion_handler,
2948 NULL, port_priv, cq_size, 0); 2950 NULL, port_priv, &cq_attr);
2949 if (IS_ERR(port_priv->cq)) { 2951 if (IS_ERR(port_priv->cq)) {
2950 dev_err(&device->dev, "Couldn't create ib_mad CQ\n"); 2952 dev_err(&device->dev, "Couldn't create ib_mad CQ\n");
2951 ret = PTR_ERR(port_priv->cq); 2953 ret = PTR_ERR(port_priv->cq);
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 7bffdbe6afe9..bac3fb406a74 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1076,12 +1076,12 @@ EXPORT_SYMBOL(ib_destroy_qp);
1076struct ib_cq *ib_create_cq(struct ib_device *device, 1076struct ib_cq *ib_create_cq(struct ib_device *device,
1077 ib_comp_handler comp_handler, 1077 ib_comp_handler comp_handler,
1078 void (*event_handler)(struct ib_event *, void *), 1078 void (*event_handler)(struct ib_event *, void *),
1079 void *cq_context, int cqe, int comp_vector) 1079 void *cq_context,
1080 const struct ib_cq_init_attr *cq_attr)
1080{ 1081{
1081 struct ib_cq *cq; 1082 struct ib_cq *cq;
1082 struct ib_cq_init_attr attr = {.cqe = cqe, .comp_vector = comp_vector};
1083 1083
1084 cq = device->create_cq(device, &attr, NULL, NULL); 1084 cq = device->create_cq(device, cq_attr, NULL, NULL);
1085 1085
1086 if (!IS_ERR(cq)) { 1086 if (!IS_ERR(cq)) {
1087 cq->device = device; 1087 cq->device = device;
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 5e30b72d3677..c0e45a46504b 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -552,6 +552,7 @@ static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
552 struct ib_cq *ibcq; 552 struct ib_cq *ibcq;
553 struct ib_qp *ibqp; 553 struct ib_qp *ibqp;
554 struct ib_qp_init_attr qp_init_attr; 554 struct ib_qp_init_attr qp_init_attr;
555 struct ib_cq_init_attr cq_attr = {};
555 int ret; 556 int ret;
556 557
557 if (sport->ibcq_aqp1) { 558 if (sport->ibcq_aqp1) {
@@ -559,7 +560,9 @@ static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
559 return -EPERM; 560 return -EPERM;
560 } 561 }
561 562
562 ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void *)(-1), 10, 0); 563 cq_attr.cqe = 10;
564 ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void *)(-1),
565 &cq_attr);
563 if (IS_ERR(ibcq)) { 566 if (IS_ERR(ibcq)) {
564 ehca_err(&shca->ib_device, "Cannot create AQP1 CQ."); 567 ehca_err(&shca->ib_device, "Cannot create AQP1 CQ.");
565 return PTR_ERR(ibcq); 568 return PTR_ERR(ibcq);
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 614ac6f07ae1..a790be5a7423 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -1774,6 +1774,7 @@ static int create_pv_resources(struct ib_device *ibdev, int slave, int port,
1774 int create_tun, struct mlx4_ib_demux_pv_ctx *ctx) 1774 int create_tun, struct mlx4_ib_demux_pv_ctx *ctx)
1775{ 1775{
1776 int ret, cq_size; 1776 int ret, cq_size;
1777 struct ib_cq_init_attr cq_attr = {};
1777 1778
1778 if (ctx->state != DEMUX_PV_STATE_DOWN) 1779 if (ctx->state != DEMUX_PV_STATE_DOWN)
1779 return -EEXIST; 1780 return -EEXIST;
@@ -1802,8 +1803,9 @@ static int create_pv_resources(struct ib_device *ibdev, int slave, int port,
1802 if (ctx->has_smi) 1803 if (ctx->has_smi)
1803 cq_size *= 2; 1804 cq_size *= 2;
1804 1805
1806 cq_attr.cqe = cq_size;
1805 ctx->cq = ib_create_cq(ctx->ib_dev, mlx4_ib_tunnel_comp_handler, 1807 ctx->cq = ib_create_cq(ctx->ib_dev, mlx4_ib_tunnel_comp_handler,
1806 NULL, ctx, cq_size, 0); 1808 NULL, ctx, &cq_attr);
1807 if (IS_ERR(ctx->cq)) { 1809 if (IS_ERR(ctx->cq)) {
1808 ret = PTR_ERR(ctx->cq); 1810 ret = PTR_ERR(ctx->cq);
1809 pr_err("Couldn't create tunnel CQ (%d)\n", ret); 1811 pr_err("Couldn't create tunnel CQ (%d)\n", ret);
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 86c0c27120f7..af2071ed1437 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -758,6 +758,7 @@ static struct ib_xrcd *mlx4_ib_alloc_xrcd(struct ib_device *ibdev,
758 struct ib_udata *udata) 758 struct ib_udata *udata)
759{ 759{
760 struct mlx4_ib_xrcd *xrcd; 760 struct mlx4_ib_xrcd *xrcd;
761 struct ib_cq_init_attr cq_attr = {};
761 int err; 762 int err;
762 763
763 if (!(to_mdev(ibdev)->dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC)) 764 if (!(to_mdev(ibdev)->dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC))
@@ -777,7 +778,8 @@ static struct ib_xrcd *mlx4_ib_alloc_xrcd(struct ib_device *ibdev,
777 goto err2; 778 goto err2;
778 } 779 }
779 780
780 xrcd->cq = ib_create_cq(ibdev, NULL, NULL, xrcd, 1, 0); 781 cq_attr.cqe = 1;
782 xrcd->cq = ib_create_cq(ibdev, NULL, NULL, xrcd, &cq_attr);
781 if (IS_ERR(xrcd->cq)) { 783 if (IS_ERR(xrcd->cq)) {
782 err = PTR_ERR(xrcd->cq); 784 err = PTR_ERR(xrcd->cq);
783 goto err3; 785 goto err3;
diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 9565c203a497..06b023855a33 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -971,6 +971,7 @@ static int create_umr_res(struct mlx5_ib_dev *dev)
971 struct ib_cq *cq; 971 struct ib_cq *cq;
972 struct ib_qp *qp; 972 struct ib_qp *qp;
973 struct ib_mr *mr; 973 struct ib_mr *mr;
974 struct ib_cq_init_attr cq_attr = {};
974 int ret; 975 int ret;
975 976
976 attr = kzalloc(sizeof(*attr), GFP_KERNEL); 977 attr = kzalloc(sizeof(*attr), GFP_KERNEL);
@@ -994,8 +995,9 @@ static int create_umr_res(struct mlx5_ib_dev *dev)
994 goto error_1; 995 goto error_1;
995 } 996 }
996 997
997 cq = ib_create_cq(&dev->ib_dev, mlx5_umr_cq_handler, NULL, NULL, 128, 998 cq_attr.cqe = 128;
998 0); 999 cq = ib_create_cq(&dev->ib_dev, mlx5_umr_cq_handler, NULL, NULL,
1000 &cq_attr);
999 if (IS_ERR(cq)) { 1001 if (IS_ERR(cq)) {
1000 mlx5_ib_dbg(dev, "Couldn't create CQ for sync UMR QP\n"); 1002 mlx5_ib_dbg(dev, "Couldn't create CQ for sync UMR QP\n");
1001 ret = PTR_ERR(cq); 1003 ret = PTR_ERR(cq);
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
index e5cc43074196..9e6ee82a8fd7 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_verbs.c
@@ -141,6 +141,7 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
141 .sq_sig_type = IB_SIGNAL_ALL_WR, 141 .sq_sig_type = IB_SIGNAL_ALL_WR,
142 .qp_type = IB_QPT_UD 142 .qp_type = IB_QPT_UD
143 }; 143 };
144 struct ib_cq_init_attr cq_attr = {};
144 145
145 int ret, size; 146 int ret, size;
146 int i; 147 int i;
@@ -178,14 +179,17 @@ int ipoib_transport_dev_init(struct net_device *dev, struct ib_device *ca)
178 } else 179 } else
179 goto out_free_wq; 180 goto out_free_wq;
180 181
181 priv->recv_cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL, dev, size, 0); 182 cq_attr.cqe = size;
183 priv->recv_cq = ib_create_cq(priv->ca, ipoib_ib_completion, NULL,
184 dev, &cq_attr);
182 if (IS_ERR(priv->recv_cq)) { 185 if (IS_ERR(priv->recv_cq)) {
183 printk(KERN_WARNING "%s: failed to create receive CQ\n", ca->name); 186 printk(KERN_WARNING "%s: failed to create receive CQ\n", ca->name);
184 goto out_cm_dev_cleanup; 187 goto out_cm_dev_cleanup;
185 } 188 }
186 189
190 cq_attr.cqe = ipoib_sendq_size;
187 priv->send_cq = ib_create_cq(priv->ca, ipoib_send_comp_handler, NULL, 191 priv->send_cq = ib_create_cq(priv->ca, ipoib_send_comp_handler, NULL,
188 dev, ipoib_sendq_size, 0); 192 dev, &cq_attr);
189 if (IS_ERR(priv->send_cq)) { 193 if (IS_ERR(priv->send_cq)) {
190 printk(KERN_WARNING "%s: failed to create send CQ\n", ca->name); 194 printk(KERN_WARNING "%s: failed to create send CQ\n", ca->name);
191 goto out_free_recv_cq; 195 goto out_free_recv_cq;
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index d33c5c000f9c..5c9f565ea0e8 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -126,14 +126,17 @@ static int iser_create_device_ib_res(struct iser_device *device)
126 goto pd_err; 126 goto pd_err;
127 127
128 for (i = 0; i < device->comps_used; i++) { 128 for (i = 0; i < device->comps_used; i++) {
129 struct ib_cq_init_attr cq_attr = {};
129 struct iser_comp *comp = &device->comps[i]; 130 struct iser_comp *comp = &device->comps[i];
130 131
131 comp->device = device; 132 comp->device = device;
133 cq_attr.cqe = max_cqe;
134 cq_attr.comp_vector = i;
132 comp->cq = ib_create_cq(device->ib_device, 135 comp->cq = ib_create_cq(device->ib_device,
133 iser_cq_callback, 136 iser_cq_callback,
134 iser_cq_event_callback, 137 iser_cq_event_callback,
135 (void *)comp, 138 (void *)comp,
136 max_cqe, i); 139 &cq_attr);
137 if (IS_ERR(comp->cq)) { 140 if (IS_ERR(comp->cq)) {
138 comp->cq = NULL; 141 comp->cq = NULL;
139 goto cq_err; 142 goto cq_err;
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index d99a0c8f14a4..9e7b4927265c 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -318,15 +318,18 @@ isert_alloc_comps(struct isert_device *device,
318 max_cqe = min(ISER_MAX_CQ_LEN, attr->max_cqe); 318 max_cqe = min(ISER_MAX_CQ_LEN, attr->max_cqe);
319 319
320 for (i = 0; i < device->comps_used; i++) { 320 for (i = 0; i < device->comps_used; i++) {
321 struct ib_cq_init_attr cq_attr = {};
321 struct isert_comp *comp = &device->comps[i]; 322 struct isert_comp *comp = &device->comps[i];
322 323
323 comp->device = device; 324 comp->device = device;
324 INIT_WORK(&comp->work, isert_cq_work); 325 INIT_WORK(&comp->work, isert_cq_work);
326 cq_attr.cqe = max_cqe;
327 cq_attr.comp_vector = i;
325 comp->cq = ib_create_cq(device->ib_device, 328 comp->cq = ib_create_cq(device->ib_device,
326 isert_cq_callback, 329 isert_cq_callback,
327 isert_cq_event_callback, 330 isert_cq_event_callback,
328 (void *)comp, 331 (void *)comp,
329 max_cqe, i); 332 &cq_attr);
330 if (IS_ERR(comp->cq)) { 333 if (IS_ERR(comp->cq)) {
331 isert_err("Unable to allocate cq\n"); 334 isert_err("Unable to allocate cq\n");
332 ret = PTR_ERR(comp->cq); 335 ret = PTR_ERR(comp->cq);
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index c3f654d20038..eada8f758ad4 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -500,6 +500,7 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch)
500 struct ib_fmr_pool *fmr_pool = NULL; 500 struct ib_fmr_pool *fmr_pool = NULL;
501 struct srp_fr_pool *fr_pool = NULL; 501 struct srp_fr_pool *fr_pool = NULL;
502 const int m = 1 + dev->use_fast_reg; 502 const int m = 1 + dev->use_fast_reg;
503 struct ib_cq_init_attr cq_attr = {};
503 int ret; 504 int ret;
504 505
505 init_attr = kzalloc(sizeof *init_attr, GFP_KERNEL); 506 init_attr = kzalloc(sizeof *init_attr, GFP_KERNEL);
@@ -507,15 +508,19 @@ static int srp_create_ch_ib(struct srp_rdma_ch *ch)
507 return -ENOMEM; 508 return -ENOMEM;
508 509
509 /* + 1 for SRP_LAST_WR_ID */ 510 /* + 1 for SRP_LAST_WR_ID */
511 cq_attr.cqe = target->queue_size + 1;
512 cq_attr.comp_vector = ch->comp_vector;
510 recv_cq = ib_create_cq(dev->dev, srp_recv_completion, NULL, ch, 513 recv_cq = ib_create_cq(dev->dev, srp_recv_completion, NULL, ch,
511 target->queue_size + 1, ch->comp_vector); 514 &cq_attr);
512 if (IS_ERR(recv_cq)) { 515 if (IS_ERR(recv_cq)) {
513 ret = PTR_ERR(recv_cq); 516 ret = PTR_ERR(recv_cq);
514 goto err; 517 goto err;
515 } 518 }
516 519
520 cq_attr.cqe = m * target->queue_size;
521 cq_attr.comp_vector = ch->comp_vector;
517 send_cq = ib_create_cq(dev->dev, srp_send_completion, NULL, ch, 522 send_cq = ib_create_cq(dev->dev, srp_send_completion, NULL, ch,
518 m * target->queue_size, ch->comp_vector); 523 &cq_attr);
519 if (IS_ERR(send_cq)) { 524 if (IS_ERR(send_cq)) {
520 ret = PTR_ERR(send_cq); 525 ret = PTR_ERR(send_cq);
521 goto err_recv_cq; 526 goto err_recv_cq;
diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp/srpt/ib_srpt.c
index 9b84b4c0a000..783efe1a3a28 100644
--- a/drivers/infiniband/ulp/srpt/ib_srpt.c
+++ b/drivers/infiniband/ulp/srpt/ib_srpt.c
@@ -2080,6 +2080,7 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
2080 struct srpt_port *sport = ch->sport; 2080 struct srpt_port *sport = ch->sport;
2081 struct srpt_device *sdev = sport->sdev; 2081 struct srpt_device *sdev = sport->sdev;
2082 u32 srp_sq_size = sport->port_attrib.srp_sq_size; 2082 u32 srp_sq_size = sport->port_attrib.srp_sq_size;
2083 struct ib_cq_init_attr cq_attr = {};
2083 int ret; 2084 int ret;
2084 2085
2085 WARN_ON(ch->rq_size < 1); 2086 WARN_ON(ch->rq_size < 1);
@@ -2090,8 +2091,9 @@ static int srpt_create_ch_ib(struct srpt_rdma_ch *ch)
2090 goto out; 2091 goto out;
2091 2092
2092retry: 2093retry:
2094 cq_attr.cqe = ch->rq_size + srp_sq_size;
2093 ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch, 2095 ch->cq = ib_create_cq(sdev->device, srpt_completion, NULL, ch,
2094 ch->rq_size + srp_sq_size, 0); 2096 &cq_attr);
2095 if (IS_ERR(ch->cq)) { 2097 if (IS_ERR(ch->cq)) {
2096 ret = PTR_ERR(ch->cq); 2098 ret = PTR_ERR(ch->cq);
2097 pr_err("failed to create CQ cqe= %d ret= %d\n", 2099 pr_err("failed to create CQ cqe= %d ret= %d\n",