-
Notifications
You must be signed in to change notification settings - Fork 5
Plugin in VPP
valebru edited this page Dec 8, 2017
·
6 revisions
cd $VPP_ROOT/src/examples/sample-plugin/
In sample-plugins directory:
libtoolize
aclocal
autoconf
autoheader
automake --add-missing
chmod +x configure
./configure
echo "MAKE command:"
make
echo "CP command:"
cp .libs/sample_plugin.so $VPP_ROOT/build-root/install-vpp-native/vpp/lib64/vpp_plugins/
To enable the sample plugin
sample macswap <interface name>
To disable the sample plugin
sample macswap <interface name> disable
In order to create cli command:
VLIB_CLI_COMMAND (sr_content_command, static) = {
.path = "sample v-macswap",
.short_help =
"sample v-macswap <interface-name> [prefetch] [disable]",
.function = macswap_enable_disable_command_fn,
};
- path is the string to write in the vppctl
- function is the c-function will be called
Instead, in order to link the plugin inside the Forwarding Graph:
VNET_FEATURE_INIT (sample, static) =
{
.arc_name = "device-input",
.node_name = "sample",
.runs_before = VNET_FEATURES ("ethernet-input"),
};
- arc_name is the previous node
- runs_before is the next node. It could be more than one with the syntax
{ , }
device-input is dpdk
#show vpp graph
sudo $SFLAG $BINS/vppctl -p vpp1 show vlib graph
If you want to apply some changes inside an existing plugin, like Acl-Plugin. You should look a different directory: cd $VPP_ROOT/src/plugin/acl/
After you made changes, in order to compile the plugin you should just run make buil-release
in $VPP_ROOT