aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0397-sdk_dpaa-ceetm-fix-recursive-dependencies.patch
blob: dff27a4d357a1e343df0375e984077650689810d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
From 03117a1e7db4cd3d745c663c697e446695ebb8e1 Mon Sep 17 00:00:00 2001
From: Camelia Groza <camelia.groza@nxp.com>
Date: Wed, 8 Jan 2020 18:41:33 +0200
Subject: [PATCH] sdk_dpaa: ceetm: fix recursive dependencies

Due to dependencies between the fsl_ceetm and fsl_dpa modules, remove
the module support for the ceetm driver and integrate it into the main
DPAA Ethernet driver.

The registration of the CEETM Qdisc was the only operation done at
module init. Pass the management of the Qdisc register and unregister
operations to the loading and unloading of the DPAA driver.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
 drivers/net/ethernet/freescale/sdk_dpaa/Makefile   |  3 +-
 drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c | 19 +++++++++++++
 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c   | 32 +---------------------
 3 files changed, 21 insertions(+), 33 deletions(-)

--- a/drivers/net/ethernet/freescale/sdk_dpaa/Makefile
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/Makefile
@@ -20,8 +20,7 @@ endif
 
 ifeq ($(CONFIG_FSL_DPAA_CEETM),y)
 ccflags-y += -I$(srctree)/drivers/net/ethernet/freescale/sdk_fman/src/wrapper
-obj-$(CONFIG_FSL_SDK_DPAA_ETH) += fsl_ceetm.o
-fsl_ceetm-objs += dpaa_eth_ceetm.o
+fsl_dpa-objs += dpaa_eth_ceetm.o
 endif
 
 fsl_mac-objs += mac.o mac-api.o
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth.c
@@ -72,6 +72,9 @@
 #ifdef CONFIG_FSL_DPAA_DBG_LOOP
 #include "dpaa_debugfs.h"
 #endif /* CONFIG_FSL_DPAA_DBG_LOOP */
+#ifdef CONFIG_FSL_DPAA_CEETM
+#include "dpaa_eth_ceetm.h"
+#endif
 
 /* CREATE_TRACE_POINTS only needs to be defined once. Other dpa files
  * using trace events only need to #include <trace/events/sched.h>
@@ -116,6 +119,10 @@ static uint8_t dpa_priv_common_bpid;
 struct net_device *dpa_loop_netdevs[20];
 #endif
 
+#ifdef CONFIG_FSL_DPAA_CEETM
+extern struct Qdisc_ops ceetm_qdisc_ops;
+#endif
+
 #ifdef CONFIG_PM
 
 static int dpaa_suspend(struct device *dev)
@@ -1158,6 +1165,14 @@ static int __init __cold dpa_load(void)
 	pr_debug(KBUILD_MODNAME ": %s:%s() ->\n",
 		KBUILD_BASENAME".c", __func__);
 
+#ifdef CONFIG_FSL_DPAA_CEETM
+	_errno = register_qdisc(&ceetm_qdisc_ops);
+	if (unlikely(_errno))
+		pr_err(KBUILD_MODNAME
+		       ": %s:%hu:%s(): register_qdisc() = %d\n",
+		       KBUILD_BASENAME ".c", __LINE__, __func__, _errno);
+#endif
+
 	return _errno;
 }
 module_init(dpa_load);
@@ -1167,6 +1182,10 @@ static void __exit __cold dpa_unload(voi
 	pr_debug(KBUILD_MODNAME ": -> %s:%s()\n",
 		KBUILD_BASENAME".c", __func__);
 
+#ifdef CONFIG_FSL_DPAA_CEETM
+	unregister_qdisc(&ceetm_qdisc_ops);
+#endif
+
 	platform_driver_unregister(&dpa_driver);
 
 #ifdef CONFIG_FSL_DPAA_DBG_LOOP
--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
@@ -33,16 +33,13 @@
 #include <linux/init.h>
 #include "dpaa_eth_ceetm.h"
 
-#define DPA_CEETM_DESCRIPTION "FSL DPAA CEETM qdisc"
-MODULE_LICENSE("Dual BSD/GPL");
-MODULE_DESCRIPTION(DPA_CEETM_DESCRIPTION);
-
 const struct nla_policy ceetm_policy[TCA_CEETM_MAX + 1] = {
 	[TCA_CEETM_COPT] = { .len = sizeof(struct tc_ceetm_copt) },
 	[TCA_CEETM_QOPS] = { .len = sizeof(struct tc_ceetm_qopt) },
 };
 
 struct Qdisc_ops ceetm_qdisc_ops;
+EXPORT_SYMBOL(ceetm_qdisc_ops);
 
 /* Obtain the DCP and the SP ids from the FMan port */
 static void get_dcp_and_sp(struct net_device *dev, enum qm_dc_portal *dcp_id,
@@ -2086,30 +2083,3 @@ drop:
 	dev_kfree_skb_any(skb);
 	return NET_XMIT_SUCCESS;
 }
-EXPORT_SYMBOL(ceetm_tx);
-
-static int __init ceetm_register(void)
-{
-	int _errno = 0;
-
-	pr_info(KBUILD_MODNAME ": " DPA_CEETM_DESCRIPTION "\n");
-
-	_errno = register_qdisc(&ceetm_qdisc_ops);
-	if (unlikely(_errno))
-		pr_err(KBUILD_MODNAME
-		       ": %s:%hu:%s(): register_qdisc() = %d\n",
-		       KBUILD_BASENAME ".c", __LINE__, __func__, _errno);
-
-	return _errno;
-}
-
-static void __exit ceetm_unregister(void)
-{
-	pr_debug(KBUILD_MODNAME ": %s:%s() ->\n",
-		 KBUILD_BASENAME ".c", __func__);
-
-	unregister_qdisc(&ceetm_qdisc_ops);
-}
-
-module_init(ceetm_register);
-module_exit(ceetm_unregister);