X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fscsi%2Fqla2xxx%2Fqla_attr.c;h=287690853caf2594ddc1fa1cd63f58b87b002562;hb=211c8d4942edf2f3337820dda101da6b13c8a19a;hp=1dd8591bd5c2d3c2048794d9a7754a9255ffc742;hpb=e87110852d0bd331d50c3de686a7fc9626579d60;p=linux-2.6-omap-h63xx.git diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 1dd8591bd5c..7a4409ab30e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -1,6 +1,6 @@ /* * QLogic Fibre Channel HBA Driver - * Copyright (c) 2003-2005 QLogic Corporation + * Copyright (c) 2003-2008 QLogic Corporation * * See LICENSE.qla2xxx for copyright and licensing details. */ @@ -20,18 +20,12 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj, { struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj, struct device, kobj))); - char *rbuf = (char *)ha->fw_dump; if (ha->fw_dump_reading == 0) return 0; - if (off > ha->fw_dump_len) - return 0; - if (off + count > ha->fw_dump_len) - count = ha->fw_dump_len - off; - memcpy(buf, &rbuf[off], count); - - return (count); + return memory_read_from_buffer(buf, count, &off, ha->fw_dump, + ha->fw_dump_len); } static ssize_t @@ -70,6 +64,9 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj, case 2: qla2x00_alloc_fw_dump(ha); break; + case 3: + qla2x00_system_error(ha); + break; } return (count); } @@ -91,20 +88,13 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj, { struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj, struct device, kobj))); - int size = ha->nvram_size; - char *nvram_cache = ha->nvram; - if (!capable(CAP_SYS_ADMIN) || off > size || count == 0) + if (!capable(CAP_SYS_ADMIN)) return 0; - if (off + count > size) { - size -= off; - count = size; - } /* Read NVRAM data from cache. */ - memcpy(buf, &nvram_cache[off], count); - - return count; + return memory_read_from_buffer(buf, count, &off, ha->nvram, + ha->nvram_size); } static ssize_t @@ -172,14 +162,9 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj, if (ha->optrom_state != QLA_SREADING) return 0; - if (off > ha->optrom_region_size) - return 0; - if (off + count > ha->optrom_region_size) - count = ha->optrom_region_size - off; - - memcpy(buf, &ha->optrom_buffer[off], count); - return count; + return memory_read_from_buffer(buf, count, &off, ha->optrom_buffer, + ha->optrom_region_size); } static ssize_t @@ -371,20 +356,12 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj, { struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj, struct device, kobj))); - int size = ha->vpd_size; - char *vpd_cache = ha->vpd; - if (!capable(CAP_SYS_ADMIN) || off > size || count == 0) + if (!capable(CAP_SYS_ADMIN)) return 0; - if (off + count > size) { - size -= off; - count = size; - } /* Read NVRAM data from cache. */ - memcpy(buf, &vpd_cache[off], count); - - return count; + return memory_read_from_buffer(buf, count, &off, ha->vpd, ha->vpd_size); } static ssize_t @@ -530,15 +507,17 @@ qla2x00_free_sysfs_attr(scsi_qla_host_t *ha) /* Scsi_Host attributes. */ static ssize_t -qla2x00_drvr_version_show(struct class_device *cdev, char *buf) +qla2x00_drvr_version_show(struct device *dev, + struct device_attribute *attr, char *buf) { return snprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str); } static ssize_t -qla2x00_fw_version_show(struct class_device *cdev, char *buf) +qla2x00_fw_version_show(struct device *dev, + struct device_attribute *attr, char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); char fw_str[30]; return snprintf(buf, PAGE_SIZE, "%s\n", @@ -546,13 +525,16 @@ qla2x00_fw_version_show(struct class_device *cdev, char *buf) } static ssize_t -qla2x00_serial_num_show(struct class_device *cdev, char *buf) +qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); uint32_t sn; - if (IS_FWI2_CAPABLE(ha)) - return snprintf(buf, PAGE_SIZE, "\n"); + if (IS_FWI2_CAPABLE(ha)) { + qla2xxx_get_vpd_field(ha, "SN", buf, PAGE_SIZE); + return snprintf(buf, PAGE_SIZE, "%s\n", buf); + } sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1; return snprintf(buf, PAGE_SIZE, "%c%05d\n", 'A' + sn / 100000, @@ -560,40 +542,45 @@ qla2x00_serial_num_show(struct class_device *cdev, char *buf) } static ssize_t -qla2x00_isp_name_show(struct class_device *cdev, char *buf) +qla2x00_isp_name_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "ISP%04X\n", ha->pdev->device); } static ssize_t -qla2x00_isp_id_show(struct class_device *cdev, char *buf) +qla2x00_isp_id_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n", ha->product_id[0], ha->product_id[1], ha->product_id[2], ha->product_id[3]); } static ssize_t -qla2x00_model_name_show(struct class_device *cdev, char *buf) +qla2x00_model_name_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_number); } static ssize_t -qla2x00_model_desc_show(struct class_device *cdev, char *buf) +qla2x00_model_desc_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%s\n", ha->model_desc ? ha->model_desc: ""); } static ssize_t -qla2x00_pci_info_show(struct class_device *cdev, char *buf) +qla2x00_pci_info_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); char pci_info[30]; return snprintf(buf, PAGE_SIZE, "%s\n", @@ -601,9 +588,10 @@ qla2x00_pci_info_show(struct class_device *cdev, char *buf) } static ssize_t -qla2x00_state_show(struct class_device *cdev, char *buf) +qla2x00_link_state_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); int len = 0; if (atomic_read(&ha->loop_state) == LOOP_DOWN || @@ -639,9 +627,10 @@ qla2x00_state_show(struct class_device *cdev, char *buf) } static ssize_t -qla2x00_zio_show(struct class_device *cdev, char *buf) +qla2x00_zio_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); int len = 0; switch (ha->zio_mode) { @@ -656,9 +645,10 @@ qla2x00_zio_show(struct class_device *cdev, char *buf) } static ssize_t -qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) +qla2x00_zio_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); int val = 0; uint16_t zio_mode; @@ -682,18 +672,19 @@ qla2x00_zio_store(struct class_device *cdev, const char *buf, size_t count) } static ssize_t -qla2x00_zio_timer_show(struct class_device *cdev, char *buf) +qla2x00_zio_timer_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%d us\n", ha->zio_timer * 100); } static ssize_t -qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, - size_t count) +qla2x00_zio_timer_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); int val = 0; uint16_t zio_timer; @@ -709,9 +700,10 @@ qla2x00_zio_timer_store(struct class_device *cdev, const char *buf, } static ssize_t -qla2x00_beacon_show(struct class_device *cdev, char *buf) +qla2x00_beacon_show(struct device *dev, struct device_attribute *attr, + char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); int len = 0; if (ha->beacon_blink_led) @@ -722,10 +714,10 @@ qla2x00_beacon_show(struct class_device *cdev, char *buf) } static ssize_t -qla2x00_beacon_store(struct class_device *cdev, const char *buf, - size_t count) +qla2x00_beacon_store(struct device *dev, struct device_attribute *attr, + const char *buf, size_t count) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); int val = 0; int rval; @@ -753,84 +745,99 @@ qla2x00_beacon_store(struct class_device *cdev, const char *buf, } static ssize_t -qla2x00_optrom_bios_version_show(struct class_device *cdev, char *buf) +qla2x00_optrom_bios_version_show(struct device *dev, + struct device_attribute *attr, char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1], ha->bios_revision[0]); } static ssize_t -qla2x00_optrom_efi_version_show(struct class_device *cdev, char *buf) +qla2x00_optrom_efi_version_show(struct device *dev, + struct device_attribute *attr, char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1], ha->efi_revision[0]); } static ssize_t -qla2x00_optrom_fcode_version_show(struct class_device *cdev, char *buf) +qla2x00_optrom_fcode_version_show(struct device *dev, + struct device_attribute *attr, char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1], ha->fcode_revision[0]); } static ssize_t -qla2x00_optrom_fw_version_show(struct class_device *cdev, char *buf) +qla2x00_optrom_fw_version_show(struct device *dev, + struct device_attribute *attr, char *buf) { - scsi_qla_host_t *ha = shost_priv(class_to_shost(cdev)); + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); return snprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n", ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2], ha->fw_revision[3]); } -static CLASS_DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, - NULL); -static CLASS_DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); -static CLASS_DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); -static CLASS_DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); -static CLASS_DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); -static CLASS_DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); -static CLASS_DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); -static CLASS_DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); -static CLASS_DEVICE_ATTR(state, S_IRUGO, qla2x00_state_show, NULL); -static CLASS_DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, - qla2x00_zio_store); -static CLASS_DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, - qla2x00_zio_timer_store); -static CLASS_DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, - qla2x00_beacon_store); -static CLASS_DEVICE_ATTR(optrom_bios_version, S_IRUGO, - qla2x00_optrom_bios_version_show, NULL); -static CLASS_DEVICE_ATTR(optrom_efi_version, S_IRUGO, - qla2x00_optrom_efi_version_show, NULL); -static CLASS_DEVICE_ATTR(optrom_fcode_version, S_IRUGO, - qla2x00_optrom_fcode_version_show, NULL); -static CLASS_DEVICE_ATTR(optrom_fw_version, S_IRUGO, - qla2x00_optrom_fw_version_show, NULL); - -struct class_device_attribute *qla2x00_host_attrs[] = { - &class_device_attr_driver_version, - &class_device_attr_fw_version, - &class_device_attr_serial_num, - &class_device_attr_isp_name, - &class_device_attr_isp_id, - &class_device_attr_model_name, - &class_device_attr_model_desc, - &class_device_attr_pci_info, - &class_device_attr_state, - &class_device_attr_zio, - &class_device_attr_zio_timer, - &class_device_attr_beacon, - &class_device_attr_optrom_bios_version, - &class_device_attr_optrom_efi_version, - &class_device_attr_optrom_fcode_version, - &class_device_attr_optrom_fw_version, +static ssize_t +qla2x00_total_isp_aborts_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + scsi_qla_host_t *ha = shost_priv(class_to_shost(dev)); + + return snprintf(buf, PAGE_SIZE, "%d\n", + ha->qla_stats.total_isp_aborts); +} + +static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL); +static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL); +static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL); +static DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL); +static DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL); +static DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL); +static DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL); +static DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL); +static DEVICE_ATTR(link_state, S_IRUGO, qla2x00_link_state_show, NULL); +static DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, qla2x00_zio_store); +static DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show, + qla2x00_zio_timer_store); +static DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show, + qla2x00_beacon_store); +static DEVICE_ATTR(optrom_bios_version, S_IRUGO, + qla2x00_optrom_bios_version_show, NULL); +static DEVICE_ATTR(optrom_efi_version, S_IRUGO, + qla2x00_optrom_efi_version_show, NULL); +static DEVICE_ATTR(optrom_fcode_version, S_IRUGO, + qla2x00_optrom_fcode_version_show, NULL); +static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show, + NULL); +static DEVICE_ATTR(total_isp_aborts, S_IRUGO, qla2x00_total_isp_aborts_show, + NULL); + +struct device_attribute *qla2x00_host_attrs[] = { + &dev_attr_driver_version, + &dev_attr_fw_version, + &dev_attr_serial_num, + &dev_attr_isp_name, + &dev_attr_isp_id, + &dev_attr_model_name, + &dev_attr_model_desc, + &dev_attr_pci_info, + &dev_attr_link_state, + &dev_attr_zio, + &dev_attr_zio_timer, + &dev_attr_beacon, + &dev_attr_optrom_bios_version, + &dev_attr_optrom_efi_version, + &dev_attr_optrom_fcode_version, + &dev_attr_optrom_fw_version, + &dev_attr_total_isp_aborts, NULL, }; @@ -848,18 +855,21 @@ qla2x00_get_host_port_id(struct Scsi_Host *shost) static void qla2x00_get_host_speed(struct Scsi_Host *shost) { - scsi_qla_host_t *ha = shost_priv(shost); - uint32_t speed = 0; + scsi_qla_host_t *ha = to_qla_parent(shost_priv(shost)); + u32 speed = FC_PORTSPEED_UNKNOWN; switch (ha->link_data_rate) { case PORT_SPEED_1GB: - speed = 1; + speed = FC_PORTSPEED_1GBIT; break; case PORT_SPEED_2GB: - speed = 2; + speed = FC_PORTSPEED_2GBIT; break; case PORT_SPEED_4GB: - speed = 4; + speed = FC_PORTSPEED_4GBIT; + break; + case PORT_SPEED_8GB: + speed = FC_PORTSPEED_8GBIT; break; } fc_host_speed(shost) = speed; @@ -871,6 +881,10 @@ qla2x00_get_host_port_type(struct Scsi_Host *shost) scsi_qla_host_t *ha = shost_priv(shost); uint32_t port_type = FC_PORTTYPE_UNKNOWN; + if (ha->parent) { + fc_host_port_type(shost) = FC_PORTTYPE_NPIV; + return; + } switch (ha->current_topology) { case ISP_CFG_NL: port_type = FC_PORTTYPE_LPORT; @@ -897,7 +911,8 @@ qla2x00_get_starget_node_name(struct scsi_target *starget) u64 node_name = 0; list_for_each_entry(fcport, &ha->fcports, list) { - if (starget->id == fcport->os_target_id) { + if (fcport->rport && + starget->id == fcport->rport->scsi_target_id) { node_name = wwn_to_u64(fcport->node_name); break; } @@ -915,7 +930,8 @@ qla2x00_get_starget_port_name(struct scsi_target *starget) u64 port_name = 0; list_for_each_entry(fcport, &ha->fcports, list) { - if (starget->id == fcport->os_target_id) { + if (fcport->rport && + starget->id == fcport->rport->scsi_target_id) { port_name = wwn_to_u64(fcport->port_name); break; } @@ -933,7 +949,8 @@ qla2x00_get_starget_port_id(struct scsi_target *starget) uint32_t port_id = ~0U; list_for_each_entry(fcport, &ha->fcports, list) { - if (starget->id == fcport->os_target_id) { + if (fcport->rport && + starget->id == fcport->rport->scsi_target_id) { port_id = fcport->d_id.b.domain << 16 | fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa; break; @@ -944,26 +961,39 @@ qla2x00_get_starget_port_id(struct scsi_target *starget) } static void -qla2x00_get_rport_loss_tmo(struct fc_rport *rport) +qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) { - struct Scsi_Host *host = rport_to_shost(rport); - scsi_qla_host_t *ha = shost_priv(host); - - rport->dev_loss_tmo = ha->port_down_retry_count + 5; + if (timeout) + rport->dev_loss_tmo = timeout; + else + rport->dev_loss_tmo = 1; } static void -qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) +qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport) { struct Scsi_Host *host = rport_to_shost(rport); - scsi_qla_host_t *ha = shost_priv(host); + fc_port_t *fcport = *(fc_port_t **)rport->dd_data; + + qla2x00_abort_fcport_cmds(fcport); + + /* + * Transport has effectively 'deleted' the rport, clear + * all local references. + */ + spin_lock_irq(host->host_lock); + fcport->rport = NULL; + *((fc_port_t **)rport->dd_data) = NULL; + spin_unlock_irq(host->host_lock); +} - if (timeout) - ha->port_down_retry_count = timeout; - else - ha->port_down_retry_count = 1; +static void +qla2x00_terminate_rport_io(struct fc_rport *rport) +{ + fc_port_t *fcport = *(fc_port_t **)rport->dd_data; - rport->dev_loss_tmo = ha->port_down_retry_count + 5; + qla2x00_abort_fcport_cmds(fcport); + scsi_target_unblock(&rport->dev); } static int @@ -978,7 +1008,7 @@ qla2x00_issue_lip(struct Scsi_Host *shost) static struct fc_host_statistics * qla2x00_get_fc_host_stats(struct Scsi_Host *shost) { - scsi_qla_host_t *ha = shost_priv(shost); + scsi_qla_host_t *ha = to_qla_parent(shost_priv(shost)); int rval; struct link_statistics *stats; dma_addr_t stats_dma; @@ -1017,6 +1047,7 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost) pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt; pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt; if (IS_FWI2_CAPABLE(ha)) { + pfc_host_stat->lip_count = stats->lip_cnt; pfc_host_stat->tx_frames = stats->tx_frames; pfc_host_stat->rx_frames = stats->rx_frames; pfc_host_stat->dumped_frames = stats->dumped_frames; @@ -1062,7 +1093,7 @@ qla2x00_get_host_fabric_name(struct Scsi_Host *shost) static void qla2x00_get_host_port_state(struct Scsi_Host *shost) { - scsi_qla_host_t *ha = shost_priv(shost); + scsi_qla_host_t *ha = to_qla_parent(shost_priv(shost)); if (!ha->flags.online) fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; @@ -1145,17 +1176,16 @@ vport_create_failed_2: static int qla24xx_vport_delete(struct fc_vport *fc_vport) { - scsi_qla_host_t *ha = shost_priv(fc_vport->shost); scsi_qla_host_t *vha = fc_vport->dd_data; + scsi_qla_host_t *pha = to_qla_parent(vha); + + while (test_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags) || + test_bit(FCPORT_UPDATE_NEEDED, &pha->dpc_flags)) + msleep(1000); qla24xx_disable_vp(vha); qla24xx_deallocate_vp_id(vha); - down(&ha->vport_sem); - ha->cur_vport_count--; - clear_bit(vha->vp_idx, ha->vp_idx_map); - up(&ha->vport_sem); - kfree(vha->node_name); kfree(vha->port_name); @@ -1193,6 +1223,7 @@ struct fc_function_template qla2xxx_transport_functions = { .show_host_node_name = 1, .show_host_port_name = 1, .show_host_supported_classes = 1, + .show_host_supported_speeds = 1, .get_host_port_id = qla2x00_get_host_port_id, .show_host_port_id = 1, @@ -1219,11 +1250,12 @@ struct fc_function_template qla2xxx_transport_functions = { .get_starget_port_id = qla2x00_get_starget_port_id, .show_starget_port_id = 1, - .get_rport_dev_loss_tmo = qla2x00_get_rport_loss_tmo, .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo, .show_rport_dev_loss_tmo = 1, .issue_fc_host_lip = qla2x00_issue_lip, + .dev_loss_tmo_callbk = qla2x00_dev_loss_tmo_callbk, + .terminate_rport_io = qla2x00_terminate_rport_io, .get_fc_host_stats = qla2x00_get_fc_host_stats, .vport_create = qla24xx_vport_create, @@ -1262,20 +1294,35 @@ struct fc_function_template qla2xxx_transport_vport_functions = { .get_starget_port_id = qla2x00_get_starget_port_id, .show_starget_port_id = 1, - .get_rport_dev_loss_tmo = qla2x00_get_rport_loss_tmo, .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo, .show_rport_dev_loss_tmo = 1, .issue_fc_host_lip = qla2x00_issue_lip, + .dev_loss_tmo_callbk = qla2x00_dev_loss_tmo_callbk, + .terminate_rport_io = qla2x00_terminate_rport_io, .get_fc_host_stats = qla2x00_get_fc_host_stats, }; void qla2x00_init_host_attr(scsi_qla_host_t *ha) { + u32 speed = FC_PORTSPEED_UNKNOWN; + fc_host_node_name(ha->host) = wwn_to_u64(ha->node_name); fc_host_port_name(ha->host) = wwn_to_u64(ha->port_name); fc_host_supported_classes(ha->host) = FC_COS_CLASS3; fc_host_max_npiv_vports(ha->host) = ha->max_npiv_vports;; fc_host_npiv_vports_inuse(ha->host) = ha->cur_vport_count; + + if (IS_QLA25XX(ha)) + speed = FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT | + FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT; + else if (IS_QLA24XX_TYPE(ha)) + speed = FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT | + FC_PORTSPEED_1GBIT; + else if (IS_QLA23XX(ha)) + speed = FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT; + else + speed = FC_PORTSPEED_1GBIT; + fc_host_supported_speeds(ha->host) = speed; }