Commit 4ab00cdc authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

harmonize codestyle

parent c5cdee6a
Pipeline #293379 failed with stages
in 4 seconds
Subproject commit 1ddb51d71d13295a76b06a10593102659227f972 Subproject commit e58a611a755b759925b78c6ee2c73ae282cef444
...@@ -50,7 +50,7 @@ GpuAllocator::GpuAllocator(Gpu& gpu) : ...@@ -50,7 +50,7 @@ GpuAllocator::GpuAllocator(Gpu& gpu) :
{ {
free = [&](MemoryBlock* mem) { free = [&](MemoryBlock* mem) {
cudaSetDevice(gpu.gpuId); cudaSetDevice(gpu.gpuId);
if(cudaFree(reinterpret_cast<void*>(mem->getOffset())) != cudaSuccess) { if (cudaFree(reinterpret_cast<void*>(mem->getOffset())) != cudaSuccess) {
logger->warn("cudaFree() failed for {:#x} of size {:#x}", logger->warn("cudaFree() failed for {:#x} of size {:#x}",
mem->getOffset(), mem->getSize()); mem->getOffset(), mem->getSize());
} }
...@@ -92,7 +92,7 @@ public: ...@@ -92,7 +92,7 @@ public:
std::string Gpu::getName() const std::string Gpu::getName() const
{ {
cudaDeviceProp deviceProp; cudaDeviceProp deviceProp;
if(cudaGetDeviceProperties(&deviceProp, gpuId) != cudaSuccess) { if (cudaGetDeviceProperties(&deviceProp, gpuId) != cudaSuccess) {
// logger not yet availabe // logger not yet availabe
villas::logging.get("Gpu")->error("Cannot retrieve properties for GPU {}", gpuId); villas::logging.get("Gpu")->error("Cannot retrieve properties for GPU {}", gpuId);
throw std::exception(); throw std::exception();
...@@ -115,7 +115,7 @@ bool Gpu::registerIoMemory(const MemoryBlock& mem) ...@@ -115,7 +115,7 @@ bool Gpu::registerIoMemory(const MemoryBlock& mem)
// overlapping window, so this will fail badly! // overlapping window, so this will fail badly!
auto translation = mm.getTranslation(masterPciEAddrSpaceId, auto translation = mm.getTranslation(masterPciEAddrSpaceId,
mem.getAddrSpaceId()); mem.getAddrSpaceId());
if(translation.getSize() >= mem.getSize()) { if (translation.getSize() >= mem.getSize()) {
// there is already a sufficient path // there is already a sufficient path
logger->debug("Already mapped through another mapping"); logger->debug("Already mapped through another mapping");
return true; return true;
...@@ -159,7 +159,7 @@ bool Gpu::registerIoMemory(const MemoryBlock& mem) ...@@ -159,7 +159,7 @@ bool Gpu::registerIoMemory(const MemoryBlock& mem)
return false; return false;
} }
if(sizeOnPci < mem.getSize()) { if (sizeOnPci < mem.getSize()) {
logger->warn("VA mapping of IO memory is too small: {:#x} instead of {:#x} bytes", logger->warn("VA mapping of IO memory is too small: {:#x} instead of {:#x} bytes",
sizeOnPci, mem.getSize()); sizeOnPci, mem.getSize());
logger->warn("If something later on fails or behaves strangely, this might be the cause!"); logger->warn("If something later on fails or behaves strangely, this might be the cause!");
...@@ -169,13 +169,13 @@ bool Gpu::registerIoMemory(const MemoryBlock& mem) ...@@ -169,13 +169,13 @@ bool Gpu::registerIoMemory(const MemoryBlock& mem)
cudaSetDevice(gpuId); cudaSetDevice(gpuId);
auto baseAddrVA = reinterpret_cast<void*>(baseAddrForProcess); auto baseAddrVA = reinterpret_cast<void*>(baseAddrForProcess);
if(cudaHostRegister(baseAddrVA, sizeOnPci, cudaHostRegisterIoMemory) != cudaSuccess) { if (cudaHostRegister(baseAddrVA, sizeOnPci, cudaHostRegisterIoMemory) != cudaSuccess) {
logger->error("Cannot register IO memory for block {}", mem.getAddrSpaceId()); logger->error("Cannot register IO memory for block {}", mem.getAddrSpaceId());
return false; return false;
} }
void* devicePointer = nullptr; void* devicePointer = nullptr;
if(cudaHostGetDevicePointer(&devicePointer, baseAddrVA, 0) != cudaSuccess) { if (cudaHostGetDevicePointer(&devicePointer, baseAddrVA, 0) != cudaSuccess) {
logger->error("Cannot retrieve device pointer for IO memory"); logger->error("Cannot retrieve device pointer for IO memory");
return false; return false;
} }
...@@ -195,7 +195,7 @@ Gpu::registerHostMemory(const MemoryBlock& mem) ...@@ -195,7 +195,7 @@ Gpu::registerHostMemory(const MemoryBlock& mem)
auto localBase = reinterpret_cast<void*>(translation.getLocalAddr(0)); auto localBase = reinterpret_cast<void*>(translation.getLocalAddr(0));
int ret = cudaHostRegister(localBase, mem.getSize(), 0); int ret = cudaHostRegister(localBase, mem.getSize(), 0);
if(ret != cudaSuccess) { if (ret != cudaSuccess) {
logger->error("Cannot register memory block {} addr={:p} size={:#x} to CUDA: ret={}", logger->error("Cannot register memory block {} addr={:p} size={:#x} to CUDA: ret={}",
mem.getAddrSpaceId(), localBase, mem.getSize(), ret); mem.getAddrSpaceId(), localBase, mem.getSize(), ret);
return false; return false;
...@@ -203,7 +203,7 @@ Gpu::registerHostMemory(const MemoryBlock& mem) ...@@ -203,7 +203,7 @@ Gpu::registerHostMemory(const MemoryBlock& mem)
void* devicePointer = nullptr; void* devicePointer = nullptr;
ret = cudaHostGetDevicePointer(&devicePointer, localBase, 0); ret = cudaHostGetDevicePointer(&devicePointer, localBase, 0);
if(ret != cudaSuccess) { if (ret != cudaSuccess) {
logger->error("Cannot retrieve device pointer for IO memory: ret={}", ret); logger->error("Cannot retrieve device pointer for IO memory: ret={}", ret);
return false; return false;
} }
...@@ -216,7 +216,7 @@ Gpu::registerHostMemory(const MemoryBlock& mem) ...@@ -216,7 +216,7 @@ Gpu::registerHostMemory(const MemoryBlock& mem)
bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem) bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem)
{ {
if(pImpl->gdr == nullptr) { if (pImpl->gdr == nullptr) {
logger->warn("GDRcopy not available"); logger->warn("GDRcopy not available");
return false; return false;
} }
...@@ -226,7 +226,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem) ...@@ -226,7 +226,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem)
try { try {
auto path = mm.findPath(masterPciEAddrSpaceId, mem.getAddrSpaceId()); auto path = mm.findPath(masterPciEAddrSpaceId, mem.getAddrSpaceId());
// if first hop is the PCIe bus, we know that memory is off-GPU // if first hop is the PCIe bus, we know that memory is off-GPU
if(path.front() == mm.getPciAddressSpace()) { if (path.front() == mm.getPciAddressSpace()) {
throw std::out_of_range("Memory block is outside of this GPU"); throw std::out_of_range("Memory block is outside of this GPU");
} }
...@@ -246,7 +246,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem) ...@@ -246,7 +246,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem)
// required to set this flag before mapping // required to set this flag before mapping
unsigned int enable = 1; unsigned int enable = 1;
ret = cuPointerSetAttribute(&enable, CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, devptr); ret = cuPointerSetAttribute(&enable, CU_POINTER_ATTRIBUTE_SYNC_MEMOPS, devptr);
if(ret != CUDA_SUCCESS) { if (ret != CUDA_SUCCESS) {
logger->error("Cannot set pointer attributes on memory block {}: {}", logger->error("Cannot set pointer attributes on memory block {}: {}",
mem.getAddrSpaceId(), ret); mem.getAddrSpaceId(), ret);
return false; return false;
...@@ -254,7 +254,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem) ...@@ -254,7 +254,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem)
gdr_mh_t mh; gdr_mh_t mh;
ret = gdr_pin_buffer(pImpl->gdr, devptr, mem.getSize(), 0, 0, &mh); ret = gdr_pin_buffer(pImpl->gdr, devptr, mem.getSize(), 0, 0, &mh);
if(ret != 0) { if (ret != 0) {
logger->error("Cannot pin memory block {} via gdrcopy: {}", logger->error("Cannot pin memory block {} via gdrcopy: {}",
mem.getAddrSpaceId(), ret); mem.getAddrSpaceId(), ret);
return false; return false;
...@@ -262,7 +262,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem) ...@@ -262,7 +262,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem)
void* bar = nullptr; void* bar = nullptr;
ret = gdr_map(pImpl->gdr, mh, &bar, mem.getSize()); ret = gdr_map(pImpl->gdr, mh, &bar, mem.getSize());
if(ret != 0) { if (ret != 0) {
logger->error("Cannot map memory block {} via gdrcopy: {}", logger->error("Cannot map memory block {} via gdrcopy: {}",
mem.getAddrSpaceId(), ret); mem.getAddrSpaceId(), ret);
return false; return false;
...@@ -270,7 +270,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem) ...@@ -270,7 +270,7 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem)
gdr_info_t info; gdr_info_t info;
ret = gdr_get_info(pImpl->gdr, mh, &info); ret = gdr_get_info(pImpl->gdr, mh, &info);
if(ret != 0) { if (ret != 0) {
logger->error("Cannot get info for mapping of memory block {}: {}", logger->error("Cannot get info for mapping of memory block {}: {}",
mem.getAddrSpaceId(), ret); mem.getAddrSpaceId(), ret);
return false; return false;
...@@ -294,11 +294,11 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem) ...@@ -294,11 +294,11 @@ bool Gpu::makeAccessibleToPCIeAndVA(const MemoryBlock& mem)
uint64_t addr[8]; uint64_t addr[8];
ret = gdr_map_dma(pImpl->gdr, mh, 3, 0, 0, addr, 8); ret = gdr_map_dma(pImpl->gdr, mh, 3, 0, 0, addr, 8);
for(int i = 0; i < ret; i++) { for (int i = 0; i < ret; i++) {
logger->debug("DMA addr[{}]: {:#x}", i, addr[i]); logger->debug("DMA addr[{}]: {:#x}", i, addr[i]);
} }
if(ret != 1) { if (ret != 1) {
logger->error("Only one DMA address per block supported at the moment"); logger->error("Only one DMA address per block supported at the moment");
return false; return false;
} }
...@@ -328,7 +328,7 @@ Gpu::makeAccessibleFromPCIeOrHostRam(const MemoryBlock& mem) ...@@ -328,7 +328,7 @@ Gpu::makeAccessibleFromPCIeOrHostRam(const MemoryBlock& mem)
// not reachable via PCI -> not IO memory // not reachable via PCI -> not IO memory
} }
if(isIoMemory) { if (isIoMemory) {
logger->debug("Memory block {} is assumed to be IO memory", logger->debug("Memory block {} is assumed to be IO memory",
mem.getAddrSpaceId()); mem.getAddrSpaceId());
...@@ -396,7 +396,7 @@ GpuAllocator::allocateBlock(size_t size) ...@@ -396,7 +396,7 @@ GpuAllocator::allocateBlock(size_t size)
}); });
if(chunk != chunks.end()) { if (chunk != chunks.end()) {
logger->debug("Found existing chunk that can host the requested block"); logger->debug("Found existing chunk that can host the requested block");
return (*chunk)->allocateBlock(size); return (*chunk)->allocateBlock(size);
...@@ -408,7 +408,7 @@ GpuAllocator::allocateBlock(size_t size) ...@@ -408,7 +408,7 @@ GpuAllocator::allocateBlock(size_t size)
const size_t chunkSize = size - (size & (GpuPageSize - 1)) + GpuPageSize; const size_t chunkSize = size - (size & (GpuPageSize - 1)) + GpuPageSize;
logger->debug("Allocate new chunk of {:#x} bytes", chunkSize); logger->debug("Allocate new chunk of {:#x} bytes", chunkSize);
if(cudaSuccess != cudaMalloc(&addr, chunkSize)) { if (cudaSuccess != cudaMalloc(&addr, chunkSize)) {
logger->error("cudaMalloc(..., size={}) failed", chunkSize); logger->error("cudaMalloc(..., size={}) failed", chunkSize);
throw std::bad_alloc(); throw std::bad_alloc();
} }
...@@ -445,7 +445,7 @@ Gpu::Gpu(int gpuId) : ...@@ -445,7 +445,7 @@ Gpu::Gpu(int gpuId) :
logger = villas::logging.get(getName()); logger = villas::logging.get(getName());
pImpl->gdr = gdr_open(); pImpl->gdr = gdr_open();
if(pImpl->gdr == nullptr) { if (pImpl->gdr == nullptr) {
logger->warn("No GDRcopy support enabled, cannot open /dev/gdrdrv"); logger->warn("No GDRcopy support enabled, cannot open /dev/gdrdrv");
} }
} }
...@@ -470,7 +470,7 @@ bool Gpu::init() ...@@ -470,7 +470,7 @@ bool Gpu::init()
struct pci_region* pci_regions = nullptr; struct pci_region* pci_regions = nullptr;
const size_t pci_num_regions = pci_get_regions(&pImpl->pdev, &pci_regions); const size_t pci_num_regions = pci_get_regions(&pImpl->pdev, &pci_regions);
for(size_t i = 0; i < pci_num_regions; i++) { for (size_t i = 0; i < pci_num_regions; i++) {
const size_t region_size = pci_regions[i].end - pci_regions[i].start + 1; const size_t region_size = pci_regions[i].end - pci_regions[i].start + 1;
logger->info("BAR{}: bus addr={:#x} size={:#x}", logger->info("BAR{}: bus addr={:#x} size={:#x}",
pci_regions[i].num, pci_regions[i].start, region_size); pci_regions[i].num, pci_regions[i].start, region_size);
...@@ -500,15 +500,15 @@ GpuFactory::make() ...@@ -500,15 +500,15 @@ GpuFactory::make()
std::list<std::unique_ptr<Gpu>> gpuList; std::list<std::unique_ptr<Gpu>> gpuList;
for(int gpuId = 0; gpuId < deviceCount; gpuId++) { for (int gpuId = 0; gpuId < deviceCount; gpuId++) {
if(cudaSetDevice(gpuId) != cudaSuccess) { if (cudaSetDevice(gpuId) != cudaSuccess) {
logger->warn("Cannot activate GPU {}", gpuId); logger->warn("Cannot activate GPU {}", gpuId);
continue; continue;
} }
auto gpu = std::make_unique<Gpu>(gpuId); auto gpu = std::make_unique<Gpu>(gpuId);
if(not gpu->init()) { if (not gpu->init()) {
logger->warn("Cannot initialize GPU {}", gpuId); logger->warn("Cannot initialize GPU {}", gpuId);
continue; continue;
} }
...@@ -517,7 +517,7 @@ GpuFactory::make() ...@@ -517,7 +517,7 @@ GpuFactory::make()
} }
logger->info("Initialized {} GPUs", gpuList.size()); logger->info("Initialized {} GPUs", gpuList.size());
for(auto& gpu : gpuList) { for (auto& gpu : gpuList) {
logger->debug(" - {}", gpu->getName()); logger->debug(" - {}", gpu->getName());
} }
......
...@@ -42,7 +42,7 @@ kernel_mailbox(volatile uint32_t *mailbox, volatile uint32_t* counter) ...@@ -42,7 +42,7 @@ kernel_mailbox(volatile uint32_t *mailbox, volatile uint32_t* counter)
printf("[kernel] started\n"); printf("[kernel] started\n");
while(1) { while (1) {
if (*mailbox == 1) { if (*mailbox == 1) {
*mailbox = 0; *mailbox = 0;
printf("[gpu] counter = %d\n", *counter); printf("[gpu] counter = %d\n", *counter);
...@@ -56,7 +56,7 @@ kernel_mailbox(volatile uint32_t *mailbox, volatile uint32_t* counter) ...@@ -56,7 +56,7 @@ kernel_mailbox(volatile uint32_t *mailbox, volatile uint32_t* counter)
__global__ void __global__ void
kernel_memcpy(volatile uint8_t* dst, volatile uint8_t* src, size_t length) kernel_memcpy(volatile uint8_t* dst, volatile uint8_t* src, size_t length)
{ {
while(length > 0) { while (length > 0) {
*dst++ = *src++; *dst++ = *src++;
length--; length--;
} }
......
...@@ -70,9 +70,9 @@ public: ...@@ -70,9 +70,9 @@ public:
const std::string& port, const std::string& port,
bool isMaster) bool isMaster)
{ {
for(auto& vertexEntry : vertices) { for (auto& vertexEntry : vertices) {
auto& vertex = vertexEntry.second; auto& vertex = vertexEntry.second;
if(vertex->nodeName == node and vertex->portName == port and vertex->isMaster == isMaster) if (vertex->nodeName == node and vertex->portName == port and vertex->isMaster == isMaster)
return vertex; return vertex;
} }
......
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
private: private:
void updateRunningStatus() void updateRunningStatus()
{ {
if(running and isIdleBit()) if (running and isIdleBit())
running = false; running = false;
} }
......
...@@ -62,7 +62,7 @@ PCIeCardFactory::make(json_t *json, struct pci* pci, std::shared_ptr<VfioContain ...@@ -62,7 +62,7 @@ PCIeCardFactory::make(json_t *json, struct pci* pci, std::shared_ptr<VfioContain
"slot", &pci_slot, "slot", &pci_slot,
"id", &pci_id); "id", &pci_id);
if(ret != 0) { if (ret != 0) {
logger->warn("Cannot parse JSON config"); logger->warn("Cannot parse JSON config");
continue; continue;
} }
...@@ -87,18 +87,18 @@ PCIeCardFactory::make(json_t *json, struct pci* pci, std::shared_ptr<VfioContain ...@@ -87,18 +87,18 @@ PCIeCardFactory::make(json_t *json, struct pci* pci, std::shared_ptr<VfioContain
} }
if(not card->init()) { if (not card->init()) {
logger->warn("Cannot start FPGA card {}", card_name); logger->warn("Cannot start FPGA card {}", card_name);
continue; continue;
} }
card->ips = ip::IpCoreFactory::make(card.get(), json_ips); card->ips = ip::IpCoreFactory::make(card.get(), json_ips);
if(card->ips.empty()) { if (card->ips.empty()) {
logger->error("Cannot initialize IPs of FPGA card {}", card_name); logger->error("Cannot initialize IPs of FPGA card {}", card_name);
continue; continue;
} }
if(not card->check()) { if (not card->check()) {
logger->warn("Checking of FPGA card {} failed", card_name); logger->warn("Checking of FPGA card {} failed", card_name);
continue; continue;
} }
...@@ -122,7 +122,7 @@ PCIeCard::~PCIeCard() ...@@ -122,7 +122,7 @@ PCIeCard::~PCIeCard()
auto& mm = MemoryManager::get(); auto& mm = MemoryManager::get();
// unmap all memory blocks // unmap all memory blocks
for(auto& mappedMemoryBlock : memoryBlocksMapped) { for (auto& mappedMemoryBlock : memoryBlocksMapped) {
auto translation = mm.getTranslation(addrSpaceIdDeviceToHost, auto translation = mm.getTranslation(addrSpaceIdDeviceToHost,
mappedMemoryBlock); mappedMemoryBlock);
...@@ -139,8 +139,8 @@ PCIeCard::~PCIeCard() ...@@ -139,8 +139,8 @@ PCIeCard::~PCIeCard()
ip::IpCore* ip::IpCore*
PCIeCard::lookupIp(const std::string& name) const PCIeCard::lookupIp(const std::string& name) const
{ {
for(auto& ip : ips) { for (auto& ip : ips) {
if(*ip == name) { if (*ip == name) {
return ip.get(); return ip.get();
} }
} }
...@@ -152,8 +152,8 @@ PCIeCard::lookupIp(const std::string& name) const ...@@ -152,8 +152,8 @@ PCIeCard::lookupIp(const std::string& name) const
ip::IpCore* ip::IpCore*
PCIeCard::lookupIp(const Vlnv& vlnv) const PCIeCard::lookupIp(const Vlnv& vlnv) const
{ {
for(auto& ip : ips) { for (auto& ip : ips) {
if(*ip == vlnv) { if (*ip == vlnv) {
return ip.get(); return ip.get();
} }
} }
...@@ -163,8 +163,8 @@ PCIeCard::lookupIp(const Vlnv& vlnv) const ...@@ -163,8 +163,8 @@ PCIeCard::lookupIp(const Vlnv& vlnv) const
ip::IpCore*PCIeCard::lookupIp(const ip::IpIdentifier& id) const ip::IpCore*PCIeCard::lookupIp(const ip::IpIdentifier& id) const
{ {
for(auto& ip : ips) { for (auto& ip : ips) {
if(*ip == id) { if (*ip == id) {
return ip.get(); return ip.get();
} }
} }
...@@ -176,7 +176,7 @@ ip::IpCore*PCIeCard::lookupIp(const ip::IpIdentifier& id) const ...@@ -176,7 +176,7 @@ ip::IpCore*PCIeCard::lookupIp(const ip::IpIdentifier& id) const
bool bool
PCIeCard::mapMemoryBlock(const MemoryBlock& block) PCIeCard::mapMemoryBlock(const MemoryBlock& block)
{ {
if(not vfioContainer->isIommuEnabled()) { if (not vfioContainer->isIommuEnabled()) {
logger->warn("VFIO mapping not supported without IOMMU"); logger->warn("VFIO mapping not supported without IOMMU");
return false; return false;
} }
...@@ -184,7 +184,7 @@ PCIeCard::mapMemoryBlock(const MemoryBlock& block) ...@@ -184,7 +184,7 @@ PCIeCard::mapMemoryBlock(const MemoryBlock& block)
auto& mm = MemoryManager::get(); auto& mm = MemoryManager::get();
const auto& addrSpaceId = block.getAddrSpaceId(); const auto& addrSpaceId = block.getAddrSpaceId();
if(memoryBlocksMapped.find(addrSpaceId) != memoryBlocksMapped.end()) { if (memoryBlocksMapped.find(addrSpaceId) != memoryBlocksMapped.end()) {
// block already mapped // block already mapped
return true; return true;
} else { } else {
...@@ -197,7 +197,7 @@ PCIeCard::mapMemoryBlock(const MemoryBlock& block) ...@@ -197,7 +197,7 @@ PCIeCard::mapMemoryBlock(const MemoryBlock& block)
UINTPTR_MAX, UINTPTR_MAX,
block.getSize()); block.getSize());
if(iovaAddr == UINTPTR_MAX) { if (iovaAddr == UINTPTR_MAX) {
logger->error("Cannot map memory at {:#x} of size {:#x}", logger->error("Cannot map memory at {:#x} of size {:#x}",
processBaseAddr, block.getSize()); processBaseAddr, block.getSize());
return false; return false;
...@@ -242,12 +242,12 @@ PCIeCard::init() ...@@ -242,12 +242,12 @@ PCIeCard::init()
/* Reset system? */ /* Reset system? */
if (do_reset) { if (do_reset) {
/* Reset / detect PCI device */ /* Reset / detect PCI device */
if(not vfioDevice->pciHotReset()) { if (not vfioDevice->pciHotReset()) {
logger->error("Failed to reset PCI device"); logger->error("Failed to reset PCI device");
return false; return false;
} }
if(not reset()) { if (not reset()) {
logger->error("Failed to reset FGPA card"); logger->error("Failed to reset FGPA card");
return false; return false;
} }
......
...@@ -70,7 +70,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) ...@@ -70,7 +70,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips)
json_t* json_ip; json_t* json_ip;
json_object_foreach(json_ips, ipName, json_ip) { json_object_foreach(json_ips, ipName, json_ip) {
const char* vlnv; const char* vlnv;
if(json_unpack(json_ip, "{ s: s }", "vlnv", &vlnv) != 0) { if (json_unpack(json_ip, "{ s: s }", "vlnv", &vlnv) != 0) {
loggerStatic->warn("IP {} has no VLNV", ipName); loggerStatic->warn("IP {} has no VLNV", ipName);
continue; continue;
} }
...@@ -85,10 +85,10 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) ...@@ -85,10 +85,10 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips)
// first to be initialized. // first to be initialized.
vlnvInitializationOrder.reverse(); vlnvInitializationOrder.reverse();
for(auto& vlnvInitFirst : vlnvInitializationOrder) { for (auto& vlnvInitFirst : vlnvInitializationOrder) {
// iterate over IPs, if VLNV matches, push to front and remove from list // iterate over IPs, if VLNV matches, push to front and remove from list
for(auto it = allIps.begin(); it != allIps.end(); ++it) { for (auto it = allIps.begin(); it != allIps.end(); ++it) {
if(vlnvInitFirst == it->getVlnv()) { if (vlnvInitFirst == it->getVlnv()) {
orderedIps.push_front(*it); orderedIps.push_front(*it);
it = allIps.erase(it); it = allIps.erase(it);
} }
...@@ -99,12 +99,12 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) ...@@ -99,12 +99,12 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips)
orderedIps.splice(orderedIps.end(), allIps); orderedIps.splice(orderedIps.end(), allIps);
loggerStatic->debug("IP initialization order:"); loggerStatic->debug("IP initialization order:");
for(auto& id : orderedIps) { for (auto& id : orderedIps) {
loggerStatic->debug(" " CLR_BLD("{}"), id.getName()); loggerStatic->debug(" " CLR_BLD("{}"), id.getName());
} }
// configure all IPs // configure all IPs
for(auto& id : orderedIps) { for (auto& id : orderedIps) {
loggerStatic->info("Configuring {}", id); loggerStatic->info("Configuring {}", id);
// find the appropriate factory that can create the specified VLNV // find the appropriate factory that can create the specified VLNV
...@@ -114,7 +114,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) ...@@ -114,7 +114,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips)
// candidates, the first suitable factory will be used. // candidates, the first suitable factory will be used.
IpCoreFactory* ipCoreFactory = lookup(id.getVlnv()); IpCoreFactory* ipCoreFactory = lookup(id.getVlnv());
if(ipCoreFactory == nullptr) { if (ipCoreFactory == nullptr) {
loggerStatic->warn("No plugin found to handle {}", id.getVlnv()); loggerStatic->warn("No plugin found to handle {}", id.getVlnv());
continue; continue;
} else { } else {
...@@ -132,7 +132,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips) ...@@ -132,7 +132,7 @@ IpCoreFactory::make(PCIeCard* card, json_t *json_ips)