Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/7372/?format=api
https://patches.dpdk.org/api/patches/7372/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1443798007-20122-1-git-send-email-3chas3@gmail.com/", "project": { "id": 1, "url": "https://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<1443798007-20122-1-git-send-email-3chas3@gmail.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1443798007-20122-1-git-send-email-3chas3@gmail.com", "date": "2015-10-02T15:00:07", "name": "[dpdk-dev] devargs: add blacklisting by linux interface name", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "d68307d6df0d298f14cd2caf3eb842f1e5441c1c", "submitter": { "id": 341, "url": "https://patches.dpdk.org/api/people/341/?format=api", "name": "Chas Williams", "email": "3chas3@gmail.com" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1443798007-20122-1-git-send-email-3chas3@gmail.com/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/7372/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/7372/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 5BF148E6F;\n\tFri, 2 Oct 2015 17:00:20 +0200 (CEST)", "from mail-qk0-f176.google.com (mail-qk0-f176.google.com\n\t[209.85.220.176]) by dpdk.org (Postfix) with ESMTP id CAD768D9E\n\tfor <dev@dpdk.org>; Fri, 2 Oct 2015 17:00:18 +0200 (CEST)", "by qkcf65 with SMTP id f65so43772433qkc.3\n\tfor <dev@dpdk.org>; Fri, 02 Oct 2015 08:00:18 -0700 (PDT)", "from foobar.home (pool-71-163-182-126.washdc.fios.verizon.net.\n\t[71.163.182.126]) by smtp.gmail.com with ESMTPSA id\n\tz19sm4784417qge.38.2015.10.02.08.00.15\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 02 Oct 2015 08:00:15 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\n\th=from:to:cc:subject:date:message-id;\n\tbh=5r13Cnl6jyeQKlXMutTiytVYrDmmPwsH7pW79coIiW4=;\n\tb=o6cbN2kf6RDa4IHQH1iDk6JyZ3vSJxvItOqr59Dq3NlKpWkp1n+rBX4b5oah0A/GGk\n\tT/YSVjqt9TUJIdE/9Jqbg+bmJJ9ipJqIOge4lCD9IYP9m95neBitfDVf5+4nwCc1oMCx\n\twCwNGggyN5eeOch6jfWMozjvf8ykT2sYe+6lFtMjF5yAE9qGDU9RRcKYFlGWluHSreNG\n\tyr7kOmYn1yX9CQ0mvR5cumuNGWs23EdktCFtVqWQHCYeaxkRAB2HSgPUEnioTMhhhpx7\n\t16/ji5ADqO9CG1skS9Le9k/gee8sP9GCcws+6KeC5EXadlTN1741nA5is2/7Vz0SbFrd\n\trd5g==", "X-Received": "by 10.55.31.72 with SMTP id f69mr2080726qkf.94.1443798015811;\n\tFri, 02 Oct 2015 08:00:15 -0700 (PDT)", "From": "Chas Williams <3chas3@gmail.com>", "To": "dev@dpdk.org", "Date": "Fri, 2 Oct 2015 11:00:07 -0400", "Message-Id": "<1443798007-20122-1-git-send-email-3chas3@gmail.com>", "X-Mailer": "git-send-email 2.1.0", "Subject": "[dpdk-dev] [PATCH] devargs: add blacklisting by linux interface name", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "If a system is using deterministic interface names, it may be easier in\nsome cases to use the interface name to blacklist an interface.\n\nSigned-off-by: Chas Williams <3chas3@gmail.com>\n---\n app/test/test_devargs.c | 2 ++\n lib/librte_eal/common/eal_common_devargs.c | 8 ++++++++\n lib/librte_eal/common/eal_common_options.c | 10 ++++++++++\n lib/librte_eal/common/eal_common_pci.c | 17 +++++++++++------\n lib/librte_eal/common/eal_options.h | 2 ++\n lib/librte_eal/common/include/rte_devargs.h | 5 +++++\n lib/librte_eal/common/include/rte_pci.h | 1 +\n lib/librte_eal/linuxapp/eal/eal_pci.c | 15 +++++++++++++++\n 8 files changed, 54 insertions(+), 6 deletions(-)", "diff": "diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c\nindex f7fc59c..c204c49 100644\n--- a/app/test/test_devargs.c\n+++ b/app/test/test_devargs.c\n@@ -85,6 +85,8 @@ test_devargs(void)\n \t\tgoto fail;\n \tif (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 2)\n \t\tgoto fail;\n+\tif (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_NAME, \"eth0\") < 0)\n+\t\tgoto fail;\n \tfree_devargs_list();\n \n \t/* check virtual device with argument parsing */\ndiff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c\nindex ec56165..cac651b 100644\n--- a/lib/librte_eal/common/eal_common_devargs.c\n+++ b/lib/librte_eal/common/eal_common_devargs.c\n@@ -113,6 +113,14 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)\n \t\t\tgoto fail;\n \n \t\tbreak;\n+\tcase RTE_DEVTYPE_BLACKLISTED_NAME:\n+\t\t/* save interface name */\n+\t\tret = snprintf(devargs->name.name,\n+\t\t\t sizeof(devargs->name.name), \"%s\", buf);\n+\t\tif (ret < 0 || ret >= (int)sizeof(devargs->name.name))\n+\t\t\tgoto fail;\n+\n+\t\tbreak;\n \t}\n \n \tfree(buf);\ndiff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c\nindex 1f459ac..c08126d 100644\n--- a/lib/librte_eal/common/eal_common_options.c\n+++ b/lib/librte_eal/common/eal_common_options.c\n@@ -90,6 +90,7 @@ eal_long_options[] = {\n \t{OPT_VFIO_INTR, 1, NULL, OPT_VFIO_INTR_NUM },\n \t{OPT_VMWARE_TSC_MAP, 0, NULL, OPT_VMWARE_TSC_MAP_NUM },\n \t{OPT_XEN_DOM0, 0, NULL, OPT_XEN_DOM0_NUM },\n+\t{OPT_BLACKLISTED_NAME, 1, NULL, OPT_BLACKLISTED_NAME_NUM },\n \t{0, 0, NULL, 0 }\n };\n \n@@ -785,6 +786,13 @@ eal_parse_common_option(int opt, const char *optarg,\n \t\t}\n \t\tbreak;\n \n+\tcase OPT_BLACKLISTED_NAME_NUM:\n+\t\tif (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_NAME,\n+\t\t\t\toptarg) < 0) {\n+\t\t\treturn -1;\n+\t\t}\n+\t\tbreak;\n+\n \t/* don't know what to do, leave this to caller */\n \tdefault:\n \t\treturn 1;\n@@ -898,6 +906,8 @@ eal_common_usage(void)\n \t \" --\"OPT_VDEV\" Add a virtual device.\\n\"\n \t \" The argument format is <driver><id>[,key=val,...]\\n\"\n \t \" (ex: --vdev=eth_pcap0,iface=eth2).\\n\"\n+\t \" --\"OPT_BLACKLISTED_NAME\" Add a device name to the black list.\\n\"\n+\t \" Prevent EAL from using this named interface.\\n\"\n \t \" --\"OPT_VMWARE_TSC_MAP\" Use VMware TSC map instead of native RDTSC\\n\"\n \t \" --\"OPT_PROC_TYPE\" Type of this process (primary|secondary|auto)\\n\"\n \t \" --\"OPT_SYSLOG\" Set syslog facility\\n\"\ndiff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c\nindex dcfe947..41a7690 100644\n--- a/lib/librte_eal/common/eal_common_pci.c\n+++ b/lib/librte_eal/common/eal_common_pci.c\n@@ -90,11 +90,15 @@ static struct rte_devargs *pci_devargs_lookup(struct rte_pci_device *dev)\n \tstruct rte_devargs *devargs;\n \n \tTAILQ_FOREACH(devargs, &devargs_list, next) {\n-\t\tif (devargs->type != RTE_DEVTYPE_BLACKLISTED_PCI &&\n-\t\t\tdevargs->type != RTE_DEVTYPE_WHITELISTED_PCI)\n-\t\t\tcontinue;\n-\t\tif (!rte_eal_compare_pci_addr(&dev->addr, &devargs->pci.addr))\n-\t\t\treturn devargs;\n+\t\tif (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI ||\n+\t\t\tdevargs->type == RTE_DEVTYPE_WHITELISTED_PCI) {\n+\t\t\tif (!rte_eal_compare_pci_addr(&dev->addr, &devargs->pci.addr))\n+\t\t\t\treturn devargs;\n+\t\t}\n+\t\tif (devargs->type == RTE_DEVTYPE_BLACKLISTED_NAME) {\n+\t\t\tif (strcmp(dev->name, devargs->name.name) == 0)\n+\t\t\t\treturn devargs;\n+\t\t}\n \t}\n \treturn NULL;\n }\n@@ -174,7 +178,8 @@ rte_eal_pci_probe_one_driver(struct rte_pci_driver *dr, struct rte_pci_device *d\n \n \t\t/* no initialization when blacklisted, return without error */\n \t\tif (dev->devargs != NULL &&\n-\t\t\tdev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI) {\n+\t\t\t(dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI ||\n+\t\t\t dev->devargs->type == RTE_DEVTYPE_BLACKLISTED_NAME)) {\n \t\t\tRTE_LOG(DEBUG, EAL, \" Device is blacklisted, not initializing\\n\");\n \t\t\treturn 1;\n \t\t}\ndiff --git a/lib/librte_eal/common/eal_options.h b/lib/librte_eal/common/eal_options.h\nindex f6714d9..2aea553 100644\n--- a/lib/librte_eal/common/eal_options.h\n+++ b/lib/librte_eal/common/eal_options.h\n@@ -45,6 +45,8 @@ enum {\n \t/* first long only option value must be >= 256, so that we won't\n \t * conflict with short options */\n \tOPT_LONG_MIN_NUM = 256,\n+#define OPT_BLACKLISTED_NAME \"blacklisted-name\"\n+\tOPT_BLACKLISTED_NAME_NUM,\n #define OPT_BASE_VIRTADDR \"base-virtaddr\"\n \tOPT_BASE_VIRTADDR_NUM,\n #define OPT_CREATE_UIO_DEV \"create-uio-dev\"\ndiff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h\nindex 7084ae2..8531405 100644\n--- a/lib/librte_eal/common/include/rte_devargs.h\n+++ b/lib/librte_eal/common/include/rte_devargs.h\n@@ -59,6 +59,7 @@ enum rte_devtype {\n \tRTE_DEVTYPE_WHITELISTED_PCI,\n \tRTE_DEVTYPE_BLACKLISTED_PCI,\n \tRTE_DEVTYPE_VIRTUAL,\n+\tRTE_DEVTYPE_BLACKLISTED_NAME,\n };\n \n /**\n@@ -87,6 +88,10 @@ struct rte_devargs {\n \t\t\t/** Driver name. */\n \t\t\tchar drv_name[32];\n \t\t} virtual;\n+\t\tstruct {\n+\t\t\t/** Interface name. */\n+\t\t\tchar name[32];\n+\t\t} name;\n \t};\n \t/** Arguments string as given by user or \"\" for no argument. */\n \tchar *args;\ndiff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h\nindex 83e3c28..852c149 100644\n--- a/lib/librte_eal/common/include/rte_pci.h\n+++ b/lib/librte_eal/common/include/rte_pci.h\n@@ -161,6 +161,7 @@ struct rte_pci_device {\n \tstruct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */\n \tstruct rte_intr_handle intr_handle; /**< Interrupt handle */\n \tstruct rte_pci_driver *driver; /**< Associated driver */\n+\tchar name[32];\t\t\t\t/**< Interface name (if any) */\n \tuint16_t max_vfs; /**< sriov enable if not zero */\n \tint numa_node; /**< NUMA node connection */\n \tstruct rte_devargs *devargs; /**< Device user arguments */\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex bc5b5be..c417d01 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -260,6 +260,8 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,\n \tunsigned long tmp;\n \tstruct rte_pci_device *dev;\n \tchar driver[PATH_MAX];\n+\tstruct dirent *e;\n+\tDIR *dir;\n \tint ret;\n \n \tdev = malloc(sizeof(*dev));\n@@ -352,6 +354,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,\n \t\treturn -1;\n \t}\n \n+\t/* get network interface name */\n+\tsnprintf(filename, sizeof(filename), \"%s/net\", dirname);\n+\tdir = opendir(filename);\n+\tif (dir) {\n+\t\twhile ((e = readdir(dir)) != NULL) {\n+\t\t\tif (e->d_name[0] == '.')\n+\t\t\t\tcontinue;\n+\n+\t\t\tstrcpy(dev->name, e->d_name);\n+\t\t}\n+\t\tclosedir(dir);\n+\t}\n+\n \tif (!ret) {\n \t\tif (!strcmp(driver, \"vfio-pci\"))\n \t\t\tdev->kdrv = RTE_KDRV_VFIO;\n", "prefixes": [ "dpdk-dev" ] }{ "id": 7372, "url": "