net: mv643xx_eth: ensure coalesce settings survive read-modify-write
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 1 Nov 2016 10:50:01 +0000 (10:50 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 1 Nov 2016 16:17:16 +0000 (12:17 -0400)
commitb9b84fc07dbc6ac74d85f1b1a401b41c403fecb1
treee938511fe8a1bbf73eed926c1f96cac7d0da86fc
parent42fb18fd5852dba9c43ac008558e4bc8062bda57
net: mv643xx_eth: ensure coalesce settings survive read-modify-write

The coalesce settings behave badly when changing just one value:

... # ethtool -c eth0
rx-usecs: 249
... # ethtool -C eth0 tx-usecs 250
... # ethtool -c eth0
rx-usecs: 248

This occurs due to rounding errors when calculating the microseconds
value - the divisons round down.  This causes (eg) the rx-usecs to
decrease by one every time the tx-usecs value is set as per the above.

Fix this by making the divison round-to-nearest.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/mv643xx_eth.c