port: prevent unnecessary flush for ring output port

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>
This commit is contained in:
Cristian Dumitrescu 2022-08-05 22:00:27 +00:00 committed by Thomas Monjalon
parent 0b5122dcf5
commit f8b0c950a5

View File

@ -174,6 +174,7 @@ struct writer {
struct rte_mbuf **pkts;
int n_pkts;
uint32_t n_bytes;
int flush_flag;
};
static void *
@ -254,6 +255,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,
@ -364,8 +366,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