* 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>
*/
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);
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);
if (!bdev)
return NULL;
- strncpy(bdev->name, bdev_name, sizeof(bdev->name));
- strncpy(bdev->product_name, bdev_serial, sizeof(bdev->product_name));
+ snprintf(bdev->name, sizeof(bdev->name), "%s", bdev_name);
+ snprintf(bdev->product_name, sizeof(bdev->product_name), "%s",
+ bdev_serial);
bdev->blocklen = blk_size;
bdev->blockcnt = blk_cnt;
bdev->write_cache = wce_enable;
signal(SIGINT, signal_handler);
- rte_vhost_driver_start(dev_pathname);
+ ret = rte_vhost_driver_start(dev_pathname);
+ if (ret < 0) {
+ fprintf(stderr, "Failed to start vhost driver.\n");
+ return -1;
+ }
/* loop for exit the application */
while (1)