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 B07A2A2EDB for ; Wed, 2 Oct 2019 22:58:30 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 487B51BF7F; Wed, 2 Oct 2019 22:58:14 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id 613241BF7D for ; Wed, 2 Oct 2019 22:58: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 x92KsWdN015442; Wed, 2 Oct 2019 13:58: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=kvNeF7gcaMLPOagYjr0py1voUaVgGPnq/CqjvD/PMWQ=; b=eY2/ey/5H+NQ6uopdpvdRgoS85niSvreUQ5WJ7+0CiIQCw9mvjrK1kbuq+TW2kP6KT5d CIt8NJZkooC4AHlz7ZPKeuQxmkZ/4naJA1qVREbU5ZtfNegnGRmdssOj8GrvqZAgfyhu qtnEcWCC0ZWjPB9idqM3mC7CsnUIVQYlfy0Ck46zJ/1tWcgYpWUKAQW92mkaswcdcoif N8fBpwHceEub00RNagkFrLGe27D2k/zbPeTx9IwhBZtXOqdckzbq7vtJxbaMQPwsUbML XTJ5LneQZx1s2GOcH9IAEt4VHM1kbpjf2EJlFXzJcE5DPjzUZP9Ri7ZNrM86PhBrHWwF XA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0b-0016f401.pphosted.com with ESMTP id 2vd0ya0ks9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 02 Oct 2019 13:58:11 -0700 Received: from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Wed, 2 Oct 2019 13:58:10 -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; Wed, 2 Oct 2019 13:58:10 -0700 Received: from BG-LT7430.marvell.com (unknown [10.28.17.68]) by maili.marvell.com (Postfix) with ESMTP id 177F83F7040; Wed, 2 Oct 2019 13:58:06 -0700 (PDT) From: To: , , , Marko Kovacevic , Ori Kam , Radu Nicolau , Tomasz Kantecki , Sunil Kumar Kori , "Pavan Nikhilesh" CC: Date: Thu, 3 Oct 2019 02:27:47 +0530 Message-ID: <20191002205754.11746-4-pbhagavatula@marvell.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191002205754.11746-1-pbhagavatula@marvell.com> References: <20190924094209.3827-1-pbhagavatula@marvell.com> <20191002205754.11746-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-10-02_08:2019-10-01,2019-10-02 signatures=0 Subject: [dpdk-dev] [PATCH v5 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: 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 Signed-off-by: Pavan Nikhilesh --- examples/l2fwd-event/Makefile | 2 ++ examples/l2fwd-event/l2fwd_event.c | 27 +++++++++++++++++++ examples/l2fwd-event/l2fwd_event.h | 7 +++++ examples/l2fwd-event/l2fwd_event_generic.c | 23 ++++++++++++++++ .../l2fwd-event/l2fwd_event_internal_port.c | 23 ++++++++++++++++ examples/l2fwd-event/meson.build | 2 ++ 6 files changed, 84 insertions(+) create mode 100644 examples/l2fwd-event/l2fwd_event_generic.c create mode 100644 examples/l2fwd-event/l2fwd_event_internal_port.c diff --git a/examples/l2fwd-event/Makefile b/examples/l2fwd-event/Makefile index 08ba1835d..6f4176882 100644 --- a/examples/l2fwd-event/Makefile +++ b/examples/l2fwd-event/Makefile @@ -10,6 +10,8 @@ SRCS-y := main.c SRCS-y += l2fwd_poll.c SRCS-y += l2fwd_event.c SRCS-y += l2fwd_common.c +SRCS-y += l2fwd_event_generic.c +SRCS-y += l2fwd_event_internal_port.c # Build using pkg-config variables if possible ifeq ($(shell pkg-config --exists libdpdk && echo 0),0) diff --git a/examples/l2fwd-event/l2fwd_event.c b/examples/l2fwd-event/l2fwd_event.c index 621ff63f0..1fb4dbeb6 100644 --- a/examples/l2fwd-event/l2fwd_event.c +++ b/examples/l2fwd-event/l2fwd_event.c @@ -17,6 +17,30 @@ #include "l2fwd_event.h" +static void +l2fwd_event_capability_setup(struct l2fwd_event_resources *event_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); + + event_rsrc->tx_mode_q |= !(caps & + RTE_EVENT_ETH_TX_ADAPTER_CAP_INTERNAL_PORT); + } + + if (event_rsrc->tx_mode_q) + l2fwd_event_set_generic_ops(&event_rsrc->ops); + else + l2fwd_event_set_internal_port_ops(&event_rsrc->ops); +} + void l2fwd_event_resource_setup(struct l2fwd_resources *l2fwd_rsrc) { @@ -31,4 +55,7 @@ l2fwd_event_resource_setup(struct l2fwd_resources *l2fwd_rsrc) rte_exit(EXIT_FAILURE, "failed to allocate memory\n"); l2fwd_rsrc->event_rsrc = event_rsrc; + + /* Setup eventdev capability callbacks */ + l2fwd_event_capability_setup(event_rsrc); } diff --git a/examples/l2fwd-event/l2fwd_event.h b/examples/l2fwd-event/l2fwd_event.h index 8ac2dc266..b9d089c2f 100644 --- a/examples/l2fwd-event/l2fwd_event.h +++ b/examples/l2fwd-event/l2fwd_event.h @@ -13,9 +13,16 @@ #include "l2fwd_common.h" +struct event_setup_ops { +}; + struct l2fwd_event_resources { + uint8_t tx_mode_q; + struct event_setup_ops ops; }; void l2fwd_event_resource_setup(struct l2fwd_resources *l2fwd_rsrc); +void l2fwd_event_set_generic_ops(struct event_setup_ops *ops); +void l2fwd_event_set_internal_port_ops(struct event_setup_ops *ops); #endif /* __L2FWD_EVENT_H__ */ diff --git a/examples/l2fwd-event/l2fwd_event_generic.c b/examples/l2fwd-event/l2fwd_event_generic.c new file mode 100644 index 000000000..9afade7d2 --- /dev/null +++ b/examples/l2fwd-event/l2fwd_event_generic.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "l2fwd_common.h" +#include "l2fwd_event.h" + +void +l2fwd_event_set_generic_ops(struct event_setup_ops *ops) +{ + RTE_SET_USED(ops); +} diff --git a/examples/l2fwd-event/l2fwd_event_internal_port.c b/examples/l2fwd-event/l2fwd_event_internal_port.c new file mode 100644 index 000000000..ce95b8e6d --- /dev/null +++ b/examples/l2fwd-event/l2fwd_event_internal_port.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2019 Marvell International Ltd. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "l2fwd_common.h" +#include "l2fwd_event.h" + +void +l2fwd_event_set_internal_port_ops(struct event_setup_ops *ops) +{ + RTE_SET_USED(ops); +} diff --git a/examples/l2fwd-event/meson.build b/examples/l2fwd-event/meson.build index 84ee1af84..69e90ab2d 100644 --- a/examples/l2fwd-event/meson.build +++ b/examples/l2fwd-event/meson.build @@ -12,4 +12,6 @@ sources = files( 'l2fwd_poll.c', 'l2fwd_common.c', 'l2fwd_event.c', + 'l2fwd_event_internal_port.c', + 'l2fwd_event_generic.c' ) -- 2.17.1