capsule-rs / capsule

A framework for network function development. Written in Rust, inspired by NetBricks and built on DPDK.
Apache License 2.0
393 stars 35 forks source link

Multi-Process (primary and secondary) support for Capsule application(s) #74

Open zeeshanlakhani opened 4 years ago

zeeshanlakhani commented 4 years ago

Background

As part of re-thinking our runtime model and pipeline scheduling (#75), we'd like to support multi-process applications, including examples with a non-Capsule DPDK application acting as primary while a Capsule application acts as secondary process or vice versa, as well as two Capsule applications acting as primary and secondary.

One example idea would involve a non-capsule primary DPDK application (e.g maybe testpmd) that generates packets and forwards those packets to a secondary Capsule-written NF. Another is a primary Capsule application forwarding packets to a DPDK pdump secondary process. One caveat here is be aware that both processes need to share the same DPDK versions.

A main use case we've seen usually revolves around Open vSwitch being the primary process with other secondary process in something like Capsule, etc...

ratnadeepb commented 4 years ago

I am considering using capsule in my work with multi-process DPDK applications. I noticed that there is a provision in RuntimeConfig to indicate that a process would be secondary. However, what I can't figure out is how DPDK ring has been implemented. My intuition is to checkout batch::Bridge but I was wondering if you could point out anything a little more concrete on this?

drunkirishcoder commented 4 years ago

@ratnadeepb unfortunately, we currently don't support running a Capsule app as a secondary DPDK process. It is something we are looking to provide support for but haven't gotten around to because we have some planned rework of the underlying Capsule runtime that hopefully will make adding multi-process support easier.

In terms of DPDK ring support, we only support it via the virtual PMD driver. Right now we don't have plans to expose the DPDK ring API directly in Capsule. The goal is to consolidate the number of ways you send/receive packets. We will re-evaluate that when adding the secondary process support if that's inadequate.