SOME/IP in AUTOSAR Classic

SOME/IP

The SOME/IP TP header

Every segment of a segmented message carries the normal 16-byte SOME/IP header plus the 4-byte SOME/IP TP header: the Offset where the segment starts in the original payload, counted in units of 16 bytes, and the More Segments flag, which says whether more segments follow.

Twenty bytes in front of each segment

A segment repeats the SOME/IP header of the original message with two changes, the Length and the TP flag in the Message Type, and adds the SOME/IP TP header right after it.

A segment: the 16-byte SOME/IP header with the TP flag set in the Message Type, then the 32-bit SOME/IP TP header made of a 28-bit Offset, three reserved bits and the More Segments flag, then the segment payload. bit 08162431 0 Message ID (same as the original) 4 Length = 8 + 4 + segment length 8 Request ID (same as the original) 12 Protocol Version Interface Version Message Type + 0x20 Return Code 16 SOME/IP TP header: Offset · upper 28 bits (units of 16 bytes) reserved M 20 segment payload: a slice of the original payload M = More Segments flag: 1 on every segment except the last · reserved bits are 0 and ignored
Figure 1. Message ID, Request ID, Protocol Version, Interface Version and Return Code are the same as in the original message. Only three things differ: the Length, the TP flag (0x20) in the Message Type, and the new orange row. All big-endian.

Offset

Units of 16 bytes

The 32-bit word holds the byte offset with its lowest 4 bits used for flags, so offsets are always multiples of 16. Offset value 87 means byte 87 × 16 = 1392 of the original payload.

size

At most 1392 bytes

A UDP SOME/IP payload is limited to 1400 bytes; minus the 4-byte SOME/IP TP header that leaves 1396, and the largest multiple of 16 below is 1392. Every segment except the last is a multiple of 16; all those segments are equally long.

same values

One Session ID

Session handling is on for segmented messages, and all segments of one original message carry its Session ID, Message ID, versions and Return Code. The receiver uses them to know which segments belong together.

The example of the specification

An original message with 5880 bytes of payload, segmented into segments of at most 1392 bytes:

5880 bytes segmented into five segments: four of 1392 bytes at Offset 0, 87, 174 and 261 in units of 16, with the More Segments flag 1, and a last segment of 312 bytes at Offset 348 with the More Segments flag 0. 1392Offset 0 · M = 1 1392Offset 87 · M = 1 1392Offset 174 · M = 1 1392Offset 261 · M = 1 312 Offset 348 · M = 0 Length field of each full segment: 8 + 4 + 1392 = 1404 · of the last one: 8 + 4 + 312 = 324
Figure 2. Widths are to scale: four equal segments and a short last one. M is the More Segments flag. The Offset grows by 87 each time because 1392 / 16 = 87.

The example in the R20-11 SOME/IP TP module specification uses the same five offsets but quotes the payload as 5571 and later 5771 bytes; with 4 × 1392 + 312 the total is 5880, as in the protocol specification.

What the AUTOSAR module checks

The SOME/IP TP module of the Classic Platform is deliberately simple: it does not put segments back in order and does not ask for repeats. On reception it stops the current reassembly when a segment's Offset does not match the bytes received so far, when the header values differ from the first segment, when a segment with the More Segments flag 1 is not a multiple of 16 bytes, or when its receive timeout runs out. A segment with an Offset greater than 0 and no reassembly running is ignored. The upper layer (PduR) is told about the first segment with an unknown total length and gets the rest segment by segment.

Try it

Pick a payload size and a largest segment size. Click a row to see that segment's 20 header bytes. Then choose what the network does with the segments.

#Byte offsetOffsetMore SegmentsSegmentLengthSOME/IP TP header

Things to notice. With "500" the sender cannot use 500: segments must be multiples of 16, so it uses 496. The SOME/IP TP header of segment 2 of the example is 00 00 05 71: 0x570 = 1392 bytes, plus the More Segments flag. Swapping two segments is enough to make the AUTOSAR receiver give up, although every byte arrived.

Check yourself optional

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