20e87459f8d22020574ad5d7ca295e369fe82ed9
[openwrt/staging/blocktrron.git] /
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
5 and carrifer_off
6
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.
10
11 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
12 ---
13 nss_dp_main.c | 4 +++-
14 1 file changed, 3 insertions(+), 1 deletion(-)
15
16 --- a/nss_dp_main.c
17 +++ b/nss_dp_main.c
18 @@ -920,6 +920,9 @@ static int nss_dp_remove(struct platform
19 dp_ops = dp_priv->data_plane_ops;
20 hal_ops = dp_priv->gmac_hal_ops;
21
22 + netif_carrier_off(dp_priv->netdev);
23 + unregister_netdev(dp_priv->netdev);
24 +
25 if (dp_priv->phydev)
26 phy_disconnect(dp_priv->phydev);
27
28 @@ -931,7 +934,6 @@ static int nss_dp_remove(struct platform
29 #endif
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;
35 }