New upstream version 18.11-rc3
[deb_dpdk.git] / lib / librte_eal / linuxapp / eal / eal_alarm.c
index c115e82..840ede7 100644 (file)
@@ -19,7 +19,6 @@
 #include <rte_launch.h>
 #include <rte_lcore.h>
 #include <rte_errno.h>
-#include <rte_malloc.h>
 #include <rte_spinlock.h>
 #include <eal_private.h>
 
@@ -31,7 +30,9 @@
 #define NS_PER_US 1000
 #define US_PER_MS 1000
 #define MS_PER_S 1000
+#ifndef US_PER_S
 #define US_PER_S (US_PER_MS * MS_PER_S)
+#endif
 
 #ifdef CLOCK_MONOTONIC_RAW /* Defined in glibc bits/time.h */
 #define CLOCK_TYPE_ID CLOCK_MONOTONIC_RAW
@@ -91,7 +92,7 @@ eal_alarm_callback(void *arg __rte_unused)
                rte_spinlock_lock(&alarm_list_lk);
 
                LIST_REMOVE(ap, next);
-               rte_free(ap);
+               free(ap);
        }
 
        if (!LIST_EMPTY(&alarm_list)) {
@@ -122,7 +123,7 @@ rte_eal_alarm_set(uint64_t us, rte_eal_alarm_callback cb_fn, void *cb_arg)
        if (us < 1 || us > (UINT64_MAX - US_PER_S) || cb_fn == NULL)
                return -EINVAL;
 
-       new_alarm = rte_zmalloc(NULL, sizeof(*new_alarm), 0);
+       new_alarm = calloc(1, sizeof(*new_alarm));
        if (new_alarm == NULL)
                return -ENOMEM;
 
@@ -196,7 +197,7 @@ rte_eal_alarm_cancel(rte_eal_alarm_callback cb_fn, void *cb_arg)
 
                        if (ap->executing == 0) {
                                LIST_REMOVE(ap, next);
-                               rte_free(ap);
+                               free(ap);
                                count++;
                        } else {
                                /* If calling from other context, mark that alarm is executing
@@ -220,7 +221,7 @@ rte_eal_alarm_cancel(rte_eal_alarm_callback cb_fn, void *cb_arg)
 
                                if (ap->executing == 0) {
                                        LIST_REMOVE(ap, next);
-                                       rte_free(ap);
+                                       free(ap);
                                        count++;
                                        ap = ap_prev;
                                } else if (pthread_equal(ap->executing_id, pthread_self()) == 0)