diff options
author | Luca Boccassi <bluca@debian.org> | 2022-01-14 14:13:19 +0000 |
---|---|---|
committer | Aaron Rossetto <aaron.rossetto@ni.com> | 2022-01-20 13:58:51 -0600 |
commit | b1586ee26b61fedd74e3bc076f7ff58d7a72f615 (patch) | |
tree | 1ab09a06308acee12f2136e13e91246111fb9d87 /host/lib/include | |
parent | 4e391500b54a22dbaae8692750ec25ae8a97ee6d (diff) | |
download | uhd-b1586ee26b61fedd74e3bc076f7ff58d7a72f615.tar.gz uhd-b1586ee26b61fedd74e3bc076f7ff58d7a72f615.tar.bz2 uhd-b1586ee26b61fedd74e3bc076f7ff58d7a72f615.zip |
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 <martin.anderseck@ni.com>
Diffstat (limited to 'host/lib/include')
-rw-r--r-- | host/lib/include/uhdlib/transport/dpdk/udp.hpp | 25 |
1 files changed, 17 insertions, 8 deletions
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]; |