Commit ada1dba0 authored by Tom Herbert's avatar Tom Herbert Committed by David S. Miller

sched: Call skb_get_hash_perturb in sch_sfq

Call skb_get_hash_perturb instead of doing skb_flow_dissect and then
jhash by hand.
Signed-off-by: default avatarTom Herbert <tom@herbertland.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 63c0ad4d
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/vmalloc.h> #include <linux/vmalloc.h>
#include <net/netlink.h> #include <net/netlink.h>
#include <net/pkt_sched.h> #include <net/pkt_sched.h>
#include <net/flow_keys.h>
#include <net/red.h> #include <net/red.h>
...@@ -156,30 +155,10 @@ static inline struct sfq_head *sfq_dep_head(struct sfq_sched_data *q, sfq_index ...@@ -156,30 +155,10 @@ static inline struct sfq_head *sfq_dep_head(struct sfq_sched_data *q, sfq_index
return &q->dep[val - SFQ_MAX_FLOWS]; return &q->dep[val - SFQ_MAX_FLOWS];
} }
/*
* 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)
{
qdisc_cb_private_validate(skb, 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, static unsigned int sfq_hash(const struct sfq_sched_data *q,
const struct sk_buff *skb) const struct sk_buff *skb)
{ {
const struct flow_keys *keys = &sfq_skb_cb(skb)->keys; return skb_get_hash_perturb(skb, q->perturbation) & (q->divisor - 1);
unsigned int hash;
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);
} }
static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch, static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
...@@ -196,10 +175,8 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch, ...@@ -196,10 +175,8 @@ static unsigned int sfq_classify(struct sk_buff *skb, struct Qdisc *sch,
return TC_H_MIN(skb->priority); return TC_H_MIN(skb->priority);
fl = rcu_dereference_bh(q->filter_list); fl = rcu_dereference_bh(q->filter_list);
if (!fl) { if (!fl)
skb_flow_dissect(skb, &sfq_skb_cb(skb)->keys);
return sfq_hash(q, skb) + 1; return sfq_hash(q, skb) + 1;
}
*qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS; *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
result = tc_classify(skb, fl, &res); result = tc_classify(skb, fl, &res);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment