From d080e216e0e41e25dfbf1f38f56d1dba84761726 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Tue, 21 Aug 2018 12:12:46 +0800 Subject: [PATCH] msg/async: do not include dpdk headers in public header before this change, async/Stack.cc includes DPDKStack.h, which in turn includes dpdk headers. this practically renders the dpdk::dpdk an PUBLIC library of common_async_dpdk. as dpdk needs to be compiled with -march=core2, we should constrain the scope of this compiler option. hence this change. Signed-off-by: Kefu Chai --- src/msg/async/dpdk/DPDKStack.cc | 13 +++++++++++++ src/msg/async/dpdk/DPDKStack.h | 12 ++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/msg/async/dpdk/DPDKStack.cc b/src/msg/async/dpdk/DPDKStack.cc index fabfb024129..b5550f3537c 100644 --- a/src/msg/async/dpdk/DPDKStack.cc +++ b/src/msg/async/dpdk/DPDKStack.cc @@ -41,6 +41,7 @@ #include #include "common/ceph_argparse.h" +#include "dpdk_rte.h" #include "DPDKStack.h" #include "DPDK.h" #include "IP.h" @@ -197,6 +198,11 @@ DPDKWorker::Impl::Impl(CephContext *cct, unsigned i, EventCenter *c, std::shared _inet.set_netmask_address(ipv4_address(std::get<2>(tuples[0]))); } +DPDKWorker::Impl::~Impl() +{ + _dev->unset_local_queue(id); +} + int DPDKWorker::listen(entity_addr_t &sa, const SocketOptions &opt, ServerSocket *sock) { @@ -265,3 +271,10 @@ void DPDKStack::spawn_worker(unsigned i, std::function &&func) } }); } + +void DPDKStack::join_worker(unsigned i) +{ + dpdk::eal::execute_on_master([&]() { + rte_eal_wait_lcore(i+1); + }); +} diff --git a/src/msg/async/dpdk/DPDKStack.h b/src/msg/async/dpdk/DPDKStack.h index 3ccf2a22e59..cc374af9384 100644 --- a/src/msg/async/dpdk/DPDKStack.h +++ b/src/msg/async/dpdk/DPDKStack.h @@ -21,8 +21,6 @@ #include "common/Tub.h" #include "msg/async/Stack.h" -#include "dpdk_rte.h" -#include "DPDK.h" #include "net.h" #include "const.h" #include "IP.h" @@ -215,9 +213,7 @@ class DPDKWorker : public Worker { std::shared_ptr _dev; ipv4 _inet; Impl(CephContext *cct, unsigned i, EventCenter *c, std::shared_ptr dev); - ~Impl() { - _dev->unset_local_queue(id); - } + ~Impl(); }; std::unique_ptr _impl; @@ -251,11 +247,7 @@ class DPDKStack : public NetworkStack { virtual bool support_local_listen_table() const override { return true; } virtual void spawn_worker(unsigned i, std::function &&func) override; - virtual void join_worker(unsigned i) override { - dpdk::eal::execute_on_master([&]() { - rte_eal_wait_lcore(i+1); - }); - } + virtual void join_worker(unsigned i) override; }; #endif -- 2.47.3