aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ipath/ipath_qp.c
diff options
context:
space:
mode:
authorBryan O'Sullivan <bos@pathscale.com>2006-08-25 14:24:41 -0400
committerRoland Dreier <rolandd@cisco.com>2006-09-22 18:22:36 -0400
commitfc8cf8cdfc3ce328c577b18ebcd60a5595f2a283 (patch)
tree55f4240fd9eca1b3d3545881e9cce9c575ddbb7c /drivers/infiniband/hw/ipath/ipath_qp.c
parentff0b8597ec3e7db6b37130a195cb3d673dafea27 (diff)
IB/ipath: be more strict about testing the modify QP verb
Signed-off-by: Bryan O'Sullivan <bryan.osullivan@qlogic.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_qp.c')
-rw-r--r--drivers/infiniband/hw/ipath/ipath_qp.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c
index c0267cf8ca8c..502d555fdf37 100644
--- a/drivers/infiniband/hw/ipath/ipath_qp.c
+++ b/drivers/infiniband/hw/ipath/ipath_qp.c
@@ -455,11 +455,16 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
455 attr_mask)) 455 attr_mask))
456 goto inval; 456 goto inval;
457 457
458 if (attr_mask & IB_QP_AV) 458 if (attr_mask & IB_QP_AV) {
459 if (attr->ah_attr.dlid == 0 || 459 if (attr->ah_attr.dlid == 0 ||
460 attr->ah_attr.dlid >= IPATH_MULTICAST_LID_BASE) 460 attr->ah_attr.dlid >= IPATH_MULTICAST_LID_BASE)
461 goto inval; 461 goto inval;
462 462
463 if ((attr->ah_attr.ah_flags & IB_AH_GRH) &&
464 (attr->ah_attr.grh.sgid_index > 1))
465 goto inval;
466 }
467
463 if (attr_mask & IB_QP_PKEY_INDEX) 468 if (attr_mask & IB_QP_PKEY_INDEX)
464 if (attr->pkey_index >= ipath_get_npkeys(dev->dd)) 469 if (attr->pkey_index >= ipath_get_npkeys(dev->dd))
465 goto inval; 470 goto inval;
@@ -468,6 +473,27 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
468 if (attr->min_rnr_timer > 31) 473 if (attr->min_rnr_timer > 31)
469 goto inval; 474 goto inval;
470 475
476 if (attr_mask & IB_QP_PORT)
477 if (attr->port_num == 0 ||
478 attr->port_num > ibqp->device->phys_port_cnt)
479 goto inval;
480
481 if (attr_mask & IB_QP_PATH_MTU)
482 if (attr->path_mtu > IB_MTU_4096)
483 goto inval;
484
485 if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC)
486 if (attr->max_dest_rd_atomic > 1)
487 goto inval;
488
489 if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC)
490 if (attr->max_rd_atomic > 1)
491 goto inval;
492
493 if (attr_mask & IB_QP_PATH_MIG_STATE)
494 if (attr->path_mig_state != IB_MIG_MIGRATED)
495 goto inval;
496
471 switch (new_state) { 497 switch (new_state) {
472 case IB_QPS_RESET: 498 case IB_QPS_RESET:
473 ipath_reset_qp(qp); 499 ipath_reset_qp(qp);
@@ -518,6 +544,9 @@ int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
518 if (attr_mask & IB_QP_MIN_RNR_TIMER) 544 if (attr_mask & IB_QP_MIN_RNR_TIMER)
519 qp->r_min_rnr_timer = attr->min_rnr_timer; 545 qp->r_min_rnr_timer = attr->min_rnr_timer;
520 546
547 if (attr_mask & IB_QP_TIMEOUT)
548 qp->timeout = attr->timeout;
549
521 if (attr_mask & IB_QP_QKEY) 550 if (attr_mask & IB_QP_QKEY)
522 qp->qkey = attr->qkey; 551 qp->qkey = attr->qkey;
523 552
@@ -564,7 +593,7 @@ int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
564 attr->max_dest_rd_atomic = 1; 593 attr->max_dest_rd_atomic = 1;
565 attr->min_rnr_timer = qp->r_min_rnr_timer; 594 attr->min_rnr_timer = qp->r_min_rnr_timer;
566 attr->port_num = 1; 595 attr->port_num = 1;
567 attr->timeout = 0; 596 attr->timeout = qp->timeout;
568 attr->retry_cnt = qp->s_retry_cnt; 597 attr->retry_cnt = qp->s_retry_cnt;
569 attr->rnr_retry = qp->s_rnr_retry; 598 attr->rnr_retry = qp->s_rnr_retry;
570 attr->alt_port_num = 0; 599 attr->alt_port_num = 0;