From b1586ee26b61fedd74e3bc076f7ff58d7a72f615 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 14 Jan 2022 14:13:19 +0000 Subject: host: fix build with DPDK v21.11 LTS Some APIs were changed with the latest DPDK LTS release, add some ifdefs to fix the build. Fixes https://github.com/EttusResearch/uhd/issues/547 Updated CMake file to reflect updated DPDK version. Fixed mbuf size to take ethernet headers into account. Updated documentation. Co-authored-by: Martin Anderseck --- host/lib/include/uhdlib/transport/dpdk/udp.hpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'host/lib/include') diff --git a/host/lib/include/uhdlib/transport/dpdk/udp.hpp b/host/lib/include/uhdlib/transport/dpdk/udp.hpp index 712b73d81..d43fa3959 100644 --- a/host/lib/include/uhdlib/transport/dpdk/udp.hpp +++ b/host/lib/include/uhdlib/transport/dpdk/udp.hpp @@ -15,7 +15,8 @@ namespace uhd { namespace transport { namespace dpdk { constexpr size_t HDR_SIZE_UDP_IPV4 = - (sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + sizeof(struct rte_udp_hdr)); + (sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + + sizeof(struct rte_udp_hdr)); /*! * An enumerated type representing the type of flow for an IPv4 client @@ -57,12 +58,17 @@ inline void fill_rte_ipv4_hdr(struct rte_mbuf* mbuf, ip_hdr->hdr_checksum = 0; // Require HW offload ip_hdr->src_addr = port->get_ipv4(); ip_hdr->dst_addr = dst_rte_ipv4_addr; - +#if RTE_VER_YEAR > 21 || (RTE_VER_YEAR == 21 && RTE_VER_MONTH == 11) + mbuf->ol_flags = RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4; +#else mbuf->ol_flags = PKT_TX_IP_CKSUM | PKT_TX_IPV4; - mbuf->l2_len = sizeof(struct rte_ether_hdr); - mbuf->l3_len = sizeof(struct rte_ipv4_hdr); - mbuf->pkt_len = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + payload_len; - mbuf->data_len = sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + payload_len; +#endif + mbuf->l2_len = sizeof(struct rte_ether_hdr); + mbuf->l3_len = sizeof(struct rte_ipv4_hdr); + mbuf->pkt_len = + sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + payload_len; + mbuf->data_len = + sizeof(struct rte_ether_hdr) + sizeof(struct rte_ipv4_hdr) + payload_len; } /* All values except payload length must be in network order */ @@ -77,8 +83,11 @@ inline void fill_rte_udp_hdr(struct rte_mbuf* mbuf, struct rte_ipv4_hdr* ip_hdr; struct rte_udp_hdr* tx_hdr; - fill_rte_ipv4_hdr( - mbuf, port, dst_rte_ipv4_addr, IPPROTO_UDP, sizeof(struct rte_udp_hdr) + payload_len); + fill_rte_ipv4_hdr(mbuf, + port, + dst_rte_ipv4_addr, + IPPROTO_UDP, + sizeof(struct rte_udp_hdr) + payload_len); eth_hdr = rte_pktmbuf_mtod(mbuf, struct rte_ether_hdr*); ip_hdr = (struct rte_ipv4_hdr*)ð_hdr[1]; -- cgit v1.2.3