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

core: move configuration of polling mode to parse()

Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
Steffen Vogel 2022-11-11 06:46:24 -05:00 committed by Niklas Eiling
parent 09af6d9e88
commit 3b8949afe9
7 changed files with 10 additions and 27 deletions

View file

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

View file

@ -104,7 +104,6 @@ public: // TODO: make this private
bool doReset; // Reset VILLASfpga during startup?
int affinity; // Affinity for MSI interrupts
bool polling; // Poll on interrupts?
std::string name; // The name of the FPGA card

View file

@ -293,11 +293,6 @@ public:
}
protected:
enum PollingMode {
POLL,
IRQ,
};
Logger getLogger() const
{
return villas::logging.get(getName());
@ -312,10 +307,6 @@ private:
// Create a concrete IP instance
virtual Core* create() = 0;
virtual
void configurePollingMode(Core &, PollingMode)
{ }
virtual
Vlnv getCompatibleVlnv() const = 0;

View file

@ -176,12 +176,6 @@ public:
virtual
void parse(Core& ip, json_t* json) override;
virtual void
configurePollingMode(Core& ip, PollingMode mode) override
{
dynamic_cast<Dma&>(ip).polling = (mode == POLL);
}
};
} /* namespace ip */

View file

@ -57,16 +57,14 @@ PCIeCardFactory::make(json_t *json, std::shared_ptr<kernel::pci::DeviceList> pci
const char* pci_id = nullptr;
int do_reset = 0;
int affinity = 0;
int polling = 0;
json_error_t err;
int ret = json_unpack_ex(json_card, &err, 0, "{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b }",
int ret = json_unpack_ex(json_card, &err, 0, "{ s: o, s?: i, s?: b, s?: s, s?: s }",
"ips", &json_ips,
"affinity", &affinity,
"do_reset", &do_reset,
"slot", &pci_slot,
"id", &pci_id,
"polling", &polling);
"id", &pci_id);
if (ret != 0)
throw ConfigError(json_card, err, "", "Failed to parse card");
@ -78,7 +76,6 @@ PCIeCardFactory::make(json_t *json, std::shared_ptr<kernel::pci::DeviceList> pci
card->vfioContainer = vc;
card->affinity = affinity;
card->doReset = do_reset != 0;
card->polling = (polling != 0);
kernel::pci::Device filter = defaultFilter;

View file

@ -247,9 +247,6 @@ CoreFactory::make(PCIeCard* card, json_t *json_ips)
// IP-specific setup via JSON config
CoreFactory->parse(*ip, json_ip);
// Set polling mode
CoreFactory->configurePollingMode(*ip, (card->polling ? PollingMode::POLL : PollingMode::IRQ));
// IP has been configured now
configuredIps.push_back(std::move(ip));
}

View file

@ -641,8 +641,12 @@ void DmaFactory::parse(Core &ip, json_t *cfg)
dma.xConfig.AddrWidth = 32;
dma.xConfig.SgLengthWidth = 14;
int polling;
json_error_t err;
int ret = json_unpack_ex(cfg, &err, 0, "{ s: { s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i } }",
int ret = json_unpack_ex(cfg, &err, 0, "{ s: b, s: { s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i, s?: i } }",
"polling", &polling,
"parameters",
"c_sg_include_stscntrl_strm", &dma.xConfig.HasStsCntrlStrm,
"c_include_mm2s", &dma.xConfig.HasMm2S,
@ -660,4 +664,6 @@ void DmaFactory::parse(Core &ip, json_t *cfg)
);
if (ret != 0)
throw ConfigError(cfg, err, "", "Failed to parse DMA configuration");
dma.polling = polling != 0;
}