Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/3528/?format=api
http://patches.dpdk.org/api/patches/3528/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1424414390-18509-11-git-send-email-mukawa@igel.co.jp/", "project": { "id": 1, "url": "http://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": "<1424414390-18509-11-git-send-email-mukawa@igel.co.jp>", "list_archive_url": "https://inbox.dpdk.org/dev/1424414390-18509-11-git-send-email-mukawa@igel.co.jp", "date": "2015-02-20T06:39:44", "name": "[dpdk-dev,v10,10/14] eal/pci: Add a function to remove the entry of devargs list", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "86e5da8129dc04df7af2f1af4af9ae72a194043c", "submitter": { "id": 64, "url": "http://patches.dpdk.org/api/people/64/?format=api", "name": "Tetsuya Mukawa", "email": "mukawa@igel.co.jp" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1424414390-18509-11-git-send-email-mukawa@igel.co.jp/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/3528/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/3528/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 4F90CB5A0;\n\tFri, 20 Feb 2015 07:40:29 +0100 (CET)", "from mail-pd0-f173.google.com (mail-pd0-f173.google.com\n\t[209.85.192.173]) by dpdk.org (Postfix) with ESMTP id 3CD36B4FA\n\tfor <dev@dpdk.org>; Fri, 20 Feb 2015 07:40:22 +0100 (CET)", "by pdjg10 with SMTP id g10so5610575pdj.1\n\tfor <dev@dpdk.org>; Thu, 19 Feb 2015 22:40:21 -0800 (PST)", "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby mx.google.com with ESMTPSA id\n\tg7sm13769979pdm.4.2015.02.19.22.40.19\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tThu, 19 Feb 2015 22:40:20 -0800 (PST)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=sJKd5FN3Oyq5Ljjpix4/DD/raVaGqYh38EeTAxbHYgo=;\n\tb=EDe5H0w52VSBdycwUAaLO+P5OTLvfyBLVtkUzSkvV8nrseMlzK3hSyKVKfo/K+2zqc\n\t5cRmK6HzPTFEVl9mB8IhxPxIDlufYXdpsFVynsZdWGcwjyj/zK/0X8fpEWri9MzAxTgu\n\tMwRpwJELrBM3CFw5RMWyFDex0ZXY2NTmv14tNUsmVsKb0HTeIbkiZ2+o9IqmT3XTWKo6\n\tARvHur6FPgP5QyciCe24D0p+jeEX/XOUkipYNUuPdY1joVieIO1E21peiE1XQsku7qO1\n\tEk/NZxc++1ujwTRFAaeSTmI+bmI82ewKs8w0eaqfI9VX8rUyCRMaFnNdMLzOAIPlm0a7\n\thV7Q==", "X-Gm-Message-State": "ALoCoQnLxSwvUSxScbJLIAuqHhAqk4LfgOHM8TU8L3TPNE8AOek7GSoyrTD+XF7h+cMit38x9irZ", "X-Received": "by 10.66.149.106 with SMTP id tz10mr14285850pab.90.1424414421683;\n\tThu, 19 Feb 2015 22:40:21 -0800 (PST)", "From": "Tetsuya Mukawa <mukawa@igel.co.jp>", "To": "dev@dpdk.org", "Date": "Fri, 20 Feb 2015 15:39:44 +0900", "Message-Id": "<1424414390-18509-11-git-send-email-mukawa@igel.co.jp>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1424414390-18509-1-git-send-email-mukawa@igel.co.jp>", "References": "<1424060073-23484-2-git-send-email-mukawa@igel.co.jp>\n\t<1424414390-18509-1-git-send-email-mukawa@igel.co.jp>", "Subject": "[dpdk-dev] [PATCH v10 10/14] eal/pci: Add a function to remove the\n\tentry of devargs list", "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": "The function removes the specified devargs entry from devargs_list.\nAlso, the patch adds sanity checking to rte_eal_devargs_add().\n\nv5:\n- Change function definition of rte_eal_devargs_remove().\nv4:\n- Fix sanity check code.\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\n---\n lib/librte_eal/common/eal_common_devargs.c | 61 +++++++++++++++++++++++++++++\n lib/librte_eal/common/include/rte_devargs.h | 21 ++++++++++\n 2 files changed, 82 insertions(+)", "diff": "diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c\nindex 3aace08..06954c3 100644\n--- a/lib/librte_eal/common/eal_common_devargs.c\n+++ b/lib/librte_eal/common/eal_common_devargs.c\n@@ -44,6 +44,36 @@\n struct rte_devargs_list devargs_list =\n \tTAILQ_HEAD_INITIALIZER(devargs_list);\n \n+\n+/* find a entry specified by pci address or device name */\n+static struct rte_devargs *\n+rte_eal_devargs_find(enum rte_devtype devtype, void *args)\n+{\n+\tstruct rte_devargs *devargs;\n+\n+\tif (args == NULL)\n+\t\treturn NULL;\n+\n+\tTAILQ_FOREACH(devargs, &devargs_list, next) {\n+\t\tswitch (devtype) {\n+\t\tcase RTE_DEVTYPE_WHITELISTED_PCI:\n+\t\tcase RTE_DEVTYPE_BLACKLISTED_PCI:\n+\t\t\tif (rte_eal_compare_pci_addr(\n+\t\t\t\t\t&devargs->pci.addr, args) == 0)\n+\t\t\t\tgoto found;\n+\t\t\tbreak;\n+\t\tcase RTE_DEVTYPE_VIRTUAL:\n+\t\t\tif (memcmp(&devargs->virtual.drv_name, args,\n+\t\t\t strlen((char *)args)) == 0)\n+\t\t\t\tgoto found;\n+\t\t\tbreak;\n+\t\t}\n+\t}\n+\treturn NULL;\n+found:\n+\treturn devargs;\n+}\n+\n /* store a whitelist parameter for later parsing */\n int\n rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)\n@@ -88,6 +118,12 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)\n \t\t\tRTE_LOG(ERR, EAL, \"invalid PCI identifier <%s>\\n\", buf);\n \t\t\tgoto fail;\n \t\t}\n+\t\t/* make sure there is no same entry */\n+\t\tif (rte_eal_devargs_find(devtype, &devargs->pci.addr)) {\n+\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\"device already registered: <%s>\\n\", buf);\n+\t\t\treturn -1;\n+\t\t}\n \t\tbreak;\n \tcase RTE_DEVTYPE_VIRTUAL:\n \t\t/* save driver name */\n@@ -97,6 +133,12 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)\n \t\t\tRTE_LOG(ERR, EAL, \"driver name too large: <%s>\\n\", buf);\n \t\t\tgoto fail;\n \t\t}\n+\t\t/* make sure there is no same entry */\n+\t\tif (rte_eal_devargs_find(devtype, &devargs->virtual.drv_name)) {\n+\t\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\t\"device already registered: <%s>\\n\", buf);\n+\t\t\treturn -1;\n+\t\t}\n \t\tbreak;\n \t}\n \n@@ -114,6 +156,25 @@ fail:\n \treturn -1;\n }\n \n+/* remove it from the devargs_list */\n+int\n+rte_eal_devargs_remove(enum rte_devtype devtype, void *args)\n+{\n+\tstruct rte_devargs *devargs;\n+\n+\tif (args == NULL)\n+\t\treturn -EINVAL;\n+\n+\tdevargs = rte_eal_devargs_find(devtype, args);\n+\tif (devargs == NULL) {\n+\t\tRTE_LOG(ERR, EAL, \"device not found\\n\");\n+\t\treturn -ENODEV;\n+\t}\n+\n+\tTAILQ_REMOVE(&devargs_list, devargs, next);\n+\treturn 0;\n+}\n+\n /* count the number of devices of a specified type */\n unsigned int\n rte_eal_devargs_type_count(enum rte_devtype devtype)\ndiff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h\nindex 996e180..abfa3b1 100644\n--- a/lib/librte_eal/common/include/rte_devargs.h\n+++ b/lib/librte_eal/common/include/rte_devargs.h\n@@ -123,6 +123,27 @@ extern struct rte_devargs_list devargs_list;\n int rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str);\n \n /**\n+ * Remove a device from the user device list\n+ *\n+ * For PCI devices, the format of arguments string is \"PCI_ADDR\". It shouldn't\n+ * involve parameters for the device. Example: \"08:00.1\".\n+ *\n+ * For virtual devices, the format of arguments string is \"DRIVER_NAME*\". It\n+ * shouldn't involve parameters for the device. Example: \"eth_ring\". The\n+ * validity of the driver name is not checked by this function, it is done\n+ * when closing the drivers.\n+ *\n+ * @param devtype\n+ * The type of the device.\n+ * @param name\n+ * The name of the device.\n+ *\n+ * @return\n+ * - 0 on success, negative on error\n+ */\n+int rte_eal_devargs_remove(enum rte_devtype devtype, void *args);\n+\n+/**\n * Count the number of user devices of a specified type\n *\n * @param devtype\n", "prefixes": [ "dpdk-dev", "v10", "10/14" ] }{ "id": 3528, "url": "