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

Move to libpldm APIs for Allocating Instance IDs and change Transport APIs #213

Open
wants to merge 2 commits into
base: 1110
Choose a base branch
from

Conversation

Lakshmi-y
Copy link

Replace the current APIs with libpldm APIs for allocating instance IDs directly. This eliminates the need for remote D-Bus calls to the pldm daemon.

Replace pldm transport APIs with libpldm pldm_transport APIs. This change migrates the application off the deprecated "requester" APIs in libpldm. Since we currently lack the infrastructure to obtain the correct TIDs, use the EID as the TID in the EID-to-TID mapping to maintain the current functionality.

Change-Id: I5854aa022582ceae6a1843983fc90181b7e6d55f

@jenkins-openbmc-ibm
Copy link

Can one of the admins verify this patch?

@Lakshmi-y Lakshmi-y force-pushed the libpldm-mctp branch 3 times, most recently from eb2049a to e580391 Compare July 10, 2024 21:56
@Lakshmi-y Lakshmi-y requested a review from jinuthomas July 11, 2024 03:02
@Lakshmi-y
Copy link
Author

I created one commit for both instance ID API and transport API changes.
Changes are similar to phosphor-debug-collector, waiting for review,
https://gerrit.openbmc.org/c/openbmc/phosphor-debug-collector/+/72594
https://gerrit.openbmc.org/c/openbmc/phosphor-debug-collector/+/72595

@Lakshmi-y
Copy link
Author

Journalctl out:
ul 09 20:07:33 rain104bmc ibm-panel[1545]: Button event 2 At function - 16 Panel cur state = 2e
Jul 09 20:09:09 rain104bmc ibm-panel[1545]: Sub function executed = 0
Jul 09 20:09:09 rain104bmc ibm-panel[1545]: Got instanceId: 0 from PLDM eid: 9
Jul 09 20:09:09 rain104bmc ibm-panel[1545]: packet data sent to pldm: 80 02 39 08 00 01 01 16
Jul 09 20:09:09 rain104bmc ibm-panel[1545]: Button event 2 At function - 16 Panel cur state = 2e
Jul 09 20:09:09 rain104bmc pldmd[2132]: Got a repo change event from TID: 208
Jul 09 20:09:09 rain104bmc pldmd[2132]: pldmPDRRepositoryChgEvent eventDataOperation : 3
Jul 09 20:09:09 rain104bmc pldmd[2132]: Record handles sent down to BMC: 33554449
Jul 09 20:09:10 rain104bmc pldmd[2132]: Panel:BitMap received: 00 00 00
Jul 09 20:09:10 rain104bmc ibm-panel[1545]: Bitmap received: 00 00 00
Jul 09 20:09:10 rain104bmc ibm-panel[1545]: Empty function list received. Functions enabled before will be disabled.
Jul 09 20:09:10 rain104bmc ibm-panel[1545]: Function Disabled: 16
Jul 09 20:09:10 rain104bmc ibm-panel[1545]: Button event 2 At function - 16 Panel cur state = 2e
Jul 09 20:09:12 rain104bmc ibm-panel[1545]: Sub function executed = 0
Jul 09 20:09:12 rain104bmc ibm-panel[1545]: Got instanceId: 0 from PLDM eid: 9
Jul 09 20:09:12 rain104bmc ibm-panel[1545]: packet data sent to pldm: 80 02 39 08 00 01 01 16
Jul 09 20:09:12 rain104bmc ibm-panel[1545]: Button event 2 At function - 16 Panel cur state = 2e
Jul 09 20:10:04 rain104bmc pldmd[2132]: 81 02 0a 01 01 00 15 00 01 00 02 00
Jul 09 20:10:04 rain104bmc pldmd[2132]: 81 02 0a 01 01 00 15 00 01 00 02 00
Jul 09 20:10:05 rain104bmc pldmd[2132]: Got a repo change event from TID: 208
Jul 09 20:10:05 rain104bmc pldmd[2132]: pldmPDRRepositoryChgEvent eventDataOperation : 3
Jul 09 20:10:05 rain104bmc pldmd[2132]: Record handles sent down to BMC: 33554449
Jul 09 20:10:05 rain104bmc pldmd[2132]: Panel:BitMap received: 00 00 40
Jul 09 20:10:08 rain104bmc ibm-panel[1545]: Bitmap received: 00 00 40
Jul 09 20:10:08 rain104bmc ibm-panel[1545]: Function enabled: 16

… APIs

Replace the current APIs with libpldm APIs for allocating instance IDs
directly.  This eliminates the need for remote D-Bus calls to the pldm
daemon.

Replace pldm transport APIs with libpldm pldm_transport APIs. This
change migrates the application off the deprecated "requester" APIs in
libpldm. Since we currently lack the infrastructure to obtain the
correct TIDs, use the EID as the TID in the EID-to-TID mapping to
maintain the current functionality.

Change-Id: I5854aa022582ceae6a1843983fc90181b7e6d55f
Signed-off-by: Lakshmi Yadlapati <[email protected]>
-Added support for kernel MCTP (AF_MCTP) to enable MCTP communication
 using AF_MCTP sockets.

- Introduced a new configuration option 'transport-implementation'

The 'transport-implementation' option can be set to either:
- 'mctp-demux': Uses the existing mctp-demux transport method.
- 'af-mctp': Uses the new kernel AF_MCTP transport method.

Change-Id: I6b6b4d85bfec4b6efa630448f0c51b71b1150efa
Signed-off-by: Lakshmi Yadlapati <[email protected]>
@@ -43,6 +60,19 @@ class PldmFramework
/** Host mctp eid */
static constexpr auto mctpEid = (types::Byte)9;

/** @brief Hardcoded TID */
using TerminusID = uint8_t;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move this to types.hpp

*/
int openPldm();

/** @brief Opens the MCTP socket for sending and receiving messages.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Format: Move this to next line please.

@@ -1,3 +1,4 @@

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove extra line.

method.append(mctpEid);
auto reply = bus.call(method);
reply.read(instanceId);
std::this_thread::sleep_for(std::chrono::milliseconds(100));
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you please add a comment about why this 100ms sleep is required? And how did we reach to this number?

Copy link
Collaborator

@SunnySrivastava1984 SunnySrivastava1984 left a comment

Choose a reason for hiding this comment

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

I could not understand from the commit message why this change was required.
Could you please add that to the commit message so that I can get some context w.r.t. the changes.

@@ -1,2 +1,8 @@
option('tests', type: 'feature', value: 'enabled', description: 'Build tests.',)
option('system-vpd-dependency', type: 'feature', description: 'Enable/disable system vpd dependency.', value: 'disabled')
option(
Copy link
Collaborator

Choose a reason for hiding this comment

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

So, which one needs to be used and based on what criteria is it decided?

@@ -135,6 +142,11 @@ class PldmFramework
*/
int openMctpDemuxTransport();

/** @brief Opens the MCTP AF_MCTP for sending and receiving messages.
*
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is AF_MCTP? what it does? and why it is required here?
can you please add those details in doxygen.

@@ -34,6 +34,12 @@ systemd_system_unit_dir = systemd.get_variable('systemdsystemunitdir')

service_file = 'service_files/com.ibm.panel.service'

if(get_option('transport-implementation')) == 'mctp-demux'
add_project_arguments('-DPLDM_TRANSPORT_WITH_MCTP_DEMUX', language : 'cpp')
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you please add a comment here on what does the options DPLDM_TRANSPORT_WITH_MCTP_DEMUX and DPLDM_TRANSPORT_WITH_AF_MCTP do?

@@ -72,9 +81,10 @@ int PldmFramework::openPldm()
return fd;
}

int PldmFramework::openMctpDemuxTransport()
Copy link
Collaborator

Choose a reason for hiding this comment

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

you have created the line 75 in your first commit and edited it in second commit(in the same PR). can you please check if these changes between two commits are required?

Copy link
Collaborator

@jinuthomas jinuthomas left a comment

Choose a reason for hiding this comment

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

I see that there is a lot of if...else , which I am not a fan of , why do we need two types of mctp in this repo?
All I do have concerns on the exception handling , as it is not per pour coding standards.
Could you retry this code.

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.

5 participants