diff options
author | Alex Williams <alex.williams@ni.com> | 2019-11-04 15:54:35 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 12:21:33 -0800 |
commit | 70ed069b6e36b1823339cb0ac48f383c992de3b0 (patch) | |
tree | 9910b21f4ab84a81f6b2c1b51afed9a1a3f7f7e7 /host/tests/dpdk_port_test.cpp | |
parent | 80ec3fee4298d5b0defd98db7dcf1a01f49e9778 (diff) | |
download | uhd-70ed069b6e36b1823339cb0ac48f383c992de3b0.tar.gz uhd-70ed069b6e36b1823339cb0ac48f383c992de3b0.tar.bz2 uhd-70ed069b6e36b1823339cb0ac48f383c992de3b0.zip |
tests: Add check for life on DPDK port
Diffstat (limited to 'host/tests/dpdk_port_test.cpp')
-rw-r--r-- | host/tests/dpdk_port_test.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/host/tests/dpdk_port_test.cpp b/host/tests/dpdk_port_test.cpp new file mode 100644 index 000000000..65cf045eb --- /dev/null +++ b/host/tests/dpdk_port_test.cpp @@ -0,0 +1,41 @@ +// +// Copyright 2019 Ettus Research, a National Instruments brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include <uhdlib/transport/dpdk/common.hpp> +#include <boost/program_options.hpp> +#include <iostream> + +namespace po = boost::program_options; + +int main(int argc, char **argv) +{ + po::options_description desc("Allowed options"); + int status = 0; + std::string args; + desc.add_options() + ("help", "help message") + ("args", po::value<std::string>(&args)->default_value(""), "UHD-DPDK args") + ; + po::variables_map vm; + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + + if (vm.count("help")) { + std::cout << desc << std::endl; + return 0; + } + + auto dpdk_args = uhd::device_addr_t(args); + auto ctx = uhd::transport::dpdk::dpdk_ctx::get(); + ctx->init(args); + + uhd::transport::dpdk::dpdk_port* port = ctx->get_port(0); + std::cout << "Port 0 MTU: " << port->get_mtu() << std::endl; + status = ctx->get_port_link_status(0); + std::cout << "Port 0 Link up: " << status << std::endl; + ctx.reset(); + return 0; +} |