I like this, it makes a lot of sense since packets are almost always queued in order.
Minor style stuff you might want to fix (but don't have to). > + if (!last || > + t_last->time_to_send > last->time_to_send) { > + last = t_last; > + } I don't think you need braces here for single assignment. > +static void netem_erase_head(struct netem_sched_data *q, struct sk_buff *skb) > +{ > + if (skb == q->t_head) { > + q->t_head = skb->next; > + if (!q->t_head) > + q->t_tail = NULL; > + } else > + rb_erase(&skb->rbnode, &q->t_root); Checkpatch wants both sides of if/else to have brackets. Personally, don't care. Reviewed-by: Stephen Hemminger <step...@networkplumber.org>