diff options
| -rw-r--r-- | include/net/sch_generic.h | 12 | ||||
| -rw-r--r-- | net/ipv4/route.c | 4 | ||||
| -rw-r--r-- | net/ipv4/tcp_output.c | 6 | ||||
| -rw-r--r-- | net/sched/sch_api.c | 18 | ||||
| -rw-r--r-- | net/sched/sch_cbq.c | 4 | ||||
| -rw-r--r-- | net/sched/sch_generic.c | 4 | ||||
| -rw-r--r-- | net/sched/sch_hfsc.c | 4 | ||||
| -rw-r--r-- | net/sched/sch_htb.c | 4 |
8 files changed, 37 insertions, 19 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index b1d2cfea89c5..e5569625d2a5 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
| @@ -217,6 +217,14 @@ static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc) | |||
| 217 | return qdisc_lock(root); | 217 | return qdisc_lock(root); |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | static inline spinlock_t *qdisc_root_sleeping_lock(struct Qdisc *qdisc) | ||
| 221 | { | ||
| 222 | struct Qdisc *root = qdisc_root_sleeping(qdisc); | ||
| 223 | |||
| 224 | ASSERT_RTNL(); | ||
| 225 | return qdisc_lock(root); | ||
| 226 | } | ||
| 227 | |||
| 220 | static inline struct net_device *qdisc_dev(struct Qdisc *qdisc) | 228 | static inline struct net_device *qdisc_dev(struct Qdisc *qdisc) |
| 221 | { | 229 | { |
| 222 | return qdisc->dev_queue->dev; | 230 | return qdisc->dev_queue->dev; |
| @@ -224,12 +232,12 @@ static inline struct net_device *qdisc_dev(struct Qdisc *qdisc) | |||
| 224 | 232 | ||
| 225 | static inline void sch_tree_lock(struct Qdisc *q) | 233 | static inline void sch_tree_lock(struct Qdisc *q) |
| 226 | { | 234 | { |
| 227 | spin_lock_bh(qdisc_root_lock(q)); | 235 | spin_lock_bh(qdisc_root_sleeping_lock(q)); |
| 228 | } | 236 | } |
| 229 | 237 | ||
| 230 | static inline void sch_tree_unlock(struct Qdisc *q) | 238 | static inline void sch_tree_unlock(struct Qdisc *q) |
| 231 | { | 239 | { |
| 232 | spin_unlock_bh(qdisc_root_lock(q)); | 240 | spin_unlock_bh(qdisc_root_sleeping_lock(q)); |
| 233 | } | 241 | } |
| 234 | 242 | ||
| 235 | #define tcf_tree_lock(tp) sch_tree_lock((tp)->q) | 243 | #define tcf_tree_lock(tp) sch_tree_lock((tp)->q) |
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index e91bafeb32f4..6ee5354c9aa1 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c | |||
| @@ -3121,9 +3121,9 @@ static struct ctl_table empty[1]; | |||
| 3121 | static struct ctl_table ipv4_skeleton[] = | 3121 | static struct ctl_table ipv4_skeleton[] = |
| 3122 | { | 3122 | { |
| 3123 | { .procname = "route", .ctl_name = NET_IPV4_ROUTE, | 3123 | { .procname = "route", .ctl_name = NET_IPV4_ROUTE, |
| 3124 | .child = ipv4_route_table}, | 3124 | .mode = 0555, .child = ipv4_route_table}, |
| 3125 | { .procname = "neigh", .ctl_name = NET_IPV4_NEIGH, | 3125 | { .procname = "neigh", .ctl_name = NET_IPV4_NEIGH, |
| 3126 | .child = empty}, | 3126 | .mode = 0555, .child = empty}, |
| 3127 | { } | 3127 | { } |
| 3128 | }; | 3128 | }; |
| 3129 | 3129 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a00532de2a8c..8165f5aa8c71 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
| @@ -468,7 +468,8 @@ static unsigned tcp_syn_options(struct sock *sk, struct sk_buff *skb, | |||
| 468 | } | 468 | } |
| 469 | if (likely(sysctl_tcp_window_scaling)) { | 469 | if (likely(sysctl_tcp_window_scaling)) { |
| 470 | opts->ws = tp->rx_opt.rcv_wscale; | 470 | opts->ws = tp->rx_opt.rcv_wscale; |
| 471 | size += TCPOLEN_WSCALE_ALIGNED; | 471 | if(likely(opts->ws)) |
| 472 | size += TCPOLEN_WSCALE_ALIGNED; | ||
| 472 | } | 473 | } |
| 473 | if (likely(sysctl_tcp_sack)) { | 474 | if (likely(sysctl_tcp_sack)) { |
| 474 | opts->options |= OPTION_SACK_ADVERTISE; | 475 | opts->options |= OPTION_SACK_ADVERTISE; |
| @@ -509,7 +510,8 @@ static unsigned tcp_synack_options(struct sock *sk, | |||
| 509 | 510 | ||
| 510 | if (likely(ireq->wscale_ok)) { | 511 | if (likely(ireq->wscale_ok)) { |
| 511 | opts->ws = ireq->rcv_wscale; | 512 | opts->ws = ireq->rcv_wscale; |
| 512 | size += TCPOLEN_WSCALE_ALIGNED; | 513 | if(likely(opts->ws)) |
| 514 | size += TCPOLEN_WSCALE_ALIGNED; | ||
| 513 | } | 515 | } |
| 514 | if (likely(doing_ts)) { | 516 | if (likely(doing_ts)) { |
| 515 | opts->options |= OPTION_TS; | 517 | opts->options |= OPTION_TS; |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index e7fb9e0d21b4..506b709510b6 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
| @@ -624,7 +624,7 @@ static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | |||
| 624 | struct Qdisc *oqdisc = dev_queue->qdisc_sleeping; | 624 | struct Qdisc *oqdisc = dev_queue->qdisc_sleeping; |
| 625 | spinlock_t *root_lock; | 625 | spinlock_t *root_lock; |
| 626 | 626 | ||
| 627 | root_lock = qdisc_root_lock(oqdisc); | 627 | root_lock = qdisc_lock(oqdisc); |
| 628 | spin_lock_bh(root_lock); | 628 | spin_lock_bh(root_lock); |
| 629 | 629 | ||
| 630 | /* Prune old scheduler */ | 630 | /* Prune old scheduler */ |
| @@ -635,7 +635,7 @@ static struct Qdisc *dev_graft_qdisc(struct netdev_queue *dev_queue, | |||
| 635 | if (qdisc == NULL) | 635 | if (qdisc == NULL) |
| 636 | qdisc = &noop_qdisc; | 636 | qdisc = &noop_qdisc; |
| 637 | dev_queue->qdisc_sleeping = qdisc; | 637 | dev_queue->qdisc_sleeping = qdisc; |
| 638 | dev_queue->qdisc = &noop_qdisc; | 638 | rcu_assign_pointer(dev_queue->qdisc, &noop_qdisc); |
| 639 | 639 | ||
| 640 | spin_unlock_bh(root_lock); | 640 | spin_unlock_bh(root_lock); |
| 641 | 641 | ||
| @@ -830,9 +830,16 @@ qdisc_create(struct net_device *dev, struct netdev_queue *dev_queue, | |||
| 830 | sch->stab = stab; | 830 | sch->stab = stab; |
| 831 | } | 831 | } |
| 832 | if (tca[TCA_RATE]) { | 832 | if (tca[TCA_RATE]) { |
| 833 | spinlock_t *root_lock; | ||
| 834 | |||
| 835 | if ((sch->parent != TC_H_ROOT) && | ||
| 836 | !(sch->flags & TCQ_F_INGRESS)) | ||
| 837 | root_lock = qdisc_root_sleeping_lock(sch); | ||
| 838 | else | ||
| 839 | root_lock = qdisc_lock(sch); | ||
| 840 | |||
| 833 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, | 841 | err = gen_new_estimator(&sch->bstats, &sch->rate_est, |
| 834 | qdisc_root_lock(sch), | 842 | root_lock, tca[TCA_RATE]); |
| 835 | tca[TCA_RATE]); | ||
| 836 | if (err) { | 843 | if (err) { |
| 837 | /* | 844 | /* |
| 838 | * Any broken qdiscs that would require | 845 | * Any broken qdiscs that would require |
| @@ -884,7 +891,8 @@ static int qdisc_change(struct Qdisc *sch, struct nlattr **tca) | |||
| 884 | 891 | ||
| 885 | if (tca[TCA_RATE]) | 892 | if (tca[TCA_RATE]) |
| 886 | gen_replace_estimator(&sch->bstats, &sch->rate_est, | 893 | gen_replace_estimator(&sch->bstats, &sch->rate_est, |
| 887 | qdisc_root_lock(sch), tca[TCA_RATE]); | 894 | qdisc_root_sleeping_lock(sch), |
| 895 | tca[TCA_RATE]); | ||
| 888 | return 0; | 896 | return 0; |
| 889 | } | 897 | } |
| 890 | 898 | ||
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 8fa90d68ec6d..9b720adedead 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
| @@ -1839,7 +1839,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t | |||
| 1839 | 1839 | ||
| 1840 | if (tca[TCA_RATE]) | 1840 | if (tca[TCA_RATE]) |
| 1841 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1841 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
| 1842 | qdisc_root_lock(sch), | 1842 | qdisc_root_sleeping_lock(sch), |
| 1843 | tca[TCA_RATE]); | 1843 | tca[TCA_RATE]); |
| 1844 | return 0; | 1844 | return 0; |
| 1845 | } | 1845 | } |
| @@ -1930,7 +1930,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t | |||
| 1930 | 1930 | ||
| 1931 | if (tca[TCA_RATE]) | 1931 | if (tca[TCA_RATE]) |
| 1932 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1932 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
| 1933 | qdisc_root_lock(sch), tca[TCA_RATE]); | 1933 | qdisc_root_sleeping_lock(sch), tca[TCA_RATE]); |
| 1934 | 1934 | ||
| 1935 | *arg = (unsigned long)cl; | 1935 | *arg = (unsigned long)cl; |
| 1936 | return 0; | 1936 | return 0; |
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 5f0ade7806a7..9634091ee2f0 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
| @@ -634,7 +634,7 @@ static void dev_deactivate_queue(struct net_device *dev, | |||
| 634 | if (!(qdisc->flags & TCQ_F_BUILTIN)) | 634 | if (!(qdisc->flags & TCQ_F_BUILTIN)) |
| 635 | set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state); | 635 | set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state); |
| 636 | 636 | ||
| 637 | dev_queue->qdisc = qdisc_default; | 637 | rcu_assign_pointer(dev_queue->qdisc, qdisc_default); |
| 638 | qdisc_reset(qdisc); | 638 | qdisc_reset(qdisc); |
| 639 | 639 | ||
| 640 | spin_unlock_bh(qdisc_lock(qdisc)); | 640 | spin_unlock_bh(qdisc_lock(qdisc)); |
| @@ -709,7 +709,7 @@ static void shutdown_scheduler_queue(struct net_device *dev, | |||
| 709 | struct Qdisc *qdisc_default = _qdisc_default; | 709 | struct Qdisc *qdisc_default = _qdisc_default; |
| 710 | 710 | ||
| 711 | if (qdisc) { | 711 | if (qdisc) { |
| 712 | dev_queue->qdisc = qdisc_default; | 712 | rcu_assign_pointer(dev_queue->qdisc, qdisc_default); |
| 713 | dev_queue->qdisc_sleeping = qdisc_default; | 713 | dev_queue->qdisc_sleeping = qdisc_default; |
| 714 | 714 | ||
| 715 | qdisc_destroy(qdisc); | 715 | qdisc_destroy(qdisc); |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index c2b8d9cce3d2..c1e77da8cd09 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
| @@ -1045,7 +1045,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
| 1045 | 1045 | ||
| 1046 | if (tca[TCA_RATE]) | 1046 | if (tca[TCA_RATE]) |
| 1047 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1047 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
| 1048 | qdisc_root_lock(sch), | 1048 | qdisc_root_sleeping_lock(sch), |
| 1049 | tca[TCA_RATE]); | 1049 | tca[TCA_RATE]); |
| 1050 | return 0; | 1050 | return 0; |
| 1051 | } | 1051 | } |
| @@ -1104,7 +1104,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
| 1104 | 1104 | ||
| 1105 | if (tca[TCA_RATE]) | 1105 | if (tca[TCA_RATE]) |
| 1106 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1106 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
| 1107 | qdisc_root_lock(sch), tca[TCA_RATE]); | 1107 | qdisc_root_sleeping_lock(sch), tca[TCA_RATE]); |
| 1108 | *arg = (unsigned long)cl; | 1108 | *arg = (unsigned long)cl; |
| 1109 | return 0; | 1109 | return 0; |
| 1110 | } | 1110 | } |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 0df0df202ed0..97d4761cc31e 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
| @@ -1372,7 +1372,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
| 1372 | goto failure; | 1372 | goto failure; |
| 1373 | 1373 | ||
| 1374 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1374 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
| 1375 | qdisc_root_lock(sch), | 1375 | qdisc_root_sleeping_lock(sch), |
| 1376 | tca[TCA_RATE] ? : &est.nla); | 1376 | tca[TCA_RATE] ? : &est.nla); |
| 1377 | cl->refcnt = 1; | 1377 | cl->refcnt = 1; |
| 1378 | cl->children = 0; | 1378 | cl->children = 0; |
| @@ -1427,7 +1427,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid, | |||
| 1427 | } else { | 1427 | } else { |
| 1428 | if (tca[TCA_RATE]) | 1428 | if (tca[TCA_RATE]) |
| 1429 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1429 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
| 1430 | qdisc_root_lock(sch), | 1430 | qdisc_root_sleeping_lock(sch), |
| 1431 | tca[TCA_RATE]); | 1431 | tca[TCA_RATE]); |
| 1432 | sch_tree_lock(sch); | 1432 | sch_tree_lock(sch); |
| 1433 | } | 1433 | } |
