summaryrefslogtreecommitdiffstats
path: root/src/vnet/pg/pg_api.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/pg_api.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/pg_api.c')
-rw-r--r--src/vnet/pg/pg_api.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/src/vnet/pg/pg_api.c b/src/vnet/pg/pg_api.c
index 554e8ea31c1..b3eb315e807 100644
--- a/src/vnet/pg/pg_api.c
+++ b/src/vnet/pg/pg_api.c
@@ -40,12 +40,13 @@
#include <vlibapi/api_helper_macros.h>
-
-#define foreach_pg_api_msg \
-_(PG_CREATE_INTERFACE, pg_create_interface) \
-_(PG_CAPTURE, pg_capture) \
-_(PG_ENABLE_DISABLE, pg_enable_disable) \
-_(PG_INTERFACE_ENABLE_DISABLE_COALESCE, pg_interface_enable_disable_coalesce)
+#define foreach_pg_api_msg \
+ _ (PG_CREATE_INTERFACE, pg_create_interface) \
+ _ (PG_CREATE_INTERFACE_V2, pg_create_interface_v2) \
+ _ (PG_CAPTURE, pg_capture) \
+ _ (PG_ENABLE_DISABLE, pg_enable_disable) \
+ _ (PG_INTERFACE_ENABLE_DISABLE_COALESCE, \
+ pg_interface_enable_disable_coalesce)
static void
vl_api_pg_create_interface_t_handler (vl_api_pg_create_interface_t * mp)
@@ -54,9 +55,9 @@ vl_api_pg_create_interface_t_handler (vl_api_pg_create_interface_t * mp)
int rv = 0;
pg_main_t *pg = &pg_main;
- u32 pg_if_id = pg_interface_add_or_get (pg, ntohl (mp->interface_id),
- mp->gso_enabled,
- ntohl (mp->gso_size), 0);
+ u32 pg_if_id =
+ pg_interface_add_or_get (pg, ntohl (mp->interface_id), mp->gso_enabled,
+ ntohl (mp->gso_size), 0, PG_MODE_ETHERNET);
pg_interface_t *pi = pool_elt_at_index (pg->interfaces, pg_if_id);
/* *INDENT-OFF* */
@@ -68,6 +69,22 @@ vl_api_pg_create_interface_t_handler (vl_api_pg_create_interface_t * mp)
}
static void
+vl_api_pg_create_interface_v2_t_handler (vl_api_pg_create_interface_v2_t *mp)
+{
+ vl_api_pg_create_interface_v2_reply_t *rmp;
+ int rv = 0;
+
+ pg_main_t *pg = &pg_main;
+ u32 pg_if_id =
+ pg_interface_add_or_get (pg, ntohl (mp->interface_id), mp->gso_enabled,
+ ntohl (mp->gso_size), 0, (u8) mp->mode);
+ pg_interface_t *pi = pool_elt_at_index (pg->interfaces, pg_if_id);
+
+ REPLY_MACRO2 (VL_API_PG_CREATE_INTERFACE_V2_REPLY,
+ ({ rmp->sw_if_index = ntohl (pi->sw_if_index); }));
+}
+
+static void
vl_api_pg_interface_enable_disable_coalesce_t_handler
(vl_api_pg_interface_enable_disable_coalesce_t * mp)
{