aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/layerscape/patches-5.4/701-net-0362-sdk_dpaa-ceetm-remove-references-to-qdisc_lookup.patch
blob: 652ab89dd83e9c28a054d1287b8fde246da8f4bf (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
From d6fc3dc5591ca4f0b2a5a77b210c622d8b709362 Mon Sep 17 00:00:00 2001
From: Camelia Groza <camelia.groza@nxp.com>
Date: Fri, 20 Dec 2019 15:56:53 +0200
Subject: [PATCH] sdk_dpaa: ceetm: remove references to qdisc_lookup

In order to enable building the driver as a module, remove the
references to the undefined qdisc_lookup symbol.

Signed-off-by: Camelia Groza <camelia.groza@nxp.com>
---
 .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c   | 49 ++++++++++++++++------
 1 file changed, 36 insertions(+), 13 deletions(-)

--- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
+++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c
@@ -812,8 +812,8 @@ static int ceetm_init_prio(struct Qdisc
 	int err;
 	unsigned int i;
 	struct ceetm_class *parent_cl, *child_cl;
-	struct Qdisc *parent_qdisc;
 	struct net_device *dev = qdisc_dev(sch);
+	struct Qdisc *root_qdisc = dev->qdisc;
 
 	pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
 
@@ -822,14 +822,18 @@ static int ceetm_init_prio(struct Qdisc
 		return -EINVAL;
 	}
 
-	parent_qdisc = qdisc_lookup(dev, TC_H_MAJ(sch->parent));
-	if (strcmp(parent_qdisc->ops->id, ceetm_qdisc_ops.id)) {
+	if (TC_H_MAJ(sch->parent) != TC_H_MAJ(root_qdisc->handle)) {
+		pr_err("CEETM: a prio ceetm qdiscs can be added only under a root ceetm class\n");
+		return -EINVAL;
+	}
+
+	if (strcmp(root_qdisc->ops->id, ceetm_qdisc_ops.id)) {
 		pr_err("CEETM: a ceetm qdisc can not be attached to other qdisc/class types\n");
 		return -EINVAL;
 	}
 
 	/* Obtain the parent root ceetm_class */
-	parent_cl = ceetm_find(sch->parent, parent_qdisc);
+	parent_cl = ceetm_find(sch->parent, root_qdisc);
 
 	if (!parent_cl || parent_cl->type != CEETM_ROOT) {
 		pr_err("CEETM: a prio ceetm qdiscs can be added only under a root ceetm class\n");
@@ -902,9 +906,9 @@ static int ceetm_init_wbfs(struct Qdisc
 {
 	int err, group_b, small_group;
 	unsigned int i, id, prio_a, prio_b;
-	struct ceetm_class *parent_cl, *child_cl, *root_cl;
-	struct Qdisc *parent_qdisc;
-	struct ceetm_qdisc *parent_priv;
+	struct ceetm_class *parent_cl, *child_cl, *tmp_cl, *root_cl = NULL;
+	struct Qdisc *root_qdisc, *parent_qdisc = NULL;
+	struct ceetm_qdisc *root_priv;
 	struct net_device *dev = qdisc_dev(sch);
 
 	pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle);
@@ -915,16 +919,37 @@ static int ceetm_init_wbfs(struct Qdisc
 		return -EINVAL;
 	}
 
-	/* Obtain the parent prio ceetm qdisc */
-	parent_qdisc = qdisc_lookup(dev, TC_H_MAJ(sch->parent));
-	if (strcmp(parent_qdisc->ops->id, ceetm_qdisc_ops.id)) {
+	root_qdisc = dev->qdisc;
+
+	if (strcmp(root_qdisc->ops->id, ceetm_qdisc_ops.id)) {
 		pr_err("CEETM: a ceetm qdisc can not be attached to other qdisc/class types\n");
 		return -EINVAL;
 	}
 
+	root_priv = qdisc_priv(root_qdisc);
+
+	/* Obtain the root ceetm class and the parent prio ceetm qdisc */
+	for (i = 0; i < root_priv->clhash.hashsize; i++) {
+		hlist_for_each_entry(tmp_cl, &root_priv->clhash.hash[i],
+				     common.hnode) {
+			if (tmp_cl->root.child &&
+			    (TC_H_MAJ(tmp_cl->root.child->handle) ==
+			    TC_H_MAJ(sch->parent))) {
+				parent_qdisc = tmp_cl->root.child;
+				root_cl = tmp_cl;
+				break;
+			}
+		}
+	}
+
+	if (!parent_qdisc ||
+	    strcmp(parent_qdisc->ops->id, ceetm_qdisc_ops.id)) {
+		pr_err("CEETM: a wbfs ceetm qdiscs can be added only under a prio ceetm class\n");
+		return -EINVAL;
+	}
+
 	/* Obtain the parent prio ceetm class */
 	parent_cl = ceetm_find(sch->parent, parent_qdisc);
-	parent_priv = qdisc_priv(parent_qdisc);
 
 	if (!parent_cl || parent_cl->type != CEETM_PRIO) {
 		pr_err("CEETM: a wbfs ceetm qdiscs can be added only under a prio ceetm class\n");
@@ -948,8 +973,6 @@ static int ceetm_init_wbfs(struct Qdisc
 		return -EINVAL;
 	}
 
-	/* Obtain the parent root ceetm class */
-	root_cl = parent_priv->prio.parent;
 	if ((root_cl->root.wbfs_grp_a && root_cl->root.wbfs_grp_b) ||
 	    root_cl->root.wbfs_grp_large) {
 		pr_err("CEETM: no more wbfs classes are available\n");