aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2024-10-21 16:54:27 +0000
committerBeno�t Ganne <bganne@cisco.com>2024-10-22 14:22:08 +0000
commitb9a68b5b2e802f1f1ce7ac99f5393df3c0442869 (patch)
tree1c0a23f0419a6c1f2475239cef6373c5ac259ded
parente7226a21274c48909a76dde69ea00a38f5413438 (diff)
pg: fix the buffer leak when pa steams are deleted
Type: fix vpp# sh buffers Pool Name Index NUMA Size Data Size Total Avail Cached Used default-numa-0 0 0 2304 2048 128270 125968 1108 1194 default-numa-1 1 1 2304 2048 128270 128270 0 0 vpp# sh pa Name Enabled Count Parameters pg0-test-0 No 60900431 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 0, pg1-test-0 No 60900385 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 0, pg0-test-1 No 60898008 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 1, pg1-test-1 No 60897934 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 1, pg0-test-2 No 60900278 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 2, pg1-test-2 No 60900184 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 2, pg0-test-3 No 60900431 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 3, pg1-test-3 No 60900387 limit -1, rate 1.00e6 pps, size 64-64, buffer-size 2048, worker 3 vpp# pa delete pg0-test-0 vpp# pa delete pg0-test-1 vpp# pa delete pg0-test-2 vpp# pa delete pg0-test-3 vpp# pa delete pg1-test-0 vpp# pa delete pg1-test-1 vpp# pa delete pg1-test-2 vpp# pa delete pg1-test-3 vpp# sh buffer trace verbose Pool Name Index NUMA Size Data Size Total Avail Cached Used default-numa-0 0 0 2304 2048 128270 126650 1620 0 default-numa-1 1 1 2304 2048 128270 128270 0 0 Node Allocated Freed In Out Buffered unix-cli-process-0 0 1194 0 0 -1194 Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com> Change-Id: I03051a8f529df7801cf08f8374a994dbc00fc972
-rw-r--r--src/vnet/pg/pg.h4
-rw-r--r--src/vnet/pg/stream.c6
2 files changed, 4 insertions, 6 deletions
diff --git a/src/vnet/pg/pg.h b/src/vnet/pg/pg.h
index 0e4b2868b6c..5e99d9af9f6 100644
--- a/src/vnet/pg/pg.h
+++ b/src/vnet/pg/pg.h
@@ -184,7 +184,11 @@ typedef struct pg_stream_t
always_inline void
pg_buffer_index_free (pg_buffer_index_t * bi)
{
+ vlib_main_t *vm = vlib_get_main ();
+ word n_alloc;
vec_free (bi->edits);
+ n_alloc = clib_fifo_elts (bi->buffer_fifo);
+ vlib_buffer_free (vm, bi->buffer_fifo, n_alloc);
clib_fifo_free (bi->buffer_fifo);
}
diff --git a/src/vnet/pg/stream.c b/src/vnet/pg/stream.c
index 6376e9b7ce3..440e285031a 100644
--- a/src/vnet/pg/stream.c
+++ b/src/vnet/pg/stream.c
@@ -615,18 +615,12 @@ void
pg_stream_del (pg_main_t * pg, uword index)
{
pg_stream_t *s;
- pg_buffer_index_t *bi;
s = pool_elt_at_index (pg->streams, index);
pg_stream_enable_disable (pg, s, /* want_enabled */ 0);
hash_unset_mem (pg->stream_index_by_name, s->name);
- vec_foreach (bi, s->buffer_indices)
- {
- clib_fifo_free (bi->buffer_fifo);
- }
-
pg_stream_free (s);
pool_put (pg->streams, s);
}