[Click] how do I dynamically create an element ?

bartvdb Bart.VandenBroeck at esat.kuleuven.ac.be
Thu Mar 31 04:21:07 EST 2005


Eddie


> Click is not built to do this.

Heh, I've come to the same conclusion during every other previous
project involving Click  :-)  But me, my colleagues and our students
have up till now managed to hack our way to the goal anyway.  The fact
that this doesn't work surprises me hugely though.  I must have
misunderstood the word "modular" in "Click modular router"...


Anyways, the reason why I think hotswapping will be too slow, is because
this configuration has to handle a traffic stream between interface A
and interface B of about 200 Mbps (and about a fifth of that in the
other direction).  Therefore, I thought of kernel mode, but hotswapping
will involve switching between kernel mode and user mode, building a new
configuration in user mode based on information provided by Click,
loading it (and switching back to kernel mode).  This means larger
delays and a lower processing speed, no?

A very conservative estimation of the amount of hotswaps needed is over
1000 per hour.

If you think hotswapping is feasible in this situation, I'll certainly
try to use it, but some guidance will probably be needed.


Kind regards
Bart



Quoting Eddie Kohler <kohler at CS.UCLA.EDU>:

> Bart,
> 
> Click is not built to do this.  I will not help you do this. 
> CERTAINLY not when 
> you have not even measured how slow hotswapping is for your
> application.  How 
> many configuration changes do you want a second?  10000?
> 
> Eddie
> 
> 
> bartvdb wrote:
> > Hi all
> > 
> > 
> > I fear the configuration will probably need to be "hotswapped" too
> > often.  I've tried a bit to create elements dynamically anyway in
> the
> > C++ code of a custom element, and that seems to work up to a
> certain
> > level, but now the router.cc code gives me a SIGABORT signal...
> > 
> > 
> > Could anyone tell me please why this doesn't work and how I could
> make
> > it to work:
> > ##############
> > int Valve::configure(Vector<String> &conf, ErrorHandler *errh)
> > {   
> >     int result;
> >     Vector<String> v;
> >     v.push_back("1000");
> >     queue->configure(v,errh);
> >     queue->initialize(errh);
> >     _errh=errh;
> >     //fill hashmap with dummy value;
> >     unsigned hash=hashcode("255.255.255.255");
> >     Usershaper *ushaper=new Usershaper();
> >     ushaper->usershaper=new BandwidthShaper();
> >     ushaper->userqueue=new SimpleQueue();
> > 
> >     Vector<String> vqueue;
> >     vqueue.push_back("1000");
> >     result = ushaper->userqueue->configure(vqueue,_errh);
> >     click_chatter("result: %i", result);
> > 
> >     Vector<String> tempv;
> >     tempv.push_back("56000bps");
> >     result = ushaper->usershaper->configure(tempv,_errh);
> >     click_chatter("result: %i", result);
> > 
> >     // cf.     
> >
> http://www.pdos.lcs.mit.edu/click/doc/progman.html#Initialization%20Phases
> >     //                  First configure, then connect ports, then
> initialize
> >     //  cf.     $CLICKDIR/lib/router.cc:
> "Router::set_connections()"
> >     //                  First connect output port then input port
> >     int *input_codes, *output_codes;
> >     ushaper->userqueue->processing_vector(input_codes,
> output_codes, _errh);
> >     ushaper->userqueue->initialize_ports(input_codes,
> output_codes);
> >     ushaper->usershaper->processing_vector(input_codes,
> output_codes,
> > _errh);
> >     ushaper->usershaper->initialize_ports(input_codes,
> output_codes);
> >     result =
> ushaper->userqueue->connect_output(0,ushaper->usershaper,0);
> >     click_chatter("result: %i", result);
> >     result =
> ushaper->usershaper->connect_input(0,ushaper->userqueue,0);
> >     click_chatter("result: %i", result);
> >     result = ushaper->userqueue->initialize(_errh);
> >     click_chatter("result: %i", result);
> >     result = ushaper->usershaper->initialize(_errh);
> >     click_chatter("result: %i", result);
> > 
> >     _shapermap.insert(hash, ushaper);
> >     
> >     return 0;
> > }
> > ##############
> > 
> > 
> > Starting a configuration with this element in userlevel Click
> returns
> > this on the command line:
> > ##############
> > result: 0
> > result: 0
> > result: -1
> > result: 0
> > result: 0
> > result: 0
> > Segmentation fault
> > ##############
> > 
> > 
> > All seems very much OK, up till the segmentation fault.  As
> mentioned
> > before, the segmentation fault corresponds to a SIGABORT signal (as
> seen
> > when debugging the code with DDD) when the configuration of this
> element
> > finishes and the code of router.cc resumes executing.  Some memory
> > address cannot be accessed and it seems the "this" pointer has
> changed...
> > 
> > 
> > Thanks in advance
> > Bart
> > 
> > 
> > 
> > 
> >>Hi Bart,
> >>
> >>Click doesn't yet support this directly, but it is possible to 
> >>"hotswap" a new configuration.  State from the old config will be 
> >>inserted into the new.
> >>
> >>Eddie
> >>
> >>
> >>On Mar 16, 2005, at 6:08 AM, Bart Van Keyenberg wrote:
> >>
> >>
> >>>Hi,
> >>>
> >>>I want to create a click configuration where I don't know how much
> 
> >>>elements of a certain kind I will need beforehand (number of
> elements 
> >>>depends on number of users).  Can I dynamically create an element
> 
> >>>(e.g. from within another element), and if so, how do I handle
> this 
> >>>kind of thing?
> >>>
> >>>Kind Regards
> >>>
> >>>Bart
> > 
> > 
> > _______________________________________________
> > click mailing list
> > click at amsterdam.lcs.mit.edu
> > https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 


-- 
Bart Van den Broeck

MSEE, PhD student
K.U.Leuven
ESAT-TELEMIC
Kasteelpark Arenberg 10
B-3001 HEVERLEE
BELGIUM

Office: 02.38
Email: Bart.VandenBroeck at esat.kuleuven.ac.be
TEL: +32 16 32 18 73  (Office)
URL: http://www.esat.kuleuven.ac.be/telemic/networking


More information about the click mailing list