aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2010-10-13 10:06:46 -0400
committerDavid S. Miller <davem@davemloft.net>2010-10-14 13:45:53 -0400
commita2c9e769dbb92336ddacba01d399ad0f509e7094 (patch)
tree1afcdf479fac91ebf32ebcf549ce1c235ea83d9f /drivers/net/cnic.c
parent6e0dda0c467d6c66d64c146170ea35399ec34c15 (diff)
cnic: Add cnic_bnx2x_destroy_ramrod()
Refactoring code for the next patch to defer connection clean up. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c39
1 files changed, 25 insertions, 14 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 311b2e6620d6..ee66c48e28bc 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -1708,25 +1708,14 @@ static int cnic_bnx2x_iscsi_update(struct cnic_dev *dev, struct kwqe *kwqe)
1708 return ret; 1708 return ret;
1709} 1709}
1710 1710
1711static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe) 1711static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid)
1712{ 1712{
1713 struct cnic_local *cp = dev->cnic_priv; 1713 struct cnic_local *cp = dev->cnic_priv;
1714 struct iscsi_kwqe_conn_destroy *req =
1715 (struct iscsi_kwqe_conn_destroy *) kwqe;
1716 union l5cm_specific_data l5_data;
1717 u32 l5_cid = req->reserved0;
1718 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid]; 1714 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid];
1719 int ret = 0; 1715 union l5cm_specific_data l5_data;
1720 struct iscsi_kcqe kcqe; 1716 int ret;
1721 struct kcqe *cqes[1];
1722 u32 hw_cid, type; 1717 u32 hw_cid, type;
1723 1718
1724 if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags))
1725 goto skip_cfc_delete;
1726
1727 while (!time_after(jiffies, ctx->timestamp + (2 * HZ)))
1728 msleep(250);
1729
1730 init_waitqueue_head(&ctx->waitq); 1719 init_waitqueue_head(&ctx->waitq);
1731 ctx->wait_cond = 0; 1720 ctx->wait_cond = 0;
1732 memset(&l5_data, 0, sizeof(l5_data)); 1721 memset(&l5_data, 0, sizeof(l5_data));
@@ -1742,6 +1731,28 @@ static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
1742 if (ret == 0) 1731 if (ret == 0)
1743 wait_event(ctx->waitq, ctx->wait_cond); 1732 wait_event(ctx->waitq, ctx->wait_cond);
1744 1733
1734 return ret;
1735}
1736
1737static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
1738{
1739 struct cnic_local *cp = dev->cnic_priv;
1740 struct iscsi_kwqe_conn_destroy *req =
1741 (struct iscsi_kwqe_conn_destroy *) kwqe;
1742 u32 l5_cid = req->reserved0;
1743 struct cnic_context *ctx = &cp->ctx_tbl[l5_cid];
1744 int ret = 0;
1745 struct iscsi_kcqe kcqe;
1746 struct kcqe *cqes[1];
1747
1748 if (!test_bit(CTX_FL_OFFLD_START, &ctx->ctx_flags))
1749 goto skip_cfc_delete;
1750
1751 while (!time_after(jiffies, ctx->timestamp + (2 * HZ)))
1752 msleep(250);
1753
1754 ret = cnic_bnx2x_destroy_ramrod(dev, l5_cid);
1755
1745skip_cfc_delete: 1756skip_cfc_delete:
1746 cnic_free_bnx2x_conn_resc(dev, l5_cid); 1757 cnic_free_bnx2x_conn_resc(dev, l5_cid);
1747 1758