net_sched: move dev_graft_qdisc() to sch_generic.c
It will be used in a following patch by the multiqueue qdisc. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
af356afa01
commit
589983cd21
@@ -610,32 +610,6 @@ static u32 qdisc_alloc_handle(struct net_device *dev)
|
||||
return i>0 ? autohandle : 0;
|
||||
}
|
||||
|
||||
/* Attach toplevel qdisc to device queue. */
|
||||
|
||||
static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue,
|
||||
struct Qdisc *qdisc)
|
||||
{
|
||||
struct Qdisc *oqdisc = dev_queue->qdisc_sleeping;
|
||||
spinlock_t *root_lock;
|
||||
|
||||
root_lock = qdisc_lock(oqdisc);
|
||||
spin_lock_bh(root_lock);
|
||||
|
||||
/* Prune old scheduler */
|
||||
if (oqdisc && atomic_read(&oqdisc->refcnt) <= 1)
|
||||
qdisc_reset(oqdisc);
|
||||
|
||||
/* ... and graft new one */
|
||||
if (qdisc == NULL)
|
||||
qdisc = &noop_qdisc;
|
||||
dev_queue->qdisc_sleeping = qdisc;
|
||||
rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc);
|
||||
|
||||
spin_unlock_bh(root_lock);
|
||||
|
||||
return oqdisc;
|
||||
}
|
||||
|
||||
void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
|
||||
{
|
||||
const struct Qdisc_class_ops *cops;
|
||||
|
Reference in New Issue
Block a user