[07/10] port: free buffered packets on ring output port free

Message ID 20220805220029.1096212-8-cristian.dumitrescu@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series port: implement output port non-blocking behavior |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Cristian Dumitrescu Aug. 5, 2022, 10 p.m. UTC
  Free the buffered packets as opposed to retrying to send them when the
output port is freed.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/port/rte_swx_port_ring.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
  

Patch

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);