Packet buffer header
File: csp/interfaces/csp_if_eth_pbuf.h
Description: Packet buffer header
The first part is an identifier that must uniquely identify the CSP packet to which the segment carried by the pbuf belongs. Each source node sends via same ethernet tx function that must provide the packet identifier like a packet counter that wraps around at 32768. With multiple nodes connected on ethernet the packet identifiers on different nodes may collide, which is why the CSP source address is included in the pbuf identifier. Multiple source addresses causes no problems, as the packet_id dows not depend on the packet content.
A segment identifier is considered not required, as the stream of ethernet frames follows a single path, and there are no retransmission, so it can be assumed received in same order as sent. A lost frame causes a stalled pbuf waiting fhr last bytes to arrive. This is discarded a period of CSP_IF_ETH_PBUF_TIMEOUT_MS after latest data was received.
There is a minimum ethernet frame size, such that the received size is at leas 60 bytes. The segment size field of the header provides the length of the actual payload.
The size of a CSP packet can generally not be determined from a partial CSP frame. The packet_length field providing the packet length is simplest solution.
-
csp_packet_t *csp_if_eth_pbuf_find(csp_packet_t **plist, uint32_t pbuf_id)
[source] Packet list operations