aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/include/uhdlib/transport/uhd-dpdk.h
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/uhd-dpdk.h
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/uhd-dpdk.h')
-rw-r--r--host/lib/include/uhdlib/transport/uhd-dpdk.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/host/lib/include/uhdlib/transport/uhd-dpdk.h b/host/lib/include/uhdlib/transport/uhd-dpdk.h
index 8d46912bd..ae7d31383 100644
--- a/host/lib/include/uhdlib/transport/uhd-dpdk.h
+++ b/host/lib/include/uhdlib/transport/uhd-dpdk.h
@@ -31,12 +31,22 @@ enum uhd_dpdk_sock_type {
};
/**
- * Init UHD-DPDK environment and bring up ports (link UP).
- *
- * Offload capabilities will be used if available
+ * Init UHD-DPDK environment, including DPDK's EAL.
+ * This will make available information about the DPDK-assigned NIC devices.
*
* @param argc passed directly to rte_eal_init()
* @param argv passed directly to rte_eal_init()
+ *
+ * @return Returns negative error code if there were issues, else 0
+ */
+int uhd_dpdk_init(int argc, const char **argv);
+
+/**
+ * Start UHD-DPDK networking stack. Bring ports up (link UP).
+ * uhd_dpdk_init() must be called first.
+ *
+ * Offload capabilities will be used if available
+ *
* @param num_ports number of network interfaces to map
* @param port_thread_mapping array of num_ports entries specifying which thread
* will drive the I/O for a given port (determined by array index)
@@ -47,9 +57,8 @@ enum uhd_dpdk_sock_type {
*
* @return Returns negative error code if there were issues, else 0
*/
-int uhd_dpdk_init(int argc, const char **argv, unsigned int num_ports,
- int *port_thread_mapping, int num_mbufs, int mbuf_cache_size,
- int mtu);
+int uhd_dpdk_start(unsigned int num_ports, int *port_thread_mapping,
+ int num_mbufs, int mbuf_cache_size, int mtu);
/**
* @return Returns number of ports registered to DPDK.
@@ -58,6 +67,12 @@ int uhd_dpdk_init(int argc, const char **argv, unsigned int num_ports,
int uhd_dpdk_port_count(void);
/**
+ * @return Returns 0 if link is down, 1 if link is up, and negative error code
+ * if error occurred.
+ */
+int uhd_dpdk_port_link_status(unsigned int portid);
+
+/**
* @return Returns Ethernet MAC address of requested port
*
* @param portid ID number of network interface
@@ -121,17 +136,21 @@ int uhd_dpdk_sock_close(struct uhd_dpdk_socket *sock);
/**
* Arguments for a UDP socket
- * All data should be provided in network format
+ * All address/port data should be provided in network format
*/
struct uhd_dpdk_sockarg_udp {
/*! True for TX socket, false for RX socket */
bool is_tx;
+ /*! True to filter broadcast packets, else recv */
+ bool filter_bcast;
/*! Local udp port. This is dst_port for RX, src_port for TX */
uint16_t local_port;
/*! Remote udp port. This is dst_port for TX */
uint16_t remote_port;
/*! IPv4 address for destination (TX) */
uint32_t dst_addr;
+ /*! Number of buffers in ring */
+ size_t num_bufs;
};
/**