]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[SCSI] qla4xxx: do not reuse session when connecting to different target port
authorMike Christie <michaelc@cs.wisc.edu>
Fri, 16 Jan 2009 18:36:52 +0000 (12:36 -0600)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Sun, 25 Jan 2009 13:55:13 +0000 (07:55 -0600)
qla4xxx does not check the I_T nexus values correctly
so it ends up creating one session to the target. If
a portal should disappear or they should be reported
in different order the driver will think it is already
logged in when it could now be speaking to a different
target portal or accessing it through a different
initiator port (iscsi initiator port is not tied to
hardware and is just the initiator name plus isid
so you could end up with multiple ports through one
host).

This patch has the driver check the iscsi scsi port
values when matching sessions (we do not check
the initiator name because that is static). It results
in a portal from each target portal group getting
logged into instead of just one per target. In the future
the firmware should hopefully send us notification of other
sessions that are created to other portals within the
same tpgt and the sessions should have different isids.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/qla4xxx/ql4_def.h
drivers/scsi/qla4xxx/ql4_init.c

index d6be0762eb918977b27bd428f7057a8e25bba3af..b586f27c3bd4a32f0baa1e629eccbde2eb7ec32b 100644 (file)
@@ -244,6 +244,7 @@ struct ddb_entry {
        uint8_t ip_addr[ISCSI_IPADDR_SIZE];
        uint8_t iscsi_name[ISCSI_NAME_SIZE];    /* 72 x48 */
        uint8_t iscsi_alias[0x20];
+       uint8_t isid[6];
 };
 
 /*
index 109c5f5985ecfb1772956296a27ea219ee7a01ff..af8c3233e8aef9c3449917e9e3850e553a937ca3 100644 (file)
@@ -342,8 +342,12 @@ static struct ddb_entry* qla4xxx_get_ddb_entry(struct scsi_qla_host *ha,
        DEBUG2(printk("scsi%ld: %s: Looking for ddb[%d]\n", ha->host_no,
                      __func__, fw_ddb_index));
        list_for_each_entry(ddb_entry, &ha->ddb_list, list) {
-               if (memcmp(ddb_entry->iscsi_name, fw_ddb_entry->iscsi_name,
-                          ISCSI_NAME_SIZE) == 0) {
+               if ((memcmp(ddb_entry->iscsi_name, fw_ddb_entry->iscsi_name,
+                          ISCSI_NAME_SIZE) == 0) &&
+                       (ddb_entry->tpgt ==
+                               le32_to_cpu(fw_ddb_entry->tgt_portal_grp)) &&
+                       (memcmp(ddb_entry->isid, fw_ddb_entry->isid,
+                               sizeof(ddb_entry->isid)) == 0)) {
                        found++;
                        break;
                }
@@ -430,6 +434,8 @@ static int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha,
 
        ddb_entry->port = le16_to_cpu(fw_ddb_entry->port);
        ddb_entry->tpgt = le32_to_cpu(fw_ddb_entry->tgt_portal_grp);
+       memcpy(ddb_entry->isid, fw_ddb_entry->isid, sizeof(ddb_entry->isid));
+
        memcpy(&ddb_entry->iscsi_name[0], &fw_ddb_entry->iscsi_name[0],
               min(sizeof(ddb_entry->iscsi_name),
                   sizeof(fw_ddb_entry->iscsi_name)));