1 From 33dd3aa6d0f9cd240d63f53a49157ae44ebccf87 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Tue, 16 Apr 2024 16:12:11 +0200
4 Subject: [PATCH 4/6] nss_dp_main: call unregister_netdev first in dp_remove
7 In dp_remove move unregister_netdev up before calling exit and deinit
8 and first call netif_carrier_off to stop any traffic from happening and
9 prevent kernel panics for napi in the middle of transfer.
11 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
13 nss_dp_main.c | 4 +++-
14 1 file changed, 3 insertions(+), 1 deletion(-)
18 @@ -979,6 +979,9 @@ static int nss_dp_remove(struct platform
19 dp_ops = dp_priv->data_plane_ops;
20 hal_ops = dp_priv->gmac_hal_ops;
22 + netif_carrier_off(dp_priv->netdev);
23 + unregister_netdev(dp_priv->netdev);
26 phy_disconnect(dp_priv->phydev);
28 @@ -990,7 +993,6 @@ static int nss_dp_remove(struct platform
30 hal_ops->exit(dp_priv->gmac_hal_ctx);
31 dp_ops->deinit(dp_priv->dpc);
32 - unregister_netdev(dp_priv->netdev);
33 free_netdev(dp_priv->netdev);
34 dp_global_ctx.nss_dp[i] = NULL;