[1/2] test/pmd_ring_perf: release ring resources after test

Message ID 1539946839-12996-1-git-send-email-phil.yang@arm.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [1/2] test/pmd_ring_perf: release ring resources after test |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Phil Yang Oct. 19, 2018, 11 a.m. UTC
  Need to release the port and the ring resources after test. Otherwise,
it will cause failure to allocate memory when reentry the test.

Fixes: ea764af ("app/test: add performance test for ring driver")

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
---
 test/test/test_pmd_ring_perf.c | 8 ++++++++
 1 file changed, 8 insertions(+)
  

Comments

Thomas Monjalon Nov. 18, 2018, 10:21 p.m. UTC | #1
19/10/2018 13:00, Phil Yang:
> Need to release the port and the ring resources after test. Otherwise,
> it will cause failure to allocate memory when reentry the test.
> 
> Fixes: ea764af ("app/test: add performance test for ring driver")
> 
> Signed-off-by: Phil Yang <phil.yang@arm.com>
> Reviewed-by: Gavin Hu <gavin.hu@arm.com>

This patch was out of the radar because patch 2 was superseded.

Applied, thanks
  
Phil Yang Nov. 19, 2018, 1:42 a.m. UTC | #2
Hi Thomas,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Monday, November 19, 2018 6:21 AM
> To: Phil Yang (Arm Technology China) <Phil.Yang@arm.com>
> Cc: dev@dpdk.org; nd <nd@arm.com>; Gavin Hu (Arm Technology China)
> <Gavin.Hu@arm.com>
> Subject: Re: [dpdk-dev] [PATCH 1/2] test/pmd_ring_perf: release ring resources
> after test
> 
> 19/10/2018 13:00, Phil Yang:
> > Need to release the port and the ring resources after test. Otherwise,
> > it will cause failure to allocate memory when reentry the test.
> >
> > Fixes: ea764af ("app/test: add performance test for ring driver")
> >
> > Signed-off-by: Phil Yang <phil.yang@arm.com>
> > Reviewed-by: Gavin Hu <gavin.hu@arm.com>
> 
> This patch was out of the radar because patch 2 was superseded.
> 
Patch 2 has been abandoned because another commit has already fixed that issue. Thanks.

> Applied, thanks
> 

Thanks,
Phil
  

Patch

diff --git a/test/test/test_pmd_ring_perf.c b/test/test/test_pmd_ring_perf.c
index ad5004a..6318da1 100644
--- a/test/test/test_pmd_ring_perf.c
+++ b/test/test/test_pmd_ring_perf.c
@@ -10,6 +10,7 @@ 
 #include <rte_launch.h>
 #include <rte_ethdev.h>
 #include <rte_eth_ring.h>
+#include <rte_bus_vdev.h>
 
 #include "test.h"
 
@@ -135,6 +136,8 @@  test_bulk_enqueue_dequeue(void)
 static int
 test_ring_pmd_perf(void)
 {
+	char name[RTE_ETH_NAME_MAX_LEN];
+
 	r = rte_ring_create(RING_NAME, RING_SIZE, rte_socket_id(),
 			RING_F_SP_ENQ|RING_F_SC_DEQ);
 	if (r == NULL && (r = rte_ring_lookup(RING_NAME)) == NULL)
@@ -151,6 +154,11 @@  test_ring_pmd_perf(void)
 	printf("\n### Testing using a single lcore ###\n");
 	test_bulk_enqueue_dequeue();
 
+	/* release port and ring resources */
+	rte_eth_dev_stop(ring_ethdev_port);
+	rte_eth_dev_get_name_by_port(ring_ethdev_port, name);
+	rte_vdev_uninit(name);
+	rte_ring_free(r);
 	return 0;
 }