Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mroda/opmon #142

Merged
merged 14 commits into from
Sep 10, 2024
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ find_package(fmt REQUIRED)

daq_codegen( nicsender.jsonnet nicreader.jsonnet TEMPLATES Structs.hpp.j2 Nljs.hpp.j2 )

daq_protobuf_codegen( opmon/*.proto )

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2")

##############################################################################
Expand Down
28 changes: 12 additions & 16 deletions plugins/DPDKReaderModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <vector>
#include <ios>


/**
* @brief Name used by TRACE TLOG calls from this source file
*/
Expand Down Expand Up @@ -93,9 +94,9 @@ DPDKReaderModule::init(const std::shared_ptr<appfwk::ModuleConfiguration> mcfg )
auto mdal = mcfg->module<appmodel::DataReaderModule>(get_name());
m_cfg = mcfg;
if (mdal->get_outputs().empty()) {
auto err = dunedaq::datahandlinglibs::InitializationError(ERS_HERE, "No outputs defined for NIC reader in configuration.");
ers::fatal(err);
throw err;
auto err = dunedaq::datahandlinglibs::InitializationError(ERS_HERE, "No outputs defined for NIC reader in configuration.");
ers::fatal(err);
throw err;
}

for (auto con : mdal->get_outputs()) {
Expand All @@ -118,7 +119,8 @@ DPDKReaderModule::init(const std::shared_ptr<appfwk::ModuleConfiguration> mcfg )
callback_mode = true;
}

m_sources[queue->get_source_id()] = createSourceModel(queue->UID(), callback_mode);
auto ptr = m_sources[queue->get_source_id()] = createSourceModel(queue->UID(), callback_mode);
register_node( queue->UID(), ptr );
//m_sources[queue->get_source_id()]->init();
}
}
Expand Down Expand Up @@ -235,11 +237,12 @@ DPDKReaderModule::do_configure(const data_t& /*args*/)
}

uint iface_id = m_mac_to_id_map[net_device->get_mac_address()];
m_ifaces[iface_id] = std::make_unique<IfaceWrapper>(iface_id, dpdk_receiver, nw_senders, m_sources, m_run_marker);
m_ifaces[iface_id]->allocate_mbufs();
m_ifaces[iface_id]->setup_interface();
m_ifaces[iface_id]->setup_flow_steering();
m_ifaces[iface_id]->setup_xstats();
auto ptr = m_ifaces[iface_id] = std::make_shared<IfaceWrapper>(iface_id, dpdk_receiver, nw_senders, m_sources, m_run_marker);
register_node( fmt::format("interface-{}", iface_id), ptr);
ptr->allocate_mbufs();
ptr->setup_interface();
ptr->setup_flow_steering();
ptr->setup_xstats();

}

Expand Down Expand Up @@ -298,13 +301,6 @@ DPDKReaderModule::do_scrap(const data_t&)
}
}

// void
// DPDKReaderModule::get_info(opmonlib::InfoCollector& ci, int level)
// {
// for (auto& [iface_id, iface] : m_ifaces) {
// iface->get_info(ci, level);
// }
// }

void
DPDKReaderModule::set_running(bool should_run)
Expand Down
15 changes: 10 additions & 5 deletions plugins/DPDKReaderModule.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class DPDKReaderModule : public dunedaq::appfwk::DAQModule

void init(const std::shared_ptr<appfwk::ModuleConfiguration> mfcg) override;



private:
// Types
//using module_conf_t = dunedaq::dpdklibs::nicreader::Conf;
Expand All @@ -61,9 +63,6 @@ class DPDKReaderModule : public dunedaq::appfwk::DAQModule
void do_stop(const data_t&);
void do_scrap(const data_t&);

#warning MISSING OPMON
//void get_info(opmonlib::InfoCollector& ci, int level);

// Internals
std::shared_ptr<appfwk::ModuleConfiguration> m_cfg;

Expand All @@ -74,12 +73,18 @@ class DPDKReaderModule : public dunedaq::appfwk::DAQModule
// Interfaces (logical ID, MAC) -> IfaceWrapper
std::map<std::string, uint16_t> m_mac_to_id_map;
std::map<std::string, uint16_t> m_pci_to_id_map;
std::map<uint16_t, std::unique_ptr<IfaceWrapper>> m_ifaces;
std::map<uint16_t, std::shared_ptr<IfaceWrapper>> m_ifaces;

// Sinks (SourceConcepts)
using sid_to_source_map_t = std::map<int, std::unique_ptr<SourceConcept>>;
using sid_to_source_map_t = std::map<int, std::shared_ptr<SourceConcept>>;
sid_to_source_map_t m_sources;

// Comment of Monitoring
// Both SourceConcepts and IfaceWrappers are Monitorable Objecets
// Both quantities are available for the ReaderModule and both are registered.
// There is no loop because the Sources passed to the Wrappers are not registered in the wrapper


};

} // namespace dunedaq::dpdklibs
Expand Down
98 changes: 0 additions & 98 deletions schema/dpdklibs/nicreaderinfo.jsonnet

This file was deleted.

98 changes: 98 additions & 0 deletions schema/dpdklibs/opmon/IfaceWrapper.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
syntax = "proto3";

package dunedaq.dpdklibs.opmon;

message EthStats {

uint64 ipackets = 1; // Received packets
uint64 opackets = 2; // Transmitted packets
uint64 ibytes = 10; // Received bytes
uint64 obytes = 11; // Transmitted bytes
uint64 imissed = 20; // Missed packets
uint64 ierrors = 21; // Received errors
uint64 oerrors = 22; // Output Errors
uint64 rx_nombuf = 30; // Number of Rx mbuf allocation failures
}


message QueueInfo {

uint64 packets_received = 1;
uint64 bytes_received = 2;
uint64 full_rx_burst = 3;
uint32 max_burst_size = 4;

}

message QueueEthXStats {

uint64 packets = 1;
uint64 bytes = 2;
uint64 errors = 3;

}


message EthXStatsInfo {

uint64 groups_sent = 1;
uint64 total_groups_sent = 2;
uint64 rx_good_packets = 3;
uint64 rx_good_bytes = 4;
uint64 rx_dropped_packets = 5;

uint64 rx_unicast_packets = 11;
uint64 rx_multicast_packets = 12;
uint64 rx_broadcast_packets = 13;
uint64 rx_unknown_protocol_packets = 14;
uint64 rx_xon_packets = 15;
uint64 rx_xoff_packets = 16;

uint64 rx_size_64_packets = 49;
uint64 rx_size_65_to_127_packets = 50;
uint64 rx_size_128_to_255_packets = 51;
uint64 rx_size_256_to_511_packets = 52;
uint64 rx_size_512_to_1023_packets = 53;
uint64 rx_size_1024_to_1522_packets = 54;
uint64 rx_size_1523_to_max_packets = 55;
uint64 rx_mac_short_pkt_dropped = 60;

uint64 tx_good_packets = 100;
uint64 tx_good_bytes = 101;
uint64 tx_unicast_packets = 102;
uint64 tx_multicast_packets = 103;
uint64 tx_broadcast_packets = 104;
uint64 tx_dropped_packets = 105;
uint64 tx_link_down_dropped = 106;
uint64 tx_xon_packets = 107;
uint64 tx_xoff_packets = 108;

uint64 tx_size_64_packets = 149;
uint64 tx_size_65_to_127_packets = 150;
uint64 tx_size_128_to_255_packets = 151;
uint64 tx_size_256_to_511_packets = 152;
uint64 tx_size_512_to_1023_packets = 153;
uint64 tx_size_1024_to_1522_packets = 154;
uint64 tx_size_1523_to_max_packets = 155;

}

message EthXStatsErrors {

uint64 rx_missed_errors = 1;
uint64 rx_errors = 2;
uint64 rx_error_bytes = 3;
uint64 rx_mbuf_allocation_errors = 4;
uint64 rx_crc_errors = 5;
uint64 rx_illegal_byte_errors = 6;
uint64 rx_jabber_errors = 7;
uint64 mac_local_errors = 20;
uint64 mac_remote_errors = 21;
uint64 rx_len_errors = 22;
uint64 rx_undersized_errors = 23;
uint64 rx_oversize_errors = 24;
uint64 rx_fragmented_errors = 25;

uint64 tx_errors = 100;

}
9 changes: 9 additions & 0 deletions schema/dpdklibs/opmon/SourceModel.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";

package dunedaq.dpdklibs.opmon;

message SourceInfo {

uint32 dropped_frames = 1;

}
32 changes: 0 additions & 32 deletions schema/dpdklibs/receiverinfo.jsonnet

This file was deleted.

6 changes: 3 additions & 3 deletions src/CreateSource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ DUNE_DAQ_TYPESTRING(dunedaq::fdreadoutlibs::types::TDEFrameTypeAdapter, "TDEFram

namespace dpdklibs {

std::unique_ptr<SourceConcept>
std::shared_ptr<SourceConcept>
createSourceModel(const std::string& conn_uid, bool callback_mode)
{
auto datatypes = dunedaq::iomanager::IOManager::get()->get_datatypes(conn_uid);
Expand All @@ -39,7 +39,7 @@ createSourceModel(const std::string& conn_uid, bool callback_mode)

if (raw_dt.find("WIBEthFrame") != std::string::npos) {
// Create Model
auto source_model = std::make_unique<SourceModel<fdreadoutlibs::types::DUNEWIBEthTypeAdapter>>();
auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::DUNEWIBEthTypeAdapter>>();

// For callback acquisition later (lazy)
source_model->set_sink_name(conn_uid);
Expand All @@ -64,7 +64,7 @@ createSourceModel(const std::string& conn_uid, bool callback_mode)

} else if (raw_dt.find("TDEFrame") != std::string::npos) {
// WIB2 specific char arrays
auto source_model = std::make_unique<SourceModel<fdreadoutlibs::types::TDEFrameTypeAdapter>>();
auto source_model = std::make_shared<SourceModel<fdreadoutlibs::types::TDEFrameTypeAdapter>>();
source_model->set_sink_name(conn_uid);
source_model->set_sink(conn_uid, callback_mode);
//auto& parser = source_model->get_parser();
Expand Down
Loading
Loading