aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ehca/ehca_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/ehca/ehca_main.c')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_main.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 598844d2edc9..086959a0cbee 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -366,22 +366,23 @@ static int ehca_sense_attributes(struct ehca_shca *shca)
366 shca->hca_cap_mr_pgsize |= pgsize_map[i + 1]; 366 shca->hca_cap_mr_pgsize |= pgsize_map[i + 1];
367 367
368 /* Set maximum number of CQs and QPs to calculate EQ size */ 368 /* Set maximum number of CQs and QPs to calculate EQ size */
369 if (ehca_max_qp == -1) 369 if (shca->max_num_qps == -1)
370 ehca_max_qp = min_t(int, rblock->max_qp, EHCA_MAX_NUM_QUEUES); 370 shca->max_num_qps = min_t(int, rblock->max_qp,
371 else if (ehca_max_qp < 1 || ehca_max_qp > rblock->max_qp) { 371 EHCA_MAX_NUM_QUEUES);
372 ehca_gen_err("Requested number of QPs is out of range (1 - %i) " 372 else if (shca->max_num_qps < 1 || shca->max_num_qps > rblock->max_qp) {
373 "specified by HW", rblock->max_qp); 373 ehca_gen_warn("The requested number of QPs is out of range "
374 ret = -EINVAL; 374 "(1 - %i) specified by HW. Value is set to %i",
375 goto sense_attributes1; 375 rblock->max_qp, rblock->max_qp);
376 shca->max_num_qps = rblock->max_qp;
376 } 377 }
377 378
378 if (ehca_max_cq == -1) 379 if (shca->max_num_cqs == -1)
379 ehca_max_cq = min_t(int, rblock->max_cq, EHCA_MAX_NUM_QUEUES); 380 shca->max_num_cqs = min_t(int, rblock->max_cq,
380 else if (ehca_max_cq < 1 || ehca_max_cq > rblock->max_cq) { 381 EHCA_MAX_NUM_QUEUES);
381 ehca_gen_err("Requested number of CQs is out of range (1 - %i) " 382 else if (shca->max_num_cqs < 1 || shca->max_num_cqs > rblock->max_cq) {
382 "specified by HW", rblock->max_cq); 383 ehca_gen_warn("The requested number of CQs is out of range "
383 ret = -EINVAL; 384 "(1 - %i) specified by HW. Value is set to %i",
384 goto sense_attributes1; 385 rblock->max_cq, rblock->max_cq);
385 } 386 }
386 387
387 /* query max MTU from first port -- it's the same for all ports */ 388 /* query max MTU from first port -- it's the same for all ports */
@@ -733,9 +734,13 @@ static int __devinit ehca_probe(struct of_device *dev,
733 ehca_gen_err("Cannot allocate shca memory."); 734 ehca_gen_err("Cannot allocate shca memory.");
734 return -ENOMEM; 735 return -ENOMEM;
735 } 736 }
737
736 mutex_init(&shca->modify_mutex); 738 mutex_init(&shca->modify_mutex);
737 atomic_set(&shca->num_cqs, 0); 739 atomic_set(&shca->num_cqs, 0);
738 atomic_set(&shca->num_qps, 0); 740 atomic_set(&shca->num_qps, 0);
741 shca->max_num_qps = ehca_max_qp;
742 shca->max_num_cqs = ehca_max_cq;
743
739 for (i = 0; i < ARRAY_SIZE(shca->sport); i++) 744 for (i = 0; i < ARRAY_SIZE(shca->sport); i++)
740 spin_lock_init(&shca->sport[i].mod_sqp_lock); 745 spin_lock_init(&shca->sport[i].mod_sqp_lock);
741 746
@@ -755,7 +760,7 @@ static int __devinit ehca_probe(struct of_device *dev,
755 goto probe1; 760 goto probe1;
756 } 761 }
757 762
758 eq_size = 2 * ehca_max_cq + 4 * ehca_max_qp; 763 eq_size = 2 * shca->max_num_cqs + 4 * shca->max_num_qps;
759 /* create event queues */ 764 /* create event queues */
760 ret = ehca_create_eq(shca, &shca->eq, EHCA_EQ, eq_size); 765 ret = ehca_create_eq(shca, &shca->eq, EHCA_EQ, eq_size);
761 if (ret) { 766 if (ret) {