Before you go any further, decide how many PPS the overall system needs to process. If the answer isn’t “as many as possible,” or “several million PPS,” you’d be better off feeding packets to/from vpp over a memif channel or via the host stack from a separate process.
If you decide to continue down the path of building vpp into your application: fabricate a plugin which creates a custom device class and interface to handle packet I/O to/from the application. FWIW... Dave From: Akash S R <akashsr.akas...@gmail.com> Sent: Thursday, June 10, 2021 11:06 AM To: Dave Barach <v...@barachs.net> Cc: vpp-dev@lists.fd.io; srilcha...@gmail.com Subject: Re: [vpp-dev] Quick question on VPP on : How to Embed VPP as library Thanks for the quick reply. So if I need to take inputs from application and proceed to further processing, what is the way to do so? Should I still be using 2 binaries? Regards, Akash On Thu, Jun 10, 2021 at 6:31 PM Dave Barach <v...@barachs.net <mailto:v...@barachs.net> > wrote: Vpp seems to be its dispatch loop, waiting for an input node to inject work into the forwarding graph. What you call cust_main() is the moral equivalent of a while(1) loop. It won’t return. D. From: Akash S R <akashsr.akas...@gmail.com <mailto:akashsr.akas...@gmail.com> > Sent: Thursday, June 10, 2021 7:38 AM To: Akash S R <akashsr.akas...@gmail.com <mailto:akashsr.akas...@gmail.com> > Cc: v...@barachs.net <mailto:v...@barachs.net> ; vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> ; srilcha...@gmail.com <mailto:srilcha...@gmail.com> Subject: Re: [vpp-dev] Quick question on VPP on : How to Embed VPP as library Hi Dave, As per your suggestion, we have compiled a shared library and renamed main in vnet/main.c as cust_main (). Invoking the cust_main() from our application results in a hang. Bt as below: Thread 1 "vpp_main" received signal SIGINT, Interrupt. 0x00007ffff519d888 in clib_time_now_internal (c=0x7fffb3115680, n=287541441385032) at /home/soundarya/june4/vpp/src/vppinfra/time.h:219 219 if (PREDICT_FALSE Missing separate debuginfos, use: debuginfo-install check-0.9.9-5.el7.x86_64 keyutils-libs-1.5.8-3.el7.x86_64 libgcc-4.8.5-44.el7.x86_64 libselinux-2.5-15.el7.x86_64 libstdc++-4.8.5-44.el7.x86_64 libuuid-2.23.2-65.el7_9.1.x86_64 mbedtls-2.7.17-1.el7.x86_64 numactl-libs-2.0.12-5.el7.x86_64 pcre-8.32-17.el7.x86_64 pkcs11-helper-1.11-3.el7.x86_64 (gdb) thread apply all bt Thread 2 (Thread 0x7fffac0de700 (LWP 10052)): #0 0x00007ffff6ad0fd3 in epoll_wait () at ../sysdeps/unix/syscall-template.S:81 #1 0x00007fffb03dae84 in eal_intr_thread_main () from /home/soundarya/june4/vpp/build-root/install-vpp_debug-native/vpp/lib/vpp_plugins/dpdk_plugin.so #2 0x00007ffff7b53ea5 in start_thread (arg=0x7fffac0de700) at pthread_create.c:307 #3 0x00007ffff6ad09fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111 Thread 1 (Thread 0x7ffff3218940 (LWP 10048)): #0 0x00007ffff51a57f9 in vlib_main_or_worker_loop (vm=0x7fffb3115680, is_main=1) at /home/soundarya/june4/vpp/src/vlib/main.c:1764 #1 0x00007ffff51a599e in vlib_main_loop (vm=0x7fffb3115680) at /home/soundarya/june4/vpp/src/vlib/main.c:1794 #2 0x00007ffff51a69f6 in vlib_main (vm=0x7fffb3115680, input=0x7fffae6c3fb0) at /home/soundarya/june4/vpp/src/vlib/main.c:2083 #3 0x00007ffff52118c1 in thread0 (arg=140736197645952) at /home/soundarya/june4/vpp/src/vlib/unix/main.c:671 #4 0x00007ffff7e5d638 in clib_calljmp () at /home/5G/vpp/src/vppinfra/longjmp.S:123 #5 0x00007fffffffafa0 in ?? () #6 0x00007ffff5212010 in vlib_unix_main (argc=37, argv=0x46a3c0) at /home/soundarya/june4/vpp/src/vlib/unix/main.c:751 #7 0x00007ffff7f2774e in cust_main (argc=37, argv=0x46a3c0) at /home/soundarya/june4/vpp/src/vpp/vnet/main.c:339 #8 0x000000000041757c in main () at /home/soundarya/june4/ViNGC/upf/DataPlane/packetProcessing/vpp/dp/sim/src/altvppsim.c:119 (gdb) Any points to resolve it? Thanks in Advance! Regards, Akash On Wed, May 19, 2021 at 5:48 PM Akash S R via lists.fd.io <http://lists.fd.io> <akashsr.akashsr=gmail....@lists.fd.io <mailto:gmail....@lists.fd.io> > wrote: Thanks Dave, Will check it out and get back here if any query is to be addressed. Regards, Akash On Wed, May 19, 2021, 4:51 PM <v...@barachs.net <mailto:v...@barachs.net> > wrote: Long ago, we decided to strictly separate the vpp data plane process from its control plane process(es); as a matter of fault containment if nothing else. As a practical matter, if you want to build vpp as a library you could change .../src/vpp/vnet/main.c in trivial ways, and adjust .../src/vpp/CMakeLists.txt to build a shared library instead of a standalone binary. Bottom line: I wouldn’t go there myself for any number of reasons, but it wouldn’t be difficult. HTH... Dave From: vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> <vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> > On Behalf Of Akash S R Sent: Wednesday, May 19, 2021 6:31 AM To: vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io> Cc: srilcha...@gmail.com <mailto:srilcha...@gmail.com> Subject: [vpp-dev] Quick question on VPP on : How to Embed VPP as library Hi All, We are using VPP version 21.06 (Latest) We understand that vpp package consists of libraries , plugins,dev and debugs utilities and runs as exe . But as per our current usage , we have a control plane application layer from which we have included VPP packages as libraries from our Makefile . We launch VPP as a separate process and we invoke VAPI's using socket. What is the way to embed VPP directly as a library (Instead of a separate process ) and directly invoke VAPI's from control plane applications ? This is important since we need to know how to deliver VPP as a library to our client. Please Reply Back if any Related Solution is known. Thanks in Advance! Regards, Akash
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#19558): https://lists.fd.io/g/vpp-dev/message/19558 Mute This Topic: https://lists.fd.io/mt/82933046/21656 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-