misc: remove GNU Indent directives
[vpp.git] / src / plugins / marvell / pp2 / pp2.c
index d84d12f..030ab9b 100644 (file)
@@ -22,9 +22,9 @@
 
 #include <vlib/vlib.h>
 #include <vlib/unix/unix.h>
-#include <vppinfra/linux/syscall.h>
 #include <vnet/plugin/plugin.h>
 #include <marvell/pp2/pp2.h>
+#include <vnet/interface/rx_queue_funcs.h>
 
 /* size of DMA memory used by musdk (not used for buffers) */
 #define MV_SYS_DMA_MEM_SZ              (2 << 20)
@@ -119,14 +119,9 @@ mrvl_pp2_delete_if (mrvl_pp2_if_t * ppif)
   mrvl_pp2_main_t *ppm = &mrvl_pp2_main;
   mrvl_pp2_outq_t *outq;
   mrvl_pp2_inq_t *inq;
-  int i;
 
   if (ppif->hw_if_index != ~0)
-    {
-      vec_foreach_index (i, ppif->inqs)
-       vnet_hw_interface_unassign_rx_thread (vnm, ppif->hw_if_index, i);
       ethernet_delete_interface (vnm, ppif->hw_if_index);
-    }
 
   if (ppif->ppio)
     {
@@ -134,7 +129,6 @@ mrvl_pp2_delete_if (mrvl_pp2_if_t * ppif)
       pp2_ppio_deinit (ppif->ppio);
     }
 
-  /* *INDENT-OFF* */
   /* free buffers hanging in the tx ring */
   vec_foreach (outq, ppif->outqs)
     {
@@ -167,7 +161,6 @@ mrvl_pp2_delete_if (mrvl_pp2_if_t * ppif)
        pp2_bpool_deinit (inq->bpool);
       }
   vec_free (ppif->inqs);
-  /* *INDENT-ON* */
 
 
   pool_put (ppm->interfaces, ppif);
@@ -179,8 +172,10 @@ mrvl_pp2_delete_if (mrvl_pp2_if_t * ppif)
 void
 mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args)
 {
+  vlib_main_t *vm = vlib_get_main ();
   vnet_main_t *vnm = vnet_get_main ();
   vlib_thread_main_t *tm = vlib_get_thread_main ();
+  vnet_eth_interface_registration_t eir = {};
   mrvl_pp2_main_t *ppm = &mrvl_pp2_main;
   struct pp2_bpool_params bpool_params = { 0 };
   struct pp2_ppio_params ppio_params = { 0 };
@@ -244,7 +239,7 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args)
   /* FIXME bpool bit select per pp */
   s = format (s, "pool-%d:%d%c", pp2_id, pp2_id + 8, 0);
   bpool_params.match = (char *) s;
-  bpool_params.buff_len = vlib_bufer_get_default_size (vm);
+  bpool_params.buff_len = vlib_buffer_get_default_data_size (vm);
   /* FIXME +64 ? */
   if (pp2_bpool_init (&bpool_params, &ppif->inqs[0].bpool))
     {
@@ -285,25 +280,25 @@ mrvl_pp2_create_if (mrvl_pp2_create_if_args_t * args)
       goto error;
     }
 
-  args->error = ethernet_register_interface (vnm, mrvl_pp2_device_class.index,
-                                            ppif->dev_instance,
-                                            mac_addr,
-                                            &ppif->hw_if_index,
-                                            mrvl_pp2_eth_flag_change);
-  if (args->error)
-    {
-      args->rv = VNET_API_ERROR_INVALID_REGISTRATION;
-      goto error;
-    }
+  eir.dev_class_index = mrvl_pp2_device_class.index;
+  eir.dev_instance = ppif->dev_instance;
+  eir.address = mac_addr;
+  eir.cb.flag_change = mrvl_pp2_eth_flag_change;
+  ppif->hw_if_index = vnet_eth_register_interface (vnm, &eir);
 
   sw = vnet_get_hw_sw_interface (vnm, ppif->hw_if_index);
   ppif->sw_if_index = sw->sw_if_index;
   ppif->per_interface_next_index = ~0;
-  vnet_hw_interface_set_input_node (vnm, ppif->hw_if_index,
-                                   mrvl_pp2_input_node.index);
-  vnet_hw_interface_assign_rx_thread (vnm, ppif->hw_if_index, 0, ~0);
-  vnet_hw_interface_set_rx_mode (vnm, ppif->hw_if_index, 0,
-                                VNET_HW_INTERFACE_RX_MODE_POLLING);
+  args->sw_if_index = sw->sw_if_index;
+  vnet_hw_if_set_input_node (vnm, ppif->hw_if_index,
+                            mrvl_pp2_input_node.index);
+  /* FIXME: only one RX queue ? */
+  ppif->inqs[0].queue_index = vnet_hw_if_register_rx_queue (
+    vnm, ppif->hw_if_index, 0, VNET_HW_IF_RXQ_THREAD_ANY);
+
+  vnet_hw_if_set_rx_queue_mode (vnm, ppif->inqs[0].queue_index,
+                               VNET_HW_IF_RX_MODE_POLLING);
+  vnet_hw_if_update_runtime_data (vnm, ppif->hw_if_index);
   vnet_hw_interface_set_flags (vnm, ppif->hw_if_index,
                               VNET_HW_INTERFACE_FLAG_LINK_UP);
   goto done;
@@ -378,7 +373,6 @@ static char *mrvl_pp2_tx_func_error_strings[] = {
 #undef _
 };
 
-/* *INDENT-OFF* */
 VNET_DEVICE_CLASS (mrvl_pp2_device_class,) =
 {
   .name = "Marvell PPv2 interface",
@@ -391,7 +385,6 @@ VNET_DEVICE_CLASS (mrvl_pp2_device_class,) =
   .clear_counters = mrvl_pp2_clear_interface_counters,
   .rx_redirect_to_node = mrvl_pp2_set_interface_next_node,
 };
-/* *INDENT-ON* */
 
 static clib_error_t *
 mrvl_pp2_init (vlib_main_t * vm)