Commit 81496b72 authored by Heiner Kallweit's avatar Heiner Kallweit Committed by David S. Miller

r8169: add check for invalid parameter combination in rtl_set_coalesce

Realtek provided information about a HW constraint that time limit must
not be set to 0 if the frame limit is >0. Add a check for this and
reject invalid parameter combinations.
Signed-off-by: default avatarHeiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2b3e48b6
......@@ -1908,6 +1908,11 @@ static int rtl_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
if (tx_fr == 1)
tx_fr = 0;
/* HW requires time limit to be set if frame limit is set */
if ((tx_fr && !ec->tx_coalesce_usecs) ||
(rx_fr && !ec->rx_coalesce_usecs))
return -EINVAL;
w |= FIELD_PREP(RTL_COALESCE_TX_FRAMES, DIV_ROUND_UP(tx_fr, 4));
w |= FIELD_PREP(RTL_COALESCE_RX_FRAMES, DIV_ROUND_UP(rx_fr, 4));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment