[v3,2/3] examples/eventdev: start ethdev after eth adapter setup

Message ID 20190312204037.16141-2-pbhagavatula@marvell.com
State Accepted, archived
Delegated to: Jerin Jacob
Headers show
Series
  • [v3,1/3] app/eventdev: start event producers after eventdev
Related show

Checks

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

Commit Message

Pavan Nikhilesh Bhagavatula March 12, 2019, 8:41 p.m.
From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Start ethdev after the Rx/Tx adapter setup is complete as in some
architectures it might lead to undefined behaviour or events being
dropped.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 v3 Changes:
 - add the same changes in examples/eventdev_pipeline

 examples/eventdev_pipeline/main.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

--
2.21.0

Comments

Nikhil Rao March 13, 2019, 1:10 p.m. | #1
> -----Original Message-----
> From: Pavan Nikhilesh Bhagavatula [mailto:pbhagavatula@marvell.com]
> Sent: Wednesday, March 13, 2019 2:11 AM
> To: Jerin Jacob Kollanukkaran <jerinj@marvell.com>; Van Haaren, Harry
> <harry.van.haaren@intel.com>; Rao, Nikhil <nikhil.rao@intel.com>; Carrillo,
> Erik G <erik.g.carrillo@intel.com>; Gujjar, Abhinandan S
> <abhinandan.gujjar@intel.com>; Mcnamara, John
> <john.mcnamara@intel.com>
> Cc: dev@dpdk.org; Pavan Nikhilesh Bhagavatula
> <pbhagavatula@marvell.com>
> Subject: [dpdk-dev] [PATCH v3 2/3] examples/eventdev: start ethdev after
> eth adapter setup
> 
> From: Pavan Nikhilesh <pbhagavatula@marvell.com>
> 
> Start ethdev after the Rx/Tx adapter setup is complete as in some
> architectures it might lead to undefined behaviour or events being dropped.
> 
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
>  v3 Changes:
>  - add the same changes in examples/eventdev_pipeline
> 
>  examples/eventdev_pipeline/main.c | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/examples/eventdev_pipeline/main.c
> b/examples/eventdev_pipeline/main.c
> index 92e08bc0c..22ea75e7b 100644
> --- a/examples/eventdev_pipeline/main.c
> +++ b/examples/eventdev_pipeline/main.c
> @@ -316,11 +316,6 @@ port_init(uint8_t port, struct rte_mempool
> *mbuf_pool)
>  			return retval;
>  	}
> 
> -	/* Start the Ethernet port. */
> -	retval = rte_eth_dev_start(port);
> -	if (retval < 0)
> -		return retval;
> -
>  	/* Display the port MAC address. */
>  	struct ether_addr addr;
>  	rte_eth_macaddr_get(port, &addr);
> @@ -440,6 +435,7 @@ main(int argc, char **argv)  {
>  	struct worker_data *worker_data;
>  	uint16_t num_ports;
> +	uint16_t portid;
>  	int lcore_id;
>  	int err;
> 
> @@ -507,6 +503,14 @@ main(int argc, char **argv)
>  	init_ports(num_ports);
>  	fdata->cap.adptr_setup(num_ports);
> 
> +	/* Start the Ethernet port. */
> +	RTE_ETH_FOREACH_DEV(portid) {
> +		err = rte_eth_dev_start(portid);
> +		if (err < 0)
> +			rte_exit(EXIT_FAILURE, "Error starting ethdev %d\n",
> +					portid);
> +	}
> +

Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>

>  	int worker_idx = 0;
>  	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
>  		if (lcore_id >= MAX_NUM_CORE)
> --
> 2.21.0

Patch

diff --git a/examples/eventdev_pipeline/main.c b/examples/eventdev_pipeline/main.c
index 92e08bc0c..22ea75e7b 100644
--- a/examples/eventdev_pipeline/main.c
+++ b/examples/eventdev_pipeline/main.c
@@ -316,11 +316,6 @@  port_init(uint8_t port, struct rte_mempool *mbuf_pool)
 			return retval;
 	}

-	/* Start the Ethernet port. */
-	retval = rte_eth_dev_start(port);
-	if (retval < 0)
-		return retval;
-
 	/* Display the port MAC address. */
 	struct ether_addr addr;
 	rte_eth_macaddr_get(port, &addr);
@@ -440,6 +435,7 @@  main(int argc, char **argv)
 {
 	struct worker_data *worker_data;
 	uint16_t num_ports;
+	uint16_t portid;
 	int lcore_id;
 	int err;

@@ -507,6 +503,14 @@  main(int argc, char **argv)
 	init_ports(num_ports);
 	fdata->cap.adptr_setup(num_ports);

+	/* Start the Ethernet port. */
+	RTE_ETH_FOREACH_DEV(portid) {
+		err = rte_eth_dev_start(portid);
+		if (err < 0)
+			rte_exit(EXIT_FAILURE, "Error starting ethdev %d\n",
+					portid);
+	}
+
 	int worker_idx = 0;
 	RTE_LCORE_FOREACH_SLAVE(lcore_id) {
 		if (lcore_id >= MAX_NUM_CORE)