aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mlx4/qp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mlx4/qp.c')
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c17
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; 1865out:
1866 mutex_unlock(&qp->mutex);
1867 return err;
1861} 1868}
1862 1869