machnet icon indicating copy to clipboard operation
machnet copied to clipboard

Packet->append does increase the data region, but the packet len value stays the same.

Open sarsanaee opened this issue 2 years ago • 1 comments

Once we allocate a packet, we usually append some free space to be able to fit our data in the packet.

The way we are doing this is by calling packet->alloc. This, however, does not change the packet length property.

So if we call packet->length() we do not observe the new length there. Check here as an example: https://github.com/microsoft/machnet/blob/15a937d5856dcf84139bf3db81083a206dbdd07a/src/include/machnet_engine.h#L928

sarsanaee avatar Oct 09 '23 17:10 sarsanaee

Hi @sarsanaee,

Could you please elaborate on the issue?

PacketAlloc() is not meant to change the underlying mbuf size; it's merely an allocation from the pool.

The append method, is increasing the length of the packet using the underlying DPDK function. https://github.com/microsoft/machnet/blob/15a937d5856dcf84139bf3db81083a206dbdd07a/src/include/packet.h#L132

Does this not work? Or you are pointing out that in this line:

https://github.com/microsoft/machnet/blob/15a937d5856dcf84139bf3db81083a206dbdd07a/src/include/machnet_engine.h#L929

there is no check for the return value ?

marinosi avatar Oct 11 '23 20:10 marinosi