RDMA/cxgb4: Centralize the wait logic

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
Steve Wise
2010-09-10 11:15:25 -05:00
committed by Roland Dreier
parent 9e8d1fa342
commit aadc4df308
5 changed files with 72 additions and 111 deletions

View File

@@ -64,14 +64,7 @@ static int destroy_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
c4iw_init_wr_wait(&wr_wait);
ret = c4iw_ofld_send(rdev, skb);
if (!ret) {
wait_event_timeout(wr_wait.wait, wr_wait.done, C4IW_WR_TO);
if (!wr_wait.done) {
printk(KERN_ERR MOD "Device %s not responding!\n",
pci_name(rdev->lldi.pdev));
rdev->flags = T4_FATAL_ERROR;
ret = -EIO;
} else
ret = wr_wait.ret;
ret = c4iw_wait_for_reply(rdev, &wr_wait, 0, 0, __func__);
}
kfree(cq->sw_queue);
@@ -157,14 +150,7 @@ static int create_cq(struct c4iw_rdev *rdev, struct t4_cq *cq,
if (ret)
goto err4;
PDBG("%s wait_event wr_wait %p\n", __func__, &wr_wait);
wait_event_timeout(wr_wait.wait, wr_wait.done, C4IW_WR_TO);
if (!wr_wait.done) {
printk(KERN_ERR MOD "Device %s not responding!\n",
pci_name(rdev->lldi.pdev));
rdev->flags = T4_FATAL_ERROR;
ret = -EIO;
} else
ret = wr_wait.ret;
ret = c4iw_wait_for_reply(rdev, &wr_wait, 0, 0, __func__);
if (ret)
goto err4;