]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_attr.c
[SCSI] lpfc: minor cleanups
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_attr.c
index 80a11218b9bbe8ddafe5d44ce896ecd1115d9bc6..e1b041d8f6d5dadc9c1544f360bb527e64e639cb 100644 (file)
@@ -85,6 +85,15 @@ lpfc_serialnum_show(struct class_device *cdev, char *buf)
        return snprintf(buf, PAGE_SIZE, "%s\n",phba->SerialNumber);
 }
 
+static ssize_t
+lpfc_temp_sensor_show(struct class_device *cdev, char *buf)
+{
+       struct Scsi_Host *shost = class_to_shost(cdev);
+       struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
+       struct lpfc_hba   *phba = vport->phba;
+       return snprintf(buf, PAGE_SIZE, "%d\n",phba->temp_sensor_support);
+}
+
 static ssize_t
 lpfc_modeldesc_show(struct class_device *cdev, char *buf)
 {
@@ -178,12 +187,9 @@ lpfc_state_show(struct class_device *cdev, char *buf)
        case LPFC_LINK_UP:
        case LPFC_CLEAR_LA:
        case LPFC_HBA_READY:
-               len += snprintf(buf + len, PAGE_SIZE-len, "Link Up - \n");
+               len += snprintf(buf + len, PAGE_SIZE-len, "Link Up - ");
 
                switch (vport->port_state) {
-                       len += snprintf(buf + len, PAGE_SIZE-len,
-                                       "initializing\n");
-                       break;
                case LPFC_LOCAL_CFG_LINK:
                        len += snprintf(buf + len, PAGE_SIZE-len,
                                        "Configuring Link\n");
@@ -908,6 +914,8 @@ static CLASS_DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL);
 static CLASS_DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL);
 static CLASS_DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL);
 static CLASS_DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL);
+static CLASS_DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show,
+                        NULL);
 
 
 static char *lpfc_soft_wwn_key = "C99G71SL8032A";
@@ -971,6 +979,12 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
        unsigned int i, j, cnt=count;
        u8 wwpn[8];
 
+       spin_lock_irq(&phba->hbalock);
+       if (phba->over_temp_state == HBA_OVER_TEMP) {
+               spin_unlock_irq(&phba->hbalock);
+               return -EPERM;
+       }
+       spin_unlock_irq(&phba->hbalock);
        /* count may include a LF at end of string */
        if (buf[cnt-1] == '\n')
                cnt--;
@@ -1102,7 +1116,13 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
                 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
                 " 3 - select SLI-3");
 
-LPFC_ATTR_R(enable_npiv, 0, 0, 1, "Enable NPIV functionality");
+int lpfc_enable_npiv = 0;
+module_param(lpfc_enable_npiv, int, 0);
+MODULE_PARM_DESC(lpfc_enable_npiv, "Enable NPIV functionality");
+lpfc_param_show(enable_npiv);
+lpfc_param_init(enable_npiv, 0, 0, 1);
+static CLASS_DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO,
+                        lpfc_enable_npiv_show, NULL);
 
 /*
 # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear
@@ -1247,6 +1267,13 @@ static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
 LPFC_VPORT_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff,
                       "Verbose logging bit-mask");
 
+/*
+# lpfc_enable_da_id: This turns on the DA_ID CT command that deregisters
+# objects that have been registered with the nameserver after login.
+*/
+LPFC_VPORT_ATTR_R(enable_da_id, 0, 0, 1,
+                 "Deregister nameserver objects before LOGO");
+
 /*
 # lun_queue_depth:  This parameter is used to limit the number of outstanding
 # commands per FCP LUN. Value range is [1,128]. Default value is 30.
@@ -1494,6 +1521,7 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
        &class_device_attr_state,
        &class_device_attr_num_discovered_ports,
        &class_device_attr_lpfc_drvr_version,
+       &class_device_attr_lpfc_temp_sensor,
        &class_device_attr_lpfc_log_verbose,
        &class_device_attr_lpfc_lun_queue_depth,
        &class_device_attr_lpfc_hba_queue_depth,
@@ -1552,6 +1580,7 @@ struct class_device_attribute *lpfc_vport_attrs[] = {
        &class_device_attr_lpfc_max_luns,
        &class_device_attr_nport_evt_cnt,
        &class_device_attr_npiv_info,
+       &class_device_attr_lpfc_enable_da_id,
        NULL,
 };
 
@@ -1727,13 +1756,18 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
 
        spin_lock_irq(&phba->hbalock);
 
+       if (phba->over_temp_state == HBA_OVER_TEMP) {
+               sysfs_mbox_idle(phba);
+               spin_unlock_irq(&phba->hbalock);
+               return  -EPERM;
+       }
+
        if (off == 0 &&
            phba->sysfs_mbox.state  == SMBOX_WRITING &&
            phba->sysfs_mbox.offset >= 2 * sizeof(uint32_t)) {
 
                switch (phba->sysfs_mbox.mbox->mb.mbxCommand) {
                        /* Offline only */
-               case MBX_WRITE_NV:
                case MBX_INIT_LINK:
                case MBX_DOWN_LINK:
                case MBX_CONFIG_LINK:
@@ -1756,6 +1790,8 @@ sysfs_mbox_read(struct kobject *kobj, struct bin_attribute *bin_attr,
                                spin_unlock_irq(&phba->hbalock);
                                return -EPERM;
                        }
+               case MBX_WRITE_NV:
+               case MBX_WRITE_VPARMS:
                case MBX_LOAD_SM:
                case MBX_READ_NV:
                case MBX_READ_CONFIG:
@@ -2337,8 +2373,6 @@ struct fc_function_template lpfc_transport_functions = {
        .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk,
        .terminate_rport_io = lpfc_terminate_rport_io,
 
-       .vport_create = lpfc_vport_create,
-       .vport_delete = lpfc_vport_delete,
        .dd_fcvport_size = sizeof(struct lpfc_vport *),
 };
 
@@ -2448,5 +2482,6 @@ lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
        lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
        lpfc_max_luns_init(vport, lpfc_max_luns);
        lpfc_scan_down_init(vport, lpfc_scan_down);
+       lpfc_enable_da_id_init(vport, lpfc_enable_da_id);
        return;
 }