mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
add ignored ips
This commit is contained in:
parent
48fbfbe088
commit
bca8ec0c86
6 changed files with 53 additions and 4 deletions
|
@ -10,6 +10,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <villas/fpga/core.hpp>
|
||||
#include <villas/kernel/vfio_container.hpp>
|
||||
|
||||
|
@ -25,6 +27,8 @@ public:
|
|||
std::shared_ptr<kernel::vfio::Container> vfioContainer;
|
||||
std::shared_ptr<kernel::vfio::Device> vfioDevice;
|
||||
|
||||
std::list<std::string> ignored_ip_names;
|
||||
|
||||
// Slave address space ID to access the PCIe address space from the
|
||||
// FPGA
|
||||
MemoryManager::AddressSpaceId addrSpaceIdDeviceToHost;
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include <jansson.h>
|
||||
#include <spdlog/logger.h>
|
||||
#include <villas/exceptions.hpp>
|
||||
|
@ -16,13 +19,25 @@ public:
|
|||
int do_reset = 0;
|
||||
int affinity = 0;
|
||||
int polling = 0;
|
||||
std::list<std::string> ignored_ip_names;
|
||||
|
||||
CardParser(json_t *json_card) : logger(villas::Log::get("CardParser")) {
|
||||
json_error_t err;
|
||||
json_t *ignored_ips_array = nullptr;
|
||||
|
||||
int ret = json_unpack_ex(
|
||||
json_card, &err, 0, "{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b, s?: o}",
|
||||
"ips", &json_ips, "affinity", &affinity, "do_reset", &do_reset, "slot",
|
||||
&pci_slot, "id", &pci_id, "polling", &polling, "paths", &json_paths);
|
||||
json_card, &err, 0,
|
||||
"{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b, s?: o, s?: o}", "ips",
|
||||
&json_ips, "affinity", &affinity, "do_reset", &do_reset, "slot",
|
||||
&pci_slot, "id", &pci_id, "polling", &polling, "paths", &json_paths,
|
||||
"ignore_ips", &ignored_ips_array);
|
||||
|
||||
// Parse ignored ip names to list
|
||||
size_t index;
|
||||
json_t *value;
|
||||
json_array_foreach(ignored_ips_array, index, value) {
|
||||
ignored_ip_names.push_back(json_string_value(value));
|
||||
}
|
||||
|
||||
if (ret != 0)
|
||||
throw villas::ConfigError(json_card, err, "", "Failed to parse card");
|
||||
|
|
|
@ -213,6 +213,9 @@ public:
|
|||
using plugin::Plugin::Plugin;
|
||||
|
||||
static std::list<IpIdentifier> parseIpIdentifier(json_t *json_ips);
|
||||
static std::list<IpIdentifier>
|
||||
filterIps(std::list<IpIdentifier> allIps,
|
||||
std::list<std::string> ignored_ip_names);
|
||||
static std::list<IpIdentifier> reorderIps(std::list<IpIdentifier> allIps);
|
||||
static std::list<std::shared_ptr<Core>>
|
||||
configureIps(std::list<IpIdentifier> orderedIps, json_t *json_ips,
|
||||
|
|
|
@ -57,6 +57,28 @@ std::list<IpIdentifier> CoreFactory::parseIpIdentifier(json_t *json_ips) {
|
|||
return allIps;
|
||||
}
|
||||
|
||||
std::list<IpIdentifier>
|
||||
CoreFactory::filterIps(std::list<IpIdentifier> allIps,
|
||||
std::list<std::string> ignored_ip_names) {
|
||||
std::list<IpIdentifier> filteredIps;
|
||||
|
||||
for (auto ip : allIps) {
|
||||
bool on_blocklist = false;
|
||||
for (auto ignored_ip_name : ignored_ip_names) {
|
||||
if (ip.getName() == ignored_ip_name) {
|
||||
on_blocklist = true;
|
||||
CoreFactory::getStaticLogger()->warn("Ignoring Ip {} (explicitly on ignorelist)", ignored_ip_name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!on_blocklist)
|
||||
filteredIps.push_back(ip);
|
||||
}
|
||||
|
||||
return filteredIps;
|
||||
}
|
||||
|
||||
std::list<IpIdentifier>
|
||||
CoreFactory::reorderIps(std::list<IpIdentifier> allIps) {
|
||||
// Pick out IPs to be initialized first.
|
||||
|
@ -315,8 +337,11 @@ std::list<std::shared_ptr<Core>> CoreFactory::make(Card *card,
|
|||
std::list<IpIdentifier> allIps =
|
||||
parseIpIdentifier(json_ips); // All IPs available in config
|
||||
|
||||
std::list<IpIdentifier> filteredIps = filterIps(
|
||||
allIps, card->ignored_ip_names); // Remove ips on ignorelist in .conf
|
||||
|
||||
std::list<IpIdentifier> orderedIps =
|
||||
reorderIps(allIps); // IPs ordered in initialization order
|
||||
reorderIps(filteredIps); // IPs ordered in initialization order
|
||||
|
||||
std::list<std::shared_ptr<Core>> configuredIps =
|
||||
configureIps(orderedIps, json_ips, card); // Successfully configured IPs
|
||||
|
|
|
@ -198,6 +198,7 @@ PlatformCardFactory::make(json_t *json_card, std::string card_name,
|
|||
card->affinity = parser.affinity;
|
||||
card->doReset = parser.do_reset != 0;
|
||||
card->polling = (parser.polling != 0);
|
||||
card->ignored_ip_names = parser.ignored_ip_names;
|
||||
|
||||
json_t *json_ips = parser.json_ips;
|
||||
json_t *json_paths = parser.json_paths;
|
||||
|
|
|
@ -6,6 +6,7 @@ fpgas = {
|
|||
zcu106 = {
|
||||
interface = "platform",
|
||||
ips = "/root/codebase/node/etc/fpga/zcu106_aurora_dino/zcu106_aurora_dino_240808-2.json", # Absolute path for remote debugging
|
||||
ignore_ips = ["dino_dinoif_dac_0", "dino_dinoif_fast_nologic_0", "dino_registerif_0", "axi_iic_0"],
|
||||
polling = true,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue