Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: How many times pico_stack_tick() should be called #508

Open
amine177 opened this issue Jun 15, 2020 · 3 comments
Open

Question: How many times pico_stack_tick() should be called #508

amine177 opened this issue Jun 15, 2020 · 3 comments

Comments

@amine177
Copy link

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 ?

@phalox
Copy link
Contributor

phalox commented Jul 2, 2020

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:

void pico_stack_tick(void)

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.

@danielinux
Copy link
Contributor

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.

@amine177
Copy link
Author

amine177 commented Jul 25, 2020

@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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants