From patchwork Fri Aug 5 22:00:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114682 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 99506A00C4; Sat, 6 Aug 2022 00:01:00 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9A4042C38; Sat, 6 Aug 2022 00:00:40 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 978AB40697 for ; Sat, 6 Aug 2022 00:00:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659736836; x=1691272836; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=/PMF7LK3Rss+u7W5zvSXLq6pGHQrQX8k9ZYCmTiY9q0=; b=DxoPLhaWj3/fNWwWZSVJAKmDAS/pycinEhurFpwVIuGFwzE8MRdDFuPA /Fmd5wdFDLZi2oJqq/k8XJi0FYmpAlsFX3CKMRYhl1JphOgbCZItkrc8P 3IVVBvKlVETZnUB4J6E2XvBtXBQBjksVR3sj4vRCKj5v+w2F4PNxnfYTq 4Gx5IPAyLyTXjBk/UsBnyoW1hf0Y7ktPHJL9SC0Z+Xf1q8/KobTAQvCAQ ctWVesENfs90qlthFEYUhAU0t/EGI1O+ZloemSh6gisR21rPCzVrGLVa4 xt5XPqSuXVKnC6R7EY3SxZ5mCiUPDhRGS1YXSY8sAzpi2rhOwNfbNwpc0 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="273348509" X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="273348509" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2022 15:00:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137542" 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:31 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 01/10] port: add output port packet drop statistics couters Date: Fri, 5 Aug 2022 22:00:20 +0000 Message-Id: <20220805220029.1096212-2-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 Add packet drop statistics counters for the output ports. Required by the non-blocking output port behavior where the packets that cannot be sent at the time of the operation are dropped as opposed to the send operation being retried potentially forever for the same packets. Signed-off-by: Cristian Dumitrescu --- lib/port/rte_swx_port.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/port/rte_swx_port.h b/lib/port/rte_swx_port.h index 5e29100f59..1dbd95ae87 100644 --- a/lib/port/rte_swx_port.h +++ b/lib/port/rte_swx_port.h @@ -185,12 +185,18 @@ typedef void /** Output port statistics counters. */ struct rte_swx_port_out_stats { - /** Number of packets. */ + /** Number of packets successfully transmitted. */ uint64_t n_pkts; - /** Number of bytes. */ + /** Number of bytes successfully transmitted. */ uint64_t n_bytes; + /** Number of packets dropped. */ + uint64_t n_pkts_drop; + + /** Number of bytes dropped. */ + uint64_t n_bytes_drop; + /** Number of packets cloned successfully. */ uint64_t n_pkts_clone; From patchwork Fri Aug 5 22:00:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114685 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 63145A00C4; Sat, 6 Aug 2022 00:01:18 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9CEC742C9C; Sat, 6 Aug 2022 00:00:44 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id AECA640697 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=KwJoE32OviBspvMQplNuoy8xoKheS55ft5ouYGAvgJE=; b=JIQITuteZV5vQCz7rBeR8z0R2hOAPMBC6nysJE3sqDGsCS467iZPgo95 o4GZPFuRd7l3dVayv2OXeZ8RHIwG/MFYMWJfY+9M1Ab9i5ukogLRRiMmZ u7TX/0xlu7BpoQpRBJ1GPqQfoJWc9eLWYDu4nSGm3eNd7/P0PVEfF1oFv +UBjceLR3cV2Y2wSjD0fsA+rpRTEXABTfDRIvKmSnAB8ky3Trx0uyLvQ0 3D3eqKMmyePkXLzHbosGqECKEy9CkaTRDTdFDC2c41aCLMz1kqVWHOzcU PGli9j5gZExdXOhjrbxSpuPJPnifh9Qihkwz9zQt9eacOoS1MWWxqvpFY w==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="273348511" X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="273348511" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2022 15:00:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137546" 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:31 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 02/10] port: adjust the sink port counters Date: Fri, 5 Aug 2022 22:00:21 +0000 Message-Id: <20220805220029.1096212-3-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 The sink port is tasked to drop all packets, hence the packet and byte counters should be named to reflect the drop operation. Signed-off-by: Cristian Dumitrescu --- lib/port/rte_swx_port_source_sink.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/port/rte_swx_port_source_sink.c b/lib/port/rte_swx_port_source_sink.c index d3cf42c30b..757a2c4a2e 100644 --- a/lib/port/rte_swx_port_source_sink.c +++ b/lib/port/rte_swx_port_source_sink.c @@ -299,8 +299,8 @@ sink_pkt_tx(void *port, struct rte_swx_pkt *pkt) m->pkt_len = pkt->length; m->data_off = (uint16_t)pkt->offset; - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; + p->stats.n_pkts_drop++; + p->stats.n_bytes_drop += pkt->length; #ifdef RTE_PORT_PCAP if (p->f_dump) { @@ -335,8 +335,8 @@ __sink_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_len m->pkt_len = pkt->length; m->data_off = (uint16_t)pkt->offset; - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; + p->stats.n_pkts_drop++; + p->stats.n_bytes_drop += pkt->length; p->stats.n_pkts_clone++; #ifdef RTE_PORT_PCAP From patchwork Fri Aug 5 22:00:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114687 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 D9FBAA00C4; Sat, 6 Aug 2022 00:01:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A98B942C62; Sat, 6 Aug 2022 00:00:46 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id D83D742BCA 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=1659736838; x=1691272838; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=huPtsityDprM+5RxCo7OAXHI1TTkmIEmvzv8bfl+9lQ=; b=AZDFbxJ5mOoN46Up2gYaHUhAAIqE9h+z+R6tyBZbGqdQqEz9/ZJfEGdC pjPd+IMSY0mRuZVDKtSXWu/q+c4aVojK1YUdvZFs/AsEaCl02D+AEpfPr e5vX4L9VdGLpf2jKd3gM18fbhQFi7Av+r20LB86MLj/t3UVViPh6xI6Xw m5flbd7n21mhvg3YR2GiBcnCwqUUh1oNQkvM8RSnOqy7iobVRbLkBsIaJ Pw0IaffoLANEAsXsvGoFY0BykamtYvA8EWPbrPrj0YpM3XgDFsOdyhctj D/Z0aSFgTiRptJWbYuQI8scVoQE12b6DKmvf9QFndJO2kJZlMIz+PlmH7 w==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="273348512" X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="273348512" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Aug 2022 15:00:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137552" 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:32 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 03/10] port: rework the Ethernet device output port behavior to non-blocking Date: Fri, 5 Aug 2022 22:00:22 +0000 Message-Id: <20220805220029.1096212-4-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 Drop packets that cannot be sent instead of retry sending the same packets potentially forever when the Ethernet device that is down. Signed-off-by: Cristian Dumitrescu --- lib/port/rte_swx_port_ethdev.c | 103 +++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 36 deletions(-) diff --git a/lib/port/rte_swx_port_ethdev.c b/lib/port/rte_swx_port_ethdev.c index ca4a43ac4f..eae20d34ce 100644 --- a/lib/port/rte_swx_port_ethdev.c +++ b/lib/port/rte_swx_port_ethdev.c @@ -173,6 +173,7 @@ struct writer { struct rte_mbuf **pkts; int n_pkts; + uint32_t n_bytes; }; static void * @@ -214,34 +215,56 @@ writer_create(void *args) return p; } -static void +static inline void __writer_flush(struct writer *p) { - int n_pkts; - - for (n_pkts = 0; ; ) { - n_pkts += rte_eth_tx_burst(p->params.port_id, - p->params.queue_id, - p->pkts + n_pkts, - p->n_pkts - n_pkts); - - TRACE("[Ethdev TX port %u queue %u] %d packets out\n", - (uint32_t)p->params.port_id, - (uint32_t)p->params.queue_id, - n_pkts); - - if (n_pkts == p->n_pkts) - break; + struct rte_mbuf **pkts = p->pkts; + uint64_t n_pkts_total = p->stats.n_pkts; + uint64_t n_bytes_total = p->stats.n_bytes; + uint64_t n_pkts_drop_total = p->stats.n_pkts_drop; + uint64_t n_bytes_drop_total = p->stats.n_bytes_drop; + int n_pkts = p->n_pkts, n_pkts_drop, n_pkts_tx; + uint32_t n_bytes = p->n_bytes, n_bytes_drop = 0; + + /* Packet TX. */ + n_pkts_tx = rte_eth_tx_burst(p->params.port_id, + p->params.queue_id, + pkts, + n_pkts); + + /* Packet drop. */ + n_pkts_drop = n_pkts - n_pkts_tx; + + for ( ; n_pkts_tx < n_pkts; n_pkts_tx++) { + struct rte_mbuf *m = pkts[n_pkts_tx]; + + n_bytes_drop += m->pkt_len; + rte_pktmbuf_free(m); } + /* Port update. */ + p->stats.n_pkts = n_pkts_total + n_pkts - n_pkts_drop; + p->stats.n_bytes = n_bytes_total + n_bytes - n_bytes_drop; + p->stats.n_pkts_drop = n_pkts_drop_total + n_pkts_drop; + p->stats.n_bytes_drop = n_bytes_drop_total + n_bytes_drop; p->n_pkts = 0; + p->n_bytes = 0; + + TRACE("[Ethdev TX port %u queue %u] Buffered packets flushed: %d out, %d dropped\n", + (uint32_t)p->params.port_id, + (uint32_t)p->params.queue_id, + n_pkts - n_pkts_drop, + n_pkts_drop); } static void writer_pkt_tx(void *port, struct rte_swx_pkt *pkt) { struct writer *p = port; + int n_pkts = p->n_pkts; + uint32_t n_bytes = p->n_bytes; struct rte_mbuf *m = pkt->handle; + uint32_t pkt_length = pkt->length; TRACE("[Ethdev TX port %u queue %u] Pkt %d (%u bytes at offset %u)\n", (uint32_t)p->params.port_id, @@ -252,15 +275,15 @@ writer_pkt_tx(void *port, struct rte_swx_pkt *pkt) if (TRACE_LEVEL) rte_hexdump(stdout, NULL, &pkt->pkt[pkt->offset], pkt->length); - m->data_len = (uint16_t)(pkt->length + m->data_len - m->pkt_len); - m->pkt_len = pkt->length; + m->data_len = (uint16_t)(pkt_length + m->data_len - m->pkt_len); + m->pkt_len = pkt_length; m->data_off = (uint16_t)pkt->offset; - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; + p->pkts[n_pkts++] = m; + p->n_pkts = n_pkts; + p->n_bytes = n_bytes + pkt_length; - p->pkts[p->n_pkts++] = m; - if (p->n_pkts == (int)p->params.burst_size) + if (n_pkts == (int)p->params.burst_size) __writer_flush(p); } @@ -268,7 +291,11 @@ static void writer_pkt_fast_clone_tx(void *port, struct rte_swx_pkt *pkt) { struct writer *p = port; + int n_pkts = p->n_pkts; + uint32_t n_bytes = p->n_bytes; + uint64_t n_pkts_clone = p->stats.n_pkts_clone; struct rte_mbuf *m = pkt->handle; + uint32_t pkt_length = pkt->length; TRACE("[Ethdev TX port %u queue %u] Pkt %d (%u bytes at offset %u) (fast clone)\n", (uint32_t)p->params.port_id, @@ -279,17 +306,17 @@ writer_pkt_fast_clone_tx(void *port, struct rte_swx_pkt *pkt) if (TRACE_LEVEL) rte_hexdump(stdout, NULL, &pkt->pkt[pkt->offset], pkt->length); - m->data_len = (uint16_t)(pkt->length + m->data_len - m->pkt_len); - m->pkt_len = pkt->length; + m->data_len = (uint16_t)(pkt_length + m->data_len - m->pkt_len); + m->pkt_len = pkt_length; m->data_off = (uint16_t)pkt->offset; rte_pktmbuf_refcnt_update(m, 1); - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; - p->stats.n_pkts_clone++; + p->pkts[n_pkts++] = m; + p->n_pkts = n_pkts; + p->n_bytes = n_bytes + pkt_length; + p->stats.n_pkts_clone = n_pkts_clone + 1; - p->pkts[p->n_pkts++] = m; - if (p->n_pkts == (int)p->params.burst_size) + if (n_pkts == (int)p->params.burst_size) __writer_flush(p); } @@ -297,7 +324,11 @@ static void writer_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_length) { struct writer *p = port; + int n_pkts = p->n_pkts; + uint32_t n_bytes = p->n_bytes; + uint64_t n_pkts_clone = p->stats.n_pkts_clone; struct rte_mbuf *m = pkt->handle, *m_clone; + uint32_t pkt_length = pkt->length; TRACE("[Ethdev TX port %u queue %u] Pkt %d (%u bytes at offset %u) (clone)\n", (uint32_t)p->params.port_id, @@ -308,8 +339,8 @@ writer_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_len if (TRACE_LEVEL) rte_hexdump(stdout, NULL, &pkt->pkt[pkt->offset], pkt->length); - m->data_len = (uint16_t)(pkt->length + m->data_len - m->pkt_len); - m->pkt_len = pkt->length; + m->data_len = (uint16_t)(pkt_length + m->data_len - m->pkt_len); + m->pkt_len = pkt_length; m->data_off = (uint16_t)pkt->offset; m_clone = rte_pktmbuf_copy(m, m->pool, 0, truncation_length); @@ -318,12 +349,12 @@ writer_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_len return; } - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; - p->stats.n_pkts_clone++; + p->pkts[n_pkts++] = m_clone; + p->n_pkts = n_pkts; + p->n_bytes = n_bytes + pkt_length; + p->stats.n_pkts_clone = n_pkts_clone + 1; - p->pkts[p->n_pkts++] = m_clone; - if (p->n_pkts == (int)p->params.burst_size) + if (n_pkts == (int)p->params.burst_size) __writer_flush(p); } From patchwork Fri Aug 5 22:00:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114678 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 123B1A00C4; Sat, 6 Aug 2022 00:00:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E3C6E41145; Sat, 6 Aug 2022 00:00:36 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id A2C65400D6 for ; Sat, 6 Aug 2022 00:00:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659736834; x=1691272834; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=F6a7/2uNUV1/3Q+iATUUU91gU11ETLcnyIqs3im2YL0=; b=ElaPsk0U829kFRUsVtcigMYINVsHOSebPXYrK6otBOedjzRecG9SvJiL UYjM1twdXWwg83u0R4sybMW218ju/IcVHGXC8d6vchX4uW2+g42mB9K3k L54ntIKFtECUubuq1EqbUKnbNv/n2ZD3SeFaWa2FtrSrIsV/7Luq2tHCn cZKuViBfbBz8IXeXrNIKbWTl+BuIzTBzZSKaXzo6sDsqM353g09sduaLC XDGwr7IWPjAgAMPRDRrfHFvBo6BccriFgq2an7miQaCnESWNPQ+1+ZNVr hmmrck8fy50U5vKRMzgwtslRrf1QgJ+Tt27JzUVvninKm3sOgK/bXePG8 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="290308811" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290308811" 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:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137557" 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:33 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 04/10] port: free buffered packets on Ethernet device output port free Date: Fri, 5 Aug 2022 22:00:23 +0000 Message-Id: <20220805220029.1096212-5-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 Free the buffered packets as opposed to retrying to send them when the output port is freed. Signed-off-by: Cristian Dumitrescu --- lib/port/rte_swx_port_ethdev.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/port/rte_swx_port_ethdev.c b/lib/port/rte_swx_port_ethdev.c index eae20d34ce..8a1da71003 100644 --- a/lib/port/rte_swx_port_ethdev.c +++ b/lib/port/rte_swx_port_ethdev.c @@ -371,11 +371,17 @@ static void writer_free(void *port) { struct writer *p = port; + int i; if (!p) return; - writer_flush(p); + for (i = 0; i < p->n_pkts; i++) { + struct rte_mbuf *m = p->pkts[i]; + + rte_pktmbuf_free(m); + } + free(p->pkts); free(port); } From patchwork Fri Aug 5 22:00:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114679 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 07616A00C4; Sat, 6 Aug 2022 00:00:43 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1806942905; Sat, 6 Aug 2022 00:00:38 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 49EEE400D6 for ; Sat, 6 Aug 2022 00:00:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659736835; x=1691272835; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=ZBh62HpW23Ht9f6a4VoeI/C2wkX5PrS7PTH/YxhgW8s=; b=F3+v0lQxUBKl3cLS19NJdjhOADID9eYUZ0W0IvMcutQ+BFy2891oTrSW hzsNo7cxuPbvx5MHrfi9JDcSfg0dXeFrjJEMY/l9fYggnuzk7DYkz0RhQ swF/bxIMHTX7p8QL2y2r8VLy1Jf7ypZHRESdhvquSPKQ/5fKzrEyrD7rm zdB5qZ2DsVPD6K24aung9QPXFxSkebZWSgK2EpoeasbxlKBgF2NNQSQCl CHoIiHCJB5lNdoJ14Dc8Z4HHoItP8YBCBxhMQ7F++E17rtAcJUh+fWLuz MST+98MeQlkEUds3KNVlPdznG0WcK0jWCvpKsWGAleuACEnnZTZzVNOaf g==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="290308813" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290308813" 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:34 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137562" 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:33 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 05/10] port: prevent unnecessary flush for the Ethernet device output port Date: Fri, 5 Aug 2022 22:00:24 +0000 Message-Id: <20220805220029.1096212-6-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_ethdev.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/port/rte_swx_port_ethdev.c b/lib/port/rte_swx_port_ethdev.c index 8a1da71003..7cb3c4dfb1 100644 --- a/lib/port/rte_swx_port_ethdev.c +++ b/lib/port/rte_swx_port_ethdev.c @@ -174,6 +174,7 @@ struct writer { struct rte_mbuf **pkts; int n_pkts; uint32_t n_bytes; + int flush_flag; }; static void * @@ -249,6 +250,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("[Ethdev TX port %u queue %u] Buffered packets flushed: %d out, %d dropped\n", (uint32_t)p->params.port_id, @@ -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 From patchwork Fri Aug 5 22:00:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114680 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 1479AA00C4; Sat, 6 Aug 2022 00:00:49 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09FC042C17; Sat, 6 Aug 2022 00:00:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id E25D7400D6 for ; Sat, 6 Aug 2022 00:00:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659736836; x=1691272836; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=dlvEmX0YiaVyPWcmd1SvuGOUcr2w4MPhBoVs5OlkhGI=; b=YXx0OcI5VXAiQUyt43SJes5fHgVmK9TZVGUje3WWSrJbm9ta0SjbdaGr ttOi00sm1x6Uuj7Z+nCF+S+uPHXD9uqgyUCC5iDHuwSV2iL4ie3t075OQ lQKp6Z6zHOolD7SNwFNUU+o7XpoSee2qAo+/8FdKOjheq8Eis1dN5nCic e3qgRMsGIQXVCgXIHcOBM4KU/K+4bClh3qawxiz5fFvZNYzwY7gyT5cE9 fQZ3PXzjUu6vVe+5EbWXKt4GgA/M4rrRBJViG6oZp7c1k8wSGx83OBq34 tZUp7daYWWU28QhPJbiSJOzZxG4NwiioTD/nJnr+8sSEuRDJFSXbauwmE w==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="290308817" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290308817" 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:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137570" 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:34 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 06/10] port: rework the ring output port behavior to non-blocking Date: Fri, 5 Aug 2022 22:00:25 +0000 Message-Id: <20220805220029.1096212-7-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 Drop packets that cannot be sent instead of retry sending the same packets potentially forever when the ring consumer that is down. Signed-off-by: Cristian Dumitrescu --- lib/port/rte_swx_port_ring.c | 99 ++++++++++++++++++++++++------------ 1 file changed, 66 insertions(+), 33 deletions(-) diff --git a/lib/port/rte_swx_port_ring.c b/lib/port/rte_swx_port_ring.c index c62fb3d8c8..72ec7209bf 100644 --- a/lib/port/rte_swx_port_ring.c +++ b/lib/port/rte_swx_port_ring.c @@ -172,6 +172,7 @@ struct writer { struct rte_mbuf **pkts; int n_pkts; + uint32_t n_bytes; }; static void * @@ -218,31 +219,55 @@ writer_create(void *args) return NULL; } -static void +static inline void __writer_flush(struct writer *p) { - int n_pkts; - - for (n_pkts = 0; ; ) { - n_pkts += rte_ring_sp_enqueue_burst(p->params.ring, - (void **)p->pkts + n_pkts, - p->n_pkts - n_pkts, - NULL); - - TRACE("[Ring %s] %d packets out\n", p->params.name, n_pkts); - - if (n_pkts == p->n_pkts) - break; + struct rte_mbuf **pkts = p->pkts; + uint64_t n_pkts_total = p->stats.n_pkts; + uint64_t n_bytes_total = p->stats.n_bytes; + uint64_t n_pkts_drop_total = p->stats.n_pkts_drop; + uint64_t n_bytes_drop_total = p->stats.n_bytes_drop; + int n_pkts = p->n_pkts, n_pkts_drop, n_pkts_tx; + uint32_t n_bytes = p->n_bytes, n_bytes_drop = 0; + + /* Packet TX. */ + n_pkts_tx = rte_ring_sp_enqueue_burst(p->params.ring, + (void **)pkts, + n_pkts, + NULL); + + /* Packet drop. */ + n_pkts_drop = n_pkts - n_pkts_tx; + + for ( ; n_pkts_tx < n_pkts; n_pkts_tx++) { + struct rte_mbuf *m = pkts[n_pkts_tx]; + + n_bytes_drop += m->pkt_len; + rte_pktmbuf_free(m); } + /* Port update. */ + p->stats.n_pkts = n_pkts_total + n_pkts - n_pkts_drop; + p->stats.n_bytes = n_bytes_total + n_bytes - n_bytes_drop; + p->stats.n_pkts_drop = n_pkts_drop_total + n_pkts_drop; + p->stats.n_bytes_drop = n_bytes_drop_total + n_bytes_drop; p->n_pkts = 0; + p->n_bytes = 0; + + TRACE("[Ring %s] Buffered packets flushed: %d out, %d dropped\n", + p->params.name, + n_pkts - n_pkts_drop, + n_pkts_drop); } static void writer_pkt_tx(void *port, struct rte_swx_pkt *pkt) { struct writer *p = port; + int n_pkts = p->n_pkts; + uint32_t n_bytes = p->n_bytes; struct rte_mbuf *m = pkt->handle; + uint32_t pkt_length = pkt->length; TRACE("[Ring %s] Pkt %d (%u bytes at offset %u)\n", p->params.name, @@ -252,15 +277,15 @@ writer_pkt_tx(void *port, struct rte_swx_pkt *pkt) if (TRACE_LEVEL) rte_hexdump(stdout, NULL, &pkt->pkt[pkt->offset], pkt->length); - m->data_len = (uint16_t)(pkt->length + m->data_len - m->pkt_len); - m->pkt_len = pkt->length; + m->data_len = (uint16_t)(pkt_length + m->data_len - m->pkt_len); + m->pkt_len = pkt_length; m->data_off = (uint16_t)pkt->offset; - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; + p->pkts[n_pkts++] = m; + p->n_pkts = n_pkts; + p->n_bytes = n_bytes + pkt_length; - p->pkts[p->n_pkts++] = m; - if (p->n_pkts == (int)p->params.burst_size) + if (n_pkts == (int)p->params.burst_size) __writer_flush(p); } @@ -268,7 +293,11 @@ static void writer_pkt_fast_clone_tx(void *port, struct rte_swx_pkt *pkt) { struct writer *p = port; + int n_pkts = p->n_pkts; + uint32_t n_bytes = p->n_bytes; + uint64_t n_pkts_clone = p->stats.n_pkts_clone; struct rte_mbuf *m = pkt->handle; + uint32_t pkt_length = pkt->length; TRACE("[Ring %s] Pkt %d (%u bytes at offset %u) (fast clone)\n", p->params.name, @@ -278,17 +307,17 @@ writer_pkt_fast_clone_tx(void *port, struct rte_swx_pkt *pkt) if (TRACE_LEVEL) rte_hexdump(stdout, NULL, &pkt->pkt[pkt->offset], pkt->length); - m->data_len = (uint16_t)(pkt->length + m->data_len - m->pkt_len); - m->pkt_len = pkt->length; + m->data_len = (uint16_t)(pkt_length + m->data_len - m->pkt_len); + m->pkt_len = pkt_length; m->data_off = (uint16_t)pkt->offset; rte_pktmbuf_refcnt_update(m, 1); - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; - p->stats.n_pkts_clone++; + p->pkts[n_pkts++] = m; + p->n_pkts = n_pkts; + p->n_bytes = n_bytes + pkt_length; + p->stats.n_pkts_clone = n_pkts_clone + 1; - p->pkts[p->n_pkts++] = m; - if (p->n_pkts == (int)p->params.burst_size) + if (n_pkts == (int)p->params.burst_size) __writer_flush(p); } @@ -296,7 +325,11 @@ static void writer_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_length) { struct writer *p = port; + int n_pkts = p->n_pkts; + uint32_t n_bytes = p->n_bytes; + uint64_t n_pkts_clone = p->stats.n_pkts_clone; struct rte_mbuf *m = pkt->handle, *m_clone; + uint32_t pkt_length = pkt->length; TRACE("[Ring %s] Pkt %d (%u bytes at offset %u) (clone)\n", p->params.name, @@ -306,8 +339,8 @@ writer_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_len if (TRACE_LEVEL) rte_hexdump(stdout, NULL, &pkt->pkt[pkt->offset], pkt->length); - m->data_len = (uint16_t)(pkt->length + m->data_len - m->pkt_len); - m->pkt_len = pkt->length; + m->data_len = (uint16_t)(pkt_length + m->data_len - m->pkt_len); + m->pkt_len = pkt_length; m->data_off = (uint16_t)pkt->offset; m_clone = rte_pktmbuf_copy(m, m->pool, 0, truncation_length); @@ -316,12 +349,12 @@ writer_pkt_clone_tx(void *port, struct rte_swx_pkt *pkt, uint32_t truncation_len return; } - p->stats.n_pkts++; - p->stats.n_bytes += pkt->length; - p->stats.n_pkts_clone++; + p->pkts[n_pkts++] = m_clone; + p->n_pkts = n_pkts; + p->n_bytes = n_bytes + pkt_length; + p->stats.n_pkts_clone = n_pkts_clone + 1; - p->pkts[p->n_pkts++] = m_clone; - if (p->n_pkts == (int)p->params.burst_size) + if (n_pkts == (int)p->params.burst_size) __writer_flush(p); } From patchwork Fri Aug 5 22:00:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114681 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 9C3DFA00C4; Sat, 6 Aug 2022 00:00:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DC5FB42C29; Sat, 6 Aug 2022 00:00:39 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 85A1B400D6 for ; Sat, 6 Aug 2022 00:00:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659736836; x=1691272836; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=fn9gdEuKHiYVYsvz9A14FD9hT0zZoolGH0ROrbe7DWs=; b=cHLmMRbBT1HN4oN0eoZDwj/CdH3qNAYMimUP+PIxVRGMP8OyOAJzWKhM XD0eje37QBYGUfxTM/F1Oo38/KpmZbvAapWDdITxio+LVN00nIxoCsWYx 0coXHiubto1LvrEJLUJoRSZMvh1+jxTel+yK7gIWKLNPtlwODp8UwOCVS o6ckRczaP5jmRm99sRhPoRSkauvVcaqHOHLHbhMPrqgQVfr/HiNgwdXhQ JjvTDb6CDqOYB0EtGbepccm6fd8ilKnm91uVVjAbf9eKlz/BHLNsixDvm bheHrcbr+oRZwHrHgKL5YzwlS7rjxfrMj1wU22BSDDGCbecMZtMnRqm5p A==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="290308821" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290308821" 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:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137580" 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 07/10] port: free buffered packets on ring output port free Date: Fri, 5 Aug 2022 22:00:26 +0000 Message-Id: <20220805220029.1096212-8-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 Free the buffered packets as opposed to retrying to send them when the output port is freed. Signed-off-by: Cristian Dumitrescu --- lib/port/rte_swx_port_ring.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/port/rte_swx_port_ring.c b/lib/port/rte_swx_port_ring.c index 72ec7209bf..7cdcd4b638 100644 --- a/lib/port/rte_swx_port_ring.c +++ b/lib/port/rte_swx_port_ring.c @@ -371,11 +371,17 @@ static void writer_free(void *port) { struct writer *p = port; + int i; if (!p) return; - writer_flush(p); + for (i = 0; i < p->n_pkts; i++) { + struct rte_mbuf *m = p->pkts[i]; + + rte_pktmbuf_free(m); + } + free(p->pkts); free(p->params.name); free(port); 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 From patchwork Fri Aug 5 22:00:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114686 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 778DFA00C4; Sat, 6 Aug 2022 00:01:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2CF242CA5; Sat, 6 Aug 2022 00:00:45 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id CB4594282D 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=9wUCzD8dj32kQOqvOCnQOxf6aETriwatWr/V+vcfz64=; b=bYdpDV3raa/inqTl30W9rrhYSx6AN/6fjdpR5rTovTGEmdkwgmxTEK61 uSr7piwgn00BwoxEO9xAyKgM4AXWkBmJuJ2zCHCCCFpO6ZpFiFCUs0TVc yGwNhyDUONKAcsozGMe4mPhS7k3fpo2K7avDZg/yH+5UuZNE9Vbjzqcup w8PqqHQ+xpEibWGKoGxZFPC7HZNJvdp5Os4qzaIG03DIq2wHLBtfYMGDC A3a8IBhqaBmW3+TU8hhwDk6c18BTXM5wgC1i4/S8vTjcjgylM4unG7sOW zxWPdkiu16cKkQxD263IRU43OiXCzX/J31VS/AGpEYzSPSWojqgFqPC93 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="290308827" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290308827" 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:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137589" 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:36 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 09/10] examples/pipeline: print the output port packet drop counters Date: Fri, 5 Aug 2022 22:00:28 +0000 Message-Id: <20220805220029.1096212-10-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 Print the output port pacet drop statistics counters. Signed-off-by: Cristian Dumitrescu --- examples/pipeline/cli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index 75c32b9089..2e69698031 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -2276,10 +2276,14 @@ cmd_pipeline_stats(char **tokens, out_size, " packets %" PRIu64 " bytes %" PRIu64 + " packets dropped %" PRIu64 + " bytes dropped %" PRIu64 " clone %" PRIu64 " clonerr %" PRIu64 "\n", stats.n_pkts, stats.n_bytes, + stats.n_pkts_drop, + stats.n_bytes_drop, stats.n_pkts_clone, stats.n_pkts_clone_err); From patchwork Fri Aug 5 22:00:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 114688 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 6125AA00C4; Sat, 6 Aug 2022 00:01:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F23042CB1; Sat, 6 Aug 2022 00:00:47 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 6C8FA40697 for ; Sat, 6 Aug 2022 00:00:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659736838; x=1691272838; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=UTaGueyczIkg+vGQk3ztLBNkk2XznGrvomPpi8XHhGY=; b=Mx6ZOVOzJdih9883icvhZR5zNZDlqFkoSn+Z5qi4yFFeNp/Weo8JEVrf /pT6kAN1Gt/JqJaOf/j2XJMImJfJAFHOkV16iqPBI2k40ZP1qGc9BKJrj PGU7x7NmEP2aIy9d6IEUZF+UMmACkoONfFyFwr7wKppcDtZVWqM4NL0ws tHyHmKBzvYniDzOOWi/j3tYIt+377Uhqnv9bkszpnI01SXLpeq6snECTU xfMqyVqGRxB1TdDMmJplFmGaCj3pnSrHJij6XscMSl9IuUHIDhyyJu9eP g5ZFM4WXqE/WvNbyW4aB+jgdLJPHo4m2SLPlc4ZeX0+5BHtOYh4n7gzn8 Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10430"; a="290308829" X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="290308829" 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:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,217,1654585200"; d="scan'208";a="693137592" 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:37 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Subject: [PATCH 10/10] net/softnic: print the output port packet drop counters Date: Fri, 5 Aug 2022 22:00:29 +0000 Message-Id: <20220805220029.1096212-11-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 Print the output port packet drop statistics counters. Signed-off-by: Cristian Dumitrescu --- drivers/net/softnic/rte_eth_softnic_cli.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c index 61221b2f2e..9f4c44579a 100644 --- a/drivers/net/softnic/rte_eth_softnic_cli.c +++ b/drivers/net/softnic/rte_eth_softnic_cli.c @@ -1987,10 +1987,14 @@ cmd_softnic_pipeline_stats(struct pmd_internals *softnic, out_size, " packets %" PRIu64 " bytes %" PRIu64 + " packets dropped %" PRIu64 + " bytes dropped %" PRIu64 " clone %" PRIu64 " clonerr %" PRIu64 "\n", stats.n_pkts, stats.n_bytes, + stats.n_pkts_drop, + stats.n_bytes_drop, stats.n_pkts_clone, stats.n_pkts_clone_err);