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 5EBA9A0613 for ; Thu, 26 Sep 2019 12:06:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6F4C51BF41; Thu, 26 Sep 2019 12:06:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 4DEAD1BF2A for ; Thu, 26 Sep 2019 12:06:12 +0200 (CEST) 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 x8QA5PsF000795; Thu, 26 Sep 2019 03:06:11 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=vPUbzA3mcZfxzIfEbAjIKbuTvPVGD3iZBQvadLhpwe0=; b=GV36bVBStA26W+LbZ+WnbanyT+Qr2s63Z3PT5PwXwcAOwmXNpVDGiGNPDP/VtC/cW6jE TsX8Ra0Q3LftUi1Hb/+QCnlbf37ZzlIa5bdh+DioO/aTWtrhxlEyWIlwNoeHiiVYP+rA sAdqFa+De2X+5lBjioCmeXiM4cL+pPQ9JV7boZ8DS/bS/9vEwTyO7zPnXIPqx/eJXn1V Wo86R+HGTyJa1zrovtzcmKzxadKSQTTI63Hd82FOsZdIOdaPFf8UyTVMscgkJeKW3yTQ 63Z2mHfgO0mLGtsX1dhl3mSFEbbOid7pHPl71t3DBeWmvk26ptLKgvDzeTcicoIj1SOV dg== Received: from sc-exch04.marvell.com ([199.233.58.184]) by mx0b-0016f401.pphosted.com with ESMTP id 2v8u5dr196-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 26 Sep 2019 03:06:11 -0700 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.1367.3; Thu, 26 Sep 2019 03:06:09 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 26 Sep 2019 03:06:09 -0700 Received: from BG-LT7430.marvell.com (unknown [10.28.17.15]) by maili.marvell.com (Postfix) with ESMTP id A17E03F7041; Thu, 26 Sep 2019 03:06:06 -0700 (PDT) From: To: , , Marko Kovacevic , Ori Kam , Bruce Richardson , Radu Nicolau , "Tomasz Kantecki" CC: , Sunil Kumar Kori Date: Thu, 26 Sep 2019 15:35:49 +0530 Message-ID: <20190926100558.24348-3-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190926100558.24348-1-pbhagavatula@marvell.com> References: <20190926100558.24348-1-pbhagavatula@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-09-26_04:2019-09-25,2019-09-26 signatures=0 Subject: [dpdk-dev] [PATCH 02/11] examples/l3fwd: split pipelines based on capability 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" From: Sunil Kumar Kori Add infra to split eventdev framework based on event Tx adapter capability. If event Tx adapter has internal port capability then we use `rte_event_eth_tx_adapter_enqueue` to transmitting packets else we use a SINGLE_LINK event queue to enqueue packets to a service core which is responsible for transmitting packets. Signed-off-by: Sunil Kumar Kori --- examples/l3fwd/Makefile | 1 + examples/l3fwd/l3fwd_eventdev.c | 31 +++++++++++++++++++ examples/l3fwd/l3fwd_eventdev.h | 21 +++++++++++++ examples/l3fwd/l3fwd_eventdev_generic.c | 12 +++++++ examples/l3fwd/l3fwd_eventdev_internal_port.c | 12 +++++++ examples/l3fwd/meson.build | 3 +- 6 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 examples/l3fwd/l3fwd_eventdev_generic.c create mode 100644 examples/l3fwd/l3fwd_eventdev_internal_port.c diff --git a/examples/l3fwd/Makefile b/examples/l3fwd/Makefile index 4d20f3790..42d3f0bb6 100644 --- a/examples/l3fwd/Makefile +++ b/examples/l3fwd/Makefile @@ -6,6 +6,7 @@ APP = l3fwd # all source are stored in SRCS-y SRCS-y := main.c l3fwd_lpm.c l3fwd_em.c l3fwd_eventdev.c +SRCS-y += l3fwd_eventdev_generic.c l3fwd_eventdev_internal_port.c # Build using pkg-config variables if possible ifeq ($(shell pkg-config --exists libdpdk && echo 0),0) diff --git a/examples/l3fwd/l3fwd_eventdev.c b/examples/l3fwd/l3fwd_eventdev.c index 319a20746..fa464626d 100644 --- a/examples/l3fwd/l3fwd_eventdev.c +++ b/examples/l3fwd/l3fwd_eventdev.c @@ -66,6 +66,31 @@ l3fwd_parse_eventdev_args(char **argv, int argc) return 0; } +static void +l3fwd_eventdev_capability_setup(void) +{ + struct l3fwd_eventdev_resources *evdev_rsrc = l3fwd_get_eventdev_rsrc(); + uint32_t caps = 0; + uint16_t i; + int ret; + + RTE_ETH_FOREACH_DEV(i) { + ret = rte_event_eth_tx_adapter_caps_get(0, i, &caps); + if (ret) + rte_exit(EXIT_FAILURE, + "Invalid capability for Tx adptr port %d\n", + i); + + evdev_rsrc->tx_mode_q |= !(caps & + RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT); + } + + if (evdev_rsrc->tx_mode_q) + l3fwd_eventdev_set_generic_ops(&evdev_rsrc->ops); + else + l3fwd_eventdev_set_internal_port_ops(&evdev_rsrc->ops); +} + void l3fwd_eventdev_resource_setup(void) { @@ -76,4 +101,10 @@ l3fwd_eventdev_resource_setup(void) ret = l3fwd_parse_eventdev_args(evdev_rsrc->args, evdev_rsrc->nb_args); if (ret < 0 || !evdev_rsrc->enabled) return; + + if (!rte_event_dev_count()) + rte_exit(EXIT_FAILURE, "No Eventdev found"); + + /* Setup eventdev capability callbacks */ + l3fwd_eventdev_capability_setup(); } diff --git a/examples/l3fwd/l3fwd_eventdev.h b/examples/l3fwd/l3fwd_eventdev.h index 64d9207a3..61a537864 100644 --- a/examples/l3fwd/l3fwd_eventdev.h +++ b/examples/l3fwd/l3fwd_eventdev.h @@ -7,6 +7,7 @@ #include #include +#include #include #include "l3fwd.h" @@ -19,8 +20,26 @@ enum { CMD_LINE_OPT_EVENTQ_SYNC_NUM, }; +typedef void (*event_queue_setup_cb)(uint16_t ethdev_count, + uint32_t event_queue_cfg); +typedef uint32_t (*eventdev_setup_cb)(uint16_t ethdev_count); +typedef void (*adapter_setup_cb)(uint16_t ethdev_count); +typedef void (*event_port_setup_cb)(void); +typedef void (*service_setup_cb)(void); +typedef int (*event_loop_cb)(void *); + +struct l3fwd_eventdev_setup_ops { + event_queue_setup_cb event_queue_setup; + event_port_setup_cb event_port_setup; + adapter_setup_cb adapter_setup; + event_loop_cb lpm_event_loop; + event_loop_cb em_event_loop; +}; + struct l3fwd_eventdev_resources { + struct l3fwd_eventdev_setup_ops ops; uint8_t sync_mode; + uint8_t tx_mode_q; uint8_t enabled; uint8_t nb_args; char **args; @@ -50,5 +69,7 @@ l3fwd_get_eventdev_rsrc(void) } void l3fwd_eventdev_resource_setup(void); +void l3fwd_eventdev_set_generic_ops(struct l3fwd_eventdev_setup_ops *ops); +void l3fwd_eventdev_set_internal_port_ops(struct l3fwd_eventdev_setup_ops *ops); #endif /* __L3FWD_EVENTDEV_H__ */ diff --git a/examples/l3fwd/l3fwd_eventdev_generic.c b/examples/l3fwd/l3fwd_eventdev_generic.c new file mode 100644 index 000000000..35e655fc0 --- /dev/null +++ b/examples/l3fwd/l3fwd_eventdev_generic.c @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include "l3fwd.h" +#include "l3fwd_eventdev.h" + +void +l3fwd_eventdev_set_generic_ops(struct l3fwd_eventdev_setup_ops *ops) +{ + RTE_SET_USED(ops); +} diff --git a/examples/l3fwd/l3fwd_eventdev_internal_port.c b/examples/l3fwd/l3fwd_eventdev_internal_port.c new file mode 100644 index 000000000..f698a0ce1 --- /dev/null +++ b/examples/l3fwd/l3fwd_eventdev_internal_port.c @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include "l3fwd.h" +#include "l3fwd_eventdev.h" + +void +l3fwd_eventdev_set_internal_port_ops(struct l3fwd_eventdev_setup_ops *ops) +{ + RTE_SET_USED(ops); +} diff --git a/examples/l3fwd/meson.build b/examples/l3fwd/meson.build index c88676817..dccea0b02 100644 --- a/examples/l3fwd/meson.build +++ b/examples/l3fwd/meson.build @@ -8,5 +8,6 @@ deps += ['hash', 'lpm', 'eventdev'] sources = files( - 'l3fwd_em.c', 'l3fwd_lpm.c', 'l3fwd_eventdev.c', 'main.c' + 'l3fwd_em.c', 'l3fwd_lpm.c', 'l3fwd_eventdev.c', + 'l3fwd_eventdev_internal_port.c', 'l3fwd_eventdev_generic.c', 'main.c' ) -- 2.17.1