aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-11-12 18:02:18 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-12-21 13:24:04 -0500
commit6cb8ef573fd4c2bd72248f492fe336133660148d (patch)
tree876438b230c73464f2f6414e0d30658fbc91e56c /drivers
parentdd3741d30300f9cf1adc046773a4bb87252d96ac (diff)
[SCSI] mpt2sas: Added loadtime para for IOMissingDelay and DMD
Ability to override/set the ReportDeviceMissingDelay and IODeviceMissingDelay from driver: Add new command line option missing_delay, this is an array, where the first element is the device missing delay, and the second element is io missing delay. The driver will program sas iounit page 1 with the new setting when the driver loads. This is programmed to the current and persistent configuration page so this takes immediately, as will be sticky across host reboots. Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/mpt2sas/mpt2sas_base.c100
1 files changed, 100 insertions, 0 deletions
diff --git a/drivers/scsi/mpt2sas/mpt2sas_base.c b/drivers/scsi/mpt2sas/mpt2sas_base.c
index d1c53455c063..0e30827d44e7 100644
--- a/drivers/scsi/mpt2sas/mpt2sas_base.c
+++ b/drivers/scsi/mpt2sas/mpt2sas_base.c
@@ -79,6 +79,10 @@ static int msix_disable = -1;
79module_param(msix_disable, int, 0); 79module_param(msix_disable, int, 0);
80MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); 80MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)");
81 81
82static int missing_delay[2] = {-1, -1};
83module_param_array(missing_delay, int, NULL, 0);
84MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay");
85
82/* diag_buffer_enable is bitwise 86/* diag_buffer_enable is bitwise
83 * bit 0 set = TRACE 87 * bit 0 set = TRACE
84 * bit 1 set = SNAPSHOT 88 * bit 1 set = SNAPSHOT
@@ -1823,6 +1827,97 @@ _base_display_ioc_capabilities(struct MPT2SAS_ADAPTER *ioc)
1823} 1827}
1824 1828
1825/** 1829/**
1830 * _base_update_missing_delay - change the missing delay timers
1831 * @ioc: per adapter object
1832 * @device_missing_delay: amount of time till device is reported missing
1833 * @io_missing_delay: interval IO is returned when there is a missing device
1834 *
1835 * Return nothing.
1836 *
1837 * Passed on the command line, this function will modify the device missing
1838 * delay, as well as the io missing delay. This should be called at driver
1839 * load time.
1840 */
1841static void
1842_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc,
1843 u16 device_missing_delay, u8 io_missing_delay)
1844{
1845 u16 dmd, dmd_new, dmd_orignal;
1846 u8 io_missing_delay_original;
1847 u16 sz;
1848 Mpi2SasIOUnitPage1_t *sas_iounit_pg1 = NULL;
1849 Mpi2ConfigReply_t mpi_reply;
1850 u8 num_phys = 0;
1851 u16 ioc_status;
1852
1853 mpt2sas_config_get_number_hba_phys(ioc, &num_phys);
1854 if (!num_phys)
1855 return;
1856
1857 sz = offsetof(Mpi2SasIOUnitPage1_t, PhyData) + (num_phys *
1858 sizeof(Mpi2SasIOUnit1PhyData_t));
1859 sas_iounit_pg1 = kzalloc(sz, GFP_KERNEL);
1860 if (!sas_iounit_pg1) {
1861 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
1862 ioc->name, __FILE__, __LINE__, __func__);
1863 goto out;
1864 }
1865 if ((mpt2sas_config_get_sas_iounit_pg1(ioc, &mpi_reply,
1866 sas_iounit_pg1, sz))) {
1867 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
1868 ioc->name, __FILE__, __LINE__, __func__);
1869 goto out;
1870 }
1871 ioc_status = le16_to_cpu(mpi_reply.IOCStatus) &
1872 MPI2_IOCSTATUS_MASK;
1873 if (ioc_status != MPI2_IOCSTATUS_SUCCESS) {
1874 printk(MPT2SAS_ERR_FMT "failure at %s:%d/%s()!\n",
1875 ioc->name, __FILE__, __LINE__, __func__);
1876 goto out;
1877 }
1878
1879 /* device missing delay */
1880 dmd = sas_iounit_pg1->ReportDeviceMissingDelay;
1881 if (dmd & MPI2_SASIOUNIT1_REPORT_MISSING_UNIT_16)
1882 dmd = (dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK) * 16;
1883 else
1884 dmd = dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
1885 dmd_orignal = dmd;
1886 if (device_missing_delay > 0x7F) {
1887 dmd = (device_missing_delay > 0x7F0) ? 0x7F0 :
1888 device_missing_delay;
1889 dmd = dmd / 16;
1890 dmd |= MPI2_SASIOUNIT1_REPORT_MISSING_UNIT_16;
1891 } else
1892 dmd = device_missing_delay;
1893 sas_iounit_pg1->ReportDeviceMissingDelay = dmd;
1894
1895 /* io missing delay */
1896 io_missing_delay_original = sas_iounit_pg1->IODeviceMissingDelay;
1897 sas_iounit_pg1->IODeviceMissingDelay = io_missing_delay;
1898
1899 if (!mpt2sas_config_set_sas_iounit_pg1(ioc, &mpi_reply, sas_iounit_pg1,
1900 sz)) {
1901 if (dmd & MPI2_SASIOUNIT1_REPORT_MISSING_UNIT_16)
1902 dmd_new = (dmd &
1903 MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK) * 16;
1904 else
1905 dmd_new =
1906 dmd & MPI2_SASIOUNIT1_REPORT_MISSING_TIMEOUT_MASK;
1907 printk(MPT2SAS_INFO_FMT "device_missing_delay: old(%d), "
1908 "new(%d)\n", ioc->name, dmd_orignal, dmd_new);
1909 printk(MPT2SAS_INFO_FMT "ioc_missing_delay: old(%d), "
1910 "new(%d)\n", ioc->name, io_missing_delay_original,
1911 io_missing_delay);
1912 ioc->device_missing_delay = dmd_new;
1913 ioc->io_missing_delay = io_missing_delay;
1914 }
1915
1916out:
1917 kfree(sas_iounit_pg1);
1918}
1919
1920/**
1826 * _base_static_config_pages - static start of day config pages 1921 * _base_static_config_pages - static start of day config pages
1827 * @ioc: per adapter object 1922 * @ioc: per adapter object
1828 * 1923 *
@@ -1859,6 +1954,7 @@ _base_static_config_pages(struct MPT2SAS_ADAPTER *ioc)
1859 MPI2_IOUNITPAGE1_DISABLE_TASK_SET_FULL_HANDLING; 1954 MPI2_IOUNITPAGE1_DISABLE_TASK_SET_FULL_HANDLING;
1860 ioc->iounit_pg1.Flags = cpu_to_le32(iounit_pg1_flags); 1955 ioc->iounit_pg1.Flags = cpu_to_le32(iounit_pg1_flags);
1861 mpt2sas_config_set_iounit_pg1(ioc, &mpi_reply, &ioc->iounit_pg1); 1956 mpt2sas_config_set_iounit_pg1(ioc, &mpi_reply, &ioc->iounit_pg1);
1957
1862} 1958}
1863 1959
1864/** 1960/**
@@ -3720,6 +3816,10 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPTER *ioc)
3720 if (r) 3816 if (r)
3721 goto out_free_resources; 3817 goto out_free_resources;
3722 3818
3819 if (missing_delay[0] != -1 && missing_delay[1] != -1)
3820 _base_update_missing_delay(ioc, missing_delay[0],
3821 missing_delay[1]);
3822
3723 mpt2sas_base_start_watchdog(ioc); 3823 mpt2sas_base_start_watchdog(ioc);
3724 return 0; 3824 return 0;
3725 3825