Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOME/IP Specification Cleanup #117

Closed
wants to merge 2 commits into from
Closed

SOME/IP Specification Cleanup #117

wants to merge 2 commits into from

Conversation

stevenhartley
Copy link
Contributor

The following change is a reboot of the SOME/IP specifications in an attempt to drastically simplify to show how we map up-l1 messages to SOME/IP messages and uSubscription messages to SOME/IP-SD messages. the older specifications had a lot of uProtocol version 1.3.6 concepts (cloudevents) that were rather complicating the situation.

#93

The following change is a reboot of the SOME/IP specifications in an attempt to drastically simplify to show how we map up-l1 messages to SOME/IP messages and uSubscription messages to SOME/IP-SD messages.  the older specifications had a lot of uProtocol version 1.3.6 concepts (cloudevents) that were rather complicating the situation.

#93

Scalable service-Oriented MiddlewarE over IP (SOME/IP) is a communication protocol used in the automotive industry for exchanging data between electronic control units (ECUs) in a vehicle.
SOME/IP provides a framework for efficient and reliable communication between ECUs over IP networks. It is designed to support real-time and high-bandwidth communication requirements in automotive systems. The protocol allows ECUs to discover and communicate with each other, exchange messages, and provide services in a distributed system.
SOME/IP is based on the Internet Protocol (IP) and uses UDP (User Datagram Protocol) as the transport layer. It supports various communication patterns, including unicast, multicast, and broadcast. The protocol defines a set of message formats and procedures for encoding and decoding data, handling service discovery, and managing communication sessions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOME/IP also uses TCP transport


|*`UEntity::id`* |Service ID |Software entity ID that is placed in the upper 16
bits of the SOME/IP Message ID header field

Copy link
Contributor

@int0x27 int0x27 Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SOME/IP header does not include Instance ID, but it is used in SOME/IP SD and also required for vsomeip/sommr API.
Can we map it to UUri? e.g. ServiceID | InstanceID both u16 as UAuthority::id: u32

UUri spec also refers to UResource instance, but maybe it is outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I checked again UUri spec, we don't have u32 id to use for ServiceID + InstanceID.
It could be handled as a client option per Service ID along with major/minor service version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per discussion below, we will stick with instance 1. Need to discuss instance id further though.

bits of the SOME/IP Message ID header field

|*`UResource::id`* |Method/Event ID |Identifier of the method/resource placed in the
lower 15 bits of the SOME/IP Message ID header field
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

16 bits?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


link:../basics/uuid.adoc[uProtocol UUID specifications] create a unique identifier for each message along with timestamp information. the ID is used for correlate between request and response as well. SOME/IP instead defines the ID as 16bit client ID + 16 bit session ID (that is incremented). When messages are converted SOME/IP to/from uProtocol, care must be taken to ensure that the SOME/IP ID and uProtocol UUID are properly mapped, especially when corelating a request to a response.

* Generated SOME/IP events *SHOULD* set the 16 bit client ID to 0 per SOME/IP specifications 4.1.2.4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you should refer to [PRS_SOMEIP_00925]?

• Set the Client ID to 0x00. Set the Session ID according to
[PRS_SOMEIP_00932], [PRS_SOMEIP_00933], and [PRS_SOMEIP_00521].
In case of active Session Handling the Session ID shall be incremented upon
each transmission.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

|`UMESSAGE_TYPE_PUBLISH` or `UMESSAGE_TYPE_NOTIFICATION` |`NOTIFICATION` |Both publication and notifications events are the same for SOME/IP

| `UMESSAGE_TYPE_REQUEST` |`REQUEST` |Requests type message

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we handle REQUEST_NO_RETURN as per [PRS_SOMEIP_00055] for fire and forget requests?
Could be handled internally for the client

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

|`NOT_FOUND` |`E_UNKNOWN_SERVICE`
|`UNAVAILABLE` |`E_NOT_READY`
|`DATA_LOSS` |`E_MALFORMED_MESSAGE`
|`INTERNAL` |`E_NOT_REACHABLE`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add: E_NOT_OK here

  • E_WRONG_PROTOCOL_VERSION, E_WRONG_INTERFACE_VERSION not described as well

For more error codes add link to SOME/IP Protocol specification: [PRS_SOMEIP_00191]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, @int0x27 please check


The following section will elaborate only on the translation of uSubscription messages to/from SOME/IP-SD messages. Subscription state (persistent or not) is handled in the uSubscription services and not at the transport layer or this component.

The following section we will elaborate on how Eventgroup Entry types (5.1.3.1) are mapped to uSubscription messages for the subscribe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it was harder to find this reference, can you also mention [PRS_SOMEIPSD_00385]

|===
|Eventgroup Entry Field |UUri

|Service ID |`UEntity.id`
Copy link
Contributor

@int0x27 int0x27 Apr 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: For API calls also Instance ID is required, but could be defined as static configuration in the client.
Can we add it to UAuthority::id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are merging back name, ip, and id per #120 so it is no longer ambiguous (and split into three parts). This means that the name has to be either ip address, a hostname, or an id and has to be globally unique.


|===

NOTE: `UUri.authority.ip` is translated to/from IPv4 (and/or IPv6) Endpoint Option of the SOME/IP-SD message
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vsomeip API does not provide anything to get remote endpoint IP, it uses <service/instance/..> mappings internally to find which tcp/udp endpoint is used.
For me setting remote IPs in the authority for SOME/IP seems wrong.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@int0x27 the idea is discovery has the location of the service/instance and can translate that to the endpoint (ip address) that is used to build uAuthority. So we cannot have the same service +instance hosted on different devices (ip address)? I think this is the endless loop of why we have instance id :-(

|`SubscriptionRequest`
a|The message is used to subscribe to a topic.

* Instance ID *SHALL* assume to be 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instance ID should be arbitrary value expected from the SOME/IP service. e.g. if you hardcode 0 and the service only handles instance 1, subscription will be NACKed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per discussion thread I'm changing this to 1 in lieu of 0


* Instance ID *SHALL* assume to be 0
* *SHALL* assume version 0 to match uProtocol backwards compatibility requirements
* TTL (`SubscribeAttributes.ttl`) *SHALL* set to 0xFFFFFF to indicate that the subscription should remain for the duration of the ignition cycle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark about vsomeip: there is global Service Discovery TTL (static config) and it is used for all subscriptions. It's not possible to have it per service or dynamic. Probably it should match remote service shortest TTL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@int0x27 , given your comment, should we assume live forever?

a|The message is used to subscribe to a topic.

* Instance ID *SHALL* assume to be 0
* *SHALL* assume version 0 to match uProtocol backwards compatibility requirements
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean Major Version here? The service may NACK the subscription if it requests different major version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No the UService.id but the text is not clear, I cleaned it up a bit

response.reqid = request.id
```

* Auto-generated SOME/IP REQUEST message, *MAY* set the 16 bit client ID to the 0 per SOME/IP specifications
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only for notifications, but not requests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@int0x27 do we need to explicitly state this?


|Major Version | `UEntity.major_version`

|Eventgroup ID | `UResource.id`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Eventgroup ID and Event ID both are being mapped to UResource.id, I am guessing it means that this still doesn't support multiple event ids in an eventgroup and that eventgroup id should be equal to event id ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we have 1 : 1 mapping for events and groups, they should be different IDs for the client library.
Everything is hardcoded in the SOME/IP service and the client library must follow those defined IDs.

I suggest we use Event ID as the primary mapping (as UResource.id) also for subscribe().
The client implementation may look up its static configuration to get additional information about Eventgroup ID to call subcribe(), but then events will be coming with Event ID, so subscribing to that Event ID makes more sense.

As a side effect subscribing to ECU with multiple events in the event group may trigger receive on_message() notifications for other events as well (those can be filtered on client level)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked Ivan's suggestion. lets keep event group logical entity (i.e. not defined in uProtocol). we can map an event group or event groups to a service. also we can consider adding new api in sdk for registerListnergroup() which can be used for registering logical events (event id) for a services/event group.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in latest change.

@stevenhartley
Copy link
Contributor Author

Closing so we can use #165 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants