From nobody Mon Feb 9 10:58:06 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=1616124854; cv=none; d=zohomail.com; s=zohoarc; b=MPleF0ef1OT1qT30i2NLoollxSschFrgGuuQSr3OaaGiik2xb90o45YcCw0krTByhaQLc/dDUiUdENp/GWKn75mkF5ZnlELnUNlwSM6ykKTeN/W6NulLNlVMegLHQs7FYHyjwbMSgJob7Upf3aivnUZ3BCEHYz3NejhrujfMG9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616124854; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=dNNd25QiEN2ATr1KaPTXaGFIhPqB7EECp92ohogMsVo=; b=RGkQg8x6wKlfZAkR/fZE8zXzi8sTcWLmOXebNQvqNyF8W6/stkt/+0anHFr8pbB4uCntt7fD77O7spYdJeYK3v4bRdQ+wzGbmok9lY67EOoaPoA/Y4OveyQNATUF//yLS2tpvLyAsOnzlR1UxU7oNxoJoZoMlDzqNfjK3e8skks= 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 1616124854359180.0867015423927; Thu, 18 Mar 2021 20:34:14 -0700 (PDT) Received: from localhost ([::1]:59168 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN5tt-00057q-BF for importer@patchew.org; Thu, 18 Mar 2021 23:34:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34056) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qm-0000bn-CM for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:00 -0400 Received: from mga12.intel.com ([192.55.52.136]:34574) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN5qj-0002um-9n for qemu-devel@nongnu.org; Thu, 18 Mar 2021 23:31:00 -0400 Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Mar 2021 20:30:55 -0700 Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([10.240.192.103]) by fmsmga005.fm.intel.com with ESMTP; 18 Mar 2021 20:30:51 -0700 IronPort-SDR: PIEj+AGEKGCms8PZmc1F5F2pGaG0KtFl1DCEiYCsFnlU4vY7uHX2QSN+sXV2Xs7rBJ2ySjyFzx UIsT7lxZxmrA== X-IronPort-AV: E=McAfee;i="6000,8403,9927"; a="169117080" X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="169117080" IronPort-SDR: r99VZ1SnJYzDKg1GlZMbVHhnoJAMN59L1nbv3Eo/0muV36UqsSNBgpC/VsRy2VCkO9jOchpfyO dTzbvgpSyE6g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,259,1610438400"; d="scan'208";a="606448879" From: leirao To: chen.zhang@intel.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, quintela@redhat.com, dgilbert@redhat.com, pbonzini@redhat.com, lukasstraub2@web.de Subject: [PATCH v3 03/10] Optimize the function of filter_send Date: Fri, 19 Mar 2021 11:07:41 +0800 Message-Id: <1616123268-89517-4-git-send-email-lei.rao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1616123268-89517-1-git-send-email-lei.rao@intel.com> References: <1616123268-89517-1-git-send-email-lei.rao@intel.com> 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=lei.rao@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: "Rao, Lei" , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 --- 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 f8e6500..f20240c 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 1.8.3.1