vlib: introduce vlib_get_main_by_index(), vlib_get_n_threads()
[vpp.git] / src / plugins / memif / device.c
index 28bf825..101c3f7 100644 (file)
@@ -413,7 +413,7 @@ VNET_DEVICE_CLASS_TX_FN (memif_device_class) (vlib_main_t * vm,
                                                   thread_index);
   u8 tx_queues = vec_len (mif->tx_queues);
 
-  if (tx_queues < vec_len (vlib_mains))
+  if (tx_queues < vlib_get_n_threads ())
     {
       ASSERT (tx_queues > 0);
       mq = vec_elt_at_index (mif->tx_queues, thread_index % tx_queues);
@@ -459,14 +459,14 @@ memif_clear_hw_interface_counters (u32 instance)
 
 static clib_error_t *
 memif_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
-                               vnet_hw_interface_rx_mode mode)
+                               vnet_hw_if_rx_mode mode)
 {
   memif_main_t *mm = &memif_main;
   vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
   memif_if_t *mif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
   memif_queue_t *mq = vec_elt_at_index (mif->rx_queues, qid);
 
-  if (mode == VNET_HW_INTERFACE_RX_MODE_POLLING)
+  if (mode == VNET_HW_IF_RX_MODE_POLLING)
     mq->ring->flags |= MEMIF_RING_FLAG_MASK_INT;
   else
     mq->ring->flags &= ~MEMIF_RING_FLAG_MASK_INT;
@@ -474,22 +474,6 @@ memif_interface_rx_mode_change (vnet_main_t * vnm, u32 hw_if_index, u32 qid,
   return 0;
 }
 
-static clib_error_t *
-memif_interface_admin_up_down (vnet_main_t * vnm, u32 hw_if_index, u32 flags)
-{
-  memif_main_t *mm = &memif_main;
-  vnet_hw_interface_t *hw = vnet_get_hw_interface (vnm, hw_if_index);
-  memif_if_t *mif = pool_elt_at_index (mm->interfaces, hw->dev_instance);
-  static clib_error_t *error = 0;
-
-  if (flags & VNET_SW_INTERFACE_FLAG_ADMIN_UP)
-    mif->flags |= MEMIF_IF_FLAG_ADMIN_UP;
-  else
-    mif->flags &= ~MEMIF_IF_FLAG_ADMIN_UP;
-
-  return error;
-}
-
 static clib_error_t *
 memif_subif_add_del_function (vnet_main_t * vnm,
                              u32 hw_if_index,