From c83c3b7f117b981b677f646a0e30f44ec70de239 Mon Sep 17 00:00:00 2001 From: Jon Loeliger Date: Thu, 23 Feb 2017 13:57:35 -0600 Subject: Implement a loopback instance allocation scheme. To support creating loopback interfaces with a specific instance number, a new CREATE_LOOPBACK_INSTANCE API call with flag is_specified and value user_instance is introduced. Presumably the existing CREATE_LOOPBACK API message will be obsoleted and revmoved. The VAT cli commands can now mention and format the new field as 'instance %d' data. If no instance number is named, the old call CREATE_LOOPBACK is used to maintain backward compatibility. However, if the instance is named, the new CREATE_LOOPBACK_INSTANCE message will be used. Both the dynamically allocated and user-requested instance number are tracked in a bitvector. If is_specified is 0, the next free instance will be used.. A request for a specific instance number will be granted if it is available. On error, the value ~0 is returned. Change-Id: I849815563a5da736dcd6bccd262ef49b963f6643 Signed-off-by: Jon Loeliger --- src/vpp/api/custom_dump.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/vpp/api/custom_dump.c') diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index c61e31bb..ee0c4629 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -72,6 +72,18 @@ static void *vl_api_create_loopback_t_print FINISH; } +static void *vl_api_create_loopback_instance_t_print + (vl_api_create_loopback_instance_t * mp, void *handle) +{ + u8 *s; + + s = format (0, "SCRIPT: create_loopback "); + s = format (s, "mac %U ", format_ethernet_address, &mp->mac_address); + s = format (s, "instance %d ", ntohl (mp->user_instance)); + + FINISH; +} + static void *vl_api_delete_loopback_t_print (vl_api_delete_loopback_t * mp, void *handle) { @@ -2821,6 +2833,7 @@ foreach_custom_print_no_arg_function #undef _ #define foreach_custom_print_function \ _(CREATE_LOOPBACK, create_loopback) \ +_(CREATE_LOOPBACK_INSTANCE, create_loopback_instance) \ _(SW_INTERFACE_SET_FLAGS, sw_interface_set_flags) \ _(SW_INTERFACE_ADD_DEL_ADDRESS, sw_interface_add_del_address) \ _(SW_INTERFACE_SET_TABLE, sw_interface_set_table) \ -- cgit 1.2.3-korg