get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/68237/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 68237,
    "url": "https://patches.dpdk.org/api/patches/68237/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20200413023115.47191-1-haiyue.wang@intel.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": "<20200413023115.47191-1-haiyue.wang@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200413023115.47191-1-haiyue.wang@intel.com",
    "date": "2020-04-13T02:31:15",
    "name": "[v1] eal: add VFIO-PCI SR-IOV support",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "4bdb06370851e1946ff7d4df61de4692131ef365",
    "submitter": {
        "id": 1044,
        "url": "https://patches.dpdk.org/api/people/1044/?format=api",
        "name": "Wang, Haiyue",
        "email": "haiyue.wang@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20200413023115.47191-1-haiyue.wang@intel.com/mbox/",
    "series": [
        {
            "id": 9323,
            "url": "https://patches.dpdk.org/api/series/9323/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=9323",
            "date": "2020-04-13T02:31:15",
            "name": "[v1] eal: add VFIO-PCI SR-IOV support",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/9323/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/68237/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/68237/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 39D6EA0577;\n\tMon, 13 Apr 2020 04:39:39 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 9782B2A66;\n\tMon, 13 Apr 2020 04:39:38 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n by dpdk.org (Postfix) with ESMTP id 48D222986\n for <dev@dpdk.org>; Mon, 13 Apr 2020 04:39:36 +0200 (CEST)",
            "from fmsmga004.fm.intel.com ([10.253.24.48])\n by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 12 Apr 2020 19:39:34 -0700",
            "from npg-dpdk-haiyue-1.sh.intel.com ([10.67.119.213])\n by fmsmga004.fm.intel.com with ESMTP; 12 Apr 2020 19:39:32 -0700"
        ],
        "IronPort-SDR": [
            "\n vmHLQVcg/FQ1+66/41e3re1rc4KO0LdOdLPGC61wlSc4aS5AzC4ptW7nYo2yeG8Lpq1BlYyIKp\n T79HcfQAkXVw==",
            "\n B69td/YgHrfY30E+H4qdKv3KfSO3U/bQX5NUl2cCZbYJF7huCM//ad6sO8veEmjpB3u12n/Ae5\n rTiTuN/gBTLQ=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.72,377,1580803200\"; d=\"scan'208\";a=\"276769882\"",
        "From": "Haiyue Wang <haiyue.wang@intel.com>",
        "To": "dev@dpdk.org, thomas@monjalon.net, vattunuru@marvell.com,\n jerinj@marvell.com, alex.williamson@redhat.com, david.marchand@redhat.com",
        "Cc": "Haiyue Wang <haiyue.wang@intel.com>",
        "Date": "Mon, 13 Apr 2020 10:31:15 +0800",
        "Message-Id": "<20200413023115.47191-1-haiyue.wang@intel.com>",
        "X-Mailer": "git-send-email 2.26.0",
        "In-Reply-To": "<20200305043311.17065-1-vattunuru@marvell.com>",
        "References": "<20200305043311.17065-1-vattunuru@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v1] eal: add VFIO-PCI SR-IOV support",
        "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 <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 <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The kernel module vfio-pci introduces the VF token to enable SR-IOV\nsupport since 5.7.\n\nThe VF token can be set by a vfio-pci based PF driver and must be known\nby the vfio-pci based VF driver in order to gain access to the device.\n\nAn example VF token option would take this form:\n\n1. Install vfio-pci with option 'enable_sriov=1'\n\n2. ./usertools/dpdk-devbind.py -b vfio-pci 0000:87:00.0\n\n3. echo 2 > /sys/bus/pci/devices/0000:87:00.0/sriov_numvfs\n\n4. Start the PF:\n  ./x86_64-native-linux-gcc/app/testpmd -l 22-25 -n 4 \\\n         -w 87:00.0,vf_token=2ab74924-c335-45f4-9b16-8569e5b08258 \\\n         --file-prefix=pf -- -i\n\n5. Start the VF:\n   ./x86_64-native-linux-gcc/app/testpmd -l 26-29 -n 4 \\\n         -w 87:02.0,vf_token=2ab74924-c335-45f4-9b16-8569e5b08258 \\\n         --file-prefix=vf1 -- -i\n\nSigned-off-by: Haiyue Wang <haiyue.wang@intel.com>\nAcked-by: Vamsi Attunuru <vattunuru@marvell.com>\n---\nv1: Update the commit message.\n\nRFC v2: https://patchwork.dpdk.org/patch/68114/\n\t   Based on Vamsi's RFC v1, and Alex's patch for Qemu\n\t       [https://lore.kernel.org/lkml/20200204161737.34696b91@w520.home/]:\n\t   Use the devarg to pass-down the VF token.\n\nRFC v1: https://patchwork.dpdk.org/patch/66281/ by Vamsi.\n---\n drivers/bus/pci/linux/pci_vfio.c  | 56 +++++++++++++++++++++++++++++--\n lib/librte_eal/freebsd/eal.c      |  3 +-\n lib/librte_eal/include/rte_vfio.h |  8 ++++-\n lib/librte_eal/linux/eal_vfio.c   | 20 +++++++++--\n 4 files changed, 80 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c\nindex 64cd84a68..7f99337c7 100644\n--- a/drivers/bus/pci/linux/pci_vfio.c\n+++ b/drivers/bus/pci/linux/pci_vfio.c\n@@ -11,6 +11,7 @@\n #include <sys/mman.h>\n #include <stdbool.h>\n \n+#include <rte_devargs.h>\n #include <rte_log.h>\n #include <rte_pci.h>\n #include <rte_bus_pci.h>\n@@ -644,11 +645,59 @@ pci_vfio_msix_is_mappable(int vfio_dev_fd, int msix_region)\n \treturn ret;\n }\n \n+static void\n+vfio_pci_vf_token_arg(struct rte_devargs *devargs, rte_uuid_t uu)\n+{\n+#define VF_TOKEN_ARG \"vf_token=\"\n+\tchar c, *p, *vf_token;\n+\n+\tif (devargs == NULL)\n+\t\treturn;\n+\n+\tp = strstr(devargs->args, VF_TOKEN_ARG);\n+\tif (!p)\n+\t\treturn;\n+\n+\tvf_token = p + strlen(VF_TOKEN_ARG);\n+\tif (strlen(vf_token) < (RTE_UUID_STRLEN - 1))\n+\t\treturn;\n+\n+\tc = vf_token[RTE_UUID_STRLEN - 1];\n+\tif (c != '\\0' && c != ',')\n+\t\treturn;\n+\n+\tvf_token[RTE_UUID_STRLEN - 1] = '\\0';\n+\tif (rte_uuid_parse(vf_token, uu)) {\n+\t\tRTE_LOG(ERR, EAL,\n+\t\t\t\"The VF token is not a valid uuid : %s\\n\", vf_token);\n+\t\tvf_token[RTE_UUID_STRLEN - 1] = c;\n+\t\treturn;\n+\t}\n+\n+\tRTE_LOG(DEBUG, EAL,\n+\t\t\"The VF token is found : %s\\n\", vf_token);\n+\n+\tvf_token[RTE_UUID_STRLEN - 1] = c;\n+\n+\t/* Purge this vfio-pci specific token from the device arguments */\n+\tif (c != '\\0') {\n+\t\t/* 1. Handle the case : 'vf_token=uuid,arg1=val1' */\n+\t\tmemmove(p, vf_token + RTE_UUID_STRLEN,\n+\t\t\tstrlen(vf_token + RTE_UUID_STRLEN) + 1);\n+\t} else {\n+\t\t/* 2. Handle the case : 'arg1=val1,vf_token=uuid' */\n+\t\tif (p != devargs->args)\n+\t\t\tp--;\n+\n+\t\t*p = '\\0';\n+\t}\n+}\n \n static int\n pci_vfio_map_resource_primary(struct rte_pci_device *dev)\n {\n \tstruct vfio_device_info device_info = { .argsz = sizeof(device_info) };\n+\trte_uuid_t vf_token = RTE_UUID_INIT(0, 0, 0, 0, 0ULL);\n \tchar pci_addr[PATH_MAX] = {0};\n \tint vfio_dev_fd;\n \tstruct rte_pci_addr *loc = &dev->addr;\n@@ -668,8 +717,9 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev)\n \tsnprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,\n \t\t\tloc->domain, loc->bus, loc->devid, loc->function);\n \n+\tvfio_pci_vf_token_arg(dev->device.devargs, vf_token);\n \tret = rte_vfio_setup_device(rte_pci_get_sysfs_path(), pci_addr,\n-\t\t\t\t\t&vfio_dev_fd, &device_info);\n+\t\t\t\t\t&vfio_dev_fd, &device_info, vf_token);\n \tif (ret)\n \t\treturn ret;\n \n@@ -797,6 +847,7 @@ static int\n pci_vfio_map_resource_secondary(struct rte_pci_device *dev)\n {\n \tstruct vfio_device_info device_info = { .argsz = sizeof(device_info) };\n+\trte_uuid_t vf_token = RTE_UUID_INIT(0, 0, 0, 0, 0ULL);\n \tchar pci_addr[PATH_MAX] = {0};\n \tint vfio_dev_fd;\n \tstruct rte_pci_addr *loc = &dev->addr;\n@@ -830,8 +881,9 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev)\n \t\treturn -1;\n \t}\n \n+\tvfio_pci_vf_token_arg(dev->device.devargs, vf_token);\n \tret = rte_vfio_setup_device(rte_pci_get_sysfs_path(), pci_addr,\n-\t\t\t\t\t&vfio_dev_fd, &device_info);\n+\t\t\t\t\t&vfio_dev_fd, &device_info, vf_token);\n \tif (ret)\n \t\treturn ret;\n \ndiff --git a/lib/librte_eal/freebsd/eal.c b/lib/librte_eal/freebsd/eal.c\nindex 6ae37e7e6..cbb4c400e 100644\n--- a/lib/librte_eal/freebsd/eal.c\n+++ b/lib/librte_eal/freebsd/eal.c\n@@ -995,7 +995,8 @@ rte_eal_vfio_intr_mode(void)\n int rte_vfio_setup_device(__rte_unused const char *sysfs_base,\n \t\t      __rte_unused const char *dev_addr,\n \t\t      __rte_unused int *vfio_dev_fd,\n-\t\t      __rte_unused struct vfio_device_info *device_info)\n+\t\t      __rte_unused struct vfio_device_info *device_info\n+\t\t      __rte_unused rte_uuid_t vf_token)\n {\n \treturn -1;\n }\ndiff --git a/lib/librte_eal/include/rte_vfio.h b/lib/librte_eal/include/rte_vfio.h\nindex 20ed8c45a..1f9e22d82 100644\n--- a/lib/librte_eal/include/rte_vfio.h\n+++ b/lib/librte_eal/include/rte_vfio.h\n@@ -16,6 +16,8 @@ extern \"C\" {\n \n #include <stdint.h>\n \n+#include <rte_uuid.h>\n+\n /*\n  * determine if VFIO is present on the system\n  */\n@@ -102,13 +104,17 @@ struct vfio_device_info;\n  * @param device_info\n  *   Device information.\n  *\n+ * @param vf_token\n+ *   VF token.\n+ *\n  * @return\n  *   0 on success.\n  *   <0 on failure.\n  *   >1 if the device cannot be managed this way.\n  */\n int rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,\n-\t\tint *vfio_dev_fd, struct vfio_device_info *device_info);\n+\t\tint *vfio_dev_fd, struct vfio_device_info *device_info,\n+\t\trte_uuid_t vf_token);\n \n /**\n  * Release a device mapped to a VFIO-managed I/O MMU group.\ndiff --git a/lib/librte_eal/linux/eal_vfio.c b/lib/librte_eal/linux/eal_vfio.c\nindex 4502aefed..8c0ad04e5 100644\n--- a/lib/librte_eal/linux/eal_vfio.c\n+++ b/lib/librte_eal/linux/eal_vfio.c\n@@ -702,7 +702,8 @@ rte_vfio_clear_group(int vfio_group_fd)\n \n int\n rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,\n-\t\tint *vfio_dev_fd, struct vfio_device_info *device_info)\n+\t\tint *vfio_dev_fd, struct vfio_device_info *device_info,\n+\t\trte_uuid_t vf_token)\n {\n \tstruct vfio_group_status group_status = {\n \t\t\t.argsz = sizeof(group_status)\n@@ -712,6 +713,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,\n \tint vfio_container_fd;\n \tint vfio_group_fd;\n \tint iommu_group_num;\n+\tchar dev[PATH_MAX];\n \tint i, ret;\n \n \t/* get group number */\n@@ -895,8 +897,19 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,\n \t\t\t\tt->type_id, t->name);\n \t}\n \n+\tif (!rte_uuid_is_null(vf_token)) {\n+\t\tchar vf_token_str[RTE_UUID_STRLEN];\n+\n+\t\trte_uuid_unparse(vf_token, vf_token_str, sizeof(vf_token_str));\n+\t\tsnprintf(dev, sizeof(dev),\n+\t\t\t \"%s vf_token=%s\", dev_addr, vf_token_str);\n+\t} else {\n+\t\tsnprintf(dev, sizeof(dev),\n+\t\t\t \"%s\", dev_addr);\n+\t}\n+\n \t/* get a file descriptor for the device */\n-\t*vfio_dev_fd = ioctl(vfio_group_fd, VFIO_GROUP_GET_DEVICE_FD, dev_addr);\n+\t*vfio_dev_fd = ioctl(vfio_group_fd, VFIO_GROUP_GET_DEVICE_FD, dev);\n \tif (*vfio_dev_fd < 0) {\n \t\t/* if we cannot get a device fd, this implies a problem with\n \t\t * the VFIO group or the container not having IOMMU configured.\n@@ -2081,7 +2094,8 @@ int\n rte_vfio_setup_device(__rte_unused const char *sysfs_base,\n \t\t__rte_unused const char *dev_addr,\n \t\t__rte_unused int *vfio_dev_fd,\n-\t\t__rte_unused struct vfio_device_info *device_info)\n+\t\t__rte_unused struct vfio_device_info *device_info\n+\t\t__rte_unused rte_uuid_t vf_token)\n {\n \treturn -1;\n }\n",
    "prefixes": [
        "v1"
    ]
}