1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-30 00:00:11 +01:00

fix PCIeCardFactory looking for IP config file at the wrong location

Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de>
This commit is contained in:
Niklas Eiling 2023-03-21 11:29:32 +01:00
parent d9e60e22b1
commit d273162f71
3 changed files with 12 additions and 10 deletions

View file

@ -4,7 +4,7 @@
"id": "10ee:7021",
"slot": "0000:88:00.0",
"do_reset": true,
"ips": "etc/vc707-xbar-pcie/vc707-xbar-pcie.json",
"ips": "vc707-xbar-pcie/vc707-xbar-pcie.json",
"polling": false
}
}

View file

@ -90,17 +90,19 @@ std::list<std::shared_ptr<PCIeCard>> PCIeCardFactory::make(json_t *json,
}
// Load IPs from a separate json file
if (json_is_string(json_ips) && !searchPath.empty()) {
std::filesystem::path json_ips_path = searchPath / json_string_value(json_ips);
json_ips = json_load_file(json_ips_path.c_str(), 0, nullptr);
if (json_ips == nullptr) {
logger->debug("FPGA IP cores config not found in {} looking elsewhere...", json_ips_path);
}
if (!json_is_string(json_ips)) {
logger->debug("FPGA IP cores config item is not a string.");
throw ConfigError(json_ips, "node-config-fpga-ips", "FPGA IP cores config item is not a string.");
}
if (json_is_string(json_ips) && json_ips == nullptr) {
if (!searchPath.empty()) {
std::filesystem::path json_ips_path = searchPath / json_string_value(json_ips);
logger->debug("searching for FPGA IP cors config at {}", json_ips_path);
json_ips = json_load_file(json_ips_path.c_str(), 0, nullptr);
}
if (json_ips == nullptr) {
json_ips = json_load_file(json_string_value(json_ips), 0, nullptr);
logger->debug("searching for FPGA IP cors config at {}", json_string_value(json_ips));
if (json_ips == nullptr) {
logger->debug("FPGA IP cores config not found in {}", json_string_value(json_ips));
throw ConfigError(json_ips, "node-config-fpga-ips", "Failed to find FPGA IP cores config");
}
}

View file

@ -199,7 +199,7 @@ fpga::setupFpgaCard(const std::string &configFile, const std::string &fpgaName)
}
// Create all FPGA card instances using the corresponding plugin
auto cards = fpgaCardFactory->make(fpgas, pciDevices, vfioContainer);
auto cards = fpgaCardFactory->make(fpgas, pciDevices, vfioContainer, configDir);
std::shared_ptr<fpga::PCIeCard> card;
for (auto &fpgaCard : cards) {