mlx4: fix potential divide by 0 in mlx4_en_auto_moderation()
authorEric Dumazet <edumazet@google.com>
Thu, 16 Feb 2017 23:23:27 +0000 (15:23 -0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 19 Feb 2017 23:15:23 +0000 (18:15 -0500)
commitf5a57723371f11ff953c4ba71184dc00e65469fc
tree38f76e696c6934a7c0ff3500f9c36bd581ca4d51
parent1786dbf3702e33ce3afd2d3dbe630bd04b1d2e58
mlx4: fix potential divide by 0 in mlx4_en_auto_moderation()

1) In the case where rate == priv->pkt_rate_low == priv->pkt_rate_high,
mlx4_en_auto_moderation() does a divide by zero.

2) We want to properly change the moderation parameters if rx_frames
was changed (like in ethtool -C eth0 rx-frames 16)

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx4/en_netdev.c