Skip to contentSkip to conversation

: pkt_sched: Allocate anonymous qdisc handles in dev_queue namespace.

PATCH In review David Miller 1 participant 1 message Jul 14, 2008

Subsystems (3)
lore
Share & tools
lore

David Miller

author maintainer
#0 lore raw

PATCH 10/14 : pkt_sched: Allocate anonymous qdisc handles in dev_queue namespace.

When the user does not specify a specific handle, we should allocate in the per-dev_queue namespace.

qdisc_lookup_dev() is no longer used, delete.

---
 net/sched/sch_api.c |   19 +++----------------
 1 files changed, 3 insertions(+), 16 deletions(-)
net/sched/sch_api.c +3 -16
index cd5ff65..8473719 100644
@@ -194,19 +194,6 @@ struct Qdisc *qdisc_lookup(struct netdev_queue *dev_queue, u32 handle)
 	return NULL;
 }
 
-static struct Qdisc *qdisc_lookup_dev(struct net_device *dev, u32 handle)
-{
-	unsigned int i;
-
-	for (i = 0; i < dev->num_tx_queues; i++) {
-		struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
-		struct Qdisc *q = qdisc_lookup(txq, handle);
-		if (q)
-			return q;
-	}
-	return NULL;
-}
-
 static struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
 {
 	unsigned long cl;
@@ -435,7 +422,7 @@ EXPORT_SYMBOL(qdisc_class_hash_remove);
 
 /* Allocate an unique handle from space managed by kernel */
 
-static u32 qdisc_alloc_handle(struct net_device *dev)
+static u32 qdisc_alloc_handle(struct netdev_queue *dev_queue)
 {
 	int i = 0x10000;
 	static u32 autohandle = TC_H_MAKE(0x80000000U, 0);
@@ -444,7 +431,7 @@ static u32 qdisc_alloc_handle(struct net_device *dev)
 		autohandle += TC_H_MAKE(0x10000U, 0);
 		if (autohandle == TC_H_MAKE(TC_H_ROOT, 0))
 			autohandle = TC_H_MAKE(0x80000000U, 0);
-	} while	(qdisc_lookup_dev(dev, autohandle) && --i > 0);
+	} while	(qdisc_lookup(dev_queue, autohandle) && --i > 0);
 
 	return i>0 ? autohandle : 0;
 }
@@ -589,7 +576,7 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue,
 		handle = TC_H_MAKE(TC_H_INGRESS, 0);
 	} else {
 		if (handle == 0) {
-			handle = qdisc_alloc_handle(dev);
+			handle = qdisc_alloc_handle(dev_queue);
 			err = -ENOMEM;
 			if (handle == 0)
 				goto err_out_dev_put;
Signature · 1 line
1.5.6.2.255.gbed62