Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 190124
b: refs/heads/master
c: 490475a
h: refs/heads/master
v: v3
  • Loading branch information
Anil Veerabhadrappa authored and James Bottomley committed Apr 11, 2010
1 parent 8d00e2f commit 455ff93
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a71fa1fc43a29133f13ae6ada1a389ca298c0934
refs/heads/master: 490475a9938f3480e1ab3a67063e547cea41c295
2 changes: 2 additions & 0 deletions trunk/drivers/scsi/bnx2i/bnx2i.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ struct bnx2i_hba {
u32 num_ccell;

int ofld_conns_active;
wait_queue_head_t eh_wait;

int max_active_conns;
struct iscsi_cid_queue cid_que;
Expand All @@ -381,6 +382,7 @@ struct bnx2i_hba {
spinlock_t lock; /* protects hba structure access */
struct mutex net_dev_lock;/* sync net device access */

int hba_shutdown_tmo;
/*
* PCI related info.
*/
Expand Down
13 changes: 12 additions & 1 deletion trunk/drivers/scsi/bnx2i/bnx2i_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,22 @@ void bnx2i_stop(void *handle)
struct bnx2i_hba *hba = handle;

/* check if cleanup happened in GOING_DOWN context */
clear_bit(ADAPTER_STATE_UP, &hba->adapter_state);
if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN,
&hba->adapter_state))
iscsi_host_for_each_session(hba->shost,
bnx2i_drop_session);

/* Wait for all endpoints to be torn down, Chip will be reset once
* control returns to network driver. So it is required to cleanup and
* release all connection resources before returning from this routine.
*/
wait_event_interruptible_timeout(hba->eh_wait,
(hba->ofld_conns_active == 0),
hba->hba_shutdown_tmo);
/* This flag should be cleared last so that ep_disconnect() gracefully
* cleans up connection context
*/
clear_bit(ADAPTER_STATE_UP, &hba->adapter_state);
}

/**
Expand Down
13 changes: 10 additions & 3 deletions trunk/drivers/scsi/bnx2i/bnx2i_iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,11 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic)

spin_lock_init(&hba->lock);
mutex_init(&hba->net_dev_lock);
init_waitqueue_head(&hba->eh_wait);
if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type))
hba->hba_shutdown_tmo = 240 * HZ;
else /* 5706/5708/5709 */
hba->hba_shutdown_tmo = 30 * HZ;

if (iscsi_host_add(shost, &hba->pcidev->dev))
goto free_dump_mem;
Expand Down Expand Up @@ -1658,8 +1663,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost,
*/
hba = bnx2i_check_route(dst_addr);

if (!hba) {
rc = -ENOMEM;
if (!hba || test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state)) {
rc = -EINVAL;
goto check_busy;
}

Expand Down Expand Up @@ -1804,7 +1809,7 @@ static int bnx2i_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
(bnx2i_ep->state ==
EP_STATE_CONNECT_COMPL)),
msecs_to_jiffies(timeout_ms));
if (!rc || (bnx2i_ep->state == EP_STATE_OFLD_FAILED))
if (bnx2i_ep->state == EP_STATE_OFLD_FAILED)
rc = -1;

if (rc > 0)
Expand Down Expand Up @@ -1957,6 +1962,8 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep)

if (!hba->ofld_conns_active)
bnx2i_unreg_dev_all();

wake_up_interruptible(&hba->eh_wait);
}


Expand Down

0 comments on commit 455ff93

Please sign in to comment.