[riot-notifications] [RIOT-OS/RIOT] Discussion: How should netdev_driver_t::recv() behave when buffer is too small (#10413)
notifications at github.com
Mon Nov 19 14:32:37 CET 2018
Isn't our current practice to first read the frame size, then do a read with the previously returned size?
IMO, in that case, drivers should return as much as possible, drop the rest and return -ENOBUFS, which implicitly means "only \<len\> bytes of packet have been written to buffer".
What's the use case for first reading part of the packet, then reading the full packet?
What comes to mind would be some kind of check whether the packet is actually interesting for the node, and it would want to take a look at the first couple of bytes before deciding to allocate the full amount. To me, the stack would need to be able to allocate the full amount anyways in case the packet turns out to be interesting to the node. I can think of obscure memory saving reasons where a node might rather not free some data unless absolutely necessary, but do we want to design our API around that?
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications