From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: devik@cdi.cz, netdev@vger.kernel.org,
Patrick McHardy <kaber@trash.net>,
shemminger@linux-foundation.org
Subject: [NET_SCHED 02/10]: Add hrtimer based qdisc watchdog
Date: Fri, 16 Mar 2007 06:30:51 +0100 (MET) [thread overview]
Message-ID: <20070316053021.22744.96564.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20070316053018.22744.76883.sendpatchset@localhost.localdomain>
[NET_SCHED]: Add hrtimer based qdisc watchdog
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
commit 4d0baa5c06cb04a53d8c68ecc10f38a295f08d14
tree 08da6754c9cc015a3118c452649d9fb6425dd903
parent e400fa6d9e7c13d675b96958a967e747148e9b70
author Patrick McHardy <kaber@trash.net> Fri, 16 Mar 2007 06:06:26 +0100
committer Patrick McHardy <kaber@trash.net> Fri, 16 Mar 2007 06:06:26 +0100
include/net/pkt_sched.h | 10 ++++++++++
net/sched/sch_api.c | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index 1c12afd..b090d55 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -64,6 +64,16 @@ #define PSCHED_SET_PASTPERFECT(t) ((t) =
#define PSCHED_IS_PASTPERFECT(t) ((t) == 0)
#define PSCHED_AUDIT_TDIFF(t)
+struct qdisc_watchdog {
+ struct hrtimer timer;
+ struct Qdisc *qdisc;
+};
+
+extern void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
+extern void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
+ psched_time_t expires);
+extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
+
extern struct Qdisc_ops pfifo_qdisc_ops;
extern struct Qdisc_ops bfifo_qdisc_ops;
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index d71bf79..6bc395c 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -34,6 +34,7 @@ #include <linux/seq_file.h>
#include <linux/kmod.h>
#include <linux/list.h>
#include <linux/bitops.h>
+#include <linux/hrtimer.h>
#include <net/sock.h>
#include <net/pkt_sched.h>
@@ -291,6 +292,41 @@ void qdisc_put_rtab(struct qdisc_rate_ta
}
}
+static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
+{
+ struct qdisc_watchdog *wd = container_of(timer, struct qdisc_watchdog,
+ timer);
+
+ wd->qdisc->flags &= ~TCQ_F_THROTTLED;
+ netif_schedule(wd->qdisc->dev);
+ return HRTIMER_NORESTART;
+}
+
+void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc)
+{
+ hrtimer_init(&wd->timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
+ wd->timer.function = qdisc_watchdog;
+ wd->qdisc = qdisc;
+}
+EXPORT_SYMBOL(qdisc_watchdog_init);
+
+void qdisc_watchdog_schedule(struct qdisc_watchdog *wd, psched_time_t expires)
+{
+ ktime_t time;
+
+ wd->qdisc->flags |= TCQ_F_THROTTLED;
+ time = ktime_set(0, 0);
+ time = ktime_add_ns(time, PSCHED_US2NS(expires));
+ hrtimer_start(&wd->timer, time, HRTIMER_MODE_ABS);
+}
+EXPORT_SYMBOL(qdisc_watchdog_schedule);
+
+void qdisc_watchdog_cancel(struct qdisc_watchdog *wd)
+{
+ hrtimer_cancel(&wd->timer);
+ wd->qdisc->flags &= ~TCQ_F_THROTTLED;
+}
+EXPORT_SYMBOL(qdisc_watchdog_cancel);
/* Allocate an unique handle from space managed by kernel */
next prev parent reply other threads:[~2007-03-16 5:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-16 5:30 [NET_SCHED 00/10]: ktime clocksource + hrtimer Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 01/10]: Use ktime as clocksource Patrick McHardy
2007-03-16 5:30 ` Patrick McHardy [this message]
2007-03-16 5:30 ` [NET_SCHED 03/10]: sch_hfsc: use hrtimer based watchdog Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 04/10]: sch_tbf: " Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 05/10]: sch_netem: " Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 06/10]: sch_cbq: " Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 07/10]: sch_cbq: fix cbq_undelay_prio for non-active priorites Patrick McHardy
2007-03-16 5:30 ` [NET_SCHED 08/10]: sch_cbq: use hrtimer for delay_timer Patrick McHardy
2007-03-16 5:31 ` [NET_SCHED 09/10]: sch_htb: use hrtimer based watchdog Patrick McHardy
2007-03-16 5:31 ` [NET_SCHED 10/10]: kill jiffie conversion macros Patrick McHardy
2007-03-16 9:35 ` [NET_SCHED 00/10]: ktime clocksource + hrtimer David Miller
2007-03-16 9:42 ` Patrick McHardy
2007-03-16 12:41 ` Thomas Graf
2007-03-16 12:45 ` Patrick McHardy
2007-03-16 19:31 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070316053021.22744.96564.sendpatchset@localhost.localdomain \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--cc=devik@cdi.cz \
--cc=netdev@vger.kernel.org \
--cc=shemminger@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.