From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id EE6E2A04F1;
	Mon,  6 Jan 2020 05:27:09 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 2598B1D583;
	Mon,  6 Jan 2020 05:27:09 +0100 (CET)
Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com
 [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 3EE7B1D440
 for <dev@dpdk.org>; Mon,  6 Jan 2020 05:27:07 +0100 (CET)
Received: from pps.filterd (m0045849.ppops.net [127.0.0.1])
 by mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id
 0064NDnL032451; Sun, 5 Jan 2020 20:27:06 -0800
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;
 h=from : to : cc :
 subject : date : message-id : references : in-reply-to : content-type :
 content-transfer-encoding : mime-version; s=pfpt0818;
 bh=bLvoBybTnFZ/t6VBtbiEnaGlGjqP809uxhdcdx0uP7A=;
 b=RKGnqbi/DOHRi1gMEEYVDwYENDySjBRHpRkcyeOJ25H/su3seHZfoS7RarTjb2Q8WqRX
 KlTz5NIoCABi0AQBLz28v+ygws/kxtZhTNAR2daKYsHMzu4gik6UWC1SvKF0QZ7AdhV3
 Dl1n3JhwISQVUItCJNryEREglCaCDxQ4C1FZHgvg9aBQBj9hvQ6JBHvhAYeezM4uWfg7
 BDfe/Op0kj7Zjj24D/UJaBQD9GHjqBtQTIXyT1Peithh8+wUEvnn7Kk+KdLR+qwjAqsh
 osDdVAE7J9OVaX4k+ORGBUFiMvebNAajgImzFkqppvOh8EtIh/AOY2TOhrmRR8tyQzOy 0g== 
Received: from sc-exch02.marvell.com ([199.233.58.182])
 by mx0a-0016f401.pphosted.com with ESMTP id 2xarxv4h9f-2
 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);
 Sun, 05 Jan 2020 20:27:06 -0800
Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH02.marvell.com
 (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 5 Jan
 2020 20:27:04 -0800
Received: from NAM02-BL2-obe.outbound.protection.outlook.com (104.47.38.50) by
 SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server
 (TLS) id
 15.0.1497.2 via Frontend Transport; Sun, 5 Jan 2020 20:27:04 -0800
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=XsJNqi7iaj9kFvCSKvUS7uslxR3LtYTSJGcmSqUa6+1UigwEzM77DW6JzqtGAfSjHfONEQD2f66T1QiOWOnxB+MDfqC0AvxlYhZvJqCzRDcXFsMXwVzrQWcdy8jYJFW5vO3ufajkTb6ckgjO8sijr6xvIhYkdUXjxfEPmfTa/iVQk5AroBA4bUJ2+T2oQ2MFOgkXPr0IID/z7s2AKnSElI2pROK7fX/qHyZJfWXG9u/Ljk+q/iN54JsfwKRXFxLBprApclv7lhiXUdxESXOpk7Vc0sw65xvkuGLrcLapEq2gORAgZNb1iVy+RpKsXlmE6mzaUOPlygcmf6Vh5B9pCA==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; 
 s=arcselector9901;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=bLvoBybTnFZ/t6VBtbiEnaGlGjqP809uxhdcdx0uP7A=;
 b=NPH3sQhJ501EvKRi4AkvJGzIlG8gMoHfASVb0UDkvyO9jVR367QbSKjuhSJRdBoZ8c8LrDOLfY01pzFXLu+9YUTcBFiaijktjy5eLHZZQ360+0CV/ke57oVQYFdemkbzD9O6gCV/6TbE3STX/Wgvb3WP3VHHDiBD5N7qXIadsg6uXY5/i1Gvt/JrcNnEDhEIFoGP7RSK02D0R8aGqz0Iyvkuqp+Tx6NoJdIXCDimmKHUpZeuCIQcuHLvSdSCl1MKfXeDLN/2fOE/SBtf3C496tlLXlx+1R/fIgyDvej3aWN/aPqsNPJA6SEnT+pNqCdDr+goQgbJOmLo83G1RUcViw==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=marvell.com; dmarc=pass action=none header.from=marvell.com;
 dkim=pass header.d=marvell.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=marvell.onmicrosoft.com; s=selector1-marvell-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=bLvoBybTnFZ/t6VBtbiEnaGlGjqP809uxhdcdx0uP7A=;
 b=pNR4cEs+o6dOREmDVBbR5EFoKTO25N9WDoN93NLw2jFDpnuNCfajfahTRT1BjapJYE6NTCI5vnY60lLyuZC9YHLYdcDItZhXWz0Ba3BssdJ7HfSub5TPNIzcjGwxSjHZi5wLn9vNRJJFxYumuyk0gWOeNknQBIIRhrBYMIVZ88s=
Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.160) by
 CY4PR1801MB1941.namprd18.prod.outlook.com (10.171.254.159) with Microsoft
 SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.2602.15; Mon, 6 Jan 2020 04:27:02 +0000
Received: from CY4PR1801MB1863.namprd18.prod.outlook.com
 ([fe80::edb0:c18d:7455:f60b]) by CY4PR1801MB1863.namprd18.prod.outlook.com
 ([fe80::edb0:c18d:7455:f60b%4]) with mapi id 15.20.2602.015; Mon, 6 Jan 2020
 04:27:02 +0000
From: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>, "Jerin Jacob
 Kollanukkaran" <jerinj@marvell.com>, "Kovacevic, Marko"
 <marko.kovacevic@intel.com>, Ori Kam <orika@mellanox.com>, "Richardson,
 Bruce" <bruce.richardson@intel.com>, "Nicolau, Radu"
 <radu.nicolau@intel.com>, Akhil Goyal <akhil.goyal@nxp.com>, "Kantecki,
 Tomasz" <tomasz.kantecki@intel.com>, Sunil Kumar Kori <skori@marvell.com>
CC: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [dpdk-dev] [PATCH v2 01/11] examples/l3fwd: add framework for
 event	device
Thread-Index: AQHVwjQ7Ss9W5H4tz0qJdKkOuMTnjafdBwPQ
Date: Mon, 6 Jan 2020 04:27:02 +0000
Message-ID: <CY4PR1801MB18631E5666DB33E812402A2FDE3C0@CY4PR1801MB1863.namprd18.prod.outlook.com>
References: <20191204144345.5736-1-pbhagavatula@marvell.com>
 <20191204144345.5736-2-pbhagavatula@marvell.com>
 <SN6PR11MB255845160EC09481D26F87E59A230@SN6PR11MB2558.namprd11.prod.outlook.com>
In-Reply-To: <SN6PR11MB255845160EC09481D26F87E59A230@SN6PR11MB2558.namprd11.prod.outlook.com>
Accept-Language: en-IN, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [14.140.231.66]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: fbe44545-f55d-46bb-5073-08d79260adbb
x-ms-traffictypediagnostic: CY4PR1801MB1941:
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <CY4PR1801MB1941421FAC116120B9B4A04ADE3C0@CY4PR1801MB1941.namprd18.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:10000;
x-forefront-prvs: 0274272F87
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10009020)(4636009)(39850400004)(396003)(366004)(136003)(346002)(376002)(13464003)(199004)(189003)(55016002)(30864003)(4326008)(9686003)(86362001)(52536014)(2906002)(33656002)(71200400001)(5660300002)(6636002)(110136005)(316002)(8936002)(186003)(81156014)(81166006)(66446008)(66556008)(478600001)(76116006)(55236004)(6506007)(26005)(66946007)(7696005)(64756008)(66476007)(921003)(1121003);
 DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1941;
 H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; A:1; MX:1; 
received-spf: None (protection.outlook.com: marvell.com does not designate
 permitted sender hosts)
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: vLwEjGXRYoDcoU3lyiMbIMYGjynodDbCZP+VcjW5VL8TvzuetO7LblkFJIOzJGVsvNQL98Wf6QDill80seRoPbcqKP8Toqk/eZwMeX5YNayuv2HvbXVU0jNRLarx0uc3Ho1i8dZfgGDkv0YcXcVJJnOD+SxHtFdjbQCayXLn1yedMtime4cCB6MSNs2NmqZGJgepTKUh/Nc0qpETErjHtsXcCvzzEDbEE6Zt5YN0AjpfzRwHdNdb/t8PvPaRkFOBQGTsr2jhd2txrGwxJ2C8wPRK57SAd2RMXkMSyjmbyabz24Fw+UHo+1i99os6CSbYXcH1ykZNYzwPrAyqwjw/2lVHxtVlxdZFW4/9uyT5KwEk9vZZ+Tzdr2yHxfzuvX9JjP7XSNFnH0avQaWmD/rDksIri/oBtjd2nwXj7F3QX/0mdsi9dxu3o6gCqr0i1pIzLL2NPUk/yrlBNkKpUEWLiAjdvvQJ/uJtV501QyaEYVlm9yVuldCYEZF7fB/bkQj/GlaWHkqhDUF/C+1iBeOPng==
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: fbe44545-f55d-46bb-5073-08d79260adbb
X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2020 04:27:02.3615 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 70e1fb47-1155-421d-87fc-2e58f638b6e0
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: CAXcwcQgKBJfpAkgQXHoW066NkKEsp7r62EFz4YXhb30k8Wd07rl0Y4fOkOKRM8L+Aa9z7lEnINOCxeQwb3ldpQMUs/M17STyCNc6lE7P8I=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1941
X-OriginatorOrg: marvell.com
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572
 definitions=2020-01-05_08:2020-01-02,2020-01-05 signatures=0
Subject: Re: [dpdk-dev] [PATCH v2 01/11] examples/l3fwd: add framework for
 event	device
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>



>-----Original Message-----
>From: dev <dev-bounces@dpdk.org> On Behalf Of Ananyev,
>Konstantin
>Sent: Friday, January 3, 2020 6:19 PM
>To: Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>; Jerin
>Jacob Kollanukkaran <jerinj@marvell.com>; Kovacevic, Marko
><marko.kovacevic@intel.com>; Ori Kam <orika@mellanox.com>;
>Richardson, Bruce <bruce.richardson@intel.com>; Nicolau, Radu
><radu.nicolau@intel.com>; Akhil Goyal <akhil.goyal@nxp.com>;
>Kantecki, Tomasz <tomasz.kantecki@intel.com>; Sunil Kumar Kori
><skori@marvell.com>
>Cc: dev@dpdk.org
>Subject: Re: [dpdk-dev] [PATCH v2 01/11] examples/l3fwd: add
>framework for event device
>
>
>> Add framework to enable event device as a producer of packets.
>> To switch between event mode and poll mode the following options
>> have been added:
>> 	`--mode=3D"eventdev"` or `--mode=3D"poll"`
>> Also, allow the user to select the schedule type to be either
>> RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC or
>RTE_SCHED_TYPE_PARALLEL
>> through:
>> 	`--eventq-sched=3D"ordered"` or `--eventq-sched=3D"atomic"` or
>> 		`--eventq-sched=3D"parallel"`
>>
>> Poll mode is still the default operation mode.
>>
>> Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
>> ---
>>  examples/l3fwd/Makefile      |  2 +-
>>  examples/l3fwd/l3fwd.h       |  6 +++
>>  examples/l3fwd/l3fwd_event.c | 75
>++++++++++++++++++++++++++++++++++++
>>  examples/l3fwd/l3fwd_event.h | 54
>++++++++++++++++++++++++++
>>  examples/l3fwd/main.c        | 41 +++++++++++++++++---
>>  examples/l3fwd/meson.build   |  4 +-
>>  6 files changed, 174 insertions(+), 8 deletions(-)
>>  create mode 100644 examples/l3fwd/l3fwd_event.c
>>  create mode 100644 examples/l3fwd/l3fwd_event.h
>>
>> diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile
>> index b2dbf2607..c892b867b 100644
>> --- a/examples/l3fwd/Makefile
>> +++ b/examples/l3fwd/Makefile
>> @@ -5,7 +5,7 @@
>>  APP =3D l3fwd
>>
>>  # all source are stored in SRCS-y
>> -SRCS-y :=3D main.c l3fwd_lpm.c l3fwd_em.c
>> +SRCS-y :=3D main.c l3fwd_lpm.c l3fwd_em.c l3fwd_event.c
>>
>>  # Build using pkg-config variables if possible
>>  ifeq ($(shell pkg-config --exists libdpdk && echo 0),0)
>> diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
>> index 293fb1fa2..cd17a41b3 100644
>> --- a/examples/l3fwd/l3fwd.h
>> +++ b/examples/l3fwd/l3fwd.h
>> @@ -5,6 +5,9 @@
>>  #ifndef __L3_FWD_H__
>>  #define __L3_FWD_H__
>>
>> +#include <stdbool.h>
>> +
>
>Why do we need it here?

Looks like an artifact I will remove it in next version.

>
>> +#include <rte_ethdev.h>
>>  #include <rte_vect.h>
>>
>>  #define DO_RFC_1812_CHECKS
>> @@ -169,6 +172,9 @@ is_valid_ipv4_pkt(struct rte_ipv4_hdr *pkt,
>uint32_t link_len)
>>  }
>>  #endif /* DO_RFC_1812_CHECKS */
>>
>> +void
>> +print_usage(const char *prgname);
>> +
>>  /* Function pointers for LPM or EM functionality. */
>>  void
>>  setup_lpm(const int socketid);
>> diff --git a/examples/l3fwd/l3fwd_event.c
>b/examples/l3fwd/l3fwd_event.c
>> new file mode 100644
>> index 000000000..3892720be
>> --- /dev/null
>> +++ b/examples/l3fwd/l3fwd_event.c
>> @@ -0,0 +1,75 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(C) 2019 Marvell International Ltd.
>> + */
>> +
>> +#include <stdbool.h>
>> +#include <getopt.h>
>> +
>> +#include "l3fwd.h"
>> +#include "l3fwd_event.h"
>> +
>> +static void
>> +parse_mode(const char *optarg)
>> +{
>> +	struct l3fwd_event_resources *evt_rsrc =3D
>l3fwd_get_eventdev_rsrc();
>> +
>> +	if (!strncmp(optarg, "poll", 4))
>
>That looks a bit clumsy and error-prone.
>Just strcmp(optarg, "poll") seems enough here.
>Same for other similar places.

Will simplify in next version.

>
>> +		evt_rsrc->enabled =3D false;
>> +	else if (!strncmp(optarg, "eventdev", 8))
>> +		evt_rsrc->enabled =3D true;
>> +}
>> +
>> +static void
>> +parse_eventq_sync(const char *optarg)
>> +{
>> +	struct l3fwd_event_resources *evt_rsrc =3D
>l3fwd_get_eventdev_rsrc();
>> +
>> +	if (!strncmp(optarg, "ordered", 7))
>> +		evt_rsrc->sched_type =3D RTE_SCHED_TYPE_ORDERED;
>> +	if (!strncmp(optarg, "atomic", 6))
>> +		evt_rsrc->sched_type =3D RTE_SCHED_TYPE_ATOMIC;
>> +	if (!strncmp(optarg, "parallel", 8))
>> +		evt_rsrc->sched_type =3D RTE_SCHED_TYPE_PARALLEL;
>> +}
>> +
>> +static void
>> +l3fwd_parse_eventdev_args(char **argv, int argc)
>> +{
>> +	const struct option eventdev_lgopts[] =3D {
>> +		{CMD_LINE_OPT_MODE, 1, 0,
>CMD_LINE_OPT_MODE_NUM},
>> +		{CMD_LINE_OPT_EVENTQ_SYNC, 1, 0,
>CMD_LINE_OPT_EVENTQ_SYNC_NUM},
>> +		{NULL, 0, 0, 0}
>> +	};
>> +	char *prgname =3D argv[0];
>> +	char **argvopt =3D argv;
>> +	int32_t option_index;
>> +	int32_t opt;
>> +
>> +	while ((opt =3D getopt_long(argc, argvopt, "", eventdev_lgopts,
>> +					&option_index)) !=3D EOF) {
>> +		switch (opt) {
>> +		case CMD_LINE_OPT_MODE_NUM:
>> +			parse_mode(optarg);
>> +			break;
>> +
>> +		case CMD_LINE_OPT_EVENTQ_SYNC_NUM:
>> +			parse_eventq_sync(optarg);
>> +			break;
>> +
>> +		default:
>> +			print_usage(prgname);
>> +			exit(1);
>> +		}
>> +	}
>> +}
>> +
>> +void
>> +l3fwd_event_resource_setup(void)
>> +{
>> +	struct l3fwd_event_resources *evt_rsrc =3D
>l3fwd_get_eventdev_rsrc();
>> +
>> +	/* Parse eventdev command line options */
>> +	l3fwd_parse_eventdev_args(evt_rsrc->args, evt_rsrc-
>>nb_args);
>> +	if (!evt_rsrc->enabled)
>> +		return;
>> +}
>> diff --git a/examples/l3fwd/l3fwd_event.h
>b/examples/l3fwd/l3fwd_event.h
>> new file mode 100644
>> index 000000000..c95296c38
>> --- /dev/null
>> +++ b/examples/l3fwd/l3fwd_event.h
>> @@ -0,0 +1,54 @@
>> +/* SPDX-License-Identifier: BSD-3-Clause
>> + * Copyright(C) 2019 Marvell International Ltd.
>> + */
>> +
>> +#ifndef __L3FWD_EVENTDEV_H__
>> +#define __L3FWD_EVENTDEV_H__
>> +
>> +#include <rte_common.h>
>> +#include <rte_eventdev.h>
>> +#include <rte_spinlock.h>
>> +
>> +#include "l3fwd.h"
>> +
>> +#define CMD_LINE_OPT_MODE "mode"
>> +#define CMD_LINE_OPT_EVENTQ_SYNC "eventq-sched"
>> +
>> +enum {
>> +	CMD_LINE_OPT_MODE_NUM =3D 265,
>> +	CMD_LINE_OPT_EVENTQ_SYNC_NUM,
>> +};
>> +
>> +struct l3fwd_event_resources {
>> +	uint8_t sched_type;
>> +	uint8_t enabled;
>> +	uint8_t nb_args;
>> +	char **args;
>> +};
>> +
>> +static inline struct l3fwd_event_resources *
>> +l3fwd_get_eventdev_rsrc(void)
>> +{
>> +	static const char name[RTE_MEMZONE_NAMESIZE] =3D
>"l3fwd_event_rsrc";
>> +	const struct rte_memzone *mz;
>> +
>> +	mz =3D rte_memzone_lookup(name);
>> +
>> +	if (mz !=3D NULL)
>> +		return mz->addr;
>> +
>> +	mz =3D rte_memzone_reserve(name, sizeof(struct
>l3fwd_event_resources),
>> +				 0, 0);
>> +	if (mz !=3D NULL) {
>> +		memset(mz->addr, 0, sizeof(struct
>l3fwd_event_resources));
>> +		return mz->addr;
>> +	}
>> +
>> +	rte_exit(EXIT_FAILURE, "Unable to allocate memory for
>eventdev cfg\n");
>> +
>> +	return NULL;
>> +}
>
>Does this function really need to be inline?
>It wouldn't be fast anyway.
>Another question - do you really need memzone here?
>Wouldn't just rte_malloc() be enough?

Will remove inline in next version.=20
rte_malloc would call for a global variable which I'm=20
trying to avoid. I don't think there is any harm in using
named memzone.

>
>> +
>> +void l3fwd_event_resource_setup(void);
>> +
>> +#endif /* __L3FWD_EVENTDEV_H__ */
>> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
>> index 4dea12a65..19ca4483c 100644
>> --- a/examples/l3fwd/main.c
>> +++ b/examples/l3fwd/main.c
>> @@ -13,12 +13,12 @@
>>  #include <errno.h>
>>  #include <getopt.h>
>>  #include <signal.h>
>> -#include <stdbool.h>
>>
>>  #include <rte_common.h>
>>  #include <rte_vect.h>
>>  #include <rte_byteorder.h>
>>  #include <rte_log.h>
>> +#include <rte_malloc.h>
>>  #include <rte_memory.h>
>>  #include <rte_memcpy.h>
>>  #include <rte_eal.h>
>> @@ -33,7 +33,6 @@
>>  #include <rte_random.h>
>>  #include <rte_debug.h>
>>  #include <rte_ether.h>
>> -#include <rte_ethdev.h>
>>  #include <rte_mempool.h>
>>  #include <rte_mbuf.h>
>>  #include <rte_ip.h>
>> @@ -46,6 +45,7 @@
>>  #include <cmdline_parse_etheraddr.h>
>>
>>  #include "l3fwd.h"
>> +#include "l3fwd_event.h"
>>
>>  /*
>>   * Configurable number of RX/TX ring descriptors
>> @@ -274,7 +274,7 @@ init_lcore_rx_queues(void)
>>  }
>>
>>  /* display usage */
>> -static void
>> +void
>>  print_usage(const char *prgname)
>>  {
>>  	fprintf(stderr, "%s [EAL options] --"
>> @@ -289,7 +289,9 @@ print_usage(const char *prgname)
>>  		" [--hash-entry-num]"
>>  		" [--ipv6]"
>>  		" [--parse-ptype]"
>> -		" [--per-port-pool]\n\n"
>> +		" [--per-port-pool]"
>> +		" [--mode]"
>> +		" [--eventq-sched]\n\n"
>>
>>  		"  -p PORTMASK: Hexadecimal bitmask of ports to
>configure\n"
>>  		"  -P : Enable promiscuous mode\n"
>> @@ -304,7 +306,13 @@ print_usage(const char *prgname)
>>  		"  --hash-entry-num: Specify the hash entry number in
>hexadecimal to be setup\n"
>>  		"  --ipv6: Set if running ipv6 packets\n"
>>  		"  --parse-ptype: Set to use software to analyze packet
>type\n"
>> -		"  --per-port-pool: Use separate buffer pool per
>port\n\n",
>> +		"  --per-port-pool: Use separate buffer pool per port\n"
>> +		"  --mode: Packet transfer mode for I/O, poll or
>eventdev\n"
>> +		"          Default mode =3D poll\n"
>> +		"  --eventq-sched: Event queue synchronization
>method "
>> +		"                  ordered, atomic or parallel.\n\t\t"
>> +		"		   Default: atomic\n\t\t"
>> +		"                  Valid only if --mode=3Deventdev\n\n",
>>  		prgname);
>>  }
>>
>> @@ -504,11 +512,19 @@ static const struct option lgopts[] =3D {
>>  static int
>>  parse_args(int argc, char **argv)
>>  {
>> +	struct l3fwd_event_resources *evt_rsrc;
>>  	int opt, ret;
>>  	char **argvopt;
>>  	int option_index;
>>  	char *prgname =3D argv[0];
>>
>> +	evt_rsrc =3D l3fwd_get_eventdev_rsrc();
>> +	evt_rsrc->args =3D rte_zmalloc("l3fwd_event_args", sizeof(char
>*), 0);
>> +	if (evt_rsrc->args =3D=3D NULL)
>> +		rte_exit(EXIT_FAILURE,
>> +				"Unable to allocate memory for
>eventdev arg");
>> +	evt_rsrc->args[0] =3D argv[0];
>> +	evt_rsrc->nb_args++;
>>  	argvopt =3D argv;
>>
>>  	/* Error or normal output strings. */
>> @@ -538,6 +554,15 @@ parse_args(int argc, char **argv)
>>  			l3fwd_lpm_on =3D 1;
>>  			break;
>>
>> +		case '?':
>> +			/* Eventdev options are encountered skip for
>> +			 * now and processed later.
>> +			 */
>> +			evt_rsrc->args[evt_rsrc->nb_args] =3D
>> +				argv[optind - 1];
>> +			evt_rsrc->nb_args++;
>> +			break;
>> +
>
>All this construction with first allocating space for eventdev specific
>params
>copying them and parsing in a special function - looks like an overkill to
>me.
>Why not just to call parse_mode()/parse_eventq.. functions straight
>from here?

We were trying to make minimal changes to l3fwd but I guess we could=20
have common cmdline parse functions.

>
>
>>  		/* long options */
>>  		case CMD_LINE_OPT_CONFIG_NUM:
>>  			ret =3D parse_config(optarg);
>> @@ -811,6 +836,7 @@ prepare_ptype_parser(uint16_t portid,
>uint16_t queueid)
>>  int
>>  main(int argc, char **argv)
>>  {
>> +	struct l3fwd_event_resources *evt_rsrc;
>>  	struct lcore_conf *qconf;
>>  	struct rte_eth_dev_info dev_info;
>>  	struct rte_eth_txconf *txconf;
>> @@ -839,11 +865,16 @@ main(int argc, char **argv)
>>  		*(uint64_t *)(val_eth + portid) =3D
>dest_eth_addr[portid];
>>  	}
>>
>> +	evt_rsrc =3D l3fwd_get_eventdev_rsrc();
>> +	RTE_SET_USED(evt_rsrc);
>>  	/* parse application arguments (after the EAL ones) */
>>  	ret =3D parse_args(argc, argv);
>>  	if (ret < 0)
>>  		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
>>
>> +	/* Configure eventdev parameters if user has requested */
>> +	l3fwd_event_resource_setup();
>> +
>>  	if (check_lcore_params() < 0)
>>  		rte_exit(EXIT_FAILURE, "check_lcore_params
>failed\n");
>>
>> diff --git a/examples/l3fwd/meson.build
>b/examples/l3fwd/meson.build
>> index 6dd4b9022..864327c7b 100644
>> --- a/examples/l3fwd/meson.build
>> +++ b/examples/l3fwd/meson.build
>> @@ -6,7 +6,7 @@
>>  # To build this example as a standalone application with an already-
>installed
>>  # DPDK instance, use 'make'
>>
>> -deps +=3D ['hash', 'lpm']
>> +deps +=3D ['hash', 'lpm', 'eventdev']
>>  sources =3D files(
>> -	'l3fwd_em.c', 'l3fwd_lpm.c', 'main.c'
>> +	'l3fwd_em.c', 'l3fwd_lpm.c', 'l3fwd_event.c', 'main.c'
>>  )
>> --
>> 2.17.1