diff options
| author | Steve Wise <swise@opengridcomputing.com> | 2016-04-12 09:55:03 -0400 |
|---|---|---|
| committer | Doug Ledford <dledford@redhat.com> | 2016-04-26 12:46:54 -0400 |
| commit | 40edd7fdfc8a2c838c313b982f318cd69e638750 (patch) | |
| tree | 63b76f49c560c213da6a8f7a3e4d858a64781bc1 /drivers | |
| parent | ad202348fe3fa8187c43af5ab5b86fe6de057bd3 (diff) | |
iw_cxgb4: handle draining an idle qp
In c4iw_drain_sq/rq(), if the particular queue is already empty
then don't block.
Fixes: ce4af14d94aa ('iw_cxgb4: add queue drain functions')
Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/infiniband/hw/cxgb4/qp.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c index e17fb5d5e033..8aa2e52b453e 100644 --- a/drivers/infiniband/hw/cxgb4/qp.c +++ b/drivers/infiniband/hw/cxgb4/qp.c | |||
| @@ -1895,13 +1895,27 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
| 1895 | void c4iw_drain_sq(struct ib_qp *ibqp) | 1895 | void c4iw_drain_sq(struct ib_qp *ibqp) |
| 1896 | { | 1896 | { |
| 1897 | struct c4iw_qp *qp = to_c4iw_qp(ibqp); | 1897 | struct c4iw_qp *qp = to_c4iw_qp(ibqp); |
| 1898 | unsigned long flag; | ||
| 1899 | bool need_to_wait; | ||
| 1900 | |||
| 1901 | spin_lock_irqsave(&qp->lock, flag); | ||
| 1902 | need_to_wait = !t4_sq_empty(&qp->wq); | ||
| 1903 | spin_unlock_irqrestore(&qp->lock, flag); | ||
| 1898 | 1904 | ||
| 1899 | wait_for_completion(&qp->sq_drained); | 1905 | if (need_to_wait) |
| 1906 | wait_for_completion(&qp->sq_drained); | ||
| 1900 | } | 1907 | } |
| 1901 | 1908 | ||
| 1902 | void c4iw_drain_rq(struct ib_qp *ibqp) | 1909 | void c4iw_drain_rq(struct ib_qp *ibqp) |
| 1903 | { | 1910 | { |
| 1904 | struct c4iw_qp *qp = to_c4iw_qp(ibqp); | 1911 | struct c4iw_qp *qp = to_c4iw_qp(ibqp); |
| 1912 | unsigned long flag; | ||
| 1913 | bool need_to_wait; | ||
| 1914 | |||
| 1915 | spin_lock_irqsave(&qp->lock, flag); | ||
| 1916 | need_to_wait = !t4_rq_empty(&qp->wq); | ||
| 1917 | spin_unlock_irqrestore(&qp->lock, flag); | ||
| 1905 | 1918 | ||
| 1906 | wait_for_completion(&qp->rq_drained); | 1919 | if (need_to_wait) |
| 1920 | wait_for_completion(&qp->rq_drained); | ||
| 1907 | } | 1921 | } |
