diff options
Diffstat (limited to 'net/sched/sch_netem.c')
| -rw-r--r-- | net/sched/sch_netem.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 5a4a4d0ae502..45939bafbdf8 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
| @@ -13,7 +13,6 @@ | |||
| 13 | * Catalin(ux aka Dino) BOIE <catab at umbrella dot ro> | 13 | * Catalin(ux aka Dino) BOIE <catab at umbrella dot ro> |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <linux/config.h> | ||
| 17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
| 18 | #include <linux/bitops.h> | 17 | #include <linux/bitops.h> |
| 19 | #include <linux/types.h> | 18 | #include <linux/types.h> |
| @@ -149,7 +148,8 @@ static long tabledist(unsigned long mu, long sigma, | |||
| 149 | static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | 148 | static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) |
| 150 | { | 149 | { |
| 151 | struct netem_sched_data *q = qdisc_priv(sch); | 150 | struct netem_sched_data *q = qdisc_priv(sch); |
| 152 | struct netem_skb_cb *cb = (struct netem_skb_cb *)skb->cb; | 151 | /* We don't fill cb now as skb_unshare() may invalidate it */ |
| 152 | struct netem_skb_cb *cb; | ||
| 153 | struct sk_buff *skb2; | 153 | struct sk_buff *skb2; |
| 154 | int ret; | 154 | int ret; |
| 155 | int count = 1; | 155 | int count = 1; |
| @@ -192,8 +192,8 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
| 192 | */ | 192 | */ |
| 193 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { | 193 | if (q->corrupt && q->corrupt >= get_crandom(&q->corrupt_cor)) { |
| 194 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) | 194 | if (!(skb = skb_unshare(skb, GFP_ATOMIC)) |
| 195 | || (skb->ip_summed == CHECKSUM_HW | 195 | || (skb->ip_summed == CHECKSUM_PARTIAL |
| 196 | && skb_checksum_help(skb, 0))) { | 196 | && skb_checksum_help(skb))) { |
| 197 | sch->qstats.drops++; | 197 | sch->qstats.drops++; |
| 198 | return NET_XMIT_DROP; | 198 | return NET_XMIT_DROP; |
| 199 | } | 199 | } |
| @@ -201,6 +201,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch) | |||
| 201 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); | 201 | skb->data[net_random() % skb_headlen(skb)] ^= 1<<(net_random() % 8); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | cb = (struct netem_skb_cb *)skb->cb; | ||
| 204 | if (q->gap == 0 /* not doing reordering */ | 205 | if (q->gap == 0 /* not doing reordering */ |
| 205 | || q->counter < q->gap /* inside last reordering gap */ | 206 | || q->counter < q->gap /* inside last reordering gap */ |
| 206 | || q->reorder < get_crandom(&q->reorder_cor)) { | 207 | || q->reorder < get_crandom(&q->reorder_cor)) { |
