diff options
Diffstat (limited to 'drivers/scsi/bnx2i')
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i.h | 2 | ||||
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_hwi.c | 1 | ||||
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_init.c | 13 | ||||
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_iscsi.c | 14 |
4 files changed, 26 insertions, 4 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i.h b/drivers/scsi/bnx2i/bnx2i.h index 6cf9dc37d78b..6b624e767d3b 100644 --- a/drivers/scsi/bnx2i/bnx2i.h +++ b/drivers/scsi/bnx2i/bnx2i.h | |||
@@ -362,6 +362,7 @@ struct bnx2i_hba { | |||
362 | u32 num_ccell; | 362 | u32 num_ccell; |
363 | 363 | ||
364 | int ofld_conns_active; | 364 | int ofld_conns_active; |
365 | wait_queue_head_t eh_wait; | ||
365 | 366 | ||
366 | int max_active_conns; | 367 | int max_active_conns; |
367 | struct iscsi_cid_queue cid_que; | 368 | struct iscsi_cid_queue cid_que; |
@@ -381,6 +382,7 @@ struct bnx2i_hba { | |||
381 | spinlock_t lock; /* protects hba structure access */ | 382 | spinlock_t lock; /* protects hba structure access */ |
382 | struct mutex net_dev_lock;/* sync net device access */ | 383 | struct mutex net_dev_lock;/* sync net device access */ |
383 | 384 | ||
385 | int hba_shutdown_tmo; | ||
384 | /* | 386 | /* |
385 | * PCI related info. | 387 | * PCI related info. |
386 | */ | 388 | */ |
diff --git a/drivers/scsi/bnx2i/bnx2i_hwi.c b/drivers/scsi/bnx2i/bnx2i_hwi.c index 1af578dec276..18352ff82101 100644 --- a/drivers/scsi/bnx2i/bnx2i_hwi.c +++ b/drivers/scsi/bnx2i/bnx2i_hwi.c | |||
@@ -11,6 +11,7 @@ | |||
11 | * Written by: Anil Veerabhadrappa (anilgv@broadcom.com) | 11 | * Written by: Anil Veerabhadrappa (anilgv@broadcom.com) |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/gfp.h> | ||
14 | #include <scsi/scsi_tcq.h> | 15 | #include <scsi/scsi_tcq.h> |
15 | #include <scsi/libiscsi.h> | 16 | #include <scsi/libiscsi.h> |
16 | #include "bnx2i.h" | 17 | #include "bnx2i.h" |
diff --git a/drivers/scsi/bnx2i/bnx2i_init.c b/drivers/scsi/bnx2i/bnx2i_init.c index 6d8172e781cf..5d9296c599f6 100644 --- a/drivers/scsi/bnx2i/bnx2i_init.c +++ b/drivers/scsi/bnx2i/bnx2i_init.c | |||
@@ -177,11 +177,22 @@ void bnx2i_stop(void *handle) | |||
177 | struct bnx2i_hba *hba = handle; | 177 | struct bnx2i_hba *hba = handle; |
178 | 178 | ||
179 | /* check if cleanup happened in GOING_DOWN context */ | 179 | /* check if cleanup happened in GOING_DOWN context */ |
180 | clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); | ||
181 | if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN, | 180 | if (!test_and_clear_bit(ADAPTER_STATE_GOING_DOWN, |
182 | &hba->adapter_state)) | 181 | &hba->adapter_state)) |
183 | iscsi_host_for_each_session(hba->shost, | 182 | iscsi_host_for_each_session(hba->shost, |
184 | bnx2i_drop_session); | 183 | bnx2i_drop_session); |
184 | |||
185 | /* Wait for all endpoints to be torn down, Chip will be reset once | ||
186 | * control returns to network driver. So it is required to cleanup and | ||
187 | * release all connection resources before returning from this routine. | ||
188 | */ | ||
189 | wait_event_interruptible_timeout(hba->eh_wait, | ||
190 | (hba->ofld_conns_active == 0), | ||
191 | hba->hba_shutdown_tmo); | ||
192 | /* This flag should be cleared last so that ep_disconnect() gracefully | ||
193 | * cleans up connection context | ||
194 | */ | ||
195 | clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); | ||
185 | } | 196 | } |
186 | 197 | ||
187 | /** | 198 | /** |
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index cb71dc984797..fa68ab34b998 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * Written by: Anil Veerabhadrappa (anilgv@broadcom.com) | 12 | * Written by: Anil Veerabhadrappa (anilgv@broadcom.com) |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/slab.h> | ||
15 | #include <scsi/scsi_tcq.h> | 16 | #include <scsi/scsi_tcq.h> |
16 | #include <scsi/libiscsi.h> | 17 | #include <scsi/libiscsi.h> |
17 | #include "bnx2i.h" | 18 | #include "bnx2i.h" |
@@ -819,6 +820,11 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) | |||
819 | 820 | ||
820 | spin_lock_init(&hba->lock); | 821 | spin_lock_init(&hba->lock); |
821 | mutex_init(&hba->net_dev_lock); | 822 | mutex_init(&hba->net_dev_lock); |
823 | init_waitqueue_head(&hba->eh_wait); | ||
824 | if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) | ||
825 | hba->hba_shutdown_tmo = 240 * HZ; | ||
826 | else /* 5706/5708/5709 */ | ||
827 | hba->hba_shutdown_tmo = 30 * HZ; | ||
822 | 828 | ||
823 | if (iscsi_host_add(shost, &hba->pcidev->dev)) | 829 | if (iscsi_host_add(shost, &hba->pcidev->dev)) |
824 | goto free_dump_mem; | 830 | goto free_dump_mem; |
@@ -1657,8 +1663,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, | |||
1657 | */ | 1663 | */ |
1658 | hba = bnx2i_check_route(dst_addr); | 1664 | hba = bnx2i_check_route(dst_addr); |
1659 | 1665 | ||
1660 | if (!hba) { | 1666 | if (!hba || test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state)) { |
1661 | rc = -ENOMEM; | 1667 | rc = -EINVAL; |
1662 | goto check_busy; | 1668 | goto check_busy; |
1663 | } | 1669 | } |
1664 | 1670 | ||
@@ -1803,7 +1809,7 @@ static int bnx2i_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) | |||
1803 | (bnx2i_ep->state == | 1809 | (bnx2i_ep->state == |
1804 | EP_STATE_CONNECT_COMPL)), | 1810 | EP_STATE_CONNECT_COMPL)), |
1805 | msecs_to_jiffies(timeout_ms)); | 1811 | msecs_to_jiffies(timeout_ms)); |
1806 | if (!rc || (bnx2i_ep->state == EP_STATE_OFLD_FAILED)) | 1812 | if (bnx2i_ep->state == EP_STATE_OFLD_FAILED) |
1807 | rc = -1; | 1813 | rc = -1; |
1808 | 1814 | ||
1809 | if (rc > 0) | 1815 | if (rc > 0) |
@@ -1956,6 +1962,8 @@ return_bnx2i_ep: | |||
1956 | 1962 | ||
1957 | if (!hba->ofld_conns_active) | 1963 | if (!hba->ofld_conns_active) |
1958 | bnx2i_unreg_dev_all(); | 1964 | bnx2i_unreg_dev_all(); |
1965 | |||
1966 | wake_up_interruptible(&hba->eh_wait); | ||
1959 | } | 1967 | } |
1960 | 1968 | ||
1961 | 1969 | ||