2 * QLogic Fibre Channel HBA Driver
3 * Copyright (c) 2003-2013 QLogic Corporation
5 * See LICENSE.qla2xxx for copyright and licensing details.
8 #include "qla_target.h"
10 #include <linux/kthread.h>
11 #include <linux/vmalloc.h>
12 #include <linux/slab.h>
13 #include <linux/delay.h>
15 static int qla24xx_vport_disable(struct fc_vport *, bool);
17 /* SYSFS attributes --------------------------------------------------------- */
20 qla2x00_sysfs_read_fw_dump(struct file *filp, struct kobject *kobj,
21 struct bin_attribute *bin_attr,
22 char *buf, loff_t off, size_t count)
24 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
25 struct device, kobj)));
26 struct qla_hw_data *ha = vha->hw;
29 if (!(ha->fw_dump_reading || ha->mctp_dump_reading))
32 if (IS_P3P_TYPE(ha)) {
33 if (off < ha->md_template_size) {
34 rval = memory_read_from_buffer(buf, count,
35 &off, ha->md_tmplt_hdr, ha->md_template_size);
38 off -= ha->md_template_size;
39 rval = memory_read_from_buffer(buf, count,
40 &off, ha->md_dump, ha->md_dump_size);
42 } else if (ha->mctp_dumped && ha->mctp_dump_reading)
43 return memory_read_from_buffer(buf, count, &off, ha->mctp_dump,
45 else if (ha->fw_dump_reading)
46 return memory_read_from_buffer(buf, count, &off, ha->fw_dump,
53 qla2x00_sysfs_write_fw_dump(struct file *filp, struct kobject *kobj,
54 struct bin_attribute *bin_attr,
55 char *buf, loff_t off, size_t count)
57 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
58 struct device, kobj)));
59 struct qla_hw_data *ha = vha->hw;
65 reading = simple_strtol(buf, NULL, 10);
68 if (!ha->fw_dump_reading)
71 ql_log(ql_log_info, vha, 0x705d,
72 "Firmware dump cleared on (%ld).\n", vha->host_no);
74 if (IS_P3P_TYPE(ha)) {
78 ha->fw_dump_reading = 0;
82 if (ha->fw_dumped && !ha->fw_dump_reading) {
83 ha->fw_dump_reading = 1;
85 ql_log(ql_log_info, vha, 0x705e,
86 "Raw firmware dump ready for read on (%ld).\n",
91 qla2x00_alloc_fw_dump(vha);
96 qla82xx_set_reset_owner(vha);
97 qla82xx_idc_unlock(ha);
98 } else if (IS_QLA8044(ha)) {
100 qla82xx_set_reset_owner(vha);
101 qla8044_idc_unlock(ha);
103 qla2x00_system_error(vha);
106 if (IS_P3P_TYPE(ha)) {
107 if (ha->md_tmplt_hdr)
108 ql_dbg(ql_dbg_user, vha, 0x705b,
109 "MiniDump supported with this firmware.\n");
111 ql_dbg(ql_dbg_user, vha, 0x709d,
112 "MiniDump not supported with this firmware.\n");
117 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
120 if (!ha->mctp_dump_reading)
122 ql_log(ql_log_info, vha, 0x70c1,
123 "MCTP dump cleared on (%ld).\n", vha->host_no);
124 ha->mctp_dump_reading = 0;
128 if (ha->mctp_dumped && !ha->mctp_dump_reading) {
129 ha->mctp_dump_reading = 1;
130 ql_log(ql_log_info, vha, 0x70c2,
131 "Raw mctp dump ready for read on (%ld).\n",
139 static struct bin_attribute sysfs_fw_dump_attr = {
142 .mode = S_IRUSR | S_IWUSR,
145 .read = qla2x00_sysfs_read_fw_dump,
146 .write = qla2x00_sysfs_write_fw_dump,
150 qla2x00_sysfs_read_nvram(struct file *filp, struct kobject *kobj,
151 struct bin_attribute *bin_attr,
152 char *buf, loff_t off, size_t count)
154 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
155 struct device, kobj)));
156 struct qla_hw_data *ha = vha->hw;
158 if (!capable(CAP_SYS_ADMIN))
161 if (IS_NOCACHE_VPD_TYPE(ha))
162 ha->isp_ops->read_optrom(vha, ha->nvram, ha->flt_region_nvram << 2,
164 return memory_read_from_buffer(buf, count, &off, ha->nvram,
169 qla2x00_sysfs_write_nvram(struct file *filp, struct kobject *kobj,
170 struct bin_attribute *bin_attr,
171 char *buf, loff_t off, size_t count)
173 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
174 struct device, kobj)));
175 struct qla_hw_data *ha = vha->hw;
178 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->nvram_size ||
179 !ha->isp_ops->write_nvram)
182 /* Checksum NVRAM. */
183 if (IS_FWI2_CAPABLE(ha)) {
187 iter = (uint32_t *)buf;
189 for (cnt = 0; cnt < ((count >> 2) - 1); cnt++)
190 chksum += le32_to_cpu(*iter++);
191 chksum = ~chksum + 1;
192 *iter = cpu_to_le32(chksum);
197 iter = (uint8_t *)buf;
199 for (cnt = 0; cnt < count - 1; cnt++)
201 chksum = ~chksum + 1;
205 if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
206 ql_log(ql_log_warn, vha, 0x705f,
207 "HBA not online, failing NVRAM update.\n");
212 ha->isp_ops->write_nvram(vha, (uint8_t *)buf, ha->nvram_base, count);
213 ha->isp_ops->read_nvram(vha, (uint8_t *)ha->nvram, ha->nvram_base,
216 ql_dbg(ql_dbg_user, vha, 0x7060,
217 "Setting ISP_ABORT_NEEDED\n");
218 /* NVRAM settings take effect immediately. */
219 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
220 qla2xxx_wake_dpc(vha);
221 qla2x00_wait_for_chip_reset(vha);
226 static struct bin_attribute sysfs_nvram_attr = {
229 .mode = S_IRUSR | S_IWUSR,
232 .read = qla2x00_sysfs_read_nvram,
233 .write = qla2x00_sysfs_write_nvram,
237 qla2x00_sysfs_read_optrom(struct file *filp, struct kobject *kobj,
238 struct bin_attribute *bin_attr,
239 char *buf, loff_t off, size_t count)
241 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
242 struct device, kobj)));
243 struct qla_hw_data *ha = vha->hw;
246 if (ha->optrom_state != QLA_SREADING)
249 mutex_lock(&ha->optrom_mutex);
250 rval = memory_read_from_buffer(buf, count, &off, ha->optrom_buffer,
251 ha->optrom_region_size);
252 mutex_unlock(&ha->optrom_mutex);
258 qla2x00_sysfs_write_optrom(struct file *filp, struct kobject *kobj,
259 struct bin_attribute *bin_attr,
260 char *buf, loff_t off, size_t count)
262 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
263 struct device, kobj)));
264 struct qla_hw_data *ha = vha->hw;
266 if (ha->optrom_state != QLA_SWRITING)
268 if (off > ha->optrom_region_size)
270 if (off + count > ha->optrom_region_size)
271 count = ha->optrom_region_size - off;
273 mutex_lock(&ha->optrom_mutex);
274 memcpy(&ha->optrom_buffer[off], buf, count);
275 mutex_unlock(&ha->optrom_mutex);
280 static struct bin_attribute sysfs_optrom_attr = {
283 .mode = S_IRUSR | S_IWUSR,
286 .read = qla2x00_sysfs_read_optrom,
287 .write = qla2x00_sysfs_write_optrom,
291 qla2x00_sysfs_write_optrom_ctl(struct file *filp, struct kobject *kobj,
292 struct bin_attribute *bin_attr,
293 char *buf, loff_t off, size_t count)
295 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
296 struct device, kobj)));
297 struct qla_hw_data *ha = vha->hw;
299 uint32_t size = ha->optrom_size;
301 ssize_t rval = count;
306 if (unlikely(pci_channel_offline(ha->pdev)))
309 if (sscanf(buf, "%d:%x:%x", &val, &start, &size) < 1)
311 if (start > ha->optrom_size)
314 mutex_lock(&ha->optrom_mutex);
317 if (ha->optrom_state != QLA_SREADING &&
318 ha->optrom_state != QLA_SWRITING) {
322 ha->optrom_state = QLA_SWAITING;
324 ql_dbg(ql_dbg_user, vha, 0x7061,
325 "Freeing flash region allocation -- 0x%x bytes.\n",
326 ha->optrom_region_size);
328 vfree(ha->optrom_buffer);
329 ha->optrom_buffer = NULL;
332 if (ha->optrom_state != QLA_SWAITING) {
337 ha->optrom_region_start = start;
338 ha->optrom_region_size = start + size > ha->optrom_size ?
339 ha->optrom_size - start : size;
341 ha->optrom_state = QLA_SREADING;
342 ha->optrom_buffer = vmalloc(ha->optrom_region_size);
343 if (ha->optrom_buffer == NULL) {
344 ql_log(ql_log_warn, vha, 0x7062,
345 "Unable to allocate memory for optrom retrieval "
346 "(%x).\n", ha->optrom_region_size);
348 ha->optrom_state = QLA_SWAITING;
353 if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
354 ql_log(ql_log_warn, vha, 0x7063,
355 "HBA not online, failing NVRAM update.\n");
360 ql_dbg(ql_dbg_user, vha, 0x7064,
361 "Reading flash region -- 0x%x/0x%x.\n",
362 ha->optrom_region_start, ha->optrom_region_size);
364 memset(ha->optrom_buffer, 0, ha->optrom_region_size);
365 ha->isp_ops->read_optrom(vha, ha->optrom_buffer,
366 ha->optrom_region_start, ha->optrom_region_size);
369 if (ha->optrom_state != QLA_SWAITING) {
375 * We need to be more restrictive on which FLASH regions are
376 * allowed to be updated via user-space. Regions accessible
377 * via this method include:
379 * ISP21xx/ISP22xx/ISP23xx type boards:
381 * 0x000000 -> 0x020000 -- Boot code.
383 * ISP2322/ISP24xx type boards:
385 * 0x000000 -> 0x07ffff -- Boot code.
386 * 0x080000 -> 0x0fffff -- Firmware.
388 * ISP25xx type boards:
390 * 0x000000 -> 0x07ffff -- Boot code.
391 * 0x080000 -> 0x0fffff -- Firmware.
392 * 0x120000 -> 0x12ffff -- VPD and HBA parameters.
395 if (ha->optrom_size == OPTROM_SIZE_2300 && start == 0)
397 else if (start == (ha->flt_region_boot * 4) ||
398 start == (ha->flt_region_fw * 4))
400 else if (IS_QLA24XX_TYPE(ha) || IS_QLA25XX(ha)
401 || IS_CNA_CAPABLE(ha) || IS_QLA2031(ha))
404 ql_log(ql_log_warn, vha, 0x7065,
405 "Invalid start region 0x%x/0x%x.\n", start, size);
410 ha->optrom_region_start = start;
411 ha->optrom_region_size = start + size > ha->optrom_size ?
412 ha->optrom_size - start : size;
414 ha->optrom_state = QLA_SWRITING;
415 ha->optrom_buffer = vmalloc(ha->optrom_region_size);
416 if (ha->optrom_buffer == NULL) {
417 ql_log(ql_log_warn, vha, 0x7066,
418 "Unable to allocate memory for optrom update "
419 "(%x)\n", ha->optrom_region_size);
421 ha->optrom_state = QLA_SWAITING;
426 ql_dbg(ql_dbg_user, vha, 0x7067,
427 "Staging flash region write -- 0x%x/0x%x.\n",
428 ha->optrom_region_start, ha->optrom_region_size);
430 memset(ha->optrom_buffer, 0, ha->optrom_region_size);
433 if (ha->optrom_state != QLA_SWRITING) {
438 if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
439 ql_log(ql_log_warn, vha, 0x7068,
440 "HBA not online, failing flash update.\n");
445 ql_dbg(ql_dbg_user, vha, 0x7069,
446 "Writing flash region -- 0x%x/0x%x.\n",
447 ha->optrom_region_start, ha->optrom_region_size);
449 ha->isp_ops->write_optrom(vha, ha->optrom_buffer,
450 ha->optrom_region_start, ha->optrom_region_size);
457 mutex_unlock(&ha->optrom_mutex);
461 static struct bin_attribute sysfs_optrom_ctl_attr = {
463 .name = "optrom_ctl",
467 .write = qla2x00_sysfs_write_optrom_ctl,
471 qla2x00_sysfs_read_vpd(struct file *filp, struct kobject *kobj,
472 struct bin_attribute *bin_attr,
473 char *buf, loff_t off, size_t count)
475 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
476 struct device, kobj)));
477 struct qla_hw_data *ha = vha->hw;
479 if (unlikely(pci_channel_offline(ha->pdev)))
482 if (!capable(CAP_SYS_ADMIN))
485 if (IS_NOCACHE_VPD_TYPE(ha))
486 ha->isp_ops->read_optrom(vha, ha->vpd, ha->flt_region_vpd << 2,
488 return memory_read_from_buffer(buf, count, &off, ha->vpd, ha->vpd_size);
492 qla2x00_sysfs_write_vpd(struct file *filp, struct kobject *kobj,
493 struct bin_attribute *bin_attr,
494 char *buf, loff_t off, size_t count)
496 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
497 struct device, kobj)));
498 struct qla_hw_data *ha = vha->hw;
501 if (unlikely(pci_channel_offline(ha->pdev)))
504 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != ha->vpd_size ||
505 !ha->isp_ops->write_nvram)
508 if (qla2x00_wait_for_hba_online(vha) != QLA_SUCCESS) {
509 ql_log(ql_log_warn, vha, 0x706a,
510 "HBA not online, failing VPD update.\n");
515 ha->isp_ops->write_nvram(vha, (uint8_t *)buf, ha->vpd_base, count);
516 ha->isp_ops->read_nvram(vha, (uint8_t *)ha->vpd, ha->vpd_base, count);
518 /* Update flash version information for 4Gb & above. */
519 if (!IS_FWI2_CAPABLE(ha))
522 tmp_data = vmalloc(256);
524 ql_log(ql_log_warn, vha, 0x706b,
525 "Unable to allocate memory for VPD information update.\n");
528 ha->isp_ops->get_flash_version(vha, tmp_data);
534 static struct bin_attribute sysfs_vpd_attr = {
537 .mode = S_IRUSR | S_IWUSR,
540 .read = qla2x00_sysfs_read_vpd,
541 .write = qla2x00_sysfs_write_vpd,
545 qla2x00_sysfs_read_sfp(struct file *filp, struct kobject *kobj,
546 struct bin_attribute *bin_attr,
547 char *buf, loff_t off, size_t count)
549 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
550 struct device, kobj)));
551 struct qla_hw_data *ha = vha->hw;
552 uint16_t iter, addr, offset;
555 if (!capable(CAP_SYS_ADMIN) || off != 0 || count != SFP_DEV_SIZE * 2)
561 ha->sfp_data = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL,
564 ql_log(ql_log_warn, vha, 0x706c,
565 "Unable to allocate memory for SFP read-data.\n");
570 memset(ha->sfp_data, 0, SFP_BLOCK_SIZE);
572 for (iter = 0, offset = 0; iter < (SFP_DEV_SIZE * 2) / SFP_BLOCK_SIZE;
573 iter++, offset += SFP_BLOCK_SIZE) {
575 /* Skip to next device address. */
580 rval = qla2x00_read_sfp(vha, ha->sfp_data_dma, ha->sfp_data,
581 addr, offset, SFP_BLOCK_SIZE, 0);
582 if (rval != QLA_SUCCESS) {
583 ql_log(ql_log_warn, vha, 0x706d,
584 "Unable to read SFP data (%x/%x/%x).\n", rval,
589 memcpy(buf, ha->sfp_data, SFP_BLOCK_SIZE);
590 buf += SFP_BLOCK_SIZE;
596 static struct bin_attribute sysfs_sfp_attr = {
599 .mode = S_IRUSR | S_IWUSR,
601 .size = SFP_DEV_SIZE * 2,
602 .read = qla2x00_sysfs_read_sfp,
606 qla2x00_sysfs_write_reset(struct file *filp, struct kobject *kobj,
607 struct bin_attribute *bin_attr,
608 char *buf, loff_t off, size_t count)
610 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
611 struct device, kobj)));
612 struct qla_hw_data *ha = vha->hw;
613 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
615 uint32_t idc_control;
616 uint8_t *tmp_data = NULL;
620 type = simple_strtol(buf, NULL, 10);
623 ql_log(ql_log_info, vha, 0x706e,
624 "Issuing ISP reset.\n");
626 scsi_block_requests(vha->host);
627 if (IS_QLA82XX(ha)) {
628 ha->flags.isp82xx_no_md_cap = 1;
629 qla82xx_idc_lock(ha);
630 qla82xx_set_reset_owner(vha);
631 qla82xx_idc_unlock(ha);
632 } else if (IS_QLA8044(ha)) {
633 qla8044_idc_lock(ha);
634 idc_control = qla8044_rd_reg(ha,
635 QLA8044_IDC_DRV_CTRL);
636 qla8044_wr_reg(ha, QLA8044_IDC_DRV_CTRL,
637 (idc_control | GRACEFUL_RESET_BIT1));
638 qla82xx_set_reset_owner(vha);
639 qla8044_idc_unlock(ha);
641 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
642 qla2xxx_wake_dpc(vha);
644 qla2x00_wait_for_chip_reset(vha);
645 scsi_unblock_requests(vha->host);
648 if (!IS_QLA81XX(ha) && !IS_QLA83XX(ha))
651 ql_log(ql_log_info, vha, 0x706f,
652 "Issuing MPI reset.\n");
654 if (IS_QLA83XX(ha)) {
655 uint32_t idc_control;
657 qla83xx_idc_lock(vha, 0);
658 __qla83xx_get_idc_control(vha, &idc_control);
659 idc_control |= QLA83XX_IDC_GRACEFUL_RESET;
660 __qla83xx_set_idc_control(vha, idc_control);
661 qla83xx_wr_reg(vha, QLA83XX_IDC_DEV_STATE,
662 QLA8XXX_DEV_NEED_RESET);
663 qla83xx_idc_audit(vha, IDC_AUDIT_TIMESTAMP);
664 qla83xx_idc_unlock(vha, 0);
667 /* Make sure FC side is not in reset */
668 qla2x00_wait_for_hba_online(vha);
670 /* Issue MPI reset */
671 scsi_block_requests(vha->host);
672 if (qla81xx_restart_mpi_firmware(vha) != QLA_SUCCESS)
673 ql_log(ql_log_warn, vha, 0x7070,
674 "MPI reset failed.\n");
675 scsi_unblock_requests(vha->host);
679 if (!IS_P3P_TYPE(ha) || vha != base_vha) {
680 ql_log(ql_log_info, vha, 0x7071,
681 "FCoE ctx reset no supported.\n");
685 ql_log(ql_log_info, vha, 0x7072,
686 "Issuing FCoE ctx reset.\n");
687 set_bit(FCOE_CTX_RESET_NEEDED, &vha->dpc_flags);
688 qla2xxx_wake_dpc(vha);
689 qla2x00_wait_for_fcoe_ctx_reset(vha);
694 ql_log(ql_log_info, vha, 0x70bc,
695 "Disabling Reset by IDC control\n");
696 qla83xx_idc_lock(vha, 0);
697 __qla83xx_get_idc_control(vha, &idc_control);
698 idc_control |= QLA83XX_IDC_RESET_DISABLED;
699 __qla83xx_set_idc_control(vha, idc_control);
700 qla83xx_idc_unlock(vha, 0);
705 ql_log(ql_log_info, vha, 0x70bd,
706 "Enabling Reset by IDC control\n");
707 qla83xx_idc_lock(vha, 0);
708 __qla83xx_get_idc_control(vha, &idc_control);
709 idc_control &= ~QLA83XX_IDC_RESET_DISABLED;
710 __qla83xx_set_idc_control(vha, idc_control);
711 qla83xx_idc_unlock(vha, 0);
714 ql_dbg(ql_dbg_user, vha, 0x70e0,
715 "Updating cache versions without reset ");
717 tmp_data = vmalloc(256);
719 ql_log(ql_log_warn, vha, 0x70e1,
720 "Unable to allocate memory for VPD information update.\n");
723 ha->isp_ops->get_flash_version(vha, tmp_data);
730 static struct bin_attribute sysfs_reset_attr = {
736 .write = qla2x00_sysfs_write_reset,
740 qla2x00_sysfs_read_xgmac_stats(struct file *filp, struct kobject *kobj,
741 struct bin_attribute *bin_attr,
742 char *buf, loff_t off, size_t count)
744 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
745 struct device, kobj)));
746 struct qla_hw_data *ha = vha->hw;
748 uint16_t actual_size;
750 if (!capable(CAP_SYS_ADMIN) || off != 0 || count > XGMAC_DATA_SIZE)
756 ha->xgmac_data = dma_alloc_coherent(&ha->pdev->dev, XGMAC_DATA_SIZE,
757 &ha->xgmac_data_dma, GFP_KERNEL);
758 if (!ha->xgmac_data) {
759 ql_log(ql_log_warn, vha, 0x7076,
760 "Unable to allocate memory for XGMAC read-data.\n");
766 memset(ha->xgmac_data, 0, XGMAC_DATA_SIZE);
768 rval = qla2x00_get_xgmac_stats(vha, ha->xgmac_data_dma,
769 XGMAC_DATA_SIZE, &actual_size);
770 if (rval != QLA_SUCCESS) {
771 ql_log(ql_log_warn, vha, 0x7077,
772 "Unable to read XGMAC data (%x).\n", rval);
776 count = actual_size > count ? count: actual_size;
777 memcpy(buf, ha->xgmac_data, count);
782 static struct bin_attribute sysfs_xgmac_stats_attr = {
784 .name = "xgmac_stats",
788 .read = qla2x00_sysfs_read_xgmac_stats,
792 qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj,
793 struct bin_attribute *bin_attr,
794 char *buf, loff_t off, size_t count)
796 struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj,
797 struct device, kobj)));
798 struct qla_hw_data *ha = vha->hw;
800 uint16_t actual_size;
802 if (!capable(CAP_SYS_ADMIN) || off != 0 || count > DCBX_TLV_DATA_SIZE)
808 ha->dcbx_tlv = dma_alloc_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE,
809 &ha->dcbx_tlv_dma, GFP_KERNEL);
811 ql_log(ql_log_warn, vha, 0x7078,
812 "Unable to allocate memory for DCBX TLV read-data.\n");
818 memset(ha->dcbx_tlv, 0, DCBX_TLV_DATA_SIZE);
820 rval = qla2x00_get_dcbx_params(vha, ha->dcbx_tlv_dma,
822 if (rval != QLA_SUCCESS) {
823 ql_log(ql_log_warn, vha, 0x7079,
824 "Unable to read DCBX TLV (%x).\n", rval);
828 memcpy(buf, ha->dcbx_tlv, count);
833 static struct bin_attribute sysfs_dcbx_tlv_attr = {
839 .read = qla2x00_sysfs_read_dcbx_tlv,
842 static struct sysfs_entry {
844 struct bin_attribute *attr;
846 } bin_file_entries[] = {
847 { "fw_dump", &sysfs_fw_dump_attr, },
848 { "nvram", &sysfs_nvram_attr, },
849 { "optrom", &sysfs_optrom_attr, },
850 { "optrom_ctl", &sysfs_optrom_ctl_attr, },
851 { "vpd", &sysfs_vpd_attr, 1 },
852 { "sfp", &sysfs_sfp_attr, 1 },
853 { "reset", &sysfs_reset_attr, },
854 { "xgmac_stats", &sysfs_xgmac_stats_attr, 3 },
855 { "dcbx_tlv", &sysfs_dcbx_tlv_attr, 3 },
860 qla2x00_alloc_sysfs_attr(scsi_qla_host_t *vha)
862 struct Scsi_Host *host = vha->host;
863 struct sysfs_entry *iter;
866 for (iter = bin_file_entries; iter->name; iter++) {
867 if (iter->is4GBp_only && !IS_FWI2_CAPABLE(vha->hw))
869 if (iter->is4GBp_only == 2 && !IS_QLA25XX(vha->hw))
871 if (iter->is4GBp_only == 3 && !(IS_CNA_CAPABLE(vha->hw)))
874 ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
877 ql_log(ql_log_warn, vha, 0x00f3,
878 "Unable to create sysfs %s binary attribute (%d).\n",
881 ql_dbg(ql_dbg_init, vha, 0x00f4,
882 "Successfully created sysfs %s binary attribure.\n",
888 qla2x00_free_sysfs_attr(scsi_qla_host_t *vha, bool stop_beacon)
890 struct Scsi_Host *host = vha->host;
891 struct sysfs_entry *iter;
892 struct qla_hw_data *ha = vha->hw;
894 for (iter = bin_file_entries; iter->name; iter++) {
895 if (iter->is4GBp_only && !IS_FWI2_CAPABLE(ha))
897 if (iter->is4GBp_only == 2 && !IS_QLA25XX(ha))
899 if (iter->is4GBp_only == 3 && !(IS_CNA_CAPABLE(vha->hw)))
902 sysfs_remove_bin_file(&host->shost_gendev.kobj,
906 if (stop_beacon && ha->beacon_blink_led == 1)
907 ha->isp_ops->beacon_off(vha);
910 /* Scsi_Host attributes. */
913 qla2x00_drvr_version_show(struct device *dev,
914 struct device_attribute *attr, char *buf)
916 return scnprintf(buf, PAGE_SIZE, "%s\n", qla2x00_version_str);
920 qla2x00_fw_version_show(struct device *dev,
921 struct device_attribute *attr, char *buf)
923 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
924 struct qla_hw_data *ha = vha->hw;
927 return scnprintf(buf, PAGE_SIZE, "%s\n",
928 ha->isp_ops->fw_version_str(vha, fw_str));
932 qla2x00_serial_num_show(struct device *dev, struct device_attribute *attr,
935 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
936 struct qla_hw_data *ha = vha->hw;
939 if (IS_QLAFX00(vha->hw)) {
940 return scnprintf(buf, PAGE_SIZE, "%s\n",
941 vha->hw->mr.serial_num);
942 } else if (IS_FWI2_CAPABLE(ha)) {
943 qla2xxx_get_vpd_field(vha, "SN", buf, PAGE_SIZE - 1);
944 return strlen(strcat(buf, "\n"));
947 sn = ((ha->serial0 & 0x1f) << 16) | (ha->serial2 << 8) | ha->serial1;
948 return scnprintf(buf, PAGE_SIZE, "%c%05d\n", 'A' + sn / 100000,
953 qla2x00_isp_name_show(struct device *dev, struct device_attribute *attr,
956 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
957 return scnprintf(buf, PAGE_SIZE, "ISP%04X\n", vha->hw->pdev->device);
961 qla2x00_isp_id_show(struct device *dev, struct device_attribute *attr,
964 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
965 struct qla_hw_data *ha = vha->hw;
967 if (IS_QLAFX00(vha->hw))
968 return scnprintf(buf, PAGE_SIZE, "%s\n",
969 vha->hw->mr.hw_version);
971 return scnprintf(buf, PAGE_SIZE, "%04x %04x %04x %04x\n",
972 ha->product_id[0], ha->product_id[1], ha->product_id[2],
977 qla2x00_model_name_show(struct device *dev, struct device_attribute *attr,
980 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
982 return scnprintf(buf, PAGE_SIZE, "%s\n", vha->hw->model_number);
986 qla2x00_model_desc_show(struct device *dev, struct device_attribute *attr,
989 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
990 return scnprintf(buf, PAGE_SIZE, "%s\n",
991 vha->hw->model_desc ? vha->hw->model_desc : "");
995 qla2x00_pci_info_show(struct device *dev, struct device_attribute *attr,
998 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1001 return scnprintf(buf, PAGE_SIZE, "%s\n",
1002 vha->hw->isp_ops->pci_info_str(vha, pci_info));
1006 qla2x00_link_state_show(struct device *dev, struct device_attribute *attr,
1009 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1010 struct qla_hw_data *ha = vha->hw;
1013 if (atomic_read(&vha->loop_state) == LOOP_DOWN ||
1014 atomic_read(&vha->loop_state) == LOOP_DEAD ||
1015 vha->device_flags & DFLG_NO_CABLE)
1016 len = scnprintf(buf, PAGE_SIZE, "Link Down\n");
1017 else if (atomic_read(&vha->loop_state) != LOOP_READY ||
1018 qla2x00_reset_active(vha))
1019 len = scnprintf(buf, PAGE_SIZE, "Unknown Link State\n");
1021 len = scnprintf(buf, PAGE_SIZE, "Link Up - ");
1023 switch (ha->current_topology) {
1025 len += scnprintf(buf + len, PAGE_SIZE-len, "Loop\n");
1028 len += scnprintf(buf + len, PAGE_SIZE-len, "FL_Port\n");
1031 len += scnprintf(buf + len, PAGE_SIZE-len,
1032 "N_Port to N_Port\n");
1035 len += scnprintf(buf + len, PAGE_SIZE-len, "F_Port\n");
1038 len += scnprintf(buf + len, PAGE_SIZE-len, "Loop\n");
1046 qla2x00_zio_show(struct device *dev, struct device_attribute *attr,
1049 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1052 switch (vha->hw->zio_mode) {
1053 case QLA_ZIO_MODE_6:
1054 len += scnprintf(buf + len, PAGE_SIZE-len, "Mode 6\n");
1056 case QLA_ZIO_DISABLED:
1057 len += scnprintf(buf + len, PAGE_SIZE-len, "Disabled\n");
1064 qla2x00_zio_store(struct device *dev, struct device_attribute *attr,
1065 const char *buf, size_t count)
1067 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1068 struct qla_hw_data *ha = vha->hw;
1072 if (!IS_ZIO_SUPPORTED(ha))
1075 if (sscanf(buf, "%d", &val) != 1)
1079 zio_mode = QLA_ZIO_MODE_6;
1081 zio_mode = QLA_ZIO_DISABLED;
1083 /* Update per-hba values and queue a reset. */
1084 if (zio_mode != QLA_ZIO_DISABLED || ha->zio_mode != QLA_ZIO_DISABLED) {
1085 ha->zio_mode = zio_mode;
1086 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags);
1092 qla2x00_zio_timer_show(struct device *dev, struct device_attribute *attr,
1095 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1097 return scnprintf(buf, PAGE_SIZE, "%d us\n", vha->hw->zio_timer * 100);
1101 qla2x00_zio_timer_store(struct device *dev, struct device_attribute *attr,
1102 const char *buf, size_t count)
1104 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1108 if (sscanf(buf, "%d", &val) != 1)
1110 if (val > 25500 || val < 100)
1113 zio_timer = (uint16_t)(val / 100);
1114 vha->hw->zio_timer = zio_timer;
1120 qla2x00_beacon_show(struct device *dev, struct device_attribute *attr,
1123 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1126 if (vha->hw->beacon_blink_led)
1127 len += scnprintf(buf + len, PAGE_SIZE-len, "Enabled\n");
1129 len += scnprintf(buf + len, PAGE_SIZE-len, "Disabled\n");
1134 qla2x00_beacon_store(struct device *dev, struct device_attribute *attr,
1135 const char *buf, size_t count)
1137 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1138 struct qla_hw_data *ha = vha->hw;
1142 if (IS_QLA2100(ha) || IS_QLA2200(ha))
1145 if (test_bit(ABORT_ISP_ACTIVE, &vha->dpc_flags)) {
1146 ql_log(ql_log_warn, vha, 0x707a,
1147 "Abort ISP active -- ignoring beacon request.\n");
1151 if (sscanf(buf, "%d", &val) != 1)
1155 rval = ha->isp_ops->beacon_on(vha);
1157 rval = ha->isp_ops->beacon_off(vha);
1159 if (rval != QLA_SUCCESS)
1166 qla2x00_optrom_bios_version_show(struct device *dev,
1167 struct device_attribute *attr, char *buf)
1169 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1170 struct qla_hw_data *ha = vha->hw;
1171 return scnprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->bios_revision[1],
1172 ha->bios_revision[0]);
1176 qla2x00_optrom_efi_version_show(struct device *dev,
1177 struct device_attribute *attr, char *buf)
1179 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1180 struct qla_hw_data *ha = vha->hw;
1181 return scnprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->efi_revision[1],
1182 ha->efi_revision[0]);
1186 qla2x00_optrom_fcode_version_show(struct device *dev,
1187 struct device_attribute *attr, char *buf)
1189 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1190 struct qla_hw_data *ha = vha->hw;
1191 return scnprintf(buf, PAGE_SIZE, "%d.%02d\n", ha->fcode_revision[1],
1192 ha->fcode_revision[0]);
1196 qla2x00_optrom_fw_version_show(struct device *dev,
1197 struct device_attribute *attr, char *buf)
1199 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1200 struct qla_hw_data *ha = vha->hw;
1201 return scnprintf(buf, PAGE_SIZE, "%d.%02d.%02d %d\n",
1202 ha->fw_revision[0], ha->fw_revision[1], ha->fw_revision[2],
1203 ha->fw_revision[3]);
1207 qla2x00_optrom_gold_fw_version_show(struct device *dev,
1208 struct device_attribute *attr, char *buf)
1210 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1211 struct qla_hw_data *ha = vha->hw;
1213 if (!IS_QLA81XX(ha) && !IS_QLA83XX(ha))
1214 return scnprintf(buf, PAGE_SIZE, "\n");
1216 return scnprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%d)\n",
1217 ha->gold_fw_version[0], ha->gold_fw_version[1],
1218 ha->gold_fw_version[2], ha->gold_fw_version[3]);
1222 qla2x00_total_isp_aborts_show(struct device *dev,
1223 struct device_attribute *attr, char *buf)
1225 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1226 return scnprintf(buf, PAGE_SIZE, "%d\n",
1227 vha->qla_stats.total_isp_aborts);
1231 qla24xx_84xx_fw_version_show(struct device *dev,
1232 struct device_attribute *attr, char *buf)
1234 int rval = QLA_SUCCESS;
1235 uint16_t status[2] = {0, 0};
1236 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1237 struct qla_hw_data *ha = vha->hw;
1239 if (!IS_QLA84XX(ha))
1240 return scnprintf(buf, PAGE_SIZE, "\n");
1242 if (ha->cs84xx->op_fw_version == 0)
1243 rval = qla84xx_verify_chip(vha, status);
1245 if ((rval == QLA_SUCCESS) && (status[0] == 0))
1246 return scnprintf(buf, PAGE_SIZE, "%u\n",
1247 (uint32_t)ha->cs84xx->op_fw_version);
1249 return scnprintf(buf, PAGE_SIZE, "\n");
1253 qla2x00_mpi_version_show(struct device *dev, struct device_attribute *attr,
1256 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1257 struct qla_hw_data *ha = vha->hw;
1259 if (!IS_QLA81XX(ha) && !IS_QLA8031(ha) && !IS_QLA8044(ha))
1260 return scnprintf(buf, PAGE_SIZE, "\n");
1262 return scnprintf(buf, PAGE_SIZE, "%d.%02d.%02d (%x)\n",
1263 ha->mpi_version[0], ha->mpi_version[1], ha->mpi_version[2],
1264 ha->mpi_capabilities);
1268 qla2x00_phy_version_show(struct device *dev, struct device_attribute *attr,
1271 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1272 struct qla_hw_data *ha = vha->hw;
1274 if (!IS_QLA81XX(ha) && !IS_QLA8031(ha))
1275 return scnprintf(buf, PAGE_SIZE, "\n");
1277 return scnprintf(buf, PAGE_SIZE, "%d.%02d.%02d\n",
1278 ha->phy_version[0], ha->phy_version[1], ha->phy_version[2]);
1282 qla2x00_flash_block_size_show(struct device *dev,
1283 struct device_attribute *attr, char *buf)
1285 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1286 struct qla_hw_data *ha = vha->hw;
1288 return scnprintf(buf, PAGE_SIZE, "0x%x\n", ha->fdt_block_size);
1292 qla2x00_vlan_id_show(struct device *dev, struct device_attribute *attr,
1295 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1297 if (!IS_CNA_CAPABLE(vha->hw))
1298 return scnprintf(buf, PAGE_SIZE, "\n");
1300 return scnprintf(buf, PAGE_SIZE, "%d\n", vha->fcoe_vlan_id);
1304 qla2x00_vn_port_mac_address_show(struct device *dev,
1305 struct device_attribute *attr, char *buf)
1307 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1309 if (!IS_CNA_CAPABLE(vha->hw))
1310 return scnprintf(buf, PAGE_SIZE, "\n");
1312 return scnprintf(buf, PAGE_SIZE, "%pMR\n", vha->fcoe_vn_port_mac);
1316 qla2x00_fabric_param_show(struct device *dev, struct device_attribute *attr,
1319 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1321 return scnprintf(buf, PAGE_SIZE, "%d\n", vha->hw->switch_cap);
1325 qla2x00_thermal_temp_show(struct device *dev,
1326 struct device_attribute *attr, char *buf)
1328 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1331 if (qla2x00_reset_active(vha)) {
1332 ql_log(ql_log_warn, vha, 0x70dc, "ISP reset active.\n");
1336 if (vha->hw->flags.eeh_busy) {
1337 ql_log(ql_log_warn, vha, 0x70dd, "PCI EEH busy.\n");
1341 if (qla2x00_get_thermal_temp(vha, &temp) == QLA_SUCCESS)
1342 return scnprintf(buf, PAGE_SIZE, "%d\n", temp);
1345 return scnprintf(buf, PAGE_SIZE, "\n");
1349 qla2x00_fw_state_show(struct device *dev, struct device_attribute *attr,
1352 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1353 int rval = QLA_FUNCTION_FAILED;
1357 if (IS_QLAFX00(vha->hw)) {
1358 pstate = qlafx00_fw_state_show(dev, attr, buf);
1359 return scnprintf(buf, PAGE_SIZE, "0x%x\n", pstate);
1362 if (qla2x00_reset_active(vha))
1363 ql_log(ql_log_warn, vha, 0x707c,
1364 "ISP reset active.\n");
1365 else if (!vha->hw->flags.eeh_busy)
1366 rval = qla2x00_get_firmware_state(vha, state);
1367 if (rval != QLA_SUCCESS)
1368 memset(state, -1, sizeof(state));
1370 return scnprintf(buf, PAGE_SIZE, "0x%x 0x%x 0x%x 0x%x 0x%x\n", state[0],
1371 state[1], state[2], state[3], state[4]);
1375 qla2x00_diag_requests_show(struct device *dev,
1376 struct device_attribute *attr, char *buf)
1378 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1380 if (!IS_BIDI_CAPABLE(vha->hw))
1381 return scnprintf(buf, PAGE_SIZE, "\n");
1383 return scnprintf(buf, PAGE_SIZE, "%llu\n", vha->bidi_stats.io_count);
1387 qla2x00_diag_megabytes_show(struct device *dev,
1388 struct device_attribute *attr, char *buf)
1390 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1392 if (!IS_BIDI_CAPABLE(vha->hw))
1393 return scnprintf(buf, PAGE_SIZE, "\n");
1395 return scnprintf(buf, PAGE_SIZE, "%llu\n",
1396 vha->bidi_stats.transfer_bytes >> 20);
1400 qla2x00_fw_dump_size_show(struct device *dev, struct device_attribute *attr,
1403 scsi_qla_host_t *vha = shost_priv(class_to_shost(dev));
1404 struct qla_hw_data *ha = vha->hw;
1409 else if (IS_QLA82XX(ha))
1410 size = ha->md_template_size + ha->md_dump_size;
1412 size = ha->fw_dump_len;
1414 return scnprintf(buf, PAGE_SIZE, "%d\n", size);
1417 static DEVICE_ATTR(driver_version, S_IRUGO, qla2x00_drvr_version_show, NULL);
1418 static DEVICE_ATTR(fw_version, S_IRUGO, qla2x00_fw_version_show, NULL);
1419 static DEVICE_ATTR(serial_num, S_IRUGO, qla2x00_serial_num_show, NULL);
1420 static DEVICE_ATTR(isp_name, S_IRUGO, qla2x00_isp_name_show, NULL);
1421 static DEVICE_ATTR(isp_id, S_IRUGO, qla2x00_isp_id_show, NULL);
1422 static DEVICE_ATTR(model_name, S_IRUGO, qla2x00_model_name_show, NULL);
1423 static DEVICE_ATTR(model_desc, S_IRUGO, qla2x00_model_desc_show, NULL);
1424 static DEVICE_ATTR(pci_info, S_IRUGO, qla2x00_pci_info_show, NULL);
1425 static DEVICE_ATTR(link_state, S_IRUGO, qla2x00_link_state_show, NULL);
1426 static DEVICE_ATTR(zio, S_IRUGO | S_IWUSR, qla2x00_zio_show, qla2x00_zio_store);
1427 static DEVICE_ATTR(zio_timer, S_IRUGO | S_IWUSR, qla2x00_zio_timer_show,
1428 qla2x00_zio_timer_store);
1429 static DEVICE_ATTR(beacon, S_IRUGO | S_IWUSR, qla2x00_beacon_show,
1430 qla2x00_beacon_store);
1431 static DEVICE_ATTR(optrom_bios_version, S_IRUGO,
1432 qla2x00_optrom_bios_version_show, NULL);
1433 static DEVICE_ATTR(optrom_efi_version, S_IRUGO,
1434 qla2x00_optrom_efi_version_show, NULL);
1435 static DEVICE_ATTR(optrom_fcode_version, S_IRUGO,
1436 qla2x00_optrom_fcode_version_show, NULL);
1437 static DEVICE_ATTR(optrom_fw_version, S_IRUGO, qla2x00_optrom_fw_version_show,
1439 static DEVICE_ATTR(optrom_gold_fw_version, S_IRUGO,
1440 qla2x00_optrom_gold_fw_version_show, NULL);
1441 static DEVICE_ATTR(84xx_fw_version, S_IRUGO, qla24xx_84xx_fw_version_show,
1443 static DEVICE_ATTR(total_isp_aborts, S_IRUGO, qla2x00_total_isp_aborts_show,
1445 static DEVICE_ATTR(mpi_version, S_IRUGO, qla2x00_mpi_version_show, NULL);
1446 static DEVICE_ATTR(phy_version, S_IRUGO, qla2x00_phy_version_show, NULL);
1447 static DEVICE_ATTR(flash_block_size, S_IRUGO, qla2x00_flash_block_size_show,
1449 static DEVICE_ATTR(vlan_id, S_IRUGO, qla2x00_vlan_id_show, NULL);
1450 static DEVICE_ATTR(vn_port_mac_address, S_IRUGO,
1451 qla2x00_vn_port_mac_address_show, NULL);
1452 static DEVICE_ATTR(fabric_param, S_IRUGO, qla2x00_fabric_param_show, NULL);
1453 static DEVICE_ATTR(fw_state, S_IRUGO, qla2x00_fw_state_show, NULL);
1454 static DEVICE_ATTR(thermal_temp, S_IRUGO, qla2x00_thermal_temp_show, NULL);
1455 static DEVICE_ATTR(diag_requests, S_IRUGO, qla2x00_diag_requests_show, NULL);
1456 static DEVICE_ATTR(diag_megabytes, S_IRUGO, qla2x00_diag_megabytes_show, NULL);
1457 static DEVICE_ATTR(fw_dump_size, S_IRUGO, qla2x00_fw_dump_size_show, NULL);
1459 struct device_attribute *qla2x00_host_attrs[] = {
1460 &dev_attr_driver_version,
1461 &dev_attr_fw_version,
1462 &dev_attr_serial_num,
1465 &dev_attr_model_name,
1466 &dev_attr_model_desc,
1468 &dev_attr_link_state,
1470 &dev_attr_zio_timer,
1472 &dev_attr_optrom_bios_version,
1473 &dev_attr_optrom_efi_version,
1474 &dev_attr_optrom_fcode_version,
1475 &dev_attr_optrom_fw_version,
1476 &dev_attr_84xx_fw_version,
1477 &dev_attr_total_isp_aborts,
1478 &dev_attr_mpi_version,
1479 &dev_attr_phy_version,
1480 &dev_attr_flash_block_size,
1482 &dev_attr_vn_port_mac_address,
1483 &dev_attr_fabric_param,
1485 &dev_attr_optrom_gold_fw_version,
1486 &dev_attr_thermal_temp,
1487 &dev_attr_diag_requests,
1488 &dev_attr_diag_megabytes,
1489 &dev_attr_fw_dump_size,
1493 /* Host attributes. */
1496 qla2x00_get_host_port_id(struct Scsi_Host *shost)
1498 scsi_qla_host_t *vha = shost_priv(shost);
1500 fc_host_port_id(shost) = vha->d_id.b.domain << 16 |
1501 vha->d_id.b.area << 8 | vha->d_id.b.al_pa;
1505 qla2x00_get_host_speed(struct Scsi_Host *shost)
1507 struct qla_hw_data *ha = ((struct scsi_qla_host *)
1508 (shost_priv(shost)))->hw;
1509 u32 speed = FC_PORTSPEED_UNKNOWN;
1511 if (IS_QLAFX00(ha)) {
1512 qlafx00_get_host_speed(shost);
1516 switch (ha->link_data_rate) {
1517 case PORT_SPEED_1GB:
1518 speed = FC_PORTSPEED_1GBIT;
1520 case PORT_SPEED_2GB:
1521 speed = FC_PORTSPEED_2GBIT;
1523 case PORT_SPEED_4GB:
1524 speed = FC_PORTSPEED_4GBIT;
1526 case PORT_SPEED_8GB:
1527 speed = FC_PORTSPEED_8GBIT;
1529 case PORT_SPEED_10GB:
1530 speed = FC_PORTSPEED_10GBIT;
1532 case PORT_SPEED_16GB:
1533 speed = FC_PORTSPEED_16GBIT;
1536 fc_host_speed(shost) = speed;
1540 qla2x00_get_host_port_type(struct Scsi_Host *shost)
1542 scsi_qla_host_t *vha = shost_priv(shost);
1543 uint32_t port_type = FC_PORTTYPE_UNKNOWN;
1546 fc_host_port_type(shost) = FC_PORTTYPE_NPIV;
1549 switch (vha->hw->current_topology) {
1551 port_type = FC_PORTTYPE_LPORT;
1554 port_type = FC_PORTTYPE_NLPORT;
1557 port_type = FC_PORTTYPE_PTP;
1560 port_type = FC_PORTTYPE_NPORT;
1563 fc_host_port_type(shost) = port_type;
1567 qla2x00_get_starget_node_name(struct scsi_target *starget)
1569 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
1570 scsi_qla_host_t *vha = shost_priv(host);
1574 list_for_each_entry(fcport, &vha->vp_fcports, list) {
1575 if (fcport->rport &&
1576 starget->id == fcport->rport->scsi_target_id) {
1577 node_name = wwn_to_u64(fcport->node_name);
1582 fc_starget_node_name(starget) = node_name;
1586 qla2x00_get_starget_port_name(struct scsi_target *starget)
1588 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
1589 scsi_qla_host_t *vha = shost_priv(host);
1593 list_for_each_entry(fcport, &vha->vp_fcports, list) {
1594 if (fcport->rport &&
1595 starget->id == fcport->rport->scsi_target_id) {
1596 port_name = wwn_to_u64(fcport->port_name);
1601 fc_starget_port_name(starget) = port_name;
1605 qla2x00_get_starget_port_id(struct scsi_target *starget)
1607 struct Scsi_Host *host = dev_to_shost(starget->dev.parent);
1608 scsi_qla_host_t *vha = shost_priv(host);
1610 uint32_t port_id = ~0U;
1612 list_for_each_entry(fcport, &vha->vp_fcports, list) {
1613 if (fcport->rport &&
1614 starget->id == fcport->rport->scsi_target_id) {
1615 port_id = fcport->d_id.b.domain << 16 |
1616 fcport->d_id.b.area << 8 | fcport->d_id.b.al_pa;
1621 fc_starget_port_id(starget) = port_id;
1625 qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout)
1628 rport->dev_loss_tmo = timeout;
1630 rport->dev_loss_tmo = 1;
1634 qla2x00_dev_loss_tmo_callbk(struct fc_rport *rport)
1636 struct Scsi_Host *host = rport_to_shost(rport);
1637 fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
1638 unsigned long flags;
1643 /* Now that the rport has been deleted, set the fcport state to
1645 qla2x00_set_fcport_state(fcport, FCS_DEVICE_DEAD);
1648 * Transport has effectively 'deleted' the rport, clear
1649 * all local references.
1651 spin_lock_irqsave(host->host_lock, flags);
1652 fcport->rport = fcport->drport = NULL;
1653 *((fc_port_t **)rport->dd_data) = NULL;
1654 spin_unlock_irqrestore(host->host_lock, flags);
1656 if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
1659 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
1660 qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
1666 qla2x00_terminate_rport_io(struct fc_rport *rport)
1668 fc_port_t *fcport = *(fc_port_t **)rport->dd_data;
1673 if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags))
1676 if (unlikely(pci_channel_offline(fcport->vha->hw->pdev))) {
1677 qla2x00_abort_all_cmds(fcport->vha, DID_NO_CONNECT << 16);
1681 * At this point all fcport's software-states are cleared. Perform any
1682 * final cleanup of firmware resources (PCBs and XCBs).
1684 if (fcport->loop_id != FC_NO_LOOP_ID) {
1685 if (IS_FWI2_CAPABLE(fcport->vha->hw))
1686 fcport->vha->hw->isp_ops->fabric_logout(fcport->vha,
1687 fcport->loop_id, fcport->d_id.b.domain,
1688 fcport->d_id.b.area, fcport->d_id.b.al_pa);
1690 qla2x00_port_logout(fcport->vha, fcport);
1695 qla2x00_issue_lip(struct Scsi_Host *shost)
1697 scsi_qla_host_t *vha = shost_priv(shost);
1699 if (IS_QLAFX00(vha->hw))
1702 qla2x00_loop_reset(vha);
1706 static struct fc_host_statistics *
1707 qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
1709 scsi_qla_host_t *vha = shost_priv(shost);
1710 struct qla_hw_data *ha = vha->hw;
1711 struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
1713 struct link_statistics *stats;
1714 dma_addr_t stats_dma;
1715 struct fc_host_statistics *pfc_host_stat;
1717 pfc_host_stat = &vha->fc_host_stat;
1718 memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
1720 if (IS_QLAFX00(vha->hw))
1723 if (test_bit(UNLOADING, &vha->dpc_flags))
1726 if (unlikely(pci_channel_offline(ha->pdev)))
1729 if (qla2x00_reset_active(vha))
1732 stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma);
1733 if (stats == NULL) {
1734 ql_log(ql_log_warn, vha, 0x707d,
1735 "Failed to allocate memory for stats.\n");
1738 memset(stats, 0, DMA_POOL_SIZE);
1740 rval = QLA_FUNCTION_FAILED;
1741 if (IS_FWI2_CAPABLE(ha)) {
1742 rval = qla24xx_get_isp_stats(base_vha, stats, stats_dma);
1743 } else if (atomic_read(&base_vha->loop_state) == LOOP_READY &&
1745 /* Must be in a 'READY' state for statistics retrieval. */
1746 rval = qla2x00_get_link_status(base_vha, base_vha->loop_id,
1750 if (rval != QLA_SUCCESS)
1753 pfc_host_stat->link_failure_count = stats->link_fail_cnt;
1754 pfc_host_stat->loss_of_sync_count = stats->loss_sync_cnt;
1755 pfc_host_stat->loss_of_signal_count = stats->loss_sig_cnt;
1756 pfc_host_stat->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
1757 pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt;
1758 pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt;
1759 if (IS_FWI2_CAPABLE(ha)) {
1760 pfc_host_stat->lip_count = stats->lip_cnt;
1761 pfc_host_stat->tx_frames = stats->tx_frames;
1762 pfc_host_stat->rx_frames = stats->rx_frames;
1763 pfc_host_stat->dumped_frames = stats->discarded_frames;
1764 pfc_host_stat->nos_count = stats->nos_rcvd;
1765 pfc_host_stat->error_frames =
1766 stats->dropped_frames + stats->discarded_frames;
1767 pfc_host_stat->rx_words = vha->qla_stats.input_bytes;
1768 pfc_host_stat->tx_words = vha->qla_stats.output_bytes;
1770 pfc_host_stat->fcp_control_requests = vha->qla_stats.control_requests;
1771 pfc_host_stat->fcp_input_requests = vha->qla_stats.input_requests;
1772 pfc_host_stat->fcp_output_requests = vha->qla_stats.output_requests;
1773 pfc_host_stat->fcp_input_megabytes = vha->qla_stats.input_bytes >> 20;
1774 pfc_host_stat->fcp_output_megabytes = vha->qla_stats.output_bytes >> 20;
1775 pfc_host_stat->seconds_since_last_reset =
1776 get_jiffies_64() - vha->qla_stats.jiffies_at_last_reset;
1777 do_div(pfc_host_stat->seconds_since_last_reset, HZ);
1780 dma_pool_free(ha->s_dma_pool, stats, stats_dma);
1782 return pfc_host_stat;
1786 qla2x00_reset_host_stats(struct Scsi_Host *shost)
1788 scsi_qla_host_t *vha = shost_priv(shost);
1790 memset(&vha->fc_host_stat, 0, sizeof(vha->fc_host_stat));
1792 vha->qla_stats.jiffies_at_last_reset = get_jiffies_64();
1796 qla2x00_get_host_symbolic_name(struct Scsi_Host *shost)
1798 scsi_qla_host_t *vha = shost_priv(shost);
1800 qla2x00_get_sym_node_name(vha, fc_host_symbolic_name(shost));
1804 qla2x00_set_host_system_hostname(struct Scsi_Host *shost)
1806 scsi_qla_host_t *vha = shost_priv(shost);
1808 set_bit(REGISTER_FDMI_NEEDED, &vha->dpc_flags);
1812 qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
1814 scsi_qla_host_t *vha = shost_priv(shost);
1815 uint8_t node_name[WWN_SIZE] = { 0xFF, 0xFF, 0xFF, 0xFF, \
1816 0xFF, 0xFF, 0xFF, 0xFF};
1817 u64 fabric_name = wwn_to_u64(node_name);
1819 if (vha->device_flags & SWITCH_FOUND)
1820 fabric_name = wwn_to_u64(vha->fabric_node_name);
1822 fc_host_fabric_name(shost) = fabric_name;
1826 qla2x00_get_host_port_state(struct Scsi_Host *shost)
1828 scsi_qla_host_t *vha = shost_priv(shost);
1829 struct scsi_qla_host *base_vha = pci_get_drvdata(vha->hw->pdev);
1831 if (!base_vha->flags.online) {
1832 fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
1836 switch (atomic_read(&base_vha->loop_state)) {
1838 fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS;
1841 if (test_bit(LOOP_RESYNC_NEEDED, &base_vha->dpc_flags))
1842 fc_host_port_state(shost) = FC_PORTSTATE_DIAGNOSTICS;
1844 fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN;
1847 fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN;
1850 fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
1853 fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
1859 qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
1863 scsi_qla_host_t *base_vha = shost_priv(fc_vport->shost);
1864 scsi_qla_host_t *vha = NULL;
1865 struct qla_hw_data *ha = base_vha->hw;
1866 uint16_t options = 0;
1868 struct req_que *req = ha->req_q_map[0];
1870 ret = qla24xx_vport_create_req_sanity_check(fc_vport);
1872 ql_log(ql_log_warn, vha, 0x707e,
1873 "Vport sanity check failed, status %x\n", ret);
1877 vha = qla24xx_create_vhost(fc_vport);
1879 ql_log(ql_log_warn, vha, 0x707f, "Vport create host failed.\n");
1880 return FC_VPORT_FAILED;
1883 atomic_set(&vha->vp_state, VP_OFFLINE);
1884 fc_vport_set_state(fc_vport, FC_VPORT_DISABLED);
1886 atomic_set(&vha->vp_state, VP_FAILED);
1888 /* ready to create vport */
1889 ql_log(ql_log_info, vha, 0x7080,
1890 "VP entry id %d assigned.\n", vha->vp_idx);
1892 /* initialized vport states */
1893 atomic_set(&vha->loop_state, LOOP_DOWN);
1894 vha->vp_err_state= VP_ERR_PORTDWN;
1895 vha->vp_prev_err_state= VP_ERR_UNKWN;
1896 /* Check if physical ha port is Up */
1897 if (atomic_read(&base_vha->loop_state) == LOOP_DOWN ||
1898 atomic_read(&base_vha->loop_state) == LOOP_DEAD) {
1899 /* Don't retry or attempt login of this virtual port */
1900 ql_dbg(ql_dbg_user, vha, 0x7081,
1901 "Vport loop state is not UP.\n");
1902 atomic_set(&vha->loop_state, LOOP_DEAD);
1904 fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN);
1907 if (IS_T10_PI_CAPABLE(ha) && ql2xenabledif) {
1908 if (ha->fw_attributes & BIT_4) {
1909 int prot = 0, guard;
1910 vha->flags.difdix_supported = 1;
1911 ql_dbg(ql_dbg_user, vha, 0x7082,
1912 "Registered for DIF/DIX type 1 and 3 protection.\n");
1913 if (ql2xenabledif == 1)
1914 prot = SHOST_DIX_TYPE0_PROTECTION;
1915 scsi_host_set_prot(vha->host,
1916 prot | SHOST_DIF_TYPE1_PROTECTION
1917 | SHOST_DIF_TYPE2_PROTECTION
1918 | SHOST_DIF_TYPE3_PROTECTION
1919 | SHOST_DIX_TYPE1_PROTECTION
1920 | SHOST_DIX_TYPE2_PROTECTION
1921 | SHOST_DIX_TYPE3_PROTECTION);
1923 guard = SHOST_DIX_GUARD_CRC;
1925 if (IS_PI_IPGUARD_CAPABLE(ha) &&
1926 (ql2xenabledif > 1 || IS_PI_DIFB_DIX0_CAPABLE(ha)))
1927 guard |= SHOST_DIX_GUARD_IP;
1929 scsi_host_set_guard(vha->host, guard);
1931 vha->flags.difdix_supported = 0;
1934 if (scsi_add_host_with_dma(vha->host, &fc_vport->dev,
1936 ql_dbg(ql_dbg_user, vha, 0x7083,
1937 "scsi_add_host failure for VP[%d].\n", vha->vp_idx);
1938 goto vport_create_failed_2;
1941 /* initialize attributes */
1942 fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
1943 fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
1944 fc_host_port_name(vha->host) = wwn_to_u64(vha->port_name);
1945 fc_host_supported_classes(vha->host) =
1946 fc_host_supported_classes(base_vha->host);
1947 fc_host_supported_speeds(vha->host) =
1948 fc_host_supported_speeds(base_vha->host);
1950 qlt_vport_create(vha, ha);
1951 qla24xx_vport_disable(fc_vport, disable);
1953 if (ha->flags.cpu_affinity_enabled) {
1954 req = ha->req_q_map[1];
1955 ql_dbg(ql_dbg_multiq, vha, 0xc000,
1956 "Request queue %p attached with "
1957 "VP[%d], cpu affinity =%d\n",
1958 req, vha->vp_idx, ha->flags.cpu_affinity_enabled);
1960 } else if (ql2xmaxqueues == 1 || !ha->npiv_info)
1962 /* Create a request queue in QoS mode for the vport */
1963 for (cnt = 0; cnt < ha->nvram_npiv_size; cnt++) {
1964 if (memcmp(ha->npiv_info[cnt].port_name, vha->port_name, 8) == 0
1965 && memcmp(ha->npiv_info[cnt].node_name, vha->node_name,
1967 qos = ha->npiv_info[cnt].q_qos;
1973 ret = qla25xx_create_req_que(ha, options, vha->vp_idx, 0, 0,
1976 ql_log(ql_log_warn, vha, 0x7084,
1977 "Can't create request queue for VP[%d]\n",
1980 ql_dbg(ql_dbg_multiq, vha, 0xc001,
1981 "Request Que:%d Q0s: %d) created for VP[%d]\n",
1982 ret, qos, vha->vp_idx);
1983 ql_dbg(ql_dbg_user, vha, 0x7085,
1984 "Request Que:%d Q0s: %d) created for VP[%d]\n",
1985 ret, qos, vha->vp_idx);
1986 req = ha->req_q_map[ret];
1994 vport_create_failed_2:
1995 qla24xx_disable_vp(vha);
1996 qla24xx_deallocate_vp_id(vha);
1997 scsi_host_put(vha->host);
1998 return FC_VPORT_FAILED;
2002 qla24xx_vport_delete(struct fc_vport *fc_vport)
2004 scsi_qla_host_t *vha = fc_vport->dd_data;
2005 struct qla_hw_data *ha = vha->hw;
2006 uint16_t id = vha->vp_idx;
2008 while (test_bit(LOOP_RESYNC_ACTIVE, &vha->dpc_flags) ||
2009 test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
2012 qla24xx_disable_vp(vha);
2014 vha->flags.delete_progress = 1;
2016 qlt_remove_target(ha, vha);
2018 fc_remove_host(vha->host);
2020 scsi_remove_host(vha->host);
2022 /* Allow timer to run to drain queued items, when removing vp */
2023 qla24xx_deallocate_vp_id(vha);
2025 if (vha->timer_active) {
2026 qla2x00_vp_stop_timer(vha);
2027 ql_dbg(ql_dbg_user, vha, 0x7086,
2028 "Timer for the VP[%d] has stopped\n", vha->vp_idx);
2031 BUG_ON(atomic_read(&vha->vref_count));
2033 qla2x00_free_fcports(vha);
2035 mutex_lock(&ha->vport_lock);
2036 ha->cur_vport_count--;
2037 clear_bit(vha->vp_idx, ha->vp_idx_map);
2038 mutex_unlock(&ha->vport_lock);
2040 if (vha->req->id && !ha->flags.cpu_affinity_enabled) {
2041 if (qla25xx_delete_req_que(vha, vha->req) != QLA_SUCCESS)
2042 ql_log(ql_log_warn, vha, 0x7087,
2043 "Queue delete failed.\n");
2046 ql_log(ql_log_info, vha, 0x7088, "VP[%d] deleted.\n", id);
2047 scsi_host_put(vha->host);
2052 qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
2054 scsi_qla_host_t *vha = fc_vport->dd_data;
2057 qla24xx_disable_vp(vha);
2059 qla24xx_enable_vp(vha);
2064 struct fc_function_template qla2xxx_transport_functions = {
2066 .show_host_node_name = 1,
2067 .show_host_port_name = 1,
2068 .show_host_supported_classes = 1,
2069 .show_host_supported_speeds = 1,
2071 .get_host_port_id = qla2x00_get_host_port_id,
2072 .show_host_port_id = 1,
2073 .get_host_speed = qla2x00_get_host_speed,
2074 .show_host_speed = 1,
2075 .get_host_port_type = qla2x00_get_host_port_type,
2076 .show_host_port_type = 1,
2077 .get_host_symbolic_name = qla2x00_get_host_symbolic_name,
2078 .show_host_symbolic_name = 1,
2079 .set_host_system_hostname = qla2x00_set_host_system_hostname,
2080 .show_host_system_hostname = 1,
2081 .get_host_fabric_name = qla2x00_get_host_fabric_name,
2082 .show_host_fabric_name = 1,
2083 .get_host_port_state = qla2x00_get_host_port_state,
2084 .show_host_port_state = 1,
2086 .dd_fcrport_size = sizeof(struct fc_port *),
2087 .show_rport_supported_classes = 1,
2089 .get_starget_node_name = qla2x00_get_starget_node_name,
2090 .show_starget_node_name = 1,
2091 .get_starget_port_name = qla2x00_get_starget_port_name,
2092 .show_starget_port_name = 1,
2093 .get_starget_port_id = qla2x00_get_starget_port_id,
2094 .show_starget_port_id = 1,
2096 .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo,
2097 .show_rport_dev_loss_tmo = 1,
2099 .issue_fc_host_lip = qla2x00_issue_lip,
2100 .dev_loss_tmo_callbk = qla2x00_dev_loss_tmo_callbk,
2101 .terminate_rport_io = qla2x00_terminate_rport_io,
2102 .get_fc_host_stats = qla2x00_get_fc_host_stats,
2103 .reset_fc_host_stats = qla2x00_reset_host_stats,
2105 .vport_create = qla24xx_vport_create,
2106 .vport_disable = qla24xx_vport_disable,
2107 .vport_delete = qla24xx_vport_delete,
2108 .bsg_request = qla24xx_bsg_request,
2109 .bsg_timeout = qla24xx_bsg_timeout,
2112 struct fc_function_template qla2xxx_transport_vport_functions = {
2114 .show_host_node_name = 1,
2115 .show_host_port_name = 1,
2116 .show_host_supported_classes = 1,
2118 .get_host_port_id = qla2x00_get_host_port_id,
2119 .show_host_port_id = 1,
2120 .get_host_speed = qla2x00_get_host_speed,
2121 .show_host_speed = 1,
2122 .get_host_port_type = qla2x00_get_host_port_type,
2123 .show_host_port_type = 1,
2124 .get_host_symbolic_name = qla2x00_get_host_symbolic_name,
2125 .show_host_symbolic_name = 1,
2126 .set_host_system_hostname = qla2x00_set_host_system_hostname,
2127 .show_host_system_hostname = 1,
2128 .get_host_fabric_name = qla2x00_get_host_fabric_name,
2129 .show_host_fabric_name = 1,
2130 .get_host_port_state = qla2x00_get_host_port_state,
2131 .show_host_port_state = 1,
2133 .dd_fcrport_size = sizeof(struct fc_port *),
2134 .show_rport_supported_classes = 1,
2136 .get_starget_node_name = qla2x00_get_starget_node_name,
2137 .show_starget_node_name = 1,
2138 .get_starget_port_name = qla2x00_get_starget_port_name,
2139 .show_starget_port_name = 1,
2140 .get_starget_port_id = qla2x00_get_starget_port_id,
2141 .show_starget_port_id = 1,
2143 .set_rport_dev_loss_tmo = qla2x00_set_rport_loss_tmo,
2144 .show_rport_dev_loss_tmo = 1,
2146 .issue_fc_host_lip = qla2x00_issue_lip,
2147 .dev_loss_tmo_callbk = qla2x00_dev_loss_tmo_callbk,
2148 .terminate_rport_io = qla2x00_terminate_rport_io,
2149 .get_fc_host_stats = qla2x00_get_fc_host_stats,
2150 .reset_fc_host_stats = qla2x00_reset_host_stats,
2152 .bsg_request = qla24xx_bsg_request,
2153 .bsg_timeout = qla24xx_bsg_timeout,
2157 qla2x00_init_host_attr(scsi_qla_host_t *vha)
2159 struct qla_hw_data *ha = vha->hw;
2160 u32 speed = FC_PORTSPEED_UNKNOWN;
2162 fc_host_dev_loss_tmo(vha->host) = ha->port_down_retry_count;
2163 fc_host_node_name(vha->host) = wwn_to_u64(vha->node_name);
2164 fc_host_port_name(vha->host) = wwn_to_u64(vha->port_name);
2165 fc_host_supported_classes(vha->host) = ha->tgt.enable_class_2 ?
2166 (FC_COS_CLASS2|FC_COS_CLASS3) : FC_COS_CLASS3;
2167 fc_host_max_npiv_vports(vha->host) = ha->max_npiv_vports;
2168 fc_host_npiv_vports_inuse(vha->host) = ha->cur_vport_count;
2170 if (IS_CNA_CAPABLE(ha))
2171 speed = FC_PORTSPEED_10GBIT;
2172 else if (IS_QLA2031(ha))
2173 speed = FC_PORTSPEED_16GBIT | FC_PORTSPEED_8GBIT |
2175 else if (IS_QLA25XX(ha))
2176 speed = FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT |
2177 FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT;
2178 else if (IS_QLA24XX_TYPE(ha))
2179 speed = FC_PORTSPEED_4GBIT | FC_PORTSPEED_2GBIT |
2181 else if (IS_QLA23XX(ha))
2182 speed = FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT;
2183 else if (IS_QLAFX00(ha))
2184 speed = FC_PORTSPEED_8GBIT | FC_PORTSPEED_4GBIT |
2185 FC_PORTSPEED_2GBIT | FC_PORTSPEED_1GBIT;
2187 speed = FC_PORTSPEED_1GBIT;
2188 fc_host_supported_speeds(vha->host) = speed;