52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
// Copyright (2019-2022) Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#ifdef JFJOCH_USE_IBVERBS
|
|
|
|
#ifndef JUNGFRAUJOCH_IBRECEIVER_H
|
|
#define JUNGFRAUJOCH_IBRECEIVER_H
|
|
|
|
#include "IBWrappers.h"
|
|
|
|
#include <future>
|
|
|
|
#include "../../jungfrau/ProcessJFPacket.h"
|
|
|
|
class IBReceiverBuffer {
|
|
std::unique_ptr<IBMemoryRegion> mr;
|
|
uint8_t *buffer;
|
|
void Unmap();
|
|
public:
|
|
explicit IBReceiverBuffer(uint8_t numa_node = 1);
|
|
~IBReceiverBuffer();
|
|
void Register(IBProtectionDomain &pd);
|
|
uint8_t *GetLocation(uint64_t location);
|
|
IBMemoryRegion *GetMemoryRegion();
|
|
};
|
|
|
|
class IBReceiver {
|
|
IBProtectionDomain pd;
|
|
IBCompletionQueue cq;
|
|
IBQueuePair qp;
|
|
IBReceiverBuffer buffer;
|
|
ProcessJFPacket process;
|
|
volatile bool &cancel;
|
|
|
|
std::vector<std::future<void>> futures;
|
|
void Run(uint8_t numa_node);
|
|
void Arp(uint64_t mac_addr, uint32_t ipv4_addr);
|
|
public:
|
|
IBReceiver(IBContext &context,
|
|
ThreadSafeFIFO<Completion> &completion_queue,
|
|
ThreadSafeFIFO<ProcessWorkRequest> &wr_queue,
|
|
uint32_t nmodules,
|
|
uint64_t mac_addr,
|
|
uint32_t ipv4,
|
|
volatile bool &cancel,
|
|
uint32_t nthreads = 1,
|
|
uint8_t numa_node = -1);
|
|
~IBReceiver();
|
|
};
|
|
|
|
#endif //JUNGFRAUJOCH_IBRECEIVER_H
|
|
#endif //JFJOCH_USE_IBVERBS
|