aboutsummaryrefslogtreecommitdiff
path: root/block/iscsi.c
diff options
context:
space:
mode:
authorRoy Shterman <roysh@mellanox.com>2016-10-09 11:14:56 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 11:30:55 +0200
commite0ae49871ae697b5d1a8853e79cbee35fda2145b (patch)
tree334f074105395bd6dd64a8310d16a097388a8af7 /block/iscsi.c
parent583ec22e2385fda19e2207cab1b688b816d95de0 (diff)
block/iscsi: Adding new iSER transport layer option
iSER is a new transport layer supported in Libiscsi, iSER provides a zero-copy RDMA capable interface that can improve performance. In order to use the new iSER transport one need to have RDMA supported HW and to choose iser as the protocol name in Libiscsi URI. For now iSER memory buffers are pre-allocated and pre-registered, hence in order to work with iSER from QEMU, one need to enable MEMLOCK attribute in the VM to be large enough for all iSER buffers and RDMA resources. Signed-off-by: Roy Shterman <roysh@mellanox.com> Message-Id: <1476000896-18632-3-git-send-email-roysh@mellanox.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'block/iscsi.c')
-rw-r--r--block/iscsi.c47
1 files changed, 46 insertions, 1 deletions
diff --git a/block/iscsi.c b/block/iscsi.c
index e9bf5db5c5..71bd523df5 100644
--- a/block/iscsi.c
+++ b/block/iscsi.c
@@ -1644,7 +1644,13 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
ret = -ENOMEM;
goto out;
}
-
+#if LIBISCSI_API_VERSION >= (20160603)
+ if (iscsi_init_transport(iscsi, iscsi_url->transport)) {
+ error_setg(errp, ("Error initializing transport."));
+ ret = -EINVAL;
+ goto out;
+ }
+#endif
if (iscsi_set_targetname(iscsi, iscsi_url->target)) {
error_setg(errp, "iSCSI: Failed to set target name.");
ret = -EINVAL;
@@ -2048,9 +2054,48 @@ static BlockDriver bdrv_iscsi = {
.bdrv_attach_aio_context = iscsi_attach_aio_context,
};
+#if LIBISCSI_API_VERSION >= (20160603)
+static BlockDriver bdrv_iser = {
+ .format_name = "iser",
+ .protocol_name = "iser",
+
+ .instance_size = sizeof(IscsiLun),
+ .bdrv_needs_filename = true,
+ .bdrv_file_open = iscsi_open,
+ .bdrv_close = iscsi_close,
+ .bdrv_create = iscsi_create,
+ .create_opts = &iscsi_create_opts,
+ .bdrv_reopen_prepare = iscsi_reopen_prepare,
+ .bdrv_reopen_commit = iscsi_reopen_commit,
+ .bdrv_invalidate_cache = iscsi_invalidate_cache,
+
+ .bdrv_getlength = iscsi_getlength,
+ .bdrv_get_info = iscsi_get_info,
+ .bdrv_truncate = iscsi_truncate,
+ .bdrv_refresh_limits = iscsi_refresh_limits,
+
+ .bdrv_co_get_block_status = iscsi_co_get_block_status,
+ .bdrv_co_pdiscard = iscsi_co_pdiscard,
+ .bdrv_co_pwrite_zeroes = iscsi_co_pwrite_zeroes,
+ .bdrv_co_readv = iscsi_co_readv,
+ .bdrv_co_writev_flags = iscsi_co_writev_flags,
+ .bdrv_co_flush_to_disk = iscsi_co_flush,
+
+#ifdef __linux__
+ .bdrv_aio_ioctl = iscsi_aio_ioctl,
+#endif
+
+ .bdrv_detach_aio_context = iscsi_detach_aio_context,
+ .bdrv_attach_aio_context = iscsi_attach_aio_context,
+};
+#endif
+
static void iscsi_block_init(void)
{
bdrv_register(&bdrv_iscsi);
+#if LIBISCSI_API_VERSION >= (20160603)
+ bdrv_register(&bdrv_iser);
+#endif
}
block_init(iscsi_block_init);