From: Chunsong Feng Date: Fri, 10 Dec 2021 03:39:33 +0000 (+0000) Subject: msg/async/dpdk: replacing rte_exit with ceph_assert to avoid exit failure X-Git-Tag: v17.1.0~209^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=744b197052c20668ec943be21399b201fbc77d92;p=ceph.git msg/async/dpdk: replacing rte_exit with ceph_assert to avoid exit failure In the DPDK example program,rte_exit is invoked only in the master thread. The DPDK worker thread cannot invoke rte_exit to avoid waiting forever. Fixes: https://tracker.ceph.com/issues/53481 Signed-off-by: Chunsong Feng Reviewed-by: luo rixin Reviewed-by: Han Fengzhe --- diff --git a/src/msg/async/dpdk/DPDK.cc b/src/msg/async/dpdk/DPDK.cc index a17e1788e5474..a5e5c6d120723 100644 --- a/src/msg/async/dpdk/DPDK.cc +++ b/src/msg/async/dpdk/DPDK.cc @@ -232,9 +232,11 @@ int DPDKDevice::init_port_start() } else if (_dev_info.hash_key_size == 52) { _rss_key = default_rsskey_52bytes; } else if (_dev_info.hash_key_size != 0) { - rte_exit(EXIT_FAILURE, - "Port %d: We support only 40 or 52 bytes RSS hash keys, %d bytes key requested", - _port_idx, _dev_info.hash_key_size); + lderr(cct) << "Port " << int(_port_idx) + << ": We support only 40 or 52 bytes RSS hash keys, " + << int(_dev_info.hash_key_size) << " bytes key requested" + << dendl; + return -EINVAL; } else { _rss_key = default_rsskey_40bytes; _dev_info.hash_key_size = 40; @@ -1250,7 +1252,7 @@ std::unique_ptr create_dpdk_net_device( { // Check that we have at least one DPDK-able port if (rte_eth_dev_count_avail() == 0) { - rte_exit(EXIT_FAILURE, "No Ethernet ports - bye\n"); + ceph_assert(false && "No Ethernet ports - bye\n"); } else { ldout(cct, 10) << __func__ << " ports number: " << int(rte_eth_dev_count_avail()) << dendl; } diff --git a/src/msg/async/dpdk/DPDK.h b/src/msg/async/dpdk/DPDK.h index 47c09340d63e4..13923c7287142 100644 --- a/src/msg/async/dpdk/DPDK.h +++ b/src/msg/async/dpdk/DPDK.h @@ -811,7 +811,7 @@ class DPDKDevice { /* now initialise the port we will use */ int ret = init_port_start(); if (ret != 0) { - rte_exit(EXIT_FAILURE, "Cannot initialise port %u\n", _port_idx); + ceph_assert(false && "Cannot initialise port\n"); } std::string name(std::string("port") + std::to_string(port_idx)); PerfCountersBuilder plb(cct, name, l_dpdk_dev_first, l_dpdk_dev_last);