[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-users] Pbuf volatile flag for received packets
From: |
Simon Goldschmidt |
Subject: |
Re: [lwip-users] Pbuf volatile flag for received packets |
Date: |
Wed, 16 Mar 2022 13:23:54 +0100 |
User-agent: |
K-9 Mail for Android |
Am 16. März 2022 12:26:04 MEZ schrieb Jarno Malmari <jarno.malmari@vincit.fi>:
>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