diff --git a/pkgs/by-name/od/odp-dpdk/dpdk_25.03.patch b/pkgs/by-name/od/odp-dpdk/dpdk_25.03.patch new file mode 100644 index 000000000000..daafdfad8584 --- /dev/null +++ b/pkgs/by-name/od/odp-dpdk/dpdk_25.03.patch @@ -0,0 +1,46 @@ +diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h +index deb1fd43f2..0f63ebe1d5 100644 +--- a/lib/eal/include/rte_bitops.h ++++ b/lib/eal/include/rte_bitops.h +@@ -525,10 +525,12 @@ __rte_bit_ ## variant ## flip ## size(qualifier uint ## size ## _t *addr, unsign + __RTE_GEN_BIT_OPS(,, size) \ + __RTE_GEN_BIT_OPS(v_, volatile, size) + ++#ifndef __cplusplus + #ifdef ALLOW_EXPERIMENTAL_API + __RTE_GEN_BIT_OPS_SIZE(32) + __RTE_GEN_BIT_OPS_SIZE(64) + #endif ++#endif + + #define __RTE_GEN_BIT_ATOMIC_TEST(variant, qualifier, size) \ + __rte_experimental \ +@@ -653,10 +655,12 @@ __rte_bit_atomic_ ## variant ## test_and_assign ## size( \ + __RTE_GEN_BIT_ATOMIC_OPS(,, size) \ + __RTE_GEN_BIT_ATOMIC_OPS(v_, volatile, size) + ++#ifndef __cplusplus + #ifdef ALLOW_EXPERIMENTAL_API + __RTE_GEN_BIT_ATOMIC_OPS_SIZE(32) + __RTE_GEN_BIT_ATOMIC_OPS_SIZE(64) + #endif ++#endif + + /*------------------------ 32-bit relaxed operations ------------------------*/ + +@@ -1485,6 +1489,7 @@ rte_bit_ ## family ## fun(qualifier uint ## size ## _t *addr, arg1_type arg1_nam + __RTE_BIT_OVERLOAD_SZ_4R(family, fun, qualifier, 64, ret_type, arg1_type, arg1_name, \ + arg2_type, arg2_name, arg3_type, arg3_name) + ++#ifndef __cplusplus + #ifdef ALLOW_EXPERIMENTAL_API + __RTE_BIT_OVERLOAD_2R(, test, const, bool, unsigned int, nr) + __RTE_BIT_OVERLOAD_2(, set,, unsigned int, nr) +@@ -1502,6 +1507,7 @@ __RTE_BIT_OVERLOAD_3R(atomic_, test_and_clear,, bool, unsigned int, nr, int, mem + __RTE_BIT_OVERLOAD_4R(atomic_, test_and_assign,, bool, unsigned int, nr, bool, value, + int, memory_order) + #endif ++#endif + + #endif + diff --git a/pkgs/by-name/od/odp-dpdk/odp-dpdk_25.03.patch b/pkgs/by-name/od/odp-dpdk/odp-dpdk_25.03.patch new file mode 100644 index 000000000000..a62c9a0796a3 --- /dev/null +++ b/pkgs/by-name/od/odp-dpdk/odp-dpdk_25.03.patch @@ -0,0 +1,50 @@ +diff --git a/platform/linux-dpdk/odp_packet_dpdk.c b/platform/linux-dpdk/odp_packet_dpdk.c +index cd95ba0f9..7e8b7e3f1 100644 +--- a/platform/linux-dpdk/odp_packet_dpdk.c ++++ b/platform/linux-dpdk/odp_packet_dpdk.c +@@ -372,13 +372,18 @@ static void prepare_rss_conf(pktio_entry_t *pktio_entry, + uint64_t rss_hf_capa; + pkt_dpdk_t *pkt_dpdk = pkt_priv(pktio_entry); + uint16_t port_id = pkt_dpdk->port_id; ++ int ret; + + memset(&pkt_dpdk->rss_conf, 0, sizeof(struct rte_eth_rss_conf)); + + if (!p->hash_enable) + return; + +- rte_eth_dev_info_get(port_id, &dev_info); ++ ret = rte_eth_dev_info_get(port_id, &dev_info); ++ if (ret) { ++ _ODP_ERR("Failed to read device info: %d\n", ret); ++ return; ++ } + rss_hf_capa = dev_info.flow_type_rss_offloads; + + /* Print debug info about unsupported hash protocols */ +@@ -842,7 +847,11 @@ static int dpdk_start(pktio_entry_t *pktio_entry) + pktio_entry->state == PKTIO_STATE_STOP_PENDING) + rte_eth_dev_stop(pkt_dpdk->port_id); + +- rte_eth_dev_info_get(port_id, &dev_info); ++ ret = rte_eth_dev_info_get(port_id, &dev_info); ++ if (ret) { ++ _ODP_ERR("Failed to read device info: %d\n", ret); ++ return -1; ++ } + + /* Pcap driver reconfiguration may fail if number of rx/tx queues is set to zero */ + if (!strncmp(dev_info.driver_name, PCAP_DRV_NAME, strlen(PCAP_DRV_NAME))) { +@@ -1258,7 +1267,11 @@ static uint32_t _dpdk_vdev_mtu(uint16_t port_id) + int ret; + int sockfd; + +- rte_eth_dev_info_get(port_id, &dev_info); ++ ret = rte_eth_dev_info_get(port_id, &dev_info); ++ if (ret) { ++ _ODP_ERR("Failed to read device info: %d\n", ret); ++ return 0; ++ } + if_indextoname(dev_info.if_index, ifr.ifr_name); + sockfd = socket(AF_INET, SOCK_DGRAM, 0); + ret = ioctl(sockfd, SIOCGIFMTU, &ifr); diff --git a/pkgs/by-name/od/odp-dpdk/package.nix b/pkgs/by-name/od/odp-dpdk/package.nix index 0c8ef1005e6f..5134a82a6987 100644 --- a/pkgs/by-name/od/odp-dpdk/package.nix +++ b/pkgs/by-name/od/odp-dpdk/package.nix @@ -29,13 +29,21 @@ stdenv.mkDerivation rec { hash = "sha256-9stWGupRSQwUXOdPEQ9Rhkim22p5BBA5Z+2JCYS7Za0="; }; + patches = [ + ./odp-dpdk_25.03.patch + ]; + nativeBuildInputs = [ autoreconfHook pkg-config ]; buildInputs = [ - dpdk + (dpdk.overrideAttrs { + patches = [ + ./dpdk_25.03.patch + ]; + }) libconfig libpcap numactl