* [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary
@ 2017-01-18 21:04 Andrew Collins
2017-01-18 21:13 ` Eric Dumazet
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andrew Collins @ 2017-01-18 21:04 UTC (permalink / raw)
To: netdev; +Cc: eric.dumazet, tom, Andrew Collins
The fq_codel qdisc currently always regenerates the skb flow hash.
This wastes some cycles and prevents flow seperation in cases where
the traffic has been encrypted and can no longer be understood by the
flow dissector.
Change it to use the prexisting flow hash if one exists, and only
regenerate if necessary.
Signed-off-by: Andrew Collins <acollins@cradlepoint.com>
---
net/sched/sch_fq_codel.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
index a5ea0e9..2f50e4c 100644
--- a/net/sched/sch_fq_codel.c
+++ b/net/sched/sch_fq_codel.c
@@ -57,7 +57,6 @@ struct fq_codel_sched_data {
struct fq_codel_flow *flows; /* Flows table [flows_cnt] */
u32 *backlogs; /* backlog table [flows_cnt] */
u32 flows_cnt; /* number of flows */
- u32 perturbation; /* hash perturbation */
u32 quantum; /* psched_mtu(qdisc_dev(sch)); */
u32 drop_batch_size;
u32 memory_limit;
@@ -75,9 +74,7 @@ struct fq_codel_sched_data {
static unsigned int fq_codel_hash(const struct fq_codel_sched_data *q,
struct sk_buff *skb)
{
- u32 hash = skb_get_hash_perturb(skb, q->perturbation);
-
- return reciprocal_scale(hash, q->flows_cnt);
+ return reciprocal_scale(skb_get_hash(skb), q->flows_cnt);
}
static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
@@ -482,7 +479,6 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
q->memory_limit = 32 << 20; /* 32 MBytes */
q->drop_batch_size = 64;
q->quantum = psched_mtu(qdisc_dev(sch));
- q->perturbation = prandom_u32();
INIT_LIST_HEAD(&q->new_flows);
INIT_LIST_HEAD(&q->old_flows);
codel_params_init(&q->cparams);
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary
2017-01-18 21:04 [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary Andrew Collins
@ 2017-01-18 21:13 ` Eric Dumazet
2017-01-20 17:15 ` David Miller
2017-01-20 17:23 ` Tom Herbert
2 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2017-01-18 21:13 UTC (permalink / raw)
To: Andrew Collins; +Cc: netdev, tom
On Wed, 2017-01-18 at 14:04 -0700, Andrew Collins wrote:
> The fq_codel qdisc currently always regenerates the skb flow hash.
> This wastes some cycles and prevents flow seperation in cases where
> the traffic has been encrypted and can no longer be understood by the
> flow dissector.
>
> Change it to use the prexisting flow hash if one exists, and only
> regenerate if necessary.
>
> Signed-off-by: Andrew Collins <acollins@cradlepoint.com>
> ---
Acked-by: Eric Dumazet <edumazet@google.com>
Thanks !
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary
2017-01-18 21:04 [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary Andrew Collins
2017-01-18 21:13 ` Eric Dumazet
@ 2017-01-20 17:15 ` David Miller
2017-01-20 17:23 ` Tom Herbert
2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-01-20 17:15 UTC (permalink / raw)
To: acollins; +Cc: netdev, eric.dumazet, tom
From: Andrew Collins <acollins@cradlepoint.com>
Date: Wed, 18 Jan 2017 14:04:28 -0700
> The fq_codel qdisc currently always regenerates the skb flow hash.
> This wastes some cycles and prevents flow seperation in cases where
> the traffic has been encrypted and can no longer be understood by the
> flow dissector.
>
> Change it to use the prexisting flow hash if one exists, and only
> regenerate if necessary.
>
> Signed-off-by: Andrew Collins <acollins@cradlepoint.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary
2017-01-18 21:04 [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary Andrew Collins
2017-01-18 21:13 ` Eric Dumazet
2017-01-20 17:15 ` David Miller
@ 2017-01-20 17:23 ` Tom Herbert
2017-01-20 17:31 ` Eric Dumazet
2 siblings, 1 reply; 5+ messages in thread
From: Tom Herbert @ 2017-01-20 17:23 UTC (permalink / raw)
To: Andrew Collins; +Cc: Linux Kernel Network Developers, Eric Dumazet
On Wed, Jan 18, 2017 at 1:04 PM, Andrew Collins
<acollins@cradlepoint.com> wrote:
> The fq_codel qdisc currently always regenerates the skb flow hash.
> This wastes some cycles and prevents flow seperation in cases where
> the traffic has been encrypted and can no longer be understood by the
> flow dissector.
>
> Change it to use the prexisting flow hash if one exists, and only
> regenerate if necessary.
>
> Signed-off-by: Andrew Collins <acollins@cradlepoint.com>
> ---
> net/sched/sch_fq_codel.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/net/sched/sch_fq_codel.c b/net/sched/sch_fq_codel.c
> index a5ea0e9..2f50e4c 100644
> --- a/net/sched/sch_fq_codel.c
> +++ b/net/sched/sch_fq_codel.c
> @@ -57,7 +57,6 @@ struct fq_codel_sched_data {
> struct fq_codel_flow *flows; /* Flows table [flows_cnt] */
> u32 *backlogs; /* backlog table [flows_cnt] */
> u32 flows_cnt; /* number of flows */
> - u32 perturbation; /* hash perturbation */
> u32 quantum; /* psched_mtu(qdisc_dev(sch)); */
> u32 drop_batch_size;
> u32 memory_limit;
> @@ -75,9 +74,7 @@ struct fq_codel_sched_data {
> static unsigned int fq_codel_hash(const struct fq_codel_sched_data *q,
> struct sk_buff *skb)
> {
> - u32 hash = skb_get_hash_perturb(skb, q->perturbation);
> -
> - return reciprocal_scale(hash, q->flows_cnt);
> + return reciprocal_scale(skb_get_hash(skb), q->flows_cnt);
So the perturbing of the hash is no longer needed for fq_codel?
> }
>
> static unsigned int fq_codel_classify(struct sk_buff *skb, struct Qdisc *sch,
> @@ -482,7 +479,6 @@ static int fq_codel_init(struct Qdisc *sch, struct nlattr *opt)
> q->memory_limit = 32 << 20; /* 32 MBytes */
> q->drop_batch_size = 64;
> q->quantum = psched_mtu(qdisc_dev(sch));
> - q->perturbation = prandom_u32();
> INIT_LIST_HEAD(&q->new_flows);
> INIT_LIST_HEAD(&q->old_flows);
> codel_params_init(&q->cparams);
> --
> 2.9.3
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-01-20 17:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-18 21:04 [PATCH net-next] fq_codel: Avoid regenerating skb flow hash unless necessary Andrew Collins
2017-01-18 21:13 ` Eric Dumazet
2017-01-20 17:15 ` David Miller
2017-01-20 17:23 ` Tom Herbert
2017-01-20 17:31 ` Eric Dumazet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox