Subject: Re: [PATCH 0/2] netem: trace enhancement

From: Patrick McHardy <[email-masked]>
Date: Tue, 04 Dec 2007 15:58:40 +0100

Ariane Keller wrote:
> 
>>> That sounds like it would also be possible using rtnetlink. You could
>>> send out a notification whenever you switch the active buffer and have
>>> userspace listen to these and replace the inactive one.
> 
> I guess using rtnetlink is possible. However I'm not sure about how to 
> implement it:
> The first thought was to use RTM_NEWQDISC to send the data to the 
> netem_change() function (similar to tc_qdisc_modify() ).

That sounds reasonable.

> But with this 
> we would need the tcm_handle, tcm_parent arguments etc. which are not 
> known in q_netem.c
> Therefore we would have to change the parse_qopt() function prototype in 
> order to pass the whole "req" and not only the nlmsghdr.

I assume you mean netem_init, parse_qopt is userspace. But I don't
see how that is related, emptying the buffer happens during packet
processing, right?

I guess I would simply change the qdisc_notify function to not
require a struct nlmsghdr * (simply pass nlmsg_seq directly) and
use that to send notifications. The netem dump function would
add the buffer state. BTW, the parent class id is available in
sch->parent, the handle in sch->handle, but qdisc_notify should
take care of everything you need.