diff options
Diffstat (limited to 'net/sched/sch_generic.c')
-rw-r--r-- | net/sched/sch_generic.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index ff4dd53eeff..a63029ef3ed 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/list.h> | 26 | #include <linux/list.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <net/pkt_sched.h> | 28 | #include <net/pkt_sched.h> |
29 | #include <net/dst.h> | ||
29 | 30 | ||
30 | /* Main transmission queue. */ | 31 | /* Main transmission queue. */ |
31 | 32 | ||
@@ -40,6 +41,7 @@ | |||
40 | 41 | ||
41 | static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) | 42 | static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) |
42 | { | 43 | { |
44 | skb_dst_force(skb); | ||
43 | q->gso_skb = skb; | 45 | q->gso_skb = skb; |
44 | q->qstats.requeues++; | 46 | q->qstats.requeues++; |
45 | q->q.qlen++; /* it's still part of the queue */ | 47 | q->q.qlen++; /* it's still part of the queue */ |
@@ -94,7 +96,7 @@ static inline int handle_dev_cpu_collision(struct sk_buff *skb, | |||
94 | * Another cpu is holding lock, requeue & delay xmits for | 96 | * Another cpu is holding lock, requeue & delay xmits for |
95 | * some time. | 97 | * some time. |
96 | */ | 98 | */ |
97 | __get_cpu_var(netdev_rx_stat).cpu_collision++; | 99 | __get_cpu_var(softnet_data).cpu_collision++; |
98 | ret = dev_requeue_skb(skb, q); | 100 | ret = dev_requeue_skb(skb, q); |
99 | } | 101 | } |
100 | 102 | ||
@@ -179,7 +181,7 @@ static inline int qdisc_restart(struct Qdisc *q) | |||
179 | skb = dequeue_skb(q); | 181 | skb = dequeue_skb(q); |
180 | if (unlikely(!skb)) | 182 | if (unlikely(!skb)) |
181 | return 0; | 183 | return 0; |
182 | 184 | WARN_ON_ONCE(skb_dst_is_noref(skb)); | |
183 | root_lock = qdisc_lock(q); | 185 | root_lock = qdisc_lock(q); |
184 | dev = qdisc_dev(q); | 186 | dev = qdisc_dev(q); |
185 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); | 187 | txq = netdev_get_tx_queue(dev, skb_get_queue_mapping(skb)); |
@@ -529,7 +531,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, | |||
529 | unsigned int size; | 531 | unsigned int size; |
530 | int err = -ENOBUFS; | 532 | int err = -ENOBUFS; |
531 | 533 | ||
532 | /* ensure that the Qdisc and the private data are 32-byte aligned */ | 534 | /* ensure that the Qdisc and the private data are 64-byte aligned */ |
533 | size = QDISC_ALIGN(sizeof(*sch)); | 535 | size = QDISC_ALIGN(sizeof(*sch)); |
534 | size += ops->priv_size + (QDISC_ALIGNTO - 1); | 536 | size += ops->priv_size + (QDISC_ALIGNTO - 1); |
535 | 537 | ||
@@ -591,6 +593,13 @@ void qdisc_reset(struct Qdisc *qdisc) | |||
591 | } | 593 | } |
592 | EXPORT_SYMBOL(qdisc_reset); | 594 | EXPORT_SYMBOL(qdisc_reset); |
593 | 595 | ||
596 | static void qdisc_rcu_free(struct rcu_head *head) | ||
597 | { | ||
598 | struct Qdisc *qdisc = container_of(head, struct Qdisc, rcu_head); | ||
599 | |||
600 | kfree((char *) qdisc - qdisc->padded); | ||
601 | } | ||
602 | |||
594 | void qdisc_destroy(struct Qdisc *qdisc) | 603 | void qdisc_destroy(struct Qdisc *qdisc) |
595 | { | 604 | { |
596 | const struct Qdisc_ops *ops = qdisc->ops; | 605 | const struct Qdisc_ops *ops = qdisc->ops; |
@@ -614,7 +623,11 @@ void qdisc_destroy(struct Qdisc *qdisc) | |||
614 | dev_put(qdisc_dev(qdisc)); | 623 | dev_put(qdisc_dev(qdisc)); |
615 | 624 | ||
616 | kfree_skb(qdisc->gso_skb); | 625 | kfree_skb(qdisc->gso_skb); |
617 | kfree((char *) qdisc - qdisc->padded); | 626 | /* |
627 | * gen_estimator est_timer() might access qdisc->q.lock, | ||
628 | * wait a RCU grace period before freeing qdisc. | ||
629 | */ | ||
630 | call_rcu(&qdisc->rcu_head, qdisc_rcu_free); | ||
618 | } | 631 | } |
619 | EXPORT_SYMBOL(qdisc_destroy); | 632 | EXPORT_SYMBOL(qdisc_destroy); |
620 | 633 | ||