net: ena: fix continuous keep-alive resets
authorArthur Kiyanovski <akiyano@amazon.com>
Tue, 17 Mar 2020 07:06:42 +0000 (09:06 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 08:59:51 +0000 (10:59 +0200)
commit5d10e0ef0090885ad5850f09d87addf61b377e11
treef24664a6d03e818152aa8100c2b034c48134a135
parentbcb6ca0bcabf201a2a24433c502b433c96ac7c65
net: ena: fix continuous keep-alive resets

[ Upstream commit dfdde1345bc124816f0fd42fa91b8748051e758e ]

last_keep_alive_jiffies is updated in probe and when a keep-alive
event is received.  In case the driver times-out on a keep-alive event,
it has high chances of continuously timing-out on keep-alive events.
This is because when the driver recovers from the keep-alive-timeout reset
the value of last_keep_alive_jiffies is very old, and if a keep-alive
event is not received before the next timer expires, the value of
last_keep_alive_jiffies will cause another keep-alive-timeout reset
and so forth in a loop.

Solution:
Update last_keep_alive_jiffies whenever the device is restored after
reset.

Fixes: 1738cd3ed342 ("net: ena: Add a driver for Amazon Elastic Network Adapters (ENA)")
Signed-off-by: Noam Dagan <ndagan@amazon.com>
Signed-off-by: Arthur Kiyanovski <akiyano@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/amazon/ena/ena_netdev.c