From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68758C2BA19 for ; Sun, 5 Apr 2020 08:59:38 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id C969320675 for ; Sun, 5 Apr 2020 08:59:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Uq/Ma4Eh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C969320675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=marvell.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5AAC31C0BC; Sun, 5 Apr 2020 10:57:12 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 0F18D1BED1 for ; Sun, 5 Apr 2020 10:57:10 +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 0358uTeo029756; Sun, 5 Apr 2020 01:57:09 -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=6z4ScVFOqcP9ZMHJZc9/zrOH+h1IcqOlvpXH4XolvkU=; b=Uq/Ma4Eho1wjuM9i9nwx4MbVPMRlbbnvRmDCoee06FXl1K1kFhiedPrS9chcEii1tSgf F5sEumxOKI68y0n7fWPL/W9BVFby+GwMvSHZxC/sZLkK1HPXzUHo12irUmAOTPhUADdk h7DgITmQ8W0RolizHVgllCClWL1wZQjGGVmDExgmFS+rU7mHXyKijksy18Q9BUKxp2YU SpC7/jMrEeoVxRhx6BmOEymKf/SG8RQdB2NOP2VQGa9h276MarSPdg7GFC6dfV6w6bRN ak1++QOgKRYz+c1mk45+Qc550x5FJGyTsgvdyxhwHbrI3CYC++zCEZy7Q0+tveT2usvJ EA== Received: from sc-exch02.marvell.com ([199.233.58.182]) by mx0a-0016f401.pphosted.com with ESMTP id 306qkqtmrn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 05 Apr 2020 01:57:08 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH02.marvell.com (10.93.176.82) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Sun, 5 Apr 2020 01:57:07 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Sun, 5 Apr 2020 01:57:07 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 0865C3F7040; Sun, 5 Apr 2020 01:57:03 -0700 (PDT) From: To: Thomas Monjalon , John McNamara , Marko Kovacevic , Nithin Dabilpuram , Pavan Nikhilesh , Bruce Richardson CC: , , , , , Date: Sun, 5 Apr 2020 14:25:59 +0530 Message-ID: <20200405085613.1336841-16-jerinj@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200405085613.1336841-1-jerinj@marvell.com> References: <20200331192945.2466880-1-jerinj@marvell.com> <20200405085613.1336841-1-jerinj@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.138, 18.0.676 definitions=2020-04-05_01:2020-04-03, 2020-04-05 signatures=0 Subject: [dpdk-dev] [PATCH v4 15/29] node: add log infra and null node 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: Nithin Dabilpuram Add log infra for node specific logging. Also, add null rte_node that just ignores all the objects directed to it. Signed-off-by: Nithin Dabilpuram Signed-off-by: Pavan Nikhilesh Signed-off-by: Kiran Kumar K --- MAINTAINERS | 5 +++++ app/test/meson.build | 7 +++++-- config/common_base | 5 +++++ doc/api/doxy-api.conf.in | 1 + lib/Makefile | 3 +++ lib/librte_node/Makefile | 22 ++++++++++++++++++++++ lib/librte_node/log.c | 14 ++++++++++++++ lib/librte_node/meson.build | 8 ++++++++ lib/librte_node/node_private.h | 22 ++++++++++++++++++++++ lib/librte_node/null.c | 23 +++++++++++++++++++++++ lib/librte_node/rte_node_version.map | 6 ++++++ lib/meson.build | 5 ++++- meson.build | 1 + mk/rte.app.mk | 1 + 14 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 lib/librte_node/Makefile create mode 100644 lib/librte_node/log.c create mode 100644 lib/librte_node/meson.build create mode 100644 lib/librte_node/node_private.h create mode 100644 lib/librte_node/null.c create mode 100644 lib/librte_node/rte_node_version.map diff --git a/MAINTAINERS b/MAINTAINERS index aa40cc92b..55fb9bbb0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1467,6 +1467,11 @@ M: Jerin Jacob M: Kiran Kumar K F: lib/librte_graph/ +Nodes - EXPERIMENTAL +M: Nithin Dabilpuram +M: Pavan Nikhilesh +F: lib/librte_node/ + Test Applications ----------------- diff --git a/app/test/meson.build b/app/test/meson.build index 9006cc074..728d20c1f 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -154,7 +154,8 @@ test_deps = ['acl', 'ring', 'stack', 'timer', - 'graph' + 'graph', + 'node' ] # Each test is marked with flag true/false @@ -390,13 +391,15 @@ endforeach test_dep_objs += cc.find_library('execinfo', required: false) link_libs = [] +link_nodes = [] if get_option('default_library') == 'static' link_libs = dpdk_drivers + link_nodes = dpdk_graph_nodes endif dpdk_test = executable('dpdk-test', test_sources, - link_whole: link_libs, + link_whole: link_libs + link_nodes, dependencies: test_dep_objs, c_args: [cflags, '-DALLOW_EXPERIMENTAL_API'], install_rpath: driver_install_path, diff --git a/config/common_base b/config/common_base index 32f982136..1ed5187dc 100644 --- a/config/common_base +++ b/config/common_base @@ -1081,6 +1081,11 @@ CONFIG_RTE_LIBRTE_GRAPH=y CONFIG_RTE_GRAPH_BURST_SIZE=256 CONFIG_RTE_LIBRTE_GRAPH_STATS=y +# +# Compile librte_node +# +CONFIG_RTE_LIBRTE_NODE=y + # # Compile the test application # diff --git a/doc/api/doxy-api.conf.in b/doc/api/doxy-api.conf.in index e3b7f54f8..92122125a 100644 --- a/doc/api/doxy-api.conf.in +++ b/doc/api/doxy-api.conf.in @@ -49,6 +49,7 @@ INPUT = @TOPDIR@/doc/api/doxy-api-index.md \ @TOPDIR@/lib/librte_mempool \ @TOPDIR@/lib/librte_meter \ @TOPDIR@/lib/librte_metrics \ + @TOPDIR@/lib/librte_node \ @TOPDIR@/lib/librte_net \ @TOPDIR@/lib/librte_pci \ @TOPDIR@/lib/librte_pdump \ diff --git a/lib/Makefile b/lib/Makefile index 1f572b659..50d61a338 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -122,6 +122,9 @@ DEPDIRS-librte_rcu := librte_eal DIRS-$(CONFIG_RTE_LIBRTE_GRAPH) += librte_graph DEPDIRS-librte_graph := librte_eal +DIRS-$(CONFIG_RTE_LIBRTE_NODE) += librte_node +DEPDIRS-librte_node := librte_graph librte_lpm librte_ethdev librte_mbuf + ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) DIRS-$(CONFIG_RTE_LIBRTE_KNI) += librte_kni endif diff --git a/lib/librte_node/Makefile b/lib/librte_node/Makefile new file mode 100644 index 000000000..dbc8e1d44 --- /dev/null +++ b/lib/librte_node/Makefile @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2020 Marvell International Ltd. +# + +include $(RTE_SDK)/mk/rte.vars.mk + +# library name +LIB = librte_node.a + +CFLAGS += -O3 -DALLOW_EXPERIMENTAL_API +CFLAGS += $(WERROR_FLAGS) +# Strict-aliasing rules are violated by uint8_t[] to context size casts. +CFLAGS += -fno-strict-aliasing +LDLIBS += -lrte_eal -lrte_graph + +EXPORT_MAP := rte_node_version.map + +# all source are stored in SRCS-y +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += null.c +SRCS-$(CONFIG_RTE_LIBRTE_NODE) += log.c + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/lib/librte_node/log.c b/lib/librte_node/log.c new file mode 100644 index 000000000..f035f91e8 --- /dev/null +++ b/lib/librte_node/log.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2020 Marvell International Ltd. + */ + +#include "node_private.h" + +int rte_node_logtype; + +RTE_INIT(rte_node_init_log) +{ + rte_node_logtype = rte_log_register("lib.node"); + if (rte_node_logtype >= 0) + rte_log_set_level(rte_node_logtype, RTE_LOG_INFO); +} diff --git a/lib/librte_node/meson.build b/lib/librte_node/meson.build new file mode 100644 index 000000000..a97813ad4 --- /dev/null +++ b/lib/librte_node/meson.build @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(C) 2020 Marvell International Ltd. + +sources = files('null.c', 'log.c') +allow_experimental_apis = true +# Strict-aliasing rules are violated by uint8_t[] to context size casts. +cflags += '-fno-strict-aliasing' +deps += ['graph'] diff --git a/lib/librte_node/node_private.h b/lib/librte_node/node_private.h new file mode 100644 index 000000000..f30902a94 --- /dev/null +++ b/lib/librte_node/node_private.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2020 Marvell International Ltd. + */ + +#ifndef __NODE_PRIVATE_H__ +#define __NODE_PRIVATE_H__ + +#include +#include + +extern int rte_node_logtype; +#define NODE_LOG(level, node_name, ...) \ + rte_log(RTE_LOG_##level, rte_node_logtype, \ + RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n", \ + node_name, __func__, __LINE__, \ + RTE_FMT_TAIL(__VA_ARGS__, ))) + +#define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__) +#define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__) +#define node_dbg(node_name, ...) NODE_LOG(DEBUG, node_name, __VA_ARGS__) + +#endif /* __NODE_PRIVATE_H__ */ diff --git a/lib/librte_node/null.c b/lib/librte_node/null.c new file mode 100644 index 000000000..c7cd8b6df --- /dev/null +++ b/lib/librte_node/null.c @@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(C) 2020 Marvell International Ltd. + */ + +#include + +static uint16_t +null(struct rte_graph *graph, struct rte_node *node, void **objs, + uint16_t nb_objs) +{ + RTE_SET_USED(node); + RTE_SET_USED(objs); + RTE_SET_USED(graph); + + return nb_objs; +} + +static struct rte_node_register null_node = { + .name = "null", + .process = null, +}; + +RTE_NODE_REGISTER(null_node); diff --git a/lib/librte_node/rte_node_version.map b/lib/librte_node/rte_node_version.map new file mode 100644 index 000000000..f87163bb9 --- /dev/null +++ b/lib/librte_node/rte_node_version.map @@ -0,0 +1,6 @@ +EXPERIMENTAL { + global: + + rte_node_logtype; + local: *; +}; diff --git a/lib/meson.build b/lib/meson.build index c43d86bb9..147129b0b 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -30,7 +30,7 @@ libraries = [ # add pkt framework libs which use other libs from above 'port', 'table', 'pipeline', # flow_classify lib depends on pkt framework table lib - 'flow_classify', 'bpf', 'graph', 'telemetry'] + 'flow_classify', 'bpf', 'graph', 'node', 'telemetry'] if is_windows libraries = ['kvargs','eal'] # only supported libraries for windows @@ -186,6 +186,9 @@ foreach l:libraries dpdk_libraries = [shared_lib] + dpdk_libraries dpdk_static_libraries = [static_lib] + dpdk_static_libraries + if libname == 'rte_node' + dpdk_graph_nodes = [static_lib] + endif endif # sources.length() > 0 set_variable('shared_rte_' + name, shared_dep) diff --git a/meson.build b/meson.build index d36580438..269ba9614 100644 --- a/meson.build +++ b/meson.build @@ -16,6 +16,7 @@ cc = meson.get_compiler('c') dpdk_conf = configuration_data() dpdk_libraries = [] dpdk_static_libraries = [] +dpdk_graph_nodes = [] dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = [] diff --git a/mk/rte.app.mk b/mk/rte.app.mk index b1195f09a..68d7806a4 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -99,6 +99,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder _LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched _LDLIBS-$(CONFIG_RTE_LIBRTE_RCU) += -lrte_rcu _LDLIBS-$(CONFIG_RTE_LIBRTE_GRAPH) += -lrte_graph +_LDLIBS-$(CONFIG_RTE_LIBRTE_NODE) += -lrte_node ifeq ($(CONFIG_RTE_EXEC_ENV_LINUX),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni -- 2.25.1