diff options
Diffstat (limited to 'host/lib/usrp')
-rw-r--r-- | host/lib/usrp/common/CMakeLists.txt | 8 | ||||
-rw-r--r-- | host/lib/usrp/common/io_service_mgr.cpp | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/host/lib/usrp/common/CMakeLists.txt b/host/lib/usrp/common/CMakeLists.txt index e4048fdf7..7a6a4fe27 100644 --- a/host/lib/usrp/common/CMakeLists.txt +++ b/host/lib/usrp/common/CMakeLists.txt @@ -36,3 +36,11 @@ LIBUHD_APPEND_SOURCES( ${CMAKE_CURRENT_SOURCE_DIR}/io_service_mgr.cpp ${CMAKE_CURRENT_SOURCE_DIR}/io_service_args.cpp ) + +if(ENABLE_DPDK) + set_property( + SOURCE + ${CMAKE_CURRENT_SOURCE_DIR}/io_service_mgr.cpp + PROPERTY COMPILE_DEFINITIONS HAVE_DPDK + ) +endif(ENABLE_DPDK) diff --git a/host/lib/usrp/common/io_service_mgr.cpp b/host/lib/usrp/common/io_service_mgr.cpp index 707618c11..19c06a826 100644 --- a/host/lib/usrp/common/io_service_mgr.cpp +++ b/host/lib/usrp/common/io_service_mgr.cpp @@ -10,7 +10,11 @@ #include <uhd/utils/log.hpp> #include <uhdlib/transport/inline_io_service.hpp> #include <uhdlib/transport/offload_io_service.hpp> +#ifdef HAVE_DPDK +# include <uhdlib/usrp/common/dpdk_io_service_mgr.hpp> +#endif #include <uhdlib/usrp/common/io_service_mgr.hpp> +#include <uhdlib/usrp/constrained_device_args.hpp> #include <map> #include <vector> @@ -450,6 +454,18 @@ private: io_service_mgr::sptr io_service_mgr::make(const uhd::device_addr_t& args) { + constrained_device_args_t::bool_arg use_dpdk("use_dpdk", false); + if (args.has_key(use_dpdk.key())) { + use_dpdk.parse(args[use_dpdk.key()]); + } + + if (use_dpdk.get()) { +#ifdef HAVE_DPDK + return std::make_shared<dpdk_io_service_mgr_impl>(); +#else + UHD_LOG_WARNING(LOG_ID, "Cannot instantiate DPDK I/O service. Proceeding with regular I/O service."); +#endif + } return std::make_shared<io_service_mgr_impl>(args); } |