commit | 36af84cdbb660953d73804a12dfda056c3ac9b08 | [log] [tgz] |
---|---|---|
author | Rashmica Gupta <rashmica@linux.ibm.com> | Wed Apr 12 16:16:28 2023 +1000 |
committer | Andrew Jeffery <andrew@aj.id.au> | Fri Apr 21 04:11:06 2023 +0000 |
tree | 0cc7cf63828a47c6153bb7064cc8b19c71d2e069 | |
parent | 891781e945318290d657a621dd0ce592c0b43ddd [diff] |
requester: Add new APIs for instance ID allocation and freeing This patch starts the move of instance id handling into libpldm. Currently pldmd allocates instance ids, and exposes a DBus call for external apps to get instance ids. It relies on exploiting a behaviour of mctp-demux to reclaim used ids by monitoring all incoming PLDM responses. When moving to AF_MCTP, PLDM messages are not broadcast to all PLDM sockets, and so this method of reclaiming ids won't work automatically. As instance id handling is moving into libpldm eventually, we may as well do that now rather than adding an additional step to address this issue. So an allocate and free function for instance ids is added in this patch. As this implementation uses file locking, we have the feature of any ids belonging to a process that dies being automatically reclaimed into the id pool. Some context behind the file based range locking design for instance IDs can be found here: https://amboar.github.io/notes/2023/03/28/motivating-a-new-scheme-for-pldm-instance-id-management-in-openbmc.html and https://amboar.github.io/notes/2023/03/29/a-global-pldm-instance-id-allocator-for-libpldm.html Change-Id: Ia19870b1bcae9e614bda6e475b290faa0b327a73 Signed-off-by: Rashmica Gupta <rashmica@linux.ibm.com>
This is a library which deals with the encoding and decoding of PLDM messages. It should be possible to use this library by projects other than OpenBMC, and hence certain constraints apply to it:
Source files are named according to the PLDM Type, for eg base.[h/c], fru.[h/c], etc.
Given a PLDM command "foo", the library will provide the following API: For the Requester function:
encode_foo_req() - encode a foo request decode_foo_resp() - decode a response to foo
For the Responder function:
decode_foo_req() - decode a foo request encode_foo_resp() - encode a response to foo
The library also provides API to pack and unpack PLDM headers.
Need meson
and ninja
. Alternatively, source an OpenBMC ARM/x86 SDK.
meson setup builddir && ninja -C builddir
The simplest way of running the tests is as described by the meson man page:
meson setup builddir && meson test -C builddir
This will support OEM or vendor-specific functions and semantic information. Following directory structure has to be used:
libpldm |---- include/libpldm | |---- oem/<oem_name>/libpldm | |----<oem based .h files> |---- src | |---- oem/<oem_name> | |----<oem based .c files> |---- tests | |---- oem/<oem_name> | |----<oem based test files>
<oem_name> - This folder must be created with the name of the OEM/vendor in lower case.
Header files & source files having the oem functionality for the libpldm library should be placed under the respective folder hierarchy as mentioned in the above figure. They must be adhering to the rules mentioned under the libpldm section above.
Once the above is done a meson option has to be created in libpldm/meson_options.txt
with its mapped compiler flag to enable conditional compilation.
For consistency would recommend using "oem-<oem_name>".
The libpldm/meson.build
and the corresponding source file(s) will need to incorporate the logic of adding its mapped compiler flag to allow conditional compilation of the code.
The pldm requester API's are present in src/requester
folder and they are intended to provide API's to interact with the desired underlying transport layer to send/receive pldm messages.
NOTE : In the current state, the requester API's in the repository only works with specific transport mechanism & these are going to change in future & probably aren't appropriate to be writing code against.