aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrent Stapleton <brent.stapleton@ettus.com>2019-07-10 15:00:18 -0700
committerBrent Stapleton <brent.stapleton@ettus.com>2019-07-15 10:12:33 -0700
commitdb9285586213f0100dd9f0caf6e69e872d9a6718 (patch)
tree05a43f722c8a0108a49cb75ef0f2689bf79c5b63
parentnocscript: add optional port argument to block sr_write (diff)
downloaduhd-db9285586213f0100dd9f0caf6e69e872d9a6718.tar.xz
uhd-db9285586213f0100dd9f0caf6e69e872d9a6718.zip
device3: rfnoc: formatting changes
Applying clang-format to files used in upcoming changes. clang-format -i --style=file host/include/uhd/rfnoc/node_ctrl_base.hpp clang-format -i --style=file host/lib/rfnoc/ddc_block_ctrl_impl.cpp \ host/lib/rfnoc/duc_block_ctrl_impl.cpp \ host/lib/rfnoc/legacy_compat.cpp \ host/lib/usrp/device3/device3_impl.cpp \ host/lib/usrp/device3/device3_impl.hpp \ host/lib/usrp/device3/device3_io_impl.cpp \ host/lib/usrp/x300/x300_impl.cpp
-rw-r--r--host/lib/rfnoc/ddc_block_ctrl_impl.cpp12
-rw-r--r--host/lib/rfnoc/duc_block_ctrl_impl.cpp7
-rw-r--r--host/lib/usrp/device3/device3_io_impl.cpp36
-rw-r--r--host/lib/usrp/x300/x300_impl.cpp55
4 files changed, 57 insertions, 53 deletions
diff --git a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
index dbba7f68c..7785d525d 100644
--- a/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
+++ b/host/lib/rfnoc/ddc_block_ctrl_impl.cpp
@@ -170,9 +170,8 @@ public:
or stream_cmd.stream_mode
== uhd::stream_cmd_t::STREAM_MODE_NUM_SAMPS_AND_MORE) {
const size_t decimation =
- static_cast<size_t>(
- get_arg<double>("input_rate", chan)
- / get_arg<double>("output_rate", chan));
+ static_cast<size_t>(get_arg<double>("input_rate", chan)
+ / get_arg<double>("output_rate", chan));
stream_cmd.num_samps *= decimation;
}
@@ -228,9 +227,10 @@ private:
double set_output_rate(const double requested_rate, const size_t chan)
{
const double input_rate = get_arg<double>("input_rate");
- const double tick_rate = _tree->exists("tick_rate") ?
- _tree->access<double>("tick_rate").get() : input_rate;
- const size_t m = size_t(tick_rate / input_rate);
+ const double tick_rate = _tree->exists("tick_rate")
+ ? _tree->access<double>("tick_rate").get()
+ : input_rate;
+ const size_t m = size_t(tick_rate / input_rate);
const size_t decim_rate = boost::math::iround(
input_rate / this->get_output_rates().clip(requested_rate, true));
size_t decim = decim_rate;
diff --git a/host/lib/rfnoc/duc_block_ctrl_impl.cpp b/host/lib/rfnoc/duc_block_ctrl_impl.cpp
index 8d5567d21..0a24fcc31 100644
--- a/host/lib/rfnoc/duc_block_ctrl_impl.cpp
+++ b/host/lib/rfnoc/duc_block_ctrl_impl.cpp
@@ -213,9 +213,10 @@ private:
double set_input_rate(const double requested_rate, const size_t chan)
{
const double output_rate = get_arg<double>("output_rate", chan);
- const double tick_rate = _tree->exists("tick_rate") ?
- _tree->access<double>("tick_rate").get() : output_rate;
- const size_t n = size_t(tick_rate / output_rate);
+ const double tick_rate = _tree->exists("tick_rate")
+ ? _tree->access<double>("tick_rate").get()
+ : output_rate;
+ const size_t n = size_t(tick_rate / output_rate);
const size_t interp_rate = boost::math::iround(
output_rate / get_input_rates().clip(requested_rate, true));
size_t interp = interp_rate;
diff --git a/host/lib/usrp/device3/device3_io_impl.cpp b/host/lib/usrp/device3/device3_io_impl.cpp
index 081f881d5..188deb89c 100644
--- a/host/lib/usrp/device3/device3_io_impl.cpp
+++ b/host/lib/usrp/device3/device3_io_impl.cpp
@@ -168,9 +168,7 @@ static size_t get_rx_flow_control_window(
size_t window_in_bytes = (static_cast<size_t>(fullness_factor * sw_buff_size));
if (rx_args.has_key("max_recv_window")) {
window_in_bytes = std::min(
- window_in_bytes,
- pkt_size * rx_args.cast<size_t>("max_recv_window", 1)
- );
+ window_in_bytes, pkt_size * rx_args.cast<size_t>("max_recv_window", 1));
}
if (window_in_bytes < pkt_size) {
throw uhd::value_error("recv_buff_size must be larger than the recv_frame_size.");
@@ -340,8 +338,8 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t& args_)
// Traverse the upstream nodes for minimum mtu
size_t min_mtu = blk_ctrl->get_mtu(block_port);
- UHD_RX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id()
- << ": " << min_mtu;
+ UHD_RX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id()
+ << ": " << min_mtu;
std::vector<boost::shared_ptr<uhd::rfnoc::source_block_ctrl_base>>
upstream_source_nodes =
blk_ctrl->find_upstream_node<uhd::rfnoc::source_block_ctrl_base>();
@@ -350,14 +348,15 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t& args_)
// Get MTU from Port 0 of the upstream nodes. This is okay for now as
// currently we use port 0 of a block in case of channel 1.
UHD_RX_STREAMER_LOG() << "Maximum MTU supported by " << node->unique_id()
- << ": " << node->get_mtu(0);
+ << ": " << node->get_mtu(0);
min_mtu = std::min(min_mtu, node->get_mtu(0));
}
// Contraint min_mtu by device mtu
min_mtu = std::min(min_mtu, get_mtu(mb_index, uhd::direction_t::RX_DIRECTION));
if (rx_hints.has_key("recv_frame_size")) {
if (rx_hints.cast<size_t>("recv_frame_size", min_mtu) > min_mtu) {
- UHD_RX_STREAMER_LOG() << "Requested recv_frame_size of " << rx_hints["recv_frame_size"]
+ UHD_RX_STREAMER_LOG()
+ << "Requested recv_frame_size of " << rx_hints["recv_frame_size"]
<< " exceeds the maximum possible on this stream. Using " << min_mtu;
}
min_mtu =
@@ -449,7 +448,8 @@ rx_streamer::sptr device3_impl::get_rx_stream(const stream_args_t& args_)
convert::get_bytes_per_item(args.otw_format); // bytes per item
const size_t spp = std::min(args.args.cast<size_t>("spp", bpp / bpi),
bpp / bpi); // samples per packet
- UHD_RX_STREAMER_LOG() << "bpp == " << bpp << ", bpi == " << bpi << ", spp == " << spp;
+ UHD_RX_STREAMER_LOG()
+ << "bpp == " << bpp << ", bpi == " << bpi << ", spp == " << spp;
my_streamer = boost::make_shared<device3_recv_packet_streamer>(
spp, recv_terminator, xport);
@@ -607,8 +607,8 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_)
// Traverse the downstream nodes for minimum mtu
size_t min_mtu = blk_ctrl->get_mtu(block_port);
- UHD_TX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id()
- << ": " << min_mtu;
+ UHD_TX_STREAMER_LOG() << "Maximum MTU supported by " << blk_ctrl->unique_id()
+ << ": " << min_mtu;
std::vector<boost::shared_ptr<uhd::rfnoc::sink_block_ctrl_base>>
downstream_sink_nodes =
blk_ctrl->find_downstream_node<uhd::rfnoc::sink_block_ctrl_base>();
@@ -616,14 +616,15 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_)
downstream_sink_nodes) {
// Get MTU from Port 0 of the downstream nodes. This is okay for now as
// currently we use port 0 of a block in case of channel 1.
- UHD_TX_STREAMER_LOG() << "Maximum MTU supported by " << node->unique_id()
- << ": " << node->get_mtu(0);
+ UHD_TX_STREAMER_LOG() << "Maximum MTU supported by " << node->unique_id()
+ << ": " << node->get_mtu(0);
min_mtu = std::min(min_mtu, node->get_mtu(0));
}
min_mtu = std::min(min_mtu, get_mtu(mb_index, uhd::direction_t::TX_DIRECTION));
if (tx_hints.has_key("send_frame_size")) {
if (tx_hints.cast<size_t>("send_frame_size", min_mtu) > min_mtu) {
- UHD_TX_STREAMER_LOG() << "Requested send_frame_size of " << tx_hints["send_frame_size"]
+ UHD_TX_STREAMER_LOG()
+ << "Requested send_frame_size of " << tx_hints["send_frame_size"]
<< " exceeds the maximum possible on this stream. Using " << min_mtu;
}
min_mtu =
@@ -728,13 +729,13 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_)
// To calculate the max number of samples per packet, we assume the maximum
// header length to avoid fragmentation should the entire header be used.
const size_t bpp =
- tx_hints.cast<size_t>("bpp", pkt_size)
- - stream_options.tx_max_len_hdr;
+ tx_hints.cast<size_t>("bpp", pkt_size) - stream_options.tx_max_len_hdr;
const size_t bpi =
convert::get_bytes_per_item(args.otw_format); // bytes per item
const size_t spp = std::min(args.args.cast<size_t>("spp", bpp / bpi),
bpp / bpi); // samples per packet
- UHD_TX_STREAMER_LOG() << "bpp == " << bpp << ", bpi == " << bpi << ", spp == " << spp;
+ UHD_TX_STREAMER_LOG()
+ << "bpp == " << bpp << ", bpi == " << bpi << ", spp == " << spp;
my_streamer = boost::make_shared<device3_send_packet_streamer>(
spp, send_terminator, xport, async_xport);
@@ -791,8 +792,7 @@ tx_streamer::sptr device3_impl::get_tx_stream(const uhd::stream_args_t& args_)
// Avoid sending FC ACKs if the transport is lossless or the user
// has explictly requested not to send them
- if (not (xport.lossless or tx_hints.has_key("send_no_fc_acks")))
- {
+ if (not(xport.lossless or tx_hints.has_key("send_no_fc_acks"))) {
my_streamer->set_xport_chan_post_send_cb(stream_i, [fc_cache, xport]() {
tx_flow_ctrl_ack(fc_cache, xport.send, xport.send_sid);
});
diff --git a/host/lib/usrp/x300/x300_impl.cpp b/host/lib/usrp/x300/x300_impl.cpp
index f6eda34ff..ac5b66442 100644
--- a/host/lib/usrp/x300/x300_impl.cpp
+++ b/host/lib/usrp/x300/x300_impl.cpp
@@ -25,8 +25,8 @@
#include <uhd/utils/static.hpp>
#include <uhdlib/usrp/common/apply_corrections.hpp>
#ifdef HAVE_DPDK
-# include <uhdlib/transport/dpdk_zero_copy.hpp>
# include <uhdlib/transport/dpdk_simple.hpp>
+# include <uhdlib/transport/dpdk_zero_copy.hpp>
#endif
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
@@ -151,8 +151,7 @@ std::string map_mb_type_to_product_name(
} // namespace
-static x300_impl::udp_simple_factory_t x300_get_udp_factory(
- const device_addr_t& args)
+static x300_impl::udp_simple_factory_t x300_get_udp_factory(const device_addr_t& args)
{
x300_impl::udp_simple_factory_t udp_make_connected = udp_simple::make_connected;
if (args.has_key("use_dpdk")) {
@@ -162,8 +161,8 @@ static x300_impl::udp_simple_factory_t x300_get_udp_factory(
return dpdk_simple::make_connected(ctx, addr, port);
};
#else
- UHD_LOG_WARNING("DPDK",
- "Detected use_dpdk argument, but DPDK support not built in.");
+ UHD_LOG_WARNING(
+ "DPDK", "Detected use_dpdk argument, but DPDK support not built in.");
#endif
}
return udp_make_connected;
@@ -176,8 +175,7 @@ static x300_impl::udp_simple_factory_t x300_get_udp_factory(
static device_addrs_t x300_find_with_addr(const device_addr_t& hint)
{
x300_impl::udp_simple_factory_t udp_make_broadcast = udp_simple::make_broadcast;
- x300_impl::udp_simple_factory_t udp_make_connected =
- x300_get_udp_factory(hint);
+ x300_impl::udp_simple_factory_t udp_make_connected = x300_get_udp_factory(hint);
#ifdef HAVE_DPDK
if (hint.has_key("use_dpdk")) {
auto& dpdk_ctx = uhd::transport::uhd_dpdk_ctx::get();
@@ -538,8 +536,7 @@ x300_impl::x300_impl(const uhd::device_addr_t& dev_addr) : device3_impl(), _sid_
void x300_impl::mboard_members_t::discover_eth(
const mboard_eeprom_t mb_eeprom, const std::vector<std::string>& ip_addrs)
{
- x300_impl::udp_simple_factory_t udp_make_connected =
- x300_get_udp_factory(send_args);
+ x300_impl::udp_simple_factory_t udp_make_connected = x300_get_udp_factory(send_args);
// Clear any previous addresses added
eth_conns.clear();
@@ -1438,27 +1435,31 @@ uhd::both_xports_t x300_impl::make_transport(const uhd::sid_t& address,
int dpdk_port_id = dpdk_ctx.get_route(conn.addr);
if (dpdk_port_id < 0) {
- throw uhd::runtime_error("Could not find a DPDK port with route to " +
- conn.addr);
+ throw uhd::runtime_error(
+ "Could not find a DPDK port with route to " + conn.addr);
}
- auto recv = transport::dpdk_zero_copy::make(
- dpdk_ctx,
- (const unsigned int) dpdk_port_id,
+ auto recv = transport::dpdk_zero_copy::make(dpdk_ctx,
+ (const unsigned int)dpdk_port_id,
conn.addr,
BOOST_STRINGIZE(X300_VITA_UDP_PORT),
"0",
default_buff_args,
- xport_args
- );
+ xport_args);
xports.recv = recv; // Note: This is a type cast!
xports.send = xports.recv;
- xports.recv_buff_size = (default_buff_args.recv_frame_size-X300_UDP_RESERVED_FRAME_SIZE)*default_buff_args.num_recv_frames;
- xports.send_buff_size = (default_buff_args.send_frame_size-X300_UDP_RESERVED_FRAME_SIZE)*default_buff_args.num_send_frames;
- UHD_LOG_TRACE("BUFF", "num_recv_frames=" << default_buff_args.num_recv_frames
- << ", num_send_frames=" << default_buff_args.num_send_frames
- << ", recv_frame_size=" << default_buff_args.recv_frame_size
- << ", send_frame_size=" << default_buff_args.send_frame_size);
+ xports.recv_buff_size =
+ (default_buff_args.recv_frame_size - X300_UDP_RESERVED_FRAME_SIZE)
+ * default_buff_args.num_recv_frames;
+ xports.send_buff_size =
+ (default_buff_args.send_frame_size - X300_UDP_RESERVED_FRAME_SIZE)
+ * default_buff_args.num_send_frames;
+ UHD_LOG_TRACE("BUFF",
+ "num_recv_frames="
+ << default_buff_args.num_recv_frames
+ << ", num_send_frames=" << default_buff_args.num_send_frames
+ << ", recv_frame_size=" << default_buff_args.recv_frame_size
+ << ", send_frame_size=" << default_buff_args.send_frame_size);
// send a mini packet with SID into the ZPU
// ZPU will reprogram the ethernet framer
UHD_LOGGER_DEBUG("X300") << "programming packet for new xport on " << conn.addr
@@ -1993,12 +1994,14 @@ x300_impl::frame_size_t x300_impl::determine_max_frame_size(
return frame_size;
}
-size_t x300_impl::get_mtu(const size_t mb_index, const uhd::direction_t dir) {
+size_t x300_impl::get_mtu(const size_t mb_index, const uhd::direction_t dir)
+{
if (_mb[mb_index].xport_path == "nirio") {
- return (dir == RX_DIRECTION ? x300::PCIE_RX_DATA_FRAME_SIZE : x300::PCIE_TX_DATA_FRAME_SIZE);
+ return (dir == RX_DIRECTION ? x300::PCIE_RX_DATA_FRAME_SIZE
+ : x300::PCIE_TX_DATA_FRAME_SIZE);
}
- return (dir == RX_DIRECTION) ? _max_frame_sizes.recv_frame_size :
- _max_frame_sizes.send_frame_size;
+ return (dir == RX_DIRECTION) ? _max_frame_sizes.recv_frame_size
+ : _max_frame_sizes.send_frame_size;
}
/***********************************************************************