diff options
Diffstat (limited to 'drivers/scsi/mvsas/mv_init.c')
-rw-r--r-- | drivers/scsi/mvsas/mv_init.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/drivers/scsi/mvsas/mv_init.c b/drivers/scsi/mvsas/mv_init.c index 9f1cccc2a3e..531093ddc41 100644 --- a/drivers/scsi/mvsas/mv_init.c +++ b/drivers/scsi/mvsas/mv_init.c | |||
@@ -34,6 +34,8 @@ MODULE_PARM_DESC(collector, "\n" | |||
34 | "\tThe mvsas SAS LLDD supports both modes.\n" | 34 | "\tThe mvsas SAS LLDD supports both modes.\n" |
35 | "\tDefault: 1 (Direct Mode).\n"); | 35 | "\tDefault: 1 (Direct Mode).\n"); |
36 | 36 | ||
37 | int interrupt_coalescing = 0x80; | ||
38 | |||
37 | static struct scsi_transport_template *mvs_stt; | 39 | static struct scsi_transport_template *mvs_stt; |
38 | struct kmem_cache *mvs_task_list_cache; | 40 | struct kmem_cache *mvs_task_list_cache; |
39 | static const struct mvs_chip_info mvs_chips[] = { | 41 | static const struct mvs_chip_info mvs_chips[] = { |
@@ -48,6 +50,8 @@ static const struct mvs_chip_info mvs_chips[] = { | |||
48 | [chip_1320] = { 2, 4, 0x800, 17, 64, 9, &mvs_94xx_dispatch, }, | 50 | [chip_1320] = { 2, 4, 0x800, 17, 64, 9, &mvs_94xx_dispatch, }, |
49 | }; | 51 | }; |
50 | 52 | ||
53 | struct device_attribute *mvst_host_attrs[]; | ||
54 | |||
51 | #define SOC_SAS_NUM 2 | 55 | #define SOC_SAS_NUM 2 |
52 | #define SG_MX 64 | 56 | #define SG_MX 64 |
53 | 57 | ||
@@ -74,6 +78,7 @@ static struct scsi_host_template mvs_sht = { | |||
74 | .slave_alloc = mvs_slave_alloc, | 78 | .slave_alloc = mvs_slave_alloc, |
75 | .target_destroy = sas_target_destroy, | 79 | .target_destroy = sas_target_destroy, |
76 | .ioctl = sas_ioctl, | 80 | .ioctl = sas_ioctl, |
81 | .shost_attrs = mvst_host_attrs, | ||
77 | }; | 82 | }; |
78 | 83 | ||
79 | static struct sas_domain_function_template mvs_transport_ops = { | 84 | static struct sas_domain_function_template mvs_transport_ops = { |
@@ -706,6 +711,70 @@ static struct pci_driver mvs_pci_driver = { | |||
706 | .remove = __devexit_p(mvs_pci_remove), | 711 | .remove = __devexit_p(mvs_pci_remove), |
707 | }; | 712 | }; |
708 | 713 | ||
714 | static ssize_t | ||
715 | mvs_show_driver_version(struct device *cdev, | ||
716 | struct device_attribute *attr, char *buffer) | ||
717 | { | ||
718 | return snprintf(buffer, PAGE_SIZE, "%s\n", DRV_VERSION); | ||
719 | } | ||
720 | |||
721 | static DEVICE_ATTR(driver_version, | ||
722 | S_IRUGO, | ||
723 | mvs_show_driver_version, | ||
724 | NULL); | ||
725 | |||
726 | static ssize_t | ||
727 | mvs_store_interrupt_coalescing(struct device *cdev, | ||
728 | struct device_attribute *attr, | ||
729 | const char *buffer, size_t size) | ||
730 | { | ||
731 | int val = 0; | ||
732 | struct mvs_info *mvi = NULL; | ||
733 | struct Scsi_Host *shost = class_to_shost(cdev); | ||
734 | struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost); | ||
735 | u8 i, core_nr; | ||
736 | if (buffer == NULL) | ||
737 | return size; | ||
738 | |||
739 | if (sscanf(buffer, "%d", &val) != 1) | ||
740 | return -EINVAL; | ||
741 | |||
742 | if (val >= 0x10000) { | ||
743 | mv_dprintk("interrupt coalescing timer %d us is" | ||
744 | "too long\n", val); | ||
745 | return strlen(buffer); | ||
746 | } | ||
747 | |||
748 | interrupt_coalescing = val; | ||
749 | |||
750 | core_nr = ((struct mvs_prv_info *)sha->lldd_ha)->n_host; | ||
751 | mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[0]; | ||
752 | |||
753 | if (unlikely(!mvi)) | ||
754 | return -EINVAL; | ||
755 | |||
756 | for (i = 0; i < core_nr; i++) { | ||
757 | mvi = ((struct mvs_prv_info *)sha->lldd_ha)->mvi[i]; | ||
758 | if (MVS_CHIP_DISP->tune_interrupt) | ||
759 | MVS_CHIP_DISP->tune_interrupt(mvi, | ||
760 | interrupt_coalescing); | ||
761 | } | ||
762 | mv_dprintk("set interrupt coalescing time to %d us\n", | ||
763 | interrupt_coalescing); | ||
764 | return strlen(buffer); | ||
765 | } | ||
766 | |||
767 | static ssize_t mvs_show_interrupt_coalescing(struct device *cdev, | ||
768 | struct device_attribute *attr, char *buffer) | ||
769 | { | ||
770 | return snprintf(buffer, PAGE_SIZE, "%d\n", interrupt_coalescing); | ||
771 | } | ||
772 | |||
773 | static DEVICE_ATTR(interrupt_coalescing, | ||
774 | S_IRUGO|S_IWUSR, | ||
775 | mvs_show_interrupt_coalescing, | ||
776 | mvs_store_interrupt_coalescing); | ||
777 | |||
709 | /* task handler */ | 778 | /* task handler */ |
710 | struct task_struct *mvs_th; | 779 | struct task_struct *mvs_th; |
711 | static int __init mvs_init(void) | 780 | static int __init mvs_init(void) |
@@ -742,6 +811,12 @@ static void __exit mvs_exit(void) | |||
742 | kmem_cache_destroy(mvs_task_list_cache); | 811 | kmem_cache_destroy(mvs_task_list_cache); |
743 | } | 812 | } |
744 | 813 | ||
814 | struct device_attribute *mvst_host_attrs[] = { | ||
815 | &dev_attr_driver_version, | ||
816 | &dev_attr_interrupt_coalescing, | ||
817 | NULL, | ||
818 | }; | ||
819 | |||
745 | module_init(mvs_init); | 820 | module_init(mvs_init); |
746 | module_exit(mvs_exit); | 821 | module_exit(mvs_exit); |
747 | 822 | ||