Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359481
b: refs/heads/master
c: 1dc8ed5
h: refs/heads/master
i:
  359479: d21ff7c
v: v3
  • Loading branch information
Manish Rangankar authored and James Bottomley committed Jan 30, 2013
1 parent 66e8490 commit 8c1161a
Show file tree
Hide file tree
Showing 3 changed files with 85 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: 9661975f1717876577c62796707a2b7e34facb3f
refs/heads/master: 1dc8ed5d3888dbec2d7b6530308f4aca9288f7ec
2 changes: 2 additions & 0 deletions trunk/drivers/scsi/qla4xxx/ql4_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
#define DISABLE_ACB_TOV 30
#define IP_CONFIG_TOV 30
#define LOGIN_TOV 12
#define BOOT_LOGIN_RESP_TOV 60

#define MAX_RESET_HA_RETRIES 2
#define FW_ALIVE_WAIT_TOV 3
Expand Down Expand Up @@ -315,6 +316,7 @@ struct ql4_tuple_ddb {
* DDB flags.
*/
#define DF_RELOGIN 0 /* Relogin to device */
#define DF_BOOT_TGT 1 /* Boot target entry */
#define DF_ISNS_DISCOVERED 2 /* Device was discovered via iSNS */
#define DF_FO_MASKED 3

Expand Down
86 changes: 82 additions & 4 deletions trunk/drivers/scsi/qla4xxx/ql4_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -4728,7 +4728,8 @@ static int qla4xxx_verify_boot_idx(struct scsi_qla_host *ha, uint16_t idx)
}

static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha,
struct ddb_entry *ddb_entry)
struct ddb_entry *ddb_entry,
uint16_t idx)
{
uint16_t def_timeout;

Expand All @@ -4748,6 +4749,10 @@ static void qla4xxx_setup_flash_ddb_entry(struct scsi_qla_host *ha,
def_timeout : LOGIN_TOV;
ddb_entry->default_time2wait =
le16_to_cpu(ddb_entry->fw_ddb_entry.iscsi_def_time2wait);

if (ql4xdisablesysfsboot &&
(idx == ha->pri_ddb_idx || idx == ha->sec_ddb_idx))
set_bit(DF_BOOT_TGT, &ddb_entry->flags);
}

static void qla4xxx_wait_for_ip_configuration(struct scsi_qla_host *ha)
Expand Down Expand Up @@ -4884,7 +4889,7 @@ static void qla4xxx_remove_failed_ddb(struct scsi_qla_host *ha,

static int qla4xxx_sess_conn_setup(struct scsi_qla_host *ha,
struct dev_db_entry *fw_ddb_entry,
int is_reset)
int is_reset, uint16_t idx)
{
struct iscsi_cls_session *cls_sess;
struct iscsi_session *sess;
Expand Down Expand Up @@ -4922,7 +4927,7 @@ static int qla4xxx_sess_conn_setup(struct scsi_qla_host *ha,
memcpy(&ddb_entry->fw_ddb_entry, fw_ddb_entry,
sizeof(struct dev_db_entry));

qla4xxx_setup_flash_ddb_entry(ha, ddb_entry);
qla4xxx_setup_flash_ddb_entry(ha, ddb_entry, idx);

cls_conn = iscsi_conn_setup(cls_sess, sizeof(struct qla_conn), conn_id);

Expand Down Expand Up @@ -5039,7 +5044,7 @@ static void qla4xxx_build_nt_list(struct scsi_qla_host *ha,
goto continue_next_nt;
}

ret = qla4xxx_sess_conn_setup(ha, fw_ddb_entry, is_reset);
ret = qla4xxx_sess_conn_setup(ha, fw_ddb_entry, is_reset, idx);
if (ret == QLA_ERROR)
goto exit_nt_list;

Expand Down Expand Up @@ -5118,6 +5123,78 @@ void qla4xxx_build_ddb_list(struct scsi_qla_host *ha, int is_reset)
qla4xxx_free_ddb_index(ha);
}

/**
* qla4xxx_wait_login_resp_boot_tgt - Wait for iSCSI boot target login
* response.
* @ha: pointer to adapter structure
*
* When the boot entry is normal iSCSI target then DF_BOOT_TGT flag will be
* set in DDB and we will wait for login response of boot targets during
* probe.
**/
static void qla4xxx_wait_login_resp_boot_tgt(struct scsi_qla_host *ha)
{
struct ddb_entry *ddb_entry;
struct dev_db_entry *fw_ddb_entry = NULL;
dma_addr_t fw_ddb_entry_dma;
unsigned long wtime;
uint32_t ddb_state;
int max_ddbs, idx, ret;

max_ddbs = is_qla40XX(ha) ? MAX_DEV_DB_ENTRIES_40XX :
MAX_DEV_DB_ENTRIES;

fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry),
&fw_ddb_entry_dma, GFP_KERNEL);
if (!fw_ddb_entry) {
ql4_printk(KERN_ERR, ha,
"%s: Unable to allocate dma buffer\n", __func__);
goto exit_login_resp;
}

wtime = jiffies + (HZ * BOOT_LOGIN_RESP_TOV);

for (idx = 0; idx < max_ddbs; idx++) {
ddb_entry = qla4xxx_lookup_ddb_by_fw_index(ha, idx);
if (ddb_entry == NULL)
continue;

if (test_bit(DF_BOOT_TGT, &ddb_entry->flags)) {
DEBUG2(ql4_printk(KERN_INFO, ha,
"%s: DDB index [%d]\n", __func__,
ddb_entry->fw_ddb_index));
do {
ret = qla4xxx_get_fwddb_entry(ha,
ddb_entry->fw_ddb_index,
fw_ddb_entry, fw_ddb_entry_dma,
NULL, NULL, &ddb_state, NULL,
NULL, NULL);
if (ret == QLA_ERROR)
goto exit_login_resp;

if ((ddb_state == DDB_DS_SESSION_ACTIVE) ||
(ddb_state == DDB_DS_SESSION_FAILED))
break;

schedule_timeout_uninterruptible(HZ);

} while ((time_after(wtime, jiffies)));

if (!time_after(wtime, jiffies)) {
DEBUG2(ql4_printk(KERN_INFO, ha,
"%s: Login response wait timer expired\n",
__func__));
goto exit_login_resp;
}
}
}

exit_login_resp:
if (fw_ddb_entry)
dma_free_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry),
fw_ddb_entry, fw_ddb_entry_dma);
}

/**
* qla4xxx_probe_adapter - callback function to probe HBA
* @pdev: pointer to pci_dev structure
Expand Down Expand Up @@ -5371,6 +5448,7 @@ static int qla4xxx_probe_adapter(struct pci_dev *pdev,
/* Perform the build ddb list and login to each */
qla4xxx_build_ddb_list(ha, INIT_ADAPTER);
iscsi_host_for_each_session(ha->host, qla4xxx_login_flash_ddb);
qla4xxx_wait_login_resp_boot_tgt(ha);

qla4xxx_create_chap_list(ha);

Expand Down

0 comments on commit 8c1161a

Please sign in to comment.