summaryrefslogtreecommitdiffstats
path: root/src/vnet/ethernet/ethernet.h
diff options
context:
space:
mode:
authorJon Loeliger <jdl@netgate.com>2017-02-23 13:57:35 -0600
committerJohn Lo <loj@cisco.com>2017-03-03 23:19:21 +0000
commitc83c3b7f117b981b677f646a0e30f44ec70de239 (patch)
tree323266bab831bcbfb14f089e803b7cbc13b857e1 /src/vnet/ethernet/ethernet.h
parenta084d62a6e47d3505b3ed314230598704314f7bc (diff)
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 <jdl@netgate.com>
Diffstat (limited to 'src/vnet/ethernet/ethernet.h')
-rw-r--r--src/vnet/ethernet/ethernet.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/vnet/ethernet/ethernet.h b/src/vnet/ethernet/ethernet.h
index 3acde421f78..ba84c69c00c 100644
--- a/src/vnet/ethernet/ethernet.h
+++ b/src/vnet/ethernet/ethernet.h
@@ -265,6 +265,9 @@ typedef struct
/* Feature arc index */
u8 output_feature_arc_index;
+
+ /* Allocated loopback instances */
+ uword *bm_loopback_instances;
} ethernet_main_t;
ethernet_main_t ethernet_main;
@@ -412,7 +415,8 @@ clib_error_t *next_by_ethertype_init (next_by_ethertype_t * l3_next);
clib_error_t *next_by_ethertype_register (next_by_ethertype_t * l3_next,
u32 ethertype, u32 next_index);
-int vnet_create_loopback_interface (u32 * sw_if_indexp, u8 * mac_address);
+int vnet_create_loopback_interface (u32 * sw_if_indexp, u8 * mac_address,
+ u8 is_specified, u32 user_instance);
int vnet_delete_loopback_interface (u32 sw_if_index);
int vnet_delete_sub_interface (u32 sw_if_index);