get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 56586,
    "url": "https://patches.dpdk.org/api/patches/56586/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20190717090408.13717-3-vattunuru@marvell.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": "<20190717090408.13717-3-vattunuru@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20190717090408.13717-3-vattunuru@marvell.com",
    "date": "2019-07-17T09:04:06",
    "name": "[v7,2/4] kni: add IOVA = VA support in KNI lib",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "1121e169f457efc3dccad41f953204fb420b8cd1",
    "submitter": {
        "id": 1277,
        "url": "https://patches.dpdk.org/api/people/1277/?format=api",
        "name": "Vamsi Krishna Attunuru",
        "email": "vattunuru@marvell.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20190717090408.13717-3-vattunuru@marvell.com/mbox/",
    "series": [
        {
            "id": 5556,
            "url": "https://patches.dpdk.org/api/series/5556/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=5556",
            "date": "2019-07-17T09:04:04",
            "name": "kni: add IOVA=VA support",
            "version": 7,
            "mbox": "https://patches.dpdk.org/series/5556/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/56586/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/56586/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 33FB92BBE;\n\tWed, 17 Jul 2019 11:05:03 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n\t[67.231.148.174]) by dpdk.org (Postfix) with ESMTP id 5F4352082\n\tfor <dev@dpdk.org>; Wed, 17 Jul 2019 11:05:01 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n\tby mx0a-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id\n\tx6H94wtj030026; Wed, 17 Jul 2019 02:04:58 -0700",
            "from sc-exch04.marvell.com ([199.233.58.184])\n\tby mx0a-0016f401.pphosted.com with ESMTP id 2ts07vfg9p-2\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); \n\tWed, 17 Jul 2019 02:04:58 -0700",
            "from SC-EXCH01.marvell.com (10.93.176.81) by SC-EXCH04.marvell.com\n\t(10.93.176.84) with Microsoft SMTP Server (TLS) id 15.0.1367.3;\n\tWed, 17 Jul 2019 02:04:55 -0700",
            "from maili.marvell.com (10.93.176.43) by SC-EXCH01.marvell.com\n\t(10.93.176.81) with Microsoft SMTP Server id 15.0.1367.3 via Frontend\n\tTransport; Wed, 17 Jul 2019 02:04:55 -0700",
            "from hyd1vattunuru-dt.caveonetworks.com (unknown [10.29.52.72])\n\tby maili.marvell.com (Postfix) with ESMTP id 169DD3F703F;\n\tWed, 17 Jul 2019 02:04:52 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n\th=from : to : cc :\n\tsubject : date : message-id : in-reply-to : references : mime-version\n\t: content-type; s=pfpt0818;\n\tbh=m2znQ6SI8vJMqKSUjM2FNii3DlSWYj9Rxf257Ax4Z9E=; \n\tb=kQOARILgT6YqT1dOvzQ6fLjoEKuwYhXXao10VCa21HYe8WNBpMSzwDjC0iBBMimo6hd4\n\tKPcTpGfGtc7wtysDPF+/xa637XDsuLaobTUqCtM70+uk8zGYkHqKxopZuwhujHpBhoM9\n\tHSbInKA9SAPidlrDgWqJDCLFjRnft8/yi12lDcBmqreMm37orJTkTk6RZrpK1WVCyf4q\n\t6FqLt2LQwv9RVcd2JYb5qxqbgrRzR8xktX7N0Rk9nCwsSs3/hYZQDjZqtcrl+6iX14Kb\n\tWAH12lgrSsWUu07sDDIT1uNiUMHolxNc9f+9Dl9GqgEti7SAGAkvTtP5Fkc82PHKyOsh\n\t7A== ",
        "From": "<vattunuru@marvell.com>",
        "To": "<dev@dpdk.org>",
        "CC": "<thomas@monjalon.net>, <jerinj@marvell.com>, <olivier.matz@6wind.com>,\n\t<ferruh.yigit@intel.com>, <anatoly.burakov@intel.com>,\n\t<kirankumark@marvell.com>, Vamsi Attunuru <vattunuru@marvell.com>",
        "Date": "Wed, 17 Jul 2019 14:34:06 +0530",
        "Message-ID": "<20190717090408.13717-3-vattunuru@marvell.com>",
        "X-Mailer": "git-send-email 2.8.4",
        "In-Reply-To": "<20190717090408.13717-1-vattunuru@marvell.com>",
        "References": "<20190625035700.2953-1-vattunuru@marvell.com>\n\t<20190717090408.13717-1-vattunuru@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Proofpoint-Virus-Version": "vendor=fsecure engine=2.50.10434:5.22.84,1.0.8\n\tdefinitions=2019-07-17_03:2019-07-16,2019-07-17 signatures=0",
        "Subject": "[dpdk-dev] [PATCH v7 2/4] kni: add IOVA = VA support in KNI lib",
        "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": "From: Vamsi Attunuru <vattunuru@marvell.com>\n\nCurrent KNI implmentation only operates in IOVA=PA mode, patch adds\nrequired functionality in KNI lib to support IOVA=VA mode.\n\nKNI kernel module requires device info to get iommu domain related\ninformation for IOVA addr related translations. Patch defines device\nrelated info in rte_kni_device_info struct and passes device info to\nkernel KNI module when IOVA=VA mode is enabled.\n\nSigned-off-by: Vamsi Attunuru <vattunuru@marvell.com>\nSigned-off-by: Kiran Kumar K <kirankumark@marvell.com>\n---\n lib/librte_eal/linux/eal/include/rte_kni_common.h |  8 ++++\n lib/librte_kni/Makefile                           |  1 +\n lib/librte_kni/meson.build                        |  1 +\n lib/librte_kni/rte_kni.c                          | 54 +++++++++++++++++++++++\n 4 files changed, 64 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/linux/eal/include/rte_kni_common.h b/lib/librte_eal/linux/eal/include/rte_kni_common.h\nindex 37d9ee8..4fd8a90 100644\n--- a/lib/librte_eal/linux/eal/include/rte_kni_common.h\n+++ b/lib/librte_eal/linux/eal/include/rte_kni_common.h\n@@ -111,6 +111,13 @@ struct rte_kni_device_info {\n \tvoid * mbuf_va;\n \tphys_addr_t mbuf_phys;\n \n+\t/* PCI info */\n+\tuint16_t vendor_id;           /**< Vendor ID or PCI_ANY_ID. */\n+\tuint16_t device_id;           /**< Device ID or PCI_ANY_ID. */\n+\tuint8_t bus;                  /**< Device bus */\n+\tuint8_t devid;                /**< Device ID */\n+\tuint8_t function;             /**< Device function. */\n+\n \tuint16_t group_id;            /**< Group ID */\n \tuint32_t core_id;             /**< core ID to bind for kernel thread */\n \n@@ -121,6 +128,7 @@ struct rte_kni_device_info {\n \tunsigned mbuf_size;\n \tunsigned int mtu;\n \tuint8_t mac_addr[6];\n+\tuint8_t iova_mode;\n };\n \n #define KNI_DEVICE \"kni\"\ndiff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile\nindex cbd6599..ab15d10 100644\n--- a/lib/librte_kni/Makefile\n+++ b/lib/librte_kni/Makefile\n@@ -7,6 +7,7 @@ include $(RTE_SDK)/mk/rte.vars.mk\n LIB = librte_kni.a\n \n CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing\n+CFLAGS += -I$(RTE_SDK)/drivers/bus/pci\n LDLIBS += -lrte_eal -lrte_mempool -lrte_mbuf -lrte_ethdev\n \n EXPORT_MAP := rte_kni_version.map\ndiff --git a/lib/librte_kni/meson.build b/lib/librte_kni/meson.build\nindex 41fa2e3..fd46f87 100644\n--- a/lib/librte_kni/meson.build\n+++ b/lib/librte_kni/meson.build\n@@ -9,3 +9,4 @@ version = 2\n sources = files('rte_kni.c')\n headers = files('rte_kni.h')\n deps += ['ethdev', 'pci']\n+includes += include_directories('../../drivers/bus/pci')\ndiff --git a/lib/librte_kni/rte_kni.c b/lib/librte_kni/rte_kni.c\nindex 4b51fb4..2cb653e 100644\n--- a/lib/librte_kni/rte_kni.c\n+++ b/lib/librte_kni/rte_kni.c\n@@ -14,6 +14,7 @@\n #include <rte_spinlock.h>\n #include <rte_string_fns.h>\n #include <rte_ethdev.h>\n+#include <rte_bus_pci.h>\n #include <rte_malloc.h>\n #include <rte_log.h>\n #include <rte_kni.h>\n@@ -199,6 +200,26 @@ kni_release_mz(struct rte_kni *kni)\n \trte_memzone_free(kni->m_sync_addr);\n }\n \n+static void\n+kni_dev_pci_addr_get(struct rte_pci_addr *addr,\n+\t\t    struct rte_pci_id *id, uint16_t port_id)\n+{\n+\tconst struct rte_pci_device *pci_dev;\n+\tconst struct rte_bus *bus = NULL;\n+\tstruct rte_eth_dev_info dev_info;\n+\n+\tmemset(&dev_info, 0, sizeof(dev_info));\n+\trte_eth_dev_info_get(port_id, &dev_info);\n+\n+\tif (dev_info.device)\n+\t\tbus = rte_bus_find_by_device(dev_info.device);\n+\tif (bus && !strcmp(bus->name, \"pci\")) {\n+\t\tpci_dev = RTE_DEV_TO_PCI(dev_info.device);\n+\t\t*addr = pci_dev->addr;\n+\t\t*id = pci_dev->id;\n+\t}\n+}\n+\n struct rte_kni *\n rte_kni_alloc(struct rte_mempool *pktmbuf_pool,\n \t      const struct rte_kni_conf *conf,\n@@ -247,6 +268,37 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,\n \t\tkni->ops.port_id = UINT16_MAX;\n \n \tmemset(&dev_info, 0, sizeof(dev_info));\n+\n+\tif (rte_eal_iova_mode() == RTE_IOVA_VA) {\n+\t\tuint64_t page_sz = pktmbuf_pool->mz->hugepage_sz;\n+\t\tuint16_t port_id = conf->group_id;\n+\t\tstruct rte_pci_addr addr = { 0 };\n+\t\tstruct rte_pci_id id = { 0 };\n+\t\tsize_t buf_sz;\n+\n+\t\tkni_dev_pci_addr_get(&addr, &id, port_id);\n+\t\tdev_info.bus = addr.bus;\n+\t\tdev_info.devid = addr.devid;\n+\t\tdev_info.function = addr.function;\n+\t\tdev_info.vendor_id = id.vendor_id;\n+\t\tdev_info.device_id = id.device_id;\n+\n+\t\tbuf_sz = pktmbuf_pool->header_size + pktmbuf_pool->elt_size +\n+\t\t\t pktmbuf_pool->trailer_size;\n+\n+\t\t/* Return failure when mbuf size is bigger than page size,\n+\t\t * because phys address of those mbuf might not be physically\n+\t\t * contiguous and KNI kernal module can not translate those\n+\t\t * mbuf's IOVA addresses.\n+\t\t */\n+\t\tif (buf_sz > page_sz) {\n+\t\t\tRTE_LOG(ERR, KNI,\n+\t\t\t\t\"KNI does not work in IOVA=VA mode when mbuf_sz > page_sz\\n\");\n+\t\t\tRTE_LOG(ERR, KNI, \"buf_sz:0x%\" PRIx64 \" > \", buf_sz);\n+\t\t\tRTE_LOG(ERR, KNI, \"page_sz:0x%\" PRIx64 \"\\n\", page_sz);\n+\t\t\tgoto kni_fail;\n+\t\t}\n+\t}\n \tdev_info.core_id = conf->core_id;\n \tdev_info.force_bind = conf->force_bind;\n \tdev_info.group_id = conf->group_id;\n@@ -300,6 +352,8 @@ rte_kni_alloc(struct rte_mempool *pktmbuf_pool,\n \tkni->group_id = conf->group_id;\n \tkni->mbuf_size = conf->mbuf_size;\n \n+\tdev_info.iova_mode = (rte_eal_iova_mode() == RTE_IOVA_VA) ? 1 : 0;\n+\n \tret = ioctl(kni_fd, RTE_KNI_IOCTL_CREATE, &dev_info);\n \tif (ret < 0)\n \t\tgoto ioctl_fail;\n",
    "prefixes": [
        "v7",
        "2/4"
    ]
}