layerscape: add patches-5.4
[openwrt/staging/mkresin.git] / target / linux / layerscape / patches-5.4 / 809-jailhouse-0007-ivshmem-net-Switch-to-reset-state-on-each-net-stop-a.patch
1 From 869dce4a7f48b0642e4c902c5d142503dbd37dda Mon Sep 17 00:00:00 2001
2 From: Jan Kiszka <jan.kiszka@siemens.com>
3 Date: Sun, 1 Jan 2017 15:43:37 +0100
4 Subject: [PATCH] ivshmem-net: Switch to reset state on each net stop and on
5 driver removal
6
7 Improves the state signaling to the remote side after ifconfig down and
8 driver removal.
9
10 Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 (cherry picked from commit d0f632b2830146d9892a2b1ab93f866f072412bb)
12 ---
13 drivers/net/ivshmem-net.c | 5 ++++-
14 1 file changed, 4 insertions(+), 1 deletion(-)
15
16 --- a/drivers/net/ivshmem-net.c
17 +++ b/drivers/net/ivshmem-net.c
18 @@ -554,6 +554,8 @@ static void ivshm_net_do_stop(struct net
19 {
20 struct ivshm_net *in = netdev_priv(ndev);
21
22 + ivshm_net_set_state(in, IVSHM_NET_STATE_RESET);
23 +
24 if (!test_and_clear_bit(IVSHM_NET_FLAG_RUN, &in->flags))
25 return;
26
27 @@ -593,7 +595,6 @@ static void ivshm_net_state_change(struc
28 } else {
29 netif_carrier_off(ndev);
30 ivshm_net_do_stop(ndev);
31 - ivshm_net_set_state(in, IVSHM_NET_STATE_RESET);
32 }
33 break;
34 }
35 @@ -899,6 +900,8 @@ static void ivshm_net_remove(struct pci_
36 struct net_device *ndev = pci_get_drvdata(pdev);
37 struct ivshm_net *in = netdev_priv(ndev);
38
39 + writel(IVSHM_NET_STATE_RESET, &in->ivshm_regs->lstate);
40 +
41 if (in->using_msix) {
42 free_irq(in->msix.vector, ndev);
43 pci_disable_msix(pdev);