qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Roy Shterman <roysh@mellanox.com>
Subject: [Qemu-devel] [PULL 03/50] block/iscsi: Introducing new zero-copy API
Date: Mon, 24 Oct 2016 15:46:48 +0200	[thread overview]
Message-ID: <1477316855-42218-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1477316855-42218-1-git-send-email-pbonzini@redhat.com>

From: Roy Shterman <roysh@mellanox.com>

A new API to deploy zero-copy command submission. The new API takes I/O
vectors list and number of I/O vectors to submit as input parameters
when initiating the command. New API must be used if working with
iSER transport option.

Signed-off-by: Roy Shterman <roysh@mellanox.com>
Message-Id: <1476000896-18632-2-git-send-email-roysh@mellanox.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 block/iscsi.c | 42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/block/iscsi.c b/block/iscsi.c
index 46ddc35..e9bf5db 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -202,6 +202,10 @@ static inline unsigned exp_random(double mean)
 #define SCSI_SENSE_ASCQ_PARAMETER_LIST_LENGTH_ERROR        0x1a00
 #endif
 
+#ifndef LIBISCSI_API_VERSION
+#define LIBISCSI_API_VERSION 20130701
+#endif
+
 static int iscsi_translate_sense(struct scsi_sense *sense)
 {
     int ret;
@@ -592,6 +596,20 @@ iscsi_co_writev_flags(BlockDriverState *bs, int64_t sector_num, int nb_sectors,
     iscsi_co_init_iscsitask(iscsilun, &iTask);
 retry:
     if (iscsilun->use_16_for_rw) {
+#if LIBISCSI_API_VERSION >= (20160603)
+        iTask.task = iscsi_write16_iov_task(iscsilun->iscsi, iscsilun->lun, lba,
+                                            NULL, num_sectors * iscsilun->block_size,
+                                            iscsilun->block_size, 0, 0, fua, 0, 0,
+                                            iscsi_co_generic_cb, &iTask,
+                                            (struct scsi_iovec *)iov->iov, iov->niov);
+    } else {
+        iTask.task = iscsi_write10_iov_task(iscsilun->iscsi, iscsilun->lun, lba,
+                                            NULL, num_sectors * iscsilun->block_size,
+                                            iscsilun->block_size, 0, 0, fua, 0, 0,
+                                            iscsi_co_generic_cb, &iTask,
+                                            (struct scsi_iovec *)iov->iov, iov->niov);
+    }
+#else
         iTask.task = iscsi_write16_task(iscsilun->iscsi, iscsilun->lun, lba,
                                         NULL, num_sectors * iscsilun->block_size,
                                         iscsilun->block_size, 0, 0, fua, 0, 0,
@@ -602,11 +620,14 @@ retry:
                                         iscsilun->block_size, 0, 0, fua, 0, 0,
                                         iscsi_co_generic_cb, &iTask);
     }
+#endif
     if (iTask.task == NULL) {
         return -ENOMEM;
     }
+#if LIBISCSI_API_VERSION < (20160603)
     scsi_task_set_iov_out(iTask.task, (struct scsi_iovec *) iov->iov,
                           iov->niov);
+#endif
     while (!iTask.complete) {
         iscsi_set_events(iscsilun);
         qemu_coroutine_yield();
@@ -789,6 +810,21 @@ static int coroutine_fn iscsi_co_readv(BlockDriverState *bs,
     iscsi_co_init_iscsitask(iscsilun, &iTask);
 retry:
     if (iscsilun->use_16_for_rw) {
+#if LIBISCSI_API_VERSION >= (20160603)
+        iTask.task = iscsi_read16_iov_task(iscsilun->iscsi, iscsilun->lun, lba,
+                                           num_sectors * iscsilun->block_size,
+                                           iscsilun->block_size, 0, 0, 0, 0, 0,
+                                           iscsi_co_generic_cb, &iTask,
+                                           (struct scsi_iovec *)iov->iov, iov->niov);
+    } else {
+        iTask.task = iscsi_read10_iov_task(iscsilun->iscsi, iscsilun->lun, lba,
+                                           num_sectors * iscsilun->block_size,
+                                           iscsilun->block_size,
+                                           0, 0, 0, 0, 0,
+                                           iscsi_co_generic_cb, &iTask,
+                                           (struct scsi_iovec *)iov->iov, iov->niov);
+    }
+#else
         iTask.task = iscsi_read16_task(iscsilun->iscsi, iscsilun->lun, lba,
                                        num_sectors * iscsilun->block_size,
                                        iscsilun->block_size, 0, 0, 0, 0, 0,
@@ -800,11 +836,13 @@ retry:
                                        0, 0, 0, 0, 0,
                                        iscsi_co_generic_cb, &iTask);
     }
+#endif
     if (iTask.task == NULL) {
         return -ENOMEM;
     }
+#if LIBISCSI_API_VERSION < (20160603)
     scsi_task_set_iov_in(iTask.task, (struct scsi_iovec *) iov->iov, iov->niov);
-
+#endif
     while (!iTask.complete) {
         iscsi_set_events(iscsilun);
         qemu_coroutine_yield();
@@ -1649,7 +1687,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
 
     /* timeout handling is broken in libiscsi before 1.15.0 */
     timeout = parse_timeout(iscsi_url->target);
-#if defined(LIBISCSI_API_VERSION) && LIBISCSI_API_VERSION >= 20150621
+#if LIBISCSI_API_VERSION >= 20150621
     iscsi_set_timeout(iscsi, timeout);
 #else
     if (timeout) {
-- 
1.8.3.1

  parent reply	other threads:[~2016-10-24 13:47 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-24 13:46 [Qemu-devel] [PULL 00/50] Miscellaneous patches for 2016-10-24 Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 01/50] kvm-all: don't use stale dbg_data->cpu Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 02/50] rbd: shift byte count as a 64-bit value Paolo Bonzini
2016-10-24 13:46 ` Paolo Bonzini [this message]
2016-10-24 13:46 ` [Qemu-devel] [PULL 04/50] block/iscsi: Adding new iSER transport layer option Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 05/50] Put the copyright information on a separate line Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 06/50] atomic: introduce smp_mb_acquire and smp_mb_release Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 07/50] qemu-thread: use acquire/release to clarify semantics of QemuEvent Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 08/50] rcu: simplify memory barriers Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 09/50] atomic: base mb_read/mb_set on load-acquire and store-release Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 10/50] qht-bench: relax test_start/stop atomic accesses Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 11/50] test-i386: fix bitrot for 64-bit Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 12/50] target-i386: fix 32-bit addresses in LEA Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 13/50] tcg: try sti when moving a constant into a dead memory temp Paolo Bonzini
2016-10-24 13:46 ` [Qemu-devel] [PULL 14/50] memory: eliminate global MemoryListeners Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 15/50] memory: add a per-AddressSpace list of listeners Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 16/50] memory: optimize memory_global_dirty_log_sync Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 17/50] memory: optimize memory_region_sync_dirty_bitmap Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 18/50] char: serial: check divider value against baud base Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 19/50] char.h: misc doc fix Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 20/50] rng: remove unused included header Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 21/50] char: remove use-after-free on win-stdio Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 22/50] ringbuf: fix chr_write return value Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 23/50] sun4uv: fix serial initialization regression Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 24/50] malta: replace chr init by CHR_EVENT_OPENED handler Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 25/50] char: remove init callback Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 26/50] xilinx: fix buffer overflow on realize Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 27/50] mux: split mux_chr_update_read_handler() Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 28/50] char: introduce CharBackend Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 29/50] char: start converting mux driver to use CharBackend Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 30/50] char: replace PROP_CHR with CharBackend Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 31/50] char: remaining switch to CharBackend in frontend Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 32/50] char: rename some frontend functions Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 33/50] colo: claim in find_and_check_chardev Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 34/50] char: use qemu_chr_fe* functions with CharBackend argument Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 35/50] char: fold qemu_chr_set_handlers in qemu_chr_fe_set_handlers Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 36/50] vhost-user: only initialize queue 0 CharBackend Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 37/50] char: replace qemu_chr_claim/release with qemu_chr_fe_init/deinit Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 38/50] char: make some qemu_chr_fe skip if no driver Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 39/50] tests: start chardev unit tests Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 40/50] char: move front end handlers in CharBackend Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 41/50] char: rename chr_close/chr_free Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 42/50] char: remove explicit_fe_open, use a set_handlers argument Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 43/50] char: move fe_open in CharBackend Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 44/50] char: remove unused CHR_EVENT_FOCUS Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 45/50] char: use an enum for CHR_EVENT Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 46/50] char: remove unused qemu_chr_fe_event Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 47/50] char: replace avail_connections Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 48/50] char: use common error path in qmp_chardev_add Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 49/50] char: remove explicit_be_open from CharDriverState Paolo Bonzini
2016-10-24 13:47 ` [Qemu-devel] [PULL 50/50] exec.c: workaround regression caused by alignment change in d2f39ad Paolo Bonzini
2016-10-24 15:11 ` [Qemu-devel] [PULL 00/50] Miscellaneous patches for 2016-10-24 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1477316855-42218-4-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=roysh@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).