Enable file transfer handlers in pldmd This patch adds the following changes; - Configure PDR at pldmd initialization rather than waiting for a GetPdr request. - Instantiate a fileTransferHandler - Disable reacting to mctpd so that pldmd will not initiate PLDM discovery requests with the external mctp devices. Tested: Tested on BMC and verified file transfer works Google-Bug-Id: 423027264 Change-Id: I2676517f14c348d3d3c93818d1ab092af7587580 Signed-off-by: Kasun Athukorala <kasunath@google.com>
diff --git a/meson.build b/meson.build index 61c0c4f..168f212 100644 --- a/meson.build +++ b/meson.build
@@ -46,6 +46,9 @@ if get_option('generate-terminus-locator-pdr').allowed() add_project_arguments('-DGENERATE_TERMINUS_LOCATOR_PDR', language: 'cpp') endif +if get_option('mctp-reactor').allowed() + add_project_arguments('-DMCTP_REACTOR', language: 'cpp') +endif if get_option('libpldmresponder').allowed() conf_data.set_quoted('BIOS_JSONS_DIR', join_paths(package_datadir, 'bios')) conf_data.set(
diff --git a/meson.options b/meson.options index e689ba7..ef94b2e 100644 --- a/meson.options +++ b/meson.options
@@ -230,3 +230,10 @@ value: 'enabled', description: 'Enable generating terminus locator pdr', ) + +option( + 'mctp-reactor', + type: 'feature', + value: 'enabled', + description: 'Enable reacting to mctpd events', +)
diff --git a/pldmd/pldmd.cpp b/pldmd/pldmd.cpp index 9387ffe..a32a84c 100644 --- a/pldmd/pldmd.cpp +++ b/pldmd/pldmd.cpp
@@ -52,6 +52,7 @@ #include "host-bmc/host_pdr_handler.hpp" #include "libpldmresponder/base.hpp" #include "libpldmresponder/bios.hpp" +#include "libpldmresponder/file_transfer.hpp" #include "libpldmresponder/fru.hpp" #include "libpldmresponder/oem_handler.hpp" #include "libpldmresponder/platform.hpp" @@ -304,7 +305,7 @@ auto platformHandler = std::make_unique<platform::Handler>( &dbusHandler, hostEID, &instanceIdDb, PDR_JSONS_DIR, pdrRepo.get(), hostPDRHandler.get(), dbusToPLDMEventHandler.get(), fruHandler.get(), - platformConfigHandler.get(), &reqHandler, event, true, + platformConfigHandler.get(), &reqHandler, event, false, addOnEventHandlers); auto biosHandler = std::make_unique<bios::Handler>( @@ -329,10 +330,17 @@ &reqHandler); #endif + auto fileTransferHandler = std::make_unique<file_transfer::Handler>( + baseHandler.get(), platformHandler.get()); + + baseHandler->registerMultipartReceiveHandler(PLDM_FILE, + fileTransferHandler.get()); + invoker.registerHandler(PLDM_BIOS, std::move(biosHandler)); invoker.registerHandler(PLDM_PLATFORM, std::move(platformHandler)); invoker.registerHandler(PLDM_FRU, std::move(fruHandler)); invoker.registerHandler(PLDM_BASE, std::move(baseHandler)); + invoker.registerHandler(PLDM_FILE, std::move(fileTransferHandler)); dbus_api::Pdr dbusImplPdr(bus, "/xyz/openbmc_project/pldm", pdrRepo.get()); sdbusplus::xyz::openbmc_project::PLDM::server::Event dbusImplEvent( @@ -342,10 +350,12 @@ std::unique_ptr<fw_update::Manager> fwManager = std::make_unique<fw_update::Manager>(event, reqHandler, instanceIdDb); +#ifdef MCTP_REACTOR std::unique_ptr<MctpDiscovery> mctpDiscoveryHandler = std::make_unique<MctpDiscovery>( bus, std::initializer_list<MctpDiscoveryHandlerIntf*>{ fwManager.get(), platformManager.get()}); +#endif auto callback = [verbose, &invoker, &reqHandler, &fwManager, &pldmTransport, TID](IO& io, int fd, uint32_t revents) mutable { if (revents & (POLLHUP | POLLERR))