From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 20FA8A04F1; Mon, 6 Jan 2020 05:43:36 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7387E1D594; Mon, 6 Jan 2020 05:43:35 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id F1F561D57F for ; Mon, 6 Jan 2020 05:43:33 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0064fthG025226; Sun, 5 Jan 2020 20:43:33 -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=ZSEmzD5sp/jmc8ySq/rLngCviQUBq3HI3EdAUDUGghQ=; b=nLnqlqW0jy58sQH4A/7QNYti+Hk2N+i+7Slk8SydxOXUaN0bi/gjmFIKGXvIBa7mFh7m 5lkXMEoGRATFKRW1HwCTepOGGONQ77NTSkr0lEQUg8lua7zYJkwtt0hsHaTdZfm7q0vt H5zGtg5fFeBTHpfZ3oLmSuZ/d6cb2KTr0pSCyHef6A7FCTg1Zj7vFoZa7b3PARMv8HMl JjeDB3YiWFg2mkwIJjDD4anTEEvf9NsOZb5Pds/FbotRX4gHb6JyLTJIg8vfyatYRgMH KYaJv7SWwDkEdtnmPl4ZkJgFw2+yZsXE0zFV1NFcnO8a6b0CN+xWznORgJfoSk5Z8XuR xA== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2xau3sm3vv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 05 Jan 2020 20:43:33 -0800 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH04.marvell.com (10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 5 Jan 2020 20:43:30 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.108) 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:43:30 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jsU7eXKMuMji2dlXetK7reTdlsG/9YJXd4TZQtf63wcw6cjRme/7qQEDTheM61zYovUql1lHijJVjf2KyLKog+h0MnTrx/BiNM5/Yw/2Bbw1gY+a8N+j0ZqsJg9wbISNJlA0aRbR7dwyiOnAv9cF4wct1lcLui8iwbqG5jNG20G/85KTdtM4Uruhfd/aqamSqKA7m7l6IEEEQ/4AsVQN79tIH2RROZ71rUHa9zQlNlrM1r9W1L36dWjpxqWKKvwcL5r0fla7szC0LWbZWi80BgNuGeoLqltFF3Dv0bByeX2GwrZohkInDjKm9y2jaMkZ6FVRxOVS+k8/p2GQDRabtw== 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=ZSEmzD5sp/jmc8ySq/rLngCviQUBq3HI3EdAUDUGghQ=; b=DeRxPUfkorEYD0eesUT09HcLJFcSTGvf82rXr9xsdJX2Vau8mYJMMRVe9Kstxp910c9ZGF4LqVg6A4+Th5Ha7f9gbyDOZO/Paoi79TCVwVIPqfMRq8hHr5S+6nTAaba7vtVl4jLAGFRIEERAEXabMxx1yv7Tf6WqS+ycPYj14UZ4qt53L2IA5CkY2+qXUxO4diBoszT636gFQkW8xe+wh/KNtHsWcYRFP6UHmhHuRl1HhFuIwVTHcgrWDVR9Qi2Uh8jbtofB3HEMlwfGUHg/4t2xknqXGWESNxbLUDc13Q61gueMo87544T4jgWvOHoHG2mScoJwOLhsaTegdr2F4A== 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=ZSEmzD5sp/jmc8ySq/rLngCviQUBq3HI3EdAUDUGghQ=; b=YTVhqEdAZIWr1Vyzz8b/FIdpw5K+1UAmTysQTj6USjoe77gvlkATWqshICq4hCNTODTYAMnALjM1RFHqOZjyfvBAiG7lF5/QrXnW06OOCzvTuQzt0LislJMJQQgFVSfzyeGuMs5kG8PC8t+BB6V1CHO8D7MkOyVNXISvNloupYI= Received: from CY4PR1801MB1863.namprd18.prod.outlook.com (10.171.255.160) by CY4PR1801MB1829.namprd18.prod.outlook.com (10.165.88.138) 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:43:29 +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:43:29 +0000 From: Pavan Nikhilesh Bhagavatula To: "Ananyev, Konstantin" , "Jerin Jacob Kollanukkaran" , "Kovacevic, Marko" , Ori Kam , "Richardson, Bruce" , "Nicolau, Radu" , Akhil Goyal , "Kantecki, Tomasz" , Sunil Kumar Kori CC: "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2 08/11] examples/l3fwd: add event lpm main loop Thread-Index: AQHVqrFdbfjCOKuYw0SouikTCuPvBKfZGp2AgAQklAA= Date: Mon, 6 Jan 2020 04:43:28 +0000 Message-ID: References: <20191204144345.5736-1-pbhagavatula@marvell.com> <20191204144345.5736-9-pbhagavatula@marvell.com> In-Reply-To: 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: 5c41aa8b-4254-410b-d95b-08d79262f9c6 x-ms-traffictypediagnostic: CY4PR1801MB1829: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:1824; x-forefront-prvs: 0274272F87 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(4636009)(39850400004)(396003)(366004)(136003)(376002)(346002)(189003)(199004)(52536014)(6636002)(76116006)(64756008)(66556008)(66476007)(66946007)(66446008)(8936002)(5660300002)(4326008)(30864003)(8676002)(81166006)(81156014)(55016002)(9686003)(33656002)(478600001)(7696005)(26005)(55236004)(6506007)(86362001)(2906002)(110136005)(316002)(186003)(71200400001)(921003)(1121003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1801MB1829; H:CY4PR1801MB1863.namprd18.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A: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: Vbe7lWiyo83zM4QOrljSEbEwyY452uBsA6wBa/IU61mqSjOheQS++BYr+3XkuowRzN0z3y9AfHQcRqsm9jbJdarVarIKurRkstw4Qiyyy2qJ3B/xMd7QrXZQRSUiuYm73kqlwjzXMf5me3wTKSXqaXvvNR09/kksM/jVdtkfM3LQEe/dWx0gVoMnPniGKLZsOzi6An6HDrrVvyvmBe9EeXuHlHeKN9TP26Ij6iWwqvrIdnJV4u6nDIyAKqG/XsQMqcUJ1bXdVBtQ6xP+2JT/DryBq3ZLXPp61wOZI2FwoML2yx3UyVXrZ1S3VHtqbFaaxAMjmTzeOf6FfVBvJNMm1cfXEqnt5ujEaoFp2gR/P5XTJ+BCMnj0p9dvtYf4x5bxuh6AnwE422JLpAd0ue+d972nCrI4xoFNAmE7COtDSvP9EdktnSGtql2/KJi83OrKnIZbe0IPUY7hATZfENB54FJcuD+fvArYvLRKfdpIgrGWeSu1jYP3e71h/KHJAp2I Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: 5c41aa8b-4254-410b-d95b-08d79262f9c6 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2020 04:43:29.0094 (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: A8en+iUn7vQD2eB25pgwdEb96zDT6AUfpZ7rtHIs0OviIIM2LPcpqdUGSdOd4i9HsL9itEYMuMHrd2srLaYJqb1vjV+ry3gaZs46qq7YiIs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1801MB1829 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >> Add lpm main loop for handling events based on capabilities of the >> event device. >> >> Signed-off-by: Pavan Nikhilesh >> --- >> 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(-) >> >> 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); >> >> +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)'? > These functions are used in remote launch so, we can't modify the prototype= . rte_eal_mp_remote_launch(l3fwd_lkp.main_loop, NULL, CALL_MASTER); I will remove the unnecessary attribute in next version. >> + >> /* 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; >> >> @@ -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 @@ >> >> #include "l3fwd.h" >> >> +#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" >> >> 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 >> >> #include "l3fwd.h" >> +#include "l3fwd_event.h" >> >> struct ipv4_l3fwd_lpm_route { >> uint32_t ip; >> @@ -254,6 +255,236 @@ lpm_main_loop(__attribute__((unused)) >void *dummy) >> return 0; >> } >> >> +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 *)ð_hdr->d_addr =3D >dest_eth_addr[mbuf->port]; >> + >> + /* src addr */ >> + rte_ether_addr_copy(&ports_eth_addr[mbuf->port], >> + ð_hdr->s_addr); >> +#endif > >The code snippet above looks pretty much the same as in >l3fwd_lpm_simple_forward() >except missing IPv6 part. >Same for loop_burst() below. >Instead od duplicating the code in dozen places, can we put this >common code >into a function and use it? Sure, I will move it to l3fwd_lpm.h and use it across. > > > >> + 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 *)ð_hdr->d_addr =3D >dest_eth_addr[ >> + mbuf- >>port]; >> + /* src addr */ >> + rte_ether_addr_copy(&ports_eth_addr[mbuf- >>port], >> + ð_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"); >> >> + /* 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; >> + } >> >> if (check_lcore_params() < 0) >> rte_exit(EXIT_FAILURE, "check_lcore_params >failed\n"); >> @@ -973,9 +978,6 @@ main(int argc, char **argv) >> >> nb_lcores =3D rte_lcore_count(); >> >> - /* 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