diff options
-rw-r--r-- | host/cmake/Modules/FindDPDK.cmake | 2 | ||||
-rw-r--r-- | host/docs/dpdk.dox | 3 | ||||
-rw-r--r-- | host/lib/CMakeLists.txt | 2 | ||||
-rw-r--r-- | host/lib/include/uhdlib/transport/dpdk/common.hpp | 32 | ||||
-rw-r--r-- | host/lib/transport/uhd-dpdk/dpdk_common.cpp | 8 |
5 files changed, 44 insertions, 3 deletions
diff --git a/host/cmake/Modules/FindDPDK.cmake b/host/cmake/Modules/FindDPDK.cmake index 4f1426dfd..90240e61d 100644 --- a/host/cmake/Modules/FindDPDK.cmake +++ b/host/cmake/Modules/FindDPDK.cmake @@ -39,7 +39,7 @@ else() endif() find_package(PkgConfig) -PKG_CHECK_MODULES(PC_DPDK QUIET libdpdk>=19.11) +PKG_CHECK_MODULES(PC_DPDK QUIET libdpdk>=18.11) find_path (DPDK_VERSION_INCLUDE_DIR rte_version.h HINTS ${PC_DPDK_INCLUDE_DIRS} diff --git a/host/docs/dpdk.dox b/host/docs/dpdk.dox index 0b86c78ba..a48ce42d3 100644 --- a/host/docs/dpdk.dox +++ b/host/docs/dpdk.dox @@ -26,7 +26,8 @@ computer. \subsection dpdk_installation DPDK Installation Instructions As a new and developing technology, the DPDK APIs are unstable. UHD requires -version 19.11, 20.11 or 21.11. +version 18.11(deprecated), 19.11, 20.11 or 21.11. Adjacent non-LTS releases of +DPDK may work, but are not recommended. On Ubuntu 20.04, Fedora 33-36, or Debian Bullseye/Buster (via backports), DPDK is available in your distribution's repositories. For example, on Debian diff --git a/host/lib/CMakeLists.txt b/host/lib/CMakeLists.txt index 094827d2a..5aee65d38 100644 --- a/host/lib/CMakeLists.txt +++ b/host/lib/CMakeLists.txt @@ -60,7 +60,7 @@ endmacro(INCLUDE_SUBDIRECTORY) message(STATUS "") # Dependencies find_package(LIBUSB) -find_package(DPDK 19.11...21.11) +find_package(DPDK 18.11...21.11) LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF OFF) # Devices LIBUHD_REGISTER_COMPONENT("B100" ENABLE_B100 ON "ENABLE_LIBUHD;ENABLE_USB" OFF OFF) diff --git a/host/lib/include/uhdlib/transport/dpdk/common.hpp b/host/lib/include/uhdlib/transport/dpdk/common.hpp index c1302335a..4c5ba02e9 100644 --- a/host/lib/include/uhdlib/transport/dpdk/common.hpp +++ b/host/lib/include/uhdlib/transport/dpdk/common.hpp @@ -26,6 +26,38 @@ /* NOTE: There are changes to all the network standard fields in 19.x */ +/* + * Substituting old values to support DPDK 18.11 with the API changes in DPDK 19. + * There were no functional changes in the DPDK calls utilized by UHD between + * these two API versions. + */ +#if RTE_VER_YEAR < 19 || (RTE_VER_YEAR == 19 && RTE_VER_MONTH < 8) +// 18.11 data types +#define rte_ether_addr ether_addr +#define rte_ether_hdr ether_hdr +#define rte_arp_hdr arp_hdr +#define arp_hardware arp_hrd +#define arp_protocol arp_pro +#define arp_hlen arp_hln +#define arp_plen arp_pln +#define arp_opcode arp_op +#define rte_ipv4_hdr ipv4_hdr +#define rte_udp_hdr udp_hdr +// 18.11 constants +#define RTE_ETHER_TYPE_IPV4 ETHER_TYPE_IPv4 +#define RTE_ETHER_TYPE_ARP ETHER_TYPE_ARP +#define RTE_ETHER_ADDR_LEN ETHER_ADDR_LEN +#define RTE_ETHER_CRC_LEN ETHER_CRC_LEN +#define RTE_ETHER_HDR_LEN ETHER_HDR_LEN +#define RTE_IPV4_HDR_DF_FLAG IPV4_HDR_DF_FLAG +#define RTE_ARP_HRD_ETHER ARP_HRD_ETHER +#define RTE_ARP_OP_REPLY ARP_OP_REPLY +#define RTE_ARP_OP_REQUEST ARP_OP_REQUEST +// 18.11 functions +#define rte_ether_addr_copy ether_addr_copy +#define rte_ether_format_addr ether_format_addr +#define rte_is_zero_ether_addr is_zero_ether_addr +#endif namespace uhd { namespace transport { diff --git a/host/lib/transport/uhd-dpdk/dpdk_common.cpp b/host/lib/transport/uhd-dpdk/dpdk_common.cpp index 55bf57cdc..0f0a00e51 100644 --- a/host/lib/transport/uhd-dpdk/dpdk_common.cpp +++ b/host/lib/transport/uhd-dpdk/dpdk_common.cpp @@ -413,6 +413,14 @@ void dpdk_ctx::init(const device_addr_t& user_args) unsigned int i; std::lock_guard<std::mutex> lock(_init_mutex); if (!_init_done) { +#if RTE_VER_YEAR < 19 || (RTE_VER_YEAR == 19 && RTE_VER_MONTH < 11) + UHD_LOG_WARNING("DPDK", + "Deprecated DPDK version " + << RTE_VER_YEAR << "." << RTE_VER_MONTH + << " detected. Consider upgrading DPDK. Recommended versions are 19.11, " + "20.11, and 21.11."); +#endif + /* Gather global config, build args for EAL, and init UHD-DPDK */ const device_addr_t dpdk_args = uhd::prefs::get_dpdk_args(user_args); UHD_LOG_TRACE("DPDK", "Configuration:" << std::endl << dpdk_args.to_pp_string()); |