Add APIs to access dpdk information 55/755/3
authorTodd Foggoa (tfoggoa) <tfoggoa@cisco.com>
Thu, 17 Mar 2016 20:54:30 +0000 (16:54 -0400)
committerDave Barach <openvpp@barachs.net>
Mon, 25 Apr 2016 13:25:22 +0000 (13:25 +0000)
- Add an API to get the number of DPDK mbufs
- Add an API to detemrine if the io thread has been released
- Add an API to get the DPKD pmd type
- Add an API to get the cpu socket of a device

Change-Id: I926401891fb6053c676125c9d0621cc9ed1f80bb
Signed-off-by: Todd Foggoa (tfoggoa) <tfoggoa@cisco.com>
vnet/vnet/devices/dpdk/device.c
vnet/vnet/devices/dpdk/dpdk.h

index 9b742f0..011ec75 100644 (file)
@@ -1259,3 +1259,57 @@ dpdk_get_hw_interface_stats (u32 hw_if_index, struct rte_eth_stats* dest)
   clib_memcpy(dest, &xd->stats, sizeof(xd->stats));
   return (0);
 }
+
+/*
+ * Return the number of dpdk mbufs
+ */
+u32 dpdk_num_mbufs (void)
+{
+  dpdk_main_t * dm = &dpdk_main;
+
+  return dm->num_mbufs;
+}
+
+/*
+ * Return the io_thread_release
+ */
+int dpdk_io_thread_release (void)
+{
+  dpdk_main_t * dm = &dpdk_main;
+
+  return dm->io_thread_release;
+}
+
+/*
+ * Return the pmd type for a given hardware interface
+ */
+dpdk_pmd_t dpdk_get_pmd_type (vnet_hw_interface_t *hi)
+{
+  dpdk_main_t   * dm = &dpdk_main;
+  dpdk_device_t * xd;
+
+  assert (hi);
+
+  xd = vec_elt_at_index (dm->devices, hi->dev_instance);
+
+  assert (xd);
+
+  return xd->pmd;
+}
+
+/*
+ * Return the cpu socket for a given hardware interface
+ */
+i8 dpdk_get_cpu_socket (vnet_hw_interface_t *hi)
+{
+  dpdk_main_t   * dm = &dpdk_main;
+  dpdk_device_t * xd;
+
+  assert (hi);
+
+  xd = vec_elt_at_index(dm->devices, hi->dev_instance);
+
+  assert (xd);
+
+  return xd->cpu_socket;
+}
index af12d52..3761a7f 100644 (file)
@@ -565,6 +565,14 @@ int dpdk_vhost_user_dump_ifs (vnet_main_t * vnm, vlib_main_t * vm,
 
 u32 dpdk_get_admin_up_down_in_progress (void);
 
+u32 dpdk_num_mbufs (void);
+
+int dpdk_io_thread_release (void);
+
+dpdk_pmd_t dpdk_get_pmd_type (vnet_hw_interface_t *hi);
+
+i8 dpdk_get_cpu_socket (vnet_hw_interface_t *hi);
+
 uword
 dpdk_input_rss (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * f);