Add support for DPDK 17.11
[samplevnf.git] / VNFs / DPPD-PROX / prox_port_cfg.c
index d9ce82d..bf8dbda 100644 (file)
 #include <rte_version.h>
 #include <rte_eth_ring.h>
 #include <rte_mbuf.h>
-#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0)) && (RTE_VERSION <= RTE_VERSION_NUM(17,5,0,1))
+#if (RTE_VERSION >= RTE_VERSION_NUM(17,11,0,0))
+#include <rte_bus_vdev.h>
+#else
+#if (RTE_VERSION > RTE_VERSION_NUM(17,5,0,2))
+#include <rte_dev.h>
+#else
+#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0))
 #include <rte_eth_null.h>
 #endif
+#endif
+#endif
 
 #include "prox_port_cfg.h"
 #include "prox_globals.h"
@@ -55,12 +63,17 @@ int prox_last_port_active(void)
        return ret;
 }
 
+#if RTE_VERSION >= RTE_VERSION_NUM(17,11,0,0)
+static int lsc_cb(__attribute__((unused)) uint16_t port_id, enum rte_eth_event_type type, __attribute__((unused)) void *param,
+       __attribute__((unused)) void *ret_param)
+#else
 #if RTE_VERSION >= RTE_VERSION_NUM(17,8,0,1)
 static int lsc_cb(__attribute__((unused)) uint8_t port_id, enum rte_eth_event_type type, __attribute__((unused)) void *param,
        __attribute__((unused)) void *ret_param)
 #else
 static void lsc_cb(__attribute__((unused)) uint8_t port_id, enum rte_eth_event_type type, __attribute__((unused)) void *param)
 #endif
+#endif
 {
        if (RTE_ETH_EVENT_INTR_LSC != type) {
 #if RTE_VERSION >= RTE_VERSION_NUM(17,8,0,1)
@@ -120,13 +133,17 @@ void init_rte_dev(int use_dummy_devices)
        PROX_PANIC(use_dummy_devices && nb_ports, "Can't use dummy devices while there are also real ports\n");
 
        if (use_dummy_devices) {
-#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0)) && (RTE_VERSION <= RTE_VERSION_NUM(17,5,0,1))
+#if (RTE_VERSION >= RTE_VERSION_NUM(2,1,0,0))
                nb_ports = prox_last_port_active() + 1;
                plog_info("Creating %u dummy devices\n", nb_ports);
 
                char port_name[32] = "0dummy_dev";
                for (uint32_t i = 0; i < nb_ports; ++i) {
+#if (RTE_VERSION > RTE_VERSION_NUM(17,5,0,1))
+                       rte_vdev_init(port_name, "size=ETHER_MIN_LEN,copy=0");
+#else
                        eth_dev_null_create(port_name, 0, ETHER_MIN_LEN, 0);
+#endif
                        port_name[0]++;
                }
 #else