diff options
author | Chien Tung <chien.tin.tung@intel.com> | 2009-12-09 18:21:56 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2009-12-09 18:21:56 -0500 |
commit | 5924aea6e26712cd372aa23ed432d4cefbb050d2 (patch) | |
tree | 8ce43324eefa06bb4db6ee414f2ea221cc2c0097 /drivers/infiniband | |
parent | 75742c630ed552ad963948c9f3e596e96eed7a9f (diff) |
RDMA/nes: Add max_cqe check to nes_create_cq()
Add a check to nes_create_cq() to return -EINVAL if creating a CQ with
depth > max_cqe (32766).
Signed-off-by: Chien Tung <chien.tin.tung@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/nes/nes_hw.c | 2 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c index b59ca5659423..6f625a962b30 100644 --- a/drivers/infiniband/hw/nes/nes_hw.c +++ b/drivers/infiniband/hw/nes/nes_hw.c | |||
@@ -482,7 +482,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) { | |||
482 | nesadapter->max_irrq_wr = (u32temp >> 16) & 3; | 482 | nesadapter->max_irrq_wr = (u32temp >> 16) & 3; |
483 | 483 | ||
484 | nesadapter->max_sge = 4; | 484 | nesadapter->max_sge = 4; |
485 | nesadapter->max_cqe = 32767; | 485 | nesadapter->max_cqe = 32766; |
486 | 486 | ||
487 | if (nes_read_eeprom_values(nesdev, nesadapter)) { | 487 | if (nes_read_eeprom_values(nesdev, nesadapter)) { |
488 | printk(KERN_ERR PFX "Unable to read EEPROM data.\n"); | 488 | printk(KERN_ERR PFX "Unable to read EEPROM data.\n"); |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index ea4e22ea2d49..155286b6e74e 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -527,7 +527,7 @@ static int nes_query_device(struct ib_device *ibdev, struct ib_device_attr *prop | |||
527 | props->max_qp_wr = nesdev->nesadapter->max_qp_wr - 2; | 527 | props->max_qp_wr = nesdev->nesadapter->max_qp_wr - 2; |
528 | props->max_sge = nesdev->nesadapter->max_sge; | 528 | props->max_sge = nesdev->nesadapter->max_sge; |
529 | props->max_cq = nesibdev->max_cq; | 529 | props->max_cq = nesibdev->max_cq; |
530 | props->max_cqe = nesdev->nesadapter->max_cqe - 1; | 530 | props->max_cqe = nesdev->nesadapter->max_cqe; |
531 | props->max_mr = nesibdev->max_mr; | 531 | props->max_mr = nesibdev->max_mr; |
532 | props->max_mw = nesibdev->max_mr; | 532 | props->max_mw = nesibdev->max_mr; |
533 | props->max_pd = nesibdev->max_pd; | 533 | props->max_pd = nesibdev->max_pd; |
@@ -1543,6 +1543,9 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries, | |||
1543 | unsigned long flags; | 1543 | unsigned long flags; |
1544 | int ret; | 1544 | int ret; |
1545 | 1545 | ||
1546 | if (entries > nesadapter->max_cqe) | ||
1547 | return ERR_PTR(-EINVAL); | ||
1548 | |||
1546 | err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs, | 1549 | err = nes_alloc_resource(nesadapter, nesadapter->allocated_cqs, |
1547 | nesadapter->max_cq, &cq_num, &nesadapter->next_cq); | 1550 | nesadapter->max_cq, &cq_num, &nesadapter->next_cq); |
1548 | if (err) { | 1551 | if (err) { |