[SCSI] iscsi_transport: added new iscsi_param to display target alias in sysfs
authorVikas Chaudhary <vikas.chaudhary@qlogic.com>
Sat, 10 Jul 2010 09:21:30 +0000 (14:51 +0530)
committerJames Bottomley <James.Bottomley@suse.de>
Wed, 28 Jul 2010 14:05:25 +0000 (09:05 -0500)
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/scsi/qla4xxx/ql4_init.c
drivers/scsi/qla4xxx/ql4_os.c
drivers/scsi/scsi_transport_iscsi.c
include/scsi/iscsi_if.h

index e6b73b9fcc5a5a2859c51d47cca24d45e418c17e..266ebd45396d198282baeb053c3bbfecfc62f498 100644 (file)
@@ -594,6 +594,9 @@ static int qla4xxx_update_ddb_entry(struct scsi_qla_host *ha,
        memcpy(&ddb_entry->iscsi_name[0], &fw_ddb_entry->iscsi_name[0],
               min(sizeof(ddb_entry->iscsi_name),
                   sizeof(fw_ddb_entry->iscsi_name)));
+       memcpy(&ddb_entry->iscsi_alias[0], &fw_ddb_entry->iscsi_alias[0],
+              min(sizeof(ddb_entry->iscsi_alias),
+                  sizeof(fw_ddb_entry->iscsi_alias)));
        memcpy(&ddb_entry->ip_addr[0], &fw_ddb_entry->ip_addr[0],
               min(sizeof(ddb_entry->ip_addr), sizeof(fw_ddb_entry->ip_addr)));
 
index daf5a4bf9b0aecca0f886a57b3f82181cc590f5e..821384147a41cba12a2501f7b705001cbd1f56cb 100644 (file)
@@ -126,7 +126,8 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
        .caps                   = CAP_FW_DB | CAP_SENDTARGETS_OFFLOAD |
                                  CAP_DATA_PATH_OFFLOAD,
        .param_mask             = ISCSI_CONN_PORT | ISCSI_CONN_ADDRESS |
-                                 ISCSI_TARGET_NAME | ISCSI_TPGT,
+                                 ISCSI_TARGET_NAME | ISCSI_TPGT |
+                                 ISCSI_TARGET_ALIAS,
        .host_param_mask        = ISCSI_HOST_HWADDRESS |
                                  ISCSI_HOST_IPADDRESS |
                                  ISCSI_HOST_INITIATOR_NAME,
@@ -210,6 +211,10 @@ static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess,
        case ISCSI_PARAM_TPGT:
                len = sprintf(buf, "%u\n", ddb_entry->tpgt);
                break;
+       case ISCSI_PARAM_TARGET_ALIAS:
+               len = snprintf(buf, PAGE_SIZE - 1, "%s\n",
+                   ddb_entry->iscsi_alias);
+               break;
        default:
                return -ENOSYS;
        }
index 1e6d4793542c30943602fbc13a2abcbae82080b2..b9aec304872cbd5ddec34465a285b9e19dac5eff 100644 (file)
@@ -31,7 +31,7 @@
 #include <scsi/scsi_transport_iscsi.h>
 #include <scsi/iscsi_if.h>
 
-#define ISCSI_SESSION_ATTRS 22
+#define ISCSI_SESSION_ATTRS 23
 #define ISCSI_CONN_ATTRS 13
 #define ISCSI_HOST_ATTRS 4
 
@@ -1763,7 +1763,8 @@ iscsi_session_attr(abort_tmo, ISCSI_PARAM_ABORT_TMO, 0);
 iscsi_session_attr(lu_reset_tmo, ISCSI_PARAM_LU_RESET_TMO, 0);
 iscsi_session_attr(tgt_reset_tmo, ISCSI_PARAM_TGT_RESET_TMO, 0);
 iscsi_session_attr(ifacename, ISCSI_PARAM_IFACE_NAME, 0);
-iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0)
+iscsi_session_attr(initiatorname, ISCSI_PARAM_INITIATOR_NAME, 0);
+iscsi_session_attr(targetalias, ISCSI_PARAM_TARGET_ALIAS, 0);
 
 static ssize_t
 show_priv_session_state(struct device *dev, struct device_attribute *attr,
@@ -2006,6 +2007,7 @@ iscsi_register_transport(struct iscsi_transport *tt)
        SETUP_SESSION_RD_ATTR(tgt_reset_tmo,ISCSI_TGT_RESET_TMO);
        SETUP_SESSION_RD_ATTR(ifacename, ISCSI_IFACE_NAME);
        SETUP_SESSION_RD_ATTR(initiatorname, ISCSI_INITIATOR_NAME);
+       SETUP_SESSION_RD_ATTR(targetalias, ISCSI_TARGET_ALIAS);
        SETUP_PRIV_SESSION_RD_ATTR(recovery_tmo);
        SETUP_PRIV_SESSION_RD_ATTR(state);
 
index 66d377b9c72b8b774a1cbf2a69baf23b4f53b713..a8631acd37c3b9f4dfddc0067255463a5407f6c5 100644 (file)
@@ -313,6 +313,7 @@ enum iscsi_param {
        ISCSI_PARAM_INITIATOR_NAME,
 
        ISCSI_PARAM_TGT_RESET_TMO,
+       ISCSI_PARAM_TARGET_ALIAS,
        /* must always be last */
        ISCSI_PARAM_MAX,
 };
@@ -353,6 +354,7 @@ enum iscsi_param {
 #define ISCSI_ISID                     (1ULL << ISCSI_PARAM_ISID)
 #define ISCSI_INITIATOR_NAME           (1ULL << ISCSI_PARAM_INITIATOR_NAME)
 #define ISCSI_TGT_RESET_TMO            (1ULL << ISCSI_PARAM_TGT_RESET_TMO)
+#define ISCSI_TARGET_ALIAS             (1ULL << ISCSI_PARAM_TARGET_ALIAS)
 
 /* iSCSI HBA params */
 enum iscsi_host_param {