aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
authorVladimir Ratnikov <vratnikov@netgate.com>2020-11-11 08:00:48 -0500
committerMatthew Smith <mgsmith@netgate.com>2021-01-11 20:40:23 +0000
commit9822729742168c877a301ff50a3a1067b90a89ad (patch)
tree6060722a9b4f72282e78e5076f759a42c9e1d3d7 /src/vlib
parentdcacdc4fd90d6cc71aaafccbca3ea91c7481ddbd (diff)
dpdk: allow configure individual VMBUS devices
now startup.conf supports confuguration for VMBUS devices as for PCI devices for whitelisting/blacklisting dpdk { dev fa5a6e7a-cf3a-4b98-9569-addb479b84bc } with sub-configuration as for PCI devices dpdk { blacklist fa5a6e7a-cf3a-4b98-9569-addb479b84bc } where fa5a6e7a-cf3a-4b98-9569-addb479b84bc - example of UUID struct vlib_vmbus_addr_t changed to union with UUID described fields Added device_config_index_by_vmbus_addr blacklist_by_vmbus_addr to enumerate available device configs hash_key is as_u32[0] field(last 4 bytes of UUID) Lost of precision against full UUID, but 2^32 is enough to handle all the devices available Added is_blacklisted check while creating vnet devices in order to supress creation of dev if it's blacklisted Type: feature Signed-off-by: Vladimir Ratnikov <vratnikov@netgate.com> Change-Id: Id82611e54fed082190e488c7e5fbe14ecbe5b2ab
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/linux/vmbus.c22
-rw-r--r--src/vlib/vmbus/vmbus.c15
-rw-r--r--src/vlib/vmbus/vmbus.h6
3 files changed, 33 insertions, 10 deletions
diff --git a/src/vlib/linux/vmbus.c b/src/vlib/linux/vmbus.c
index 2fc438b4778..d50b539910b 100644
--- a/src/vlib/linux/vmbus.c
+++ b/src/vlib/linux/vmbus.c
@@ -118,8 +118,8 @@ linux_vmbus_main_t linux_vmbus_main;
* "f2c086b2-ff2e-11e8-88de-7bad0a57de05" and convert
* it to u8[16]
*/
-static uword
-unformat_vlib_vmbus_addr (unformat_input_t * input, va_list * args)
+uword
+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;
@@ -137,8 +137,8 @@ unformat_vlib_vmbus_addr (unformat_input_t * input, va_list * args)
}
/* Convert bus address to standard UUID string */
-static u8 *
-format_vlib_vmbus_addr (u8 * s, va_list * va)
+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];
@@ -297,15 +297,21 @@ vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr)
vec_reset_length (s);
s = format (s, "%s/%s/new_id%c", sysfs_vmbus_drv_path, uio_drv_name, 0);
error = clib_sysfs_write ((char *) s, "%s", netvsc_uuid);
-
+ /* If device already exists, we can bind/unbind/override driver */
if (error)
{
- close (fd);
- goto done;
+ if (error->code == EEXIST)
+ {
+ clib_error_free (error);
+ }
+ else
+ {
+ close (fd);
+ goto done;
+ }
}
uio_new_id_needed = 0;
-
}
error = vlib_vmbus_raise_lower (fd, ifname);
diff --git a/src/vlib/vmbus/vmbus.c b/src/vlib/vmbus/vmbus.c
index eadf5f176d6..045e2dd9503 100644
--- a/src/vlib/vmbus/vmbus.c
+++ b/src/vlib/vmbus/vmbus.c
@@ -25,11 +25,24 @@
#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 ()
+vlib_vmbus_addr_t *__clib_weak
+vlib_vmbus_get_all_dev_addrs ()
{
return NULL;
}
+u8 *__clib_weak
+format_vlib_vmbus_addr (u8 *s, va_list *va)
+{
+ return 0;
+}
+
+uword __clib_weak
+unformat_vlib_vmbus_addr (unformat_input_t *input, va_list *args)
+{
+ return 0;
+}
+
clib_error_t *
vmbus_bus_init (vlib_main_t * vm)
{
diff --git a/src/vlib/vmbus/vmbus.h b/src/vlib/vmbus/vmbus.h
index 0927b8990d6..7df62ab4d16 100644
--- a/src/vlib/vmbus/vmbus.h
+++ b/src/vlib/vmbus/vmbus.h
@@ -21,10 +21,12 @@
#include <vlib/vlib.h>
-typedef struct
+typedef union
{
u8 guid[16];
+ u32 as_u32[4];
} vlib_vmbus_addr_t;
+
typedef u32 vlib_vmbus_dev_handle_t;
vlib_vmbus_addr_t *vlib_vmbus_get_all_dev_addrs ();
@@ -33,6 +35,8 @@ 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);
+format_function_t format_vlib_vmbus_addr;
+unformat_function_t unformat_vlib_vmbus_addr;
clib_error_t *vlib_vmbus_bind_to_uio (vlib_vmbus_addr_t * addr);
#endif /* included_vlib_vmbus_h */