[dpdk-dev] [PATCH v4 04/10] examples/l2fwd-event: add eth port setup for eventdev

Nipun Gupta nipun.gupta at nxp.com
Fri Sep 27 15:15:36 CEST 2019



> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of
> pbhagavatula at marvell.com
> Sent: Tuesday, September 24, 2019 3:12 PM
> To: jerinj at marvell.com; bruce.richardson at intel.com; Akhil Goyal
> <akhil.goyal at nxp.com>; Marko Kovacevic <marko.kovacevic at intel.com>;
> Ori Kam <orika at mellanox.com>; Radu Nicolau <radu.nicolau at intel.com>;
> Tomasz Kantecki <tomasz.kantecki at intel.com>; Sunil Kumar Kori
> <skori at marvell.com>; Pavan Nikhilesh <pbhagavatula at marvell.com>
> Cc: dev at dpdk.org
> Subject: [dpdk-dev] [PATCH v4 04/10] examples/l2fwd-event: add eth port
> setup for eventdev
> 
> From: Sunil Kumar Kori <skori at marvell.com>
> 
> Add ethernet port Rx/Tx queue setup for event device which are later
> used for setting up event eth Rx/Tx adapters.
> 
> Signed-off-by: Sunil Kumar Kori <skori at marvell.com>
> ---
>  examples/l2fwd-event/l2fwd_eventdev.c | 114
> ++++++++++++++++++++++++++
>  examples/l2fwd-event/l2fwd_eventdev.h |   1 +
>  examples/l2fwd-event/main.c           |  17 ++++
>  3 files changed, 132 insertions(+)
> 

<snip>

> +
>  static void
>  eventdev_capability_setup(void)
>  {
> @@ -105,6 +215,7 @@ void
>  eventdev_resource_setup(void)
>  {
>  	struct eventdev_resources *eventdev_rsrc = get_eventdev_rsrc();
> +	uint16_t ethdev_count = rte_eth_dev_count_avail();

Why do we need to use all the Ethernet devices available?
We should use the devices in the portmask instead.

>  	uint32_t service_id;
>  	int32_t ret;
> 
> @@ -119,6 +230,9 @@ eventdev_resource_setup(void)
>  	/* Setup eventdev capability callbacks */
>  	eventdev_capability_setup();
> 
> +	/* Ethernet device configuration */
> +	eth_dev_port_setup(ethdev_count);
> +
>  	/* Start event device service */
>  	ret = rte_event_dev_service_id_get(eventdev_rsrc->event_d_id,
>  			&service_id);
> diff --git a/examples/l2fwd-event/l2fwd_eventdev.h b/examples/l2fwd-
> event/l2fwd_eventdev.h
> index 8b6606b4c..d380faff5 100644
> --- a/examples/l2fwd-event/l2fwd_eventdev.h
> +++ b/examples/l2fwd-event/l2fwd_eventdev.h
> @@ -51,6 +51,7 @@ struct eventdev_resources {
>  	uint8_t enabled;
>  	uint8_t nb_args;
>  	char **args;
> +	struct rte_ether_addr ports_eth_addr[RTE_MAX_ETHPORTS];
>  };
> 
>  static inline struct eventdev_resources *
> diff --git a/examples/l2fwd-event/main.c b/examples/l2fwd-event/main.c
> index 087e84588..3f72d0579 100644
> --- a/examples/l2fwd-event/main.c
> +++ b/examples/l2fwd-event/main.c
> @@ -619,6 +619,22 @@ main(int argc, char **argv)
> 
>  	/* Configure eventdev parameters if user has requested */
>  	eventdev_resource_setup();
> +	if (eventdev_rsrc->enabled) {
> +		/* All settings are done. Now enable eth devices */
> +		RTE_ETH_FOREACH_DEV(portid) {
> +			/* skip ports that are not enabled */
> +			if ((l2fwd_enabled_port_mask & (1 << portid)) == 0)
> +				continue;
> +
> +			ret = rte_eth_dev_start(portid);
> +			if (ret < 0)
> +				rte_exit(EXIT_FAILURE,
> +					 "rte_eth_dev_start:err=%d,
> port=%u\n",
> +					 ret, portid);
> +		}
> +
> +		goto skip_port_config;
> +	}
> 
>  	/* Initialize the port/queue configuration of each logical core */
>  	RTE_ETH_FOREACH_DEV(portid) {
> @@ -750,6 +766,7 @@ main(int argc, char **argv)
>  			"All available ports are disabled. Please set
> portmask.\n");
>  	}
> 
> +skip_port_config:
>  	check_all_ports_link_status(l2fwd_enabled_port_mask);
> 
>  	ret = 0;
> --
> 2.17.1



More information about the dev mailing list