From 2a5bb3b5ab3e05cee0da6a78b77e67fbc3bdca75 Mon Sep 17 00:00:00 2001 From: Stanislav Zaikin Date: Thu, 9 Mar 2023 19:35:11 +0100 Subject: linux-cp: auto select tap id when creating lcp pair Now when lcp pair is created, tap instance is based on hw_id. But tap interface with such instance can already exist. Introduce an offset and auto-selection based on it. Type: fix Signed-off-by: Stanislav Zaikin Change-Id: I9db39106b0b0d5bf95c445b03e5b7ff52f946dd2 --- src/vnet/devices/tap/tap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/vnet/devices/tap/tap.c') diff --git a/src/vnet/devices/tap/tap.c b/src/vnet/devices/tap/tap.c index 1e2ee87041d..b0b0a3af13f 100644 --- a/src/vnet/devices/tap/tap.c +++ b/src/vnet/devices/tap/tap.c @@ -85,7 +85,7 @@ virtio_eth_set_max_frame_size (vnet_main_t *vnm, vnet_hw_interface_t *hi, return 0; } -#define TAP_MAX_INSTANCE 1024 +#define TAP_MAX_INSTANCE 8192 static void tap_free (vlib_main_t * vm, virtio_if_t * vif) @@ -162,7 +162,8 @@ tap_create_if (vlib_main_t * vm, tap_create_if_args_t * args) } else { - args->id = clib_bitmap_first_clear (tm->tap_ids); + args->id = clib_bitmap_next_clear (tm->tap_ids, args->auto_id_offset % + TAP_MAX_INSTANCE); } if (args->id > TAP_MAX_INSTANCE) -- cgit 1.2.3-korg