vlib: clean up r2 plugin registration relocator
[vpp.git] / src / vnet / l2 / l2_bvi.c
index 7760f3d..e39c4aa 100644 (file)
@@ -58,14 +58,12 @@ bvi_mac_change (vnet_hw_interface_t * hi,
   return (NULL);
 }
 
-/* *INDENT-OFF* */
 VNET_DEVICE_CLASS (bvi_device_class) = {
   .name = "BVI",
   .format_device_name = format_bvi_name,
   .admin_up_down_function = bvi_admin_up_down,
   .mac_addr_change_function = bvi_mac_change,
 };
-/* *INDENT-ON* */
 
 /*
  * Maintain a bitmap of allocated bvi instance numbers.
@@ -76,7 +74,7 @@ static u32
 bvi_instance_alloc (u32 want)
 {
   /*
-   * Check for dynamically allocaetd instance number.
+   * Check for dynamically allocated instance number.
    */
   if (~0 == want)
     {
@@ -138,13 +136,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 +174,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);
 
@@ -282,13 +271,11 @@ l2_bvi_create_cli (vlib_main_t * vm,
  * Example of how to create a bvi interface:
  * @cliexcmd{bvi create}
 ?*/
-/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (l2_bvi_create_command, static) = {
   .path = "bvi create",
   .short_help = "bvi create [mac <mac-addr>] [instance <instance>]",
   .function = l2_bvi_create_cli,
 };
-/* *INDENT-ON* */
 
 static clib_error_t *
 l2_bvi_delete_cli (vlib_main_t * vm,
@@ -329,17 +316,15 @@ l2_bvi_delete_cli (vlib_main_t * vm,
  *
  * @cliexpar
  * The following two command syntaxes are equivalent:
- * @cliexcmd{bvi delete <interace>}
+ * @cliexcmd{bvi delete <interface>}
  * Example of how to create a bvi interface:
  * @cliexcmd{bvi delete bvi0}
 ?*/
-/* *INDENT-OFF* */
 VLIB_CLI_COMMAND (l2_bvi_delete_command, static) = {
   .path = "bvi delete",
   .short_help = "bvi delete <interface>",
   .function = l2_bvi_delete_cli,
 };
-/* *INDENT-ON* */
 
 
 /*