[08/10] port: prevent unnecessary flush for the ring output port
Checks
Commit Message
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_ring.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
@@ -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