FD.io VPP
v19.04-6-g6f05f72
Vector Packet Processing
|
Feature Subgraph Ordering. More...
Go to the source code of this file.
Functions | |
static int | comma_split (u8 *s, u8 **a, u8 **b) |
clib_error_t * | vnet_feature_arc_init (vlib_main_t *vm, vnet_config_main_t *vcm, char **feature_start_nodes, int num_feature_start_nodes, vnet_feature_registration_t *first_reg, vnet_feature_constraint_registration_t *first_const_set, char ***in_feature_nodes) |
Initialize a feature graph arc. More... | |
Feature Subgraph Ordering.
Dynamically compute feature subgraph ordering by performing a topological sort across a set of "feature A before feature B" and "feature C after feature B" constraints.
Use the topological sort result to set up vnet_config_main_t's for use at runtime.
Feature subgraph arcs are simple enough. They start at specific fixed nodes, and end at specific fixed nodes. In between, a per-interface current feature configuration dictates which additional nodes each packet visits. Each so-called feature node can [of course] drop any specific packet.
See ip4_forward.c, ip6_forward.c in this directory to see the current rx-unicast, rx-multicast, and tx feature subgraph arc definitions.
Let's say that we wish to add a new feature to the ip4 unicast feature subgraph arc, which needs to run before ip4-lookup
. In either base code or a plugin,
#include <vnet/feature/feature.h>
and add the new feature as shown:
VNET_FEATURE_INIT (ip4_lookup, static) = { .arch_name = "ip4-unicast", .node_name = "my-ip4-unicast-feature", .runs_before = VLIB_FEATURES ("ip4-lookup") };
Here's the standard coding pattern to enable / disable my-ip4-unicast-feature
on an interface:
sw_if_index = <interface-handle> vnet_feature_enable_disable ("ip4-unicast", "my-ip4-unicast-feature", sw_if_index, 1 );
Here's how to obtain the correct next node index in packet processing code, aka in the implementation of my-ip4-unicast-feature
:
vnet_feature_next (sw_if_index0, &next0, b0);
Nodes are free to drop or otherwise redirect packets. Packets which "pass" should be enqueued via the next0 arc computed by vnet_feature_next.
Definition in file registration.c.
clib_error_t* vnet_feature_arc_init | ( | vlib_main_t * | vm, |
vnet_config_main_t * | vcm, | ||
char ** | feature_start_nodes, | ||
int | num_feature_start_nodes, | ||
vnet_feature_registration_t * | first_reg, | ||
vnet_feature_constraint_registration_t * | first_const_set, | ||
char *** | in_feature_nodes | ||
) |
Initialize a feature graph arc.
vm | vlib main structure pointer | |
vcm | vnet config main structure pointer | |
feature_start_nodes | names of start-nodes which use this feature graph arc | |
num_feature_start_nodes | number of start-nodes | |
first_reg | first element in [an attribute((constructor)) function built, or otherwise created] singly-linked list of feature registrations | |
first_const | first element in [an attribute((constructor)) function built, or otherwise created] singly-linked list of bulk order constraints | |
[out] | in_feature_nodes | returned vector of topologically-sorted feature node names, for use in show commands |
Definition at line 121 of file registration.c.