diff options
author | Dotan Barak <dotanb@dev.mellanox.co.il> | 2008-04-17 00:09:34 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:09:34 -0400 |
commit | 0df67030958bad07c3f82f392e3ffb785c56e48d (patch) | |
tree | 317bdffc336a40e344f50b05492de6350eb38f7a /drivers/infiniband/hw/mlx4/qp.c | |
parent | 5121df3ae45731ce98374a1b0b4d48f072643f42 (diff) |
IB/mlx4: Update QP state if query QP succeeds
If the QP was moved to another state (such as SQE) by the hardware,
then after this change the user won't have to set the IBV_QP_CUR_STATE
mask in order to execute modify QP in order to recover from this state.
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/mlx4/qp.c')
-rw-r--r-- | drivers/infiniband/hw/mlx4/qp.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c index 38e651a67589..b75efae7e449 100644 --- a/drivers/infiniband/hw/mlx4/qp.c +++ b/drivers/infiniband/hw/mlx4/qp.c | |||
@@ -1785,7 +1785,9 @@ int mlx4_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr | |||
1785 | struct mlx4_ib_qp *qp = to_mqp(ibqp); | 1785 | struct mlx4_ib_qp *qp = to_mqp(ibqp); |
1786 | struct mlx4_qp_context context; | 1786 | struct mlx4_qp_context context; |
1787 | int mlx4_state; | 1787 | int mlx4_state; |
1788 | int err; | 1788 | int err = 0; |
1789 | |||
1790 | mutex_lock(&qp->mutex); | ||
1789 | 1791 | ||
1790 | if (qp->state == IB_QPS_RESET) { | 1792 | if (qp->state == IB_QPS_RESET) { |
1791 | qp_attr->qp_state = IB_QPS_RESET; | 1793 | qp_attr->qp_state = IB_QPS_RESET; |
@@ -1793,12 +1795,15 @@ int mlx4_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr | |||
1793 | } | 1795 | } |
1794 | 1796 | ||
1795 | err = mlx4_qp_query(dev->dev, &qp->mqp, &context); | 1797 | err = mlx4_qp_query(dev->dev, &qp->mqp, &context); |
1796 | if (err) | 1798 | if (err) { |
1797 | return -EINVAL; | 1799 | err = -EINVAL; |
1800 | goto out; | ||
1801 | } | ||
1798 | 1802 | ||
1799 | mlx4_state = be32_to_cpu(context.flags) >> 28; | 1803 | mlx4_state = be32_to_cpu(context.flags) >> 28; |
1800 | 1804 | ||
1801 | qp_attr->qp_state = to_ib_qp_state(mlx4_state); | 1805 | qp->state = to_ib_qp_state(mlx4_state); |
1806 | qp_attr->qp_state = qp->state; | ||
1802 | qp_attr->path_mtu = context.mtu_msgmax >> 5; | 1807 | qp_attr->path_mtu = context.mtu_msgmax >> 5; |
1803 | qp_attr->path_mig_state = | 1808 | qp_attr->path_mig_state = |
1804 | to_ib_mig_state((be32_to_cpu(context.flags) >> 11) & 0x3); | 1809 | to_ib_mig_state((be32_to_cpu(context.flags) >> 11) & 0x3); |
@@ -1857,6 +1862,8 @@ done: | |||
1857 | 1862 | ||
1858 | qp_init_attr->cap = qp_attr->cap; | 1863 | qp_init_attr->cap = qp_attr->cap; |
1859 | 1864 | ||
1860 | return 0; | 1865 | out: |
1866 | mutex_unlock(&qp->mutex); | ||
1867 | return err; | ||
1861 | } | 1868 | } |
1862 | 1869 | ||