: pkt_sched: Make qdisc ->config() ops use validate/commit/cancel model.
Subsystems (4)
David Miller
maintainerPATCH 6/14 : pkt_sched: Make qdisc ->config() ops use validate/commit/cancel model.
Just like class grafting, qdisc configuration change requests now separate the arg validation and memory allocation from the actual commiting of the settings.
This allows multiqueue setups to properly unwind when the first queues would succeed but a subsequent one would not.
Signed-off-by David S. Miller <[email protected]>
--- include/net/pkt_sched.h | 3 +- include/net/sch_generic.h | 4 +- net/sched/sch_api.c | 71 ++++++++++++++-------- net/sched/sch_cbq.c | 1 - net/sched/sch_dsmark.c | 1 - net/sched/sch_fifo.c | 85 +++++++++++++++++++------- net/sched/sch_gred.c | 147 +++++++++++++++++++++++++++----------------- net/sched/sch_hfsc.c | 24 +++++--- net/sched/sch_htb.c | 1 - net/sched/sch_netem.c | 147 +++++++++++++++++++++++++++++--------------- net/sched/sch_prio.c | 112 ++++++++++++++++++++++++++-------- net/sched/sch_red.c | 72 ++++++++++++++++++---- net/sched/sch_sfq.c | 1 - net/sched/sch_tbf.c | 125 +++++++++++++++++++++++++++++++------- 14 files changed, 561 insertions(+), 233 deletions(-)
include/net/pkt_sched.h +2 -1
@@ -72,7 +72,8 @@ extern void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);extern struct Qdisc_ops pfifo_qdisc_ops;extern struct Qdisc_ops bfifo_qdisc_ops; -extern int fifo_set_limit (struct Qdisc *q,unsigned int limit); +extern int fifo_validate_limit (struct Qdisc *q,unsigned int limit); +extern void fifo_commit_limit (struct Qdisc *q,unsigned int limit);extern struct Qdisc *fifo_create_dflt (struct Qdisc *sch,struct Qdisc_ops *ops,unsigned int limit);
include/net/sch_generic.h +3 -1
@@ -102,7 +102,9 @@ struct Qdisc_opsint (*init)(struct Qdisc *,struct nlattr *arg);void (*reset)(struct Qdisc *);void (*destroy)(struct Qdisc *); -int (*change)(struct Qdisc *,struct nlattr *arg); +int (*validate_change)(struct Qdisc *,struct nlattr *arg); +void (*commit_change)(struct Qdisc *,struct nlattr *arg); +void (*cancel_change)(struct Qdisc *,struct nlattr *arg);int (*dump)(struct Qdisc *,struct sk_buff *);int (*dump_stats)(struct Qdisc *,struct gnet_dump *);
net/sched/sch_api.c +46 -25
101 lines not on this page · raw message
net/sched/sch_cbq.c +0 -1
@@ -2076,7 +2076,6 @@ static struct Qdisc_ops cbq_qdisc_ops __read_mostly = { .init = cbq_init, .reset = cbq_reset, .destroy = cbq_destroy, - .change = NULL, .dump = cbq_dump, .dump_stats = cbq_dump_stats, .owner = THIS_MODULE,
net/sched/sch_dsmark.c +0 -1
@@ -515,7 +515,6 @@ static struct Qdisc_ops dsmark_qdisc_ops __read_mostly = { .init = dsmark_init, .reset = dsmark_reset, .destroy = dsmark_destroy, - .change = NULL, .dump = dsmark_dump, .owner = THIS_MODULE, };
net/sched/sch_fifo.c +63 -22
135 lines not on this page · raw message
net/sched/sch_gred.c +90 -57
224 lines not on this page · raw message
net/sched/sch_hfsc.c +15 -9
@@ -1479,21 +1479,25 @@ hfsc_init_qdisc(struct Qdisc *sch, struct nlattr *opt)return 0 ; } -static int -hfsc_change_qdisc (struct Qdisc *sch,struct nlattr *opt) +static int hfsc_validate_change_qdisc (struct Qdisc *sch,struct nlattr *opt) { -struct hfsc_sched *q =qdisc_priv (sch); -struct tc_hfsc_qopt *qopt; - -if (opt ==NULL ||nla_len (opt) <sizeof (*qopt)) +if (nla_len (opt) <sizeof (struct tc_hfsc_qopt ))return -EINVAL ; - qopt =nla_data (opt); +return 0 ; +} + +static void hfsc_commit_change_qdisc (struct Qdisc *sch,struct nlattr *opt) +{ +struct tc_hfsc_qopt *qopt =nla_data (opt); +struct hfsc_sched *q =qdisc_priv (sch);sch_tree_lock (sch); q->defcls = qopt->defcls;sch_tree_unlock (sch); +} -return 0 ; +static void hfsc_cancel_change_qdisc (struct Qdisc *sch,struct nlattr *opt) +{ } static void
@@ -1748,7 +1752,9 @@ static const struct Qdisc_class_ops hfsc_class_ops = {static struct Qdisc_ops hfsc_qdisc_ops__read_mostly = { .id ="hfsc" , .init = hfsc_init_qdisc, - .change = hfsc_change_qdisc, + .validate_change= hfsc_validate_change_qdisc, + .commit_change = hfsc_commit_change_qdisc, + .cancel_change = hfsc_cancel_change_qdisc, .reset = hfsc_reset_qdisc, .destroy = hfsc_destroy_qdisc, .dump = hfsc_dump_qdisc,
net/sched/sch_htb.c +0 -1
@@ -1586,7 +1586,6 @@ static struct Qdisc_ops htb_qdisc_ops __read_mostly = { .init = htb_init, .reset = htb_reset, .destroy = htb_destroy, - .change = NULL /* htb_change */, .dump = htb_dump, .owner = THIS_MODULE, };
net/sched/sch_netem.c +97 -50
258 lines not on this page · raw message
net/sched/sch_prio.c +86 -26
164 lines not on this page · raw message
net/sched/sch_red.c +58 -14
129 lines not on this page · raw message
net/sched/sch_sfq.c +0 -1
@@ -629,7 +629,6 @@ static struct Qdisc_ops sfq_qdisc_ops __read_mostly = { .init = sfq_init, .reset = sfq_reset, .destroy = sfq_destroy, - .change = NULL, .dump = sfq_dump, .owner = THIS_MODULE, };
net/sched/sch_tbf.c +101 -24
198 lines not on this page · raw message
Signature · 1 line
1.5.6.2.255.gbed62