diff --git a/jungfrau/ProcessJFPacket.cpp b/jungfrau/ProcessJFPacket.cpp index 2aed3977..263e7630 100644 --- a/jungfrau/ProcessJFPacket.cpp +++ b/jungfrau/ProcessJFPacket.cpp @@ -7,7 +7,7 @@ #include "jf_packet.h" #include "../common/JFJochException.h" -ProcessJFPacket::ProcessJFPacket(ThreadSafeFIFO &in_c, ThreadSafeFIFO &in_wr, +ProcessJFPacket::ProcessJFPacket(ThreadSafeFIFO &in_c, ThreadSafeFIFO &in_wr, uint32_t nmodules) : m(2 * nmodules), c_fifo(in_c), diff --git a/jungfrau/ProcessJFPacket.h b/jungfrau/ProcessJFPacket.h index e4e725ca..a6e72f66 100644 --- a/jungfrau/ProcessJFPacket.h +++ b/jungfrau/ProcessJFPacket.h @@ -11,11 +11,6 @@ #include -struct ProcessWorkRequest { - uint16_t *ptr; - uint32_t handle; -}; - struct ModuleInfo { uint16_t *ptr; Completion c; @@ -24,11 +19,11 @@ struct ModuleInfo { class ProcessJFPacket { std::vector m; ThreadSafeFIFO &c_fifo; - ThreadSafeFIFO &wr_fifo; + ThreadSafeFIFO &wr_fifo; std::vector module_info; std::atomic packet_counter = 0; public: - ProcessJFPacket(ThreadSafeFIFO &c, ThreadSafeFIFO &wr, uint32_t nmodules); + ProcessJFPacket(ThreadSafeFIFO &c, ThreadSafeFIFO &wr, uint32_t nmodules); ~ProcessJFPacket(); void ProcessPacket(jf_udp_payload *datagram); uint64_t GetCounter(); diff --git a/receiver/host/CMakeLists.txt b/receiver/host/CMakeLists.txt index 254ee2e7..d7f23f20 100644 --- a/receiver/host/CMakeLists.txt +++ b/receiver/host/CMakeLists.txt @@ -8,7 +8,7 @@ ADD_LIBRARY(JungfraujochHost STATIC AcquisitionOfflineCounters.cpp AcquisitionOfflineCounters.h IBWrappers.cpp IBWrappers.h MlxRawEthDevice.cpp MlxRawEthDevice.h - ../../jungfrau/jf_packet.h LinuxSocketDevice.cpp LinuxSocketDevice.h FPGAAcquisitionDevice.cpp FPGAAcquisitionDevice.h) + ../../jungfrau/jf_packet.h LinuxSocketDevice.cpp LinuxSocketDevice.h FPGAAcquisitionDevice.cpp FPGAAcquisitionDevice.h WorkRequest.h) TARGET_LINK_LIBRARIES(JungfraujochHost CommonFunctions HLSSimulation ${IBVERBS} JFCalibration) diff --git a/receiver/host/Completion.h b/receiver/host/Completion.h index 6d1fe61c..168fcad4 100644 --- a/receiver/host/Completion.h +++ b/receiver/host/Completion.h @@ -6,6 +6,11 @@ #include +struct WorkRequest { + uint16_t *ptr; + uint32_t handle; +}; + struct Completion { enum class Type {Start, End, Image} type; diff --git a/receiver/host/LinuxSocketDevice.cpp b/receiver/host/LinuxSocketDevice.cpp index b22de9f5..0dc1477f 100644 --- a/receiver/host/LinuxSocketDevice.cpp +++ b/receiver/host/LinuxSocketDevice.cpp @@ -111,7 +111,7 @@ void LinuxSocketDevice::HW_SetCancelDataCollectionBit() { bool LinuxSocketDevice::HW_SendWorkRequest(uint32_t handle) { if (handle != UINT32_MAX) - wr_queue.Put(ProcessWorkRequest{ + wr_queue.Put(WorkRequest{ .ptr = buffer_device.at(handle), .handle = handle }); diff --git a/receiver/host/LinuxSocketDevice.h b/receiver/host/LinuxSocketDevice.h index 69a9c415..04f35b54 100644 --- a/receiver/host/LinuxSocketDevice.h +++ b/receiver/host/LinuxSocketDevice.h @@ -9,7 +9,7 @@ #include "AcquisitionDevice.h" class LinuxSocketDevice : public AcquisitionDevice { - ThreadSafeFIFO wr_queue; + ThreadSafeFIFO wr_queue; int32_t rcv_buf_size; diff --git a/receiver/host/MlxRawEthDevice.cpp b/receiver/host/MlxRawEthDevice.cpp index 8eb6b21f..312bcef2 100644 --- a/receiver/host/MlxRawEthDevice.cpp +++ b/receiver/host/MlxRawEthDevice.cpp @@ -109,7 +109,7 @@ void MlxRawEthDevice::HW_SetCancelDataCollectionBit() { bool MlxRawEthDevice::HW_SendWorkRequest(uint32_t handle) { if (handle != UINT32_MAX) - wr_queue.Put(ProcessWorkRequest{ + wr_queue.Put(WorkRequest{ .ptr = buffer_device.at(handle), .handle = handle }); diff --git a/receiver/host/MlxRawEthDevice.h b/receiver/host/MlxRawEthDevice.h index 15c15265..42a7709e 100644 --- a/receiver/host/MlxRawEthDevice.h +++ b/receiver/host/MlxRawEthDevice.h @@ -19,7 +19,7 @@ class MlxRawEthDevice : public AcquisitionDevice { std::mutex m; IBContext context; - ThreadSafeFIFO wr_queue; + ThreadSafeFIFO wr_queue; uint64_t mac_addr; uint32_t ipv4_addr; ActionConfig cfg; diff --git a/tests/ProcessRawPacketTest.cpp b/tests/ProcessRawPacketTest.cpp index e78d3c1a..935a0ce5 100644 --- a/tests/ProcessRawPacketTest.cpp +++ b/tests/ProcessRawPacketTest.cpp @@ -9,7 +9,7 @@ TEST_CASE("ProcessRawPacketTest_Empty") { ThreadSafeFIFO c_fifo; - ThreadSafeFIFO wr_fifo; + ThreadSafeFIFO wr_fifo; { ProcessJFPacket process(c_fifo, wr_fifo, 2); @@ -20,13 +20,13 @@ TEST_CASE("ProcessRawPacketTest_Empty") { TEST_CASE("ProcessRawPacketTest") { ThreadSafeFIFO c_fifo; - ThreadSafeFIFO wr_fifo; + ThreadSafeFIFO wr_fifo; std::vector array_0(RAW_MODULE_SIZE), array_1(RAW_MODULE_SIZE), array_2(RAW_MODULE_SIZE); - wr_fifo.Put(ProcessWorkRequest{.ptr = array_0.data(), .handle = 0}); - wr_fifo.Put(ProcessWorkRequest{.ptr = array_1.data(), .handle = 1}); - wr_fifo.Put(ProcessWorkRequest{.ptr = array_2.data(), .handle = 2}); + wr_fifo.Put(WorkRequest{.ptr = array_0.data(), .handle = 0}); + wr_fifo.Put(WorkRequest{.ptr = array_1.data(), .handle = 1}); + wr_fifo.Put(WorkRequest{.ptr = array_2.data(), .handle = 2}); DiffractionExperiment experiment(DetectorGeometry(8)); experiment.DataStreams(2); diff --git a/tools/JFCalibrationPerfTest.cpp b/tools/JFCalibrationPerfTest.cpp index f2500564..6f31e96b 100644 --- a/tools/JFCalibrationPerfTest.cpp +++ b/tools/JFCalibrationPerfTest.cpp @@ -180,11 +180,11 @@ void test_packet_processing(Logger &logger) { auto start_time = std::chrono::system_clock::now(); for (int z = 0; z < ntries; z++) { ThreadSafeFIFO c; - ThreadSafeFIFO wr; + ThreadSafeFIFO wr; ProcessJFPacket process(c, wr, nmodules); for (uint32_t i = 0; i < nmodules * nframes; i++) - wr.Put(ProcessWorkRequest{ + wr.Put(WorkRequest{ .ptr = output.data() + i * RAW_MODULE_SIZE, .handle = i });