aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/transport/dpdk_simple.hpp
diff options
context:
space:
mode:
authorAlex Williams <alex.williams@ni.com>2018-09-25 14:49:45 -0700
committerAshish Chaudhari <ashish.chaudhari@ettus.com>2019-01-25 13:30:22 -0800
commitad2720d7188aece35e8aa4c65118a33b8b9ae690 (patch)
tree2d834deb728e0d59a60b8c23fa85da9db59df8af /host/lib/include/uhdlib/transport/dpdk_simple.hpp
parent3c821adfedf859ffb689136eea2ac6fa6b48916a (diff)
downloaduhd-ad2720d7188aece35e8aa4c65118a33b8b9ae690.tar.gz
uhd-ad2720d7188aece35e8aa4c65118a33b8b9ae690.tar.bz2
uhd-ad2720d7188aece35e8aa4c65118a33b8b9ae690.zip
mpmd,transport,prefs: Add xport_mgr for dpdk_zero_copy
Add configuration sections to the UHD config file for NIC entries. Keys are based on MAC addresses, and the entries beneath the section describe which CPU and I/O thread to use for the NIC and its IPv4 address. Make ring sizes configurable for uhd-dpdk. Ring size is now an argument for packet buffers. Note that the maximum number of available buffers is still determined at init! Add ability to receive broadcasts to uhd-dpdk. This is controllable by a boolean in the sockarg during socket creation. dpdk_zero_copy will filter broadcast packets out. Add dpdk_simple transport (to mirror udp_simple). This transport allows receiving from broadcast addresses, but it only permits one outstanding buffer at a time. Fix IP checksum handling in UHD-DPDK. TX checksums were not being calculated in the NIC, and in RX, the check for IP checksums allowed values of zero (reported as none). Now packets with bad IP checksums will be dropped.
Diffstat (limited to 'host/lib/include/uhdlib/transport/dpdk_simple.hpp')
-rw-r--r--host/lib/include/uhdlib/transport/dpdk_simple.hpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/host/lib/include/uhdlib/transport/dpdk_simple.hpp b/host/lib/include/uhdlib/transport/dpdk_simple.hpp
new file mode 100644
index 000000000..62728b38d
--- /dev/null
+++ b/host/lib/include/uhdlib/transport/dpdk_simple.hpp
@@ -0,0 +1,95 @@
+//
+// Copyright 2019 Ettus Research, a National Instruments Company
+//
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+
+#ifndef INCLUDED_DPDK_SIMPLE_HPP
+#define INCLUDED_DPDK_SIMPLE_HPP
+
+#include <uhdlib/transport/dpdk_common.hpp>
+
+namespace uhd { namespace transport {
+
+class dpdk_simple : boost::noncopyable
+{
+public:
+ typedef boost::shared_ptr<dpdk_simple> sptr;
+
+ virtual ~dpdk_simple(void) = 0;
+
+ /*!
+ * Make a new connected dpdk transport:
+ * This transport is for sending and receiving
+ * between this host and a single endpoint.
+ * The primary usage for this transport will be control transactions.
+ *
+ * The address must be an ipv4 address.
+ * The port must be a number.
+ *
+ * \param addr a string representing the destination address
+ * \param port a string representing the destination port
+ */
+ static sptr make_connected(struct uhd_dpdk_ctx &ctx,
+ const std::string &addr, const std::string &port);
+
+ /*!
+ * Make a new broadcasting dpdk transport:
+ * This transport can send broadcast datagrams
+ * and receive datagrams from multiple sources.
+ * The primary usage for this transport will be to discover devices.
+ *
+ * The address must be an ipv4 address.
+ * The port must be a number.
+ *
+ * \param addr a string representing the destination address
+ * \param port a string representing the destination port
+ */
+ static sptr make_broadcast(struct uhd_dpdk_ctx &ctx,
+ const std::string &addr, const std::string &port);
+
+ /*!
+ * Request a single send buffer of specified size.
+ *
+ * \param buf a pointer to place to write buffer location
+ * \return the maximum length of the buffer in Bytes
+ */
+ virtual size_t get_tx_buf(void** buf) = 0;
+
+ /*!
+ * Send and release outstanding buffer
+ *
+ * \param number of bytes sent (releases buffer if sent)
+ */
+ virtual size_t send(size_t length) = 0;
+
+ /*!
+ * Receive a single packet.
+ * Buffer provided by transport (must be freed).
+ *
+ * \param buf a pointer to place to write buffer location
+ * \param timeout the timeout in seconds
+ * \return the number of bytes received or zero on timeout
+ */
+ virtual size_t recv(void **buf, double timeout = 0.1) = 0;
+
+ /*!
+ * Return/free receive buffer
+ */
+ virtual void put_rx_buf(void) = 0;
+
+ /*!
+ * Get the last IP address as seen by recv().
+ * Only use this with the broadcast socket.
+ */
+ virtual std::string get_recv_addr(void) = 0;
+
+ /*!
+ * Get the IP address for the destination
+ */
+ virtual std::string get_send_addr(void) = 0;
+};
+
+}} // namespace uhd::transport
+
+#endif /* INCLUDED_DPDK_SIMPLE_HPP */