Thomas Petazzoni ab42676af0 net: mvpp2: handle too large value in mvpp2_rx_time_coal_set()
When configuring the MVPP2_ISR_RX_THRESHOLD_REG with the RX coalescing
time threshold, we do not check for the maximum allowed value supported
by the driver, which means we might overflow and use a bogus value. This
commit adds a check for this situation, and if a value higher than what
is supported by the hardware is provided, then we use the maximum value
supported by the hardware.

In order to achieve this in a way that avoids overflow and rounding
errors, we introduce two utility functions mvpp2_usec_to_cycles() and
cycles_to_usec(). Many thanks to Russell King for suggesting this
implementation.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-02-21 13:16:14 -05:00
..
2017-02-10 13:41:13 -05:00
2017-02-17 15:06:52 -05:00
2017-02-11 20:59:41 -05:00
2017-02-20 10:15:11 -05:00
2017-02-11 20:59:41 -05:00
2017-02-11 20:59:41 -05:00
2017-02-11 20:59:41 -05:00