9#ifndef DPDKLIBS_SRC_IFACEWRAPPER_HPP_
10#define DPDKLIBS_SRC_IFACEWRAPPER_HPP_
28#include <nlohmann/json.hpp>
38#include <folly/ProducerConsumerQueue.h>
44 "Field " << field <<
" was not reported",
50 "Unexpected stream ID " << src_id <<
" in UDP payoad. Total counter: " << counter,
51 ((
int)src_id)((
size_t)counter)
59 using sid_to_source_map_t = std::map<int, std::shared_ptr<SourceConcept>>;
62 const std::vector<const appmodel::NWDetDataSender*>& senders,
63 const std::vector<const confmodel::DetectorStream*>& active_streams,
64 sid_to_source_map_t& sources, std::atomic<bool>&
run_marker);
67 IfaceWrapper(
const IfaceWrapper&) =
delete;
68 IfaceWrapper& operator=(
const IfaceWrapper&) =
delete;
69 IfaceWrapper(IfaceWrapper&&) =
delete;
70 IfaceWrapper& operator=(IfaceWrapper&&) =
delete;
76 void generate_opmon_data()
override;
78 void allocate_mbufs();
79 void setup_interface();
80 void setup_flow_steering();
84 void enable_flow() { m_lcore_enable_flow.store(
true);}
85 void disable_flow() { m_lcore_enable_flow.store(
false);}
87 const std::vector<uint16_t>& get_rte_cores()
const {
return m_rte_cores; }
92 std::string m_iface_id_str;
97 std::vector<std::string> m_ip_addr;
98 std::vector<rte_be32_t> m_ip_addr_bin;
99 std::string m_mac_addr;
102 unsigned m_max_block_words;
103 uint16_t m_rx_ring_size;
104 uint16_t m_tx_ring_size;
107 uint32_t m_lcore_sleep_ns;
108 int m_mbuf_cache_size;
111 int m_num_ip_sources;
113 std::set<std::string> m_ips;
114 std::set<int> m_rx_qs;
115 std::set<int> m_tx_qs;
116 std::vector<uint16_t> m_rte_cores;
119 std::map<int, std::map<int, std::string>> m_rx_core_map;
120 unsigned m_arp_rx_queue = 0;
123 std::atomic<bool> m_lcore_quit_signal{
false };
125 std::atomic<bool> m_lcore_enable_flow{
false };
128 std::map<int, std::unique_ptr<rte_mempool>> m_mbuf_pools;
129 std::map<int, struct rte_mbuf **> m_bufs;
132 std::map<int, std::atomic<std::size_t>> m_num_frames_rxq;
133 std::map<int, std::atomic<std::size_t>> m_num_bytes_rxq;
134 std::map<int, std::atomic<std::size_t>> m_num_full_bursts;
135 std::map<int, std::atomic<uint16_t>> m_max_burst_size;
138 std::map<int, std::atomic<std::size_t>> m_num_unhandled_non_ipv4;
139 std::map<int, std::atomic<std::size_t>> m_num_unhandled_non_udp;
140 std::map<int, std::atomic<std::size_t>> m_num_unhandled_non_jumbo_udp;
143 std::map<int, std::atomic<std::size_t>> m_num_unexid_frames;
151 std::map<int, std::map<uint, uint>> m_stream_id_to_source_id;
152 sid_to_source_map_t& m_sources;
153 bool m_strict_parsing {
true};
156 std::atomic<bool>& m_run_marker;
159 std::unique_ptr<rte_mempool> m_garp_mbuf_pool;
160 std::map<int, struct rte_mbuf **> m_garp_bufs;
161 std::thread m_garp_thread;
163 std::atomic<uint64_t> m_garps_sent{0};
166 std::unique_ptr<rte_mempool> m_arp_mbuf_pool;
167 std::map<int, struct rte_mbuf **> m_arp_bufs;
168 std::thread m_arp_thread;
170 std::atomic<uint64_t> m_arps_sent{0};
173 int rx_runner(
void *arg __rte_unused);
174 int arp_response_runner(
void *arg __rte_unused);
177 void parse_udp_payload(
int src_rx_q,
char* payload, std::size_t
size);
180 void passthrough_udp_payload(
int src_rx_q,
char* payload, std::size_t
size);
std::atomic< bool > run_marker
Global atomic for process lifetime.
#define ERS_DECLARE_ISSUE( namespace_name, class_name, message_, attributes)
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size