summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-11 10:11:25 +0200
committerJonathan Ribas <jonathan.ribas@fraudbuster.mobi>2019-04-11 10:11:25 +0200
commitf03492ba518f789b515141d762b24add50c41d79 (patch)
tree135ce62f8fa4fcb7237f3156bbf36f765d05d441
parentb6a602983716bb8ec2b34a288841c4ddafe0f210 (diff)
downloaddpdk-burst-replay-f03492ba518f789b515141d762b24add50c41d79.zip
dpdk-burst-replay-f03492ba518f789b515141d762b24add50c41d79.tar.gz
dpdk-burst-replay-f03492ba518f789b515141d762b24add50c41d79.tar.xz
Add a macro to facilitate the support of different API versions.
-rw-r--r--src/dpdk.c3
-rw-r--r--src/main.h5
2 files changed, 6 insertions, 2 deletions
diff --git a/src/dpdk.c b/src/dpdk.c
index 481e483..e86314c 100644
--- a/src/dpdk.c
+++ b/src/dpdk.c
@@ -185,8 +185,7 @@ int init_dpdk_eal_mempool(const struct cmd_opts* opts,
return (EINVAL);
/* API BREAKAGE ON 17.05 */
-#if (defined RTE_VER_YEAR && RTE_VER_YEAR == 17 && defined RTE_VER_MONTH && RTE_VER_MONTH < 05) \
- || defined RTE_VER_YEAR && RTE_VER_YEAR < 17
+#if API_OLDEST_THAN(17, 05)
rte_set_log_level(RTE_LOG_ERR);
#else /* if DPDK >= 17.05 */
rte_log_set_global_level(RTE_LOG_ERR);
diff --git a/src/main.h b/src/main.h
index 13b730c..7f388dc 100644
--- a/src/main.h
+++ b/src/main.h
@@ -26,6 +26,11 @@
#define max(x, y) (x > y ? x : y)
#endif /* max */
+#define API_OLDEST_THAN(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;