From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58]) by dpdk.org (Postfix) with ESMTP id 7640D4A6E for ; Mon, 17 Nov 2014 15:00:47 +0100 (CET) Received: from hmsreliant.think-freely.org ([2001:470:8:a08:7aac:c0ff:fec2:933b] helo=localhost) by smtp.tuxdriver.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1XqN11-0000Z2-Ca; Mon, 17 Nov 2014 09:10:59 -0500 Date: Mon, 17 Nov 2014 09:10:50 -0500 From: Neil Horman To: =?iso-8859-1?Q?Nicol=E1s?= Pernas Maradei Message-ID: <20141117141050.GD17886@hmsreliant.think-freely.org> References: <1416173215-27533-1-git-send-email-nicolas.pernas.maradei@emutex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1416173215-27533-1-git-send-email-nicolas.pernas.maradei@emutex.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Score: -2.9 (--) X-Spam-Status: No Cc: dev@dpdk.org, =?iso-8859-1?Q?Nicol=E1s?= Pernas Maradei Subject: Re: [dpdk-dev] [PATCH] eal: allow virtual devices to be white/black listed X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Nov 2014 14:00:47 -0000 On Sun, Nov 16, 2014 at 09:26:55PM +0000, Nicolás Pernas Maradei wrote: > From: Nicolás Pernas Maradei > > Virtual and physical devices are now treated the same in terms of > white/black listing. Virtual devices can be defined using --vdev as > before and also whitelisted (using -w vdev_name) or blacklisted (using -b > vdev_name). This allows the user to have only a virtual device (port) in > use. > > Signed-off-by: Nicolás Pernas Maradei > --- > app/test-pmd/cmdline.c | 5 +- > app/test/commands.c | 4 +- > app/test/test_devargs.c | 69 +++++----- > app/test/test_pci.c | 3 +- > lib/librte_eal/bsdapp/eal/eal.c | 8 +- > lib/librte_eal/bsdapp/eal/eal_pci.c | 2 +- > lib/librte_eal/common/eal_common_dev.c | 24 ++-- > lib/librte_eal/common/eal_common_devargs.c | 196 ++++++++++++++++++++-------- > lib/librte_eal/common/eal_common_options.c | 11 +- > lib/librte_eal/common/eal_common_pci.c | 11 +- > lib/librte_eal/common/include/rte_devargs.h | 124 +++++++++++++----- > lib/librte_eal/linuxapp/eal/eal.c | 8 +- > lib/librte_eal/linuxapp/eal/eal_pci.c | 2 +- > 13 files changed, 319 insertions(+), 148 deletions(-) > > diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c > index 4c3fc76..f6ba4fe 100644 > --- a/app/test-pmd/cmdline.c > +++ b/app/test-pmd/cmdline.c > @@ -6844,6 +6844,8 @@ static void cmd_dump_parsed(void *parsed_result, > rte_mempool_list_dump(stdout); > else if (!strcmp(res->dump, "dump_devargs")) > rte_eal_devargs_dump(stdout); > + else if (!strcmp(res->dump, "dump_vdevargs")) > + rte_eal_vdevargs_dump(stdout); > } > > cmdline_parse_token_string_t cmd_dump_dump = > @@ -6854,7 +6856,8 @@ cmdline_parse_token_string_t cmd_dump_dump = > "dump_struct_sizes#" > "dump_ring#" > "dump_mempool#" > - "dump_devargs"); > + "dump_devargs#" > + "dump_vdevargs"); > > cmdline_parse_inst_t cmd_dump = { > .f = cmd_dump_parsed, /* function to call */ > diff --git a/app/test/commands.c b/app/test/commands.c > index 92a17ed..6799d63 100644 > --- a/app/test/commands.c > +++ b/app/test/commands.c > @@ -161,13 +161,15 @@ static void cmd_dump_parsed(void *parsed_result, > rte_mempool_list_dump(stdout); > else if (!strcmp(res->dump, "dump_devargs")) > rte_eal_devargs_dump(stdout); > + else if (!strcmp(res->dump, "dump_vdevargs")) > + rte_eal_vdevargs_dump(stdout); > } > > cmdline_parse_token_string_t cmd_dump_dump = > TOKEN_STRING_INITIALIZER(struct cmd_dump_result, dump, > "dump_physmem#dump_memzone#dump_log_history#" > "dump_struct_sizes#dump_ring#dump_mempool#" > - "dump_devargs"); > + "dump_devargs#dump_vdevargs"); > > cmdline_parse_inst_t cmd_dump = { > .f = cmd_dump_parsed, /* function to call */ > diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c > index f0acf8e..8fb93df 100644 > --- a/app/test/test_devargs.c > +++ b/app/test/test_devargs.c > @@ -52,52 +52,60 @@ static void free_devargs_list(void) > } > } > > +/* clear vdevargs list that was modified by the test */ > +static void free_vdevargs_list(void) > +{ > + struct rte_vdevargs *vdevargs; > + > + while (!TAILQ_EMPTY(&vdevargs_list)) { > + vdevargs = TAILQ_FIRST(&vdevargs_list); > + TAILQ_REMOVE(&vdevargs_list, vdevargs, next); > + free(vdevargs); > + } > +} > + > static int > test_devargs(void) > { > struct rte_devargs_list save_devargs_list; > + struct rte_vdevargs_list save_vdevargs_list; > struct rte_devargs *devargs; > + struct rte_vdevargs *vdevargs; > > /* save the real devargs_list, it is restored at the end of the test */ > save_devargs_list = devargs_list; > + save_vdevargs_list = vdevargs_list; > TAILQ_INIT(&devargs_list); > + TAILQ_INIT(&vdevargs_list); > > /* test valid cases */ > - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "08:00.1") < 0) > - goto fail; > - if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "0000:5:00.0") < 0) > - goto fail; > - if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "04:00.0,arg=val") < 0) > - goto fail; > - if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "0000:01:00.1") < 0) > + if (rte_eal_devargs_add(RTE_DEV_WHITELISTED, "08:00.1") < 0) > goto fail; > - if (rte_eal_devargs_type_count(RTE_DEVTYPE_WHITELISTED_PCI) != 2) > + if (rte_eal_devargs_add(RTE_DEV_WHITELISTED, "0000:5:00.0") < 0) > goto fail; > - if (rte_eal_devargs_type_count(RTE_DEVTYPE_BLACKLISTED_PCI) != 2) > + if (rte_eal_devargs_add(RTE_DEV_BLACKLISTED, "04:00.0") < 0) > goto fail; > - if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 0) > + if (rte_eal_devargs_add(RTE_DEV_BLACKLISTED, "0000:01:00.1") < 0) > goto fail; What are the above pci bus/device/function tuples? Neil