-
Notifications
You must be signed in to change notification settings - Fork 28
MCTP Bridge Polling #85
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
base: main
Are you sure you want to change the base?
MCTP Bridge Polling #85
Conversation
Why not just store the allocated pool range on the bridge peer? This would be a considerably simpler change, and means the seaprate |
For now we are storing the start of pool and pool size (in some sense it represents allocated pool EID range), would this requirement still needed? |
Not sure I understand the question - if the In your eccc13f change, the |
I see, I think I understand what your ask is here, peer->pool_start and peer->pool_size should represent "allocated" information (coming as response to ALLOCATE_EID command whatever bridge's final say is). We are initially storing the "proposed" pool start information and minimum of "proposed" pool size and actual pool_size (response from SET ENDPOINT ID) over these two vars and request is sent for ALLOCATION based on the final proposed data, but once we get a response, whatever has been allocated by bridge, we are keeping it as pool_start and pool_size inside peer. Then later marking this range as reserved in the new reserve_eid_set per network. But I see your point now, our bridge could have any pool_size as actual size coming in response to SET_ENDPOINT_ID but the proposed size could differ and so could finally allocated size too(response of ALLOCATE_ENDPOINT_ID) May be we can introduce a new var representing actual_pool_size (response of SET_ENDPOINT ID) and call out these two vars, peer->pool_start and peer->pool_size as allocated data while network reserved_eid_set continues to interact with these vars as it has been doing. |
I also have added a TODO comment here todo in our current implementation of Busowner pool and local eid assignment, we don't have proper check to see, if localEID which is being set via mctp tool (mctp addr add <eid> dev <interface>) for any network, has already been used by Busowner when it assigned dynamic/static EID to any MCTP device/endpoint. Reference: I have two interfaces mctpusb0 and mctpspi0_2. I try to add another local EID to mctspi0_2 (EID 20) . Here EID 20 was already used up via Bridge Downstream EID under mctpusb0 thus the error message, I still see mctp link map retaining the eid 20 even though we had error in setting local eid (not seen in mctp tool but mctpd) Not sure if this was intentionally done?
Since we are getting into the reservation of EIDs, our new localEID could very well be from the reserved EID space. So should we introduce restriction of such manner in mctp tool/mctpd? |
Yes, that's along the lines of what I was thinking. But maybe with the names adjusted: And then as an improvement: since the
There's not much we can do about that case; mctpd isn't (currently) managing that local EID, so there is not much we can do on conflicts - as you have noted.
No, not while mctpd is not responsible for assigning local EIDs. I see the best way to prevent this case is a facility to explicitly configure mctpd with the range of dynamically-allocatable EIDs, and it's up to the platform integrator to ensure that that range does not conflict with the potential set of local EIDs. (that's one of the reasons for the configuration file support, for exactly this use-case) |
Table 23 – Allocate Endpoint IDs message An error completion code (ERROR_INVALID_DATA should be returned) shall be returned if the number of EIDs being allocated (Number of Endpoint IDs) exceeds the Dynamic Endpoint ID Pool size. (This error condition does not apply to when the number of endpoint IDs passed in the request is 0x00).
Acknowledged. |
If there is no way to better handle the transient requested peer size, I would prefer to just store it on the
We have the capacity of the brige, from the Set Endpoint ID response, no? As you say:
I would suggest:
If the allocation is not possible in (2), just fail for now. We can look at fallbacks in a follow-up. I think this it fine to do without a new dbus call, but am open to ideas about why we may need one. |
Please let me know if I understood you correctly on steps
Introduces req_pool_size and req_pool_start, updates pool_size -> alloc_pool_size and pool_start ->alloc_pool_start. If we are going by this then do we have to get pool_start argument from dbus method AssignBridgeStatic if we have already decided what pool start will be from req_pool_start? Or do you mean not to use any new dbus method AssignBridgeStatic at all?
|
Since the allocation mechanism is now in #71, I'll shift this discussion to there. |
Add MCTP control message structures for the ALLOCATE_ENDPOINT_ID command to support bridge endpoint EID pool allocation. - Add mctp_ctrl_cmd_alloc_eid request/response structure Signed-off-by: Faizan Ali <[email protected]>
* For mctp bridge to have contiguous bridge EID with it's downstream endpoints, we introduce max_pool_size, bus-owner configuration, to be assumed pool size before we get it's actual size via SET_ENDPOINT_ID command response. Signed-off-by: Faizan Ali <[email protected]>
Add support for MCTP bridge endpoints that can allocate pools of EIDs for downstream endpoints. We assume each AssignEndpoint d-bus call will be for a bridge. with this we allocate/reserve a max_pool_size eid range contiguous to bridge's own eid. Later this pool size is updated based on SET_ENDPOINT_ID command response. - Add pool_size and pool_start fields to struct peer - Update AssignEndpoint d-bus call to support MCTP Bridge dynamic EID assignement. - Fetch contiguous eids for bridge and its downstream endpoints. - is_eid_in_bridge_pool(): for static eid assignement via AssignEndpointStatic d-bus call, need to check eid if being part of any other bridge's pool range. Signed-off-by: Faizan Ali <[email protected]>
Add implementation for the MCTP ALLOCATE_ENDPOINT_ID control command to enable bridges to allocate EID pools for downstream endpoints. - Add endpoint_send_allocate_endpoint_id() for sending allocation requests - Update gateway route for downstream EIDs - Integrate allocation of dynamic eid for downstream endpoints of bridge with AssignEndpoint d-bus method Signed-off-by: Faizan Ali <[email protected]>
* updated mctpd.md with new mctp bridge support for dynamic eid assignment from AssignEndpoint d-bus call Signed-off-by: Faizan Ali <[email protected]>
Add new test for validating AssignEndpoint D-Bus method to verify bridge endpoint EID allocation being contiguous to its downstream eids. - Add test_assign_dynamic_bridge_eid() for bridge simulation testing - Simulate bridge with some downstream endpoints in test framework - Test EID allocation of bridge and downstream being contiguous Signed-off-by: Faizan Ali <[email protected]>
* au.com.codeconstruct.MCTP.Bridge1 interface will capture details of bridge type endpoint such as pool start, pool size, pool end. Signed-off-by: Faizan Ali <[email protected]>
955d1b4
to
2746a86
Compare
Add asynchronous polling mechanism for MCTP bridge downstream endpoints to discover them. The polling continues throughout the bridge's existence under the MCTP network and creates peer structures only when endpoints respond to poll successfully. - Update bus-owner config with polling configuration ep_removal_threshold - Add bridge_eid_poll_context and bridge_endpoint_discovery structures - Implement setup_async_downstream_ep_poll() for polling initialization - Add send_bridge_poll_request() for periodic GET_ENDPOINT_ID messages - Add handle_bridge_poll_response() for response processing - Add handle_poll_timeout() with ep_removal_threshold failure handling - Add cleanup_bridge_polling() and cleanup_bridge_downstream_peers() The polling uses an asynchronous sender-response model where mctpd continuously polls downstream EIDs and creates peer structures upon successful responses. Failed endpoints are removed after reaching the failure threshold (ep_removal_threshold). Polling stops and all resources are cleaned up when bridges are removed. Signed-off-by: Faizan Ali <[email protected]>
* modify tets case to include bridge polling logic. * once endpoints are disocvered assert the object path Signed-off-by: Faizan Ali <[email protected]>
2746a86
to
a472892
Compare
Hello Jeremy, |
I'm going to hold off on reviewing this one until we have the core bridge support done, given that's a hard dependency for this. |
understood, sounds good |
MCTP Bridge Endpoint poll
A MCTP Bridge is assigned range of EIDs for its downstream endpoints depending upon bridge's applicable pool size. MCTP Base Spec introduces MCTP control command
AllocateEndpointID
to allocate these set of range of EIDs. It's possible to have downstream endpoints detached/undiscovered due to some error in its internal bus or via physical hotplug removal (such as usb bus aligned devices). One way to detect the removal/presence of its downstream devices, make buswoner probes on each bridge's downstream endpoint using the Get Endpoint ID command. If a device fails to respond, it is treated as no longer present on the bus. The corresponding EID (if was assigned) is then released back to the bridge pool for reassignment.MCTP Reservation of Bridge EID
Once MCTP Bridge is allocated set of Endpoint IDs, it would assign the upcoming discoverable downstream devices among those range of eids. For a discovered downstream device i.e once it responds to poll command,
mctpd
then creates a peer for it and exposes its D-bus object and marks that eid as used from its EID pool.This PR is based on :