OpenCyphal / libcanard

A compact implementation of the Cyphal/CAN protocol in C for high-integrity real-time embedded systems

Home Page:http://opencyphal.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enhance `canardTxPush` to support scattered transfer payload buffers.

serges147 opened this issue · comments

@pavel-kirienko
... if we support scattered buffers, DSDL serialization could be sped up considerably in cases where there are large byte arrays present in the message (like imagery data) because the serializer would be able to serialize only non-trivial parts of the message and keep references to the blobs:

uavcan.time.SynchronizedTimestamp.1.0 timestamp  # NON ZERO-COPY
uint16 IMAGE_WIDTH  = 1280
uint16 IMAGE_HEIGHT = 800
uint8 BITS_PER_PIXEL = 24
uint8[IMAGE_WIDTH * IMAGE_HEIGHT * BITS_PER_PIXEL / 8] pixel_data  # ZERO-COPY!

If we go this way, to support full end-to-end low-copy operation, the application would need to allocate the message object itself from the media memory resource.

One side effect of scattered input buffers is that an output frame may end up straddling multiple fragments; to support this we will need to allow a tx queue item to reference not just one but an arbitrary number of fragments from the input buffer.

See OpenCyphal-Garage/libcyphal#343