DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v3] test/eventdev: add multi port test to suite
@ 2018-05-21 13:53 Vipin Varghese
  2018-06-11 10:25 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Vipin Varghese @ 2018-05-21 13:53 UTC (permalink / raw)
  To: dev, nikhil.rao, deepak.k.jain; +Cc: Vipin Varghese

Add a new test to enhance the test suite, to allow multiple eth ports
rx queue to be added to rx bridge adapter. Update the test function to
reflect change of port index from 8 to 16 bit

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Nikhil Rao <nikhil.rao@intel.com>
---

Changes in V3:
- removed residue code for capabilities - Nikhil Rao
- removed free instance safe guard - Nikhil Rao

Changes in V2:
- reprhased the variable names for dtiver - Nikhil Rao
- Initialization removed for driver_name - Nikhil Rao
- removed adapter capability instance - Nikhil Rao
- reprhased comment - Nikhil Rao
---
 test/test/test_event_eth_rx_adapter.c | 71 ++++++++++++++++++++++++++++++++++-
 1 file changed, 70 insertions(+), 1 deletion(-)

diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
index dee632b..d432731 100644
--- a/test/test/test_event_eth_rx_adapter.c
+++ b/test/test/test_event_eth_rx_adapter.c
@@ -110,12 +110,18 @@ init_ports(int num_ports)
 	uint16_t portid;
 	int retval;
 
-	default_params.mp = rte_pktmbuf_pool_create("packet_pool",
+	struct rte_mempool *ptr = rte_mempool_lookup("packet_pool");
+
+	if (ptr == NULL)
+		default_params.mp = rte_pktmbuf_pool_create("packet_pool",
 						NB_MBUFS,
 						MBUF_CACHE_SIZE,
 						MBUF_PRIV_SIZE,
 						RTE_MBUF_DEFAULT_BUF_SIZE,
 						rte_socket_id());
+	else
+		default_params.mp = ptr;
+
 	if (!default_params.mp)
 		return -ENOMEM;
 
@@ -333,6 +339,68 @@ adapter_queue_add_del(void)
 }
 
 static int
+adapter_multi_eth_add_del(void)
+{
+	int err;
+	struct rte_event ev;
+
+	uint16_t port_index, drv_id = 0;
+	char driver_name[50];
+
+	struct rte_event_eth_rx_adapter_queue_conf queue_config;
+
+	ev.queue_id = 0;
+	ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
+	ev.priority = 0;
+
+	queue_config.rx_queue_flags = 0;
+	queue_config.ev = ev;
+	queue_config.servicing_weight = 1;
+
+	/* stop eth devices for existing */
+	port_index = 0;
+	for (; port_index < rte_eth_dev_count_total(); port_index += 1)
+		rte_eth_dev_stop(port_index);
+
+	/* add the max port for rx_adapter */
+	port_index = rte_eth_dev_count_total();
+	for (; port_index < RTE_MAX_ETHPORTS; port_index += 1) {
+		sprintf(driver_name, "%s%u", "net_null", drv_id);
+		err = rte_vdev_init(driver_name, NULL);
+		TEST_ASSERT(err == 0, "Failed driver %s got %d",
+		driver_name, err);
+		drv_id += 1;
+	}
+
+	err = init_ports(rte_eth_dev_count_total());
+	TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err);
+
+	/* creating new instance for all newly added eth devices */
+	adapter_create();
+
+	/* eth_rx_adapter_queue_add for n ports */
+	port_index = 0;
+	for (; port_index < rte_eth_dev_count_total(); port_index += 1) {
+		err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
+				port_index, 0,
+				&queue_config);
+		TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	}
+
+	/* eth_rx_adapter_queue_del n ports */
+	port_index = 0;
+	for (; port_index < rte_eth_dev_count_total(); port_index += 1) {
+		err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
+				port_index, 0);
+		TEST_ASSERT(err == 0, "Expected 0 got %d", err);
+	}
+
+	adapter_free();
+
+	return TEST_SUCCESS;
+}
+
+static int
 adapter_start_stop(void)
 {
 	int err;
@@ -410,6 +478,7 @@ static struct unit_test_suite service_tests  = {
 		TEST_CASE_ST(NULL, NULL, adapter_create_free),
 		TEST_CASE_ST(adapter_create, adapter_free,
 					adapter_queue_add_del),
+		TEST_CASE_ST(NULL, NULL, adapter_multi_eth_add_del),
 		TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
 		TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
 		TEST_CASES_END() /**< NULL terminate unit test array */
-- 
2.7.4

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

* Re: [dpdk-dev] [PATCH v3] test/eventdev: add multi port test to suite
  2018-05-21 13:53 [dpdk-dev] [PATCH v3] test/eventdev: add multi port test to suite Vipin Varghese
@ 2018-06-11 10:25 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2018-06-11 10:25 UTC (permalink / raw)
  To: Vipin Varghese; +Cc: dev, nikhil.rao, deepak.k.jain

-----Original Message-----
> Date: Mon, 21 May 2018 19:23:55 +0530
> From: Vipin Varghese <vipin.varghese@intel.com>
> To: dev@dpdk.org, nikhil.rao@intel.com, deepak.k.jain@intel.com
> CC: Vipin Varghese <vipin.varghese@intel.com>
> Subject: [dpdk-dev] [PATCH v3] test/eventdev: add multi port test to suite
> X-Mailer: git-send-email 2.7.4
> 
> Add a new test to enhance the test suite, to allow multiple eth ports
> rx queue to be added to rx bridge adapter. Update the test function to
> reflect change of port index from 8 to 16 bit
> 
> Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
> Acked-by: Nikhil Rao <nikhil.rao@intel.com>

Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>

Applied to dpdk-next-eventdev/master. Thanks.

> ---
> 
> Changes in V3:
> - removed residue code for capabilities - Nikhil Rao
> - removed free instance safe guard - Nikhil Rao
> 
> Changes in V2:
> - reprhased the variable names for dtiver - Nikhil Rao
> - Initialization removed for driver_name - Nikhil Rao
> - removed adapter capability instance - Nikhil Rao
> - reprhased comment - Nikhil Rao
> ---
>  test/test/test_event_eth_rx_adapter.c | 71 ++++++++++++++++++++++++++++++++++-
>  1 file changed, 70 insertions(+), 1 deletion(-)
> 
> diff --git a/test/test/test_event_eth_rx_adapter.c b/test/test/test_event_eth_rx_adapter.c
> index dee632b..d432731 100644
> --- a/test/test/test_event_eth_rx_adapter.c
> +++ b/test/test/test_event_eth_rx_adapter.c
> @@ -110,12 +110,18 @@ init_ports(int num_ports)
>  	uint16_t portid;
>  	int retval;
>  
> -	default_params.mp = rte_pktmbuf_pool_create("packet_pool",
> +	struct rte_mempool *ptr = rte_mempool_lookup("packet_pool");
> +
> +	if (ptr == NULL)
> +		default_params.mp = rte_pktmbuf_pool_create("packet_pool",
>  						NB_MBUFS,
>  						MBUF_CACHE_SIZE,
>  						MBUF_PRIV_SIZE,
>  						RTE_MBUF_DEFAULT_BUF_SIZE,
>  						rte_socket_id());
> +	else
> +		default_params.mp = ptr;
> +
>  	if (!default_params.mp)
>  		return -ENOMEM;
>  
> @@ -333,6 +339,68 @@ adapter_queue_add_del(void)
>  }
>  
>  static int
> +adapter_multi_eth_add_del(void)
> +{
> +	int err;
> +	struct rte_event ev;
> +
> +	uint16_t port_index, drv_id = 0;
> +	char driver_name[50];
> +
> +	struct rte_event_eth_rx_adapter_queue_conf queue_config;
> +
> +	ev.queue_id = 0;
> +	ev.sched_type = RTE_SCHED_TYPE_ATOMIC;
> +	ev.priority = 0;
> +
> +	queue_config.rx_queue_flags = 0;
> +	queue_config.ev = ev;
> +	queue_config.servicing_weight = 1;
> +
> +	/* stop eth devices for existing */
> +	port_index = 0;
> +	for (; port_index < rte_eth_dev_count_total(); port_index += 1)
> +		rte_eth_dev_stop(port_index);
> +
> +	/* add the max port for rx_adapter */
> +	port_index = rte_eth_dev_count_total();
> +	for (; port_index < RTE_MAX_ETHPORTS; port_index += 1) {
> +		sprintf(driver_name, "%s%u", "net_null", drv_id);
> +		err = rte_vdev_init(driver_name, NULL);
> +		TEST_ASSERT(err == 0, "Failed driver %s got %d",
> +		driver_name, err);
> +		drv_id += 1;
> +	}
> +
> +	err = init_ports(rte_eth_dev_count_total());
> +	TEST_ASSERT(err == 0, "Port initialization failed err %d\n", err);
> +
> +	/* creating new instance for all newly added eth devices */
> +	adapter_create();
> +
> +	/* eth_rx_adapter_queue_add for n ports */
> +	port_index = 0;
> +	for (; port_index < rte_eth_dev_count_total(); port_index += 1) {
> +		err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID,
> +				port_index, 0,
> +				&queue_config);
> +		TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +	}
> +
> +	/* eth_rx_adapter_queue_del n ports */
> +	port_index = 0;
> +	for (; port_index < rte_eth_dev_count_total(); port_index += 1) {
> +		err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID,
> +				port_index, 0);
> +		TEST_ASSERT(err == 0, "Expected 0 got %d", err);
> +	}
> +
> +	adapter_free();
> +
> +	return TEST_SUCCESS;
> +}
> +
> +static int
>  adapter_start_stop(void)
>  {
>  	int err;
> @@ -410,6 +478,7 @@ static struct unit_test_suite service_tests  = {
>  		TEST_CASE_ST(NULL, NULL, adapter_create_free),
>  		TEST_CASE_ST(adapter_create, adapter_free,
>  					adapter_queue_add_del),
> +		TEST_CASE_ST(NULL, NULL, adapter_multi_eth_add_del),
>  		TEST_CASE_ST(adapter_create, adapter_free, adapter_start_stop),
>  		TEST_CASE_ST(adapter_create, adapter_free, adapter_stats),
>  		TEST_CASES_END() /**< NULL terminate unit test array */
> -- 
> 2.7.4
> 

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

end of thread, other threads:[~2018-06-11 10:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-21 13:53 [dpdk-dev] [PATCH v3] test/eventdev: add multi port test to suite Vipin Varghese
2018-06-11 10:25 ` Jerin Jacob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).