diff options
author | Dave Olson <dave.olson@qlogic.com> | 2008-04-17 00:01:12 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2008-04-17 00:01:12 -0400 |
commit | 826d801009fb3c82832f2d92149446cce354bf61 (patch) | |
tree | 564534dee75be00b019b78b130ec6eb7e5a81e7d /drivers/infiniband/hw/ipath/ipath_driver.c | |
parent | 5d1ce03dd335abaef50dc615137cac2a22c5cee0 (diff) |
IB/ipath: Enable 4KB MTU
Enable use of 4KB MTU. Since the driver uses more pinned memory for
receive buffers when the 4KB MTU is enabled, whether or not the fabric
supports that MTU, add a "mtu4096" module parameter that can be used to
limit the MTU to 2KB when it is known that 4KB MTUs can't be used
anyway.
Signed-off-by: Dave Olson <dave.olson@qlogic.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ipath/ipath_driver.c')
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_driver.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/drivers/infiniband/hw/ipath/ipath_driver.c b/drivers/infiniband/hw/ipath/ipath_driver.c index 367f2a38744..7121fe84ff8 100644 --- a/drivers/infiniband/hw/ipath/ipath_driver.c +++ b/drivers/infiniband/hw/ipath/ipath_driver.c | |||
@@ -73,6 +73,10 @@ module_param_named(debug, ipath_debug, uint, S_IWUSR | S_IRUGO); | |||
73 | MODULE_PARM_DESC(debug, "mask for debug prints"); | 73 | MODULE_PARM_DESC(debug, "mask for debug prints"); |
74 | EXPORT_SYMBOL_GPL(ipath_debug); | 74 | EXPORT_SYMBOL_GPL(ipath_debug); |
75 | 75 | ||
76 | unsigned ipath_mtu4096 = 1; /* max 4KB IB mtu by default, if supported */ | ||
77 | module_param_named(mtu4096, ipath_mtu4096, uint, S_IRUGO); | ||
78 | MODULE_PARM_DESC(mtu4096, "enable MTU of 4096 bytes, if supported"); | ||
79 | |||
76 | MODULE_LICENSE("GPL"); | 80 | MODULE_LICENSE("GPL"); |
77 | MODULE_AUTHOR("QLogic <support@pathscale.com>"); | 81 | MODULE_AUTHOR("QLogic <support@pathscale.com>"); |
78 | MODULE_DESCRIPTION("QLogic InfiniPath driver"); | 82 | MODULE_DESCRIPTION("QLogic InfiniPath driver"); |
@@ -1800,7 +1804,7 @@ int ipath_set_mtu(struct ipath_devdata *dd, u16 arg) | |||
1800 | * piosize). We check that it's one of the valid IB sizes. | 1804 | * piosize). We check that it's one of the valid IB sizes. |
1801 | */ | 1805 | */ |
1802 | if (arg != 256 && arg != 512 && arg != 1024 && arg != 2048 && | 1806 | if (arg != 256 && arg != 512 && arg != 1024 && arg != 2048 && |
1803 | arg != 4096) { | 1807 | (arg != 4096 || !ipath_mtu4096)) { |
1804 | ipath_dbg("Trying to set invalid mtu %u, failing\n", arg); | 1808 | ipath_dbg("Trying to set invalid mtu %u, failing\n", arg); |
1805 | ret = -EINVAL; | 1809 | ret = -EINVAL; |
1806 | goto bail; | 1810 | goto bail; |
@@ -1816,6 +1820,8 @@ int ipath_set_mtu(struct ipath_devdata *dd, u16 arg) | |||
1816 | if (arg >= (piosize - IPATH_PIO_MAXIBHDR)) { | 1820 | if (arg >= (piosize - IPATH_PIO_MAXIBHDR)) { |
1817 | /* Only if it's not the initial value (or reset to it) */ | 1821 | /* Only if it's not the initial value (or reset to it) */ |
1818 | if (piosize != dd->ipath_init_ibmaxlen) { | 1822 | if (piosize != dd->ipath_init_ibmaxlen) { |
1823 | if (arg > piosize && arg <= dd->ipath_init_ibmaxlen) | ||
1824 | piosize = dd->ipath_init_ibmaxlen; | ||
1819 | dd->ipath_ibmaxlen = piosize; | 1825 | dd->ipath_ibmaxlen = piosize; |
1820 | changed = 1; | 1826 | changed = 1; |
1821 | } | 1827 | } |
@@ -1829,24 +1835,17 @@ int ipath_set_mtu(struct ipath_devdata *dd, u16 arg) | |||
1829 | } | 1835 | } |
1830 | 1836 | ||
1831 | if (changed) { | 1837 | if (changed) { |
1838 | u64 ibc = dd->ipath_ibcctrl, ibdw; | ||
1832 | /* | 1839 | /* |
1833 | * set the IBC maxpktlength to the size of our pio | 1840 | * update our housekeeping variables, and set IBC max |
1834 | * buffers in words | 1841 | * size, same as init code; max IBC is max we allow in |
1842 | * buffer, less the qword pbc, plus 1 for ICRC, in dwords | ||
1835 | */ | 1843 | */ |
1836 | u64 ibc = dd->ipath_ibcctrl; | 1844 | dd->ipath_ibmaxlen = piosize - 2 * sizeof(u32); |
1845 | ibdw = (dd->ipath_ibmaxlen >> 2) + 1; | ||
1837 | ibc &= ~(INFINIPATH_IBCC_MAXPKTLEN_MASK << | 1846 | ibc &= ~(INFINIPATH_IBCC_MAXPKTLEN_MASK << |
1838 | INFINIPATH_IBCC_MAXPKTLEN_SHIFT); | 1847 | dd->ibcc_mpl_shift); |
1839 | 1848 | ibc |= ibdw << dd->ibcc_mpl_shift; | |
1840 | piosize = piosize - 2 * sizeof(u32); /* ignore pbc */ | ||
1841 | dd->ipath_ibmaxlen = piosize; | ||
1842 | piosize /= sizeof(u32); /* in words */ | ||
1843 | /* | ||
1844 | * for ICRC, which we only send in diag test pkt mode, and | ||
1845 | * we don't need to worry about that for mtu | ||
1846 | */ | ||
1847 | piosize += 1; | ||
1848 | |||
1849 | ibc |= piosize << INFINIPATH_IBCC_MAXPKTLEN_SHIFT; | ||
1850 | dd->ipath_ibcctrl = ibc; | 1849 | dd->ipath_ibcctrl = ibc; |
1851 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, | 1850 | ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl, |
1852 | dd->ipath_ibcctrl); | 1851 | dd->ipath_ibcctrl); |