sched: Call skb_get_hash_perturb in sch_sfq
authorTom Herbert <tom@herbertland.com>
Fri, 1 May 2015 18:30:16 +0000 (11:30 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 4 May 2015 04:09:08 +0000 (00:09 -0400)
Call skb_get_hash_perturb instead of doing skb_flow_dissect and then
jhash by hand.

Signed-off-by: Tom Herbert <tom@herbertland.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/sch_sfq.c

index b877140beda5573b8d2dbe4a701bf24355ba7229..7d14926633601b85c2d281d914fa978c8a038e10 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/vmalloc.h>
 #include <net/netlink.h>
 #include <net/pkt_sched.h>
-#include <net/flow_keys.h>
 #include <net/red.h>
 
 
@@ -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];
 }
 
-/*
- * 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,
                             const struct sk_buff *skb)
 {
-       const struct flow_keys *keys = &sfq_skb_cb(skb)->keys;
-       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);
+       return skb_get_hash_perturb(skb, q->perturbation) & (q->divisor - 1);
 }
 
 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);
 
        fl = rcu_dereference_bh(q->filter_list);
-       if (!fl) {
-               skb_flow_dissect(skb, &sfq_skb_cb(skb)->keys);
+       if (!fl)
                return sfq_hash(q, skb) + 1;
-       }
 
        *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
        result = tc_classify(skb, fl, &res);