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

refactor: more code-style improvements

This commit is contained in:
Steffen Vogel 2020-06-15 21:08:49 +02:00
parent cc456b6525
commit 74f55fa98c
6 changed files with 26 additions and 22 deletions

View file

@ -115,14 +115,14 @@ bool Gpu::registerIoMemory(const MemoryBlock &mem)
// overlapping window, so this will fail badly!
auto translation = mm.getTranslation(masterPciEAddrSpaceId,
mem.getAddrSpaceId());
if (translation.getSize() >= mem.getSize()) {
if (translation.getSize() >= mem.getSize())
// there is already a sufficient path
logger->debug("Already mapped through another mapping");
return true;
} else {
else
logger->warn("There's already a mapping, but too small");
}
} catch(const std::out_of_range&) {
}
catch(const std::out_of_range&) {
// not yet reachable, that's okay, proceed
}
@ -333,7 +333,8 @@ Gpu::makeAccessibleFromPCIeOrHostRam(const MemoryBlock &mem)
mem.getAddrSpaceId());
return registerIoMemory(mem);
} else {
}
else {
logger->debug("Memory block {} is assumed to be non-CUDA host memory",
mem.getAddrSpaceId());
@ -400,8 +401,8 @@ GpuAllocator::allocateBlock(size_t size)
logger->debug("Found existing chunk that can host the requested block");
return (*chunk)->allocateBlock(size);
} else {
}
else {
// allocate a new chunk
// rounded-up multiple of GPU page size

View file

@ -75,9 +75,15 @@ public:
bool reset() { return true; }
void dump() { }
ip::Core::Ptr lookupIp(const std::string &name) const;
ip::Core::Ptr lookupIp(const Vlnv &vlnv) const;
ip::Core::Ptr lookupIp(const ip::IpIdentifier &id) const;
ip::Core::Ptr
lookupIp(const std::string &name) const;
ip::Core::Ptr
lookupIp(const Vlnv &vlnv) const;
ip::Core::Ptr
lookupIp(const ip::IpIdentifier &id) const;
bool
mapMemoryBlock(const MemoryBlock &block);

View file

@ -125,8 +125,8 @@ public:
protected:
virtual bool
connectInternal(const std::string& slavePort,
const std::string& masterPort);
connectInternal(const std::string &slavePort,
const std::string &masterPort);
private:
std::pair<std::string, std::string> getLoopbackPorts() const;
@ -142,7 +142,7 @@ class NodeFactory : public CoreFactory {
public:
using CoreFactory::CoreFactory;
virtual bool configureJson(Core& ip, json_t *json_ip);
virtual bool configureJson(Core &ip, json_t *json_ip);
};
/** @} */

View file

@ -36,7 +36,7 @@
#include <villas/fpga/ips/intc.hpp>
#include <villas/fpga/ips/switch.hpp>
using namespace villas::fpga;
using namespace villas::fpga::ip;
// Special IPs that have to be initialized first. Will be initialized in the
@ -115,10 +115,9 @@ CoreFactory::make(PCIeCard* card, json_t *json_ips)
if (CoreFactory == nullptr) {
loggerStatic->warn("No plugin found to handle {}", id.getVlnv());
continue;
} else {
loggerStatic->debug("Using {} for IP {}",
CoreFactory->getName(), id.getVlnv());
}
else
loggerStatic->debug("Using {} for IP {}", CoreFactory->getName(), id.getVlnv());
auto logger = CoreFactory->getLogger();

View file

@ -73,9 +73,9 @@ Dma::init()
if (XAxiDma_Selftest(&xDma) != XST_SUCCESS) {
logger->error("DMA selftest failed");
return false;
} else {
logger->debug("DMA selftest passed");
}
else
logger->debug("DMA selftest passed");
/* Map buffer descriptors */
if (hasScatterGather()) {

View file

@ -157,12 +157,10 @@ AxiPciExpressBridgeFactory::configureJson(Core &ip, json_t* json_ip)
.size = static_cast<size_t>(size),
.translation = translation
};
} else {
} else
pcie.pcieToAxiTranslations[bar_name] = {
.translation = translation
};
}
}
}