From nobody Mon Feb 9 08:10:29 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1623141243; cv=none; d=zohomail.com; s=zohoarc; b=EWkGVVOSRvGQpF3iu5EddeizWfoPc9qFYKmMtO3aZ2BowjhEgjnCgVzbmfZfUa+ZqD6em5+p8oa69y7URvPvIVnMqzDVW12zt6BUxskFpOBiGMb4j2PcT8prGplXRrCaTE93zMmbf/SHMISqjkn7KFtXgw77FRbiO3JYF9fknLc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623141243; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MitEE8++cyFwIKhbz3DOcOb+v8j7Uamsgv1x3+0CpGc=; b=VyTJiyY1XI8qLV173dnxo+ytMIdxviSKaW0SfuHzjXdGjmLsnnhx9wheOMXG6kwlHpxkUWZK/QrjUGFotX1xCQ+95WSc/I2hjx5Kc7sPDVsesWlgHUlxPjeOM3+nBGl4O03Prks1R+O0EZnf+oExiYBKnBU/OtEMuTFSvpIc2qk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1623141243778867.8455171165571; Tue, 8 Jun 2021 01:34:03 -0700 (PDT) Received: from localhost ([::1]:58120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lqXBS-0006fl-Gc for importer@patchew.org; Tue, 08 Jun 2021 04:34:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35416) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8R-0003sO-PP for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:30:59 -0400 Received: from mga12.intel.com ([192.55.52.136]:25338) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lqX8P-0000EH-EG for qemu-devel@nongnu.org; Tue, 08 Jun 2021 04:30:55 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:46 -0700 Received: from unknown (HELO localhost.localdomain) ([10.239.13.19]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 01:30:44 -0700 IronPort-SDR: FWPuwzNA/fR3cPwqzOITRmyFT29I0JsL02DJEtBtfz9b8pyc6ONWCUYsc/Ap2p6n+N1su5FFZe tkNSBSF2i6ww== X-IronPort-AV: E=McAfee;i="6200,9189,10008"; a="184485404" X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="184485404" IronPort-SDR: BAE7xntlEDvS4kTL7uZ14gUH12qIwPBScty4HXKHuXk+vnGh/LTgG13CZJX7dceknsUFAOiHGB sL/GxNvcFnrw== X-IronPort-AV: E=Sophos;i="5.83,257,1616482800"; d="scan'208";a="481862922" From: Zhang Chen To: Jason Wang , qemu-dev Subject: [PATCH 3/7] Optimize the function of filter_send Date: Tue, 8 Jun 2021 16:23:27 +0800 Message-Id: <20210608082331.1949117-4-chen.zhang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608082331.1949117-1-chen.zhang@intel.com> References: <20210608082331.1949117-1-chen.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=192.55.52.136; envelope-from=chen.zhang@intel.com; helo=mga12.intel.com X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lukas Straub , Li Zhijian , "Rao, Lei" , Li Zhijian , Zhang Chen , Zhang Chen Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: "Rao, Lei" The iov_size has been calculated in filter_send(). we can directly return the size.In this way, this is no need to repeat calculations in filter_redirector_receive_iov(); Signed-off-by: Lei Rao Reviewed-by: Li Zhijian Reviewed-by: Zhang Chen Reviewed-by: Lukas Straub Tested-by: Lukas Straub Signed-off-by: Zhang Chen --- net/filter-mirror.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/filter-mirror.c b/net/filter-mirror.c index f8e65007c0..f20240cc9f 100644 --- a/net/filter-mirror.c +++ b/net/filter-mirror.c @@ -88,7 +88,7 @@ static int filter_send(MirrorState *s, goto err; } =20 - return 0; + return size; =20 err: return ret < 0 ? ret : -EIO; @@ -159,7 +159,7 @@ static ssize_t filter_mirror_receive_iov(NetFilterState= *nf, int ret; =20 ret =3D filter_send(s, iov, iovcnt); - if (ret) { + if (ret < 0) { error_report("filter mirror send failed(%s)", strerror(-ret)); } =20 @@ -182,10 +182,10 @@ static ssize_t filter_redirector_receive_iov(NetFilte= rState *nf, =20 if (qemu_chr_fe_backend_connected(&s->chr_out)) { ret =3D filter_send(s, iov, iovcnt); - if (ret) { + if (ret < 0) { error_report("filter redirector send failed(%s)", strerror(-re= t)); } - return iov_size(iov, iovcnt); + return ret; } else { return 0; } --=20 2.25.1