DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier MATZ <olivier.matz@6wind.com>
To: Chas Williams <3chas3@gmail.com>, dev@dpdk.org
Subject: Re: [dpdk-dev] [PATCH v2] devargs: add blacklisting by linux interface name
Date: Tue, 13 Oct 2015 14:49:31 +0200	[thread overview]
Message-ID: <561CFDDB.90601@6wind.com> (raw)
In-Reply-To: <1444058768-9208-1-git-send-email-3chas3@gmail.com>

Hi Chas,

On 10/05/2015 05:26 PM, Chas Williams wrote:
> If a system is using deterministic interface names, it may be easier in
> some cases to use the interface name to blacklist an interface.
> 
> Signed-off-by: Chas Williams <3chas3@gmail.com>
> ---
>  app/test/test_devargs.c                     |  2 ++
>  lib/librte_eal/common/eal_common_devargs.c  |  9 +++++++--
>  lib/librte_eal/common/eal_common_options.c  |  2 +-
>  lib/librte_eal/common/eal_common_pci.c      | 10 ++++++++--
>  lib/librte_eal/common/include/rte_devargs.h |  2 ++
>  lib/librte_eal/common/include/rte_pci.h     |  1 +
>  lib/librte_eal/linuxapp/eal/eal_pci.c       | 15 +++++++++++++++
>  7 files changed, 36 insertions(+), 5 deletions(-)
> 
> diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
> index f7fc59c..27855ff 100644

> 
> [...]
> 

> @@ -352,6 +354,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,
>  		return -1;
>  	}
>  
> +	/* get network interface name */
> +	snprintf(filename, sizeof(filename), "%s/net", dirname);
> +	dir = opendir(filename);
> +	if (dir) {
> +		while ((e = readdir(dir)) != NULL) {
> +			if (e->d_name[0] == '.')
> +				continue;
> +
> +			strncpy(dev->name, e->d_name, sizeof(dev->name));
> +		}
> +		closedir(dir);
> +	}
> +
>  	if (!ret) {
>  		if (!strcmp(driver, "vfio-pci"))
>  			dev->kdrv = RTE_KDRV_VFIO;
> 

For PCI devices that have several interfaces (I think it's the case for
some Mellanox boards), maybe we should not store the interface name?

Another small comment about the strncpy(): it's maybe safer to ensure
that dev->name is properly nul-terminated.

Regards,
Olivier

  parent reply	other threads:[~2015-10-13 12:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-02 15:00 [dpdk-dev] [PATCH] " Chas Williams
2015-10-02 15:18 ` Bruce Richardson
2015-10-02 16:38   ` Charles (Chas) Williams
2015-10-02 16:44     ` Richardson, Bruce
2015-10-02 18:29       ` Charles (Chas) Williams
2015-10-05 15:59       ` Charles (Chas) Williams
2015-10-05 15:26 ` [dpdk-dev] [PATCH v2] " Chas Williams
2015-10-06  7:35   ` Stephen Hemminger
2015-10-06 14:41     ` Charles (Chas) Williams
2015-10-13 12:49   ` Olivier MATZ [this message]
2015-10-14 13:41     ` Charles (Chas) Williams
2015-11-04 22:40       ` Thomas Monjalon
2015-11-05 16:39         ` Charles (Chas) Williams
2015-11-05 19:23           ` Stephen Hemminger
2015-11-10 18:51             ` Charles (Chas) Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=561CFDDB.90601@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=3chas3@gmail.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).