Re: [lwip-users] Pbuf volatile flag for received packets

2022-03-16 Thread Jarno Malmari
>
> >The behavior seems contradictory to the flag's description. Am I reading
> it
> >right? Should the comment be read only in the context of the lwip core, or
> >maybe it only applies to transmitted packets?
>
> Yes, it only applies to tx packets.
>
> There's not much point in copying on the Rx side: the netif driver is
> responsible to create pbufs that can live longer. You could argue that
> pbufs might have to be copied when really enqueueing (e.g. in TCP Rx ooseq
> and the like), but if you need to copy for tcpip_input, the driver has to
> do it.
>
>
Noted. Makes sense. Thank you.
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


Re: [lwip-users] Pbuf volatile flag for received packets

2022-03-16 Thread Simon Goldschmidt


Am 16. März 2022 12:26:04 MEZ schrieb Jarno Malmari :
>When passing received pbuf allocated with PBUF_TYPE_FLAG_DATA_VOLATILE
>(e.g. PBUF_REF) to tcpip_input(), the pbuf is immediately queued without
>checking the volatile flag.
>
>The comment on the volatile flag says:
>/** Indicates the data stored in this pbuf can change. If this pbuf needs
> * to be queued, it must be copied/duplicated. */
>
>The behavior seems contradictory to the flag's description. Am I reading it
>right? Should the comment be read only in the context of the lwip core, or
>maybe it only applies to transmitted packets?

Yes, it only applies to tx packets.

There's not much point in copying on the Rx side: the netif driver is 
responsible to create pbufs that can live longer. You could argue that pbufs 
might have to be copied when really enqueueing (e.g. in TCP Rx ooseq and the 
like), but if you need to copy for tcpip_input, the driver has to do it.

Regards,
Simon

___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users


[lwip-users] Pbuf volatile flag for received packets

2022-03-16 Thread Jarno Malmari
When passing received pbuf allocated with PBUF_TYPE_FLAG_DATA_VOLATILE
(e.g. PBUF_REF) to tcpip_input(), the pbuf is immediately queued without
checking the volatile flag.

The comment on the volatile flag says:
/** Indicates the data stored in this pbuf can change. If this pbuf needs
 * to be queued, it must be copied/duplicated. */

The behavior seems contradictory to the flag's description. Am I reading it
right? Should the comment be read only in the context of the lwip core, or
maybe it only applies to transmitted packets?

Thanks.
___
lwip-users mailing list
lwip-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/lwip-users