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

pldm: LI 1TM IBM OEM FRU Names Support #642

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

jaypadath
Copy link
Contributor

This commit supports the addition of IBM OEM FRU Names. Pretty name of the inventory item is updated by extracting the Entity Auxiliary Names PDR passed from host.

Tested By:
Verified that the decode of Entity Auxiliary Names PDR results in the intended pretty name string.

bool isPresent)
void CustomDBus::updateInventoryItemProperties(const std::string& path,
bool isPresent,
const std::string& prettyName)
Copy link
Contributor

Choose a reason for hiding this comment

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

make this an std::optionalstd::string& instead

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

// Set the pretty name dbus property to the filename
// form the dbus path object
presentStatus.at(path)->prettyName(ObjectPath.filename());
if (prettyName.empty())
Copy link
Contributor

Choose a reason for hiding this comment

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

if it is an std::optional string, then you can just check if the value is present - rather than checking for an string which is empty(), then use it ..otherwise use the ObjectPath.filename().

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

@@ -760,6 +761,12 @@ void HostPDRHandler::processHostPDRs(mctp_eid_t /*eid*/,
updateContainerId<pldm_numeric_effecter_value_pdr>(
entityTree, pdr);
}
else if (pdrHdr->type == PLDM_ENTITY_AUXILIARY_NAMES_PDR)
{
pdrTerminusHandle = 0xFFFF;
Copy link
Contributor

Choose a reason for hiding this comment

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

why was this needed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no specific terminus handle for PLDM_ENTITY_AUXILIARY_NAMES_PDR. So I put it as a default value instead of 0.

Comment on lines 1880 to 1881
std::shared_ptr<EntityAuxiliaryNames>
HostPDRHandler::parseEntityAuxNamesPDR(std::vector<uint8_t>& pdrData)
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 code duplication. I think its better to use the existing code by moving the parse function into the utils.cpp

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes this API almost matches with https://github.com/openbmc/pldm/blob/master/platform-mc/terminus.cpp#L307 except that in our use case we are not trimming the name. As of now I am moving this to a util API.

@jaypadath jaypadath force-pushed the oem_ibm_fru_names branch 4 times, most recently from 14a2f1e to 94b96b8 Compare December 17, 2024 13:36
decodedPdr->container.entity_instance_num,
decodedPdr->container.entity_container_id};

return std::make_shared<EntityAuxiliaryNames>(key, nameStrings);
Copy link
Contributor

Choose a reason for hiding this comment

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

is there any specific reason to use shared ptr here? Can't we avoid them?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This matches with the upstream design of parsing the entity aux names and approved by the community. I assume std::make_shared is used for catering the design of selecting the key with a combination of values.

Comment on lines 1891 to 1904
auto it = std::find_if(
entityAuxiliaryNamesList.begin(), entityAuxiliaryNamesList.end(),
[entity](
const std::shared_ptr<EntityAuxiliaryNames>& entityAuxiliaryNames) {
const auto& [key, entityNames] = *entityAuxiliaryNames;
return (entityAuxiliaryNames && key.type == entity.entity_type &&
key.instanceIdx == entity.entity_instance_num &&
key.containerId == entity.entity_container_id &&
entityNames.size());
Copy link
Contributor

Choose a reason for hiding this comment

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

this will become simple if we use map for entityAuxiliaryNamesList.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same comment as above and not sure whether I will be able to upstream with a different way to parse the same PDR.

PDRList entityAuxNamesPDRs{};

/** @brief Entity Auxiliary Names list */
std::vector<std::shared_ptr<pldm::hostbmc::utils::EntityAuxiliaryNames>>
Copy link
Contributor

Choose a reason for hiding this comment

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

I think changing the datatype of "entityAuxiliaryNamesList" to map will simplify things and avoid unnecessary calculations. Do you think otherwise?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be ideally same as I need to compare against each of the PDR entries to entity key parameters and there is no special calculation used here.

@@ -22,6 +24,34 @@ namespace hostbmc
namespace utils
{

using ContainerID = uint16_t;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get rid of them as those are not adding much value??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought this is more readable compared to rather than just putting as uint16_t,

@jaypadath
Copy link
Contributor Author

jenkins run tests please

1 similar comment
@jaypadath
Copy link
Contributor Author

jenkins run tests please

@jaypadath jaypadath force-pushed the oem_ibm_fru_names branch 2 times, most recently from cbd5561 to 0377d9d Compare January 10, 2025 16:14
This commit supports the addition of OEM FRU Names to the
remote end point object. Pretty name of the inventory item is
updated by extracting the entity name from the Entity Auxiliary
Names PDR passed from the remote end point.

Tested By:
1. Verified that the decode of Entity Auxiliary Names PDR results
   in the extraction of pretty name string
2. Verified that the pretty name string of the inventory dbus
   object is getting updated with new value

Signed-off-by: japadath <[email protected]>
@rfrandse rfrandse merged commit c005cc9 into ibm-openbmc:1110 Jan 13, 2025
1 check passed
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.

4 participants