net: ena: fix device destruction to gracefully free resources
authorNetanel Belgazal <netanel@amazon.com>
Sun, 9 Sep 2018 08:15:22 +0000 (08:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 9 Sep 2018 14:59:55 +0000 (07:59 -0700)
commitcfa324a514233b28a6934de619183eee941f02d7
treee641227b14798641b55385b957dc528c1179229a
parentef5b0771d247379c90c8bf1332ff32f7f74bff7f
net: ena: fix device destruction to gracefully free resources

When ena_destroy_device() is called from ena_suspend(), the device is
still reachable from the driver. Therefore, the driver can send a command
to the device to free all resources.
However, in all other cases of calling ena_destroy_device(), the device is
potentially in an error state and unreachable from the driver. In these
cases the driver must not send commands to the device.

The current implementation does not request resource freeing from the
device even when possible. We add the graceful parameter to
ena_destroy_device() to enable resource freeing when possible, and
use it in ena_suspend().

Signed-off-by: Netanel Belgazal <netanel@amazon.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amazon/ena/ena_netdev.c