rogue
Loading...
Searching...
No Matches
Core.h
Go to the documentation of this file.
1
18#ifndef __ROGUE_PROTOCOLS_ROCEV2_CORE_H__
19#define __ROGUE_PROTOCOLS_ROCEV2_CORE_H__
20#include "rogue/Directives.h"
21
22#include <infiniband/verbs.h>
23#include <memory>
24#include <stdint.h>
25#include <string>
26
27#include "rogue/Logging.h"
28
29namespace rogue {
30namespace protocols {
31namespace rocev2 {
32
33// Number of receive work requests to keep posted at all times.
34// Increase if you see CQ overruns at high data rates.
35static const uint32_t DefaultRxQueueDepth = 256;
36
37// Maximum transfer unit for a single RDMA WRITE operation.
38// Must be large enough for the biggest frame your FPGA will send.
39// Default: 9000 bytes (jumbo-frame equivalent).
40static const uint32_t DefaultMaxPayload = 9000;
41
42class Core {
43 protected:
44 // ibverbs resources owned by Core. CQ / QP / MR are owned by Server
45 // and live in the derived class.
46 struct ibv_context* ctx_; // device context
47 struct ibv_pd* pd_; // protection domain
48
49 // Configuration
50 std::string deviceName_; // e.g. "rxe0" or "mlx5_0"
51 uint8_t ibPort_; // ibverbs port number (almost always 1)
52 uint8_t gidIndex_; // GID table index for RoCEv2 (IPv4/IPv6)
53 uint32_t maxPayload_; // max bytes per RDMA WRITE
54
55 std::shared_ptr<rogue::Logging> log_;
56
57 public:
58 Core(const std::string& deviceName,
59 uint8_t ibPort,
60 uint8_t gidIndex,
61 uint32_t maxPayload = DefaultMaxPayload);
62
63 virtual ~Core();
64
65 uint32_t maxPayload() const { return maxPayload_; }
66
67 static void setup_python();
68};
69
70typedef std::shared_ptr<rogue::protocols::rocev2::Core> CorePtr;
71
72} // namespace rocev2
73} // namespace protocols
74} // namespace rogue
75
76#endif // __ROGUE_PROTOCOLS_ROCEV2_CORE_H__
virtual ~Core()
Destructor - releases the protection domain and closes the ibverbs context.
Definition Core.cpp:108
std::shared_ptr< rogue::Logging > log_
Definition Core.h:55
struct ibv_pd * pd_
Definition Core.h:47
struct ibv_context * ctx_
Definition Core.h:46
uint32_t maxPayload() const
Definition Core.h:65
static const uint32_t DefaultMaxPayload
Definition Core.h:40
static const uint32_t DefaultRxQueueDepth
Definition Core.h:35
std::shared_ptr< rogue::protocols::rocev2::Core > CorePtr
Definition Core.h:70