Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-16 Thread Michael Steinberg
Hello Sergio and all, I could not see how to use pbuf_cat for UDP purposes (aside from not being able to store the ip somewhere), since it adjusts the len and tot_len's and I would lose track of the packet boundaries (if I'm mistaken here, please yell). I use it to great success for the TCP e

Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-16 Thread Sergio R. Caprile
Talking about backfire: looking for the address info inside a pbuf violates the layer independency (someone's got to play the pedantic role...), so I would not rely on that unless willing to chase all sort of strange problems in the field and/or future lwIP versions. I would use the pbuf functio

Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-16 Thread Jan Menzel
Hi Michael! I like this type of discussions so let me put my five cents in too: - due to the zero-copy approach, the pbufs you see in receive callbacks are the ones you queued up in the input driver. So, if you're in charge for the input driver, you could only provide reasonable large pbufs

Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-15 Thread Michael Steinberg
Oh, and of course I also felt like I need to store away the source address information somewhere. I am aware that it's likely the source address is somewhere stored inside one of the first pbufs, accessible by lowering the layer and looking into the ip header, but I'm not aware of any API help

Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-15 Thread Michael Steinberg
Hey, thank you for the reply. My impression was that I would be breaking the "this->tot_len = this->len + this->next ? this->next->tot_len : 0" invariant I found somewhere in the documentation by queueing up multiple packet-chains into one chain. Is the pbuf API designed to actually handle thi

Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-15 Thread goldsi...@gmx.de
Why don't you use pbuf_cat()? This uses the next pointer of the last pbuf in a chain. Simon On 15.02.2018 18:55, Michael Steinberg wrote: Hey, right, it was silly to even ask really ;) Would I cause considerable harm to the RAM-pool if I allocated the necessary storage for queueing (basically

Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-15 Thread Michael Steinberg
Hey, right, it was silly to even ask really ;) Would I cause considerable harm to the RAM-pool if I allocated the necessary storage for queueing (basically a linked list node) from it with a RAW allocation? The packet and node pbufs would be deallocated together again later-on. The alternative

Re: [lwip-users] Queueing up UDP packets in RAW api

2018-02-15 Thread Simon Goldschmidt
Steinberg Michael wrote: > I need to queue up received UDP packets inside the UDP receive callback (RAW > API) for > an event driven->polling transfer. I take that the passed in pbuf pointers > may very > well point to pbuf chains, right? Yes. > Abusing the pbuf next pointers for my own custom

[lwip-users] Queueing up UDP packets in RAW api

2018-02-15 Thread Steinberg Michael
Hello, I need to queue up received UDP packets inside the UDP receive callback (RAW API) for an event driven->polling transfer. I take that the passed in pbuf pointers may very well point to pbuf chains, right? Abusing the pbuf next pointers for my own custom packet queue seemed like a quick an