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

Make NICReader transition to fail when NIC setup fails #114

Merged
merged 4 commits into from Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12)
project(dpdklibs VERSION 1.2.1)
project(dpdklibs VERSION 1.2.2)

find_package(daq-cmake REQUIRED)

Expand Down Expand Up @@ -79,6 +79,7 @@ daq_add_application(dpdklibs_test_transmit_and_receive test_transmit_and_receive
daq_add_application(dpdklibs_test_stats_reporting test_stats_reporting.cxx TEST LINK_LIBRARIES dpdklibs CLI11::CLI11 ${DPDK_LIBRARIES})
daq_add_application(dpdklibs_test_dpdk_stats test_dpdk_stats.cxx TEST LINK_LIBRARIES dpdklibs CLI11::CLI11 ${DPDK_LIBRARIES})
daq_add_application(dpdklibs_test_multi_process test_multi_proc.cxx TEST LINK_LIBRARIES dpdklibs CLI11::CLI11 ${DPDK_LIBRARIES})
#daq_add_application(dpdklibs_test_unique_caps test_unique_caps.cxx TEST LINK_LIBRARIES dpdklibs CLI11::CLI11 fmt::fmt ${DPDK_LIBRARIES})

target_compile_options(dpdklibs PUBLIC ${DPDK_CFLAGS})
target_include_directories(dpdklibs PUBLIC ${DPDK_INCLUDE_DIRS})
Expand Down
2 changes: 1 addition & 1 deletion include/dpdklibs/EALSetup.hpp
Expand Up @@ -36,7 +36,7 @@ int iface_promiscuous_mode(std::uint16_t iface, bool mode = false);
int iface_init(uint16_t iface, uint16_t rx_rings, uint16_t tx_rings,
uint16_t rx_ring_size, uint16_t tx_ring_size,
std::map<int, std::unique_ptr<rte_mempool>>& mbuf_pool,
bool with_reset=false, bool with_mq_rss=false);
bool with_reset=false, bool with_mq_rss=false, bool check_link_status=false);

std::unique_ptr<rte_mempool> get_mempool(const std::string& pool_name,
int num_mbufs=NUM_MBUFS, int mbuf_cache_size=MBUF_CACHE_SIZE,
Expand Down
3 changes: 1 addition & 2 deletions plugins/NICReceiver.cpp
Expand Up @@ -178,8 +178,7 @@ NICReceiver::do_configure(const data_t& args)
m_ifaces[iface_id]->setup_xstats();
} else {
TLOG() << "No available interface with MAC=" << iface_mac_addr << " PCI=" << iface_pci_addr;
ers::fatal(dunedaq::readoutlibs::InitializationError(
ERS_HERE, "NICReceiver configuration failed due expected but unavailable interface!"));
throw dunedaq::readoutlibs::InitializationError(ERS_HERE, "NICReceiver configuration failed due expected but unavailable interface!");
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/EALSetup.cpp
Expand Up @@ -95,7 +95,7 @@ int
iface_init(uint16_t iface, uint16_t rx_rings, uint16_t tx_rings,
uint16_t rx_ring_size, uint16_t tx_ring_size,
std::map<int, std::unique_ptr<rte_mempool>>& mbuf_pool,
bool with_reset, bool with_mq_rss)
bool with_reset, bool with_mq_rss, bool check_link_status)
{
struct rte_eth_conf iface_conf = iface_conf_default;
uint16_t nb_rxd = rx_ring_size;
Expand Down Expand Up @@ -198,7 +198,7 @@ iface_init(uint16_t iface, uint16_t rx_rings, uint16_t tx_rings,
throw FailedToRetrieveLinkStatus(ERS_HERE, iface, retval);
}

if (link.link_status == 0 ) {
if ( check_link_status && link.link_status == 0 ) {
throw LinkOffline(ERS_HERE, iface);
}

Expand Down
3 changes: 2 additions & 1 deletion src/IfaceWrapper.cpp
Expand Up @@ -93,8 +93,9 @@ IfaceWrapper::setup_interface()
{
TLOG() << "Initialize interface " << m_iface_id;
bool with_reset = true, with_mq_mode = true; // go to config
bool check_link_status = true;

int retval = ealutils::iface_init(m_iface_id, m_rx_qs.size(), m_tx_qs.size(), m_rx_ring_size, m_tx_ring_size, m_mbuf_pools, with_reset, with_mq_mode);
int retval = ealutils::iface_init(m_iface_id, m_rx_qs.size(), m_tx_qs.size(), m_rx_ring_size, m_tx_ring_size, m_mbuf_pools, with_reset, with_mq_mode, check_link_status);
if (retval != 0 ) {
throw FailedToSetupInterface(ERS_HERE, m_iface_id, retval);
}
Expand Down