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 C56F4A0613 for ; Tue, 24 Sep 2019 11:42:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7EB7B378E; Tue, 24 Sep 2019 11:42:29 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 672D91BE0C for ; Tue, 24 Sep 2019 11:42:27 +0200 (CEST) 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 x8O9eJtD030888; Tue, 24 Sep 2019 02:42:26 -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=j6Nj9bzcV+os1Tcpp2i2CL6Cbflbl7w2h5610UaJy1k=; b=sPfmm/+L+Yk1pA4ZGJIQi1ATzNINJT+VaRDzGVGyfKwyWdl+3gu8QXUko753iAaAGVrM LGqmthzr6HyL0X8sBPlr9/LvcKHaDxBx+fZed4d9w3DhKJKo+g5d8182YcxRITM9YoKN NJzxxD9lNTXdrxly4ZGgm81rl5puRneVQrfWD6EiqLLZSZr9u00BbkbAdI3PV/q/oBFL jn8mHJk8JXAzkb4rVtcPaTziQsrYq4IUfImVVmgHnlSS+RsMZZyE3QGeuQx4+KSqF1oy pbTDF7ttab/Ya/16Bx19EXnojSxe22M65orXIhvNlGTkANUmpFoJHXiQTuCTwTZ89ERo 9A== Received: from sc-exch03.marvell.com ([199.233.58.183]) by mx0a-0016f401.pphosted.com with ESMTP id 2v5h7qj4h0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 24 Sep 2019 02:42:26 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Tue, 24 Sep 2019 02:42:25 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Tue, 24 Sep 2019 02:42:25 -0700 Received: from BG-LT7430.marvell.com (unknown [10.28.17.28]) by maili.marvell.com (Postfix) with ESMTP id B52B33F703F; Tue, 24 Sep 2019 02:42:22 -0700 (PDT) From: To: , , , Marko Kovacevic , Ori Kam , Radu Nicolau , Tomasz Kantecki , Sunil Kumar Kori , "Pavan Nikhilesh" CC: Date: Tue, 24 Sep 2019 15:12:02 +0530 Message-ID: <20190924094209.3827-4-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190924094209.3827-1-pbhagavatula@marvell.com> References: <20190919101346.8832-1-pbhagavatula@marvell.com> <20190924094209.3827-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-24_04:2019-09-23,2019-09-24 signatures=0 Subject: [dpdk-dev] [PATCH v4 03/10] examples/l2fwd-event: add infra to split eventdev framework 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: Pavan Nikhilesh 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 Signed-off-by: Pavan Nikhilesh --- examples/l2fwd-event/Makefile | 2 ++ examples/l2fwd-event/l2fwd_eventdev.c | 29 +++++++++++++++++++ examples/l2fwd-event/l2fwd_eventdev.h | 20 +++++++++++++ examples/l2fwd-event/l2fwd_eventdev_generic.c | 24 +++++++++++++++ .../l2fwd_eventdev_internal_port.c | 24 +++++++++++++++ examples/l2fwd-event/meson.build | 4 ++- 6 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 examples/l2fwd-event/l2fwd_eventdev_generic.c create mode 100644 examples/l2fwd-event/l2fwd_eventdev_internal_port.c diff --git a/examples/l2fwd-event/Makefile b/examples/l2fwd-event/Makefile index bfe0058a2..c1f700a65 100644 --- a/examples/l2fwd-event/Makefile +++ b/examples/l2fwd-event/Makefile @@ -8,6 +8,8 @@ APP = l2fwd-event # all source are stored in SRCS-y SRCS-y := main.c SRCS-y += l2fwd_eventdev.c +SRCS-y += l2fwd_eventdev_internal_port.c +SRCS-y += l2fwd_eventdev_generic.c # Build using pkg-config variables if possible ifeq ($(shell pkg-config --exists libdpdk && echo 0),0) diff --git a/examples/l2fwd-event/l2fwd_eventdev.c b/examples/l2fwd-event/l2fwd_eventdev.c index 19efb6d1e..df76f1c1f 100644 --- a/examples/l2fwd-event/l2fwd_eventdev.c +++ b/examples/l2fwd-event/l2fwd_eventdev.c @@ -76,6 +76,31 @@ parse_eventdev_args(char **argv, int argc) return 0; } +static void +eventdev_capability_setup(void) +{ + struct eventdev_resources *eventdev_rsrc = 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); + + eventdev_rsrc->tx_mode_q |= !(caps & + RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT); + } + + if (eventdev_rsrc->tx_mode_q) + eventdev_set_generic_ops(&eventdev_rsrc->ops); + else + eventdev_set_internal_port_ops(&eventdev_rsrc->ops); +} + void eventdev_resource_setup(void) { @@ -90,6 +115,10 @@ eventdev_resource_setup(void) if (!rte_event_dev_count()) rte_exit(EXIT_FAILURE, "No Eventdev found"); + + /* Setup eventdev capability callbacks */ + eventdev_capability_setup(); + /* 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 2e8d95e67..8b6606b4c 100644 --- a/examples/l2fwd-event/l2fwd_eventdev.h +++ b/examples/l2fwd-event/l2fwd_eventdev.h @@ -18,8 +18,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 void (*event_loop_cb)(void); + +struct eventdev_setup_ops { + event_queue_setup_cb event_queue_setup; + event_port_setup_cb event_port_setup; + eventdev_setup_cb eventdev_setup; + adapter_setup_cb adapter_setup; + service_setup_cb service_setup; + event_loop_cb l2fwd_event_loop; +}; + struct eventdev_resources { struct l2fwd_port_statistics *stats; + struct eventdev_setup_ops ops; struct rte_mempool *pkt_pool; uint64_t timer_period; uint32_t *dst_ports; @@ -58,5 +76,7 @@ get_eventdev_rsrc(void) } void eventdev_resource_setup(void); +void eventdev_set_generic_ops(struct eventdev_setup_ops *ops); +void eventdev_set_internal_port_ops(struct eventdev_setup_ops *ops); #endif /* __L2FWD_EVENTDEV_H__ */ diff --git a/examples/l2fwd-event/l2fwd_eventdev_generic.c b/examples/l2fwd-event/l2fwd_eventdev_generic.c new file mode 100644 index 000000000..e3990f8b0 --- /dev/null +++ b/examples/l2fwd-event/l2fwd_eventdev_generic.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "l2fwd_common.h" +#include "l2fwd_eventdev.h" + +void +eventdev_set_generic_ops(struct eventdev_setup_ops *ops) +{ + RTE_SET_USED(ops); +} diff --git a/examples/l2fwd-event/l2fwd_eventdev_internal_port.c b/examples/l2fwd-event/l2fwd_eventdev_internal_port.c new file mode 100644 index 000000000..a0d2111f9 --- /dev/null +++ b/examples/l2fwd-event/l2fwd_eventdev_internal_port.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "l2fwd_common.h" +#include "l2fwd_eventdev.h" + +void +eventdev_set_internal_port_ops(struct eventdev_setup_ops *ops) +{ + RTE_SET_USED(ops); +} diff --git a/examples/l2fwd-event/meson.build b/examples/l2fwd-event/meson.build index b1ad48cc5..38560840c 100644 --- a/examples/l2fwd-event/meson.build +++ b/examples/l2fwd-event/meson.build @@ -9,5 +9,7 @@ sources = files( 'main.c', - 'l2fwd_eventdev.c' + 'l2fwd_eventdev.c', + 'l2fwd_eventdev_internal_port.c', + 'l2fwd_eventdev_generic.c' ) -- 2.17.1