CodeConstruct / mctp

MCTP userspace tools
GNU General Public License v2.0
31 stars 18 forks source link

mctpd: `AllocateEndpoints` implementation #46

Open PeterHo-wiwynn opened 3 months ago

PeterHo-wiwynn commented 3 months ago

We have a system which has devices at lower bus hierarchy.

As descibed in DSP0236, Bus owners are responsible for allocating pools of EIDs to MCTP bridges that are lower in the bus hierarchy. This is done using the Allocate Endpoint IDs command..

The sequence will be like:

sequenceDiagram
    BMC->>MCTP_bridge: SetEndpoint
    MCTP_bridge->>BMC: Endpoint requires EID pool allocation.
    BMC->>MCTP_bridge: AllocateEndpoints
    MCTP_bridge ->>MCTP_devices: SetEndpoint

The BMC need to send Starting EID and Number of EIDs. I think we can send next available EID as the Starting EID when we call AssignStaticEndpoint. (e.g. AssignStaticEndpoint with 10, and we give 11 as Starting EID) However, the Number of EIDs is hard to define a specific number. Moreover, for the dynamic EID, it's difficult to choose which number we should send as the Starting EID. If EID 8 and 10 is occupied, should we send Starting EID 9 and 1 as the Number of EIDs?

We might need to clarify how we implement AllocateEndpoints in mctpd.

jk-ozlabs commented 3 months ago

All sounds good. We'll likely need some configuration to assign these pools of EIDs to the downstream bridges.

First impressions for this may involve @amboar 's work on the OpenBMC mctpreactor to control the configuration of these, which then sends the pool data to mctpd via dbus, on discovery of these bridge devices.

So, we'll need to define the appropriate place in the dbus hierarchy to represent the EID pool data.

jk-ozlabs commented 3 months ago

Although, given that we have the (requested) pool size as part of the Set Endpoint ID response, we can just allocate that directly from the existing dynamic EID pool, and not need any extra configuration. Would that work for you?

We could later add limits and pre-defined allocations from the dynamic pool if necessary, but that doesn't seem to be required at the moment.

PeterHo-wiwynn commented 3 months ago

Although, given that we have the (requested) pool size as part of the Set Endpoint ID response, we can just allocate that directly from the existing dynamic EID pool, and not need any extra configuration. Would that work for you?

Oh, I missed that part. This makes sense now. I think I can start implementing it, and will make a PR when it's done.