Skip to main content

vnet_feature_init

Macro vnet_feature_init 

Source
vnet_feature_init!() { /* proc-macro */ }
Expand description

Registers a VPP feature

Allowing the VPP node to be executed in a feature arc. Note that the feature won’t be executed until enabled.

§Attributes

Each variant must have a #[error_counter(...)] attribute, with the following key-value pairs:

  • identifier = <ident>: (required) An identifier of a static of type vpp_plugin::vnet::feature::FeatureRegistration that will be declared and registered by the macro.
  • arc_name = "<name>": (required, string literal) The name of the feature arc the node will be registered to.
  • node = <ident>: (required, string literal) The name of a node type registered using [vlib_node].
  • runs_before = [("<feature-name>")*]: (optional, string literal) A list of features that should be executed in the feature arc before this feature is executed.
  • runs_after = [("<feature-name>")*]: (optional, string literal) A list of features that should be executed in the feature arc after this feature is executed.

§Examples

#[vlib_node(
    name = "example",
    instance = EXAMPLE_NODE,
)]
struct ExampleNode;

// ...

vnet_feature_init! {
    identifier: EXAMPLE_FEAT,
    arc_name: "ip4-unicast",
    node: ExampleNode,
    runs_before: ["ip4-flow-classify"],
    runs_after: ["ip4-sv-reassembly-feature"],
}