summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-19 16:59:27 +0200
committerJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-19 17:13:33 +0200
commitf1b68ea1b3ef063426fcb39ddcf1048a824b56a3 (patch)
treee189f42df9e5fdd51e1232fc3400837903966787
parentb5b1be0279d2f00fde09c50ac18b9c9b9d351848 (diff)
downloaddpdk-burst-replay-f1b68ea1b3ef063426fcb39ddcf1048a824b56a3.zip
dpdk-burst-replay-f1b68ea1b3ef063426fcb39ddcf1048a824b56a3.tar.gz
dpdk-burst-replay-f1b68ea1b3ef063426fcb39ddcf1048a824b56a3.tar.xz
Fix compilation if DPDK < 18.05.
-rw-r--r--src/dpdk.c2
-rw-r--r--src/main.h5
2 files changed, 7 insertions, 0 deletions
diff --git a/src/dpdk.c b/src/dpdk.c
index 6d52dfa..d184859 100644
--- a/src/dpdk.c
+++ b/src/dpdk.c
@@ -239,6 +239,7 @@ int init_dpdk_eal_mempool(const struct cmd_opts* opts,
if (dpdk->pktmbuf_pool == NULL) {
fprintf(stderr, "DPDK: RTE Mempool creation failed (%s)\n",
rte_strerror(rte_errno));
+#if API_AT_LEAST_AS_RECENT_AS(18, 05)
if (rte_errno == ENOMEM
&& (dpdk->nb_mbuf * dpdk->mbuf_sz /1024/1024) > RTE_MAX_MEM_MB_PER_LIST)
fprintf(stderr, "Your version of DPDK was configured to use at maximum"
@@ -246,6 +247,7 @@ int init_dpdk_eal_mempool(const struct cmd_opts* opts,
"Try to recompile DPDK by setting CONFIG_RTE_MAX_MEM_MB_PER_LIST"
" according to your needs.\n", RTE_MAX_MEM_MB_PER_LIST,
dpdk->nb_mbuf * dpdk->mbuf_sz /1024/1024);
+#endif /* API_AT_LEAST_AS_RECENT_AS(18, 05) */
return (rte_errno);
}
return (0);
diff --git a/src/main.h b/src/main.h
index 7c3dac8..4b47534 100644
--- a/src/main.h
+++ b/src/main.h
@@ -31,6 +31,11 @@
&& defined RTE_VER_MONTH && RTE_VER_MONTH < month) \
|| defined RTE_VER_YEAR && RTE_VER_YEAR < year)
+#define API_AT_LEAST_AS_RECENT_AS(year, month) \
+ ((defined RTE_VER_YEAR && RTE_VER_YEAR == year \
+ && defined RTE_VER_MONTH && RTE_VER_MONTH >= month) \
+ || defined RTE_VER_YEAR && RTE_VER_YEAR >= year)
+
/* struct to store the command line args */
struct cmd_opts {
char** pcicards;