SOME/IP Transport Protocol
Overview
RAPIDSEA supports SOME/IP Transport protocol as explained in the SOME/IP Protocol page. This module is used by both SOME/IP Clients and SOME/IP Servers when message payload size exceeds the single-frame limit. Messages smaller than 1400 bytes are directly transmitted via UDP socket communication. For payloads exceeding this limit, the SOME/IP layer delegates data to the TP layer. The TP layer then segments the data into smaller chunks (typically 1392 bytes each) and transmits them sequentially to the socket layer. On the receiver side, the socket delivers incoming segments to the SOME/IP layer.If the message is identified as a large payload, it is passed to the TP layer for reassembly before being returned to the application layer. The APIs provided by this module abstract the TP handling so that upper layers can seamlessly send and receive large messages.
The below diagram captures the block level diagram of the SOME/IP TP and how it interfaces with other modules.
Application Interface
The module ensures reliable transport of large payloads by providing mechanisms for: - Splitting outgoing messages into multiple transport PDUs. - Reassembling incoming segmented PDUs into a complete SOME/IP message. - Managing transmit and receive message buffers. - Queueing and releasing message buffers after use. - Registering user callbacks for transmission and reception events.The RAPIDSEA SOME/IP Transport protocol clearly defines API functions that are essential for the user to use/implement.
The below table captures the function that are to be called from the application logic.
Function |
Description |
|---|---|
rs_someip_tp_set_config |
To set TP configuration |
rs_someip_tp_open |
To initialize the SOME/IP Transport Protocol instance and configuration. |
rs_someip_tp_set_tx_msg_buf |
To set up the transmit message buffers for the SOME/IP TP communication. |
rs_someip_tp_set_rx_msg_buf |
To set up the receive message buffers for the SOME/IP TP communication |
rs_someip_tp_get_rx_assembled_msg_buf |
To get the fully assembled received message after segmentation reassembly |
rs_someip_tp_process |
To process the SOME/IP Transport Protocol state machine, including message, segmentation, reassembly, and transmit/receive handling. |
rs_someip_tp_close |
To close the SOME/IP Transport Protocol instance and release all allocated |
rs_someip_tp_transmit |
To initiate the transmission of a SOME/IP message using the Transport Protocol layer. Handles message segmentation and enqueues the message for sending. |
rs_someip_tp_rx_indication |
To indicate the reception of a SOME/IP message fragment or complete message to the Transport Protocol module for further processing or reassembly. |
SOME/IP TP Configuration Parameter:
Function |
Description |
|---|---|
tp_rx_timeout |
Timeout (in milliseconds) for receiving the next segment of a TP message. |
tp_tx_separation_time |
Minimum separation time (in microseconds) between consecutive TP segments during transmission. |
burst_size |
Maximum number of consecutive TP segments that can be sent in a single transmission burst before applying the separation delay |
Implementation Guide
Initialize instance using
rs_someip_tp_open.Configure TX and RX buffers via
rs_someip_tp_set_tx_msg_bufandrs_someip_tp_set_rx_msg_buf.Periodically call
rs_someip_tp_processfor internal state handling.Handle incoming PDUs via
rs_someip_tp_rx_indication.Release message buffers after transmission or reception using appropriate release APIs.
Close the instance using
rs_someip_tp_closeduring shutdown.
High level flow chart is depicted below:
The below diagram captures the Initialization of SOME/IP TP associated with the application layer.
The below diagram captures the high level sequence of operations associated with the SOME/IP stack layer.
SOME/IP TP Stack Memory Usage
Platform |
Memory |
Size |
|---|---|---|
Micro controller (iMXRT) |
ROM |
4KB |
Micro controller (iMXRT) |
RAM |
0KB |
SOME/IP TP Stack Memory Details
The SOME/IP Transport Protocol (SOME/IP-TP) layer is responsible for segmentation and reassembly of large SOME/IP messages that exceed the standard Ethernet MTU. It ensures reliable end-to-end data delivery for payloads that cannot fit within a single SOME/IP frame.
Each SOME/IP-TP instance allocates dedicated transmit (TX) and receive (RX) buffers to handle segmented message transfers. By default, a single TX or RX buffer is sized at approximately 5 KB. However, the total TP memory usage dynamically scales with the number of transmit and receive message contexts configured within the TP message manager.
The TP layer defines two key configuration parameters:
num_tx_msg– Number of TX messages supported by the TP instance.num_rx_msg– Number of RX messages supported by the TP instance.
TP buffer size must always equal SOME/IP buffer size for consistent data flow.
Increasing message counts enables higher concurrency but increases RAM consumption.
Reducing these counts may limit simultaneous segmented transfers.
All memory used by TP is statically allocated during initialization, ensuring predictable runtime behavior.
As per Autosar, TCP is not applicable for SOMEIP Transport Protocol layer.
Dependency
This stack depends on the below RAPIDSEA interfaces that can be obtained or custom implemented.
SOME/IP TP Header Details
Documentation from the relevant header as follows:
SOME/IP TP Module.
This file contains the APIs for using defined SOME/IP TP Module
- Author
Embien RAPIDSEA Team
- Copyright
Embien Technologies India Pvt. Ltd.
Defines
-
RS_SOMEIP_TP_E_UNINIT
SOME/IP TP module not initialized.
-
RS_SOMEIP_TP_E_PARAM_POINTER
Null pointer has been passed as an argument.
-
RS_SOMEIP_TP_E_PARAM
Unknown parameter has been passed.
-
RS_SOMEIP_TP_E_INIT_FAILED
Invalid configuration set selection.
-
RS_SOMEIP_TP_E_MESSAGE_TYPE
The TP-Flag (of Message Type) was set to ’0’
-
RS_SOMEIP_TP_E_INCONSISTENT_SEQUENCE
Inconsistent subsequent segment received.
-
RS_SOMEIP_TP_E_INCONSISTENT_HEADER
Inconsistent header received.
-
RS_SOMEIP_TP_E_DISASSEMBLY_INTERRUPT
Disassembly Interrupt due to the upper layer.
-
RS_SOMEIP_TP_E_ASSEMBLY_INTERRUPT
Assembly Interrupt due to the upper layer.
-
RS_SOME_TP_RX_MSG_MGR_STATE_FREE
TP RX State machine status is free.
-
RS_SOME_TP_RX_MSG_MGR_STATE_INPROGRESS
TP RX State machine status is inprogress.
-
RS_SOME_TP_RX_MSG_MGR_STATE_DONE
TP RX State machine status is done.
-
RS_SOMEIP_TP_MSG_STATUS_FREE
Message is unused.
-
RS_SOMEIP_TP_MSG_STATUS_IN_USE
Message is used.
-
RS_SOMEIP_TP_MSG_STATUS_READY_FOR_TX
Message is ready to be transmitted.
-
RS_SOMEIP_TP_MSG_STATUS_RX_ASSEMBLY_DONE
Message is assembled and ready to be received.
-
RS_SOMEIP_TP_MSG_STATUS_DISCARD
Message is to be discarded.
-
RS_SOMEIP_TP_RX_MSG_MGR_SIZE
Size of SOME/IP TP RX message manager.
Typedefs
-
typedef struct tag_rs_someip_tp_rx_msg_mgr rs_someip_tp_rx_msg_mgr_t
Contains information about SOME/IP RX Message Manager.
-
typedef struct tag_rs_someip_tp_msg_mgr rs_someip_tp_msg_mgr_t
Contains information about SOME/IP TP message manager.
-
typedef struct tag_rs_someip_tp_config rs_someip_tp_config_t
Contains information about SOME/IP TP configuration.
-
typedef struct tag_rs_someip_tp_instance rs_someip_tp_instance_t
Contains information SOME/IP TP Instance.
Functions
-
rs_ret_val_t rs_someip_tp_set_config(rs_someip_tp_config_t *ptr_config, uint32_t u32_rx_timeout, uint32_t u32_sep_time, uint32_t u32_burst_size)
Function to set TP configuration.
This function called to set TP configuration
- Parameters:
ptr_config – [out] - Pointer to the SOME/IP TP configuration
u32_rx_timeout – [in] - TP RX Timeout
u32_sep_time – [in] - Time between two segments
u32_burst_size – [in] - Number of segments to send without separation time
- Returns:
0 for success.
-
rs_handle_t rs_someip_tp_open(rs_someip_tp_instance_t *ptr_instance, rs_someip_tp_config_t *ptr_config)
Initialize the SOME/IP TP instance structure with initial values.
This function initialize the SOME/IP TP instance structure with initial values.
- Parameters:
ptr_instance – [in] - Pointer to the SOME/IP TP instance
ptr_config – [in] - Pointer to the SOME/IP TP configuration
- Returns:
Handle of the SOME/IP instance information
-
rs_ret_val_t rs_someip_tp_set_tx_msg_buf(rs_handle_t handle, rs_someip_msg_t *ptr_tx_msgs, uint16_t u16_num_msg)
Set up the transmit message to be used for the SOME/IP TP.
This function sets up the transmit buffer to be used for SOME/IP TP
- Parameters:
handle – [in] - Handle of SOME/IP TP instance information
ptr_tx_msgs – [in] - Pointer to TX message
u16_num_msg – [in] - Number of RX messages in array
- Returns:
Zero or negative error code
-
rs_ret_val_t rs_someip_tp_set_rx_msg_buf(rs_handle_t handle, rs_someip_msg_t *ptr_rx_msgs, uint16_t u16_num_msg)
Set up the receive message to be used for the SOME/IP TP.
This function sets up the transmit buffer to be used for SOME/IP TP
- Parameters:
handle – [in] - Handle of SOME/IP TP instance information
ptr_rx_msgs – [in] - Pointer to RX message
u16_num_msg – [in] - Number of RX messages in array
- Returns:
Zero or negative error code
-
rs_ret_val_t rs_someip_tp_get_rx_assembled_msg_buf(rs_handle_t handle, rs_someip_msg_t *ptr_out_rx_msg)
Called to get the assembled RX message from the array of messages.
This function is called to the assembled RX message from the array of messages
- Parameters:
handle – [in] - Handle to the SOME/IP TP instance
ptr_out_rx_msg – [in] - Pointer to the SOME/IP message
- Returns:
Length of the assembled message
-
rs_ret_val_t rs_someip_tp_transmit(rs_handle_t handle, rs_someip_msg_t *ptr_tx_msg)
Called to load the transmit message to message structure.
This function is called to load the transmit message and later handle it in process
- Parameters:
handle – [in] - Handle to the SOME/IP TP instance
ptr_tx_msg – [in] - Pointer to the SOME/IP message
- Returns:
0 for success.
-
rs_ret_val_t rs_someip_tp_close(rs_handle_t handle)
Called to free the instance from handle.
This function is called to free the SOME/IP TP instance from handle
- Parameters:
handle – [in] - Handle to the SOME/IP TP instance
- Returns:
0 for success.
-
rs_ret_val_t rs_someip_tp_rx_indication(rs_handle_t handle, rs_someip_msg_t *ptr_tx_msg)
Called to indicate a TP message has been received.
This function called to indicate a TP message has been received
- Parameters:
handle – [in] - Handle to the SOME/IP TP instance
ptr_tx_msg – [in] - Pointer to the SOME/IP message structure
- Returns:
0 for success.
-
rs_ret_val_t rs_someip_tp_process(rs_handle_t handle)
Function to call the TP TX and RX process.
This function called to initiate the TP TX and RX process
- Parameters:
handle – [in] - Handle to the SOME/IP TP instance
- Returns:
0 for success.
-
struct tag_rs_someip_tp_rx_msg_mgr
- #include <rs_someip_tp.h>
Contains information about SOME/IP RX Message Manager.
Public Members
-
uint16_t session_id
Session ID.
-
uint16_t client_id
Client ID.
-
void *ptr_cur_rx_msg
Current RX msg in progress.
-
uint32_t curr_rx_offset
OFFSET Of the Current RX message.
-
uint32_t curr_rx_time
Current time of the RX message.
-
uint32_t expected_offset
Expected OFFSET Of the Current RX message.
-
uint8_t state
State.
-
uint8_t reserved1
Reserved1.
-
uint16_t rx_port
RX Port.
-
uint32_t last_rx_time
Last Receive Data time.
-
uint8_t rx_addr[RS_SOCKET_IP_ADDR_V6_LEN]
Source/Target address.
-
uint16_t session_id
-
struct tag_rs_someip_tp_msg_mgr
- #include <rs_someip_tp.h>
Contains information about SOME/IP TP message manager.
Public Members
-
uint8_t cur_rx_state
Current Receive state.
-
uint8_t cur_tx_state
Current Transmit state.
-
uint16_t curr_tx_len
Length of current transmit message.
-
void *ptr_cur_tx_msg
Current RX msg in progress.
-
rs_someip_msg_t *ptr_tx_msg
Pointer to the TX message buffers.
-
rs_someip_msg_t *ptr_rx_msg
Pointer to the RX message buffers.
-
uint16_t num_tx_msg
Number of total TX messages.
-
uint16_t num_rx_msg
Number of total RX messages.
-
rs_someip_tp_rx_msg_mgr_t rx_msg_mgr[RS_SOMEIP_TP_RX_MSG_MGR_SIZE]
RX Message Manager FIFO.
-
uint8_t cur_rx_state
-
struct tag_rs_someip_tp_config
- #include <rs_someip_tp.h>
Contains information about SOME/IP TP configuration.
-
struct tag_rs_someip_tp_instance
- #include <rs_someip_tp.h>
Contains information SOME/IP TP Instance.
Public Members
-
rs_someip_tp_config_t *ptr_tp_config
Pointer to the SOME/IP configuration.
-
rs_someip_tp_msg_mgr_t tp_msg_mgr
Structure of message manager.
-
uint32_t exp_rx_len
Num frame bytes expected.
-
uint16_t total_tx_frames
Num frame bytes transmitted.
-
uint16_t frame_cnt
Frame count of the current segment
-
uint32_t tx_last_time
Last TX time
-
rs_someip_tp_config_t *ptr_tp_config