Re: [PATCH net-next] netem: add ECN capability
From: Hagen Paul Pfeifer <hidden>
Date: 2012-05-01 09:38:03
Nice! * Eric Dumazet | 2012-05-01 11:11:05 [+0200]:
u32 loss; + u32 ecn;
Why no bool here Eric?
quoted hunk ↗ jump to hunk
u32 limit; u32 counter; u32 gap;@@ -374,9 +376,12 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)++count; /* Drop packet? */ - if (loss_event(q)) - --count; - + if (loss_event(q)) { + if (q->ecn && INET_ECN_set_ce(skb)) + sch->qstats.drops++; /* mark packet */ + else + --count; + } if (count == 0) { sch->qstats.drops++; kfree_skb(skb);@@ -706,6 +711,7 @@ static const struct nla_policy netem_policy[TCA_NETEM_MAX + 1] = {[TCA_NETEM_CORRUPT] = { .len = sizeof(struct tc_netem_corrupt) }, [TCA_NETEM_RATE] = { .len = sizeof(struct tc_netem_rate) }, [TCA_NETEM_LOSS] = { .type = NLA_NESTED }, + [TCA_NETEM_ECN] = { .type = NLA_U32 },
This netem API, what a heck ... Ideal we would extend TCA_NETEM_LOSS somehow[tm], but yes ... ;( Acked-by: Hagen Paul Pfeifer <redacted>