telemetry: fix missing header include
[dpdk.git] / examples / vhost_blk / vhost_blk.c
index 8f5d61a..7ea6086 100644 (file)
@@ -2,6 +2,12 @@
  * Copyright(c) 2010-2019 Intel Corporation
  */
 
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+#include <pthread.h>
+#include <sched.h>
+
 #include <stdint.h>
 #include <unistd.h>
 #include <stdbool.h>
@@ -80,9 +86,9 @@ enqueue_task(struct vhost_blk_task *task)
         */
        used->ring[used->idx & (vq->vring.size - 1)].id = task->req_idx;
        used->ring[used->idx & (vq->vring.size - 1)].len = task->data_len;
-       rte_smp_mb();
+       rte_atomic_thread_fence(__ATOMIC_SEQ_CST);
        used->idx++;
-       rte_smp_mb();
+       rte_atomic_thread_fence(__ATOMIC_SEQ_CST);
 
        rte_vhost_clr_inflight_desc_split(task->ctrlr->vid,
                vq->id, used->idx, task->req_idx);
@@ -106,12 +112,12 @@ enqueue_task_packed(struct vhost_blk_task *task)
        desc->id = task->buffer_id;
        desc->addr = 0;
 
-       rte_smp_mb();
+       rte_atomic_thread_fence(__ATOMIC_SEQ_CST);
        if (vq->used_wrap_counter)
                desc->flags |= VIRTQ_DESC_F_AVAIL | VIRTQ_DESC_F_USED;
        else
                desc->flags &= ~(VIRTQ_DESC_F_AVAIL | VIRTQ_DESC_F_USED);
-       rte_smp_mb();
+       rte_atomic_thread_fence(__ATOMIC_SEQ_CST);
 
        rte_vhost_clr_inflight_desc_packed(task->ctrlr->vid, vq->id,
                                           task->inflight_idx);