* [PATCH net-next 1/2] sch_sfq: store flow_keys in skb->cb[]
@ 2011-12-16 5:39 Eric Dumazet
2011-12-16 18:54 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2011-12-16 5:39 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Instead of using automatic flow_keys variable in sfq_hash(), use storage
from skb->cb[] so that we can reuse it later if we want to rehash queues
when perturbation timer fires.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
net/sched/sch_sfq.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index 46d0d77..72bccd0 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -136,16 +136,31 @@ static inline struct sfq_head *sfq_dep_head(struct sfq_sched_data *q, sfq_index
return &q->dep[val - SFQ_SLOTS];
}
+/*
+ * In order to be able to quickly rehash our queue when timer changes
+ * q->perturbation, we store flow_keys in skb->cb[]
+ */
+struct sfq_skb_cb {
+ struct flow_keys keys;
+};
+
+static inline struct sfq_skb_cb *sfq_skb_cb(const struct sk_buff *skb)
+{
+ BUILD_BUG_ON(sizeof(skb->cb) <
+ sizeof(struct qdisc_skb_cb) + sizeof(struct sfq_skb_cb));
+ return (struct sfq_skb_cb *)qdisc_skb_cb(skb)->data;
+}
+
static unsigned int sfq_hash(const struct sfq_sched_data *q,
- const struct sk_buff *skb)
+ struct sk_buff *skb)
{
- struct flow_keys keys;
+ struct flow_keys *keys = &sfq_skb_cb(skb)->keys;
unsigned int hash;
- skb_flow_dissect(skb, &keys);
- hash = jhash_3words((__force u32)keys.dst,
- (__force u32)keys.src ^ keys.ip_proto,
- (__force u32)keys.ports, q->perturbation);
+ skb_flow_dissect(skb, keys);
+ hash = jhash_3words((__force u32)keys->dst,
+ (__force u32)keys->src ^ keys->ip_proto,
+ (__force u32)keys->ports, q->perturbation);
return hash & (q->divisor - 1);
}
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/2] sch_sfq: store flow_keys in skb->cb[]
2011-12-16 5:39 [PATCH net-next 1/2] sch_sfq: store flow_keys in skb->cb[] Eric Dumazet
@ 2011-12-16 18:54 ` David Miller
2011-12-16 19:31 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2011-12-16 18:54 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Fri, 16 Dec 2011 06:39:39 +0100
> Instead of using automatic flow_keys variable in sfq_hash(), use storage
> from skb->cb[] so that we can reuse it later if we want to rehash queues
> when perturbation timer fires.
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Where is "2/2"?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next 1/2] sch_sfq: store flow_keys in skb->cb[]
2011-12-16 18:54 ` David Miller
@ 2011-12-16 19:31 ` Eric Dumazet
0 siblings, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2011-12-16 19:31 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Le vendredi 16 décembre 2011 à 13:54 -0500, David Miller a écrit :
> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Fri, 16 Dec 2011 06:39:39 +0100
>
> > Instead of using automatic flow_keys variable in sfq_hash(), use storage
> > from skb->cb[] so that we can reuse it later if we want to rehash queues
> > when perturbation timer fires.
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>
> Where is "2/2"?
I got distracted by other stuff today, will finish later.
You can delete this one, I'll submit a proper serie when done.
Thanks !
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-16 19:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-16 5:39 [PATCH net-next 1/2] sch_sfq: store flow_keys in skb->cb[] Eric Dumazet
2011-12-16 18:54 ` David Miller
2011-12-16 19:31 ` Eric Dumazet
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.