vlib: support Hyper-v/Azure VMBus
This patch adds support for VMBus to the VPP infrastructure. Since the only device that matters is the netvsc Poll Mode Driver in DPDK, the infrastructure is much simpler than PCI. Change-Id: Ie96c897ad9c426716c2398e4528688ce2217419b Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
committed by
Damjan Marion
parent
b0b9dadc5c
commit
6fbef23228
@@ -66,7 +66,7 @@ DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
|
||||
DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev
|
||||
DEB_DEPENDS += python-all python-dev python-virtualenv python-pip libffi6 check
|
||||
DEB_DEPENDS += libboost-all-dev libffi-dev python-ply libmbedtls-dev
|
||||
DEB_DEPENDS += cmake ninja-build
|
||||
DEB_DEPENDS += cmake ninja-build uuid-dev
|
||||
ifeq ($(OS_VERSION_ID),14.04)
|
||||
DEB_DEPENDS += openjdk-8-jdk-headless
|
||||
DEB_DEPENDS += libssl-dev
|
||||
@@ -89,6 +89,7 @@ RPM_DEPENDS += check check-devel
|
||||
RPM_DEPENDS += boost boost-devel
|
||||
RPM_DEPENDS += selinux-policy selinux-policy-devel
|
||||
RPM_DEPENDS += ninja-build
|
||||
RPM_DEPENDS += libuuid-devel
|
||||
|
||||
ifeq ($(OS_ID),fedora)
|
||||
RPM_DEPENDS += dnf-utils
|
||||
@@ -119,7 +120,7 @@ RPM_SUSE_BUILDTOOLS_DEPS = autoconf automake ccache check-devel chrpath
|
||||
RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python-ply
|
||||
|
||||
RPM_SUSE_DEVEL_DEPS = glibc-devel-static java-1_8_0-openjdk-devel libnuma-devel
|
||||
RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel mbedtls-devel
|
||||
RPM_SUSE_DEVEL_DEPS += libopenssl-devel openssl-devel mbedtls-devel libuuid-devel
|
||||
|
||||
RPM_SUSE_PYTHON_DEPS = python-devel python3-devel python-pip python3-pip
|
||||
RPM_SUSE_PYTHON_DEPS += python-rpm-macros python3-rpm-macros
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <vnet/ethernet/ethernet.h>
|
||||
#include <dpdk/device/dpdk.h>
|
||||
#include <vlib/pci/pci.h>
|
||||
#include <vlib/vmbus/vmbus.h>
|
||||
|
||||
#include <rte_ring.h>
|
||||
|
||||
@@ -973,6 +974,27 @@ dpdk_bind_devices_to_uio (dpdk_config_main_t * conf)
|
||||
vlib_pci_free_device_info (d);
|
||||
}
|
||||
|
||||
static void
|
||||
dpdk_bind_vmbus_devices_to_uio (dpdk_config_main_t * conf)
|
||||
{
|
||||
clib_error_t *error;
|
||||
vlib_vmbus_addr_t *addrs, *addr = 0;
|
||||
|
||||
addrs = vlib_vmbus_get_all_dev_addrs ();
|
||||
|
||||
/* *INDENT-OFF* */
|
||||
vec_foreach (addr, addrs)
|
||||
{
|
||||
error = vlib_vmbus_bind_to_uio (addr);
|
||||
|
||||
if (error)
|
||||
{
|
||||
clib_error_report (error);
|
||||
}
|
||||
}
|
||||
/* *INDENT-ON* */
|
||||
}
|
||||
|
||||
static clib_error_t *
|
||||
dpdk_device_config (dpdk_config_main_t * conf, vlib_pci_addr_t pci_addr,
|
||||
unformat_input_t * input, u8 is_default)
|
||||
@@ -1121,6 +1143,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
int ret, i;
|
||||
int num_whitelisted = 0;
|
||||
u8 no_pci = 0;
|
||||
u8 no_vmbus = 0;
|
||||
u8 no_huge = 0;
|
||||
u8 huge_dir = 0;
|
||||
u8 file_prefix = 0;
|
||||
@@ -1214,6 +1237,12 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
vec_add1 (conf->blacklist_by_pci_vendor_and_device,
|
||||
blacklist_entry);
|
||||
}
|
||||
else if (unformat (input, "no-vmbus"))
|
||||
{
|
||||
no_vmbus = 1;
|
||||
tmp = format (0, "--no-vmbus%c", 0);
|
||||
vec_add1 (conf->eal_init_args, tmp);
|
||||
}
|
||||
|
||||
#define _(a) \
|
||||
else if (unformat(input, #a)) \
|
||||
@@ -1417,6 +1446,9 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
|
||||
if (no_pci == 0 && geteuid () == 0)
|
||||
dpdk_bind_devices_to_uio (conf);
|
||||
|
||||
if (no_vmbus == 0 && geteuid () == 0)
|
||||
dpdk_bind_vmbus_devices_to_uio (conf);
|
||||
|
||||
#define _(x) \
|
||||
if (devconf->x == 0 && conf->default_devconf.x > 0) \
|
||||
devconf->x = conf->default_devconf.x ;
|
||||
|
||||
+20
-1
@@ -25,6 +25,22 @@ install(
|
||||
COMPONENT vpp-dev
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Find lib and include files
|
||||
##############################################################################
|
||||
message(STATUS "Looking for libuuid")
|
||||
find_path(UUID_INCLUDE_DIR NAMES uuid/uuid.h)
|
||||
find_library(UUID_LIB NAMES uuid)
|
||||
|
||||
if(UUID_INCLUDE_DIR AND UUID_LIB)
|
||||
include_directories(${UUID_INCLUDE_DIR})
|
||||
set(VMBUS_SOURCE linux/vmbus.c)
|
||||
set(VMBUS_LIBS uuid)
|
||||
message(STATUS "Found uuid in ${UUID_INCLUDE_DIR}")
|
||||
else()
|
||||
message(WARNING "-- libuuid not found - vmbus support disabled")
|
||||
endif()
|
||||
|
||||
##############################################################################
|
||||
# vlib shared library
|
||||
##############################################################################
|
||||
@@ -56,6 +72,8 @@ add_vpp_library(vlib
|
||||
unix/main.c
|
||||
unix/plugin.c
|
||||
unix/util.c
|
||||
vmbus/vmbus.c
|
||||
${VMBUS_SOURCE}
|
||||
|
||||
INSTALL_HEADERS
|
||||
buffer_funcs.h
|
||||
@@ -89,6 +107,7 @@ add_vpp_library(vlib
|
||||
unix/plugin.h
|
||||
unix/unix.h
|
||||
vlib.h
|
||||
vmbus/vmbus.h
|
||||
|
||||
LINK_LIBRARIES vppinfra svm ${CMAKE_DL_LIBS}
|
||||
LINK_LIBRARIES vppinfra svm ${VMBUS_LIBS} ${CMAKE_DL_LIBS}
|
||||
)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Microsoft Corporation.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
#include <vlib/vmbus/vmbus.h>
|
||||
#include <vlib/unix/unix.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <net/if.h>
|
||||
|
||||
/* this is a stub replaced by the Linux specfic version */
|
||||
vlib_vmbus_addr_t * __attribute__ ((weak)) vlib_vmbus_get_all_dev_addrs ()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
clib_error_t *
|
||||
vmbus_bus_init (vlib_main_t * vm)
|
||||
{
|
||||
return vlib_call_init_function (vm, vmbus_bus_init);
|
||||
}
|
||||
|
||||
VLIB_INIT_FUNCTION (vmbus_bus_init);
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
* Local Variables:
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Microsoft Corporation.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at:
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* vmbus.h: VMBus definitions.
|
||||
*/
|
||||
|
||||
#ifndef included_vlib_vmbus_h
|
||||
#define included_vlib_vmbus_h
|
||||
|
||||
#include <vlib/vlib.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 guid[16];
|
||||
} vlib_vmbus_addr_t;
|
||||
typedef u32 vlib_vmbus_dev_handle_t;
|
||||
|
||||
vlib_vmbus_addr_t *vlib_vmbus_get_all_dev_addrs ();
|
||||
vlib_vmbus_addr_t *vlib_vmbus_get_addr (vlib_vmbus_dev_handle_t h);
|
||||
uword vlib_vmbus_get_private_data (vlib_vmbus_dev_handle_t h);
|
||||
void vlib_vmbus_set_private_data (vlib_vmbus_dev_handle_t h,
|
||||
uword private_data);
|
||||
|
||||
clib_error_t *vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr);
|
||||
#endif /* included_vlib_vmbus_h */
|
||||
|
||||
/*
|
||||
* fd.io coding-style-patch-verification: ON
|
||||
*
|
||||
* Local Variables:
|
||||
* eval: (c-set-style "gnu")
|
||||
* End:
|
||||
*/
|
||||
Reference in New Issue
Block a user