Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/56423/?format=api
http://patches.dpdk.org/api/patches/56423/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20190715075214.16616-2-tiwei.bie@intel.com/", "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": "<20190715075214.16616-2-tiwei.bie@intel.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20190715075214.16616-2-tiwei.bie@intel.com", "date": "2019-07-15T07:52:10", "name": "[RFC,v2,1/5] bus/pci: introduce an internal representation of PCI device", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "94525ab2d79ee977dee50c82b47f109ea42dc41f", "submitter": { "id": 617, "url": "http://patches.dpdk.org/api/people/617/?format=api", "name": "Tiwei Bie", "email": "tiwei.bie@intel.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20190715075214.16616-2-tiwei.bie@intel.com/mbox/", "series": [ { "id": 5487, "url": "http://patches.dpdk.org/api/series/5487/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5487", "date": "2019-07-15T07:52:09", "name": "Add mdev (Mediated device) support in DPDK", "version": 2, "mbox": "http://patches.dpdk.org/series/5487/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/56423/comments/", "check": "fail", "checks": "http://patches.dpdk.org/api/patches/56423/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 [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id D89631B96E;\n\tMon, 15 Jul 2019 09:54:14 +0200 (CEST)", "from mga05.intel.com (mga05.intel.com [192.55.52.43])\n\tby dpdk.org (Postfix) with ESMTP id 8FD5E322C\n\tfor <dev@dpdk.org>; Mon, 15 Jul 2019 09:54:11 +0200 (CEST)", "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t15 Jul 2019 00:54:11 -0700", "from npg-dpdk-virtio-tbie-2.sh.intel.com ([10.67.104.66])\n\tby FMSMGA003.fm.intel.com with ESMTP; 15 Jul 2019 00:54:09 -0700" ], "X-Amp-Result": "SKIPPED(no attachment in message)", "X-Amp-File-Uploaded": "False", "X-ExtLoop1": "1", "X-IronPort-AV": "E=Sophos;i=\"5.63,493,1557212400\"; d=\"scan'208\";a=\"175025605\"", "From": "Tiwei Bie <tiwei.bie@intel.com>", "To": "dev@dpdk.org", "Cc": "ferruh.yigit@intel.com, anatoly.burakov@intel.com,\n\tbruce.richardson@intel.com, keith.wiles@intel.com,\n\tdavid.marchand@redhat.com, alejandro.lucero@netronome.com,\n\tcunming.liang@intel.com", "Date": "Mon, 15 Jul 2019 15:52:10 +0800", "Message-Id": "<20190715075214.16616-2-tiwei.bie@intel.com>", "X-Mailer": "git-send-email 2.17.1", "In-Reply-To": "<20190715075214.16616-1-tiwei.bie@intel.com>", "References": "<20190403071844.21126-1-tiwei.bie@intel.com>\n\t<20190715075214.16616-1-tiwei.bie@intel.com>", "Subject": "[dpdk-dev] [RFC v2 1/5] bus/pci: introduce an internal\n\trepresentation of PCI device", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "This patch introduces an internal representation of the PCI device\nwhich will be used to store the internal information that don't have\nto be exposed, e.g. the VFIO region sizes/offsets.\n\nIn this patch, the internal structure is simply a wrapper of the\nrte_pci_device structure. More fields will be added in the coming\npatches.\n\nSuggested-by: David Marchand <david.marchand@redhat.com>\nSigned-off-by: Tiwei Bie <tiwei.bie@intel.com>\n---\n drivers/bus/pci/bsd/pci.c | 14 ++++++++------\n drivers/bus/pci/linux/pci.c | 25 ++++++++++++++-----------\n drivers/bus/pci/pci_common.c | 2 +-\n drivers/bus/pci/private.h | 12 ++++++++++++\n 4 files changed, 35 insertions(+), 18 deletions(-)", "diff": "diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c\nindex a2de70910..636868f38 100644\n--- a/drivers/bus/pci/bsd/pci.c\n+++ b/drivers/bus/pci/bsd/pci.c\n@@ -213,16 +213,18 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,\n static int\n pci_scan_one(int dev_pci_fd, struct pci_conf *conf)\n {\n+\tstruct rte_pci_device_internal *pdev;\n \tstruct rte_pci_device *dev;\n \tstruct pci_bar_io bar;\n \tunsigned i, max;\n \n-\tdev = malloc(sizeof(*dev));\n-\tif (dev == NULL) {\n+\tpdev = malloc(sizeof(*pdev));\n+\tif (pdev == NULL)\n \t\treturn -1;\n-\t}\n \n-\tmemset(dev, 0, sizeof(*dev));\n+\tmemset(pdev, 0, sizeof(*pdev));\n+\n+\tdev = &pdev->device;\n \tdev->device.bus = &rte_pci_bus.bus;\n \n \tdev->addr.domain = conf->pc_sel.pc_domain;\n@@ -308,7 +310,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)\n \t\t\t\tmemmove(dev2->mem_resource,\n \t\t\t\t\tdev->mem_resource,\n \t\t\t\t\tsizeof(dev->mem_resource));\n-\t\t\t\tfree(dev);\n+\t\t\t\tfree(pdev);\n \t\t\t}\n \t\t\treturn 0;\n \t\t}\n@@ -318,7 +320,7 @@ pci_scan_one(int dev_pci_fd, struct pci_conf *conf)\n \treturn 0;\n \n skipdev:\n-\tfree(dev);\n+\tfree(pdev);\n \treturn 0;\n }\n \ndiff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c\nindex 33c8ea7e9..dfab7b81b 100644\n--- a/drivers/bus/pci/linux/pci.c\n+++ b/drivers/bus/pci/linux/pci.c\n@@ -219,22 +219,25 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n {\n \tchar filename[PATH_MAX];\n \tunsigned long tmp;\n+\tstruct rte_pci_device_internal *pdev;\n \tstruct rte_pci_device *dev;\n \tchar driver[PATH_MAX];\n \tint ret;\n \n-\tdev = malloc(sizeof(*dev));\n-\tif (dev == NULL)\n+\tpdev = malloc(sizeof(*pdev));\n+\tif (pdev == NULL)\n \t\treturn -1;\n \n-\tmemset(dev, 0, sizeof(*dev));\n+\tmemset(pdev, 0, sizeof(*pdev));\n+\n+\tdev = &pdev->device;\n \tdev->device.bus = &rte_pci_bus.bus;\n \tdev->addr = *addr;\n \n \t/* get vendor id */\n \tsnprintf(filename, sizeof(filename), \"%s/vendor\", dirname);\n \tif (eal_parse_sysfs_value(filename, &tmp) < 0) {\n-\t\tfree(dev);\n+\t\tfree(pdev);\n \t\treturn -1;\n \t}\n \tdev->id.vendor_id = (uint16_t)tmp;\n@@ -242,7 +245,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n \t/* get device id */\n \tsnprintf(filename, sizeof(filename), \"%s/device\", dirname);\n \tif (eal_parse_sysfs_value(filename, &tmp) < 0) {\n-\t\tfree(dev);\n+\t\tfree(pdev);\n \t\treturn -1;\n \t}\n \tdev->id.device_id = (uint16_t)tmp;\n@@ -251,7 +254,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n \tsnprintf(filename, sizeof(filename), \"%s/subsystem_vendor\",\n \t\t dirname);\n \tif (eal_parse_sysfs_value(filename, &tmp) < 0) {\n-\t\tfree(dev);\n+\t\tfree(pdev);\n \t\treturn -1;\n \t}\n \tdev->id.subsystem_vendor_id = (uint16_t)tmp;\n@@ -260,7 +263,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n \tsnprintf(filename, sizeof(filename), \"%s/subsystem_device\",\n \t\t dirname);\n \tif (eal_parse_sysfs_value(filename, &tmp) < 0) {\n-\t\tfree(dev);\n+\t\tfree(pdev);\n \t\treturn -1;\n \t}\n \tdev->id.subsystem_device_id = (uint16_t)tmp;\n@@ -269,7 +272,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n \tsnprintf(filename, sizeof(filename), \"%s/class\",\n \t\t dirname);\n \tif (eal_parse_sysfs_value(filename, &tmp) < 0) {\n-\t\tfree(dev);\n+\t\tfree(pdev);\n \t\treturn -1;\n \t}\n \t/* the least 24 bits are valid: class, subclass, program interface */\n@@ -309,7 +312,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n \tsnprintf(filename, sizeof(filename), \"%s/resource\", dirname);\n \tif (pci_parse_sysfs_resource(filename, dev) < 0) {\n \t\tRTE_LOG(ERR, EAL, \"%s(): cannot parse resource\\n\", __func__);\n-\t\tfree(dev);\n+\t\tfree(pdev);\n \t\treturn -1;\n \t}\n \n@@ -318,7 +321,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n \tret = pci_get_kernel_driver_by_path(filename, driver, sizeof(driver));\n \tif (ret < 0) {\n \t\tRTE_LOG(ERR, EAL, \"Fail to get kernel driver\\n\");\n-\t\tfree(dev);\n+\t\tfree(pdev);\n \t\treturn -1;\n \t}\n \n@@ -382,7 +385,7 @@ pci_scan_one(const char *dirname, const struct rte_pci_addr *addr)\n \t\t\t\t\t\tRTE_LOG(ERR, EAL, \"Unexpected device scan at %s!\\n\",\n \t\t\t\t\t\t\tfilename);\n \t\t\t\t}\n-\t\t\t\tfree(dev);\n+\t\t\t\tfree(pdev);\n \t\t\t}\n \t\t\treturn 0;\n \t\t}\ndiff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c\nindex d2af472ef..8b9deca8b 100644\n--- a/drivers/bus/pci/pci_common.c\n+++ b/drivers/bus/pci/pci_common.c\n@@ -523,7 +523,7 @@ pci_unplug(struct rte_device *dev)\n \tif (ret == 0) {\n \t\trte_pci_remove_device(pdev);\n \t\trte_devargs_remove(dev->devargs);\n-\t\tfree(pdev);\n+\t\tfree(RTE_PCI_DEVICE_INTERNAL(pdev));\n \t}\n \treturn ret;\n }\ndiff --git a/drivers/bus/pci/private.h b/drivers/bus/pci/private.h\nindex 8a5524052..3e2abd818 100644\n--- a/drivers/bus/pci/private.h\n+++ b/drivers/bus/pci/private.h\n@@ -10,6 +10,14 @@\n #include <rte_pci.h>\n #include <rte_bus_pci.h>\n \n+/*\n+ * Convert struct rte_pci_device to struct rte_pci_device_internal\n+ */\n+#define RTE_PCI_DEVICE_INTERNAL(ptr) \\\n+\tcontainer_of(ptr, struct rte_pci_device_internal, device)\n+#define RTE_PCI_DEVICE_INTERNAL_CONST(ptr) \\\n+\tcontainer_of(ptr, const struct rte_pci_device_internal, device)\n+\n extern struct rte_pci_bus rte_pci_bus;\n \n struct rte_pci_driver;\n@@ -17,6 +25,10 @@ struct rte_pci_device;\n \n extern struct rte_pci_bus rte_pci_bus;\n \n+struct rte_pci_device_internal {\n+\tstruct rte_pci_device device;\n+};\n+\n /**\n * Probe the PCI bus\n *\n", "prefixes": [ "RFC", "v2", "1/5" ] }{ "id": 56423, "url": "