diff options
author | Martin Braun <martin.braun@ettus.com> | 2020-03-02 15:25:13 -0800 |
---|---|---|
committer | atrnati <54334261+atrnati@users.noreply.github.com> | 2020-03-03 08:51:32 -0600 |
commit | 876d4150aa3da531ddd687b48afada6e43f79146 (patch) | |
tree | fd72a71419f4cd800d4e500cfcaded4dfc8dc367 /host/lib/include/uhdlib/transport | |
parent | 1393553d623bdf4ba40d5435c9719b6ce990d9ac (diff) | |
download | uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.gz uhd-876d4150aa3da531ddd687b48afada6e43f79146.tar.bz2 uhd-876d4150aa3da531ddd687b48afada6e43f79146.zip |
uhd: Apply clang-format against all .cpp and .hpp files in host/
Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of
files that clang-format gets applied against.
Diffstat (limited to 'host/lib/include/uhdlib/transport')
7 files changed, 40 insertions, 37 deletions
diff --git a/host/lib/include/uhdlib/transport/dpdk_io_service_client.hpp b/host/lib/include/uhdlib/transport/dpdk_io_service_client.hpp index d994fe376..300ca00b5 100644 --- a/host/lib/include/uhdlib/transport/dpdk_io_service_client.hpp +++ b/host/lib/include/uhdlib/transport/dpdk_io_service_client.hpp @@ -145,7 +145,8 @@ public: // first dequeue operation fails, even though we push onto it before // setting complete to true. Retrying successfully dequeues a value // in those cases. - while (rte_ring_dequeue(_buffer_queue, (void**)&buff_ptr)) {} + while (rte_ring_dequeue(_buffer_queue, (void**)&buff_ptr)) { + } } return frame_buff::uptr(buff_ptr); } @@ -200,7 +201,8 @@ public: size_t queue_size = (size_t)exp2(ceil(log2(num_recv_frames + 1))); dpdk::port_id_t nic_port = link->get_port()->get_port_id(); uint16_t id = io_srv->_get_unique_client_id(); - UHD_LOG_DEBUG("DPDK::IO_SERVICE", "Creating recv client with queue size of " << queue_size); + UHD_LOG_DEBUG( + "DPDK::IO_SERVICE", "Creating recv client with queue size of " << queue_size); char name[16]; snprintf(name, sizeof(name), "rx%hu-%hu", nic_port, id); _recv_queue = rte_ring_create( @@ -255,7 +257,8 @@ public: // first dequeue operation fails, even though we push onto it before // setting complete to true. Retrying successfully dequeues a value // in those cases. - while (rte_ring_dequeue(_recv_queue, (void**)&buff_ptr)) {} + while (rte_ring_dequeue(_recv_queue, (void**)&buff_ptr)) { + } } return frame_buff::uptr(buff_ptr); } diff --git a/host/lib/include/uhdlib/transport/liberio_link.hpp b/host/lib/include/uhdlib/transport/liberio_link.hpp index 8ab90976a..6cd550572 100644 --- a/host/lib/include/uhdlib/transport/liberio_link.hpp +++ b/host/lib/include/uhdlib/transport/liberio_link.hpp @@ -44,8 +44,7 @@ public: liberio_chan_put(_chan); } - liberio_frame_buff(const liberio_frame_buff& src) - : liberio_frame_buff(src._chan) {} + liberio_frame_buff(const liberio_frame_buff& src) : liberio_frame_buff(src._chan) {} UHD_FORCE_INLINE size_t get(int32_t timeout_ms) { @@ -55,7 +54,7 @@ public: return 0; } _packet_size = liberio_buf_get_len(_buff, 0); - _data = liberio_buf_get_mem(_buff, 0); + _data = liberio_buf_get_mem(_buff, 0); return _packet_size; } @@ -67,6 +66,7 @@ public: _buff = nullptr; _data = nullptr; } + private: struct liberio_buf* _buff = nullptr; struct liberio_chan* _chan; @@ -75,7 +75,7 @@ private: class liberio_adapter_info : public adapter_info { public: - liberio_adapter_info() = default; + liberio_adapter_info() = default; ~liberio_adapter_info() = default; std::string to_string() @@ -102,8 +102,9 @@ class liberio_link : public recv_link_base<liberio_link>, public: using sptr = std::shared_ptr<liberio_link>; - liberio_link( - const std::string& tx_path, const std::string& rx_path, const link_params_t& params); + liberio_link(const std::string& tx_path, + const std::string& rx_path, + const link_params_t& params); ~liberio_link(); diff --git a/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp b/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp index 04cd12c59..491a5ab98 100644 --- a/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp +++ b/host/lib/include/uhdlib/transport/rx_streamer_impl.hpp @@ -75,8 +75,7 @@ class rx_streamer_impl : public rx_streamer public: //! Constructor rx_streamer_impl(const size_t num_ports, const uhd::stream_args_t stream_args) - : _zero_copy_streamer(num_ports) - , _in_buffs(num_ports) + : _zero_copy_streamer(num_ports), _in_buffs(num_ports) { if (stream_args.cpu_format.empty()) { throw uhd::value_error("[rx_stream] Must provide a cpu_format!"); @@ -95,7 +94,8 @@ public: } //! Connect a new channel to the streamer - // FIXME: Needs some way to handle virtual channels, since xport could be shared among them + // FIXME: Needs some way to handle virtual channels, since xport could be shared among + // them virtual void connect_channel(const size_t channel, typename transport_t::uptr xport) { const size_t mtu = xport->get_max_payload_size(); @@ -144,8 +144,8 @@ public: size_t total_samps_recv = _recv_one_packet(buffs, nsamps_per_buff, metadata, eov_positions, timeout_ms); - if (one_packet or metadata.end_of_burst or - (eov_positions.data() and eov_positions.remaining() == 0)) { + if (one_packet or metadata.end_of_burst + or (eov_positions.data() and eov_positions.remaining() == 0)) { return total_samps_recv; } @@ -260,9 +260,8 @@ private: { if (_buff_samps_remaining == 0) { // Current set of buffers has expired, get the next one - _buff_samps_remaining = - _zero_copy_streamer.get_recv_buffs( - _in_buffs, metadata, eov_positions, timeout_ms); + _buff_samps_remaining = _zero_copy_streamer.get_recv_buffs( + _in_buffs, metadata, eov_positions, timeout_ms); _fragment_offset_in_samps = 0; } else { // There are samples still left in the current set of buffers @@ -309,8 +308,7 @@ private: _converters[chan]->conv(buffer_ptr, out_buffs, num_samps); // Advance the pointer for the source buffer - _in_buffs[chan] = - buffer_ptr + num_samps * _convert_info.bytes_per_otw_item; + _in_buffs[chan] = buffer_ptr + num_samps * _convert_info.bytes_per_otw_item; if (_buff_samps_remaining == num_samps) { _zero_copy_streamer.release_recv_buff(chan); @@ -318,8 +316,7 @@ private: } //! Create converters and initialize _convert_info - void _setup_converters(const size_t num_ports, - const uhd::stream_args_t stream_args) + void _setup_converters(const size_t num_ports, const uhd::stream_args_t stream_args) { // Note to code archaeologists: In the past, we had to also specify the // endianness here, but that is no longer necessary because we can make diff --git a/host/lib/include/uhdlib/transport/rx_streamer_zero_copy.hpp b/host/lib/include/uhdlib/transport/rx_streamer_zero_copy.hpp index 98588c6f5..86f13f28d 100644 --- a/host/lib/include/uhdlib/transport/rx_streamer_zero_copy.hpp +++ b/host/lib/include/uhdlib/transport/rx_streamer_zero_copy.hpp @@ -35,8 +35,8 @@ public: ~eov_data_wrapper() { - _metadata.eov_positions = _data; - _metadata.eov_positions_size = _size; + _metadata.eov_positions = _data; + _metadata.eov_positions_size = _size; _metadata.eov_positions_count = _write_pos; } @@ -69,14 +69,14 @@ public: private: uhd::rx_metadata_t& _metadata; - size_t* _data; - size_t _size; - size_t _remaining; - size_t _write_pos; - size_t _running_sample_count; + size_t* _data; + size_t _size; + size_t _remaining; + size_t _write_pos; + size_t _running_sample_count; }; -} // namespace uhd::transport::detail +} // namespace detail /*! * Implementation of rx streamer manipulation of frame buffers and packet info. @@ -269,9 +269,8 @@ public: // channel 0 is checked for eov--in most cases, it should be the // same for all channels. if (eov_positions.data() && eov) { - eov_positions.push_back( - eov_positions.get_running_sample_count() + - info_0.payload_bytes / _bytes_per_item); + eov_positions.push_back(eov_positions.get_running_sample_count() + + info_0.payload_bytes / _bytes_per_item); } // Done with these packets, save timestamp info for next call diff --git a/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp b/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp index d6555ad35..c1cc3156f 100644 --- a/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp +++ b/host/lib/include/uhdlib/transport/tx_streamer_impl.hpp @@ -90,9 +90,9 @@ public: private: size_t* _eov_positions; - size_t _eov_positions_size; - size_t _remaining; - size_t _read_pos; + size_t _eov_positions_size; + size_t _remaining; + size_t _read_pos; }; } // namespace detail diff --git a/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp b/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp index 88ad6e518..6b350e997 100644 --- a/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp +++ b/host/lib/include/uhdlib/transport/udp_boost_asio_link.hpp @@ -33,7 +33,9 @@ class udp_boost_asio_adapter_info : public adapter_info { public: udp_boost_asio_adapter_info(boost::asio::ip::udp::socket& s) - : _src_ip(s.local_endpoint().address()) {} + : _src_ip(s.local_endpoint().address()) + { + } ~udp_boost_asio_adapter_info() {} diff --git a/host/lib/include/uhdlib/transport/udp_common.hpp b/host/lib/include/uhdlib/transport/udp_common.hpp index e17deff9e..6deb265d4 100644 --- a/host/lib/include/uhdlib/transport/udp_common.hpp +++ b/host/lib/include/uhdlib/transport/udp_common.hpp @@ -132,7 +132,8 @@ UHD_INLINE void send_udp_packet(int sock_fd, void* mem, size_t len) // This is known to occur at least on some OSX systems. // But it should be safe to always check for the error. while (true) { - const ssize_t ret = uhd::narrow_cast<ssize_t>(::send(sock_fd, (const char*)mem, len, 0)); + const ssize_t ret = + uhd::narrow_cast<ssize_t>(::send(sock_fd, (const char*)mem, len, 0)); if (ret == ssize_t(len)) break; if (ret == -1 and errno == ENOBUFS) { |