Open amine177 opened 4 years ago
Hi Anime117, I'm a bit fuzzy on the specifics, but here's a short intro: https://github.com/tass-belgium/picotcp/wiki/scheduler-internals
Here you can find the implementation details: https://github.com/tass-belgium/picotcp/blob/46120abecc9fb79f7dfb2cc8192341a42e40fc8b/stack/pico_stack.c#L747
Every tick will attempt to process all layers, starting from the device (for incoming data) to the socket and back (for outgoing). I do believe it's possible to have a 'frame' processed in one single tick, but in general you're better off to keep ticking away when your device is online in your event loop; because you might miss out on packets in your hardware buffer if you don't process these in time.
An alternative would be to compile this fork using TICKLESS=1
option, and use pico_stack_go()
instead. This function will execute all the pending actions to process the packets, and return the number of milliseconds until the expiration of the next internal timer. TICKLESS
option can be useful to save CPU cycles by avoiding to call pico_stack_tick()
repeatedly if no actions are pending.
@danielinux , @phalox thanks for the answer. Another question, do you know of any existing product that uses picotcp ? I want to have some tests upon an existing product to see how the stack fares according to those tests in a real world scenario .
I have a program that inputs one frame to the stack using pico_stack_recv() , how many times should I call pico_stack_tick() after that ? Does the frame get processed on the first call to the latter ?