Hello, I'm a developer interested in the VPP project. I have wrote my first
plugin for VPP, mostly in educational purposes. At now it can show used
protocols, headers information and payload on input and output.

I have some trouble with understanding VPP API. Please, help me to
understand it correctly in the case of writing a multi architectural
(IPv4/IPv6) plugin. I've quoted the parts of code below:

Defining the nodes and it's functions... it's ok no problem, no questions,
just for info:

    vlib_node_registration_t probe_output_ip4_node;
    vlib_node_registration_t probe_output_ip6_node;

    static uword probe_output_ip4_node_fn (
        vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
{
        .....
    }
    static uword probe_output_ip6_node_fn (
        vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame)
{
        .....
    }

This macro defines the node name and it's place in the graph. Right?

    VNET_FEATURE_INIT (probe_output_ip4_feat, static) = {
        .arc_name = "ip4-output",

I've got this suitable 'arc_name' from other source codes.
Where I can get the comlete list of arc_names with description?

        .node_name = "data-probe-output-ip4",
        .runs_before = VNET_FEATURES ("interface-output"),
    };
    VNET_FEATURE_INIT (probe_output_ip6_feat, static) = {
        .arc_name = "ip6-output",
        .node_name = "data-probe-output-ip6",
        .runs_before = VNET_FEATURES ("interface-output"),
    };

Node registration. What is the "vector_size' and what for? Where I can read
about other node types? What is the type of next_nodes parameter? Is there
a way to assign an array of the node names (static char * arr[][]) to this
variable? What a function of sibling_of parameter? Am I use it correctly?

    VLIB_REGISTER_NODE (probe_output_ip4_node) = {
        .function = probe_output_ip4_node_fn,
        .name = "data-probe-output-ip4",
        .vector_size = sizeof (u32),
        .format_trace = format_probe_trace,
        .type = VLIB_NODE_TYPE_INTERNAL,
        ...
        .next_nodes = { [PROBE_NEXT_INTERFACE_OUTPUT] = "interface-output"
},
    };
    VLIB_REGISTER_NODE (probe_output_ip6_node) = {
        .function = probe_output_ip6_node_fn,
        .name = "data-probe-output-ip6",
        ...
        .sibling_of = "data-probe-output-ip4",
    };

I can't find any information about the macros below. What for is it?

VLIB_NODE_FUNCTION_MULTIARCH (probe_output_ip4_node,
probe_output_ip4_node_fn)
VLIB_NODE_FUNCTION_MULTIARCH (probe_output_ip6_node,
probe_output_ip6_node_fn)

Load the nodes. Can I use one node to work with both of IPv4 and IPv6
protocols? For example, can I register the node after interface-output,
before interface-tx?

    vnet_feature_enable_disable ("ip4-output", "data-probe-output-ip4",
                                        sw_if_index, enable_disable, 0, 0);
    vnet_feature_enable_disable ("ip6-output", "data-probe-output-ip6",
                                        sw_if_index, enable_disable, 0, 0);

Many thanks in advance!

Full plugin's code placed here:
https://github.com/xxald/vpp-probe

Reply via email to