diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-05 17:52:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-05 17:52:41 -0400 |
commit | 59430c2f437767094298f30dd02ca038da0df755 (patch) | |
tree | 3c79740e3580e403df02daafba26fa6e67552c16 /net | |
parent | e9ee3a54a164c249a0a576c403eba367a6d97be5 (diff) | |
parent | 16ebb5e0b36ceadc8186f71d68b0c4fa4b6e781b (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6:
tc: Fix unitialized kernel memory leak
pkt_sched: Revert tasklet_hrtimer changes.
net: sk_free() should be allowed right after sk_alloc()
gianfar: gfar_remove needs to call unregister_netdev()
ipw2200: firmware DMA loading rework
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 2 | ||||
-rw-r--r-- | net/sched/sch_api.c | 12 | ||||
-rw-r--r-- | net/sched/sch_cbq.c | 25 |
3 files changed, 19 insertions, 20 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index bbb25be7ddfe..76334228ed1c 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1025,6 +1025,7 @@ struct sock *sk_alloc(struct net *net, int family, gfp_t priority, | |||
1025 | sk->sk_prot = sk->sk_prot_creator = prot; | 1025 | sk->sk_prot = sk->sk_prot_creator = prot; |
1026 | sock_lock_init(sk); | 1026 | sock_lock_init(sk); |
1027 | sock_net_set(sk, get_net(net)); | 1027 | sock_net_set(sk, get_net(net)); |
1028 | atomic_set(&sk->sk_wmem_alloc, 1); | ||
1028 | } | 1029 | } |
1029 | 1030 | ||
1030 | return sk; | 1031 | return sk; |
@@ -1872,7 +1873,6 @@ void sock_init_data(struct socket *sock, struct sock *sk) | |||
1872 | */ | 1873 | */ |
1873 | smp_wmb(); | 1874 | smp_wmb(); |
1874 | atomic_set(&sk->sk_refcnt, 1); | 1875 | atomic_set(&sk->sk_refcnt, 1); |
1875 | atomic_set(&sk->sk_wmem_alloc, 1); | ||
1876 | atomic_set(&sk->sk_drops, 0); | 1876 | atomic_set(&sk->sk_drops, 0); |
1877 | } | 1877 | } |
1878 | EXPORT_SYMBOL(sock_init_data); | 1878 | EXPORT_SYMBOL(sock_init_data); |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 92e6f3a52c13..fdb694e9f759 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -458,7 +458,7 @@ EXPORT_SYMBOL(qdisc_warn_nonwc); | |||
458 | static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer) | 458 | static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer) |
459 | { | 459 | { |
460 | struct qdisc_watchdog *wd = container_of(timer, struct qdisc_watchdog, | 460 | struct qdisc_watchdog *wd = container_of(timer, struct qdisc_watchdog, |
461 | timer.timer); | 461 | timer); |
462 | 462 | ||
463 | wd->qdisc->flags &= ~TCQ_F_THROTTLED; | 463 | wd->qdisc->flags &= ~TCQ_F_THROTTLED; |
464 | __netif_schedule(qdisc_root(wd->qdisc)); | 464 | __netif_schedule(qdisc_root(wd->qdisc)); |
@@ -468,8 +468,8 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer) | |||
468 | 468 | ||
469 | void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc) | 469 | void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc) |
470 | { | 470 | { |
471 | tasklet_hrtimer_init(&wd->timer, qdisc_watchdog, | 471 | hrtimer_init(&wd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); |
472 | CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | 472 | wd->timer.function = qdisc_watchdog; |
473 | wd->qdisc = qdisc; | 473 | wd->qdisc = qdisc; |
474 | } | 474 | } |
475 | EXPORT_SYMBOL(qdisc_watchdog_init); | 475 | EXPORT_SYMBOL(qdisc_watchdog_init); |
@@ -485,13 +485,13 @@ void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, psched_time_t expires) | |||
485 | wd->qdisc->flags |= TCQ_F_THROTTLED; | 485 | wd->qdisc->flags |= TCQ_F_THROTTLED; |
486 | time = ktime_set(0, 0); | 486 | time = ktime_set(0, 0); |
487 | time = ktime_add_ns(time, PSCHED_TICKS2NS(expires)); | 487 | time = ktime_add_ns(time, PSCHED_TICKS2NS(expires)); |
488 | tasklet_hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS); | 488 | hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS); |
489 | } | 489 | } |
490 | EXPORT_SYMBOL(qdisc_watchdog_schedule); | 490 | EXPORT_SYMBOL(qdisc_watchdog_schedule); |
491 | 491 | ||
492 | void qdisc_watchdog_cancel(struct qdisc_watchdog *wd) | 492 | void qdisc_watchdog_cancel(struct qdisc_watchdog *wd) |
493 | { | 493 | { |
494 | tasklet_hrtimer_cancel(&wd->timer); | 494 | hrtimer_cancel(&wd->timer); |
495 | wd->qdisc->flags &= ~TCQ_F_THROTTLED; | 495 | wd->qdisc->flags &= ~TCQ_F_THROTTLED; |
496 | } | 496 | } |
497 | EXPORT_SYMBOL(qdisc_watchdog_cancel); | 497 | EXPORT_SYMBOL(qdisc_watchdog_cancel); |
@@ -1456,6 +1456,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
1456 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); | 1456 | nlh = NLMSG_NEW(skb, pid, seq, event, sizeof(*tcm), flags); |
1457 | tcm = NLMSG_DATA(nlh); | 1457 | tcm = NLMSG_DATA(nlh); |
1458 | tcm->tcm_family = AF_UNSPEC; | 1458 | tcm->tcm_family = AF_UNSPEC; |
1459 | tcm->tcm__pad1 = 0; | ||
1460 | tcm->tcm__pad2 = 0; | ||
1459 | tcm->tcm_ifindex = qdisc_dev(q)->ifindex; | 1461 | tcm->tcm_ifindex = qdisc_dev(q)->ifindex; |
1460 | tcm->tcm_parent = q->handle; | 1462 | tcm->tcm_parent = q->handle; |
1461 | tcm->tcm_handle = q->handle; | 1463 | tcm->tcm_handle = q->handle; |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 149b0405c5ec..d5798e17a832 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -163,7 +163,7 @@ struct cbq_sched_data | |||
163 | psched_time_t now_rt; /* Cached real time */ | 163 | psched_time_t now_rt; /* Cached real time */ |
164 | unsigned pmask; | 164 | unsigned pmask; |
165 | 165 | ||
166 | struct tasklet_hrtimer delay_timer; | 166 | struct hrtimer delay_timer; |
167 | struct qdisc_watchdog watchdog; /* Watchdog timer, | 167 | struct qdisc_watchdog watchdog; /* Watchdog timer, |
168 | started when CBQ has | 168 | started when CBQ has |
169 | backlog, but cannot | 169 | backlog, but cannot |
@@ -503,8 +503,6 @@ static void cbq_ovl_delay(struct cbq_class *cl) | |||
503 | cl->undertime = q->now + delay; | 503 | cl->undertime = q->now + delay; |
504 | 504 | ||
505 | if (delay > 0) { | 505 | if (delay > 0) { |
506 | struct hrtimer *ht; | ||
507 | |||
508 | sched += delay + cl->penalty; | 506 | sched += delay + cl->penalty; |
509 | cl->penalized = sched; | 507 | cl->penalized = sched; |
510 | cl->cpriority = TC_CBQ_MAXPRIO; | 508 | cl->cpriority = TC_CBQ_MAXPRIO; |
@@ -512,12 +510,12 @@ static void cbq_ovl_delay(struct cbq_class *cl) | |||
512 | 510 | ||
513 | expires = ktime_set(0, 0); | 511 | expires = ktime_set(0, 0); |
514 | expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); | 512 | expires = ktime_add_ns(expires, PSCHED_TICKS2NS(sched)); |
515 | ht = &q->delay_timer.timer; | 513 | if (hrtimer_try_to_cancel(&q->delay_timer) && |
516 | if (hrtimer_try_to_cancel(ht) && | 514 | ktime_to_ns(ktime_sub( |
517 | ktime_to_ns(ktime_sub(hrtimer_get_expires(ht), | 515 | hrtimer_get_expires(&q->delay_timer), |
518 | expires)) > 0) | 516 | expires)) > 0) |
519 | hrtimer_set_expires(ht, expires); | 517 | hrtimer_set_expires(&q->delay_timer, expires); |
520 | hrtimer_restart(ht); | 518 | hrtimer_restart(&q->delay_timer); |
521 | cl->delayed = 1; | 519 | cl->delayed = 1; |
522 | cl->xstats.overactions++; | 520 | cl->xstats.overactions++; |
523 | return; | 521 | return; |
@@ -593,7 +591,7 @@ static psched_tdiff_t cbq_undelay_prio(struct cbq_sched_data *q, int prio, | |||
593 | static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) | 591 | static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) |
594 | { | 592 | { |
595 | struct cbq_sched_data *q = container_of(timer, struct cbq_sched_data, | 593 | struct cbq_sched_data *q = container_of(timer, struct cbq_sched_data, |
596 | delay_timer.timer); | 594 | delay_timer); |
597 | struct Qdisc *sch = q->watchdog.qdisc; | 595 | struct Qdisc *sch = q->watchdog.qdisc; |
598 | psched_time_t now; | 596 | psched_time_t now; |
599 | psched_tdiff_t delay = 0; | 597 | psched_tdiff_t delay = 0; |
@@ -623,7 +621,7 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer) | |||
623 | 621 | ||
624 | time = ktime_set(0, 0); | 622 | time = ktime_set(0, 0); |
625 | time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay)); | 623 | time = ktime_add_ns(time, PSCHED_TICKS2NS(now + delay)); |
626 | tasklet_hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS); | 624 | hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS); |
627 | } | 625 | } |
628 | 626 | ||
629 | sch->flags &= ~TCQ_F_THROTTLED; | 627 | sch->flags &= ~TCQ_F_THROTTLED; |
@@ -1216,7 +1214,7 @@ cbq_reset(struct Qdisc* sch) | |||
1216 | q->tx_class = NULL; | 1214 | q->tx_class = NULL; |
1217 | q->tx_borrowed = NULL; | 1215 | q->tx_borrowed = NULL; |
1218 | qdisc_watchdog_cancel(&q->watchdog); | 1216 | qdisc_watchdog_cancel(&q->watchdog); |
1219 | tasklet_hrtimer_cancel(&q->delay_timer); | 1217 | hrtimer_cancel(&q->delay_timer); |
1220 | q->toplevel = TC_CBQ_MAXLEVEL; | 1218 | q->toplevel = TC_CBQ_MAXLEVEL; |
1221 | q->now = psched_get_time(); | 1219 | q->now = psched_get_time(); |
1222 | q->now_rt = q->now; | 1220 | q->now_rt = q->now; |
@@ -1399,8 +1397,7 @@ static int cbq_init(struct Qdisc *sch, struct nlattr *opt) | |||
1399 | q->link.minidle = -0x7FFFFFFF; | 1397 | q->link.minidle = -0x7FFFFFFF; |
1400 | 1398 | ||
1401 | qdisc_watchdog_init(&q->watchdog, sch); | 1399 | qdisc_watchdog_init(&q->watchdog, sch); |
1402 | tasklet_hrtimer_init(&q->delay_timer, cbq_undelay, | 1400 | hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); |
1403 | CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | ||
1404 | q->delay_timer.function = cbq_undelay; | 1401 | q->delay_timer.function = cbq_undelay; |
1405 | q->toplevel = TC_CBQ_MAXLEVEL; | 1402 | q->toplevel = TC_CBQ_MAXLEVEL; |
1406 | q->now = psched_get_time(); | 1403 | q->now = psched_get_time(); |