diff options
author | Andrew Vasquez <andrew.vasquez@qlogic.com> | 2009-06-03 09:55:14 -0700 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-06-08 14:46:36 -0500 |
commit | 11bbc1d896637c1d83b11cc3b97ed3d6d2076c63 (patch) | |
tree | a3c9ac3bbf1b09a8ece52496ada28316f06ecd09 /drivers/scsi/qla2xxx/qla_attr.c | |
parent | ce0423f4a23317d0166addd7d6fcc4a0fa95e751 (diff) | |
download | kernel_samsung_smdk4412-11bbc1d896637c1d83b11cc3b97ed3d6d2076c63.tar.gz kernel_samsung_smdk4412-11bbc1d896637c1d83b11cc3b97ed3d6d2076c63.tar.bz2 kernel_samsung_smdk4412-11bbc1d896637c1d83b11cc3b97ed3d6d2076c63.zip |
[SCSI] qla2xxx: Export TLV data on supported ISPs.
Firmware currently provides PB and PGF TLVs.
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_attr.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_attr.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index e8c1c9e01a7..9aa00f25aa6 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -744,6 +744,57 @@ static struct bin_attribute sysfs_xgmac_stats_attr = { .read = qla2x00_sysfs_read_xgmac_stats, }; +static ssize_t +qla2x00_sysfs_read_dcbx_tlv(struct kobject *kobj, + struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) +{ + struct scsi_qla_host *vha = shost_priv(dev_to_shost(container_of(kobj, + struct device, kobj))); + struct qla_hw_data *ha = vha->hw; + int rval; + uint16_t actual_size; + + if (!capable(CAP_SYS_ADMIN) || off != 0 || count > DCBX_TLV_DATA_SIZE) + return 0; + + if (ha->dcbx_tlv) + goto do_read; + + ha->dcbx_tlv = dma_alloc_coherent(&ha->pdev->dev, DCBX_TLV_DATA_SIZE, + &ha->dcbx_tlv_dma, GFP_KERNEL); + if (!ha->dcbx_tlv) { + qla_printk(KERN_WARNING, ha, + "Unable to allocate memory for DCBX TLV read-data.\n"); + return 0; + } + +do_read: + actual_size = 0; + memset(ha->dcbx_tlv, 0, DCBX_TLV_DATA_SIZE); + + rval = qla2x00_get_dcbx_params(vha, ha->dcbx_tlv_dma, + DCBX_TLV_DATA_SIZE); + if (rval != QLA_SUCCESS) { + qla_printk(KERN_WARNING, ha, + "Unable to read DCBX TLV data (%x).\n", rval); + count = 0; + } + + memcpy(buf, ha->dcbx_tlv, count); + + return count; +} + +static struct bin_attribute sysfs_dcbx_tlv_attr = { + .attr = { + .name = "dcbx_tlv", + .mode = S_IRUSR, + }, + .size = 0, + .read = qla2x00_sysfs_read_dcbx_tlv, +}; + static struct sysfs_entry { char *name; struct bin_attribute *attr; @@ -759,6 +810,7 @@ static struct sysfs_entry { { "edc", &sysfs_edc_attr, 2 }, { "edc_status", &sysfs_edc_status_attr, 2 }, { "xgmac_stats", &sysfs_xgmac_stats_attr, 3 }, + { "dcbx_tlv", &sysfs_dcbx_tlv_attr, 3 }, { NULL }, }; |