-
Notifications
You must be signed in to change notification settings - Fork 20
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
Support get static eid config from entity manager #17
Conversation
155f95b
to
729dab7
Compare
The mctpd will try to find the configuration interface "xyz.openbmc_project.Configuration.MCTPEndpoint" and parse the data. Then it will send get EID command to target device. If we the get the response, we publish the EID on the D-Bus. Test log: - reboot and check MCTP D-Bus path root@bmc:~# reboot root@bmc:~# busctl tree xyz.openbmc_project.MCTP `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/mctp `- /xyz/openbmc_project/mctp/1 |- /xyz/openbmc_project/mctp/1/60 `- /xyz/openbmc_project/mctp/1/8 root@bmc:~# pldmtool base GetTID -m 60 { "Response": 134 } upstream link: CodeConstruct#17
b24373a
to
55d015c
Compare
@jk-ozlabs @mkj - Is there any feedback on this PR? It has been open for a month with no action. |
So there was a discussion in OpenBMC gerrit, at https://gerrit.openbmc.org/c/openbmc/entity-manager/+/66750, you mentioned:
And I replied:
So: this is pending a decision on whether we want to expose the EM interfaces outside of OpenBMC. If not, we'll need a bit of bridge code, within OpenBMC, to perform configuration on non-openbmc code (this change is essentially a shortcut for calling the SetupEndpoint method based on EM config, which could justifiable be done elsewhere) If so, we should be fine with this as-is. Let me know what your preference with the interface. |
198de48
to
45156e1
Compare
eed15c8
to
4fc8bc9
Compare
Hi @jk-ozlabs, |
Sure thing! I'll get that done this week. |
4fc8bc9
to
30b0b9f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
Thanks for the change, overall I'm happy with the strategy here.
There are a few comments on the code though. Most are super minor, except for the InterfacesAdded / InterfacesRemoved handling - if possible, we probably want to filter those at the match level too, so we're not getting floods of signals.
src/mctpd.c
Outdated
rc = sd_bus_message_read(m, "s", &iface); | ||
if (rc == 0) | ||
break; | ||
if(strcmp(iface,OPENBMC_MCTP_CONFIG_IFACE) == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have two different spacing styles here:
if (...)
vs
if(...)
The former is more consistent with existing code.
(Super minor, only worth changing if you're re-working this commit otherwise. However, there are several other instances of this in the patch)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
} | ||
} | ||
|
||
if (update == true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (update)
You may also want to return early here, and avoid the indent below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
char *ret = strrchr(temp, '/'); | ||
*ret = '\0'; | ||
|
||
for(;;) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you seem to be using a for
to define an infinite loop, but then working over an iterator. How about:
for (peer = find_peer_by_association(ctx, temp); peer; peer = find_peer_by_association(ctx, temp)) {
remove_peer(peer)
}
the repetition isn't ideal, so I'm also okay with:
for (;;) {
peer = find_peer_by_association(ctx, temp);
if (!peer)
break;
remove_peer(peer)
}
(also, spacing again around the for
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
sd_bus_message_read(message, "t", &data); | ||
|
||
size = sizeof(uint8_t); | ||
memset(dest->hwaddr, 0x0, MAX_ADDR_LEN); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will already be zeroed above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
|
||
rc = add_peer(ctx, dest, (mctp_eid_t)eid, net, &peer); | ||
if (rc < 0) { | ||
warnx("Failed to add peer for EID %d", (mctp_eid_t)eid); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe do the cast once after extracting from the sb_bus_message_read()
, instead of every subsequent use of eid
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
char object_path[100]; | ||
strcpy(object_path, s[i]); | ||
char *ret = strrchr(object_path, '/'); | ||
*ret = '\0'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be a NULL pointer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
char *ret = strrchr(object_path, '/'); | ||
*ret = '\0'; | ||
|
||
peer->association = malloc(sizeof(struct association)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could have this allocated as part of the peer
, and then just use a boolean flag to indicate no association.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I added this to add_peer
.
30b0b9f
to
1851ecf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look at options for filtering InterfacesAdded, but I think we'll just go with what you have here. A few minor changes included as comments, but looks good so far.
src/mctpd.c
Outdated
if (strcmp(iface, OPENBMC_MCTP_CONFIG_IFACE) != 0) { | ||
sd_bus_message_skip(m, "a{sv}"); | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some unusual indenting here; just keep that on the same line:
} else {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
return rc; | ||
} | ||
|
||
int on_interface_removed(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
} | ||
sd_bus_message_exit_container(m); | ||
//TODO: parse message from signal instead of recanning | ||
if (update == true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (update)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
@@ -2584,6 +2833,92 @@ static int mctpd_dbus_enumerate(sd_bus *bus, const char* path, | |||
return rc; | |||
} | |||
|
|||
int on_interface_added(sd_bus_message *m, void *userdata, sd_bus_error *ret_error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
static
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
&error, &message, "t"); | ||
if (rc < 0) { | ||
warnx("Failed to get property: %s", error.message); | ||
goto out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
break
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're also generating the same error message as above, so there will be no way to tell which path failed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I also revised the message.
src/mctpd.c
Outdated
@@ -2337,6 +2553,9 @@ static int bus_endpoint_get_prop(sd_bus *bus, | |||
} else if (strcmp(property, "UUID") == 0 && peer->uuid) { | |||
const char *s = dfree(bytes_to_uuid(peer->uuid)); | |||
rc = sd_bus_message_append(reply, "s", s); | |||
} else if (strcmp(property, "Associations") == 0 && peer->association) { | |||
rc = sd_bus_message_append(reply, "a(sss)", | |||
1, peer->association->forward, peer->association->reverse, peer->association->object_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super minor, but can you wrap at 80 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
|
||
rc = peer_from_path(ctx, path, &peer); | ||
if (rc >= 0 && peer->published) { | ||
if (peer->association) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just include this in the conditional above maybe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
src/mctpd.c
Outdated
sd_bus_message_exit_container(m); | ||
} | ||
sd_bus_message_exit_container(m); | ||
//TODO: parse message from signal instead of recanning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by 'recanning' here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for typo. It should be 'rescanning'.
src/mctpd.c
Outdated
if (update == true) | ||
setup_static_eid(ctx); | ||
|
||
out: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you really need this label? there's no cleanup code, you could just return directly from the error cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Removed it.
7b1baed
to
c59e5fe
Compare
src/mctpd.c
Outdated
|
||
rc = peer_from_path(ctx, path, &peer); | ||
if (rc >= 0 && peer->published && peer->association) { | ||
*ret_found = peer; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only minor, but indentation is off here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
char temp[100]; | ||
strcpy(temp, object_path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same potential overflow here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also made it check the length here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same off-by-one as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good now - just have a couple of potential stack overflows to resolve. If you'd prefer to do those in a separate change, let me know, and I'll merge this and address them separately.
And one last thing: can you add a |
In which condition the Static Endpoint object path will be created? Because the https://gerrit.openbmc.org/c/openbmc/entity-manager/+/66750 creates the Association without whenever the configuration is existing. |
Summary: Updated latest patch for mctpd. CodeConstruct/mctp#17 # Description Please include a summary of the change and which issue is fixed. # Motivation Please include an explanation of why you these changes are necessary X-link: facebookexternal/openbmc.wiwynn#2938 Test Plan: Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Reviewed By: williamspatrick Differential Revision: D52501259 fbshipit-source-id: 35015fa16ed6b2d312a26c1f2cf0ef4a8e1ecf8c
1261237
to
4571f0c
Compare
Hi @ThuBaNguyen, We made it sent the MCTP |
Made it get the inventory path from association created by `mctpd` or configuration in static endpoint table. The inventory path is for platform-mc terminus. Tested with: CodeConstruct/mctp#17 https://gerrit.openbmc.org/c/openbmc/entity-manager/+/66750 which gets static EID from entity-manager and creates association definition D-Bus interface. Change-Id: Ic9d0b6cd602d71a6fa51a73bd45964c2a0dac6aa Signed-off-by: Delphine CC Chiu <[email protected]>
The inventory name was set as PLDM_DEVICE_TID, but we might need more specific name to identify inventory item. This change made it get inventory path found by MctpDiscovery. It keeps the original path name by default if it didn't get the path from MctpDiscovery. Tested with: CodeConstruct/mctp#17 https://gerrit.openbmc.org/c/openbmc/entity-manager/+/66750 which gets static EID from entity-manager and creates association definition D-Bus interface. Change-Id: I17b6c56722df180defa1f769a54fd4b10df22d71 Signed-off-by: Delphine CC Chiu <[email protected]>
Made it get the inventory path from association created by `mctpd` or configuration in static endpoint table. The inventory path is for platform-mc terminus. Tested with: CodeConstruct/mctp#17 https://gerrit.openbmc.org/c/openbmc/entity-manager/+/66750 which gets static EID from entity-manager and creates association definition D-Bus interface. Change-Id: Ic9d0b6cd602d71a6fa51a73bd45964c2a0dac6aa Signed-off-by: Delphine CC Chiu <[email protected]>
The inventory name was set as PLDM_DEVICE_TID, but we might need more specific name to identify inventory item. This change made it get inventory path found by MctpDiscovery. It keeps the original path name by default if it didn't get the path from MctpDiscovery. Tested with: CodeConstruct/mctp#17 https://gerrit.openbmc.org/c/openbmc/entity-manager/+/66750 which gets static EID from entity-manager and creates association definition D-Bus interface. Change-Id: I17b6c56722df180defa1f769a54fd4b10df22d71 Signed-off-by: Delphine CC Chiu <[email protected]>
Okay, I've been chipping away at improvements to the Next thing that needs attention is fixing up the schema in EM. Regarding the proxy associations, here's an example busctl invocation that will allow an application to traverse back from an
I think the association forward and reverse names probably need some bikeshedding, but for now I've just copied what was created by the patches in this PR. |
7a6a164
to
8de7934
Compare
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviours to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviours to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
alright, I think the
I've done a conversion of the Yosemit4 configs to use the new schemas, but I'm not sure the config as-specified was well formed: |
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor is implemented in terms of two new expose schemas in entity-manager: - MCTPInterface - MCTPDevice mctpreactor tracks instances of both appearing as a result of inventory changes, and uses the provided information to dynamically configure the endpoints via mctpd. This dynamic configuration may include assignment of static endpoint IDs to the devices as they appear. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
Summary: # Description: Update mctp patch for parsing data in InterfaceAdded signal. The mctpd will try to add corresponding board to EID table instead of rescanning whole EM config on every InterfaceAdded signal. The code had been update to CodeConstruct/mctp#17. # Motivation: Rescanning whole EM config on every InterfaceAdded signal cause performance issue. Chenge to parse signal data instead. X-link: facebookexternal/openbmc.wiwynn#3000 Test Plan: Check if mctpd spends less time getting EID on dbus. - pass Reviewed By: wangx6f Differential Revision: D54584520 fbshipit-source-id: 379f17efa52177dd9fc050aeada44b4432be5805
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor tracks instances of transport-specific MCTP device configurations appearing as a result of inventory changes, and uses them to assign endpoint IDs via mctpd. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor tracks instances of transport-specific MCTP device configurations appearing as a result of inventory changes, and uses them to assign endpoint IDs via mctpd. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor tracks instances of transport-specific MCTP device configurations appearing as a result of inventory changes, and uses them to assign endpoint IDs via mctpd. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
The mctpd will try to find the configuration interface "xyz.openbmc_project.Configuration.MCTPEndpoint" and parse the data. Then it will send get EID command to target device. If we the get the response, we publish the EID on the D-Bus. Changes: - Scan D-Bus for static EIDs config. - Add a method that rescans entity-manager config for EIDs. - Add matches for monitoring InterfaceAdded and InterfaceRemoved from entity-manger. - Add association definition interface for EIDs that came from entity-manager config. Test log: - reboot and check MCTP D-Bus path root@bmc:~# reboot root@bmc:~# busctl tree xyz.openbmc_project.MCTP `- /xyz `- /xyz/openbmc_project `- /xyz/openbmc_project/mctp `- /xyz/openbmc_project/mctp/1 |- /xyz/openbmc_project/mctp/1/60 `- /xyz/openbmc_project/mctp/1/8 root@bmc:~# pldmtool base GetTID -m 60 { "Response": 134 } Signed-off-by: PeterHo-wiwynn <[email protected]>
8de7934
to
417e77c
Compare
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor tracks instances of transport-specific MCTP device configurations appearing as a result of inventory changes, and uses them to assign endpoint IDs via mctpd. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[3] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
While mctpd[1] may see heavy use in projects such as OpenBMC, it implements generic functionality necessary to operate MCTP as a protocol. It therefore should be easy to use in other contexts, and so it feels unwise to embed OpenBMC-specific details in its implementation. Conversely, entity-manager's scope is to expose inventory and board configuration. It externalises all other responsibilities for the sake of stability and maintenance. While entity-manager is central to OpenBMC's implementation and has little use in other contexts, embedding details of how to configure mctpd in entity-manager exceeds its scope. Thus we reach the design point of mctpreactor, an intermediary process that encapsulates OpenBMC-specific and mctpd-specific behaviors to constrain their dispersion in either direction. The design-point was reached via discussion at [2]. mctpreactor tracks instances of transport-specific MCTP device configurations[3] appearing as a result of inventory changes, and uses them to assign endpoint IDs via mctpd. The lifecycle of an MCTP device can be quite dynamic - mctpd provides behaviors to recover[4] or remove endpoints from the network. Their presence cannot be assumed. mctpreactor handles these events: If a device is removed at the MCTP layer (as it may be unresponsive), mctpreactor will periodically attempt to re-establish it as an endpoint so long as the associated configuration on the entity-manager inventory object remains exposed. [1]: https://github.com/CodeConstruct/mctp/ [2]: CodeConstruct/mctp#17 [3]: https://gerrit.openbmc.org/c/openbmc/entity-manager/+/70628 [4]: https://github.com/CodeConstruct/mctp/blob/7ec2f8daa3a8948066390aee621d6afa03f6ecd9/docs/endpoint-recovery.md Change-Id: I5e362cf6e5ce80ce282bab48d912a1038003e236 Signed-off-by: Andrew Jeffery <[email protected]>
With the So, I'll close this now, but @BonnieLo : let me know if I'm incorrect with the above and we can revisit/reopen. |
Hi @jk-ozlabs, In our project, we have numerous devices on different I3C buses that use the same I3C address. As a temporary solution, we have been using the As I know, Thank you for your time and consideration. |
Can you expand on this a little? I assume these are on separate i3c busses, right? |
Ah, you have mentioned that they are separate busses, right. In which case, |
Thank you for your prompt response! We will double-check this and create a new issue if we have any further questions. |
The mctpd will try to find the configuration interface "xyz.openbmc_project.Configuration.MctpDevice" and parse the data. Then it will send get EID command to target device. If we the get the response, we publish the EID on the D-Bus.
Test log:
root@bmc:
# busctl tree xyz.openbmc_project.MCTP
# pldmtool base GetTID -m 60- /xyz
- /xyz/openbmc_project- /xyz/openbmc_project/mctp
- /xyz/openbmc_project/mctp/1 |- /xyz/openbmc_project/mctp/1/60 `- /xyz/openbmc_project/mctp/1/8 root@bmc:{
"Response": 134
}