From patchwork Thu Apr 7 21:47:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Owen Hilyard X-Patchwork-Id: 109441 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 08260A050C; Thu, 7 Apr 2022 23:47:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9371427EF; Thu, 7 Apr 2022 23:47:31 +0200 (CEST) Received: from mail-pl1-f227.google.com (mail-pl1-f227.google.com [209.85.214.227]) by mails.dpdk.org (Postfix) with ESMTP id D7F864068F for ; Thu, 7 Apr 2022 23:47:28 +0200 (CEST) Received: by mail-pl1-f227.google.com with SMTP id o10so6216320ple.7 for ; Thu, 07 Apr 2022 14:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=33WPSoOL7NpA5oJqa7hh4jbxcUXvO2rZYX6zYEQsxBY=; b=PvGlkhx+mZsbf0tnGJYt6SKfeXIFpcN1WhJLYRfYIHRsPFuJTXnp/gDNY+1kr1XkpY JeIN8FmB2uniCQ2v7EiwvtxjlzunDLfnECoOqRkd6S80NAIaWNvxheif9K4thZJcY6lg KhRfzStKmdCCqh+qsK1ZwxmGMaUGcUOuUrV8M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=33WPSoOL7NpA5oJqa7hh4jbxcUXvO2rZYX6zYEQsxBY=; b=INQVU/6s7rsDtIGte87jDYAVvyeFwfhBOVgAUBewKBbhFUMEFqDgEaTGV8ZDTmjsNC gkFAE1AQ/6Gt1aEzBS6iJpAY6Ev9/f6iiNp7kyjD1nEaACMNfxOj//jfk1eMYhMFUBJI 5smWkR0eXZYbIyDfod+khKiZ3xQI+6+B1DghPZKuBDK7NqX5CTgL4OOzBnLcL4CsAAV+ 5nablFnKlJG/S+HoRcD1pHBDNzCfEpvaG6YmM5ixia0v3kVnF6bqMdoYkH1cOs8LmMEY XUrFXtDgaWY/PWQz/6MyOo6TzeoQqK9bd/3X5RN8C+gGkYMRSbHqMJJ9EFyqE4Et/p6X Vqrw== X-Gm-Message-State: AOAM533zaiJ1Ye5Beok0u+FJ4i4ZYyt9czCfyzl+dzKQC8AERzM7SdLl b2WQTyIgMxdnAnuKffRD52fISLY9R6ose/ilAddCuXg50/JdYDGPnyiw1Kv/d3zCRQ== X-Google-Smtp-Source: ABdhPJzUhplZIU8hBE4JfZJM8cWOvl9G2/n7hv2nFWDcAvprLhMfm49e8j3L1t9NB906C3udULBJhvfYIAFd X-Received: by 2002:a17:90a:cb94:b0:1ca:7c56:dd4d with SMTP id a20-20020a17090acb9400b001ca7c56dd4dmr18150836pju.133.1649368048117; Thu, 07 Apr 2022 14:47:28 -0700 (PDT) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id x5-20020a17090a46c500b001ca7a173c3asm986010pjg.17.2022.04.07.14.47.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Apr 2022 14:47:28 -0700 (PDT) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::105d]) by postal.iol.unh.edu (Postfix) with ESMTP id 3CAAD605183A; Thu, 7 Apr 2022 17:47:27 -0400 (EDT) From: ohilyard@iol.unh.edu To: dev@dpdk.org Cc: Honnappa.Nagarahalli@arm.com, thomas@monjalon.net, Owen Hilyard Subject: [PATCH v1 2/4] app/test-pmd-api: Add POC with gRPC deps Date: Thu, 7 Apr 2022 17:47:06 -0400 Message-Id: <20220407214707.29730-3-ohilyard@iol.unh.edu> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220407214707.29730-1-ohilyard@iol.unh.edu> References: <20220407214707.29730-1-ohilyard@iol.unh.edu> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Owen Hilyard The new app is disabled if the dependencies are not present, in order to avoid breaking the build on any system that does not have gRPC installed. The meson file for the app is heavily derived from the testpmd. Signed-off-by: Owen Hilyard --- app/meson.build | 17 +++++++ app/test-pmd-api/meson.build | 96 ++++++++++++++++++++++++++++++++++++ 2 files changed, 113 insertions(+) create mode 100644 app/test-pmd-api/meson.build diff --git a/app/meson.build b/app/meson.build index 93d8c15032..3dfd5c003e 100644 --- a/app/meson.build +++ b/app/meson.build @@ -20,6 +20,23 @@ apps = [ 'test-sad', ] +if get_option('use_cpp') + protoc = find_program('protoc', required : false) + protobuf_dep = dependency('protobuf', required : false) + grpc_cpp_plugin = find_program('grpc_cpp_plugin', required: false) + grpc_python_plugin = find_program('grpc_python_plugin', required: false) + grpc_dep = dependency('grpc', required: false) + grpcpp_dep = dependency('grpc++', required: false) + + if protoc.found() and dep.found() and grpc_cpp_plugin.found() and grpc_python_plugin.found() and grpc_dep.found() and grpcpp_dep.found() + apps += [ + 'test-pmd-api' + ] + endif + +endif + + default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] default_ldflags = [] if get_option('default_library') == 'static' and not is_windows diff --git a/app/test-pmd-api/meson.build b/app/test-pmd-api/meson.build new file mode 100644 index 0000000000..7438098e9d --- /dev/null +++ b/app/test-pmd-api/meson.build @@ -0,0 +1,96 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2017 Intel Corporation + +# override default name to drop the hyphen +name = 'testpmd-api' +cflags += [ + '-Wno-deprecated-declarations' +] +sources += files( + 'main.c', + 'api_impl.cc' +) + +ldflags += [ + '-ldl', + '-lgrpc++_reflection', +] + +ext_deps += [protobuf_dep, grpc_dep, grpcpp_dep, dependency('threads')] + +if dpdk_conf.has('RTE_HAS_JANSSON') + ext_deps += jansson_dep +endif + +deps += ['ethdev', 'cmdline', 'bus_pci'] +if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') + deps += 'crypto_scheduler' +endif +if dpdk_conf.has('RTE_LIB_BITRATESTATS') + deps += 'bitratestats' +endif +if dpdk_conf.has('RTE_LIB_BPF') + deps += 'bpf' +endif +if dpdk_conf.has('RTE_LIB_GRO') + deps += 'gro' +endif +if dpdk_conf.has('RTE_LIB_GSO') + deps += 'gso' +endif +if dpdk_conf.has('RTE_LIB_LATENCYSTATS') + deps += 'latencystats' +endif +if dpdk_conf.has('RTE_LIB_METRICS') + deps += 'metrics' +endif +if dpdk_conf.has('RTE_LIB_PDUMP') + deps += 'pdump' +endif +if dpdk_conf.has('RTE_NET_BOND') + deps += 'net_bond' +endif +if dpdk_conf.has('RTE_NET_BNXT') + deps += 'net_bnxt' +endif +if dpdk_conf.has('RTE_NET_I40E') + deps += 'net_i40e' +endif +if dpdk_conf.has('RTE_NET_IXGBE') + deps += 'net_ixgbe' +endif +if dpdk_conf.has('RTE_NET_DPAA') + deps += ['bus_dpaa', 'mempool_dpaa', 'net_dpaa'] +endif + +if meson.version().version_compare('>=0.55') + grpc_cpp_plugin_path = grpc_cpp_plugin.full_path() + grpc_python_plugin_path = grpc_python_plugin.full_path() +else + grpc_cpp_plugin_path = grpc_cpp_plugin.path() + grpc_python_plugin_path = grpc_python_plugin.path() +endif + + +cpp_generator = generator(protoc, + output : ['@BASENAME@.pb.cc', '@BASENAME@.pb.h', '@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'], + arguments : [ + '--proto_path=@CURRENT_SOURCE_DIR@', + '--plugin=protoc-gen-grpc=@0@'.format(grpc_cpp_plugin_path), + '--cpp_out=@BUILD_DIR@', + '--grpc_out=@BUILD_DIR@', + '@INPUT@' + ]) + +python_generator = generator(protoc, + output : ['@BASENAME@_pb2.py', '@BASENAME@_pb2_grpc.py'], + arguments : [ + '--proto_path=@CURRENT_SOURCE_DIR@', + '--plugin=protoc-gen-grpc=@0@'.format(grpc_python_plugin_path), + '--python_out=@BUILD_DIR@', + '--grpc_out=@BUILD_DIR@', + '@INPUT@' + ]) + +sources += cpp_generator.process('api.proto') +sources += python_generator.process('api.proto') \ No newline at end of file