diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2008-01-17 12:02:17 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-23 12:29:32 -0500 |
commit | df613b96077cee826b14089ae6e75eeabf71faa3 (patch) | |
tree | 262f0b96f1dc94da58f837e5446b02da52d80471 /drivers/scsi/qla2xxx/qla_init.c | |
parent | 00b6bd25166e2a4bad23c614c10c55993bb2489e (diff) |
[SCSI] qla2xxx: Add Fibre Channel Event (FCE) tracing support.
FCE support enables the firmware to record FC extended link
services and basic link services frames which have been
transmitted and received by the ISP. This allows for a limited
view of the FC traffic through the ISP without using a FC
analyzer. This can be useful in situations where a physical
connection to the FC bus is not possible.
The driver exports this information in two ways -- first, via a
debugfs node exported for all supported ISPs under:
<debugfs_mount_point>/qla2xxx/qla2xxx_<host_no>/fce
where a read of the 'fce' file will provide a snapshot of the
firmware's FCE buffer; and finally, the FCE buffer will be
extracted during a firmware-dump scenario.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 73 |
1 files changed, 60 insertions, 13 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index da2cce011520..cacfd2509387 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -732,9 +732,9 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
732 | { | 732 | { |
733 | int rval; | 733 | int rval; |
734 | uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size, | 734 | uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size, |
735 | eft_size; | 735 | eft_size, fce_size; |
736 | dma_addr_t eft_dma; | 736 | dma_addr_t tc_dma; |
737 | void *eft; | 737 | void *tc; |
738 | 738 | ||
739 | if (ha->fw_dump) { | 739 | if (ha->fw_dump) { |
740 | qla_printk(KERN_WARNING, ha, | 740 | qla_printk(KERN_WARNING, ha, |
@@ -743,7 +743,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
743 | } | 743 | } |
744 | 744 | ||
745 | ha->fw_dumped = 0; | 745 | ha->fw_dumped = 0; |
746 | fixed_size = mem_size = eft_size = 0; | 746 | fixed_size = mem_size = eft_size = fce_size = 0; |
747 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { | 747 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { |
748 | fixed_size = sizeof(struct qla2100_fw_dump); | 748 | fixed_size = sizeof(struct qla2100_fw_dump); |
749 | } else if (IS_QLA23XX(ha)) { | 749 | } else if (IS_QLA23XX(ha)) { |
@@ -758,20 +758,20 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
758 | sizeof(uint32_t); | 758 | sizeof(uint32_t); |
759 | 759 | ||
760 | /* Allocate memory for Extended Trace Buffer. */ | 760 | /* Allocate memory for Extended Trace Buffer. */ |
761 | eft = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &eft_dma, | 761 | tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma, |
762 | GFP_KERNEL); | 762 | GFP_KERNEL); |
763 | if (!eft) { | 763 | if (!tc) { |
764 | qla_printk(KERN_WARNING, ha, "Unable to allocate " | 764 | qla_printk(KERN_WARNING, ha, "Unable to allocate " |
765 | "(%d KB) for EFT.\n", EFT_SIZE / 1024); | 765 | "(%d KB) for EFT.\n", EFT_SIZE / 1024); |
766 | goto cont_alloc; | 766 | goto cont_alloc; |
767 | } | 767 | } |
768 | 768 | ||
769 | rval = qla2x00_enable_eft_trace(ha, eft_dma, EFT_NUM_BUFFERS); | 769 | rval = qla2x00_enable_eft_trace(ha, tc_dma, EFT_NUM_BUFFERS); |
770 | if (rval) { | 770 | if (rval) { |
771 | qla_printk(KERN_WARNING, ha, "Unable to initialize " | 771 | qla_printk(KERN_WARNING, ha, "Unable to initialize " |
772 | "EFT (%d).\n", rval); | 772 | "EFT (%d).\n", rval); |
773 | dma_free_coherent(&ha->pdev->dev, EFT_SIZE, eft, | 773 | dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, |
774 | eft_dma); | 774 | tc_dma); |
775 | goto cont_alloc; | 775 | goto cont_alloc; |
776 | } | 776 | } |
777 | 777 | ||
@@ -779,9 +779,41 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
779 | EFT_SIZE / 1024); | 779 | EFT_SIZE / 1024); |
780 | 780 | ||
781 | eft_size = EFT_SIZE; | 781 | eft_size = EFT_SIZE; |
782 | memset(eft, 0, eft_size); | 782 | memset(tc, 0, eft_size); |
783 | ha->eft_dma = eft_dma; | 783 | ha->eft_dma = tc_dma; |
784 | ha->eft = eft; | 784 | ha->eft = tc; |
785 | |||
786 | /* Allocate memory for Fibre Channel Event Buffer. */ | ||
787 | if (!IS_QLA25XX(ha)) | ||
788 | goto cont_alloc; | ||
789 | |||
790 | tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma, | ||
791 | GFP_KERNEL); | ||
792 | if (!tc) { | ||
793 | qla_printk(KERN_WARNING, ha, "Unable to allocate " | ||
794 | "(%d KB) for FCE.\n", FCE_SIZE / 1024); | ||
795 | goto cont_alloc; | ||
796 | } | ||
797 | |||
798 | memset(tc, 0, FCE_SIZE); | ||
799 | rval = qla2x00_enable_fce_trace(ha, tc_dma, FCE_NUM_BUFFERS, | ||
800 | ha->fce_mb, &ha->fce_bufs); | ||
801 | if (rval) { | ||
802 | qla_printk(KERN_WARNING, ha, "Unable to initialize " | ||
803 | "FCE (%d).\n", rval); | ||
804 | dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, | ||
805 | tc_dma); | ||
806 | ha->flags.fce_enabled = 0; | ||
807 | goto cont_alloc; | ||
808 | } | ||
809 | |||
810 | qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n", | ||
811 | FCE_SIZE / 1024); | ||
812 | |||
813 | fce_size = sizeof(struct qla2xxx_fce_chain) + EFT_SIZE; | ||
814 | ha->flags.fce_enabled = 1; | ||
815 | ha->fce_dma = tc_dma; | ||
816 | ha->fce = tc; | ||
785 | } | 817 | } |
786 | cont_alloc: | 818 | cont_alloc: |
787 | req_q_size = ha->request_q_length * sizeof(request_t); | 819 | req_q_size = ha->request_q_length * sizeof(request_t); |
@@ -789,7 +821,7 @@ cont_alloc: | |||
789 | 821 | ||
790 | dump_size = offsetof(struct qla2xxx_fw_dump, isp); | 822 | dump_size = offsetof(struct qla2xxx_fw_dump, isp); |
791 | dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + | 823 | dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + |
792 | eft_size; | 824 | eft_size + fce_size; |
793 | 825 | ||
794 | ha->fw_dump = vmalloc(dump_size); | 826 | ha->fw_dump = vmalloc(dump_size); |
795 | if (!ha->fw_dump) { | 827 | if (!ha->fw_dump) { |
@@ -3247,6 +3279,21 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
3247 | "(%d).\n", rval); | 3279 | "(%d).\n", rval); |
3248 | } | 3280 | } |
3249 | } | 3281 | } |
3282 | |||
3283 | if (ha->fce) { | ||
3284 | ha->flags.fce_enabled = 1; | ||
3285 | memset(ha->fce, 0, | ||
3286 | fce_calc_size(ha->fce_bufs)); | ||
3287 | rval = qla2x00_enable_fce_trace(ha, | ||
3288 | ha->fce_dma, ha->fce_bufs, ha->fce_mb, | ||
3289 | &ha->fce_bufs); | ||
3290 | if (rval) { | ||
3291 | qla_printk(KERN_WARNING, ha, | ||
3292 | "Unable to reinitialize FCE " | ||
3293 | "(%d).\n", rval); | ||
3294 | ha->flags.fce_enabled = 0; | ||
3295 | } | ||
3296 | } | ||
3250 | } else { /* failed the ISP abort */ | 3297 | } else { /* failed the ISP abort */ |
3251 | ha->flags.online = 1; | 3298 | ha->flags.online = 1; |
3252 | if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { | 3299 | if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { |