net: sched: add Flow Queue PIE packet scheduler
Subsystems (3)
v3 cover net: sched: add Flow Queue PIE packet scheduler
From: Gautam Ramakrishnan <[email protected]>
Flow Queue PIE packet scheduler
This patch series implements the Flow Queue Proportional Integral controller Enhanced (FQ-PIE) active queue Management algorithm. It is an enhancement over the PIE algorithm. It integrates the PIE aqm with a deficit round robin scheme.
FQ-PIE is implemented over the latest version of PIE which uses timestamps to calculate queue delay with an additional option of using average dequeue rate to calculate the queue delay. This patch also adds a memory limit of all the packets across all queues to a default value of 32Mb.
For more information:
https://tools.ietf.org/html/rfc8033
Changes from v2 to v3
- Exported drop_early, pie_process_dequeue and calculate_probability functions from sch_pie as suggested by Stephen Hemminger.
Changes from v1 ( and RFC patch) to v2
- Added timestamp to calculate queue delay as recommended by Dave Taht
- Packet memory limit implemented as recommended by Toke.
- Added external classifier as recommended by Toke.
- Used NET_XMIT_CN instead of NET_XMIT_DROP as the return value in the fq_pie_qdisc_enqueue function.
Mohit P. Tahiliani (2):
net: sched: pie: refactor code
net: sched: add Flow Queue PIE packet scheduler
include/net/pie.h | 138 +++++++++ include/uapi/linux/pkt_sched.h | 33 ++ net/sched/Kconfig | 12 + net/sched/Makefile | 1 + net/sched/sch_fq_pie.c | 550 +++++++++++++++++++++++++++++++++ net/sched/sch_pie.c | 302 +++++++----------- 6 files changed, 846 insertions(+), 190 deletions(-) create mode 100644 include/net/pie.h create mode 100644 net/sched/sch_fq_pie.c
Signature · 1 line
2.17.1
PATCH v3 1/2 net: sched: pie: refactor code
From: "Mohit P. Tahiliani" <[email protected]>
This patch is a precursor for the addition of the Flow Queue Proportional Integral Controller Enhanced (FQ-PIE) qdisc. The patch removes structures and small inline functions common to both PIE and FQ-PIE and moves it to the header file include/net/pie.h. It also exports symbols from sch_pie.c that are to be reused by sch_fq_pie.c
--- include/net/pie.h | 136 ++++++++++++++++++++ net/sched/sch_pie.c | 302 ++++++++++++++++---------------------------- 2 files changed, 248 insertions(+), 190 deletions(-) create mode 100644 include/net/pie.h
include/net/pie.h new file +136 -0
@@ -0,0 +1,136 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __NET_SCHED_PIE_H +#define __NET_SCHED_PIE_H + +#include <linux/ktime.h> +#include <linux/skbuff.h> +#include <linux/types.h> +#include <net/inet_ecn.h> +#include <net/pkt_sched.h> + +#define QUEUE_THRESHOLD 16384 +#define PIE_SCALE 8 +#define DQCOUNT_INVALID -1 +#define DTIME_INVALID 0xffffffffffffffff +#define MAX_PROB 0xffffffffffffffff + +/** +* struct pie_params - contains pie parameters +* @target: target delay in pschedtime +* @tudpate: interval at which drop probability is calculated +* @limit: total number of packets that can be in the queue +* @alpha: parameter to control drop probability +* @beta: parameter to control drop probability +* @ecn: whether to enable ECN marking of packets +* @bytemode: whether to scale drop prob based on pkt size +* @dq_rate_estimator: whether to use little's law for qdelay calculation +*/ +struct pie_params { +psched_time_t target; +u32 tupdate; +u32 limit; +u32 alpha; +u32 beta; +u8 ecn; +u8 bytemode; +u8 dq_rate_estimator; +}; + +/** +* struct pie_vars - contains pie variables +* @burst_time: burst time allowance +* @qdelay: current queue delay +* @qdelay_old: queue delay in previous qdelay calculation +* @dq_tstamp: last instance at which dq rate was calculated +* @prob: drop probability +* @dq_count: number of bytes dequeued in a measurement cycle +* @accu_prob: accumulated drop probability +* @avg_dq_rate: calculated average dq rate +* @qlen_old: queue length during previous qdelay calculation +* @accu_prob_overflow: whether accu_prob overflowed +*/ +struct pie_vars { +psched_time_t burst_time; +psched_time_t qdelay; +psched_time_t qdelay_old; +psched_time_t dq_tstamp; +u64 prob; +u64 dq_count; +u64 accu_prob; +u32 avg_dq_rate; +u32 qlen_old; +u8 accu_prob_overflows; +}; + +/** +* struct pie_stats - contains pie stats +* @packets_in: total number of packets enqueued +* @dropped: packets dropped due to pie action +* @overlimit: packets dropped due to lack of space in queue +* @maxq: maximum queue size +* @ecn_mark: packets marked with ECN +*/ +struct pie_stats { +u32 packets_in; +u32 dropped; +u32 overlimit; +u32 maxq; +u32 ecn_mark; +}; + +/** +* struct pie_skb_cb - contains private skb vars +* @enqueue_time: timestamp when the packet is enqueued +*/ +struct pie_skb_cb { +psched_time_t enqueue_time; +}; + +static inline void pie_params_init (struct pie_params *params) +{ + params->target =PSCHED_NS2TICKS (15 *NSEC_PER_MSEC );/* 15 ms */ + params->tupdate =usecs_to_jiffies (15 *USEC_PER_MSEC );/* 15 ms */ + params->limit =1000 ;/* in packets */ + params->alpha =2 ; + params->beta =20 ; + params->ecn = false; + params->bytemode = false; + params->dq_rate_estimator = false; +} + +static inline void pie_vars_init (struct pie_vars *vars) +{ + vars->burst_time =PSCHED_NS2TICKS (150 *NSEC_PER_MSEC );/* 150 ms */ + vars->dq_count =DQCOUNT_INVALID ; + vars->dq_tstamp =DTIME_INVALID ; + vars->accu_prob =0 ; + vars->avg_dq_rate =0 ; + vars->accu_prob_overflows =0 ; +} + +static inline struct pie_skb_cb *get_pie_cb (const struct sk_buff *skb) +{ +qdisc_cb_private_validate (skb,sizeof (struct pie_skb_cb )); +return (struct pie_skb_cb *)qdisc_skb_cb (skb)->data; +} + +static inline psched_time_t pie_get_enqueue_time (const struct sk_buff *skb) +{ +return get_pie_cb (skb)->enqueue_time; +} + +static inline void pie_set_enqueue_time (struct sk_buff *skb) +{ +get_pie_cb (skb)->enqueue_time =psched_get_time (); +} + +bool pie_drop_early (struct Qdisc *sch,struct pie_params *params, +struct pie_vars *vars,u32 backlog,u32 packet_size); + +void pie_process_dequeue (struct sk_buff *skb,struct pie_params *params, +struct pie_vars *vars,u32 backlog); + +void pie_calculate_probability (struct pie_params *params,struct pie_vars *vars, +u32 backlog); + +#endif
net/sched/sch_pie.c +112 -190
508 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v3 2/2 net: sched: add Flow Queue PIE packet scheduler
In reply to [email protected]From: "Mohit P. Tahiliani" <[email protected]>
Principles:
- Packets are classified on flows.
- This is a Stochastic model (as we use a hash, several flows might be hashed on the same slot)
- Each flow has a PIE managed queue.
- Flows are linked onto two (Round Robin) lists,
so that new flows have priority on old ones.
- For a given flow, packets are not reordered.
- Drops during enqueue only.
- ECN capability is off by default.
- ECN threshold is at 10% by default.
- Uses timestamps to calculate queue delay by default.
Usage:
tc qdisc ... fq_pie [ limit PACKETS ] [ flows NUMBER ]
[ alpha NUMBER ] [ beta NUMBER ] [ target TIME us ] [ tupdate TIME us ] [ memory_limit BYTES ] [ quantum BYTES ] [ ecnprob PERCENTAGE ] [ [no]ecn ] [ [no]bytemode ] [ [no_]dq_rate_estimator ]
defaults:
limit: 10240 packets, flows: 1024
alpha: 1/8, beta : 5/4
target: 15 ms, tupdate: 15 ms (in jiffies)
memory_limit: 32 Mb, quantum: device MTU
ecnprob: 10%, ecn: off
bytemode: off, dq_rate_estimator: off
--- include/net/pie.h | 2 + include/uapi/linux/pkt_sched.h | 33 ++ net/sched/Kconfig | 12 + net/sched/Makefile | 1 + net/sched/sch_fq_pie.c | 550 +++++++++++++++++++++++++++++++++ 5 files changed, 598 insertions(+) create mode 100644 net/sched/sch_fq_pie.c
include/net/pie.h +2 -0
@@ -81,9 +81,11 @@ struct pie_stats {/** * struct pie_skb_cb - contains private skb vars * @enqueue_time: timestamp when the packet is enqueued +* @mem_usage: size of the skb during enqueue */ struct pie_skb_cb {psched_time_t enqueue_time; +u32 mem_usage; };static inline void pie_params_init (struct pie_params *params)
include/uapi/linux/pkt_sched.h +33 -0
@@ -971,6 +971,39 @@ struct tc_pie_xstats {__u32 ecn_mark;/* packets marked with ecn*/ }; +/* FQ PIE */ +enum { +TCA_FQ_PIE_UNSPEC , +TCA_FQ_PIE_LIMIT , +TCA_FQ_PIE_FLOWS , +TCA_FQ_PIE_ALPHA , +TCA_FQ_PIE_BETA , +TCA_FQ_PIE_TARGET , +TCA_FQ_PIE_TUPDATE , +TCA_FQ_PIE_MEMORY_LIMIT , +TCA_FQ_PIE_QUANTUM , +TCA_FQ_PIE_ECN_PROB , +TCA_FQ_PIE_ECN , +TCA_FQ_PIE_BYTEMODE , +TCA_FQ_PIE_DQ_RATE_ESTIMATOR , + __TCA_FQ_PIE_MAX +}; +#define TCA_FQ_PIE_MAX (__TCA_FQ_PIE_MAX - 1) + +struct tc_fq_pie_xstats { +__u32 packets_in;/* total number of packets enqueued */ +__u32 dropped;/* packets dropped due to fq_pie_action */ +__u32 overlimit;/* dropped due to lack of space in queue */ +__u32 overmemory;/* dropped due to lack of memory in queue */ +__u32 ecn_mark;/* packets marked with ecn */ +__u32 new_flow_count;/* number of times packets +* created a 'new flow' +*/ +__u32 new_flows_len;/* count of flows in new list */ +__u32 old_flows_len;/* count of flows in old list */ +__u32 memory_usage;/* total memory across all queues */ +}; +/* CBS */ struct tc_cbs_qopt {__u8 offload;
net/sched/Kconfig +12 -0
@@ -366,6 +366,18 @@ config NET_SCH_PIE If unsure, say N. +config NET_SCH_FQ_PIE + depends on NET_SCH_PIE + tristate "Flow Queue Proportional Integral controller Enhanced (FQ-PIE)" + help + Say Y here if you want to use the Flow Queue Proportional Integral + controller Enhanced (FQ-PIE) packet scheduling algorithm. + + To compile this driver as a module, choose M here: the module + will be called sch_fq_pie. + + If unsure, say N. + config NET_SCH_INGRESS tristate "Ingress/classifier-action Qdisc" depends on NET_CLS_ACT
net/sched/Makefile +1 -0
@@ -59,6 +59,7 @@ obj-$(CONFIG_NET_SCH_CAKE) += sch_cake.o obj-$(CONFIG_NET_SCH_FQ) += sch_fq.o obj-$(CONFIG_NET_SCH_HHF) += sch_hhf.o obj-$(CONFIG_NET_SCH_PIE) += sch_pie.o +obj-$(CONFIG_NET_SCH_FQ_PIE) += sch_fq_pie.o obj-$(CONFIG_NET_SCH_CBS) += sch_cbs.o obj-$(CONFIG_NET_SCH_ETF) += sch_etf.o obj-$(CONFIG_NET_SCH_TAPRIO) += sch_taprio.o
net/sched/sch_fq_pie.c new file +550 -0
550 lines not on this page · raw message
Signature · 1 line
2.17.1
Jakub Kicinski
maintainerQuoted 23 lines · On Fri, 10 Jan 2020 11:56:57 +0530, [email protected] wrote:
From: "Mohit P. Tahiliani" <[email protected]>
Principles:
- Packets are classified on flows.
- This is a Stochastic model (as we use a hash, several flows might be hashed on the same slot)
- Each flow has a PIE managed queue.
- Flows are linked onto two (Round Robin) lists,
so that new flows have priority on old ones.
- For a given flow, packets are not reordered.
- Drops during enqueue only.
- ECN capability is off by default.
- ECN threshold is at 10% by default.
- Uses timestamps to calculate queue delay by default.Usage:
tc qdisc ...fq_pie[ limit PACKETS ] [ flows NUMBER ]
[ alpha NUMBER ] [ beta NUMBER ] [ target TIME us ] [ tupdate TIME us ] [memory_limitBYTES ] [ quantum BYTES ] [ ecnprob PERCENTAGE ] [ [no]ecn ] [ [no]bytemode ] [ [no_]dq_rate_estimator ]
Quoted 7 lines
defaults:
limit: 10240 packets, flows: 1024
alpha: 1/8, beta : 5/4
target: 15 ms, tupdate: 15 ms (in jiffies)
memory_limit: 32 Mb, quantum: device MTU
ecnprob: 10%, ecn: off
bytemode: off,dq_rate_estimator: off
Some reviews below, but hopefully someone who knows more about qdiscs will still review :)
Quoted 7 lines
net/sched/Kconfig +0
-0@@ -366,6 +366,18 @@ config NET_SCH_PIE If unsure, say N.
net/sched/Kconfig config NET_SCH_PIE · line 377
Quoted 10 lines
net/sched/Kconfig +9
-0+config NET_SCH_FQ_PIE + depends on NET_SCH_PIE + tristate "Flow Queue Proportional Integral controller Enhanced (FQ-PIE)" + help + Say Y here if you want to use the Flow Queue Proportional Integral + controller Enhanced (FQ-PIE) packet scheduling algorithm. + + To compile this driver as a module, choose M here: the module + will be called sch_fq_pie.
Worth mentioning the RFC here?
net/sched/Kconfig config NET_SCH_PIE
Quoted 12 lines
net/sched/Kconfig +8
-0+ If unsure, say N. + config NET_SCH_INGRESS tristate "Ingress/classifier-action Qdisc" depends on NET_CLS_ACT +/* Flow Queue PIE + * + * Principles: + * - Packets are classified on flows. + * - This is a Stochastic model (as we use a hash, several flows might + * be hashed on the same slot)
s/on/to/ ?
Quoted 10 lines
+ * - Each flow has a PIE managed queue.
+ * - Flows are linked onto two (Round Robin) lists,
+ * so that new flows have priority on old ones.+ * - For a given flow, packets are not reordered. + * - Drops during enqueue only. + * - ECN capability is off by default. + * - ECN threshold is at 10% by default. + * - Uses timestamps to calculate queue delay by default.+ */
net/sched/Kconfig
Quoted 8 lines
net/sched/Kconfig +8
-0+static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt, + struct netlink_ext_ack *extack) +{ + struct fq_pie_sched_data *q = qdisc_priv(sch); + struct nlattr *tb[TCA_FQ_PIE_MAX + 1]; + unsigned int len_dropped = 0; + unsigned int num_dropped = 0; + unsigned int qlen;
net/sched/sch_fq_pie.c:275:15: warning: variable ‘qlen’ set but not used [-Wunused-but-set-variable]
275 | unsigned int qlen;
| ^~~~
net/sched/Kconfig
Quoted 7 lines
net/sched/Kconfig +7
-0+ int err; + + if (!opt) + return -EINVAL; + + err = nla_parse_nested_deprecated(tb, TCA_FQ_PIE_MAX, opt, + fq_pie_policy, NULL);
Please use the non-deprecated version, and pass extack in.
Quoted 7 lines
net/sched/Kconfig +7
-0+ if (err < 0) + return err; + + sch_tree_lock(sch); + if (tb[TCA_FQ_PIE_LIMIT]) { + u32 limit = nla_get_u32(tb[TCA_FQ_PIE_LIMIT]); +
net/sched/Kconfig
Quoted 10 lines
net/sched/Kconfig +10
-0+ q->p_params.limit = limit; + sch->limit = limit; + } + if (tb[TCA_FQ_PIE_FLOWS]) { + if (q->flows) + return -EINVAL; + q->flows_cnt = nla_get_u32(tb[TCA_FQ_PIE_FLOWS]); + if (!q->flows_cnt || + q->flows_cnt > 65536) + return -EINVAL;
Gotta release the tree lock here. Please also consider adding extack messages for these error conditions so users understand what went wrong.
Quoted 6 lines
net/sched/Kconfig +6
-0+ } + + if (tb[TCA_FQ_PIE_ALPHA]) + q->p_params.alpha = nla_get_u32(tb[TCA_FQ_PIE_ALPHA]); + + if (tb[TCA_FQ_PIE_BETA])
net/sched/Kconfig
Quoted 10 lines
net/sched/Kconfig +10
-0+ q->p_params.beta = nla_get_u32(tb[TCA_FQ_PIE_BETA]); + + /* convert from microseconds to pschedtime */ + if (tb[TCA_FQ_PIE_TARGET]) { + /* target is in us */ + u32 target = nla_get_u32(tb[TCA_FQ_PIE_TARGET]); + + /* convert to pschedtime */ + q->p_params.target = + PSCHED_NS2TICKS((u64)target * NSEC_PER_USEC);
looks misaligned
net/sched/Kconfig
Quoted 6 lines
net/sched/Kconfig +6
-0+ } + + /* tupdate is in jiffies */ + if (tb[TCA_FQ_PIE_TUPDATE]) + q->p_params.tupdate = + usecs_to_jiffies(nla_get_u32(tb[TCA_FQ_PIE_TUPDATE]));
ditto, and in couple other places, the continuation line should be more indented than the beginning one
Quoted 29 lines
net/sched/Kconfig +29
-0+ if (tb[TCA_FQ_PIE_MEMORY_LIMIT]) + q->memory_limit = nla_get_u32(tb[TCA_FQ_PIE_MEMORY_LIMIT]); + if (tb[TCA_FQ_PIE_QUANTUM]) + q->quantum = nla_get_u32(tb[TCA_FQ_PIE_QUANTUM]); + + if (tb[TCA_FQ_PIE_ECN_PROB]) + q->ecn_prob = nla_get_u32(tb[TCA_FQ_PIE_ECN_PROB]); + + if (tb[TCA_FQ_PIE_ECN]) + q->p_params.ecn = nla_get_u32(tb[TCA_FQ_PIE_ECN]); + + if (tb[TCA_FQ_PIE_BYTEMODE]) + q->p_params.bytemode = nla_get_u32(tb[TCA_FQ_PIE_BYTEMODE]); + + if (tb[TCA_FQ_PIE_DQ_RATE_ESTIMATOR]) + q->p_params.dq_rate_estimator = + nla_get_u32(tb[TCA_FQ_PIE_DQ_RATE_ESTIMATOR]); + + /* Drop excess packets if new limit is lower */ + qlen = sch->q.qlen; + while (sch->q.qlen > sch->limit) { + struct sk_buff *skb = fq_pie_qdisc_dequeue(sch); + + kfree_skb(skb); + len_dropped += qdisc_pkt_len(skb); + num_dropped += 1; + } + qdisc_tree_reduce_backlog(sch, num_dropped, len_dropped); +
net/sched/Kconfig
Quoted 10 lines
net/sched/Kconfig +10
-0+ sch_tree_unlock(sch); + return 0; +} + +static void fq_pie_timer(struct timer_list *t) +{ + struct fq_pie_sched_data *q = from_timer(q, t, adapt_timer); + struct Qdisc *sch = q->sch; + spinlock_t *root_lock = qdisc_lock(qdisc_root_sleeping(sch)); + u16 idx;
Could you order variable declaration lines longest to shortest, if initialization depends on order and would break such order please move it out to the body of the function (applies to all functions).
Quoted 17 lines
net/sched/Kconfig +17
-0+ spin_lock(root_lock); + + for (idx = 0; idx < q->flows_cnt; idx++) + pie_calculate_probability(&q->p_params, &q->flows[idx].vars, + q->flows[idx].backlog); + + /* reset the timer to fire after 'tupdate'. tupdate is in jiffies. */ + if (q->p_params.tupdate) + mod_timer(&q->adapt_timer, jiffies + q->p_params.tupdate); + spin_unlock(root_lock); +} + +static int fq_pie_init(struct Qdisc *sch, struct nlattr *opt, + struct netlink_ext_ack *extack) +{ + struct fq_pie_sched_data *q = qdisc_priv(sch); + int err;
net/sched/Kconfig
Quoted 10 lines
net/sched/Kconfig +10
-0+ u16 idx; + + pie_params_init(&q->p_params); + sch->limit = 10 * 1024; + q->p_params.limit = sch->limit; + q->quantum = psched_mtu(qdisc_dev(sch)); + q->sch = sch; + q->ecn_prob = 10; + q->flows_cnt = 1024; + q->memory_limit = 32 << 20;
SZ_32M ?
net/sched/Kconfig
Quoted 6 lines
net/sched/Kconfig +6
-0+ + INIT_LIST_HEAD(&q->new_flows); + INIT_LIST_HEAD(&q->old_flows); + + timer_setup(&q->adapt_timer, fq_pie_timer, 0); + mod_timer(&q->adapt_timer, jiffies + HZ / 2);
The timer should probably not be armed until flows are allocated
net/sched/Kconfig
Quoted 2 lines
net/sched/Kconfig +2
-0+ if (opt) { + int err = fq_pie_change(sch, opt, extack);
There is an err variable in outer scope already
net/sched/Kconfig
Quoted 9 lines
net/sched/Kconfig +9
-0+ if (err) + return err; + } + + err = tcf_block_get(&q->block, &q->filter_list, sch, extack); + if (err) + goto init_failure; + + if (!q->flows) {
Can qdisc ->init really called multiple times for this to ever be non-NULL?
Quoted 20 lines
net/sched/Kconfig +20
-0+ q->flows = kvcalloc(q->flows_cnt, + sizeof(struct fq_pie_flow), + GFP_KERNEL); + if (!q->flows) { + err = -ENOMEM; + goto init_failure; + } + for (idx = 0; idx < q->flows_cnt; idx++) { + struct fq_pie_flow *flow = q->flows + idx; + + INIT_LIST_HEAD(&flow->flowchain); + pie_vars_init(&flow->vars); + } + } + return 0; + +init_failure: + q->flows_cnt = 0; + + return err;
net/sched/Kconfig
Quoted 10 lines
net/sched/Kconfig +10
-0+} + +static int fq_pie_dump(struct Qdisc *sch, struct sk_buff *skb) +{ + struct fq_pie_sched_data *q = qdisc_priv(sch); + struct nlattr *opts; + + opts = nla_nest_start_noflag(skb, TCA_OPTIONS); + if (!opts) + goto nla_put_failure;
return -EMSGSIZE;
Quoted 13 lines
net/sched/Kconfig +13
-0+ + /* convert target from pschedtime to us */ + if (nla_put_u32(skb, TCA_FQ_PIE_LIMIT, sch->limit) || + nla_put_u32(skb, TCA_FQ_PIE_FLOWS, q->flows_cnt) || + nla_put_u32(skb, TCA_FQ_PIE_ALPHA, q->p_params.alpha) || + nla_put_u32(skb, TCA_FQ_PIE_BETA, q->p_params.beta) || + nla_put_u32(skb, TCA_FQ_PIE_TARGET, + ((u32)PSCHED_TICKS2NS(q->p_params.target)) / + NSEC_PER_USEC) || + nla_put_u32(skb, TCA_FQ_PIE_TUPDATE, + jiffies_to_usecs(q->p_params.tupdate)) || + nla_put_u32(skb, TCA_FQ_PIE_MEMORY_LIMIT, q->memory_limit) || + nla_put_u32(skb, TCA_FQ_PIE_QUANTUM, q->quantum) ||
net/sched/Kconfig
Quoted 10 lines
net/sched/Kconfig +10
-0+ nla_put_u32(skb, TCA_FQ_PIE_ECN_PROB, q->ecn_prob) || + nla_put_u32(skb, TCA_FQ_PIE_ECN, q->p_params.ecn) || + nla_put_u32(skb, TCA_FQ_PIE_BYTEMODE, q->p_params.bytemode) || + nla_put_u32(skb, TCA_FQ_PIE_DQ_RATE_ESTIMATOR, + q->p_params.dq_rate_estimator)) + goto nla_put_failure; + + return nla_nest_end(skb, opts); + +nla_put_failure:
nla_nest_cancel(skb, opts);
net/sched/Kconfig
Quoted 1 line
net/sched/Kconfig +1
-0+ return -1;
return -EMSGSIZE;
net/sched/Kconfig
Quoted 8 lines
net/sched/Kconfig +7
-0+} +static void fq_pie_destroy(struct Qdisc *sch) +{ + struct fq_pie_sched_data *q = qdisc_priv(sch); + + kvfree(q->flows); + del_timer_sync(&q->adapt_timer);
You probably want to del_timer_sync before freeing the flows
Quoted 1 line
+}
Quoted 32 lines · Jakub Kicinski
Quoted 23 lines · On Fri, 10 Jan 2020 11:56:57 +0530, [email protected] wrote:
From: "Mohit P. Tahiliani" <[email protected]>
Principles:
- Packets are classified on flows.
- This is a Stochastic model (as we use a hash, several flows might be hashed on the same slot)
- Each flow has a PIE managed queue.
- Flows are linked onto two (Round Robin) lists,
so that new flows have priority on old ones.
- For a given flow, packets are not reordered.
- Drops during enqueue only.
- ECN capability is off by default.
- ECN threshold is at 10% by default.
- Uses timestamps to calculate queue delay by default.Usage:
tc qdisc ...fq_pie[ limit PACKETS ] [ flows NUMBER ]
[ alpha NUMBER ] [ beta NUMBER ] [ target TIME us ] [ tupdate TIME us ] [memory_limitBYTES ] [ quantum BYTES ] [ ecnprob PERCENTAGE ] [ [no]ecn ] [ [no]bytemode ] [ [no_]dq_rate_estimator ]Quoted 7 lines
defaults:
limit: 10240 packets, flows: 1024
alpha: 1/8, beta : 5/4
target: 15 ms, tupdate: 15 ms (in jiffies)
memory_limit: 32 Mb, quantum: device MTU
ecnprob: 10%, ecn: off
bytemode: off,dq_rate_estimator: off
Quoted 2 lines
Some reviews below, but hopefully someone who knows more about qdiscs will still review :)
I looked it over, and didn't find anything you hadn't already pointed out below. It's pretty obvious that this started out as a copy of sch_fq_codel. Which is good, because that's pretty solid. And bad, because that means it introduces another almost-identical qdisc without sharing any of the code...
I think it would be worthwhile to try to consolidate things at some point. Either by just merging code from fq_{codel,pie}, but another option would be to express fq_codel and fq_pie using the fq{,_impl}.h includes. Maybe even sch_cake as well, but that may take a bit more work. Not sure if we should require this before merging fq_pie, or just leave it as a possible enhancement for later? WDYT?
-Toke
Jakub Kicinski
maintainerQuoted 42 lines · Toke Høiland-Jørgensen
Quoted 32 lines · Jakub Kicinski
Quoted 23 lines · On Fri, 10 Jan 2020 11:56:57 +0530, [email protected] wrote:
From: "Mohit P. Tahiliani" <[email protected]>
Principles:
- Packets are classified on flows.
- This is a Stochastic model (as we use a hash, several flows might be hashed on the same slot)
- Each flow has a PIE managed queue.
- Flows are linked onto two (Round Robin) lists,
so that new flows have priority on old ones.
- For a given flow, packets are not reordered.
- Drops during enqueue only.
- ECN capability is off by default.
- ECN threshold is at 10% by default.
- Uses timestamps to calculate queue delay by default.Usage:
tc qdisc ...fq_pie[ limit PACKETS ] [ flows NUMBER ]
[ alpha NUMBER ] [ beta NUMBER ] [ target TIME us ] [ tupdate TIME us ] [memory_limitBYTES ] [ quantum BYTES ] [ ecnprob PERCENTAGE ] [ [no]ecn ] [ [no]bytemode ] [ [no_]dq_rate_estimator ]Quoted 7 lines
defaults:
limit: 10240 packets, flows: 1024
alpha: 1/8, beta : 5/4
target: 15 ms, tupdate: 15 ms (in jiffies)
memory_limit: 32 Mb, quantum: device MTU
ecnprob: 10%, ecn: off
bytemode: off,dq_rate_estimator: offQuoted 2 lines
Some reviews below, but hopefully someone who knows more about qdiscs will still review :)
I looked it over, and didn't find anything you hadn't already pointed out below. It's pretty obvious that this started out as a copy of
sch_fq_codel. Which is good, because that's pretty solid. And bad, because that means it introduces another almost-identical qdisc without sharing any of the code...
Quoted 6 lines
I think it would be worthwhile to try to consolidate things at some point. Either by just merging code from fq_{codel,pie}, but another option would be to express
fq_codelandfq_pieusing the fq{,_impl}.h includes. Maybe evensch_cakeas well, but that may take a bit more work. Not sure if we should require this before mergingfq_pie, or just leave it as a possible enhancement for later? WDYT?
Tricky :/ No strong opinion on my side. I'm already a little weary of added function calls in the fast path (e.g. pie_drop_early()), but using some static inlines wouldn't hurt... Then again since fq_codel doesn't use fq{,_impl}.h it indeed seems like a bigger project to clean things up.
IMHO if this qdisc works and is useful it could probably be merged as is. Hopefully we can get an opinion on this from Stephen or others.
Quoted 50 lines · Jakub Kicinski
Quoted 42 lines · Toke Høiland-Jørgensen
Quoted 32 lines · Jakub Kicinski
Quoted 23 lines · On Fri, 10 Jan 2020 11:56:57 +0530, [email protected] wrote:
From: "Mohit P. Tahiliani" <[email protected]>
Principles:
- Packets are classified on flows.
- This is a Stochastic model (as we use a hash, several flows might be hashed on the same slot)
- Each flow has a PIE managed queue.
- Flows are linked onto two (Round Robin) lists,
so that new flows have priority on old ones.
- For a given flow, packets are not reordered.
- Drops during enqueue only.
- ECN capability is off by default.
- ECN threshold is at 10% by default.
- Uses timestamps to calculate queue delay by default.Usage:
tc qdisc ...fq_pie[ limit PACKETS ] [ flows NUMBER ]
[ alpha NUMBER ] [ beta NUMBER ] [ target TIME us ] [ tupdate TIME us ] [memory_limitBYTES ] [ quantum BYTES ] [ ecnprob PERCENTAGE ] [ [no]ecn ] [ [no]bytemode ] [ [no_]dq_rate_estimator ]Quoted 7 lines
defaults:
limit: 10240 packets, flows: 1024
alpha: 1/8, beta : 5/4
target: 15 ms, tupdate: 15 ms (in jiffies)
memory_limit: 32 Mb, quantum: device MTU
ecnprob: 10%, ecn: off
bytemode: off,dq_rate_estimator: offQuoted 2 lines
Some reviews below, but hopefully someone who knows more about qdiscs will still review :)
I looked it over, and didn't find anything you hadn't already pointed out below. It's pretty obvious that this started out as a copy of
sch_fq_codel. Which is good, because that's pretty solid. And bad, because that means it introduces another almost-identical qdisc without sharing any of the code...Quoted 6 lines
I think it would be worthwhile to try to consolidate things at some point. Either by just merging code from fq_{codel,pie}, but another option would be to express
fq_codelandfq_pieusing the fq{,_impl}.h includes. Maybe evensch_cakeas well, but that may take a bit more work. Not sure if we should require this before mergingfq_pie, or just leave it as a possible enhancement for later? WDYT?
Quoted 5 lines
Tricky :/ No strong opinion on my side. I'm already a little weary of added function calls in the fast path (e.g.
pie_drop_early()), but using some static inlines wouldn't hurt... Then again sincefq_codeldoesn't use fq{,_impl}.h it indeed seems like a bigger project to clean things up.
Yeah, definitely a bigger project; and I do worry about regressions. Especially since fq{,_impl}.h relies heavily on indirect calls...
Quoted 2 lines
IMHO if this qdisc works and is useful it could probably be merged as is. Hopefully we can get an opinion on this from Stephen or others.
OK, fine with me :)
-Toke
Hello Jakub and Toke,
Thanks for the comments. We shall make the required changes and resubmit v4 once we get some more feedback from the mailing list, probably by tomorrow.
Thank You,
Gautam
Quoted 69 lines · Toke Høiland-Jørgensen
Quoted 50 lines · Jakub Kicinski
Quoted 42 lines · Toke Høiland-Jørgensen
Quoted 32 lines · Jakub Kicinski
Quoted 23 lines · On Fri, 10 Jan 2020 11:56:57 +0530, [email protected] wrote:
From: "Mohit P. Tahiliani" <[email protected]>
Principles:
- Packets are classified on flows.
- This is a Stochastic model (as we use a hash, several flows might be hashed on the same slot)
- Each flow has a PIE managed queue.
- Flows are linked onto two (Round Robin) lists,
so that new flows have priority on old ones.
- For a given flow, packets are not reordered.
- Drops during enqueue only.
- ECN capability is off by default.
- ECN threshold is at 10% by default.
- Uses timestamps to calculate queue delay by default.Usage:
tc qdisc ...fq_pie[ limit PACKETS ] [ flows NUMBER ]
[ alpha NUMBER ] [ beta NUMBER ] [ target TIME us ] [ tupdate TIME us ] [memory_limitBYTES ] [ quantum BYTES ] [ ecnprob PERCENTAGE ] [ [no]ecn ] [ [no]bytemode ] [ [no_]dq_rate_estimator ]Quoted 7 lines
defaults:
limit: 10240 packets, flows: 1024
alpha: 1/8, beta : 5/4
target: 15 ms, tupdate: 15 ms (in jiffies)
memory_limit: 32 Mb, quantum: device MTU
ecnprob: 10%, ecn: off
bytemode: off,dq_rate_estimator: offQuoted 2 lines
Some reviews below, but hopefully someone who knows more about qdiscs will still review :)
I looked it over, and didn't find anything you hadn't already pointed out below. It's pretty obvious that this started out as a copy of
sch_fq_codel. Which is good, because that's pretty solid. And bad, because that means it introduces another almost-identical qdisc without sharing any of the code...Quoted 6 lines
I think it would be worthwhile to try to consolidate things at some point. Either by just merging code from fq_{codel,pie}, but another option would be to express
fq_codelandfq_pieusing the fq{,_impl}.h includes. Maybe evensch_cakeas well, but that may take a bit more work. Not sure if we should require this before mergingfq_pie, or just leave it as a possible enhancement for later? WDYT?Quoted 5 lines
Tricky :/ No strong opinion on my side. I'm already a little weary of added function calls in the fast path (e.g.
pie_drop_early()), but using some static inlines wouldn't hurt... Then again sincefq_codeldoesn't use fq{,_impl}.h it indeed seems like a bigger project to clean things up.Yeah, definitely a bigger project; and I do worry about regressions. Especially since fq{,_impl}.h relies heavily on indirect calls...
Quoted 2 lines
IMHO if this qdisc works and is useful it could probably be merged as is. Hopefully we can get an opinion on this from Stephen or others.
OK, fine with me :)
-Toke
Signature · 2 lines
------------- Gautam |