From patchwork Fri Aug 5 22:00:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114683 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8ABC2A00C4; Sat, 6 Aug 2022 00:01:05 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A512B42C45; Sat, 6 Aug 2022 00:00:41 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 35B2D4282D for ; Sat, 6 Aug 2022 00:00:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659736837; x=1691272837; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=mvqdhbjyhQGS+1VK6E9SEmTdMFSWl8K3B6tpeE4gkV8=; b=GX/6YNzlJF7HEe15l35zOKlf0Ry5yFqw7nxOWTUEaQcT8kR/b2lMXrMh Wd24Z7pxKDvECFqIhZ7kb+eYx3AooBfuoj44EGikabork6KdIbl94eNlL d6nW1ZsHUvHmRymlS0lyEkDOILHrinXHXdyqtLouK+5UQyQTHRVjqoaHu T0xse3XuHcz703AqCuK91YcvA97mPEAQ7T95FAnkSh2yPsRwGz8SFMtB6 CZ1hTfKAEWMZlM0BAD3Q5670VI2HWRNUH4NdByc+ZSS55F03E7JC2AcmN X4AdXPwyBKW02w2CkgvDuChawitZFwIsU47vkrwCrLJbSUKWLQMJjUMSi w==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="290308824" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290308824" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2022 15:00:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137585" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com.) ([10.237.223.157]) by FMSMGA003.fm.intel.com with ESMTP; 05 Aug 2022 15:00:35 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 08/10] port: prevent unnecessary flush for the ring output port Date: Fri, 5 Aug 2022 22:00:27 +0000 Message-Id: <20220805220029.1096212-9-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220805220029.1096212-1-cristian.dumitrescu@intel.com> References: <20220805220029.1096212-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Do not flush the buffered packets unnecessarily when a burst was sent since the last flush call. Signed-off-by: Cristian Dumitrescu --- lib/port/rte_swx_port_ring.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/port/rte_swx_port_ring.c b/lib/port/rte_swx_port_ring.c index 7cdcd4b638..d0058087bd 100644 --- a/lib/port/rte_swx_port_ring.c +++ b/lib/port/rte_swx_port_ring.c @@ -173,6 +173,7 @@ struct writer { struct rte_mbuf **pkts; int n_pkts; uint32_t n_bytes; + int flush_flag; }; static void * @@ -253,6 +254,7 @@ __writer_flush(struct writer *p) p->stats.n_bytes_drop = n_bytes_drop_total + n_bytes_drop; p->n_pkts = 0; p->n_bytes = 0; + p->flush_flag = 0; TRACE("[Ring %s] Buffered packets flushed: %d out, %d dropped\n", p->params.name, @@ -363,8 +365,10 @@ writer_flush(void *port) { struct writer *p = port; - if (p->n_pkts) + if (p->n_pkts && p->flush_flag) __writer_flush(p); + + p->flush_flag = 1; } static void