Hi,
I've created a timestamp plugin to stamp all packets being received prior to
the ethernet-input node. The problem I'm seeing, based on debug prints I've
inserted into VLIB_NODE_FN (timestamp_node), is that my plugin node is running
way way after any other node (seconds). I have similar prints on other
VLIB_NODE_FNs and I've confirmed they are printing before mine. The thing is,
though it is running seconds after, pinging my vpp still receives a result. I
would expect that it would timeout since my node sometimes runs 5 seconds after
(according to the prints).
node.c
VLIB_NODE_FN (timestamp_node) (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
.....
b0 = vlib_get_buffer (vm, bi0);
// Stamp
in_time0 = unix_time_now_nsec ();
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_RX];
/* Pass the timestamp, thanks to the vnet_buffer unused metadata field */
/* Camping on unused[4-5] data... just ensure statically that there is enough
space and no hope is using it */
STATIC_ASSERT (ARRAY_LEN (vnet_buffer (b0)->unused) * (sizeof (vnet_buffer
(b0)->unused[0]) * 2) > sizeof (in_time0), "Packet ingress timestamp fits
within remaining space of vnet_buffer unused data");
f64 *pnowts0 = (f64 *) &vnet_buffer (b0)->unused[4];
*pnowts0 = in_time0; // sets to zero according to prints in another node
...
}
VLIB_REGISTER_NODE (timestamp_node) =
{
.name = "timestamp",
.vector_size = sizeof (u32),
.format_trace = format_timestamp_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
.n_errors = ARRAY_LEN(timestamp_error_strings),
.error_strings = timestamp_error_strings,
.n_next_nodes = TIMESTAMP_N_NEXT,
/* edit / add dispositions here */
.next_nodes = {
[TIMESTAMP_NEXT_ETHERNET_INPUT] = "ethernet-input",
[TIMESTAMP_NEXT_DROP] = "error-drop", /* notused */
},
};
timestamp.c VLIB_INIT_FUNCTION (timestamp_init) =
{
.runs_before = VLIB_INITS ("ethernet-init"), // change to ip_main_init
};
VNET_FEATURE_INIT (timestamp, static) =
{
.arc_name = "device-input",
.node_name = "timestamp",
.runs_before = VNET_FEATURES ("ethernet-input"),
};
show init function
[18]: l2_init
[19]: timestamp_init
[20]: ethernet_init
Regards,
Mauricio
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#17490): https://lists.fd.io/g/vpp-dev/message/17490
Mute This Topic: https://lists.fd.io/mt/77030695/21656
Mute #vnet:https://lists.fd.io/g/vpp-dev/mutehashtag/vnet
Mute #vpp:https://lists.fd.io/g/vpp-dev/mutehashtag/vpp
Group Owner: [email protected]
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-