| b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | From d6fc3dc5591ca4f0b2a5a77b210c622d8b709362 Mon Sep 17 00:00:00 2001 |
| 2 | From: Camelia Groza <camelia.groza@nxp.com> |
| 3 | Date: Fri, 20 Dec 2019 15:56:53 +0200 |
| 4 | Subject: [PATCH] sdk_dpaa: ceetm: remove references to qdisc_lookup |
| 5 | |
| 6 | In order to enable building the driver as a module, remove the |
| 7 | references to the undefined qdisc_lookup symbol. |
| 8 | |
| 9 | Signed-off-by: Camelia Groza <camelia.groza@nxp.com> |
| 10 | --- |
| 11 | .../ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c | 49 ++++++++++++++++------ |
| 12 | 1 file changed, 36 insertions(+), 13 deletions(-) |
| 13 | |
| 14 | --- a/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c |
| 15 | +++ b/drivers/net/ethernet/freescale/sdk_dpaa/dpaa_eth_ceetm.c |
| 16 | @@ -812,8 +812,8 @@ static int ceetm_init_prio(struct Qdisc |
| 17 | int err; |
| 18 | unsigned int i; |
| 19 | struct ceetm_class *parent_cl, *child_cl; |
| 20 | - struct Qdisc *parent_qdisc; |
| 21 | struct net_device *dev = qdisc_dev(sch); |
| 22 | + struct Qdisc *root_qdisc = dev->qdisc; |
| 23 | |
| 24 | pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle); |
| 25 | |
| 26 | @@ -822,14 +822,18 @@ static int ceetm_init_prio(struct Qdisc |
| 27 | return -EINVAL; |
| 28 | } |
| 29 | |
| 30 | - parent_qdisc = qdisc_lookup(dev, TC_H_MAJ(sch->parent)); |
| 31 | - if (strcmp(parent_qdisc->ops->id, ceetm_qdisc_ops.id)) { |
| 32 | + if (TC_H_MAJ(sch->parent) != TC_H_MAJ(root_qdisc->handle)) { |
| 33 | + pr_err("CEETM: a prio ceetm qdiscs can be added only under a root ceetm class\n"); |
| 34 | + return -EINVAL; |
| 35 | + } |
| 36 | + |
| 37 | + if (strcmp(root_qdisc->ops->id, ceetm_qdisc_ops.id)) { |
| 38 | pr_err("CEETM: a ceetm qdisc can not be attached to other qdisc/class types\n"); |
| 39 | return -EINVAL; |
| 40 | } |
| 41 | |
| 42 | /* Obtain the parent root ceetm_class */ |
| 43 | - parent_cl = ceetm_find(sch->parent, parent_qdisc); |
| 44 | + parent_cl = ceetm_find(sch->parent, root_qdisc); |
| 45 | |
| 46 | if (!parent_cl || parent_cl->type != CEETM_ROOT) { |
| 47 | pr_err("CEETM: a prio ceetm qdiscs can be added only under a root ceetm class\n"); |
| 48 | @@ -902,9 +906,9 @@ static int ceetm_init_wbfs(struct Qdisc |
| 49 | { |
| 50 | int err, group_b, small_group; |
| 51 | unsigned int i, id, prio_a, prio_b; |
| 52 | - struct ceetm_class *parent_cl, *child_cl, *root_cl; |
| 53 | - struct Qdisc *parent_qdisc; |
| 54 | - struct ceetm_qdisc *parent_priv; |
| 55 | + struct ceetm_class *parent_cl, *child_cl, *tmp_cl, *root_cl = NULL; |
| 56 | + struct Qdisc *root_qdisc, *parent_qdisc = NULL; |
| 57 | + struct ceetm_qdisc *root_priv; |
| 58 | struct net_device *dev = qdisc_dev(sch); |
| 59 | |
| 60 | pr_debug(KBUILD_BASENAME " : %s : qdisc %X\n", __func__, sch->handle); |
| 61 | @@ -915,16 +919,37 @@ static int ceetm_init_wbfs(struct Qdisc |
| 62 | return -EINVAL; |
| 63 | } |
| 64 | |
| 65 | - /* Obtain the parent prio ceetm qdisc */ |
| 66 | - parent_qdisc = qdisc_lookup(dev, TC_H_MAJ(sch->parent)); |
| 67 | - if (strcmp(parent_qdisc->ops->id, ceetm_qdisc_ops.id)) { |
| 68 | + root_qdisc = dev->qdisc; |
| 69 | + |
| 70 | + if (strcmp(root_qdisc->ops->id, ceetm_qdisc_ops.id)) { |
| 71 | pr_err("CEETM: a ceetm qdisc can not be attached to other qdisc/class types\n"); |
| 72 | return -EINVAL; |
| 73 | } |
| 74 | |
| 75 | + root_priv = qdisc_priv(root_qdisc); |
| 76 | + |
| 77 | + /* Obtain the root ceetm class and the parent prio ceetm qdisc */ |
| 78 | + for (i = 0; i < root_priv->clhash.hashsize; i++) { |
| 79 | + hlist_for_each_entry(tmp_cl, &root_priv->clhash.hash[i], |
| 80 | + common.hnode) { |
| 81 | + if (tmp_cl->root.child && |
| 82 | + (TC_H_MAJ(tmp_cl->root.child->handle) == |
| 83 | + TC_H_MAJ(sch->parent))) { |
| 84 | + parent_qdisc = tmp_cl->root.child; |
| 85 | + root_cl = tmp_cl; |
| 86 | + break; |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + if (!parent_qdisc || |
| 92 | + strcmp(parent_qdisc->ops->id, ceetm_qdisc_ops.id)) { |
| 93 | + pr_err("CEETM: a wbfs ceetm qdiscs can be added only under a prio ceetm class\n"); |
| 94 | + return -EINVAL; |
| 95 | + } |
| 96 | + |
| 97 | /* Obtain the parent prio ceetm class */ |
| 98 | parent_cl = ceetm_find(sch->parent, parent_qdisc); |
| 99 | - parent_priv = qdisc_priv(parent_qdisc); |
| 100 | |
| 101 | if (!parent_cl || parent_cl->type != CEETM_PRIO) { |
| 102 | pr_err("CEETM: a wbfs ceetm qdiscs can be added only under a prio ceetm class\n"); |
| 103 | @@ -948,8 +973,6 @@ static int ceetm_init_wbfs(struct Qdisc |
| 104 | return -EINVAL; |
| 105 | } |
| 106 | |
| 107 | - /* Obtain the parent root ceetm class */ |
| 108 | - root_cl = parent_priv->prio.parent; |
| 109 | if ((root_cl->root.wbfs_grp_a && root_cl->root.wbfs_grp_b) || |
| 110 | root_cl->root.wbfs_grp_large) { |
| 111 | pr_err("CEETM: no more wbfs classes are available\n"); |