patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest
@ 2020-10-03  9:05 Jayatheerthan, Jay
  2020-10-03  9:05 ` [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in " Jayatheerthan, Jay
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jayatheerthan, Jay @ 2020-10-03  9:05 UTC (permalink / raw)
  To: jerinj, thomas, nikhil.rao; +Cc: dev, stable, jay.jayatheerthan

From: "Jay Jayatheerthan" <jay.jayatheerthan@intel.com>

adapter_multi_eth_add_del() does vdev init but doesn't uninit them.
This causes issues when running event_eth_rx_adapter_autotest multiple
times.

The fix does vdev uninit before exiting the test.

Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
---
 app/test/test_event_eth_rx_adapter.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index dd3bce71b..71c946164 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -464,7 +464,7 @@ adapter_multi_eth_add_del(void)
 	int err;
 	struct rte_event ev;
 
-	uint16_t port_index, drv_id = 0;
+	uint16_t port_index, port_index_base, drv_id = 0;
 	char driver_name[50];
 
 	struct rte_event_eth_rx_adapter_queue_conf queue_config;
@@ -484,6 +484,7 @@ adapter_multi_eth_add_del(void)
 
 	/* add the max port for rx_adapter */
 	port_index = rte_eth_dev_count_total();
+	port_index_base = port_index;
 	for (; port_index < RTE_MAX_ETHPORTS; port_index += 1) {
 		snprintf(driver_name, sizeof(driver_name), "%s%u", "net_null",
 				drv_id);
@@ -513,6 +514,17 @@ adapter_multi_eth_add_del(void)
 		TEST_ASSERT(err == 0, "Expected 0 got %d", err);
 	}
 
+	/* delete vdev ports */
+	for (drv_id = 0, port_index = port_index_base;
+	     port_index < RTE_MAX_ETHPORTS;
+	     drv_id += 1, port_index += 1) {
+		snprintf(driver_name, sizeof(driver_name), "%s%u", "net_null",
+				drv_id);
+		err = rte_vdev_uninit(driver_name);
+		TEST_ASSERT(err == 0, "Failed driver %s got %d",
+			    driver_name, err);
+	}
+
 	return TEST_SUCCESS;
 }
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in Rx adapter autotest
  2020-10-03  9:05 [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest Jayatheerthan, Jay
@ 2020-10-03  9:05 ` Jayatheerthan, Jay
  2020-10-06 17:47   ` Jayatheerthan, Jay
  2020-10-07 10:15   ` Rao, Nikhil
  2020-10-06 17:47 ` [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth " Jayatheerthan, Jay
  2020-10-07 10:13 ` Rao, Nikhil
  2 siblings, 2 replies; 7+ messages in thread
From: Jayatheerthan, Jay @ 2020-10-03  9:05 UTC (permalink / raw)
  To: jerinj, thomas, nikhil.rao; +Cc: dev, stable, jay.jayatheerthan

From: "Jay Jayatheerthan" <jay.jayatheerthan@intel.com>

Allows creation of net_null if vdev EAL option is not specified and
uninit vdev created in the test. The change also adds error checks
for vdev init and uninit.

Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
---
 app/test/test_event_eth_rx_adapter.c | 61 +++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 2 deletions(-)

diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
index 71c946164..dbf85be35 100644
--- a/app/test/test_event_eth_rx_adapter.c
+++ b/app/test/test_event_eth_rx_adapter.c
@@ -30,6 +30,8 @@ struct event_eth_rx_adapter_test_params {
 };
 
 static struct event_eth_rx_adapter_test_params default_params;
+static bool event_dev_created;
+static bool eth_dev_created;
 
 static inline int
 port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
@@ -202,7 +204,10 @@ testsuite_setup(void)
 	if (!count) {
 		printf("Failed to find a valid event device,"
 			" testing with event_skeleton device\n");
-		rte_vdev_init("event_skeleton", NULL);
+		err = rte_vdev_init("event_skeleton", NULL);
+		TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d",
+			    err);
+		event_dev_created = true;
 	}
 
 	struct rte_event_dev_config config = {
@@ -222,6 +227,15 @@ testsuite_setup(void)
 	TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
 			err);
 
+	count = rte_eth_dev_count_total();
+	if (!count) {
+		printf("Testing with net_null device\n");
+		err = rte_vdev_init("net_null", NULL);
+		TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
+			    err);
+		eth_dev_created = true;
+	}
+
 	/*
 	 * eth devices like octeontx use event device to receive packets
 	 * so rte_eth_dev_start invokes rte_event_dev_start internally, so
@@ -249,7 +263,10 @@ testsuite_setup_rx_intr(void)
 	if (!count) {
 		printf("Failed to find a valid event device,"
 			" testing with event_skeleton device\n");
-		rte_vdev_init("event_skeleton", NULL);
+		err = rte_vdev_init("event_skeleton", NULL);
+		TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d",
+			    err);
+		event_dev_created = true;
 	}
 
 	struct rte_event_dev_config config = {
@@ -270,6 +287,15 @@ testsuite_setup_rx_intr(void)
 	TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
 			err);
 
+	count = rte_eth_dev_count_total();
+	if (!count) {
+		printf("Testing with net_null device\n");
+		err = rte_vdev_init("net_null", NULL);
+		TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
+			    err);
+		eth_dev_created = true;
+	}
+
 	/*
 	 * eth devices like octeontx use event device to receive packets
 	 * so rte_eth_dev_start invokes rte_event_dev_start internally, so
@@ -292,21 +318,52 @@ testsuite_setup_rx_intr(void)
 static void
 testsuite_teardown(void)
 {
+	int err;
 	uint32_t i;
 	RTE_ETH_FOREACH_DEV(i)
 		rte_eth_dev_stop(i);
 
+	if (eth_dev_created) {
+		err = rte_vdev_uninit("net_null");
+		if (err)
+			printf("Failed to delete net_null. err=%d", err);
+		eth_dev_created = false;
+	}
+
 	rte_mempool_free(default_params.mp);
+	if (event_dev_created) {
+		err = rte_vdev_uninit("event_skeleton");
+		if (err)
+			printf("Failed to delete event_skeleton. err=%d", err);
+		event_dev_created = false;
+	}
+
+	memset(&default_params, 0, sizeof(default_params));
 }
 
 static void
 testsuite_teardown_rx_intr(void)
 {
+	int err;
 	if (!default_params.rx_intr_port_inited)
 		return;
 
 	rte_eth_dev_stop(default_params.rx_intr_port);
+	if (eth_dev_created) {
+		err = rte_vdev_uninit("net_null");
+		if (err)
+			printf("Failed to delete net_null. err=%d", err);
+		eth_dev_created = false;
+	}
 	rte_mempool_free(default_params.mp);
+	if (event_dev_created) {
+		err = rte_vdev_uninit("event_skeleton");
+		if (err)
+			printf("Failed to delete event_skeleton. err=%d", err);
+		event_dev_created = false;
+	}
+
+	memset(&default_params, 0, sizeof(default_params));
 }
 
 static int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest
  2020-10-03  9:05 [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest Jayatheerthan, Jay
  2020-10-03  9:05 ` [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in " Jayatheerthan, Jay
@ 2020-10-06 17:47 ` Jayatheerthan, Jay
  2020-10-07 10:13 ` Rao, Nikhil
  2 siblings, 0 replies; 7+ messages in thread
From: Jayatheerthan, Jay @ 2020-10-06 17:47 UTC (permalink / raw)
  To: jerinj, thomas, Rao, Nikhil; +Cc: dev, stable

Hi,
Request to review the changes below.

Regards,
Jay

> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Saturday, October 3, 2020 2:36 PM
> To: jerinj@marvell.com; thomas@monjalon.net; Rao, Nikhil <nikhil.rao@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest
> 
> From: "Jay Jayatheerthan" <jay.jayatheerthan@intel.com>
> 
> adapter_multi_eth_add_del() does vdev init but doesn't uninit them.
> This causes issues when running event_eth_rx_adapter_autotest multiple
> times.
> 
> The fix does vdev uninit before exiting the test.
> 
> Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> ---
>  app/test/test_event_eth_rx_adapter.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
> index dd3bce71b..71c946164 100644
> --- a/app/test/test_event_eth_rx_adapter.c
> +++ b/app/test/test_event_eth_rx_adapter.c
> @@ -464,7 +464,7 @@ adapter_multi_eth_add_del(void)
>  	int err;
>  	struct rte_event ev;
> 
> -	uint16_t port_index, drv_id = 0;
> +	uint16_t port_index, port_index_base, drv_id = 0;
>  	char driver_name[50];
> 
>  	struct rte_event_eth_rx_adapter_queue_conf queue_config;
> @@ -484,6 +484,7 @@ adapter_multi_eth_add_del(void)
> 
>  	/* add the max port for rx_adapter */
>  	port_index = rte_eth_dev_count_total();
> +	port_index_base = port_index;
>  	for (; port_index < RTE_MAX_ETHPORTS; port_index += 1) {
>  		snprintf(driver_name, sizeof(driver_name), "%s%u", "net_null",
>  				drv_id);
> @@ -513,6 +514,17 @@ adapter_multi_eth_add_del(void)
>  		TEST_ASSERT(err == 0, "Expected 0 got %d", err);
>  	}
> 
> +	/* delete vdev ports */
> +	for (drv_id = 0, port_index = port_index_base;
> +	     port_index < RTE_MAX_ETHPORTS;
> +	     drv_id += 1, port_index += 1) {
> +		snprintf(driver_name, sizeof(driver_name), "%s%u", "net_null",
> +				drv_id);
> +		err = rte_vdev_uninit(driver_name);
> +		TEST_ASSERT(err == 0, "Failed driver %s got %d",
> +			    driver_name, err);
> +	}
> +
>  	return TEST_SUCCESS;
>  }
> 
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in Rx adapter autotest
  2020-10-03  9:05 ` [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in " Jayatheerthan, Jay
@ 2020-10-06 17:47   ` Jayatheerthan, Jay
  2020-10-07 10:15   ` Rao, Nikhil
  1 sibling, 0 replies; 7+ messages in thread
From: Jayatheerthan, Jay @ 2020-10-06 17:47 UTC (permalink / raw)
  To: Jayatheerthan, Jay, jerinj, thomas, Rao, Nikhil; +Cc: dev, stable

Hi,
Request to review the changes below.

Regards,
Jay

> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Saturday, October 3, 2020 2:36 PM
> To: jerinj@marvell.com; thomas@monjalon.net; Rao, Nikhil <nikhil.rao@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Subject: [PATCH 2/2] app/test: add net null dev creation in Rx adapter autotest
> 
> From: "Jay Jayatheerthan" <jay.jayatheerthan@intel.com>
> 
> Allows creation of net_null if vdev EAL option is not specified and
> uninit vdev created in the test. The change also adds error checks
> for vdev init and uninit.
> 
> Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> ---
>  app/test/test_event_eth_rx_adapter.c | 61 +++++++++++++++++++++++++++-
>  1 file changed, 59 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c
> index 71c946164..dbf85be35 100644
> --- a/app/test/test_event_eth_rx_adapter.c
> +++ b/app/test/test_event_eth_rx_adapter.c
> @@ -30,6 +30,8 @@ struct event_eth_rx_adapter_test_params {
>  };
> 
>  static struct event_eth_rx_adapter_test_params default_params;
> +static bool event_dev_created;
> +static bool eth_dev_created;
> 
>  static inline int
>  port_init_common(uint16_t port, const struct rte_eth_conf *port_conf,
> @@ -202,7 +204,10 @@ testsuite_setup(void)
>  	if (!count) {
>  		printf("Failed to find a valid event device,"
>  			" testing with event_skeleton device\n");
> -		rte_vdev_init("event_skeleton", NULL);
> +		err = rte_vdev_init("event_skeleton", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d",
> +			    err);
> +		event_dev_created = true;
>  	}
> 
>  	struct rte_event_dev_config config = {
> @@ -222,6 +227,15 @@ testsuite_setup(void)
>  	TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
>  			err);
> 
> +	count = rte_eth_dev_count_total();
> +	if (!count) {
> +		printf("Testing with net_null device\n");
> +		err = rte_vdev_init("net_null", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
> +			    err);
> +		eth_dev_created = true;
> +	}
> +
>  	/*
>  	 * eth devices like octeontx use event device to receive packets
>  	 * so rte_eth_dev_start invokes rte_event_dev_start internally, so
> @@ -249,7 +263,10 @@ testsuite_setup_rx_intr(void)
>  	if (!count) {
>  		printf("Failed to find a valid event device,"
>  			" testing with event_skeleton device\n");
> -		rte_vdev_init("event_skeleton", NULL);
> +		err = rte_vdev_init("event_skeleton", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d",
> +			    err);
> +		event_dev_created = true;
>  	}
> 
>  	struct rte_event_dev_config config = {
> @@ -270,6 +287,15 @@ testsuite_setup_rx_intr(void)
>  	TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
>  			err);
> 
> +	count = rte_eth_dev_count_total();
> +	if (!count) {
> +		printf("Testing with net_null device\n");
> +		err = rte_vdev_init("net_null", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
> +			    err);
> +		eth_dev_created = true;
> +	}
> +
>  	/*
>  	 * eth devices like octeontx use event device to receive packets
>  	 * so rte_eth_dev_start invokes rte_event_dev_start internally, so
> @@ -292,21 +318,52 @@ testsuite_setup_rx_intr(void)
>  static void
>  testsuite_teardown(void)
>  {
> +	int err;
>  	uint32_t i;
>  	RTE_ETH_FOREACH_DEV(i)
>  		rte_eth_dev_stop(i);
> 
> +	if (eth_dev_created) {
> +		err = rte_vdev_uninit("net_null");
> +		if (err)
> +			printf("Failed to delete net_null. err=%d", err);
> +		eth_dev_created = false;
> +	}
> +
>  	rte_mempool_free(default_params.mp);
> +	if (event_dev_created) {
> +		err = rte_vdev_uninit("event_skeleton");
> +		if (err)
> +			printf("Failed to delete event_skeleton. err=%d", err);
> +		event_dev_created = false;
> +	}
> +
> +	memset(&default_params, 0, sizeof(default_params));
>  }
> 
>  static void
>  testsuite_teardown_rx_intr(void)
>  {
> +	int err;
>  	if (!default_params.rx_intr_port_inited)
>  		return;
> 
>  	rte_eth_dev_stop(default_params.rx_intr_port);
> +	if (eth_dev_created) {
> +		err = rte_vdev_uninit("net_null");
> +		if (err)
> +			printf("Failed to delete net_null. err=%d", err);
> +		eth_dev_created = false;
> +	}
>  	rte_mempool_free(default_params.mp);
> +	if (event_dev_created) {
> +		err = rte_vdev_uninit("event_skeleton");
> +		if (err)
> +			printf("Failed to delete event_skeleton. err=%d", err);
> +		event_dev_created = false;
> +	}
> +
> +	memset(&default_params, 0, sizeof(default_params));
>  }
> 
>  static int
> --
> 2.17.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest
  2020-10-03  9:05 [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest Jayatheerthan, Jay
  2020-10-03  9:05 ` [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in " Jayatheerthan, Jay
  2020-10-06 17:47 ` [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth " Jayatheerthan, Jay
@ 2020-10-07 10:13 ` Rao, Nikhil
  2020-10-08  9:32   ` [dpdk-stable] [dpdk-dev] " Jerin Jacob
  2 siblings, 1 reply; 7+ messages in thread
From: Rao, Nikhil @ 2020-10-07 10:13 UTC (permalink / raw)
  To: Jayatheerthan, Jay, jerinj, thomas; +Cc: dev, stable, Jayatheerthan, Jay



> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Saturday, October 3, 2020 2:36 PM
> To: jerinj@marvell.com; thomas@monjalon.net; Rao, Nikhil
> <nikhil.rao@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Jayatheerthan, Jay
> <jay.jayatheerthan@intel.com>
> Subject: [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest
> 
> From: "Jay Jayatheerthan" <jay.jayatheerthan@intel.com>
> 
> adapter_multi_eth_add_del() does vdev init but doesn't uninit them.
> This causes issues when running event_eth_rx_adapter_autotest multiple
> times.
> 
> The fix does vdev uninit before exiting the test.
> 
> Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> ---
>  app/test/test_event_eth_rx_adapter.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/app/test/test_event_eth_rx_adapter.c
> b/app/test/test_event_eth_rx_adapter.c
> index dd3bce71b..71c946164 100644
> --- a/app/test/test_event_eth_rx_adapter.c
> +++ b/app/test/test_event_eth_rx_adapter.c
> @@ -464,7 +464,7 @@ adapter_multi_eth_add_del(void)
>  	int err;
>  	struct rte_event ev;
> 
> -	uint16_t port_index, drv_id = 0;
> +	uint16_t port_index, port_index_base, drv_id = 0;
>  	char driver_name[50];
> 
>  	struct rte_event_eth_rx_adapter_queue_conf queue_config; @@ -
> 484,6 +484,7 @@ adapter_multi_eth_add_del(void)
> 
>  	/* add the max port for rx_adapter */
>  	port_index = rte_eth_dev_count_total();
> +	port_index_base = port_index;
>  	for (; port_index < RTE_MAX_ETHPORTS; port_index += 1) {
>  		snprintf(driver_name, sizeof(driver_name), "%s%u",
> "net_null",
>  				drv_id);
> @@ -513,6 +514,17 @@ adapter_multi_eth_add_del(void)
>  		TEST_ASSERT(err == 0, "Expected 0 got %d", err);
>  	}
> 
> +	/* delete vdev ports */
> +	for (drv_id = 0, port_index = port_index_base;
> +	     port_index < RTE_MAX_ETHPORTS;
> +	     drv_id += 1, port_index += 1) {
> +		snprintf(driver_name, sizeof(driver_name), "%s%u",
> "net_null",
> +				drv_id);
> +		err = rte_vdev_uninit(driver_name);
> +		TEST_ASSERT(err == 0, "Failed driver %s got %d",
> +			    driver_name, err);
> +	}
> +
>  	return TEST_SUCCESS;
>  }
> 
> --
> 2.17.1
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in Rx adapter autotest
  2020-10-03  9:05 ` [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in " Jayatheerthan, Jay
  2020-10-06 17:47   ` Jayatheerthan, Jay
@ 2020-10-07 10:15   ` Rao, Nikhil
  1 sibling, 0 replies; 7+ messages in thread
From: Rao, Nikhil @ 2020-10-07 10:15 UTC (permalink / raw)
  To: Jayatheerthan, Jay, jerinj, thomas; +Cc: dev, stable, Jayatheerthan, Jay

> -----Original Message-----
> From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> Sent: Saturday, October 3, 2020 2:36 PM
> To: jerinj@marvell.com; thomas@monjalon.net; Rao, Nikhil
> <nikhil.rao@intel.com>
> Cc: dev@dpdk.org; stable@dpdk.org; Jayatheerthan, Jay
> <jay.jayatheerthan@intel.com>
> Subject: [PATCH 2/2] app/test: add net null dev creation in Rx adapter
> autotest
> 
> From: "Jay Jayatheerthan" <jay.jayatheerthan@intel.com>
> 
> Allows creation of net_null if vdev EAL option is not specified and uninit vdev
> created in the test. The change also adds error checks for vdev init and uninit.
> 
> Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> ---
>  app/test/test_event_eth_rx_adapter.c | 61 +++++++++++++++++++++++++++-
>  1 file changed, 59 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test/test_event_eth_rx_adapter.c
> b/app/test/test_event_eth_rx_adapter.c
> index 71c946164..dbf85be35 100644
> --- a/app/test/test_event_eth_rx_adapter.c
> +++ b/app/test/test_event_eth_rx_adapter.c
> @@ -30,6 +30,8 @@ struct event_eth_rx_adapter_test_params {  };
> 
>  static struct event_eth_rx_adapter_test_params default_params;
> +static bool event_dev_created;
> +static bool eth_dev_created;
> 
>  static inline int
>  port_init_common(uint16_t port, const struct rte_eth_conf *port_conf, @@ -
> 202,7 +204,10 @@ testsuite_setup(void)
>  	if (!count) {
>  		printf("Failed to find a valid event device,"
>  			" testing with event_skeleton device\n");
> -		rte_vdev_init("event_skeleton", NULL);
> +		err = rte_vdev_init("event_skeleton", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create event_skeleton.
> err=%d",
> +			    err);
> +		event_dev_created = true;
>  	}
> 
>  	struct rte_event_dev_config config = { @@ -222,6 +227,15 @@
> testsuite_setup(void)
>  	TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
>  			err);
> 
> +	count = rte_eth_dev_count_total();
> +	if (!count) {
> +		printf("Testing with net_null device\n");
> +		err = rte_vdev_init("net_null", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
> +			    err);
> +		eth_dev_created = true;
> +	}
> +
>  	/*
>  	 * eth devices like octeontx use event device to receive packets
>  	 * so rte_eth_dev_start invokes rte_event_dev_start internally, so
> @@ -249,7 +263,10 @@ testsuite_setup_rx_intr(void)
>  	if (!count) {
>  		printf("Failed to find a valid event device,"
>  			" testing with event_skeleton device\n");
> -		rte_vdev_init("event_skeleton", NULL);
> +		err = rte_vdev_init("event_skeleton", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create event_skeleton.
> err=%d",
> +			    err);
> +		event_dev_created = true;
>  	}
> 
>  	struct rte_event_dev_config config = { @@ -270,6 +287,15 @@
> testsuite_setup_rx_intr(void)
>  	TEST_ASSERT(err == 0, "Event device initialization failed err %d\n",
>  			err);
> 
> +	count = rte_eth_dev_count_total();
> +	if (!count) {
> +		printf("Testing with net_null device\n");
> +		err = rte_vdev_init("net_null", NULL);
> +		TEST_ASSERT(err == 0, "Failed to create net_null. err=%d",
> +			    err);
> +		eth_dev_created = true;
> +	}
> +
>  	/*
>  	 * eth devices like octeontx use event device to receive packets
>  	 * so rte_eth_dev_start invokes rte_event_dev_start internally, so
> @@ -292,21 +318,52 @@ testsuite_setup_rx_intr(void)  static void
>  testsuite_teardown(void)
>  {
> +	int err;
>  	uint32_t i;
>  	RTE_ETH_FOREACH_DEV(i)
>  		rte_eth_dev_stop(i);
> 
> +	if (eth_dev_created) {
> +		err = rte_vdev_uninit("net_null");
> +		if (err)
> +			printf("Failed to delete net_null. err=%d", err);
> +		eth_dev_created = false;
> +	}
> +
>  	rte_mempool_free(default_params.mp);
> +	if (event_dev_created) {
> +		err = rte_vdev_uninit("event_skeleton");
> +		if (err)
> +			printf("Failed to delete event_skeleton. err=%d", err);
> +		event_dev_created = false;
> +	}
> +
> +	memset(&default_params, 0, sizeof(default_params));
>  }
> 
>  static void
>  testsuite_teardown_rx_intr(void)
>  {
> +	int err;
>  	if (!default_params.rx_intr_port_inited)
>  		return;
> 
>  	rte_eth_dev_stop(default_params.rx_intr_port);
> +	if (eth_dev_created) {
> +		err = rte_vdev_uninit("net_null");
> +		if (err)
> +			printf("Failed to delete net_null. err=%d", err);
> +		eth_dev_created = false;
> +	}
>  	rte_mempool_free(default_params.mp);
> +	if (event_dev_created) {
> +		err = rte_vdev_uninit("event_skeleton");
> +		if (err)
> +			printf("Failed to delete event_skeleton. err=%d", err);
> +		event_dev_created = false;
> +	}
> +
> +	memset(&default_params, 0, sizeof(default_params));
>  }
> 
>  static int
> --
> 2.17.1
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest
  2020-10-07 10:13 ` Rao, Nikhil
@ 2020-10-08  9:32   ` Jerin Jacob
  0 siblings, 0 replies; 7+ messages in thread
From: Jerin Jacob @ 2020-10-08  9:32 UTC (permalink / raw)
  To: Rao, Nikhil; +Cc: Jayatheerthan, Jay, jerinj, thomas, dev, stable

On Wed, Oct 7, 2020 at 3:43 PM Rao, Nikhil <nikhil.rao@intel.com> wrote:
>
>
>
> > -----Original Message-----
> > From: Jayatheerthan, Jay <jay.jayatheerthan@intel.com>
> > Sent: Saturday, October 3, 2020 2:36 PM
> > To: jerinj@marvell.com; thomas@monjalon.net; Rao, Nikhil
> > <nikhil.rao@intel.com>
> > Cc: dev@dpdk.org; stable@dpdk.org; Jayatheerthan, Jay
> > <jay.jayatheerthan@intel.com>
> > Subject: [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest
> >
> > From: "Jay Jayatheerthan" <jay.jayatheerthan@intel.com>
> >
> > adapter_multi_eth_add_del() does vdev init but doesn't uninit them.
> > This causes issues when running event_eth_rx_adapter_autotest multiple
> > times.
> >
> > The fix does vdev uninit before exiting the test.
> >
> > Signed-off-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
> > ---
> >  app/test/test_event_eth_rx_adapter.c | 14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/app/test/test_event_eth_rx_adapter.c
> > b/app/test/test_event_eth_rx_adapter.c
> > index dd3bce71b..71c946164 100644
> > --- a/app/test/test_event_eth_rx_adapter.c
> > +++ b/app/test/test_event_eth_rx_adapter.c
> > @@ -464,7 +464,7 @@ adapter_multi_eth_add_del(void)
> >       int err;
> >       struct rte_event ev;
> >
> > -     uint16_t port_index, drv_id = 0;
> > +     uint16_t port_index, port_index_base, drv_id = 0;
> >       char driver_name[50];
> >
> >       struct rte_event_eth_rx_adapter_queue_conf queue_config; @@ -
> > 484,6 +484,7 @@ adapter_multi_eth_add_del(void)
> >
> >       /* add the max port for rx_adapter */
> >       port_index = rte_eth_dev_count_total();
> > +     port_index_base = port_index;
> >       for (; port_index < RTE_MAX_ETHPORTS; port_index += 1) {
> >               snprintf(driver_name, sizeof(driver_name), "%s%u",
> > "net_null",
> >                               drv_id);
> > @@ -513,6 +514,17 @@ adapter_multi_eth_add_del(void)
> >               TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> >       }
> >
> > +     /* delete vdev ports */
> > +     for (drv_id = 0, port_index = port_index_base;
> > +          port_index < RTE_MAX_ETHPORTS;
> > +          drv_id += 1, port_index += 1) {
> > +             snprintf(driver_name, sizeof(driver_name), "%s%u",
> > "net_null",
> > +                             drv_id);
> > +             err = rte_vdev_uninit(driver_name);
> > +             TEST_ASSERT(err == 0, "Failed driver %s got %d",
> > +                         driver_name, err);
> > +     }
> > +
> >       return TEST_SUCCESS;
> >  }
> >
> > --
> > 2.17.1
> Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>


Series applied to dpdk-next-eventdev/main. Thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-10-08  9:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-03  9:05 [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest Jayatheerthan, Jay
2020-10-03  9:05 ` [dpdk-stable] [PATCH 2/2] app/test: add net null dev creation in " Jayatheerthan, Jay
2020-10-06 17:47   ` Jayatheerthan, Jay
2020-10-07 10:15   ` Rao, Nikhil
2020-10-06 17:47 ` [dpdk-stable] [PATCH 1/2] app/test: uninit vdevs in event eth " Jayatheerthan, Jay
2020-10-07 10:13 ` Rao, Nikhil
2020-10-08  9:32   ` [dpdk-stable] [dpdk-dev] " Jerin Jacob

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ https://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git