Implement a loopback instance allocation scheme. 72/5572/3
authorJon Loeliger <jdl@netgate.com>
Thu, 23 Feb 2017 19:57:35 +0000 (13:57 -0600)
committerJohn Lo <loj@cisco.com>
Fri, 3 Mar 2017 23:19:21 +0000 (23:19 +0000)
commitc83c3b7f117b981b677f646a0e30f44ec70de239
tree323266bab831bcbfb14f089e803b7cbc13b857e1
parenta084d62a6e47d3505b3ed314230598704314f7bc
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>
src/vat/api_format.c
src/vnet/ethernet/ethernet.h
src/vnet/ethernet/interface.c
src/vpp/api/api.c
src/vpp/api/custom_dump.c
src/vpp/api/test_client.c
src/vpp/api/vpe.api