aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorVipul Pandya <vipul@chelsio.com>2012-05-18 05:59:33 -0400
committerRoland Dreier <roland@purestorage.com>2012-05-18 16:22:37 -0400
commit67bbc05512d8a609e9a2d284dbfda9d2c50f0bf6 (patch)
treeb823f58da10c376c9be2595c97d633cbc3453dd1 /drivers/infiniband/hw
parentec3eead217181d7360a11317a888ceb30807867c (diff)
RDMA/cxgb4: Add query_qp support
This allows querying the QP state before flushing. Signed-off-by: Vipul Pandya <vipul@chelsio.com> Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/cxgb4/iw_cxgb4.h19
-rw-r--r--drivers/infiniband/hw/cxgb4/provider.c2
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c11
3 files changed, 32 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
index 2d5b06b3217b..9beb3a9f0336 100644
--- a/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
+++ b/drivers/infiniband/hw/cxgb4/iw_cxgb4.h
@@ -551,6 +551,23 @@ static inline int c4iw_convert_state(enum ib_qp_state ib_state)
551 } 551 }
552} 552}
553 553
554static inline int to_ib_qp_state(int c4iw_qp_state)
555{
556 switch (c4iw_qp_state) {
557 case C4IW_QP_STATE_IDLE:
558 return IB_QPS_INIT;
559 case C4IW_QP_STATE_RTS:
560 return IB_QPS_RTS;
561 case C4IW_QP_STATE_CLOSING:
562 return IB_QPS_SQD;
563 case C4IW_QP_STATE_TERMINATE:
564 return IB_QPS_SQE;
565 case C4IW_QP_STATE_ERROR:
566 return IB_QPS_ERR;
567 }
568 return IB_QPS_ERR;
569}
570
554static inline u32 c4iw_ib_to_tpt_access(int a) 571static inline u32 c4iw_ib_to_tpt_access(int a)
555{ 572{
556 return (a & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) | 573 return (a & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) |
@@ -846,6 +863,8 @@ struct ib_qp *c4iw_create_qp(struct ib_pd *pd,
846 struct ib_udata *udata); 863 struct ib_udata *udata);
847int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, 864int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
848 int attr_mask, struct ib_udata *udata); 865 int attr_mask, struct ib_udata *udata);
866int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
867 int attr_mask, struct ib_qp_init_attr *init_attr);
849struct ib_qp *c4iw_get_qp(struct ib_device *dev, int qpn); 868struct ib_qp *c4iw_get_qp(struct ib_device *dev, int qpn);
850u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size); 869u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size);
851void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size); 870void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size);
diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c
index fe98a0a55430..e084fdc6da7f 100644
--- a/drivers/infiniband/hw/cxgb4/provider.c
+++ b/drivers/infiniband/hw/cxgb4/provider.c
@@ -443,6 +443,7 @@ int c4iw_register_device(struct c4iw_dev *dev)
443 (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) | 443 (1ull << IB_USER_VERBS_CMD_REQ_NOTIFY_CQ) |
444 (1ull << IB_USER_VERBS_CMD_CREATE_QP) | 444 (1ull << IB_USER_VERBS_CMD_CREATE_QP) |
445 (1ull << IB_USER_VERBS_CMD_MODIFY_QP) | 445 (1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
446 (1ull << IB_USER_VERBS_CMD_QUERY_QP) |
446 (1ull << IB_USER_VERBS_CMD_POLL_CQ) | 447 (1ull << IB_USER_VERBS_CMD_POLL_CQ) |
447 (1ull << IB_USER_VERBS_CMD_DESTROY_QP) | 448 (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
448 (1ull << IB_USER_VERBS_CMD_POST_SEND) | 449 (1ull << IB_USER_VERBS_CMD_POST_SEND) |
@@ -465,6 +466,7 @@ int c4iw_register_device(struct c4iw_dev *dev)
465 dev->ibdev.destroy_ah = c4iw_ah_destroy; 466 dev->ibdev.destroy_ah = c4iw_ah_destroy;
466 dev->ibdev.create_qp = c4iw_create_qp; 467 dev->ibdev.create_qp = c4iw_create_qp;
467 dev->ibdev.modify_qp = c4iw_ib_modify_qp; 468 dev->ibdev.modify_qp = c4iw_ib_modify_qp;
469 dev->ibdev.query_qp = c4iw_ib_query_qp;
468 dev->ibdev.destroy_qp = c4iw_destroy_qp; 470 dev->ibdev.destroy_qp = c4iw_destroy_qp;
469 dev->ibdev.create_cq = c4iw_create_cq; 471 dev->ibdev.create_cq = c4iw_create_cq;
470 dev->ibdev.destroy_cq = c4iw_destroy_cq; 472 dev->ibdev.destroy_cq = c4iw_destroy_cq;
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index ba1343ee1414..45aedf1d9338 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -1711,3 +1711,14 @@ struct ib_qp *c4iw_get_qp(struct ib_device *dev, int qpn)
1711 PDBG("%s ib_dev %p qpn 0x%x\n", __func__, dev, qpn); 1711 PDBG("%s ib_dev %p qpn 0x%x\n", __func__, dev, qpn);
1712 return (struct ib_qp *)get_qhp(to_c4iw_dev(dev), qpn); 1712 return (struct ib_qp *)get_qhp(to_c4iw_dev(dev), qpn);
1713} 1713}
1714
1715int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
1716 int attr_mask, struct ib_qp_init_attr *init_attr)
1717{
1718 struct c4iw_qp *qhp = to_c4iw_qp(ibqp);
1719
1720 memset(attr, 0, sizeof *attr);
1721 memset(init_attr, 0, sizeof *init_attr);
1722 attr->qp_state = to_ib_qp_state(qhp->attr.state);
1723 return 0;
1724}