From patchwork Wed Nov 10 16:48:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 104126 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 60D3DA034F; Wed, 10 Nov 2021 17:48:46 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 52E8041149; Wed, 10 Nov 2021 17:48:46 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 5B1A341148 for ; Wed, 10 Nov 2021 17:48:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636562924; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Dzdbm4w09kbO/QVNBXlzVY+XcEX0bUoGmdk+1DJVEm0=; b=B+F64D1yF5mmbIf6h2hPsxj3ck/554jY1Vg85/iweQwpi/JTqoO+wMuf3yggI2lI2jRfkd 9f+0fN49Ht+/T7Tvunrz/5kymrJXSYH2mBtuE4ANhCS2m9ngrqbQd6r3AeZEvHFc18omSM uP3fFdY4a+5pqkgyGwG92hGzT1pbwCY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-518-yHx5P3s8Mu69TeHjR8zMuA-1; Wed, 10 Nov 2021 11:48:41 -0500 X-MC-Unique: yHx5P3s8Mu69TeHjR8zMuA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D6DDD101F7BB; Wed, 10 Nov 2021 16:48:39 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7920F60854; Wed, 10 Nov 2021 16:48:36 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr, Aaron Conole , Michael Santana Subject: [PATCH 1/5] ci: test build with minimum configuration Date: Wed, 10 Nov 2021 17:48:10 +0100 Message-Id: <20211110164814.5231-2-david.marchand@redhat.com> In-Reply-To: <20211110164814.5231-1-david.marchand@redhat.com> References: <20211110164814.5231-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 Disabling optional libraries was not tested. Add a new target in test-meson-builds.sh and GHA. The Bluefield target is removed from test-meson-builds.sh to save space and compilation time in exchange of the new target. Signed-off-by: David Marchand --- .ci/linux-build.sh | 3 +++ .github/workflows/build.yml | 5 +++++ devtools/test-meson-builds.sh | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh index ef0bd099be..e7ed648099 100755 --- a/.ci/linux-build.sh +++ b/.ci/linux-build.sh @@ -87,6 +87,9 @@ OPTS="$OPTS -Dplatform=generic" OPTS="$OPTS --default-library=$DEF_LIB" OPTS="$OPTS --buildtype=debugoptimized" OPTS="$OPTS -Dcheck_includes=true" +if [ "$NO_OPTIONAL_LIBS" = "true" ]; then + OPTS="$OPTS -Ddisable_libs=*" +fi meson build --werror $OPTS ninja -C build diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4151cafee7..346cc75c20 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,7 @@ jobs: CC: ccache ${{ matrix.config.compiler }} DEF_LIB: ${{ matrix.config.library }} LIBABIGAIL_VERSION: libabigail-1.8 + NO_OPTIONAL_LIBS: ${{ matrix.config.no_optional_libs != '' }} PPC64LE: ${{ matrix.config.cross == 'ppc64le' }} REF_GIT_TAG: none RUN_TESTS: ${{ contains(matrix.config.checks, 'tests') }} @@ -32,6 +33,10 @@ jobs: - os: ubuntu-18.04 compiler: gcc library: static + - os: ubuntu-18.04 + compiler: gcc + library: shared + no_optional_libs: no-optional-libs - os: ubuntu-18.04 compiler: gcc library: shared diff --git a/devtools/test-meson-builds.sh b/devtools/test-meson-builds.sh index 9ec8e2bc7e..36ecf63ec6 100755 --- a/devtools/test-meson-builds.sh +++ b/devtools/test-meson-builds.sh @@ -220,6 +220,8 @@ for c in gcc clang ; do done done +build build-x86-no-optional-libs cc skipABI $use_shared -Ddisable_libs=* + # test compilation with minimal x86 instruction set # Set the install path for libraries to "lib" explicitly to prevent problems # with pkg-config prefixes if installed in "lib/x86_64-linux-gnu" later. @@ -258,7 +260,7 @@ export CC="clang" build build-arm64-host-clang $f ABI $use_shared unset CC # some gcc/arm configurations -for f in $srcdir/config/arm/arm64_[bdo]*gcc ; do +for f in $srcdir/config/arm/arm64_[do]*gcc ; do export CC="$CCACHE gcc" targetdir=build-$(basename $f | tr '_' '-' | cut -d'-' -f-2) build $targetdir $f skipABI $use_shared From patchwork Wed Nov 10 16:48:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 104127 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 689FEA034F; Wed, 10 Nov 2021 17:48:58 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 51C1F41157; Wed, 10 Nov 2021 17:48:58 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id CC90641156 for ; Wed, 10 Nov 2021 17:48:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636562936; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kax+/bjhfp5lc7cI0qiwN5vsXFX2PoR+f75YWFHhOBQ=; b=UuXRvFWk8l+4ezXYj5mlW9ZeLnMbN9DnJoHkHoAOrmC7NgQXCHJRj7d1qPcAjjHoYsKhOk oAKtuK23fKnsbn2xB0GGIzKJJL6O4YYg2jVLZ9N5dwJz0STS1vcQl+RF5tRmV67zlt0KNV zzoZwTghG+HPYrZWBK88q1vcPuJdOGc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-215-bPmdkaJINU2L4xHKFJ1PEA-1; Wed, 10 Nov 2021 11:48:53 -0500 X-MC-Unique: bPmdkaJINU2L4xHKFJ1PEA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A73A8799F0; Wed, 10 Nov 2021 16:48:51 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id D18CA60854; Wed, 10 Nov 2021 16:48:43 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr, Xiaoyun Li Subject: [PATCH 2/5] build: make GRO/GSO optional Date: Wed, 10 Nov 2021 17:48:11 +0100 Message-Id: <20211110164814.5231-3-david.marchand@redhat.com> In-Reply-To: <20211110164814.5231-1-david.marchand@redhat.com> References: <20211110164814.5231-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 GRO and GSO integration in testpmd is relatively self contained and easy to extract. Those libraries can be made optional as they provide standalone features. Signed-off-by: David Marchand Acked-by: Thomas Monjalon --- app/test-pmd/cmdline.c | 14 ++++++++++++++ app/test-pmd/config.c | 6 ++++++ app/test-pmd/csumonly.c | 35 +++++++++++++++++++++++++++++------ app/test-pmd/meson.build | 8 +++++++- app/test-pmd/testpmd.c | 14 ++++++++++++++ app/test-pmd/testpmd.h | 18 ++++++++++++++++++ lib/meson.build | 2 ++ 7 files changed, 90 insertions(+), 7 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 4f51b259fe..1a3c0a56df 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -35,7 +35,9 @@ #include #include #include +#ifdef RTE_LIB_GRO #include +#endif #include #include @@ -459,6 +461,7 @@ static void cmd_help_long_parsed(void *parsed_result, "tso show (portid)" " Display the status of TCP Segmentation Offload.\n\n" +#ifdef RTE_LIB_GRO "set port (port_id) gro on|off\n" " Enable or disable Generic Receive Offload in" " csum forwarding engine.\n\n" @@ -469,7 +472,9 @@ static void cmd_help_long_parsed(void *parsed_result, "set gro flush (cycles)\n" " Set the cycle to flush GROed packets from" " reassembly tables.\n\n" +#endif +#ifdef RTE_LIB_GSO "set port (port_id) gso (on|off)" " Enable or disable Generic Segmentation Offload in" " csum forwarding engine.\n\n" @@ -480,6 +485,7 @@ static void cmd_help_long_parsed(void *parsed_result, "show port (port_id) gso\n" " Show GSO configuration.\n\n" +#endif "set fwd (%s)\n" " Set packet forwarding mode.\n\n" @@ -5150,6 +5156,7 @@ cmdline_parse_inst_t cmd_tunnel_tso_show = { }, }; +#ifdef RTE_LIB_GRO /* *** SET GRO FOR A PORT *** */ struct cmd_gro_enable_result { cmdline_fixed_string_t cmd_set; @@ -5293,7 +5300,9 @@ cmdline_parse_inst_t cmd_gro_flush = { NULL, }, }; +#endif /* RTE_LIB_GRO */ +#ifdef RTE_LIB_GSO /* *** ENABLE/DISABLE GSO *** */ struct cmd_gso_enable_result { cmdline_fixed_string_t cmd_set; @@ -5460,6 +5469,7 @@ cmdline_parse_inst_t cmd_gso_show = { NULL, }, }; +#endif /* RTE_LIB_GSO */ /* *** ENABLE/DISABLE FLUSH ON RX STREAMS *** */ struct cmd_set_flush_rx { @@ -17661,12 +17671,16 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_tso_show, (cmdline_parse_inst_t *)&cmd_tunnel_tso_set, (cmdline_parse_inst_t *)&cmd_tunnel_tso_show, +#ifdef RTE_LIB_GRO (cmdline_parse_inst_t *)&cmd_gro_enable, (cmdline_parse_inst_t *)&cmd_gro_flush, (cmdline_parse_inst_t *)&cmd_gro_show, +#endif +#ifdef RTE_LIB_GSO (cmdline_parse_inst_t *)&cmd_gso_enable, (cmdline_parse_inst_t *)&cmd_gso_size, (cmdline_parse_inst_t *)&cmd_gso_show, +#endif (cmdline_parse_inst_t *)&cmd_link_flow_control_set, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_rx, (cmdline_parse_inst_t *)&cmd_link_flow_control_set_tx, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 26cadf39f7..9ece9cd8ba 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -49,7 +49,9 @@ #ifdef RTE_NET_BNXT #include #endif +#ifdef RTE_LIB_GRO #include +#endif #include #include "testpmd.h" @@ -4192,6 +4194,7 @@ set_tx_pkt_times(unsigned int *tx_times) tx_pkt_times_intra = tx_times[1]; } +#ifdef RTE_LIB_GRO void setup_gro(const char *onoff, portid_t port_id) { @@ -4273,7 +4276,9 @@ show_gro(portid_t port_id) } else printf("Port %u doesn't enable GRO.\n", port_id); } +#endif /* RTE_LIB_GRO */ +#ifdef RTE_LIB_GSO void setup_gso(const char *mode, portid_t port_id) { @@ -4297,6 +4302,7 @@ setup_gso(const char *mode, portid_t port_id) gso_ports[port_id].enable = 0; } } +#endif /* RTE_LIB_GSO */ char* list_pkt_forwarding_modes(void) diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c index 8526d9158a..4b6c6759a4 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -41,8 +41,12 @@ #include #include #include +#ifdef RTE_LIB_GRO #include +#endif +#ifdef RTE_LIB_GSO #include +#endif #include #include "testpmd.h" @@ -69,7 +73,9 @@ uint16_t geneve_udp_port = RTE_GENEVE_DEFAULT_PORT; /* structure that caches offload info for the current packet */ struct testpmd_offload_info { uint16_t ethertype; +#ifdef RTE_LIB_GSO uint8_t gso_enable; +#endif uint16_t l2_len; uint16_t l3_len; uint16_t l4_len; @@ -511,8 +517,10 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, info->ethertype); } } +#ifdef RTE_LIB_GSO if (info->gso_enable) ol_flags |= RTE_MBUF_F_TX_UDP_SEG; +#endif } else if (info->l4_proto == IPPROTO_TCP) { tcp_hdr = (struct rte_tcp_hdr *)((char *)l3_hdr + info->l3_len); if (tso_segsz) @@ -525,8 +533,10 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, get_udptcp_checksum(l3_hdr, tcp_hdr, info->ethertype); } +#ifdef RTE_LIB_GSO if (info->gso_enable) ol_flags |= RTE_MBUF_F_TX_TCP_SEG; +#endif } else if (info->l4_proto == IPPROTO_SCTP) { sctp_hdr = (struct rte_sctp_hdr *) ((char *)l3_hdr + info->l3_len); @@ -795,16 +805,20 @@ static void pkt_burst_checksum_forward(struct fwd_stream *fs) { struct rte_mbuf *pkts_burst[MAX_PKT_BURST]; +#ifdef RTE_LIB_GSO struct rte_mbuf *gso_segments[GSO_MAX_PKT_BURST]; struct rte_gso_ctx *gso_ctx; +#endif struct rte_mbuf **tx_pkts_burst; struct rte_port *txp; struct rte_mbuf *m, *p; struct rte_ether_hdr *eth_hdr; void *l3_hdr = NULL, *outer_l3_hdr = NULL; /* can be IPv4 or IPv6 */ +#ifdef RTE_LIB_GRO void **gro_ctx; uint16_t gro_pkts_num; uint8_t gro_enable; +#endif uint16_t nb_rx; uint16_t nb_tx; uint16_t nb_prep; @@ -817,8 +831,6 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) uint32_t rx_bad_outer_l4_csum; uint32_t rx_bad_outer_ip_csum; struct testpmd_offload_info info; - uint16_t nb_segments = 0; - int ret; uint64_t start_tsc = 0; @@ -836,15 +848,19 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) rx_bad_l4_csum = 0; rx_bad_outer_l4_csum = 0; rx_bad_outer_ip_csum = 0; +#ifdef RTE_LIB_GRO gro_enable = gro_ports[fs->rx_port].enable; +#endif txp = &ports[fs->tx_port]; tx_offloads = txp->dev_conf.txmode.offloads; memset(&info, 0, sizeof(info)); info.tso_segsz = txp->tso_segsz; info.tunnel_tso_segsz = txp->tunnel_tso_segsz; +#ifdef RTE_LIB_GSO if (gso_ports[fs->tx_port].enable) info.gso_enable = 1; +#endif for (i = 0; i < nb_rx; i++) { if (likely(i < nb_rx - 1)) @@ -1053,6 +1069,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) } } +#ifdef RTE_LIB_GRO if (unlikely(gro_enable)) { if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) { nb_rx = rte_gro_reassemble_burst(pkts_burst, nb_rx, @@ -1074,13 +1091,17 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) } } } +#endif + +#ifdef RTE_LIB_GSO + if (gso_ports[fs->tx_port].enable != 0) { + uint16_t nb_segments = 0; - if (gso_ports[fs->tx_port].enable == 0) - tx_pkts_burst = pkts_burst; - else { gso_ctx = &(current_fwd_lcore()->gso_ctx); gso_ctx->gso_size = gso_max_segment_size; for (i = 0; i < nb_rx; i++) { + int ret; + ret = rte_gso_segment(pkts_burst[i], gso_ctx, &gso_segments[nb_segments], GSO_MAX_PKT_BURST - nb_segments); @@ -1102,7 +1123,9 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) tx_pkts_burst = gso_segments; nb_rx = nb_segments; - } + } else +#endif + tx_pkts_burst = pkts_burst; nb_prep = rte_eth_tx_prepare(fs->tx_port, fs->tx_queue, tx_pkts_burst, nb_rx); diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index d5df52c470..eba03b572c 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON') ext_deps += jansson_dep endif -deps += ['ethdev', 'gro', 'gso', 'cmdline', 'metrics', 'bus_pci'] +deps += ['ethdev', 'cmdline', 'metrics', 'bus_pci'] if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') deps += 'crypto_scheduler' endif @@ -43,6 +43,12 @@ if dpdk_conf.has('RTE_LIB_BPF') sources += files('bpf_cmd.c') 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 diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index a66dfb297c..e2998b066b 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -518,8 +518,10 @@ lcoreid_t bitrate_lcore_id; uint8_t bitrate_enabled; #endif +#ifdef RTE_LIB_GRO struct gro_status gro_ports[RTE_MAX_ETHPORTS]; uint8_t gro_flush_cycles = GRO_DEFAULT_FLUSH_CYCLES; +#endif /* * hexadecimal bitmask of RX mq mode can be enabled. @@ -658,8 +660,10 @@ static void fill_xstats_display_info(void); */ static int all_ports_started(void); +#ifdef RTE_LIB_GSO struct gso_status gso_ports[RTE_MAX_ETHPORTS]; uint16_t gso_max_segment_size = RTE_ETHER_MAX_LEN - RTE_ETHER_CRC_LEN; +#endif /* Holds the registered mbuf dynamic flags names. */ char dynf_names[64][RTE_MBUF_DYN_NAMESIZE]; @@ -1633,8 +1637,12 @@ init_config(void) struct rte_mempool *mbp; unsigned int nb_mbuf_per_pool; lcoreid_t lc_id; +#ifdef RTE_LIB_GRO struct rte_gro_param gro_param; +#endif +#ifdef RTE_LIB_GSO uint32_t gso_types; +#endif /* Configuration of logical cores. */ fwd_lcores = rte_zmalloc("testpmd: fwd_lcores", @@ -1717,8 +1725,10 @@ init_config(void) init_port_config(); +#ifdef RTE_LIB_GSO gso_types = RTE_ETH_TX_OFFLOAD_TCP_TSO | RTE_ETH_TX_OFFLOAD_VXLAN_TNL_TSO | RTE_ETH_TX_OFFLOAD_GRE_TNL_TSO | RTE_ETH_TX_OFFLOAD_UDP_TSO; +#endif /* * Records which Mbuf pool to use by each logical core, if needed. */ @@ -1729,6 +1739,7 @@ init_config(void) if (mbp == NULL) mbp = mbuf_pool_find(0, 0); fwd_lcores[lc_id]->mbp = mbp; +#ifdef RTE_LIB_GSO /* initialize GSO context */ fwd_lcores[lc_id]->gso_ctx.direct_pool = mbp; fwd_lcores[lc_id]->gso_ctx.indirect_pool = mbp; @@ -1736,10 +1747,12 @@ init_config(void) fwd_lcores[lc_id]->gso_ctx.gso_size = RTE_ETHER_MAX_LEN - RTE_ETHER_CRC_LEN; fwd_lcores[lc_id]->gso_ctx.flag = 0; +#endif } fwd_config_setup(); +#ifdef RTE_LIB_GRO /* create a gro context for each lcore */ gro_param.gro_types = RTE_GRO_TCP_IPV4; gro_param.max_flow_num = GRO_MAX_FLUSH_CYCLES; @@ -1753,6 +1766,7 @@ init_config(void) "rte_gro_ctx_create() failed\n"); } } +#endif } diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 669ce1e87d..b1dfd097c7 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -9,8 +9,12 @@ #include #include +#ifdef RTE_LIB_GRO #include +#endif +#ifdef RTE_LIB_GSO #include +#endif #include #include #include @@ -143,7 +147,9 @@ struct fwd_stream { /**< received packets has bad outer l4 checksum */ uint64_t rx_bad_outer_ip_csum; /**< received packets having bad outer ip checksum */ +#ifdef RTE_LIB_GRO unsigned int gro_times; /**< GRO operation times */ +#endif uint64_t core_cycles; /**< used for RX and TX processing */ struct pkt_burst_stats rx_burst_stats; struct pkt_burst_stats tx_burst_stats; @@ -264,9 +270,13 @@ struct rte_port { * CPU id. configuration table. */ struct fwd_lcore { +#ifdef RTE_LIB_GSO struct rte_gso_ctx gso_ctx; /**< GSO context */ +#endif struct rte_mempool *mbp; /**< The mbuf pool to use by this core */ +#ifdef RTE_LIB_GRO void *gro_ctx; /**< GRO context */ +#endif streamid_t stream_idx; /**< index of 1st stream in "fwd_streams" */ streamid_t stream_nb; /**< number of streams in "fwd_streams" */ lcoreid_t cpuid_idx; /**< index of logical core in CPU id table */ @@ -560,6 +570,7 @@ extern struct rte_ether_addr peer_eth_addrs[RTE_MAX_ETHPORTS]; extern uint32_t burst_tx_delay_time; /**< Burst tx delay time(us) for mac-retry. */ extern uint32_t burst_tx_retry_num; /**< Burst tx retry number for mac-retry. */ +#ifdef RTE_LIB_GRO #define GRO_DEFAULT_ITEM_NUM_PER_FLOW 32 #define GRO_DEFAULT_FLOW_NUM (RTE_GRO_MAX_BURST_ITEM_NUM / \ GRO_DEFAULT_ITEM_NUM_PER_FLOW) @@ -573,13 +584,16 @@ struct gro_status { }; extern struct gro_status gro_ports[RTE_MAX_ETHPORTS]; extern uint8_t gro_flush_cycles; +#endif /* RTE_LIB_GRO */ +#ifdef RTE_LIB_GSO #define GSO_MAX_PKT_BURST 2048 struct gso_status { uint8_t enable; }; extern struct gso_status gso_ports[RTE_MAX_ETHPORTS]; extern uint16_t gso_max_segment_size; +#endif /* RTE_LIB_GSO */ /* VXLAN encap/decap parameters. */ struct vxlan_encap_conf { @@ -1006,10 +1020,14 @@ void port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key, uint8_t hash_key_len); int rx_queue_id_is_invalid(queueid_t rxq_id); int tx_queue_id_is_invalid(queueid_t txq_id); +#ifdef RTE_LIB_GRO void setup_gro(const char *onoff, portid_t port_id); void setup_gro_flush_cycles(uint8_t cycles); void show_gro(portid_t port_id); +#endif +#ifdef RTE_LIB_GSO void setup_gso(const char *mode, portid_t port_id); +#endif int eth_dev_info_get_print_err(uint16_t port_id, struct rte_eth_dev_info *dev_info); int eth_dev_conf_get_print_err(uint16_t port_id, diff --git a/lib/meson.build b/lib/meson.build index 8537a5ab80..2766c02bd2 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -66,6 +66,8 @@ libraries = [ ] optional_libs = [ + 'gro', + 'gso', 'kni', 'power', 'vhost', From patchwork Wed Nov 10 16:48:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 104128 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 A1B86A034F; Wed, 10 Nov 2021 17:49:05 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8DB444115C; Wed, 10 Nov 2021 17:49:05 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 608004114E for ; Wed, 10 Nov 2021 17:49:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636562943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3fWsxBn4/sMMl1MpeKR1R8XcJHdm4cmn1tqnqv1Hy0w=; b=G/BXkgbb9N+LMAPp0VutQEq3/HNyRGR2Jb3BKm8JLtQJiAh//53qljsFVF5gh+2PWOFKg9 CRmCNLKT7v3yOO1wKC2/9JdvW/vbd50SBhMFGA76Mww+xLQXrDfWjjEUdXzF+hiN/VH1LD UkFM7nPDCFNaphdcr3/MzjrOpEwAK00= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-z4TBiDlcMnyvp9aUIrbGiQ-1; Wed, 10 Nov 2021 11:49:00 -0500 X-MC-Unique: z4TBiDlcMnyvp9aUIrbGiQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E3763101F7B1; Wed, 10 Nov 2021 16:48:58 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id DA72360854; Wed, 10 Nov 2021 16:48:54 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr, Maryam Tahhan , Reshma Pattan , Xiaoyun Li Subject: [PATCH 3/5] build: make metrics libraries optional Date: Wed, 10 Nov 2021 17:48:12 +0100 Message-Id: <20211110164814.5231-4-david.marchand@redhat.com> In-Reply-To: <20211110164814.5231-1-david.marchand@redhat.com> References: <20211110164814.5231-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 metrics, bitratestats, jobstats and latencystats libraries can be made optional as they provide standalone features. Signed-off-by: David Marchand Acked-by: Thomas Monjalon --- app/proc-info/main.c | 16 ++++++++++++++++ app/proc-info/meson.build | 5 ++++- app/test-pmd/meson.build | 5 ++++- app/test-pmd/testpmd.c | 4 ++++ app/test/meson.build | 24 +++++++++++++++--------- lib/meson.build | 4 ++++ 6 files changed, 47 insertions(+), 11 deletions(-) diff --git a/app/proc-info/main.c b/app/proc-info/main.c index a4271047e6..19223d034c 100644 --- a/app/proc-info/main.c +++ b/app/proc-info/main.c @@ -30,7 +30,9 @@ #include #include #include +#ifdef RTE_LIB_METRICS #include +#endif #include #ifdef RTE_LIB_SECURITY #include @@ -59,8 +61,10 @@ static uint32_t enable_collectd_format; static int stdout_fd; /**< Host id process is running on */ static char host_id[MAX_LONG_OPT_SZ]; +#ifdef RTE_LIB_METRICS /**< Enable metrics. */ static uint32_t enable_metrics; +#endif /**< Enable stats reset. */ static uint32_t reset_stats; /**< Enable xstats reset. */ @@ -108,8 +112,10 @@ proc_info_usage(const char *prgname) " --stats: to display port statistics, enabled by default\n" " --xstats: to display extended port statistics, disabled by " "default\n" +#ifdef RTE_LIB_METRICS " --metrics: to display derived metrics of the ports, disabled by " "default\n" +#endif " --xstats-name NAME: to display single xstat id by NAME\n" " --xstats-ids IDLIST: to display xstat values by id. " "The argument is comma-separated list of xstat ids to print out.\n" @@ -218,7 +224,9 @@ proc_info_parse_args(int argc, char **argv) {"stats", 0, NULL, 0}, {"stats-reset", 0, NULL, 0}, {"xstats", 0, NULL, 0}, +#ifdef RTE_LIB_METRICS {"metrics", 0, NULL, 0}, +#endif {"xstats-reset", 0, NULL, 0}, {"xstats-name", required_argument, NULL, 1}, {"collectd-format", 0, NULL, 0}, @@ -260,10 +268,12 @@ proc_info_parse_args(int argc, char **argv) else if (!strncmp(long_option[option_index].name, "xstats", MAX_LONG_OPT_SZ)) enable_xstats = 1; +#ifdef RTE_LIB_METRICS else if (!strncmp(long_option[option_index].name, "metrics", MAX_LONG_OPT_SZ)) enable_metrics = 1; +#endif /* Reset stats */ if (!strncmp(long_option[option_index].name, "stats-reset", MAX_LONG_OPT_SZ)) @@ -593,6 +603,7 @@ nic_xstats_clear(uint16_t port_id) printf("\n NIC extended statistics for port %d cleared\n", port_id); } +#ifdef RTE_LIB_METRICS static void metrics_display(int port_id) { @@ -653,6 +664,7 @@ metrics_display(int port_id) rte_free(metrics); rte_free(names); } +#endif static void show_security_context(uint16_t portid, bool inline_offload) @@ -1522,14 +1534,18 @@ main(int argc, char **argv) else if (nb_xstats_ids > 0) nic_xstats_by_ids_display(i, xstats_ids, nb_xstats_ids); +#ifdef RTE_LIB_METRICS else if (enable_metrics) metrics_display(i); +#endif } +#ifdef RTE_LIB_METRICS /* print port independent stats */ if (enable_metrics) metrics_display(RTE_METRICS_GLOBAL); +#endif /* show information for PMD */ if (enable_shw_port) diff --git a/app/proc-info/meson.build b/app/proc-info/meson.build index 1062e0ef86..1563ce656a 100644 --- a/app/proc-info/meson.build +++ b/app/proc-info/meson.build @@ -8,4 +8,7 @@ if is_windows endif sources = files('main.c') -deps += ['ethdev', 'metrics', 'security'] +deps += ['ethdev', 'security'] +if dpdk_conf.has('RTE_LIB_METRICS') + deps += 'metrics' +endif diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index eba03b572c..43130c8856 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -32,7 +32,7 @@ if dpdk_conf.has('RTE_HAS_JANSSON') ext_deps += jansson_dep endif -deps += ['ethdev', 'cmdline', 'metrics', 'bus_pci'] +deps += ['ethdev', 'cmdline', 'bus_pci'] if dpdk_conf.has('RTE_CRYPTO_SCHEDULER') deps += 'crypto_scheduler' endif @@ -52,6 +52,9 @@ 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 diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e2998b066b..73b8ba7236 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -55,7 +55,9 @@ #include #endif #include +#ifdef RTE_LIB_METRICS #include +#endif #ifdef RTE_LIB_BITRATESTATS #include #endif @@ -4231,8 +4233,10 @@ main(int argc, char** argv) port_id, rte_strerror(-ret)); } +#ifdef RTE_LIB_METRICS /* Init metrics library */ rte_metrics_init(rte_socket_id()); +#endif #ifdef RTE_LIB_LATENCYSTATS if (latencystats_enabled != 0) { diff --git a/app/test/meson.build b/app/test/meson.build index a968abac76..b5f1a89edf 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -98,7 +98,6 @@ test_sources = files( 'test_mempool_perf.c', 'test_memzone.c', 'test_meter.c', - 'test_metrics.c', 'test_mcslock.c', 'test_mp_secondary.c', 'test_per_lcore.c', @@ -162,7 +161,6 @@ test_deps = [ 'acl', 'bus_pci', 'bus_vdev', - 'bitratestats', 'bpf', 'cfgfile', 'cmdline', @@ -177,10 +175,8 @@ test_deps = [ 'graph', 'hash', 'ipsec', - 'latencystats', 'lpm', 'member', - 'metrics', 'node', 'pipeline', 'port', @@ -281,7 +277,6 @@ fast_tests = [ ['kni_autotest', false], ['kvargs_autotest', true], ['member_autotest', true], - ['metrics_autotest', true], ['power_cpufreq_autotest', false], ['power_autotest', true], ['power_kvm_vm_autotest', false], @@ -378,6 +373,11 @@ endif if dpdk_conf.has('RTE_EVENT_SKELETON') test_deps += 'event_skeleton' endif +if dpdk_conf.has('RTE_LIB_METRICS') + test_deps += 'metrics' + test_sources += ['test_metrics.c'] + fast_tests += [['metrics_autotest', true]] +endif if dpdk_conf.has('RTE_LIB_TELEMETRY') test_sources += ['test_telemetry_json.c', 'test_telemetry_data.c'] fast_tests += [['telemetry_json_autotest', true], ['telemetry_data_autotest', true]] @@ -399,16 +399,22 @@ if dpdk_conf.has('RTE_NET_RING') test_sources += 'test_pmd_ring_perf.c' test_sources += 'test_pmd_ring.c' test_sources += 'test_event_eth_tx_adapter.c' - test_sources += 'test_bitratestats.c' - test_sources += 'test_latencystats.c' test_sources += 'sample_packet_forward.c' test_sources += 'test_pdump.c' fast_tests += [['ring_pmd_autotest', true]] perf_test_names += 'ring_pmd_perf_autotest' fast_tests += [['event_eth_tx_adapter_autotest', false]] - fast_tests += [['bitratestats_autotest', true]] - fast_tests += [['latencystats_autotest', true]] fast_tests += [['pdump_autotest', true]] + if dpdk_conf.has('RTE_LIB_BITRATESTATS') + test_deps += 'bitratestats' + test_sources += 'test_bitratestats.c' + fast_tests += [['bitratestats_autotest', true]] + endif + if dpdk_conf.has('RTE_LIB_LATENCYSTATS') + test_deps += 'latencystats' + test_sources += 'test_latencystats.c' + fast_tests += [['latencystats_autotest', true]] + endif endif if dpdk_conf.has('RTE_HAS_LIBPCAP') diff --git a/lib/meson.build b/lib/meson.build index 2766c02bd2..961b95f4ad 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -66,9 +66,13 @@ libraries = [ ] optional_libs = [ + 'bitratestats', 'gro', 'gso', 'kni', + 'jobstats', + 'latencystats', + 'metrics', 'power', 'vhost', ] From patchwork Wed Nov 10 16:48:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 104129 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 A0033A034F; Wed, 10 Nov 2021 17:49:19 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 91A4641169; Wed, 10 Nov 2021 17:49:19 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id A4E364114B for ; Wed, 10 Nov 2021 17:49:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636562958; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1KdVGLJnJZNvEmgoPnzj9iS3ZRV5AnkN+shARRN34Fo=; b=NJeIXHb5weAq+Pqx42UBvM65kxKbKmV0Z4ooGpNfGZ/Rvzd8TZjJihm2ZNt231buYyK5hw 4VYsaU4hFQHp/+TjKHSWwAkakCboWDilU4qGCQ4ctKvPc43yaECo1wdwF8ZfIBObXCKsmC 5XWsw8rxLACw2U8hQQVFWy+nhOODB6M= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-21-KCZHfvQHNrOOhJZ0klbuhQ-1; Wed, 10 Nov 2021 11:49:15 -0500 X-MC-Unique: KCZHfvQHNrOOhJZ0klbuhQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A4EC11023F4E; Wed, 10 Nov 2021 16:49:13 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC61160854; Wed, 10 Nov 2021 16:49:02 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr Subject: [PATCH 4/5] build: make pdump optional Date: Wed, 10 Nov 2021 17:48:13 +0100 Message-Id: <20211110164814.5231-5-david.marchand@redhat.com> In-Reply-To: <20211110164814.5231-1-david.marchand@redhat.com> References: <20211110164814.5231-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 This library can be made optional. dumpcap and pdump applications depend on this library, check for dependencies like what we have for examples. Signed-off-by: David Marchand Acked-by: Thomas Monjalon --- app/meson.build | 18 +++++++++++++----- app/test/meson.build | 10 +++++----- lib/meson.build | 1 + 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/meson.build b/app/meson.build index 310e83076f..93d8c15032 100644 --- a/app/meson.build +++ b/app/meson.build @@ -43,15 +43,23 @@ foreach app:apps subdir(name) + if build + dep_objs = [] + foreach d:deps + var_name = get_option('default_library') + '_rte_' + d + if not is_variable(var_name) + build = false + message('Missing dependency "@0@" for app "@1@"'.format(d, name)) + break + endif + dep_objs += [get_variable(var_name)] + endforeach + endif + if not build continue endif - dep_objs = [] - foreach d:deps - dep_objs += get_variable(get_option('default_library') + '_rte_' + d) - endforeach - link_libs = [] if get_option('default_library') == 'static' link_libs = dpdk_static_libraries + dpdk_drivers diff --git a/app/test/meson.build b/app/test/meson.build index b5f1a89edf..07fe4870b0 100644 --- a/app/test/meson.build +++ b/app/test/meson.build @@ -400,11 +400,9 @@ if dpdk_conf.has('RTE_NET_RING') test_sources += 'test_pmd_ring.c' test_sources += 'test_event_eth_tx_adapter.c' test_sources += 'sample_packet_forward.c' - test_sources += 'test_pdump.c' fast_tests += [['ring_pmd_autotest', true]] perf_test_names += 'ring_pmd_perf_autotest' fast_tests += [['event_eth_tx_adapter_autotest', false]] - fast_tests += [['pdump_autotest', true]] if dpdk_conf.has('RTE_LIB_BITRATESTATS') test_deps += 'bitratestats' test_sources += 'test_bitratestats.c' @@ -415,6 +413,11 @@ if dpdk_conf.has('RTE_NET_RING') test_sources += 'test_latencystats.c' fast_tests += [['latencystats_autotest', true]] endif + if dpdk_conf.has('RTE_LIB_PDUMP') + test_deps += 'pdump' + test_sources += 'test_pdump.c' + fast_tests += [['pdump_autotest', true]] + endif endif if dpdk_conf.has('RTE_HAS_LIBPCAP') @@ -431,9 +434,6 @@ endif if dpdk_conf.has('RTE_LIB_KNI') test_deps += 'kni' endif -if dpdk_conf.has('RTE_LIB_PDUMP') - test_deps += 'pdump' -endif if cc.has_argument('-Wno-format-truncation') cflags += '-Wno-format-truncation' diff --git a/lib/meson.build b/lib/meson.build index 961b95f4ad..dad9fce14d 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -73,6 +73,7 @@ optional_libs = [ 'jobstats', 'latencystats', 'metrics', + 'pdump', 'power', 'vhost', ] From patchwork Wed Nov 10 16:48:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Marchand X-Patchwork-Id: 104130 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 9F30CA034F; Wed, 10 Nov 2021 17:49:24 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E14B41172; Wed, 10 Nov 2021 17:49:24 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id CDC4341171 for ; Wed, 10 Nov 2021 17:49:23 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1636562963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z/y5opQLD6rkmw7+UdV0i3a+Igjd/TEA7TSAOIQKldg=; b=HbrpVOXIKLZSvYNaqF6Ux8NakwjOakv79MdOZJfwQTRSd6VUGODjQnQR4E+ZllGUXNCmm9 D2FvbxftfNXQQ+prd2iH0F1ibLNJ7BStb1/VGk7fNPkVfL+sh0r3lbgriIh8z5NpJz56Wa nU8aY+zeOGTCTqw19xVwq4pGmEb3sL4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-379-uzIyi0ZtO_yDhUj2QNZFnA-1; Wed, 10 Nov 2021 11:49:20 -0500 X-MC-Unique: uzIyi0ZtO_yDhUj2QNZFnA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DAEB5804141; Wed, 10 Nov 2021 16:49:18 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.42]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4330BC888; Wed, 10 Nov 2021 16:49:15 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: bruce.richardson@intel.com, thomas@monjalon.net, bluca@debian.org, tredaelli@redhat.com, i.maximets@ovn.org, james.r.harris@intel.com, mohammed@hawari.fr Subject: [PATCH 5/5] build: select optional libraries Date: Wed, 10 Nov 2021 17:48:14 +0100 Message-Id: <20211110164814.5231-6-david.marchand@redhat.com> In-Reply-To: <20211110164814.5231-1-david.marchand@redhat.com> References: <20211110164814.5231-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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 There is currently no way to know which libraries are optional. Introduce a enable_libs option (close to what we have for drivers) so that packagers or projects consuming DPDK can more easily select the optional libraries that matter to them and disable other optional libraries. Note: the enabled_libs variable is renamed for sake of consistency. Signed-off-by: David Marchand --- buildtools/chkincs/meson.build | 2 +- lib/meson.build | 34 ++++++++++++++++++---------------- meson.build | 3 ++- meson_options.txt | 2 ++ 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build index 5ffca89761..6b93d5f46c 100644 --- a/buildtools/chkincs/meson.build +++ b/buildtools/chkincs/meson.build @@ -18,7 +18,7 @@ sources = files('main.c') sources += gen_c_files.process(dpdk_chkinc_headers) deps = [] -foreach l:enabled_libs +foreach l:dpdk_libs_enabled deps += get_variable('static_rte_' + l) endforeach diff --git a/lib/meson.build b/lib/meson.build index dad9fce14d..47c857c0fc 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -78,17 +78,10 @@ optional_libs = [ 'vhost', ] -disabled_libs = [] -opt_disabled_libs = run_command(list_dir_globs, get_option('disable_libs'), +enable_libs = run_command(list_dir_globs, get_option('enable_libs'), + check: true).stdout().split() +disable_libs = run_command(list_dir_globs, get_option('disable_libs'), check: true).stdout().split() -foreach l:opt_disabled_libs - if not optional_libs.contains(l) - warning('Cannot disable mandatory library "@0@"'.format(l)) - continue - endif - disabled_libs += l -endforeach - default_cflags = machine_args default_cflags += ['-DALLOW_EXPERIMENTAL_API'] @@ -98,8 +91,6 @@ if cc.has_argument('-Wno-format-truncation') default_cflags += '-Wno-format-truncation' endif -enabled_libs = [] # used to print summary at the end - foreach l:libraries build = true reason = '' # set if build == false to explain why @@ -123,10 +114,21 @@ foreach l:libraries deps += ['eal'] endif - if disabled_libs.contains(l) - build = false - reason = 'explicitly disabled via build config' + if optional_libs.contains(l) + # check for enabled libraries only if one is set in config + if enable_libs.length() != 0 and not enable_libs.contains(l) + build = false + reason = 'not in enabled libraries build config' + elif disable_libs.contains(l) + build = false + reason = 'explicitly disabled via build config' + endif else + if disable_libs.contains(l) + warning('Cannot disable mandatory library "@0@"'.format(l)) + endif + endif + if build subdir(l) endif if name != l @@ -150,7 +152,7 @@ foreach l:libraries static_deps += [get_variable('static_rte_' + d)] endforeach - enabled_libs += name + dpdk_libs_enabled += name dpdk_conf.set('RTE_LIB_' + name.to_upper(), 1) install_headers(headers) install_headers(indirect_headers) diff --git a/meson.build b/meson.build index 12cb6e0e83..65855ceee8 100644 --- a/meson.build +++ b/meson.build @@ -35,6 +35,7 @@ dpdk_driver_classes = [] dpdk_drivers = [] dpdk_extra_ldflags = [] dpdk_libs_disabled = [] +dpdk_libs_enabled = [] dpdk_drvs_disabled = [] abi_version_file = files('ABI_VERSION') @@ -102,7 +103,7 @@ subdir('buildtools/pkg-config') output_message = '\n=================\nLibraries Enabled\n=================\n' output_message += '\nlibs:\n\t' output_count = 0 -foreach lib:enabled_libs +foreach lib:dpdk_libs_enabled output_message += lib + ', ' output_count += 1 if output_count == 8 diff --git a/meson_options.txt b/meson_options.txt index 7c220ad68d..ccb92cff7a 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -16,6 +16,8 @@ option('enable_docs', type: 'boolean', value: false, description: 'build documentation') option('enable_drivers', type: 'string', value: '', description: 'Comma-separated list of drivers to build. If unspecified, build all drivers.') +option('enable_libs', type: 'string', value: '', description: + 'Comma-separated list of libraries to explicitly enable.') option('enable_driver_sdk', type: 'boolean', value: false, description: 'Install headers to build drivers.') option('enable_kmods', type: 'boolean', value: false, description: