From: Todd Foggoa (tfoggoa) Date: Thu, 17 Mar 2016 20:54:30 +0000 (-0400) Subject: Add APIs to access dpdk information X-Git-Tag: v16.06-rc1~121 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=a30d40d33c308c254414835e116db1d72c204b50;p=vpp.git Add APIs to access dpdk information - 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) --- diff --git a/vnet/vnet/devices/dpdk/device.c b/vnet/vnet/devices/dpdk/device.c index 9b742f0eef0..011ec75e18b 100644 --- a/vnet/vnet/devices/dpdk/device.c +++ b/vnet/vnet/devices/dpdk/device.c @@ -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; +} diff --git a/vnet/vnet/devices/dpdk/dpdk.h b/vnet/vnet/devices/dpdk/dpdk.h index af12d5292fd..3761a7f71a2 100644 --- a/vnet/vnet/devices/dpdk/dpdk.h +++ b/vnet/vnet/devices/dpdk/dpdk.h @@ -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);