SOME/IP in AUTOSAR Classic

SOME/IP

SOME/IP TP: segmentation

Over UDP a SOME/IP message must fit into one datagram. SOME/IP TP cuts a bigger message into parts, each with its own SOME/IP header, and the receiver joins them back together.

Why segments

Over UDP the payload of one SOME/IP message may be at most 1400 bytes; the rest of the datagram is kept free for headers. A camera object list or a calibration table can be several kilobytes. TCP could carry it, but TCP makes everything wait after a loss (lesson 22). SOME/IP TP keeps UDP and uses segmentation instead: it cuts the message into segments (parts that each travel as a SOME/IP message of their own: SOME/IP header, SOME/IP TP header and a slice of the payload).

An original message with one SOME/IP header and a payload of 5880 bytes is cut into five segments. Each segment has a copy of the SOME/IP header with the TP flag set, a SOME/IP TP header with the Offset where it starts and the More Segments flag, and up to 1392 bytes of payload. The last segment holds the remaining 312 bytes and has More Segments 0. original message SOME/IP header payload: 5880 bytes five segments SOME/IP header+ TP flag Offset 0More Segments 1 1392 bytes SOME/IP header+ TP flag Offset 1392More Segments 1 1392 bytes SOME/IP header+ TP flag Offset 2784More Segments 1 1392 bytes SOME/IP header+ TP flag Offset 4176More Segments 1 1392 bytes SOME/IP header+ TP flag Offset 5568More Segments 0 312 bytes Every segment goes out as its own UDP message, in ascending order. Offsets are shown in bytes.All segments carry the SOME/IP header of the original, except the Length and the TP flag.
Figure 1. Look at the orange row, the SOME/IP TP header: it tells the receiver where each segment belongs and whether more follow. The example is the one used in the specifications: 5880 bytes become four full segments of 1392 bytes and one of 312.

sender

As few segments as possible

Segments are as big as allowed, all segments except the last have the same size, they go out in ascending order without overlaps, and a configured separation time keeps them apart so the receiver is not flooded.

receiver

Reassemble or give up

The receiver checks that each segment carries the same SOME/IP header and that its Offset (where the segment starts in the original payload) is exactly where the last one ended. A timeout watches the gap between segments. Only a completely reassembled message is passed up, with the TP flag (the bit in the Message Type that marks a segment) cleared.

SOME/IP header

Same Session ID for all segments

All segments of one message carry the same Session ID, so messages that use segmentation must have session handling switched on. A segment with a new Session ID starts a new message.

Stricter in AUTOSAR

The protocol specification lets a receiver reassemble segments that arrive in reverse order and repair overlapping or repeated segments. The AUTOSAR SOME/IP TP module deliberately does less, to save time and memory on the receiver: it does not reorder segments and does not retry. A missing or out-of-place segment, a segment with a different SOME/IP header, or a gap longer than the timeout allows cancels the whole message. The typical use, "streaming" of large data, simply waits for the next message.

Where the module sits

Sending: COM passes the large I-PDU to PduR, PduR to SOME/IP TP, which hands each segment back to PduR, which passes it to SoAd. Receiving: SoAd passes each segment to PduR, PduR to SOME/IP TP, which hands the reassembled message to PduR, which passes it to COM. COM or LdCom PduR SoAd SOME/IP TP large large I-PDU one segment at a time segments segments in reassembled sending: segmentation receiving: reassembly
Figure 2. SOME/IP TP is not in the straight line between COM and SoAd: when sending, PduR passes the message to it and gets the segments back (left-hand arrows); when receiving it is the other way round (right-hand, lighter arrows).

Towards SoAd every segment is a small PDU of its own; towards COM or LdCom the whole message is one large I-PDU handed over in parts, the way transport protocols normally work. A message that fits into one UDP datagram is passed through unchanged.

Try it

Pick a payload size, then disturb the segments and see what the receiving SOME/IP TP module does.

ArrivesOffset (bytes)More SegmentsReceiver

Things to notice. 1000 bytes needs no segmentation at all. A lost segment and a swapped pair end the same way: the next segment's Offset is not where the receiver expects, so the message is dropped. When the last segment never comes, it is the timeout that ends the wait.

Check yourself optional

New terms in this lesson

TermMeaning
segmentOne part of a segmented message: SOME/IP header, SOME/IP TP header and a slice of the payload
SOME/IP TP headerThe 4 bytes SOME/IP TP adds after the SOME/IP header of each segment: Offset and More Segments flag
OffsetWhere this segment starts in the original payload (in the header: in units of 16 bytes)
More Segments flag1 if more segments follow, 0 in the last segment
TP flagBit 0x20 in the Message Type: this message is a segment (TP_REQUEST, TP_NOTIFICATION, …)

Source: SOME/IP Protocol Specification, R20-11, sections 4.1.2.10 and 4.2.1.4; SOME/IP Transport Protocol, R20-11, chapters 4, 5 and 7.