layerscape: add patches-5.4
[openwrt/staging/wigyori.git] / target / linux / layerscape / patches-5.4 / 701-net-0362-sdk_dpaa-ceetm-remove-references-to-qdisc_lookup.patch
diff --git a/target/linux/layerscape/patches-5.4/701-net-0362-sdk_dpaa-ceetm-remove-references-to-qdisc_lookup.patch b/target/linux/layerscape/patches-5.4/701-net-0362-sdk_dpaa-ceetm-remove-references-to-qdisc_lookup.patch
new file mode 100644 (file)
index 0000000..652ab89
--- /dev/null
@@ -0,0 +1,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");