Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/6191/?format=api
https://patches.dpdk.org/api/patches/6191/?format=api", "web_url": "https://patches.dpdk.org/project/dpdk/patch/1436351693-2349-12-git-send-email-mukawa@igel.co.jp/", "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": "<1436351693-2349-12-git-send-email-mukawa@igel.co.jp>", "list_archive_url": "https://inbox.dpdk.org/dev/1436351693-2349-12-git-send-email-mukawa@igel.co.jp", "date": "2015-07-08T10:34:52", "name": "[dpdk-dev,v9,11/12] eal: Consolidate pci_map/unmap_device() of linuxapp and bsdapp", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "1dfc0fdc4cec9bfa25844f0f2ef5e6939b5e5fc1", "submitter": { "id": 64, "url": "https://patches.dpdk.org/api/people/64/?format=api", "name": "Tetsuya Mukawa", "email": "mukawa@igel.co.jp" }, "delegate": null, "mbox": "https://patches.dpdk.org/project/dpdk/patch/1436351693-2349-12-git-send-email-mukawa@igel.co.jp/mbox/", "series": [], "comments": "https://patches.dpdk.org/api/patches/6191/comments/", "check": "pending", "checks": "https://patches.dpdk.org/api/patches/6191/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 CB72EC382;\n\tWed, 8 Jul 2015 12:36:02 +0200 (CEST)", "from mail-pd0-f176.google.com (mail-pd0-f176.google.com\n\t[209.85.192.176]) by dpdk.org (Postfix) with ESMTP id 57C85C36E\n\tfor <dev@dpdk.org>; Wed, 8 Jul 2015 12:36:01 +0200 (CEST)", "by pdrg1 with SMTP id g1so12214060pdr.2\n\tfor <dev@dpdk.org>; Wed, 08 Jul 2015 03:36:00 -0700 (PDT)", "from localhost.localdomain (napt.igel.co.jp. [219.106.231.132])\n\tby smtp.gmail.com with ESMTPSA id\n\txf2sm2043139pab.25.2015.07.08.03.35.58\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 08 Jul 2015 03:36:00 -0700 (PDT)" ], "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=OvJ9C6s9/f9+2/oEDWpxLqgMMDJKTpJPfmoU5S+66bM=;\n\tb=kyNlJ55kcgclaTObhonlEx7rmuTOPO5WMktnUQnxeByg3hZ7mpFCOmIZ13kRi8vgBe\n\tlO52nZIWz2QgNF7dDaBiiKCjW52nyU1z4ExNneh9LyaOOIhaz0GhXGGT7+TCtP6uwRQX\n\tV4PYGLUGvYt52BAM08jkTwpylhqO+l4Pj9+Izh6DwOuAO7CZGIU/5cmXZrw1m2dz+duk\n\tocP27K3zq5yt9QbrfskhMtNprjRFyvRLDW38WQHxNgmhbWHA95rEeAOcK3KNtW5FXo73\n\tdSDwIBEbvujUSoMO4yXAWf7ivjRsVE2dsr63t/1aRAeoSQfCs6yrDKVaSr3h0QqNIMQE\n\t8N7g==", "X-Gm-Message-State": "ALoCoQmQbXOAv0x3VcwggfPBUs96WHGGny9Vl4JaG6bV1YrgySopdl6xadqvH6RrNFLPOXU/TqsZ", "X-Received": "by 10.70.42.101 with SMTP id n5mr19330067pdl.93.1436351760767;\n\tWed, 08 Jul 2015 03:36:00 -0700 (PDT)", "From": "Tetsuya Mukawa <mukawa@igel.co.jp>", "To": "dev@dpdk.org", "Date": "Wed, 8 Jul 2015 19:34:52 +0900", "Message-Id": "<1436351693-2349-12-git-send-email-mukawa@igel.co.jp>", "X-Mailer": "git-send-email 2.1.4", "In-Reply-To": "<1436351693-2349-1-git-send-email-mukawa@igel.co.jp>", "References": "<1435652668-3380-12-git-send-email-mukawa@igel.co.jp>\n\t<1436351693-2349-1-git-send-email-mukawa@igel.co.jp>", "Subject": "[dpdk-dev] [PATCH v9 11/12] eal: Consolidate pci_map/unmap_device()\n\tof linuxapp and bsdapp", "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": "From: \"Tetsuya.Mukawa\" <mukawa@igel.co.jp>\n\nThe patch consolidates below functions, and implemented in common\neal code.\n - pci_map_device()\n - pci_unmap_device()\n\nSigned-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>\nAcked-by: Bernard Iremonger <bernard.iremonger@intel.com>\n---\n lib/librte_eal/bsdapp/eal/eal_pci.c | 3 ++\n lib/librte_eal/common/eal_common_pci.c | 57 +++++++++++++++++++++++++++++++++\n lib/librte_eal/common/eal_private.h | 19 +++++++++++\n lib/librte_eal/common/include/rte_pci.h | 1 +\n lib/librte_eal/linuxapp/eal/eal_pci.c | 53 ------------------------------\n lib/librte_ether/rte_ethdev.c | 2 ++\n 6 files changed, 82 insertions(+), 53 deletions(-)", "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c\nindex 42cf87e..d790d1f 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_pci.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c\n@@ -242,6 +242,9 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)\n \t/* FreeBSD has no NUMA support (yet) */\n \tdev->numa_node = 0;\n \n+\t/* FreeBSD has only one pass through driver */\n+\tdev->kdrv = RTE_KDRV_NIC_UIO;\n+\n \t/* parse resources */\n \tswitch (conf->pc_hdr & PCIM_HDRTYPE) {\n \tcase PCIM_HDRTYPE_NORMAL:\ndiff --git a/lib/librte_eal/common/eal_common_pci.c b/lib/librte_eal/common/eal_common_pci.c\nindex eab147a..afd14ec 100644\n--- a/lib/librte_eal/common/eal_common_pci.c\n+++ b/lib/librte_eal/common/eal_common_pci.c\n@@ -138,6 +138,63 @@ pci_unmap_resource(void *requested_addr, size_t size)\n \t\t\t\trequested_addr);\n }\n \n+/* Map pci device */\n+int\n+pci_map_device(struct rte_pci_device *dev)\n+{\n+\tint ret = -1;\n+\n+\t/* try mapping the NIC resources using VFIO if it exists */\n+\tswitch (dev->kdrv) {\n+\tcase RTE_KDRV_VFIO:\n+#ifdef VFIO_PRESENT\n+\t\tif (pci_vfio_is_enabled())\n+\t\t\tret = pci_vfio_map_resource(dev);\n+#endif\n+\t\tbreak;\n+\tcase RTE_KDRV_IGB_UIO:\n+\tcase RTE_KDRV_UIO_GENERIC:\n+\tcase RTE_KDRV_NIC_UIO:\n+\t\t/* map resources for devices that use uio */\n+\t\tret = pci_uio_map_resource(dev);\n+\t\tbreak;\n+\tdefault:\n+\t\tRTE_LOG(DEBUG, EAL, \" Not managed by a supported kernel driver,\"\n+\t\t\t\" skipped\\n\");\n+\t\tret = 1;\n+\t\tbreak;\n+\t}\n+\n+\treturn ret;\n+}\n+\n+#ifdef RTE_LIBRTE_EAL_HOTPLUG\n+/* Unmap pci device */\n+void\n+pci_unmap_device(struct rte_pci_device *dev)\n+{\n+\tif (dev == NULL)\n+\t\treturn;\n+\n+\t/* try unmapping the NIC resources using VFIO if it exists */\n+\tswitch (dev->kdrv) {\n+\tcase RTE_KDRV_VFIO:\n+\t\tRTE_LOG(ERR, EAL, \"Hotplug doesn't support vfio yet\\n\");\n+\t\tbreak;\n+\tcase RTE_KDRV_IGB_UIO:\n+\tcase RTE_KDRV_UIO_GENERIC:\n+\tcase RTE_KDRV_NIC_UIO:\n+\t\t/* unmap resources for devices that use uio */\n+\t\tpci_uio_unmap_resource(dev);\n+\t\tbreak;\n+\tdefault:\n+\t\tRTE_LOG(DEBUG, EAL, \" Not managed by a supported kernel driver,\"\n+\t\t\t\" skipped\\n\");\n+\t\tbreak;\n+\t}\n+}\n+#endif /* RTE_LIBRTE_EAL_HOTPLUG */\n+\n /*\n * If vendor/device ID match, call the devinit() function of all\n * registered driver for the given device. Return -1 if initialization\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex c0b62b7..cc022be 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -156,6 +156,25 @@ struct rte_pci_driver;\n struct rte_pci_device;\n \n /**\n+ * Map this device\n+ *\n+ * This function is private to EAL.\n+ *\n+ * @return\n+ * 0 on success, negative on error\n+ */\n+int pci_map_device(struct rte_pci_device *dev);\n+\n+#ifdef RTE_LIBRTE_EAL_HOTPLUG\n+/**\n+ * Unmap this device\n+ *\n+ * This function is private to EAL.\n+ */\n+void pci_unmap_device(struct rte_pci_device *dev);\n+#endif /* RTE_LIBRTE_EAL_HOTPLUG */\n+\n+/**\n * Map the PCI resource of a PCI device in virtual memory\n *\n * This function is private to EAL.\ndiff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h\nindex 4a4641c..1f09252 100644\n--- a/lib/librte_eal/common/include/rte_pci.h\n+++ b/lib/librte_eal/common/include/rte_pci.h\n@@ -149,6 +149,7 @@ enum rte_kernel_driver {\n \tRTE_KDRV_IGB_UIO,\n \tRTE_KDRV_VFIO,\n \tRTE_KDRV_UIO_GENERIC,\n+\tRTE_KDRV_NIC_UIO,\n };\n \n /**\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex fc99eaa..7e8df7d 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -522,59 +522,6 @@ pci_config_space_set(struct rte_pci_device *dev)\n }\n #endif\n \n-static int\n-pci_map_device(struct rte_pci_device *dev)\n-{\n-\tint ret = -1;\n-\n-\t/* try mapping the NIC resources using VFIO if it exists */\n-\tswitch (dev->kdrv) {\n-\tcase RTE_KDRV_VFIO:\n-#ifdef VFIO_PRESENT\n-\t\tif (pci_vfio_is_enabled())\n-\t\t\tret = pci_vfio_map_resource(dev);\n-#endif\n-\t\tbreak;\n-\tcase RTE_KDRV_IGB_UIO:\n-\tcase RTE_KDRV_UIO_GENERIC:\n-\t\t/* map resources for devices that use uio */\n-\t\tret = pci_uio_map_resource(dev);\n-\t\tbreak;\n-\tdefault:\n-\t\tRTE_LOG(DEBUG, EAL, \" Not managed by a supported kernel driver,\"\n-\t\t\t\" skipped\\n\");\n-\t\tret = 1;\n-\t\tbreak;\n-\t}\n-\n-\treturn ret;\n-}\n-\n-#ifdef RTE_LIBRTE_EAL_HOTPLUG\n-static void\n-pci_unmap_device(struct rte_pci_device *dev)\n-{\n-\tif (dev == NULL)\n-\t\treturn;\n-\n-\t/* try unmapping the NIC resources using VFIO if it exists */\n-\tswitch (dev->kdrv) {\n-\tcase RTE_KDRV_VFIO:\n-\t\tRTE_LOG(ERR, EAL, \"Hotplug doesn't support vfio yet\\n\");\n-\t\tbreak;\n-\tcase RTE_KDRV_IGB_UIO:\n-\tcase RTE_KDRV_UIO_GENERIC:\n-\t\t/* unmap resources for devices that use uio */\n-\t\tpci_uio_unmap_resource(dev);\n-\t\tbreak;\n-\tdefault:\n-\t\tRTE_LOG(DEBUG, EAL, \" Not managed by a supported kernel driver,\"\n-\t\t\t\" skipped\\n\");\n-\t\tbreak;\n-\t}\n-}\n-#endif /* RTE_LIBRTE_EAL_HOTPLUG */\n-\n /*\n * If vendor/device ID match, call the devinit() function of the\n * driver.\ndiff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c\nindex da915db..7b24e26 100644\n--- a/lib/librte_ether/rte_ethdev.c\n+++ b/lib/librte_ether/rte_ethdev.c\n@@ -2,6 +2,7 @@\n * BSD LICENSE\n *\n * Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ * Copyright(c) 2015 IGEL Co., Ltd.\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n@@ -527,6 +528,7 @@ rte_eth_dev_is_detachable(uint8_t port_id)\n \t\tswitch (rte_eth_devices[port_id].pci_dev->kdrv) {\n \t\tcase RTE_KDRV_IGB_UIO:\n \t\tcase RTE_KDRV_UIO_GENERIC:\n+\t\tcase RTE_KDRV_NIC_UIO:\n \t\t\tbreak;\n \t\tcase RTE_KDRV_VFIO:\n \t\tdefault:\n", "prefixes": [ "dpdk-dev", "v9", "11/12" ] }{ "id": 6191, "url": "