Task #1293
openReserve buffer space when receiving packets on all faces
0%
Description
When receiving packets on all faces, we need to reserve some space in front and at the back of the packet. This will reduce number of copy operations (ideally to just first initial copy).
Updated by Junxiao Shi over 10 years ago
Please explain:
- What scenarios would need copying ?
- Why reserving buffer space can reduce copying?
- How to calculate how much buffer space should be reserved?
Updated by Davide Pesavento over 10 years ago
One example is the TX path of EthernetFace. When the ethernet packet is constructed, the link layer header must be prepended to the serialized TLV, and in some cases padding must be added after it. If the buffer already has some headroom and tailroom, that space can be filled with the aforementioned data, thus saving a memory allocation and a copy operation.
The ethernet header size is fixed (14 bytes), so the headroom could just be static.
The tailroom must be at least max(0, ethernet::MIN_DATA_LEN - data.size())
in the ethernet case.
An skbuff-like mechanism or scatter/gather would solve this nicely.
Updated by Alex Afanasyev over 10 years ago
I think I created this issue before I discovered scatter/gather capability in boost.asio.
Updated by Davide Pesavento over 10 years ago
EthernetFace does not use boost to send and receive packets...
Updated by Junxiao Shi over 10 years ago
- Target version deleted (
v0.2)
20140514 meeting decides to defer this performance optimization.
Alex or Davide should write more about what's the problem.
Updated by Junxiao Shi about 10 years ago
20141114 conference call urges Alex to complete the definition of this problem.