[dpdk-dev] [PATCH v5 36/41] examples/pipeline: add new example application

David Marchand david.marchand at redhat.com
Tue Sep 29 15:51:18 CEST 2020


On Wed, Sep 23, 2020 at 8:07 PM Cristian Dumitrescu
<cristian.dumitrescu at intel.com> wrote:
>
> Add new example application to showcase the API of the newly
> introduced SWX pipeline type.
>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
> ---
>  MAINTAINERS                   |   1 +
>  examples/meson.build          |   1 +
>  examples/pipeline/Makefile    |  51 ++++
>  examples/pipeline/main.c      |  50 ++++
>  examples/pipeline/meson.build |  16 +
>  examples/pipeline/obj.c       | 470 +++++++++++++++++++++++++++++
>  examples/pipeline/obj.h       | 131 ++++++++
>  examples/pipeline/thread.c    | 549 ++++++++++++++++++++++++++++++++++
>  examples/pipeline/thread.h    |  28 ++
>  9 files changed, 1297 insertions(+)
>  create mode 100644 examples/pipeline/Makefile
>  create mode 100644 examples/pipeline/main.c
>  create mode 100644 examples/pipeline/meson.build
>  create mode 100644 examples/pipeline/obj.c
>  create mode 100644 examples/pipeline/obj.h
>  create mode 100644 examples/pipeline/thread.c
>  create mode 100644 examples/pipeline/thread.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 3b16d7a4b..ba8d55c22 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1332,6 +1332,7 @@ F: app/test/test_table*
>  F: app/test-pipeline/
>  F: doc/guides/sample_app_ug/test_pipeline.rst
>  F: examples/ip_pipeline/
> +F: examples/pipeline/

Not really happy to see a new example which seems a clone of the old example.


>  F: doc/guides/sample_app_ug/ip_pipeline.rst
>
>
> diff --git a/examples/meson.build b/examples/meson.build
> index eb13e8210..245d98575 100644
> --- a/examples/meson.build
> +++ b/examples/meson.build
> @@ -33,6 +33,7 @@ all_examples = [
>         'ntb', 'packet_ordering',
>         'performance-thread/l3fwd-thread',
>         'performance-thread/pthread_shim',
> +       'pipeline',
>         'ptpclient',
>         'qos_meter', 'qos_sched',
>         'rxtx_callbacks',
> diff --git a/examples/pipeline/Makefile b/examples/pipeline/Makefile
> new file mode 100644
> index 000000000..8d01fbfed
> --- /dev/null
> +++ b/examples/pipeline/Makefile
> @@ -0,0 +1,51 @@
> +# SPDX-License-Identifier: BSD-3-Clause
> +# Copyright(c) 2010-2020 Intel Corporation

Copyright 2020.

> +
> +# binary name
> +APP = pipeline
> +
> +# all source are stored in SRCS-y
> +SRCS-y += main.c
> +SRCS-y += obj.c
> +SRCS-y += thread.c
> +
> +# Build using pkg-config variables if possible
> +ifneq ($(shell pkg-config --exists libdpdk && echo 0),0)
> +$(error "no installation of DPDK found")
> +endif
> +
> +all: shared
> +.PHONY: shared static
> +shared: build/$(APP)-shared
> +       ln -sf $(APP)-shared build/$(APP)
> +static: build/$(APP)-static
> +       ln -sf $(APP)-static build/$(APP)
> +
> +PKGCONF ?= pkg-config
> +
> +PC_FILE := $(shell $(PKGCONF) --path libdpdk 2>/dev/null)
> +CFLAGS += -O3 $(shell $(PKGCONF) --cflags libdpdk)

I did not catch it on the first pass, but now looking deeper, this
example uses experimental APIs and its makefile should contain the
-DALLOW_EXPERIMENTAL_API cflag to indicate acceptance.

This triggers build warnings (or errors with -Werror), when compiled
as an external example.


obj.c: In function ‘pipeline_create’:
obj.c:381:2: warning: ‘rte_swx_pipeline_config’ is deprecated: Symbol
is not yet part of stable ABI [-Wdeprecated-declarations]
  381 |  status = rte_swx_pipeline_config(&p, numa_node);
      |  ^~~~~~
etc...


> +LDFLAGS_SHARED = $(shell $(PKGCONF) --libs libdpdk)
> +LDFLAGS_STATIC = -Wl,-Bstatic $(shell $(PKGCONF) --static --libs libdpdk)

Copied/pasted from older Makefiles ?

I get a:

ln -sf pipeline-shared build/pipeline
cc build/main.o build/obj.o build/thread.o -o build/pipeline-static
-L/home/dmarchan/intel-ipsec-mb/install/lib -Wl,-Bstatic
-Wl,--whole-archive
-L/home/dmarchan/builds/build-x86-default/install/usr/local/lib
-l:librte_common_cpt.a -l:librte_common_dpaax.a
-l:librte_common_iavf.a -l:librte_common_octeontx.a
-l:librte_common_octeontx2.a -l:librte_bus_dpaa.a
-l:librte_bus_fslmc.a -l:librte_bus_ifpga.a -l:librte_bus_pci.a
-l:librte_bus_vdev.a -l:librte_bus_vmbus.a -l:librte_common_mlx5.a
-l:librte_mempool_bucket.a -l:librte_mempool_dpaa.a
-l:librte_mempool_dpaa2.a -l:librte_mempool_octeontx.a
-l:librte_mempool_octeontx2.a -l:librte_mempool_ring.a
-l:librte_mempool_stack.a -l:librte_pmd_af_packet.a
-l:librte_pmd_af_xdp.a -l:librte_pmd_ark.a -l:librte_pmd_atlantic.a
-l:librte_pmd_avp.a -l:librte_pmd_axgbe.a -l:librte_pmd_bond.a
-l:librte_pmd_bnx2x.a -l:librte_pmd_bnxt.a -l:librte_pmd_cxgbe.a
-l:librte_pmd_dpaa.a -l:librte_pmd_dpaa2.a -l:librte_pmd_e1000.a
-l:librte_pmd_ena.a -l:librte_pmd_enetc.a -l:librte_pmd_enic.a
-l:librte_pmd_failsafe.a -l:librte_pmd_fm10k.a -l:librte_pmd_i40e.a
-l:librte_pmd_hinic.a -l:librte_pmd_hns3.a -l:librte_pmd_iavf.a
-l:librte_pmd_ice.a -l:librte_pmd_igc.a -l:librte_pmd_ipn3ke.a
-l:librte_pmd_ixgbe.a -l:librte_pmd_kni.a -l:librte_pmd_liquidio.a
-l:librte_pmd_memif.a -l:librte_pmd_mlx4.a -l:librte_pmd_mlx5.a
-l:librte_pmd_netvsc.a -l:librte_pmd_nfp.a -l:librte_pmd_null.a
-l:librte_pmd_octeontx.a -l:librte_pmd_octeontx2.a
-l:librte_pmd_pcap.a -l:librte_pmd_pfe.a -l:librte_pmd_qede.a
-l:librte_pmd_ring.a -l:librte_pmd_sfc.a -l:librte_pmd_softnic.a
-l:librte_pmd_szedata2.a -l:librte_pmd_tap.a -l:librte_pmd_thunderx.a
-l:librte_pmd_vdev_netvsc.a -l:librte_pmd_vhost.a
-l:librte_pmd_virtio.a -l:librte_pmd_vmxnet3.a
-l:librte_rawdev_dpaa2_cmdif.a -l:librte_rawdev_dpaa2_qdma.a
-l:librte_rawdev_ifpga.a -l:librte_rawdev_ioat.a
-l:librte_rawdev_ntb.a -l:librte_rawdev_octeontx2_dma.a
-l:librte_rawdev_octeontx2_ep.a -l:librte_rawdev_skeleton.a
-l:librte_pmd_aesni_gcm.a -l:librte_pmd_aesni_mb.a
-l:librte_pmd_caam_jr.a -l:librte_pmd_ccp.a -l:librte_pmd_dpaa_sec.a
-l:librte_pmd_dpaa2_sec.a -l:librte_pmd_kasumi.a
-l:librte_pmd_nitrox.a -l:librte_pmd_null_crypto.a
-l:librte_pmd_octeontx_crypto.a -l:librte_pmd_octeontx2_crypto.a
-l:librte_pmd_openssl.a -l:librte_pmd_crypto_scheduler.a
-l:librte_pmd_snow3g.a -l:librte_pmd_virtio_crypto.a
-l:librte_pmd_zuc.a -l:librte_pmd_isal.a
-l:librte_pmd_octeontx_compress.a -l:librte_pmd_qat.a
-l:librte_pmd_zlib.a -l:librte_pmd_mlx5_regex.a -l:librte_pmd_ifc.a
-l:librte_pmd_mlx5_vdpa.a -l:librte_pmd_dpaa_event.a
-l:librte_pmd_dpaa2_event.a -l:librte_pmd_octeontx2_event.a
-l:librte_pmd_opdl_event.a -l:librte_pmd_skeleton_event.a
-l:librte_pmd_sw_event.a -l:librte_pmd_dsw_event.a
-l:librte_pmd_octeontx_event.a -l:librte_pmd_bbdev_null.a
-l:librte_pmd_bbdev_turbo_sw.a -l:librte_pmd_bbdev_fpga_lte_fec.a
-l:librte_pmd_bbdev_fpga_5gnr_fec.a -l:librte_node.a -l:librte_graph.a
-l:librte_bpf.a -l:librte_flow_classify.a -l:librte_pipeline.a
-l:librte_table.a -l:librte_port.a -l:librte_fib.a -l:librte_ipsec.a
-l:librte_vhost.a -l:librte_stack.a -l:librte_security.a
-l:librte_sched.a -l:librte_reorder.a -l:librte_rib.a
-l:librte_regexdev.a -l:librte_rawdev.a -l:librte_pdump.a
-l:librte_power.a -l:librte_member.a -l:librte_lpm.a
-l:librte_latencystats.a -l:librte_kni.a -l:librte_jobstats.a
-l:librte_ip_frag.a -l:librte_gso.a -l:librte_gro.a
-l:librte_eventdev.a -l:librte_efd.a -l:librte_distributor.a
-l:librte_cryptodev.a -l:librte_compressdev.a -l:librte_cfgfile.a
-l:librte_bitratestats.a -l:librte_bbdev.a -l:librte_acl.a
-l:librte_timer.a -l:librte_hash.a -l:librte_metrics.a
-l:librte_cmdline.a -l:librte_pci.a -l:librte_ethdev.a
-l:librte_meter.a -l:librte_net.a -l:librte_mbuf.a -l:librte_mempool.a
-l:librte_rcu.a -l:librte_ring.a -l:librte_eal.a -l:librte_telemetry.a
-l:librte_kvargs.a -Wl,--no-whole-archive -lpcap -lIPSec_MB
-Wl,--as-needed -lrte_node -lrte_graph -lrte_bpf -lrte_flow_classify
-lrte_pipeline -lrte_table -lrte_port -lrte_fib -lrte_ipsec
-lrte_vhost -lrte_stack -lrte_security -lrte_sched -lrte_reorder
-lrte_rib -lrte_regexdev -lrte_rawdev -lrte_pdump -lrte_power
-lrte_member -lrte_lpm -lrte_latencystats -lrte_kni -lrte_jobstats
-lrte_ip_frag -lrte_gso -lrte_gro -lrte_eventdev -lrte_efd
-lrte_distributor -lrte_cryptodev -lrte_compressdev -lrte_cfgfile
-lrte_bitratestats -lrte_bbdev -lrte_acl -lrte_timer -lrte_hash
-lrte_metrics -lrte_cmdline -lrte_pci -lrte_ethdev -lrte_meter
-lrte_net -lrte_mbuf -lrte_mempool -lrte_rcu -lrte_ring -lrte_eal
-lrte_telemetry -lrte_kvargs -pthread -lm -ldl -lnuma -lfdt -lpcap
-lbsd -L/usr/usr/lib64 -lmlx5 -lpthread -L/usr/usr/lib64 -lpthread
-libverbs -lpthread -lbpf -lz -lmlx4 -lpthread -L/usr/usr/lib64
-libverbs -lpthread -Wl,-R/usr/lib64 -lsze2 -lcrypto -lz -ldl -pthread
-L/opt/isa-l/lib -lisal -lelf -lz -ljansson
/usr/bin/ld: cannot find -lpcap

Probably because of -Wl,-Bstatic.
I suppose you must align with Bruce previous work: 8549295db07b
("build/pkg-config: improve static linking flags")

(note for self, l3fwd-graph has to be looked at again.. suspect the same issue).


> +
> +CFLAGS += -I.
> +
> +OBJS := $(patsubst %.c,build/%.o,$(SRCS-y))
> +
> +build/%.o: %.c Makefile $(PC_FILE) | build
> +       $(CC) $(CFLAGS) -c $< -o $@
> +
> +build/$(APP)-shared: $(OBJS)
> +       $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_SHARED)
> +
> +build/$(APP)-static: $(OBJS)
> +       $(CC) $(OBJS) -o $@ $(LDFLAGS) $(LDFLAGS_STATIC)
> +
> +build:
> +       @mkdir -p $@
> +
> +.PHONY: clean
> +clean:
> +       rm -f build/$(APP)* build/*.o
> +       test -d build && rmdir -p build || true
> +

Unneeded empty line.


-- 
David Marchand



More information about the dev mailing list