diff options
author | Manish Rangankar <manish.rangankar@qlogic.com> | 2012-02-27 06:08:55 -0500 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2012-02-29 18:00:24 -0500 |
commit | 173269ef2900bf824032103b98f3446375a4f8d9 (patch) | |
tree | a8a7970a69a89535e3f7f2f55428a75a512cf7c5 /drivers | |
parent | fca9f04d460bf7c6af397dd994f1d81a3037f9dc (diff) |
[SCSI] qla4xxx: Add support for multiple session per host.
This patch will allow iscsiadm to create multiple session
for the same target on per host.
Signed-off-by: Manish Rangankar <manish.rangankar@qlogic.com>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_def.h | 1 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 10 | ||||
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 28 |
3 files changed, 35 insertions, 4 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index 0b2487631d52..7f2492e88be7 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h | |||
@@ -291,6 +291,7 @@ struct ql4_tuple_ddb { | |||
291 | uint16_t options; | 291 | uint16_t options; |
292 | #define DDB_OPT_IPV6 0x0e0e | 292 | #define DDB_OPT_IPV6 0x0e0e |
293 | #define DDB_OPT_IPV4 0x0f0f | 293 | #define DDB_OPT_IPV4 0x0f0f |
294 | uint8_t isid[6]; | ||
294 | }; | 295 | }; |
295 | 296 | ||
296 | /* | 297 | /* |
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index 71331e3b4404..b2d336c236c0 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
@@ -1607,7 +1607,7 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha, | |||
1607 | char *ip; | 1607 | char *ip; |
1608 | uint16_t iscsi_opts = 0; | 1608 | uint16_t iscsi_opts = 0; |
1609 | uint32_t options = 0; | 1609 | uint32_t options = 0; |
1610 | uint16_t idx; | 1610 | uint16_t idx, *ptid; |
1611 | 1611 | ||
1612 | fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), | 1612 | fw_ddb_entry = dma_alloc_coherent(&ha->pdev->dev, sizeof(*fw_ddb_entry), |
1613 | &fw_ddb_entry_dma, GFP_KERNEL); | 1613 | &fw_ddb_entry_dma, GFP_KERNEL); |
@@ -1633,6 +1633,14 @@ int qla4xxx_set_param_ddbentry(struct scsi_qla_host *ha, | |||
1633 | goto exit_set_param; | 1633 | goto exit_set_param; |
1634 | } | 1634 | } |
1635 | 1635 | ||
1636 | ptid = (uint16_t *)&fw_ddb_entry->isid[1]; | ||
1637 | *ptid = cpu_to_le16((uint16_t)ddb_entry->sess->target_id); | ||
1638 | |||
1639 | DEBUG2(ql4_printk(KERN_INFO, ha, "ISID [%02x%02x%02x%02x%02x%02x]\n", | ||
1640 | fw_ddb_entry->isid[5], fw_ddb_entry->isid[4], | ||
1641 | fw_ddb_entry->isid[3], fw_ddb_entry->isid[2], | ||
1642 | fw_ddb_entry->isid[1], fw_ddb_entry->isid[0])); | ||
1643 | |||
1636 | iscsi_opts = le16_to_cpu(fw_ddb_entry->iscsi_options); | 1644 | iscsi_opts = le16_to_cpu(fw_ddb_entry->iscsi_options); |
1637 | memset(fw_ddb_entry->iscsi_alias, 0, sizeof(fw_ddb_entry->iscsi_alias)); | 1645 | memset(fw_ddb_entry->iscsi_alias, 0, sizeof(fw_ddb_entry->iscsi_alias)); |
1638 | 1646 | ||
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index cbaf2b33e485..50074ed95767 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -4252,11 +4252,13 @@ static void qla4xxx_convert_param_ddb(struct dev_db_entry *fw_ddb_entry, | |||
4252 | sprintf(tddb->ip_addr, "%pI4", fw_ddb_entry->ip_addr); | 4252 | sprintf(tddb->ip_addr, "%pI4", fw_ddb_entry->ip_addr); |
4253 | 4253 | ||
4254 | tddb->port = le16_to_cpu(fw_ddb_entry->port); | 4254 | tddb->port = le16_to_cpu(fw_ddb_entry->port); |
4255 | memcpy(&tddb->isid[0], &fw_ddb_entry->isid[0], sizeof(tddb->isid)); | ||
4255 | } | 4256 | } |
4256 | 4257 | ||
4257 | static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha, | 4258 | static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha, |
4258 | struct ql4_tuple_ddb *old_tddb, | 4259 | struct ql4_tuple_ddb *old_tddb, |
4259 | struct ql4_tuple_ddb *new_tddb) | 4260 | struct ql4_tuple_ddb *new_tddb, |
4261 | uint8_t is_isid_compare) | ||
4260 | { | 4262 | { |
4261 | if (strcmp(old_tddb->iscsi_name, new_tddb->iscsi_name)) | 4263 | if (strcmp(old_tddb->iscsi_name, new_tddb->iscsi_name)) |
4262 | return QLA_ERROR; | 4264 | return QLA_ERROR; |
@@ -4267,6 +4269,26 @@ static int qla4xxx_compare_tuple_ddb(struct scsi_qla_host *ha, | |||
4267 | if (old_tddb->port != new_tddb->port) | 4269 | if (old_tddb->port != new_tddb->port) |
4268 | return QLA_ERROR; | 4270 | return QLA_ERROR; |
4269 | 4271 | ||
4272 | /* For multi sessions, driver generates the ISID, so do not compare | ||
4273 | * ISID in reset path since it would be a comparision between the | ||
4274 | * driver generated ISID and firmware generated ISID. This could | ||
4275 | * lead to adding duplicated DDBs in the list as driver generated | ||
4276 | * ISID would not match firmware generated ISID. | ||
4277 | */ | ||
4278 | if (is_isid_compare) { | ||
4279 | DEBUG2(ql4_printk(KERN_INFO, ha, "%s: old ISID [%02x%02x%02x" | ||
4280 | "%02x%02x%02x] New ISID [%02x%02x%02x%02x%02x%02x]\n", | ||
4281 | __func__, old_tddb->isid[5], old_tddb->isid[4], | ||
4282 | old_tddb->isid[3], old_tddb->isid[2], old_tddb->isid[1], | ||
4283 | old_tddb->isid[0], new_tddb->isid[5], new_tddb->isid[4], | ||
4284 | new_tddb->isid[3], new_tddb->isid[2], new_tddb->isid[1], | ||
4285 | new_tddb->isid[0])); | ||
4286 | |||
4287 | if (memcmp(&old_tddb->isid[0], &new_tddb->isid[0], | ||
4288 | sizeof(old_tddb->isid))) | ||
4289 | return QLA_ERROR; | ||
4290 | } | ||
4291 | |||
4270 | DEBUG2(ql4_printk(KERN_INFO, ha, | 4292 | DEBUG2(ql4_printk(KERN_INFO, ha, |
4271 | "Match Found, fw[%d,%d,%s,%s], [%d,%d,%s,%s]", | 4293 | "Match Found, fw[%d,%d,%s,%s], [%d,%d,%s,%s]", |
4272 | old_tddb->port, old_tddb->tpgt, old_tddb->ip_addr, | 4294 | old_tddb->port, old_tddb->tpgt, old_tddb->ip_addr, |
@@ -4309,7 +4331,7 @@ static int qla4xxx_is_session_exists(struct scsi_qla_host *ha, | |||
4309 | continue; | 4331 | continue; |
4310 | 4332 | ||
4311 | qla4xxx_get_param_ddb(ddb_entry, tmp_tddb); | 4333 | qla4xxx_get_param_ddb(ddb_entry, tmp_tddb); |
4312 | if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb)) { | 4334 | if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb, false)) { |
4313 | ret = QLA_SUCCESS; /* found */ | 4335 | ret = QLA_SUCCESS; /* found */ |
4314 | goto exit_check; | 4336 | goto exit_check; |
4315 | } | 4337 | } |
@@ -4352,7 +4374,7 @@ static int qla4xxx_is_flash_ddb_exists(struct scsi_qla_host *ha, | |||
4352 | 4374 | ||
4353 | list_for_each_entry_safe(nt_ddb_idx, nt_ddb_idx_tmp, list_nt, list) { | 4375 | list_for_each_entry_safe(nt_ddb_idx, nt_ddb_idx_tmp, list_nt, list) { |
4354 | qla4xxx_convert_param_ddb(&nt_ddb_idx->fw_ddb, tmp_tddb); | 4376 | qla4xxx_convert_param_ddb(&nt_ddb_idx->fw_ddb, tmp_tddb); |
4355 | if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb)) { | 4377 | if (!qla4xxx_compare_tuple_ddb(ha, fw_tddb, tmp_tddb, true)) { |
4356 | ret = QLA_SUCCESS; /* found */ | 4378 | ret = QLA_SUCCESS; /* found */ |
4357 | goto exit_check; | 4379 | goto exit_check; |
4358 | } | 4380 | } |