mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-04 13:45:33 +00:00
sch_choke: Use flow_keys_digest
Call make_flow_keys_digest to get a digest from flow keys and use that to pass skbuff cb and for comparing flows. Signed-off-by: Tom Herbert <tom@herbertland.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2f59e1ebaa
commit
2e99403d28
1 changed files with 4 additions and 10 deletions
|
@ -133,16 +133,10 @@ static void choke_drop_by_idx(struct Qdisc *sch, unsigned int idx)
|
||||||
--sch->q.qlen;
|
--sch->q.qlen;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* private part of skb->cb[] that a qdisc is allowed to use
|
|
||||||
* is limited to QDISC_CB_PRIV_LEN bytes.
|
|
||||||
* As a flow key might be too large, we store a part of it only.
|
|
||||||
*/
|
|
||||||
#define CHOKE_K_LEN min_t(u32, sizeof(struct flow_keys), QDISC_CB_PRIV_LEN - 3)
|
|
||||||
|
|
||||||
struct choke_skb_cb {
|
struct choke_skb_cb {
|
||||||
u16 classid;
|
u16 classid;
|
||||||
u8 keys_valid;
|
u8 keys_valid;
|
||||||
u8 keys[QDISC_CB_PRIV_LEN - 3];
|
struct flow_keys_digest keys;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb)
|
static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb)
|
||||||
|
@ -177,18 +171,18 @@ static bool choke_match_flow(struct sk_buff *skb1,
|
||||||
if (!choke_skb_cb(skb1)->keys_valid) {
|
if (!choke_skb_cb(skb1)->keys_valid) {
|
||||||
choke_skb_cb(skb1)->keys_valid = 1;
|
choke_skb_cb(skb1)->keys_valid = 1;
|
||||||
skb_flow_dissect(skb1, &temp);
|
skb_flow_dissect(skb1, &temp);
|
||||||
memcpy(&choke_skb_cb(skb1)->keys, &temp, CHOKE_K_LEN);
|
make_flow_keys_digest(&choke_skb_cb(skb1)->keys, &temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!choke_skb_cb(skb2)->keys_valid) {
|
if (!choke_skb_cb(skb2)->keys_valid) {
|
||||||
choke_skb_cb(skb2)->keys_valid = 1;
|
choke_skb_cb(skb2)->keys_valid = 1;
|
||||||
skb_flow_dissect(skb2, &temp);
|
skb_flow_dissect(skb2, &temp);
|
||||||
memcpy(&choke_skb_cb(skb2)->keys, &temp, CHOKE_K_LEN);
|
make_flow_keys_digest(&choke_skb_cb(skb2)->keys, &temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return !memcmp(&choke_skb_cb(skb1)->keys,
|
return !memcmp(&choke_skb_cb(skb1)->keys,
|
||||||
&choke_skb_cb(skb2)->keys,
|
&choke_skb_cb(skb2)->keys,
|
||||||
CHOKE_K_LEN);
|
sizeof(choke_skb_cb(skb1)->keys));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Reference in a new issue