net/enic: avoid error message when no advanced filtering
[dpdk.git] / examples / vhost_blk / blk.c
index 0d1e038..d082ab3 100644 (file)
@@ -15,7 +15,6 @@
 #include <string.h>
 #include <stddef.h>
 
-#include <rte_atomic.h>
 #include <rte_cycles.h>
 #include <rte_log.h>
 #include <rte_malloc.h>
@@ -50,7 +49,10 @@ vhost_bdev_blk_readwrite(struct vhost_block_dev *bdev,
 
        offset = lba_512 * 512;
 
-       for (i = 0; i < task->iovs_cnt; i++) {
+       /* iovs[0] is the head and iovs[iovs_cnt - 1] is the tail
+        * Middle is the data range
+        */
+       for (i = 1; i < task->iovs_cnt - 1; i++) {
                if (task->dxfer_dir == BLK_DIR_TO_DEV)
                        memcpy(bdev->data + offset, task->iovs[i].iov_base,
                               task->iovs[i].iov_len);
@@ -83,7 +85,7 @@ vhost_bdev_process_blk_commands(struct vhost_block_dev *bdev,
                                "%s - passed IO buffer is not multiple of 512b"
                                "(req_idx = %"PRIu16").\n",
                                task->req->type ? "WRITE" : "READ",
-                               task->head_idx);
+                               task->req_idx);
                        return VIRTIO_BLK_S_UNSUPP;
                }
 
@@ -98,14 +100,10 @@ vhost_bdev_process_blk_commands(struct vhost_block_dev *bdev,
                                "%s - passed IO buffer is not multiple of 512b"
                                "(req_idx = %"PRIu16").\n",
                                task->req->type ? "WRITE" : "READ",
-                               task->head_idx);
+                               task->req_idx);
                        return VIRTIO_BLK_S_UNSUPP;
                }
 
-               if (task->readtype) {
-                       fprintf(stderr, "type isn't right\n");
-                       return VIRTIO_BLK_S_IOERR;
-               }
                task->dxfer_dir = BLK_DIR_TO_DEV;
                vhost_bdev_blk_readwrite(bdev, task,
                                         task->req->sector, task->data_len);