diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2011-02-24 17:45:41 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-24 22:11:57 -0800 |
commit | 26f70e1202b3c66c4f63b8b25e0419dd0b3a91e3 (patch) | |
tree | 1f36ea8036be58a50ec72e264aee7f26afaf0558 /net | |
parent | 250a65f78265940ac33a2dd2002924e6126efe14 (diff) | |
download | kernel_samsung_smdk4412-26f70e1202b3c66c4f63b8b25e0419dd0b3a91e3.zip kernel_samsung_smdk4412-26f70e1202b3c66c4f63b8b25e0419dd0b3a91e3.tar.gz kernel_samsung_smdk4412-26f70e1202b3c66c4f63b8b25e0419dd0b3a91e3.tar.bz2 |
sch_choke: add choke_skb_cb
Better document choke skb->cb[] use, like we did in netem and sfb
This adds a compile time check to make sure we dont exhaust skb->cb[]
space.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Stephen Hemminger <shemminger@vyatta.com>
CC: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/sch_choke.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c index ee1e209..06afbae 100644 --- a/net/sched/sch_choke.c +++ b/net/sched/sch_choke.c @@ -219,14 +219,25 @@ static bool choke_match_flow(struct sk_buff *skb1, return *ports1 == *ports2; } +struct choke_skb_cb { + u16 classid; +}; + +static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb) +{ + BUILD_BUG_ON(sizeof(skb->cb) < + sizeof(struct qdisc_skb_cb) + sizeof(struct choke_skb_cb)); + return (struct choke_skb_cb *)qdisc_skb_cb(skb)->data; +} + static inline void choke_set_classid(struct sk_buff *skb, u16 classid) { - *(unsigned int *)(qdisc_skb_cb(skb)->data) = classid; + choke_skb_cb(skb)->classid = classid; } static u16 choke_get_classid(const struct sk_buff *skb) { - return *(unsigned int *)(qdisc_skb_cb(skb)->data); + return choke_skb_cb(skb)->classid; } /* |