From nobody Tue Feb 10 05:26:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1523089839079173.3934068840383; Sat, 7 Apr 2018 01:30:39 -0700 (PDT) Received: from localhost ([::1]:40968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4jF8-0007pF-4o for importer@patchew.org; Sat, 07 Apr 2018 04:30:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47448) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f4jBW-0004uh-5G for qemu-devel@nongnu.org; Sat, 07 Apr 2018 04:26:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f4jBV-00027L-57 for qemu-devel@nongnu.org; Sat, 07 Apr 2018 04:26:54 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:40640) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f4jBU-00026u-UK for qemu-devel@nongnu.org; Sat, 07 Apr 2018 04:26:53 -0400 Received: by mail-pl0-x242.google.com with SMTP id x4-v6so2040160pln.7 for ; Sat, 07 Apr 2018 01:26:52 -0700 (PDT) Received: from VM_127_91_centos.localdomain ([119.28.195.137]) by smtp.gmail.com with ESMTPSA id y129sm18478558pgb.64.2018.04.07.01.26.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 07 Apr 2018 01:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=B5U0faMyZEUEcNNcwNhUXcCQmVCig7eD4qDHmGmnx5o=; b=rmF/Amm58ZLNrVw0jlnBs+yN07iZhfze3qMLytg0JFL2TINrjZTvnl3mmDgi4BQd0o Ate4OecMduriSRuY+MR8Sd/HWxQokfMXL1Glu9/kOGrQ4FfJcaeDTA9FB+Iog2HZ2OiE MRB1oQVkcAyRSETIURsE1z1IIqWpiABhmZdp0O6syLCJHs1RNC/FVGtter2w9SxzkP0w AoAjZ53Uljm7so8Sa4gLbnFvL7N29uOZWLFhVvemDfmLJWrgjt8IMOnajcbAPfnP8jjg ed1vzGBILfE1VdtP7LKufy1+J/mfS7EHw0MEX0xEz5lpEefdTV828ylx3GpuV7JgOLgj zy9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=B5U0faMyZEUEcNNcwNhUXcCQmVCig7eD4qDHmGmnx5o=; b=cpIOIQDlxNk2wXLa71PtBcyDB6nZi2KSrg8OZq4I+1/R/T6rxCigjLXfVBNjeBcqty B2esaf50LDFGx1KiMHoPIyizKuKheFjU93d3yIdwNf/gYNlelzjsp5gTxCMZlf22gNYf JA4qlvn2xQo5uW037AhBOrsLeKyLqOen7Vbi0bwR5pnuEDtyJxU3QU5zZF4eoSpDL9vv SmFvzsw0TrA7d/b/+JGQwK7w0A7s1OBl386+KcAPoUEV7uFEX9DBPOZVBYlN2r29gfMf Cd4WAeDcVKeryFGXxXRfncr9zkk/TEpSw3teXa3qEr7r/jl8JVom3NrYPnosLjI0geSV Vquw== X-Gm-Message-State: AElRT7GhenWravTxHqA02+BdW0EWGaasuL53j+1vWA9rZX2BMVSHNdnR +q+yHuabJZ+lFEGZmfQzYUc= X-Google-Smtp-Source: AIpwx48U5/lP3BLK2eUqty++twC6U8fJP9YergQOSyWgrOg8kP9Asvz3uQhQHr0MzTOz09uwVHpckQ== X-Received: by 2002:a17:902:102:: with SMTP id 2-v6mr30521433plb.48.1523089612222; Sat, 07 Apr 2018 01:26:52 -0700 (PDT) From: Lidong Chen X-Google-Original-From: Lidong Chen To: quintela@redhat.com, dgilbert@redhat.com Date: Sat, 7 Apr 2018 16:26:31 +0800 Message-Id: <1523089594-1422-3-git-send-email-lidongchen@tencent.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1523089594-1422-1-git-send-email-lidongchen@tencent.com> References: <1523089594-1422-1-git-send-email-lidongchen@tencent.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH 2/5] migration: add the interface to set get_return_path X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lidong Chen , adido@mellanox.com, qemu-devel@nongnu.org, licq@mellanox.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The default get_return_path function of iochannel does not work for RDMA live migration. So add the interface to set get_return_path. Signed-off-by: Lidong Chen --- migration/qemu-file-channel.c | 12 ++++++++---- migration/qemu-file.c | 10 ++++++++-- migration/qemu-file.h | 2 +- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/migration/qemu-file-channel.c b/migration/qemu-file-channel.c index e202d73..d4dd8c4 100644 --- a/migration/qemu-file-channel.c +++ b/migration/qemu-file-channel.c @@ -156,7 +156,6 @@ static const QEMUFileOps channel_input_ops =3D { .close =3D channel_close, .shut_down =3D channel_shutdown, .set_blocking =3D channel_set_blocking, - .get_return_path =3D channel_get_input_return_path, }; =20 =20 @@ -165,18 +164,23 @@ static const QEMUFileOps channel_output_ops =3D { .close =3D channel_close, .shut_down =3D channel_shutdown, .set_blocking =3D channel_set_blocking, - .get_return_path =3D channel_get_output_return_path, }; =20 =20 QEMUFile *qemu_fopen_channel_input(QIOChannel *ioc) { + QEMUFile *f; object_ref(OBJECT(ioc)); - return qemu_fopen_ops(ioc, &channel_input_ops); + f =3D qemu_fopen_ops(ioc, &channel_input_ops); + qemu_file_set_return_path(f, channel_get_input_return_path); + return f; } =20 QEMUFile *qemu_fopen_channel_output(QIOChannel *ioc) { + QEMUFile *f; object_ref(OBJECT(ioc)); - return qemu_fopen_ops(ioc, &channel_output_ops); + f =3D qemu_fopen_ops(ioc, &channel_output_ops); + qemu_file_set_return_path(f, channel_get_output_return_path); + return f; } diff --git a/migration/qemu-file.c b/migration/qemu-file.c index bb63c77..8acb574 100644 --- a/migration/qemu-file.c +++ b/migration/qemu-file.c @@ -36,6 +36,7 @@ struct QEMUFile { const QEMUFileOps *ops; const QEMUFileHooks *hooks; + QEMURetPathFunc *get_return_path; void *opaque; =20 int64_t bytes_xfer; @@ -72,10 +73,15 @@ int qemu_file_shutdown(QEMUFile *f) */ QEMUFile *qemu_file_get_return_path(QEMUFile *f) { - if (!f->ops->get_return_path) { + if (!f->get_return_path) { return NULL; } - return f->ops->get_return_path(f->opaque); + return f->get_return_path(f->opaque); +} + +void qemu_file_set_return_path(QEMUFile *f, QEMURetPathFunc *get_return_pa= th) +{ + f->get_return_path =3D get_return_path; } =20 bool qemu_file_mode_is_not_valid(const char *mode) diff --git a/migration/qemu-file.h b/migration/qemu-file.h index f4f356a..74210b7 100644 --- a/migration/qemu-file.h +++ b/migration/qemu-file.h @@ -102,7 +102,6 @@ typedef struct QEMUFileOps { QEMUFileCloseFunc *close; QEMUFileSetBlocking *set_blocking; QEMUFileWritevBufferFunc *writev_buffer; - QEMURetPathFunc *get_return_path; QEMUFileShutdownFunc *shut_down; } QEMUFileOps; =20 @@ -114,6 +113,7 @@ typedef struct QEMUFileHooks { } QEMUFileHooks; =20 QEMUFile *qemu_fopen_ops(void *opaque, const QEMUFileOps *ops); +void qemu_file_set_return_path(QEMUFile *f, QEMURetPathFunc *get_return_pa= th); void qemu_file_set_hooks(QEMUFile *f, const QEMUFileHooks *hooks); int qemu_get_fd(QEMUFile *f); int qemu_fclose(QEMUFile *f); --=20 1.8.3.1