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 6A4CCA04F3;
	Fri,  3 Jan 2020 14:16:34 +0100 (CET)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 17AEA1D408;
	Fri,  3 Jan 2020 14:16:33 +0100 (CET)
Received: from mga04.intel.com (mga04.intel.com [192.55.52.120])
 by dpdk.org (Postfix) with ESMTP id E6E041C1A7
 for <dev@dpdk.org>; Fri,  3 Jan 2020 14:16:30 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga003.fm.intel.com ([10.253.24.29])
 by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 03 Jan 2020 05:16:30 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.69,390,1571727600"; d="scan'208";a="270580758"
Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202])
 by FMSMGA003.fm.intel.com with ESMTP; 03 Jan 2020 05:16:28 -0800
Received: from fmsmsx162.amr.corp.intel.com (10.18.125.71) by
 fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Fri, 3 Jan 2020 05:16:28 -0800
Received: from FMSEDG002.ED.cps.intel.com (10.1.192.134) by
 fmsmsx162.amr.corp.intel.com (10.18.125.71) with Microsoft SMTP Server (TLS)
 id 14.3.439.0; Fri, 3 Jan 2020 05:16:28 -0800
Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101)
 by edgegateway.intel.com (192.55.55.69) with Microsoft SMTP Server (TLS) id
 14.3.439.0; Fri, 3 Jan 2020 05:16:28 -0800
ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none;
 b=lKk832fer6L1JeiujvMAhiSxTlk8vQR5kmj0UmCeDM5MKoLMmJeinoGsa/eJsHHqxKVsGaFDTDZkKmaw+pADiOrrtQEnNvi+nSTZPotguRV23pCHnUGSpGEq2KLDQm4KMu1Wxm9Wtk3+twm3j3eiv2fMc/60E7R0zzDg9hh3exGWyKBuxz5bv7P+H8vUFdGFSuCod6zJ37+cfQlyuQvyT01zLvF/c/QU+eP5KyL588vfRCnl7kfj2J6Pb/mChxni24Sr9VpmW7RxW++c+wJ5YGlBFhZnmF2b+kLMg3Y01nS3oDOLvVR0k3rQAtVq/uIDe8lDF6SH08pKAeTZGyFNtA==
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=VYqTBVWLcMR8987ytcabuIsUMIj1LY55EqDFsH/8XZk=;
 b=Jlvx1a5FZAErCRrNcjosieeGh6fnSZIkIhqdWvHcx0oEC6I0m/pH8AeSZfjykX8RrIFys8sKROFyVHM4auY9NSch762kzh8AB5LzTABULWqSlXZmrqmXg+iKO8mm2FmykmnT/1Ev4xglW3dxgQ/I83Wvjw5SWpZRiPrS17R+WZlHgEmqtwiDIkDoew1rkaidL4Zup0ob98QhET+2qSifLuzhmI8S/OYKu45M8HxLNmgy0MQMP+/vbOj6bMfhdye5kAYk9VPLfEx8aOwXXA4Mp9qt8hKguTsWwnO5NCbW1An3CVKxP2NYmW7lcduzypLXNPGkRX2eOMFfsEUC34qoig==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
 smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com;
 dkim=pass header.d=intel.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; 
 s=selector2-intel-onmicrosoft-com;
 h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
 bh=VYqTBVWLcMR8987ytcabuIsUMIj1LY55EqDFsH/8XZk=;
 b=pfoiX5BVgN3QeEyojW14iIvUmCikwSSXVXnWkOqSGyoaqqG8epE1RdEdjv7tipVL9nEwzzIyw7u8LaDgs4vtdECTdlQyAeHDFAiSi3V9EyVWSjk1iWUv15i2z+yvW9UNM0vwdh9+7AMMDbFcMsqinnwNxZwSjqoIpXJBFcOa9XM=
Received: from SN6PR11MB2558.namprd11.prod.outlook.com (52.135.94.19) by
 SN6PR11MB2638.namprd11.prod.outlook.com (52.135.91.149) with Microsoft SMTP
 Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id
 15.20.2602.10; Fri, 3 Jan 2020 13:16:25 +0000
Received: from SN6PR11MB2558.namprd11.prod.outlook.com
 ([fe80::4d86:362a:13c3:8386]) by SN6PR11MB2558.namprd11.prod.outlook.com
 ([fe80::4d86:362a:13c3:8386%7]) with mapi id 15.20.2602.012; Fri, 3 Jan 2020
 13:16:25 +0000
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "pbhagavatula@marvell.com" <pbhagavatula@marvell.com>,
 "jerinj@marvell.com" <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 08/11] examples/l3fwd: add event lpm main
 loop
Thread-Index: AQHVqrGYok+YI7T7Bka8LM8J1sNWcafZGEow
Date: Fri, 3 Jan 2020 13:16:25 +0000
Message-ID: <SN6PR11MB25581B9C9C12C24272E511C79A230@SN6PR11MB2558.namprd11.prod.outlook.com>
References: <20191204144345.5736-1-pbhagavatula@marvell.com>
 <20191204144345.5736-9-pbhagavatula@marvell.com>
In-Reply-To: <20191204144345.5736-9-pbhagavatula@marvell.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTBhMDg2ZTQtYjhlZS00MjRmLTlhY2EtNmMzMTU5ODA1MDllIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicFlubHBSMlVYNWlCY2p6ZFloaURcLzdnZU9RRTNaWXdZOUR4WmlhYVk4amhyVmNqOFVYck12RUxDN3l5Q3gySzIifQ==
dlp-product: dlpe-windows
dlp-reaction: no-action
dlp-version: 11.2.0.6
x-ctpclassification: CTP_NT
authentication-results: spf=none (sender IP is )
 smtp.mailfrom=konstantin.ananyev@intel.com; 
x-originating-ip: [192.198.151.189]
x-ms-publictraffictype: Email
x-ms-office365-filtering-correlation-id: e4ea422d-e69c-4356-b92a-08d7904f22bd
x-ms-traffictypediagnostic: SN6PR11MB2638:
x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr
x-ms-exchange-transport-forked: True
x-microsoft-antispam-prvs: <SN6PR11MB2638020779EF9D838D3CBE279A230@SN6PR11MB2638.namprd11.prod.outlook.com>
x-ms-oob-tlc-oobclassifiers: OLM:1728;
x-forefront-prvs: 0271483E06
x-forefront-antispam-report: SFV:NSPM;
 SFS:(10019020)(366004)(189003)(199004)(30864003)(26005)(66446008)(5660300002)(52536014)(66946007)(66556008)(110136005)(66476007)(76116006)(64756008)(8936002)(186003)(55016002)(33656002)(4326008)(7696005)(6506007)(2906002)(9686003)(81166006)(86362001)(81156014)(8676002)(71200400001)(498600001)(921003)(1121003);
 DIR:OUT; SFP:1102; SCL:1; SRVR:SN6PR11MB2638;
 H:SN6PR11MB2558.namprd11.prod.outlook.com; FPR:; SPF:None; LANG:en;
 PTR:InfoNoRecords; MX:1; A:1; 
x-ms-exchange-senderadcheck: 1
x-microsoft-antispam: BCL:0;
x-microsoft-antispam-message-info: dpkSDqZa903n1TONev5PaeOpVdI0ldeoDQJoCpeJtnlaWID2bSI6XoxGKW+G6YNsDr//Nq/AB8BCVmO5v6I7bRNVk1zxqgKuUhA72ZlWV26rk853YKM4iNmk6kscL/qDpU2uRevumdpbVQb82l45Huws45anPjQdHuSRPZResc/fg1Jx9zg63zSvz8buclYnTF92dJC7kb+yoGjV48zaAlU2n2UJaQK0KxqbRZsjFkaaHuRH8V53U3Rbat9S/g8tN9Jo97NnLNiK6hhwqZAyaV09lNRERsKfWoNdXSacjOYgyGPLtNj9n9wRQclcevurcp/fH6XdO7h6nRTBixMoYFthOPj648PWK63AfFrK/nA3G8eGVpO6SYwt3oG/JiUizuf6y5r2ZDyoB1AMFrFHDU1d0CKzH7HWGlxn/G5tlbvqj0CcDjj4+VyXItGlMxNzmpN5sSjwlLYUpTv+XLp0d9f/5sJrJiEJdbx611D5fdQc+iBsitdOnDhi02pa5tGO
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-MS-Exchange-CrossTenant-Network-Message-Id: e4ea422d-e69c-4356-b92a-08d7904f22bd
X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jan 2020 13:16:25.4540 (UTC)
X-MS-Exchange-CrossTenant-fromentityheader: Hosted
X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d
X-MS-Exchange-CrossTenant-mailboxtype: HOSTED
X-MS-Exchange-CrossTenant-userprincipalname: A5AUDIevf61WgTItVjHejx5VTpInv+WJA6x8CdhVLn6ak5nzICDy4492pco8wFSIsfirqhKo/GqRR+WLPN65I4vRLcsuKDWKVGDWkbRb5ZU=
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR11MB2638
X-OriginatorOrg: intel.com
Subject: Re: [dpdk-dev] [PATCH v2 08/11] examples/l3fwd: add event lpm main
 loop
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>

> Add lpm main loop for handling events based on capabilities of the
> event device.
>=20
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
> ---
>  examples/l3fwd/l3fwd.h       |   9 ++
>  examples/l3fwd/l3fwd_event.c |   9 ++
>  examples/l3fwd/l3fwd_event.h |   5 +
>  examples/l3fwd/l3fwd_lpm.c   | 231 +++++++++++++++++++++++++++++++++++
>  examples/l3fwd/main.c        |  10 +-
>  5 files changed, 260 insertions(+), 4 deletions(-)
>=20
> diff --git a/examples/l3fwd/l3fwd.h b/examples/l3fwd/l3fwd.h
> index 6d16cde74..8f2e4be23 100644
> --- a/examples/l3fwd/l3fwd.h
> +++ b/examples/l3fwd/l3fwd.h
> @@ -212,6 +212,15 @@ em_main_loop(__attribute__((unused)) void *dummy);
>  int
>  lpm_main_loop(__attribute__((unused)) void *dummy);
>=20
> +int
> +lpm_event_main_loop_tx_d(__attribute__((unused)) void *dummy);
> +int
> +lpm_event_main_loop_tx_d_burst(__attribute__((unused)) void *dummy);
> +int
> +lpm_event_main_loop_tx_q(__attribute__((unused)) void *dummy);
> +int
> +lpm_event_main_loop_tx_q_burst(__attribute__((unused)) void *dummy);

No need to add unused attribute in function declaration.
BTW, if all event_loop_cb functions don't use parameter, why just not
make them 'typedef int (*event_loop_cb)(void)'?

> +
>  /* Return ipv4/ipv6 fwd lookup struct for LPM or EM. */
>  void *
>  em_get_ipv4_l3fwd_lookup_struct(const int socketid);
> diff --git a/examples/l3fwd/l3fwd_event.c b/examples/l3fwd/l3fwd_event.c
> index 0e796f003..c7de046e3 100644
> --- a/examples/l3fwd/l3fwd_event.c
> +++ b/examples/l3fwd/l3fwd_event.c
> @@ -235,6 +235,12 @@ void
>  l3fwd_event_resource_setup(struct rte_eth_conf *port_conf)
>  {
>  	struct l3fwd_event_resources *evt_rsrc =3D l3fwd_get_eventdev_rsrc();
> +	const event_loop_cb lpm_event_loop[2][2] =3D {
> +		[0][0] =3D lpm_event_main_loop_tx_d,
> +		[0][1] =3D lpm_event_main_loop_tx_d_burst,
> +		[1][0] =3D lpm_event_main_loop_tx_q,
> +		[1][1] =3D lpm_event_main_loop_tx_q_burst,
> +	};
>  	uint32_t event_queue_cfg;
>  	int ret;
>=20
> @@ -268,4 +274,7 @@ l3fwd_event_resource_setup(struct rte_eth_conf *port_=
conf)
>  	ret =3D rte_event_dev_start(evt_rsrc->event_d_id);
>  	if (ret < 0)
>  		rte_exit(EXIT_FAILURE, "Error in starting eventdev");
> +
> +	evt_rsrc->ops.lpm_event_loop =3D lpm_event_loop[evt_rsrc->tx_mode_q]
> +						       [evt_rsrc->has_burst];
>  }
> diff --git a/examples/l3fwd/l3fwd_event.h b/examples/l3fwd/l3fwd_event.h
> index 9d8bd5a36..fcc0ce51a 100644
> --- a/examples/l3fwd/l3fwd_event.h
> +++ b/examples/l3fwd/l3fwd_event.h
> @@ -14,6 +14,11 @@
>=20
>  #include "l3fwd.h"
>=20
> +#define L3FWD_EVENT_SINGLE     0x1
> +#define L3FWD_EVENT_BURST      0x2
> +#define L3FWD_EVENT_TX_DIRECT  0x4
> +#define L3FWD_EVENT_TX_ENQ     0x8
> +
>  #define CMD_LINE_OPT_MODE "mode"
>  #define CMD_LINE_OPT_EVENTQ_SYNC "eventq-sched"
>=20
> diff --git a/examples/l3fwd/l3fwd_lpm.c b/examples/l3fwd/l3fwd_lpm.c
> index 349de2703..c4669d6d5 100644
> --- a/examples/l3fwd/l3fwd_lpm.c
> +++ b/examples/l3fwd/l3fwd_lpm.c
> @@ -28,6 +28,7 @@
>  #include <rte_lpm6.h>
>=20
>  #include "l3fwd.h"
> +#include "l3fwd_event.h"
>=20
>  struct ipv4_l3fwd_lpm_route {
>  	uint32_t ip;
> @@ -254,6 +255,236 @@ lpm_main_loop(__attribute__((unused)) void *dummy)
>  	return 0;
>  }
>=20
> +static __rte_always_inline void
> +lpm_event_loop_single(struct l3fwd_event_resources *evt_rsrc,
> +		const uint8_t flags)
> +{
> +	const int event_p_id =3D l3fwd_get_free_event_port(evt_rsrc);
> +	const uint8_t tx_q_id =3D evt_rsrc->evq.event_q_id[
> +		evt_rsrc->evq.nb_queues - 1];
> +	const uint8_t event_d_id =3D evt_rsrc->event_d_id;
> +	struct lcore_conf *lconf;
> +	unsigned int lcore_id;
> +	struct rte_event ev;
> +
> +	if (event_p_id < 0)
> +		return;
> +
> +	lcore_id =3D rte_lcore_id();
> +	lconf =3D &lcore_conf[lcore_id];
> +
> +	RTE_LOG(INFO, L3FWD, "entering %s on lcore %u\n", __func__, lcore_id);
> +	while (!force_quit) {
> +		if (!rte_event_dequeue_burst(event_d_id, event_p_id, &ev, 1, 0))
> +			continue;
> +
> +		struct rte_mbuf *mbuf =3D ev.mbuf;
> +		mbuf->port =3D lpm_get_dst_port(lconf, mbuf, mbuf->port);
> +
> +#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \
> +				|| defined RTE_ARCH_PPC_64
> +		process_packet(mbuf, &mbuf->port);
> +#else
> +
> +		struct rte_ether_hdr *eth_hdr =3D rte_pktmbuf_mtod(mbuf,
> +							struct rte_ether_hdr *);
> +#ifdef DO_RFC_1812_CHECKS
> +		struct rte_ipv4_hdr *ipv4_hdr;
> +		if (RTE_ETH_IS_IPV4_HDR(mbuf->packet_type)) {
> +			/* Handle IPv4 headers.*/
> +			ipv4_hdr =3D rte_pktmbuf_mtod_offset(mbuf,
> +					struct rte_ipv4_hdr *,
> +					sizeof(struct rte_ether_hdr));
> +
> +			if (is_valid_ipv4_pkt(ipv4_hdr, mbuf->pkt_len)
> +					< 0) {
> +				mbuf->port =3D BAD_PORT;
> +				continue;
> +			}
> +			/* Update time to live and header checksum */
> +			--(ipv4_hdr->time_to_live);
> +			++(ipv4_hdr->hdr_checksum);
> +		}
> +#endif
> +		/* dst addr */
> +		*(uint64_t *)&eth_hdr->d_addr =3D dest_eth_addr[mbuf->port];
> +
> +		/* src addr */
> +		rte_ether_addr_copy(&ports_eth_addr[mbuf->port],
> +				&eth_hdr->s_addr);
> +#endif

The code snippet above looks pretty much the same as in l3fwd_lpm_simple_fo=
rward()
except missing IPv6 part.
Same for loop_burst() below.
Instead od duplicating the code in dozen places, can we put this common cod=
e
into a function and use it?=20



> +		if (mbuf->port =3D=3D BAD_PORT) {
> +			rte_pktmbuf_free(mbuf);
> +			continue;
> +		}
> +
> +		if (flags & L3FWD_EVENT_TX_ENQ) {
> +			ev.queue_id =3D tx_q_id;
> +			ev.op =3D RTE_EVENT_OP_FORWARD;
> +			while (rte_event_enqueue_burst(event_d_id, event_p_id,
> +						&ev, 1) && !force_quit)
> +				;
> +		}
> +
> +		if (flags & L3FWD_EVENT_TX_DIRECT) {
> +			rte_event_eth_tx_adapter_txq_set(mbuf, 0);
> +			while (!rte_event_eth_tx_adapter_enqueue(event_d_id,
> +						event_p_id, &ev, 1, 0) &&
> +					!force_quit)
> +				;
> +		}
> +	}
> +}
> +
> +static __rte_always_inline void
> +lpm_event_loop_burst(struct l3fwd_event_resources *evt_rsrc,
> +		const uint8_t flags)
> +{
> +	const int event_p_id =3D l3fwd_get_free_event_port(evt_rsrc);
> +	const uint8_t tx_q_id =3D evt_rsrc->evq.event_q_id[
> +		evt_rsrc->evq.nb_queues - 1];
> +	const uint8_t event_d_id =3D evt_rsrc->event_d_id;
> +	const uint16_t deq_len =3D evt_rsrc->deq_depth;
> +	struct rte_event events[MAX_PKT_BURST];
> +	struct lcore_conf *lconf;
> +	unsigned int lcore_id;
> +	int i, nb_enq, nb_deq;
> +
> +	if (event_p_id < 0)
> +		return;
> +
> +	lcore_id =3D rte_lcore_id();
> +
> +	lconf =3D &lcore_conf[lcore_id];
> +
> +	RTE_LOG(INFO, L3FWD, "entering %s on lcore %u\n", __func__, lcore_id);
> +
> +	while (!force_quit) {
> +		/* Read events from RX queues */
> +		nb_deq =3D rte_event_dequeue_burst(event_d_id, event_p_id,
> +				events, deq_len, 0);
> +		if (nb_deq =3D=3D 0) {
> +			rte_pause();
> +			continue;
> +		}
> +
> +		for (i =3D 0; i < nb_deq; i++) {
> +			struct rte_mbuf *mbuf =3D events[i].mbuf;
> +
> +			mbuf->port =3D lpm_get_dst_port(lconf, mbuf, mbuf->port);
> +
> +#if defined RTE_ARCH_X86 || defined RTE_MACHINE_CPUFLAG_NEON \
> +					|| defined RTE_ARCH_PPC_64
> +			process_packet(mbuf, &mbuf->port);
> +#else
> +			struct rte_ether_hdr *eth_hdr =3D rte_pktmbuf_mtod(mbuf,
> +						struct rte_ether_hdr *);
> +
> +#ifdef DO_RFC_1812_CHECKS
> +			struct rte_ipv4_hdr *ipv4_hdr;
> +			if (RTE_ETH_IS_IPV4_HDR(mbuf->packet_type)) {
> +				/* Handle IPv4 headers.*/
> +				ipv4_hdr =3D rte_pktmbuf_mtod_offset(mbuf,
> +						struct rte_ipv4_hdr *,
> +						sizeof(struct rte_ether_hdr));
> +
> +				if (is_valid_ipv4_pkt(ipv4_hdr, mbuf->pkt_len)
> +						< 0) {
> +					mbuf->port =3D BAD_PORT;
> +					continue;
> +				}
> +				/* Update time to live and header checksum */
> +				--(ipv4_hdr->time_to_live);
> +				++(ipv4_hdr->hdr_checksum);
> +			}
> +#endif
> +			/* dst addr */
> +			*(uint64_t *)&eth_hdr->d_addr =3D dest_eth_addr[
> +								mbuf->port];
> +			/* src addr */
> +			rte_ether_addr_copy(&ports_eth_addr[mbuf->port],
> +					&eth_hdr->s_addr);
> +#endif
> +			if (flags & L3FWD_EVENT_TX_ENQ) {
> +				events[i].queue_id =3D tx_q_id;
> +				events[i].op =3D RTE_EVENT_OP_FORWARD;
> +			}
> +
> +			if (flags & L3FWD_EVENT_TX_DIRECT)
> +				rte_event_eth_tx_adapter_txq_set(mbuf, 0);
> +		}
> +
> +		if (flags & L3FWD_EVENT_TX_ENQ) {
> +			nb_enq =3D rte_event_enqueue_burst(event_d_id, event_p_id,
> +					events, nb_deq);
> +			while (nb_enq < nb_deq && !force_quit)
> +				nb_enq +=3D rte_event_enqueue_burst(event_d_id,
> +						event_p_id, events + nb_enq,
> +						nb_deq - nb_enq);
> +		}
> +
> +		if (flags & L3FWD_EVENT_TX_DIRECT) {
> +			nb_enq =3D rte_event_eth_tx_adapter_enqueue(event_d_id,
> +					event_p_id, events, nb_deq, 0);
> +			while (nb_enq < nb_deq && !force_quit)
> +				nb_enq +=3D rte_event_eth_tx_adapter_enqueue(
> +						event_d_id, event_p_id,
> +						events + nb_enq,
> +						nb_deq - nb_enq, 0);
> +		}
> +	}
> +}
> +
> +static __rte_always_inline void
> +lpm_event_loop(struct l3fwd_event_resources *evt_rsrc,
> +		 const uint8_t flags)
> +{
> +	if (flags & L3FWD_EVENT_SINGLE)
> +		lpm_event_loop_single(evt_rsrc, flags);
> +	if (flags & L3FWD_EVENT_BURST)
> +		lpm_event_loop_burst(evt_rsrc, flags);
> +}
> +
> +int __rte_noinline
> +lpm_event_main_loop_tx_d(__attribute__((unused)) void *dummy)
> +{
> +	struct l3fwd_event_resources *evt_rsrc =3D
> +					l3fwd_get_eventdev_rsrc();
> +
> +	lpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_DIRECT | L3FWD_EVENT_SINGLE);
> +	return 0;
> +}
> +
> +int __rte_noinline
> +lpm_event_main_loop_tx_d_burst(__attribute__((unused)) void *dummy)
> +{
> +	struct l3fwd_event_resources *evt_rsrc =3D
> +					l3fwd_get_eventdev_rsrc();
> +
> +	lpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_DIRECT | L3FWD_EVENT_BURST);
> +	return 0;
> +}
> +
> +int __rte_noinline
> +lpm_event_main_loop_tx_q(__attribute__((unused)) void *dummy)
> +{
> +	struct l3fwd_event_resources *evt_rsrc =3D
> +					l3fwd_get_eventdev_rsrc();
> +
> +	lpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_ENQ | L3FWD_EVENT_SINGLE);
> +	return 0;
> +}
> +
> +int __rte_noinline
> +lpm_event_main_loop_tx_q_burst(__attribute__((unused)) void *dummy)
> +{
> +	struct l3fwd_event_resources *evt_rsrc =3D
> +					l3fwd_get_eventdev_rsrc();
> +
> +	lpm_event_loop(evt_rsrc, L3FWD_EVENT_TX_ENQ | L3FWD_EVENT_BURST);
> +	return 0;
> +}
> +
>  void
>  setup_lpm(const int socketid)
>  {
> diff --git a/examples/l3fwd/main.c b/examples/l3fwd/main.c
> index 69d212bc2..b88fd88db 100644
> --- a/examples/l3fwd/main.c
> +++ b/examples/l3fwd/main.c
> @@ -951,13 +951,18 @@ main(int argc, char **argv)
>  	if (ret < 0)
>  		rte_exit(EXIT_FAILURE, "Invalid L3FWD parameters\n");
>=20
> +	/* Setup function pointers for lookup method. */
> +	setup_l3fwd_lookup_tables();
> +
>  	evt_rsrc->per_port_pool =3D per_port_pool;
>  	evt_rsrc->pkt_pool =3D pktmbuf_pool;
>  	evt_rsrc->port_mask =3D enabled_port_mask;
>  	/* Configure eventdev parameters if user has requested */
>  	l3fwd_event_resource_setup(&port_conf);
> -	if (evt_rsrc->enabled)
> +	if (evt_rsrc->enabled) {
> +		l3fwd_lkp.main_loop =3D evt_rsrc->ops.lpm_event_loop;
>  		goto skip_port_config;
> +	}
>=20
>  	if (check_lcore_params() < 0)
>  		rte_exit(EXIT_FAILURE, "check_lcore_params failed\n");
> @@ -973,9 +978,6 @@ main(int argc, char **argv)
>=20
>  	nb_lcores =3D rte_lcore_count();
>=20
> -	/* Setup function pointers for lookup method. */
> -	setup_l3fwd_lookup_tables();
> -
>  	/* initialize all ports */
>  	RTE_ETH_FOREACH_DEV(portid) {
>  		struct rte_eth_conf local_port_conf =3D port_conf;
> --
> 2.17.1