diff options
Diffstat (limited to 'drivers/scsi/bnx2i/bnx2i_iscsi.c')
-rw-r--r-- | drivers/scsi/bnx2i/bnx2i_iscsi.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_iscsi.c index cafb888c2376..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" |
@@ -485,7 +486,6 @@ static int bnx2i_setup_cmd_pool(struct bnx2i_hba *hba, | |||
485 | struct iscsi_task *task = session->cmds[i]; | 486 | struct iscsi_task *task = session->cmds[i]; |
486 | struct bnx2i_cmd *cmd = task->dd_data; | 487 | struct bnx2i_cmd *cmd = task->dd_data; |
487 | 488 | ||
488 | /* Anil */ | ||
489 | task->hdr = &cmd->hdr; | 489 | task->hdr = &cmd->hdr; |
490 | task->hdr_max = sizeof(struct iscsi_hdr); | 490 | task->hdr_max = sizeof(struct iscsi_hdr); |
491 | 491 | ||
@@ -765,7 +765,6 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) | |||
765 | hba->pci_svid = hba->pcidev->subsystem_vendor; | 765 | hba->pci_svid = hba->pcidev->subsystem_vendor; |
766 | hba->pci_func = PCI_FUNC(hba->pcidev->devfn); | 766 | hba->pci_func = PCI_FUNC(hba->pcidev->devfn); |
767 | hba->pci_devno = PCI_SLOT(hba->pcidev->devfn); | 767 | hba->pci_devno = PCI_SLOT(hba->pcidev->devfn); |
768 | bnx2i_identify_device(hba); | ||
769 | 768 | ||
770 | bnx2i_identify_device(hba); | 769 | bnx2i_identify_device(hba); |
771 | bnx2i_setup_host_queue_size(hba, shost); | 770 | bnx2i_setup_host_queue_size(hba, shost); |
@@ -821,6 +820,11 @@ struct bnx2i_hba *bnx2i_alloc_hba(struct cnic_dev *cnic) | |||
821 | 820 | ||
822 | spin_lock_init(&hba->lock); | 821 | spin_lock_init(&hba->lock); |
823 | 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; | ||
824 | 828 | ||
825 | if (iscsi_host_add(shost, &hba->pcidev->dev)) | 829 | if (iscsi_host_add(shost, &hba->pcidev->dev)) |
826 | goto free_dump_mem; | 830 | goto free_dump_mem; |
@@ -1161,9 +1165,6 @@ static int bnx2i_task_xmit(struct iscsi_task *task) | |||
1161 | struct bnx2i_cmd *cmd = task->dd_data; | 1165 | struct bnx2i_cmd *cmd = task->dd_data; |
1162 | struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr; | 1166 | struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr; |
1163 | 1167 | ||
1164 | if (!bnx2i_conn->is_bound) | ||
1165 | return -ENOTCONN; | ||
1166 | |||
1167 | /* | 1168 | /* |
1168 | * If there is no scsi_cmnd this must be a mgmt task | 1169 | * If there is no scsi_cmnd this must be a mgmt task |
1169 | */ | 1170 | */ |
@@ -1371,7 +1372,6 @@ static int bnx2i_conn_bind(struct iscsi_cls_session *cls_session, | |||
1371 | bnx2i_conn->ep = bnx2i_ep; | 1372 | bnx2i_conn->ep = bnx2i_ep; |
1372 | bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid; | 1373 | bnx2i_conn->iscsi_conn_cid = bnx2i_ep->ep_iscsi_cid; |
1373 | bnx2i_conn->fw_cid = bnx2i_ep->ep_cid; | 1374 | bnx2i_conn->fw_cid = bnx2i_ep->ep_cid; |
1374 | bnx2i_conn->is_bound = 1; | ||
1375 | 1375 | ||
1376 | ret_code = bnx2i_bind_conn_to_iscsi_cid(hba, bnx2i_conn, | 1376 | ret_code = bnx2i_bind_conn_to_iscsi_cid(hba, bnx2i_conn, |
1377 | bnx2i_ep->ep_iscsi_cid); | 1377 | bnx2i_ep->ep_iscsi_cid); |
@@ -1432,8 +1432,8 @@ static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn, | |||
1432 | break; | 1432 | break; |
1433 | case ISCSI_PARAM_CONN_ADDRESS: | 1433 | case ISCSI_PARAM_CONN_ADDRESS: |
1434 | if (bnx2i_conn->ep) | 1434 | if (bnx2i_conn->ep) |
1435 | len = sprintf(buf, NIPQUAD_FMT "\n", | 1435 | len = sprintf(buf, "%pI4\n", |
1436 | NIPQUAD(bnx2i_conn->ep->cm_sk->dst_ip)); | 1436 | &bnx2i_conn->ep->cm_sk->dst_ip); |
1437 | break; | 1437 | break; |
1438 | default: | 1438 | default: |
1439 | return iscsi_conn_get_param(cls_conn, param, buf); | 1439 | return iscsi_conn_get_param(cls_conn, param, buf); |
@@ -1663,8 +1663,8 @@ static struct iscsi_endpoint *bnx2i_ep_connect(struct Scsi_Host *shost, | |||
1663 | */ | 1663 | */ |
1664 | hba = bnx2i_check_route(dst_addr); | 1664 | hba = bnx2i_check_route(dst_addr); |
1665 | 1665 | ||
1666 | if (!hba) { | 1666 | if (!hba || test_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state)) { |
1667 | rc = -ENOMEM; | 1667 | rc = -EINVAL; |
1668 | goto check_busy; | 1668 | goto check_busy; |
1669 | } | 1669 | } |
1670 | 1670 | ||
@@ -1809,7 +1809,7 @@ static int bnx2i_ep_poll(struct iscsi_endpoint *ep, int timeout_ms) | |||
1809 | (bnx2i_ep->state == | 1809 | (bnx2i_ep->state == |
1810 | EP_STATE_CONNECT_COMPL)), | 1810 | EP_STATE_CONNECT_COMPL)), |
1811 | msecs_to_jiffies(timeout_ms)); | 1811 | msecs_to_jiffies(timeout_ms)); |
1812 | if (!rc || (bnx2i_ep->state == EP_STATE_OFLD_FAILED)) | 1812 | if (bnx2i_ep->state == EP_STATE_OFLD_FAILED) |
1813 | rc = -1; | 1813 | rc = -1; |
1814 | 1814 | ||
1815 | if (rc > 0) | 1815 | if (rc > 0) |
@@ -1883,7 +1883,7 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) | |||
1883 | 1883 | ||
1884 | bnx2i_ep = ep->dd_data; | 1884 | bnx2i_ep = ep->dd_data; |
1885 | 1885 | ||
1886 | /* driver should not attempt connection cleanup untill TCP_CONNECT | 1886 | /* driver should not attempt connection cleanup until TCP_CONNECT |
1887 | * completes either successfully or fails. Timeout is 9-secs, so | 1887 | * completes either successfully or fails. Timeout is 9-secs, so |
1888 | * wait for it to complete | 1888 | * wait for it to complete |
1889 | */ | 1889 | */ |
@@ -1896,9 +1896,7 @@ static void bnx2i_ep_disconnect(struct iscsi_endpoint *ep) | |||
1896 | conn = bnx2i_conn->cls_conn->dd_data; | 1896 | conn = bnx2i_conn->cls_conn->dd_data; |
1897 | session = conn->session; | 1897 | session = conn->session; |
1898 | 1898 | ||
1899 | spin_lock_bh(&session->lock); | 1899 | iscsi_suspend_queue(conn); |
1900 | bnx2i_conn->is_bound = 0; | ||
1901 | spin_unlock_bh(&session->lock); | ||
1902 | } | 1900 | } |
1903 | 1901 | ||
1904 | hba = bnx2i_ep->hba; | 1902 | hba = bnx2i_ep->hba; |
@@ -1964,6 +1962,8 @@ return_bnx2i_ep: | |||
1964 | 1962 | ||
1965 | if (!hba->ofld_conns_active) | 1963 | if (!hba->ofld_conns_active) |
1966 | bnx2i_unreg_dev_all(); | 1964 | bnx2i_unreg_dev_all(); |
1965 | |||
1966 | wake_up_interruptible(&hba->eh_wait); | ||
1967 | } | 1967 | } |
1968 | 1968 | ||
1969 | 1969 | ||
@@ -1997,7 +1997,8 @@ static struct scsi_host_template bnx2i_host_template = { | |||
1997 | .queuecommand = iscsi_queuecommand, | 1997 | .queuecommand = iscsi_queuecommand, |
1998 | .eh_abort_handler = iscsi_eh_abort, | 1998 | .eh_abort_handler = iscsi_eh_abort, |
1999 | .eh_device_reset_handler = iscsi_eh_device_reset, | 1999 | .eh_device_reset_handler = iscsi_eh_device_reset, |
2000 | .eh_target_reset_handler = iscsi_eh_target_reset, | 2000 | .eh_target_reset_handler = iscsi_eh_recover_target, |
2001 | .change_queue_depth = iscsi_change_queue_depth, | ||
2001 | .can_queue = 1024, | 2002 | .can_queue = 1024, |
2002 | .max_sectors = 127, | 2003 | .max_sectors = 127, |
2003 | .cmd_per_lun = 32, | 2004 | .cmd_per_lun = 32, |
@@ -2034,7 +2035,7 @@ struct iscsi_transport bnx2i_iscsi_transport = { | |||
2034 | ISCSI_USERNAME | ISCSI_PASSWORD | | 2035 | ISCSI_USERNAME | ISCSI_PASSWORD | |
2035 | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | | 2036 | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | |
2036 | ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | | 2037 | ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | |
2037 | ISCSI_LU_RESET_TMO | | 2038 | ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO | |
2038 | ISCSI_PING_TMO | ISCSI_RECV_TMO | | 2039 | ISCSI_PING_TMO | ISCSI_RECV_TMO | |
2039 | ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME, | 2040 | ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME, |
2040 | .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_NETDEV_NAME, | 2041 | .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_NETDEV_NAME, |