vlib: remove dependency on libuuid
Type: improvement Change-Id: I4e2b2e4f227dfcb3df36166db13c8aa5c0b603f5 Signed-off-by: Damjan Marion <damarion@cisco.com>
This commit is contained in:
Damjan Marion
committed by
Florin Coras
parent
f566524a21
commit
3706636ca0
5
Makefile
5
Makefile
@ -68,7 +68,7 @@ DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
|
||||
DEB_DEPENDS += gcovr lcov chrpath autoconf libnuma-dev
|
||||
DEB_DEPENDS += python3-all python3-setuptools check
|
||||
DEB_DEPENDS += libffi-dev python3-ply
|
||||
DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
|
||||
DEB_DEPENDS += cmake ninja-build python3-jsonschema python3-yaml
|
||||
DEB_DEPENDS += python3-venv # ensurepip
|
||||
DEB_DEPENDS += python3-dev python3-pip
|
||||
DEB_DEPENDS += libnl-3-dev libnl-route-3-dev libmnl-dev
|
||||
@ -118,7 +118,6 @@ RPM_DEPENDS += numactl-devel
|
||||
RPM_DEPENDS += check check-devel
|
||||
RPM_DEPENDS += selinux-policy selinux-policy-devel
|
||||
RPM_DEPENDS += ninja-build
|
||||
RPM_DEPENDS += libuuid-devel
|
||||
RPM_DEPENDS += ccache
|
||||
RPM_DEPENDS += xmlto
|
||||
RPM_DEPENDS += elfutils-libelf-devel libpcap-devel
|
||||
@ -176,7 +175,7 @@ RPM_SUSE_BUILDTOOLS_DEPS = autoconf automake ccache check-devel chrpath
|
||||
RPM_SUSE_BUILDTOOLS_DEPS += clang cmake indent libtool make ninja python3-ply
|
||||
|
||||
RPM_SUSE_DEVEL_DEPS = glibc-devel-static libnuma-devel libelf-devel
|
||||
RPM_SUSE_DEVEL_DEPS += libopenssl-devel libuuid-devel lsb-release
|
||||
RPM_SUSE_DEVEL_DEPS += libopenssl-devel lsb-release
|
||||
RPM_SUSE_DEVEL_DEPS += libpcap-devel llvm-devel
|
||||
RPM_SUSE_DEVEL_DEPS += curl libstdc++-devel bison gcc-c++ zlib-devel
|
||||
|
||||
|
@ -45,22 +45,6 @@ install(
|
||||
COMPONENT vpp-dev
|
||||
)
|
||||
|
||||
##############################################################################
|
||||
# Find lib and include files
|
||||
##############################################################################
|
||||
message(STATUS "Looking for libuuid")
|
||||
vpp_find_path(UUID_INCLUDE_DIR NAMES uuid/uuid.h)
|
||||
vpp_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
|
||||
##############################################################################
|
||||
@ -77,6 +61,7 @@ add_vpp_library(vlib
|
||||
init.c
|
||||
linux/pci.c
|
||||
linux/vfio.c
|
||||
linux/vmbus.c
|
||||
log.c
|
||||
main.c
|
||||
node.c
|
||||
@ -104,7 +89,6 @@ add_vpp_library(vlib
|
||||
unix/plugin.c
|
||||
unix/util.c
|
||||
vmbus/vmbus.c
|
||||
${VMBUS_SOURCE}
|
||||
dma/dma.c
|
||||
dma/cli.c
|
||||
|
||||
@ -154,7 +138,7 @@ add_vpp_library(vlib
|
||||
API_FILES
|
||||
pci/pci_types.api
|
||||
|
||||
LINK_LIBRARIES vppinfra svm ${VMBUS_LIBS} ${CMAKE_DL_LIBS}
|
||||
LINK_LIBRARIES vppinfra svm ${CMAKE_DL_LIBS}
|
||||
|
||||
DEPENDS api_headers
|
||||
)
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include <linux/ethtool.h>
|
||||
#include <linux/sockios.h>
|
||||
|
||||
#include <uuid/uuid.h>
|
||||
|
||||
static const char sysfs_vmbus_dev_path[] = "/sys/bus/vmbus/devices";
|
||||
static const char sysfs_vmbus_drv_path[] = "/sys/bus/vmbus/drivers";
|
||||
static const char sysfs_class_net_path[] = "/sys/class/net";
|
||||
@ -123,16 +121,39 @@ unformat_vlib_vmbus_addr (unformat_input_t *input, va_list *args)
|
||||
{
|
||||
vlib_vmbus_addr_t *addr = va_arg (*args, vlib_vmbus_addr_t *);
|
||||
uword ret = 0;
|
||||
u8 *s;
|
||||
u8 *s = 0;
|
||||
|
||||
if (!unformat (input, "%s", &s))
|
||||
if (!unformat (input, "%U", unformat_token, "a-zA-Z0-9-", &s))
|
||||
return 0;
|
||||
|
||||
if (uuid_parse ((char *) s, addr->guid) == 0)
|
||||
ret = 1;
|
||||
if (vec_len (s) != 36)
|
||||
goto fail;
|
||||
|
||||
if (s[8] != '-' || s[13] != '-' || s[18] != '-' || s[23] != '-')
|
||||
goto fail;
|
||||
|
||||
clib_memmove (s + 8, s + 9, 4);
|
||||
clib_memmove (s + 12, s + 14, 4);
|
||||
clib_memmove (s + 16, s + 19, 4);
|
||||
clib_memmove (s + 20, s + 24, 12);
|
||||
|
||||
for (int i = 0; i < 32; i++)
|
||||
if (s[i] >= '0' && s[i] <= '9')
|
||||
s[i] -= '0';
|
||||
else if (s[i] >= 'A' && s[i] <= 'F')
|
||||
s[i] -= 'A' - 10;
|
||||
else if (s[i] >= 'a' && s[i] <= 'f')
|
||||
s[i] -= 'a' - 10;
|
||||
else
|
||||
goto fail;
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
addr->guid[i] = s[2 * i] * 16 + s[2 * i + 1];
|
||||
|
||||
ret = 1;
|
||||
|
||||
fail:
|
||||
vec_free (s);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -141,10 +162,24 @@ u8 *
|
||||
format_vlib_vmbus_addr (u8 *s, va_list *va)
|
||||
{
|
||||
vlib_vmbus_addr_t *addr = va_arg (*va, vlib_vmbus_addr_t *);
|
||||
char tmp[40];
|
||||
u8 *bytes = addr->guid;
|
||||
|
||||
uuid_unparse (addr->guid, tmp);
|
||||
return format (s, "%s", tmp);
|
||||
for (int i = 0; i < 4; i++)
|
||||
s = format (s, "%02X", bytes++[0]);
|
||||
vec_add1 (s, '-');
|
||||
for (int i = 0; i < 2; i++)
|
||||
s = format (s, "%02X", bytes++[0]);
|
||||
vec_add1 (s, '-');
|
||||
for (int i = 0; i < 2; i++)
|
||||
s = format (s, "%02X", bytes++[0]);
|
||||
vec_add1 (s, '-');
|
||||
for (int i = 0; i < 2; i++)
|
||||
s = format (s, "%02X", bytes++[0]);
|
||||
vec_add1 (s, '-');
|
||||
for (int i = 0; i < 6; i++)
|
||||
s = format (s, "%02X", bytes++[0]);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
/* workaround for mlx bug, bring lower device up before unbind */
|
||||
@ -383,7 +418,13 @@ vmbus_addr_cmp (void *v1, void *v2)
|
||||
vlib_vmbus_addr_t *a1 = v1;
|
||||
vlib_vmbus_addr_t *a2 = v2;
|
||||
|
||||
return uuid_compare (a1->guid, a2->guid);
|
||||
for (int i = 0; i < ARRAY_LEN (a1->guid); i++)
|
||||
if (a1->guid[i] > a2->guid[i])
|
||||
return 1;
|
||||
else if (a1->guid[i] < a2->guid[i])
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
vlib_vmbus_addr_t *
|
||||
|
Reference in New Issue
Block a user