You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
sch_sfb: use skb_flow_dissect()
Current SFB double hashing is not fulfilling SFB theory, if two flows share same rxhash value. Using skb_flow_dissect() permits to really have better hash dispersion, and get tunnelling support as well. Double hashing point was mentioned by Florian Westphal Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
6bd2a9af17
commit
a00bd469b6
+14
-3
@@ -26,6 +26,7 @@
|
|||||||
#include <net/ip.h>
|
#include <net/ip.h>
|
||||||
#include <net/pkt_sched.h>
|
#include <net/pkt_sched.h>
|
||||||
#include <net/inet_ecn.h>
|
#include <net/inet_ecn.h>
|
||||||
|
#include <net/flow_keys.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SFB uses two B[l][n] : L x N arrays of bins (L levels, N bins per level)
|
* SFB uses two B[l][n] : L x N arrays of bins (L levels, N bins per level)
|
||||||
@@ -286,6 +287,7 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
|||||||
u32 minqlen = ~0;
|
u32 minqlen = ~0;
|
||||||
u32 r, slot, salt, sfbhash;
|
u32 r, slot, salt, sfbhash;
|
||||||
int ret = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
|
int ret = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
|
||||||
|
struct flow_keys keys;
|
||||||
|
|
||||||
if (unlikely(sch->q.qlen >= q->limit)) {
|
if (unlikely(sch->q.qlen >= q->limit)) {
|
||||||
sch->qstats.overlimits++;
|
sch->qstats.overlimits++;
|
||||||
@@ -309,13 +311,19 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
|||||||
/* If using external classifiers, get result and record it. */
|
/* If using external classifiers, get result and record it. */
|
||||||
if (!sfb_classify(skb, q, &ret, &salt))
|
if (!sfb_classify(skb, q, &ret, &salt))
|
||||||
goto other_drop;
|
goto other_drop;
|
||||||
|
keys.src = salt;
|
||||||
|
keys.dst = 0;
|
||||||
|
keys.ports = 0;
|
||||||
} else {
|
} else {
|
||||||
salt = skb_get_rxhash(skb);
|
skb_flow_dissect(skb, &keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
slot = q->slot;
|
slot = q->slot;
|
||||||
|
|
||||||
sfbhash = jhash_1word(salt, q->bins[slot].perturbation);
|
sfbhash = jhash_3words((__force u32)keys.dst,
|
||||||
|
(__force u32)keys.src,
|
||||||
|
(__force u32)keys.ports,
|
||||||
|
q->bins[slot].perturbation);
|
||||||
if (!sfbhash)
|
if (!sfbhash)
|
||||||
sfbhash = 1;
|
sfbhash = 1;
|
||||||
sfb_skb_cb(skb)->hashes[slot] = sfbhash;
|
sfb_skb_cb(skb)->hashes[slot] = sfbhash;
|
||||||
@@ -347,7 +355,10 @@ static int sfb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
|
|||||||
if (unlikely(p_min >= SFB_MAX_PROB)) {
|
if (unlikely(p_min >= SFB_MAX_PROB)) {
|
||||||
/* Inelastic flow */
|
/* Inelastic flow */
|
||||||
if (q->double_buffering) {
|
if (q->double_buffering) {
|
||||||
sfbhash = jhash_1word(salt, q->bins[slot].perturbation);
|
sfbhash = jhash_3words((__force u32)keys.dst,
|
||||||
|
(__force u32)keys.src,
|
||||||
|
(__force u32)keys.ports,
|
||||||
|
q->bins[slot].perturbation);
|
||||||
if (!sfbhash)
|
if (!sfbhash)
|
||||||
sfbhash = 1;
|
sfbhash = 1;
|
||||||
sfb_skb_cb(skb)->hashes[slot] = sfbhash;
|
sfb_skb_cb(skb)->hashes[slot] = sfbhash;
|
||||||
|
|||||||
Reference in New Issue
Block a user