From ed04407829728c5d258b6600155edabd5198d971 Mon Sep 17 00:00:00 2001 From: Vladimir Ratnikov Date: Fri, 14 Aug 2020 08:25:30 -0400 Subject: dpdk: fix blacklists When we have both format blacklisted devices like: blacklist 1234:5678 blacklist 1234:56:78.0 unformat with fmt=%x:%x matches for both strings and the rest 78.0 substring is kept in input and it can't be parsed for init args This patch checks first if device format matches PCI address and just then if it matches Vendor and Product Type: fix Change-Id: If111762c0e0a424b052e4f6dc0f67731bf89dc2a Signed-off-by: Vladimir Ratnikov --- src/plugins/dpdk/device/dpdk_priv.h | 1 - src/plugins/dpdk/device/init.c | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src/plugins/dpdk/device') diff --git a/src/plugins/dpdk/device/dpdk_priv.h b/src/plugins/dpdk/device/dpdk_priv.h index a86a1aba7ec..64cd10dc23d 100644 --- a/src/plugins/dpdk/device/dpdk_priv.h +++ b/src/plugins/dpdk/device/dpdk_priv.h @@ -37,7 +37,6 @@ _(coremask, c) \ _(nchannels, n) \ #define foreach_eal_single_hyphen_arg \ -_(blacklist, b) \ _(mem-alloc-request, m) \ _(force-ranks, r) diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index f1d1b008279..9d4aeed6924 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -1168,7 +1168,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) u8 file_prefix = 0; u8 *socket_mem = 0; u8 *huge_dir_path = 0; - u32 vendor, device; + u32 vendor, device, domain, bus, func; huge_dir_path = format (0, "%s/hugepages%c", vlib_unix_get_runtime_dir (), 0); @@ -1241,6 +1241,15 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) tmp = format (0, "--no-pci%c", 0); vec_add1 (conf->eal_init_args, tmp); } + else + if (unformat + (input, "blacklist %x:%x:%x.%x", &domain, &bus, &device, &func)) + { + tmp = + format (0, "-b %04x:%02x:%02x.%x%c", domain, bus, device, func, + 0); + vec_add1 (conf->eal_init_args, tmp); + } else if (unformat (input, "blacklist %x:%x", &vendor, &device)) { u32 blacklist_entry; -- cgit 1.2.3-korg