aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-02-24 12:45:41 -0500
committerDavid S. Miller <davem@davemloft.net>2011-02-25 01:11:57 -0500
commit26f70e1202b3c66c4f63b8b25e0419dd0b3a91e3 (patch)
tree1f36ea8036be58a50ec72e264aee7f26afaf0558 /net/sched
parent250a65f78265940ac33a2dd2002924e6126efe14 (diff)
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/sched')
-rw-r--r--net/sched/sch_choke.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/net/sched/sch_choke.c b/net/sched/sch_choke.c
index ee1e2090eebe..06afbaeb4c88 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,
219 return *ports1 == *ports2; 219 return *ports1 == *ports2;
220} 220}
221 221
222struct choke_skb_cb {
223 u16 classid;
224};
225
226static inline struct choke_skb_cb *choke_skb_cb(const struct sk_buff *skb)
227{
228 BUILD_BUG_ON(sizeof(skb->cb) <
229 sizeof(struct qdisc_skb_cb) + sizeof(struct choke_skb_cb));
230 return (struct choke_skb_cb *)qdisc_skb_cb(skb)->data;
231}
232
222static inline void choke_set_classid(struct sk_buff *skb, u16 classid) 233static inline void choke_set_classid(struct sk_buff *skb, u16 classid)
223{ 234{
224 *(unsigned int *)(qdisc_skb_cb(skb)->data) = classid; 235 choke_skb_cb(skb)->classid = classid;
225} 236}
226 237
227static u16 choke_get_classid(const struct sk_buff *skb) 238static u16 choke_get_classid(const struct sk_buff *skb)
228{ 239{
229 return *(unsigned int *)(qdisc_skb_cb(skb)->data); 240 return choke_skb_cb(skb)->classid;
230} 241}
231 242
232/* 243/*