9#ifndef DPDKLIBS_SRC_IFACEWRAPPER_HPP_
10#define DPDKLIBS_SRC_IFACEWRAPPER_HPP_
28#include <nlohmann/json.hpp>
38#include <folly/ProducerConsumerQueue.h>
46 "Unexpected stream ID " << src_id <<
" in UDP payoad. Total counter: " << counter,
47 ((
int)src_id)((
size_t)counter))
54 using sid_to_source_map_t = std::map<int, std::shared_ptr<SourceConcept>>;
56 IfaceWrapper(uint iface_id,
58 const std::vector<const appmodel::NWDetDataSender*>& senders,
59 const std::vector<const confmodel::DetectorStream*>& active_streams,
60 sid_to_source_map_t& sources,
64 IfaceWrapper(
const IfaceWrapper&) =
delete;
65 IfaceWrapper& operator=(
const IfaceWrapper&) =
delete;
66 IfaceWrapper(IfaceWrapper&&) =
delete;
67 IfaceWrapper& operator=(IfaceWrapper&&) =
delete;
73 void generate_opmon_data()
override;
75 void allocate_mbufs();
76 void setup_interface();
77 void setup_flow_steering();
81 void enable_flow() { m_lcore_enable_flow.store(
true); }
82 void disable_flow() { m_lcore_enable_flow.store(
false); }
84 const std::vector<uint16_t>& get_rte_cores()
const {
return m_rte_cores; }
89 std::string m_iface_id_str;
94 std::vector<std::string> m_ip_addr;
95 std::vector<rte_be32_t> m_ip_addr_bin;
96 std::string m_mac_addr;
99 unsigned m_max_block_words;
100 uint16_t m_rx_ring_size;
101 uint16_t m_tx_ring_size;
104 uint32_t m_lcore_sleep_ns;
105 int m_mbuf_cache_size;
108 int m_num_ip_sources;
110 std::set<std::string> m_ips;
111 std::set<int> m_rx_qs;
112 std::set<int> m_tx_qs;
113 std::vector<uint16_t> m_rte_cores;
116 std::map<int, std::map<int, std::string>> m_rx_core_map;
117 unsigned m_arp_rx_queue = 0;
120 std::atomic<bool> m_lcore_quit_signal{
false };
122 std::atomic<bool> m_lcore_enable_flow{
false };
125 std::map<int, std::unique_ptr<rte_mempool>> m_mbuf_pools;
126 std::map<int, struct rte_mbuf**> m_bufs;
129 std::map<int, std::atomic<std::size_t>> m_num_frames_rxq;
130 std::map<int, std::atomic<std::size_t>> m_num_bytes_rxq;
131 std::map<int, std::atomic<std::size_t>> m_num_full_bursts;
132 std::map<int, std::atomic<uint16_t>> m_max_burst_size;
135 std::map<int, std::atomic<std::size_t>> m_num_unhandled_non_ipv4;
136 std::map<int, std::atomic<std::size_t>> m_num_unhandled_non_udp;
137 std::map<int, std::atomic<std::size_t>> m_num_unhandled_non_jumbo_udp;
140 std::map<int, std::atomic<std::size_t>> m_num_unexid_frames;
147 std::map<int, std::map<uint, uint>> m_stream_id_to_source_id;
148 sid_to_source_map_t& m_sources;
149 bool m_strict_parsing{
true };
152 std::atomic<bool>& m_run_marker;
155 std::unique_ptr<rte_mempool> m_garp_mbuf_pool;
156 std::map<int, struct rte_mbuf**> m_garp_bufs;
157 std::thread m_garp_thread;
159 std::atomic<uint64_t> m_garps_sent{ 0 };
162 std::unique_ptr<rte_mempool> m_arp_mbuf_pool;
163 std::map<int, struct rte_mbuf**> m_arp_bufs;
164 std::thread m_arp_thread;
166 std::atomic<uint64_t> m_arps_sent{ 0 };
169 int rx_runner(
void* arg __rte_unused);
170 int arp_response_runner(
void* arg __rte_unused);
173 void parse_udp_payload(
int src_rx_q,
char* payload, std::size_t
size);
176 void passthrough_udp_payload(
int src_rx_q,
char* payload, std::size_t
size);
std::atomic< bool > run_marker
Global atomic for process lifetime.
ERS_DECLARE_ISSUE(cibmodules, CIBCommunicationError, " CIB Hardware Communication Error: "<< descriptor,((std::string) descriptor)) ERS_DECLARE_ISSUE(cibmodules
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size