aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/cli.c
diff options
context:
space:
mode:
authorNeale Ranns <neale@graphiant.com>2021-06-03 14:43:21 +0000
committerOle Tr�an <otroan@employees.org>2021-06-14 13:12:34 +0000
commit6197cb730e1571ca69859489c0ae7ea90a5c5fd4 (patch)
tree769f178533896318ed98c0014987169d24db94db /src/vnet/pg/cli.c
parent52c33d60bc63626d400067e38ab0af312fdb8594 (diff)
pg: A Tunnel mode variant of a pg interface
Type: feature this allows VPP to simulate linux tun devices. Signed-off-by: Neale Ranns <neale@graphiant.com> Change-Id: I3adf38b49a254804370f78edd5d275d192fd00a6
Diffstat (limited to 'src/vnet/pg/cli.c')
-rw-r--r--src/vnet/pg/cli.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/vnet/pg/cli.c b/src/vnet/pg/cli.c
index 9da0f8d9981..e57e72573f3 100644
--- a/src/vnet/pg/cli.c
+++ b/src/vnet/pg/cli.c
@@ -333,6 +333,23 @@ validate_stream (pg_stream_t * s)
return 0;
}
+const char *
+pg_interface_get_input_node (pg_interface_t *pi)
+{
+ switch (pi->mode)
+ {
+ case PG_MODE_ETHERNET:
+ return ("ethernet-input");
+ case PG_MODE_IP4:
+ return ("ip4-input");
+ case PG_MODE_IP6:
+ return ("ip6-input");
+ }
+
+ ASSERT (0);
+ return ("ethernet-input");
+}
+
static clib_error_t *
new_stream (vlib_main_t * vm,
unformat_input_t * input, vlib_cli_command_t * cmd)
@@ -351,7 +368,7 @@ new_stream (vlib_main_t * vm,
s.node_index = ~0;
s.max_packet_bytes = s.min_packet_bytes = 64;
s.buffer_bytes = vlib_buffer_get_default_data_size (vm);
- s.if_id = 0;
+ s.if_id = ~0;
s.n_max_frame = VLIB_FRAME_SIZE;
pcap_file_name = 0;
@@ -427,8 +444,15 @@ new_stream (vlib_main_t * vm,
{
if (pcap_file_name != 0)
{
- vlib_node_t *n =
- vlib_get_node_by_name (vm, (u8 *) "ethernet-input");
+ vlib_node_t *n;
+
+ ASSERT (s.if_id != ~0);
+
+ if (s.if_id != ~0)
+ n = vlib_get_node_by_name (vm, (u8 *) pg_interface_get_input_node (
+ &pg->interfaces[s.if_id]));
+ else
+ n = vlib_get_node_by_name (vm, (u8 *) "ethernet-input");
s.node_index = n->index;
}
else
@@ -694,8 +718,8 @@ create_pg_if_cmd_fn (vlib_main_t * vm,
}
}
- pg_interface_add_or_get (pg, if_id, gso_enabled, gso_size,
- coalesce_enabled);
+ pg_interface_add_or_get (pg, if_id, gso_enabled, gso_size, coalesce_enabled,
+ PG_MODE_ETHERNET);
done:
unformat_free (line_input);