DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
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	[thread overview]
Message-ID: <20220805220029.1096212-6-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20220805220029.1096212-1-cristian.dumitrescu@intel.com>

Do not flush the buffered packets unnecessarily when a burst was sent
since the last flush call.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 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
-- 
2.34.1


  parent reply	other threads:[~2022-08-05 22:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-05 22:00 [PATCH 00/10] port: implement output port non-blocking behavior Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 01/10] port: add output port packet drop statistics couters Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 02/10] port: adjust the sink port counters Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 03/10] port: rework the Ethernet device output port behavior to non-blocking Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 04/10] port: free buffered packets on Ethernet device output port free Cristian Dumitrescu
2022-08-05 22:00 ` Cristian Dumitrescu [this message]
2022-08-05 22:00 ` [PATCH 06/10] port: rework the ring output port behavior to non-blocking Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 07/10] port: free buffered packets on ring output port free Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 08/10] port: prevent unnecessary flush for the ring output port Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 09/10] examples/pipeline: print the output port packet drop counters Cristian Dumitrescu
2022-08-05 22:00 ` [PATCH 10/10] net/softnic: " Cristian Dumitrescu
2022-09-22 14:58 ` [PATCH 00/10] port: implement output port non-blocking behavior Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805220029.1096212-6-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).