lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20080714.155955.103946437.davem@davemloft.net>
Date:	Mon, 14 Jul 2008 15:59:55 -0700 (PDT)
From:	David Miller <davem@...emloft.net>
To:	netdev@...r.kernel.org
Subject: [PATCH 7/14]: pkt_sched: Use __qdisc_lookup() more consistently
 and export.


We should make lookups whenever possible in the namespace of a
specific queue.

Export so we can use in the classifier API in subsequent changesets.

Signed-off-by: David S. Miller <davem@...emloft.net>
---
 include/net/pkt_sched.h |    1 +
 net/sched/sch_api.c     |   17 ++++++++++-------
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 5d9ffe8..88f07c0 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -79,6 +79,7 @@ extern struct Qdisc *fifo_create_dflt(struct Qdisc *sch, struct Qdisc_ops *ops,
 
 extern int register_qdisc(struct Qdisc_ops *qops);
 extern int unregister_qdisc(struct Qdisc_ops *qops);
+extern struct Qdisc *__qdisc_lookup(struct netdev_queue *dev_queue, u32 handle);
 extern struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle);
 extern struct Qdisc *qdisc_lookup_class(struct net_device *dev, u32 handle);
 extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index d190c49..7d646db 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -183,7 +183,7 @@ EXPORT_SYMBOL(unregister_qdisc);
    (root qdisc, all its children, children of children etc.)
  */
 
-static struct Qdisc *__qdisc_lookup(struct netdev_queue *dev_queue, u32 handle)
+struct Qdisc *__qdisc_lookup(struct netdev_queue *dev_queue, u32 handle)
 {
 	struct Qdisc *q;
 
@@ -505,7 +505,7 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
 		if (TC_H_MAJ(parentid) == TC_H_MAJ(TC_H_INGRESS))
 			return;
 
-		sch = qdisc_lookup(qdisc_dev(sch), TC_H_MAJ(parentid));
+		sch = __qdisc_lookup(sch->dev_queue, TC_H_MAJ(parentid));
 		if (sch == NULL) {
 			WARN_ON(parentid != TC_H_ROOT);
 			return;
@@ -718,7 +718,8 @@ static int tc_get_prep_request(struct tc_qdisc_op_info *queue_arr, unsigned int
 				if (TC_H_MAJ(clid) == TC_H_MAJ(TC_H_INGRESS)) {
 					qp->op_q = dev_queue->qdisc;
 				} else {
-					qp->parent_q = qdisc_lookup(dev, TC_H_MAJ(clid));
+					qp->parent_q = __qdisc_lookup(dev_queue,
+								      TC_H_MAJ(clid));
 					if (!qp->parent_q)
 						return -ENOENT;
 					qp->op_q = qdisc_leaf(qp->parent_q, clid);
@@ -1186,7 +1187,8 @@ static int tc_prepare_one(struct tc_qdisc_op_info *qp, struct net_device *dev,
 	if (clid) {
 		if (clid != TC_H_ROOT) {
 			if (clid != TC_H_INGRESS) {
-				qp->parent_q = qdisc_lookup(dev, TC_H_MAJ(clid));
+				qp->parent_q = __qdisc_lookup(dev_queue,
+							      TC_H_MAJ(clid));
 				if (!qp->parent_q)
 					return -ENOENT;
 				qp->op_q = qdisc_leaf(qp->parent_q, clid);
@@ -1210,7 +1212,8 @@ static int tc_prepare_one(struct tc_qdisc_op_info *qp, struct net_device *dev,
 				if (TC_H_MIN(tcm->tcm_handle))
 					return -EINVAL;
 
-				qp->op_q = __qdisc_lookup(dev_queue, tcm->tcm_handle);
+				qp->op_q = __qdisc_lookup(dev_queue,
+							  tcm->tcm_handle);
 				if (!qp->op_q)
 					goto create_and_graft;
 
@@ -1265,7 +1268,7 @@ static int tc_prepare_one(struct tc_qdisc_op_info *qp, struct net_device *dev,
 	} else {
 		if (!tcm->tcm_handle)
 			return -EINVAL;
-		qp->op_q = qdisc_lookup(dev, tcm->tcm_handle);
+		qp->op_q = __qdisc_lookup(dev_queue, tcm->tcm_handle);
 	}
 
 	/* Change qdisc parameters */
@@ -1574,7 +1577,7 @@ static int tc_ctl_tclass(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
 	}
 
 	/* OK. Locate qdisc */
-	if ((q = qdisc_lookup(dev, qid)) == NULL)
+	if ((q = __qdisc_lookup(dev_queue, qid)) == NULL)
 		return -ENOENT;
 
 	/* An check that it supports classes */
-- 
1.5.6.2.255.gbed62

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ