Change-Id: Ice97940a27c9f4d983d9199d59719d953520fcdb
Signed-off-by: Damjan Marion <damarion@cisco.com>
/* *INDENT-OFF* */
VNET_FEATURE_ARC_INIT (device_input, static) = {
.arc_name = "device-input",
/* *INDENT-OFF* */
VNET_FEATURE_ARC_INIT (device_input, static) = {
.arc_name = "device-input",
+ .start_nodes = VNET_FEATURES (
- .start_nodes = VNET_FEATURES ("dpdk-input", "vhost-user-input", "af-packet-input", "netmap-input", "tuntap-rx"),
-#else
- .start_nodes = VNET_FEATURES ("vhost-user-input", "af-packet-input", "netmap-input", "tuntap-rx"),
+ "vhost-user-input", "af-packet-input", "netmap-input",
+ "tuntap-rx", "pg-input"),
};
VNET_FEATURE_INIT (l2_patch, static) = {
};
VNET_FEATURE_INIT (l2_patch, static) = {
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
#include <vnet/vnet.h>
#include <vlib/vlib.h>
#include <vnet/pg/pg.h>
#include <vnet/vnet.h>
+#include <vnet/feature/feature.h>
+#include <vnet/devices/devices.h>
#if DPDK==1
#include <vnet/devices/dpdk/dpdk.h>
#if DPDK==1
#include <vnet/devices/dpdk/dpdk.h>
u32 *to_next, n_this_frame, n_left, n_trace, n_packets_in_fifo;
uword n_packets_generated;
pg_buffer_index_t *bi, *bi0;
u32 *to_next, n_this_frame, n_left, n_trace, n_packets_in_fifo;
uword n_packets_generated;
pg_buffer_index_t *bi, *bi0;
+ u32 next_index = s->next_index;
+ vnet_feature_main_t *fm = &feature_main;
+ vnet_feature_config_main_t *cm;
+ u8 feature_arc_index = fm->device_input_feature_arc_index;
+ cm = &fm->feature_config_mains[feature_arc_index];
+ u32 current_config_index = ~(u32) 0;
+ int i;
n_packets_to_generate = clib_min (n_packets_in_fifo, n_packets_to_generate);
n_packets_generated = 0;
n_packets_to_generate = clib_min (n_packets_in_fifo, n_packets_to_generate);
n_packets_generated = 0;
+ if (PREDICT_FALSE
+ (vnet_have_features (feature_arc_index, s->sw_if_index[VLIB_RX])))
+ {
+ current_config_index =
+ vec_elt (cm->config_index_by_sw_if_index, s->sw_if_index[VLIB_RX]);
+ vnet_get_config_data (&cm->config_main, ¤t_config_index,
+ &next_index, 0);
+ }
+
while (n_packets_to_generate > 0)
{
u32 *head, *start, *end;
while (n_packets_to_generate > 0)
{
u32 *head, *start, *end;
- vlib_get_next_frame (vm, node, s->next_index, to_next, n_left);
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left);
n_this_frame = n_packets_to_generate;
if (n_this_frame > n_left)
n_this_frame = n_packets_to_generate;
if (n_this_frame > n_left)
vec_foreach (bi, s->buffer_indices)
clib_fifo_advance_head (bi->buffer_fifo, n_this_frame);
vec_foreach (bi, s->buffer_indices)
clib_fifo_advance_head (bi->buffer_fifo, n_this_frame);
+ if (current_config_index != ~(u32) 0)
+ for (i = 0; i < n_this_frame; i++)
+ {
+ vlib_buffer_t *b;
+ b = vlib_get_buffer (vm, to_next[i]);
+ vnet_buffer (b)->device_input_feat.saved_next_index =
+ s->next_index;
+ vnet_buffer (b)->device_input_feat.buffer_advance = 0;
+ b->current_config_index = current_config_index;
+ b->feature_arc_index = feature_arc_index;
+ }
+
n_trace = vlib_get_trace_count (vm, node);
if (n_trace > 0)
{
n_trace = vlib_get_trace_count (vm, node);
if (n_trace > 0)
{
n_packets_to_generate -= n_this_frame;
n_packets_generated += n_this_frame;
n_left -= n_this_frame;
n_packets_to_generate -= n_this_frame;
n_packets_generated += n_this_frame;
n_left -= n_this_frame;
- vlib_put_next_frame (vm, node, s->next_index, n_left);
+ vlib_put_next_frame (vm, node, next_index, n_left);
}
return n_packets_generated;
}
return n_packets_generated;
/* Input node will be left disabled until a stream is active. */
.state = VLIB_NODE_STATE_DISABLED,
/* Input node will be left disabled until a stream is active. */
.state = VLIB_NODE_STATE_DISABLED,
+ .n_next_nodes = VNET_DEVICE_INPUT_N_NEXT_NODES,
+ .next_nodes = VNET_DEVICE_INPUT_NEXT_NODES,