aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/transport
Commit message (Collapse)AuthorAgeFilesLines
* lib: transport: Initialize _hshake_args_serverMartin Anderseck2021-08-171-1/+1
| | | | | Initialize _hshake_args_server to safely use this struct and its contents in line 70.
* transport: Fix compiler warning in nirio_linkMartin Braun2021-06-221-2/+0
| | | | | | Remove unused variables. These variables were doubly problematic: They referenced the boost:: namespace, but this file had no more boost includes.
* host: Update code base using clang-tidyMartin Braun2021-03-174-21/+21
| | | | | | | | | | | | The checks from the new clang-tidy file are applied to the source tree using: $ find . -name "*.cpp" | sort -u | xargs \ --max-procs 8 --max-args 1 clang-tidy --format-style=file \ --fix -p /path/to/compile_commands.json Note: This is the same procedure as 107a49c0, but applied to all the new code since then.
* host: Update code base using clang-tidyMartin Braun2021-03-0415-113/+115
| | | | | | | | | The checks from the new clang-tidy file are applied to the source tree using: $ find . -name "*.cpp" | sort -u | xargs \ --max-procs 8 --max-args 1 clang-tidy --format-style=file \ --fix -p /path/to/compile_commands.json
* uhd: Check for overflow after timeout buff readSteven Koo2021-01-211-6/+0
| | | | | | | | | | | | Error processing has been moved to another thread, so it's possible that consecutive recv calls may miss the signalling that an overflow occurred. We have no guarantee that the flag had been set by the time the second recv call to find the errors occurs. This adds another check for an overflow after calling _get_aligned_buffs with a min 1ms timeout. Hopefully this is long enough for the error to propogate, but it's not guaranteed. Signed-off-by: Steven Koo <steven.koo@ni.com>
* usrprio: catch exceptions if rpc data read failsSteven Koo2020-12-211-3/+17
| | | | | | | | | This is an unhandled exception case that can cause silent failures for detecting ethernet x310 devices if the niusrpriorpc service is enabled. The "out_args >> vtr_size" read can throw an exception if there are no PCIe devices connected. Signed-off-by: Steven Koo <steven.koo@ni.com>
* RFNoC: Handle receive of 0 samplesmichael-west2020-12-101-0/+6
| | | | | | | Returns immediately if requested number of samples is zero. Prevents timeout error from being thrown if user requests no samples. Signed-off-by: michael-west <michael.west@ettus.com>
* dpdk: Improve link status detectionAaron Rossetto2020-09-031-16/+37
| | | | | | | | | | | | | | | | This change improves the DPDK link status detection algorithm in the following ways: - The status of the links are checked at an interval of 250 ms. If all links report as being up, the driver proceeds. - If any of the DPDK links has not reported as being up by the end of the link status detection timeout (1000 ms by default), the algorithm throws a runtime error rather than proceeds with one or more down links. - Users may override the default link status detection timeout by passing dpdk_link_timeout=N, where N is the desired timeout in milliseconds, either via device arguments or in the UHD configuration file.
* dpdk: clean up destruction order of dpdk context membersettus2020-08-141-4/+4
| | | | | | | Clear the io service map and the dpdk port map in the dpdk context destructor to force them to destruct before the dpdk context. Signed-off-by: ettus <matt.prost@ni.com>
* uhd: Remove assignment to const var for mac buildSteven Koo2020-08-121-11/+0
| | | | | These values are already correctly set upstream and should not be modified since params is const.
* X300: fix for incorrect PCIe buffer size valuesMatthew Crymble2020-08-041-1/+6
| | | | added extra args to get PCIe buffer sizes from factory method
* uhd: remove liberioRobertWalstab2020-07-202-161/+0
|
* Remove remaining Python 2 referencesMartin Braun2020-05-071-1/+1
| | | | | | | This changes two things in all applicable files: - Remove imports from __future__ - Change default shebangs from /usr/bin/env python to /usr/bin/env python3
* libusb: Remove deprecation warnings for libusb_set_debugMartin Braun2020-04-151-1/+14
| | | | | | | | | | | Starting with 1.0.22, libusb considers libusb_set_debug() deprecated. This replaces said call with libusb_set_option(), conditionally on the libusb version. This has no effect on the execution, but will remove some compiler versions, and make this code more future-proof. Note that Ubuntu 18.04 ships libusb 1.0.21, so this conditional code needs to remain until that version is deprecated and libusb version is bumped higher.
* uhd: Apply clang-format against all .cpp and .hpp files in host/Martin Braun2020-03-0327-1771/+1791
| | | | | Note: template_lvbitx.{cpp,hpp} need to be excluded from the list of files that clang-format gets applied against.
* cmake: Find DPDK via pkg-config, if availableAlex Williams2020-01-222-1/+2
| | | | | | Debian uses pkg-config without the libdpdk.so linker script. Use the pkg-config file to grab the installed libraries and determine what to link to.
* transport: liberio: correctly release resources on destructionJoerg Hofrichter2020-01-221-6/+8
| | | | | | | | | | Stop the streaming and free the allocated buffers on destruction of the liberio xport object. Note: There is a lingering resource leak in the kernel module, this patch merely orders the resource release correctly. Signed-off-by: Joerg Hofrichter <joerg.hofrichter@ni.com>
* nirio: use `realpath` instead of `relpath`Michael Dickens2020-01-151-6/+6
| | | | | | | The latter causes issues with some builds using `/tmp` as the build directory. Ref: https://github.com/EttusResearch/uhddev/commit/9517de45709adaea8b574011573a565007149d5d This commit changed these from `abspath` to `relpath` for Windows needs. Trying `realpath` as an alternative to both of those.
* lib: Remove dpdk_zero_copy filesMartin Braun2019-12-2011-3014/+0
| | | | These were left here as a reference.
* dpdk: Add new DPDK stack to integrate with I/O servicesAlex Williams2019-12-206-253/+1436
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | docs: Update DPDK docs with new parameters: Parameter names have had their hyphens changed to underscores, and the I/O CPU argument is now named after the lcores and reflects the naming used by DPDK. transport: Add new udp_dpdk_link, based atop the new APIs: This link is tightly coupled with the DPDK I/O service. The link class carries all the address information to communicate with the other host, and it can send packets directly through the DPDK NIC ports. However, for receiving packets, the I/O service must pull the packets from the DMA queue and attach them to the appropriate link object. The link object merely formats the frame_buff object underneath, which is embedded in the rte_mbuf container. For get_recv_buff, the link will pull buffers only from its internal queue (the one filled by the I/O service). transport: Add DPDK-specific I/O service: The I/O service is split into two parts, the user threads and the I/O worker threads. The user threads submit requests through various appropriate queues, and the I/O threads perform all the I/O on their behalf. This includes routing UDP packets to the correct receiver and getting the MAC address of a destination (by performing the ARP request and handling the ARP replies). The DPDK context stores I/O services. The context spawns all I/O services on init(), and I/O services can be fetched from the dpdk_ctx object by using a port ID. I/O service clients: The clients have two lockless ring buffers. One is to get a buffer from the I/O service; the other is to release a buffer back to the I/O service. Threads sleeping on buffer I/O are kept in a separate list from the service queue and are processed in the course of doing RX or TX. The list nodes are embedded in the dpdk_io_if, and the head of the list is on the dpdk_io_service. The I/O service will transfer the embedded wait_req to the list if it cannot acquire the mutex to complete the condition for waking. Co-authored-by: Martin Braun <martin.braun@ettus.com> Co-authored-by: Ciro Nishiguchi <ciro.nishiguchi@ni.com> Co-authored-by: Brent Stapleton <brent.stapleton@ettus.com>
* transport: Fix uninitialized offload I/O service _client_typeAlex Williams2019-12-201-5/+2
| | | | | | The client type is kept in _offload_thread_params, but a separate, unitialized field is checked in member functions. Remove the duplicate and switch the checks over. This fixes offload_io_srv_test.
* rfnoc: fix packet swapping from U32 to U64Virendra Kakade2019-11-261-5/+8
| | | | Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
* lib,tests: Remove old DPDK files from buildAlex Williams2019-11-262-14/+0
| | | | The DPDK files are left behind as a reference, for now.
* transport: Add new base for DPDK links, based on 18.11Alex Williams2019-11-262-0/+637
| | | | | | | | | | | | dpdk_ctx represents the central context and manager of all memory and threads allocated via the DPDK EAL. In this commit, it parses the user's arguments, configures all the ports, and brings them up. dpdk_port represents each DPDK NIC port's configuration, and it manages the allocation of individual queues and their flow rules. It also would provide access to an ARP table and functions for handling ARP requests and responses. The flow rules and ARP functions are not yet implemented.
* rfnoc: Make polling I/O service not block on flow controlCiro Nishiguchi2019-11-262-34/+72
| | | | | | Add a new method to io_service::send_io to check whether the destination is ready for data, to make it possible to poll send_io rather than block waiting for flow control credits.
* rfnoc: Make I/O services relinquish CPU while waitingCiro Nishiguchi2019-11-262-9/+99
|
* rfnoc: Split up offload I/O service into multiple filesCiro Nishiguchi2019-11-261-297/+12
|
* uhd: Replace all occurrences of boost::bind with std::bindMartin Braun2019-11-265-10/+11
| | | | | | | | | | | | | | | | | | | | | Note: Replacing everything with a lambda would be even better, but that can't be easily scripted so we'll do this as a first step to reduce the Boost footprint. This also removes occurences of #include <boost/bind.hpp>, and makes sure all usages of std::bind have an #include <functional>. clang-format wasn't always applied to minimize the changeset in this commit, however, it was applied to the blocks of #includes. Due to conflicts with other Boost libraries, the placeholders _1, _2, etc. could not be directly used, but had to be explicitly called out (as std::placeholders::_1, etc.). This makes the use of std::bind even uglier, which serves as another reminder that using std::bind (and even more so, boost::bind) should be avoided. nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It was not possible to remove it by simply doing a search and replace, so it will be removed in a separate commit.
* uhd: Introduce I/O service managerAaron Rossetto2019-11-262-27/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | - Implement I/O service detach link methods - The I/O service manager instantiates new I/O services or connects links to existing I/O services based on options provided by the user in stream_args. - Add a streamer ID parameter to methods to create transports so that the I/O service manager can group transports appropriately when using offload threads. - Change X300 and MPMD to use I/O service manager to connect links to I/O services. - There is now a single I/O service manager per rfnoc_graph (and it is also stored in the graph) - The I/O service manager now also knows the device args for the rfnoc_graph it was created with, and can make decisions based upon those (e.g, use a specific I/O service for DPDK, share cores between streamers, etc.) - The I/O Service Manager does not get any decision logic with this commit, though - The MB ifaces for mpmd and x300 now access this global I/O service manager - Add configuration of link parameters with overrides Co-Authored-By: Martin Braun <martin.braun@ettus.com> Co-Authored-By: Aaron Rossetto <aaron.rossetto@ni.com>
* uhd: Replace boost::regex with std::regexMartin Braun2019-11-262-6/+6
| | | | | | | | boost::regex was a requirement until the minimum version of gcc was increased. Since it is at version 5.3 now, using Boost.Regex is no longer necessary. This change is a pure search-and-replace; Boost and std versions of regex are compatible and use the same syntax.
* uhd: Replace boost::function with std::functionMartin Braun2019-11-263-10/+10
| | | | | | | This is mostly a search-and-replace operation, with few exceptions: - boost::function has a clear() method. In C++11, this is achieved by assigning nullptr to the std::function object. - The empty() method is replaced by std::function's bool() operator
* uhd: Replace BOOST_FOREACH(v, c) with for(v : c)Martin Braun2019-11-261-1/+1
| | | | | Also removes all references to boost/foreach.hpp. BOOST_FOREACH is no longer necessary since all headers require C++11 anyway.
* uhd: Replace usage of boost smart pointers with C++11 counterpartsMartin Braun2019-11-2612-61/+60
| | | | | | | | | | | | | | | | | | | This removes the following Boost constructs: - boost::shared_ptr, boost::weak_ptr - boost::enable_shared_from_this - boost::static_pointer_cast, boost::dynamic_pointer_cast The appropriate includes were also removed. All C++11 versions of these require #include <memory>. Note that the stdlib and Boost versions have the exact same syntax, they only differ in the namespace (boost vs. std). The modifications were all done using sed, with the exception of boost::scoped_ptr, which was replaced by std::unique_ptr. References to boost::smart_ptr were also removed. boost::intrusive_ptr is not removed in this commit, since it does not have a 1:1 mapping to a C++11 construct.
* transport: Implement an I/O service that uses an offload threadCiro Nishiguchi2019-11-262-0/+999
| | | | | | | The offload_io_service executes another I/O service instance within an offload thread, and provides synchronization mechanisms to communicate with clients. Frame buffers are passed from the offload thread to the client and back via single-producer, single-consumer queues.
* Remove proto-RFNoC filesMartin Braun2019-11-268-563/+0
| | | | | | | This commit removes all files and parts of files that are used by proto-RFNoC only. uhd: Fix include CMakeLists.txt, add missing files
* transport: Port liberio to link_ifAlex Williams2019-11-264-315/+153
|
* rfnoc: Fix transport buffer reservationsCiro Nishiguchi2019-11-261-38/+47
| | | | | | | | | Change transports to reserve the number of frame buffers they actually need from the I/O service. Previously some I/O service clients reserved 0 buffers since they shared frame buffers with other clients, as we know the two clients do not use the links simultaneously. This is possible with the inline_io_service but not with a multithreaded I/O service which queues buffer for clients before they are requested.
* rfnoc: Add nirio_link link objectMartin Braun2019-11-262-0/+366
|
* transport: Add modeling of physical adaptersAlex Williams2019-11-263-5/+33
| | | | | | | Now link instances must have the ability to report the corresponding physical adapter that is used for the local side of the link. This information can be used to help identify when multiple links share the same adapter.
* rfnoc: Add chdr_ctrl_xportAlex Williams2019-11-261-4/+0
| | | | | | | | | | | | | | chdr_ctrl_xport is a dumb-pipe transport for RFNoC control transactions and management frames. Also remove the I/O service's check on num_recv_frames and num_send_frames. The transports may request additional virtual channels, so the send_io_if and recv_io_if may not reserve additional frames, as they are shared with a previously-allocated instance. Note: this uses a mutex to force sequentual access to the chdr_ctrl_xport. This is supposed to go away when the multi threaded xport is done.
* uhd: add udp boost asio implementation of transport interfaceCiro Nishiguchi2019-11-267-195/+176
|
* transport: Implement a single-threaded I/O serviceAlex Williams2019-11-262-0/+416
| | | | | | | | | | | | | | | | | | | | The inline_io_service connects transports to links without any worker threads. Send operations go directly to the link, and recv will perform the I/O as part of the get_recv_buffer() call. The inline_io_service also supports muxed links natively. The receive mux is entirely inline. There is no separate thread for the inline_io_service, and that continues here. A queue is created for each client of the mux, and packets are processed as they come in. If a packet is to go up to a different client, the packet is queued up for later. When that client attempts to recv(), the queue is checked first, and the attempts to receive from the link happen ONLY if no packet was found. Also add mock transport to test I/O service APIs. Tests I/O service construction and some basic packet transmision. One case will also uses a single link that is shared between the send and recv transports. That link is muxed between two compatible but different transports.
* niusrpio: Apply formattingMartin Braun2019-11-261-59/+69
|
* libusb: fix global session race conditionMark Meserve2019-10-161-0/+5
| | | | | - It was possible for two threads to generate a global session, which would cause one of them to become invalid.
* Device3: Fix MTU and default frame sizesMichael West2019-07-181-0/+5
| | | | | | | | | | The latest changes to the get_*x_stream() functions to calculate the MTU for the channel caused default frame size values to be ignored. This change fixes that by changing the key from "send/recv_frame_size" to "mtu" and then changing the implementations of make_transport() constrain the frame size values based on the "mtu" value as well as any device and/or transport-specific limits. Signed-off-by: Michael West <michael.west@ettus.com>
* nirio: Fix typo in nirio_zero_copyMichael West2019-07-181-1/+1
| | | | Signed-off-by: Michael West <michael.west@ettus.com>
* transport: usb: Allow to cancel USB requests without throwingBehnam Sabaghi2019-07-181-1/+3
|
* x310: fixed udp WSA buffer size assignment issueMatthew Crymble2019-07-171-3/+21
|
* transport: fixed a pre-mature buffer resetmcrymble2019-06-141-2/+3
| | | | | | In the PACKET_INLINE_MESSAGE case, we need to extract the error code from the packet buffer. But the buffer was being released before that happens, resulting in garbage values for metadata.error_code.
* transport: Remove warning for memset in super_recv_packet_handlerAlex Williams2019-06-071-4/+4
| | | | Should use value initialization for non-trivial classes.