From 5c954c4641c7894636aa0533634ef4f5a6bed615 Mon Sep 17 00:00:00 2001 From: Damjan Marion Date: Thu, 6 Jan 2022 20:36:14 +0100 Subject: ethernet: new interface registration function Prep for supporting multiple callbacks, optional args, etc. Type: improvement Change-Id: I96244c098712e8213374678623f12527b0e7f387 Signed-off-by: Damjan Marion --- src/vnet/l2/l2_bvi.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) (limited to 'src/vnet/l2/l2_bvi.c') diff --git a/src/vnet/l2/l2_bvi.c b/src/vnet/l2/l2_bvi.c index e5623682657..9cfff55fb45 100644 --- a/src/vnet/l2/l2_bvi.c +++ b/src/vnet/l2/l2_bvi.c @@ -138,13 +138,11 @@ l2_bvi_create (u32 user_instance, { vnet_main_t *vnm = vnet_get_main (); vlib_main_t *vm = vlib_get_main (); + vnet_eth_interface_registration_t eir = {}; u32 instance, hw_if_index, slot; vnet_hw_interface_t *hw_if; - clib_error_t *error; mac_address_t mac; - int rv = 0; - ASSERT (sw_if_indexp); *sw_if_indexp = (u32) ~ 0; @@ -178,17 +176,10 @@ l2_bvi_create (u32 user_instance, mac_address_copy (&mac, mac_in); } - error = ethernet_register_interface (vnm, - bvi_device_class.index, - instance, mac.bytes, &hw_if_index, - /* flag change */ 0); - - if (error) - { - rv = VNET_API_ERROR_INVALID_REGISTRATION; - clib_error_report (error); - return rv; - } + eir.dev_class_index = bvi_device_class.index; + eir.dev_instance = instance; + eir.address = mac.bytes; + hw_if_index = vnet_eth_register_interface (vnm, &eir); hw_if = vnet_get_hw_interface (vnm, hw_if_index); -- cgit 1.2.3-korg