get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 42742,
    "url": "http://patches.dpdk.org/api/patches/42742/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1531243552-7795-2-git-send-email-alejandro.lucero@netronome.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": "<1531243552-7795-2-git-send-email-alejandro.lucero@netronome.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1531243552-7795-2-git-send-email-alejandro.lucero@netronome.com",
    "date": "2018-07-10T17:25:48",
    "name": "[v4,1/5] mem: add function for checking memsegs IOVAs addresses",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "8343dddf30e1159ecf2bb17bed6fad6f2c726fa0",
    "submitter": {
        "id": 270,
        "url": "http://patches.dpdk.org/api/people/270/?format=api",
        "name": "Alejandro Lucero",
        "email": "alejandro.lucero@netronome.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/1531243552-7795-2-git-send-email-alejandro.lucero@netronome.com/mbox/",
    "series": [
        {
            "id": 503,
            "url": "http://patches.dpdk.org/api/series/503/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=503",
            "date": "2018-07-10T17:25:47",
            "name": "use IOVAs check based on DMA mask",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/503/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/42742/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/42742/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 68C971B438;\n\tTue, 10 Jul 2018 19:26:09 +0200 (CEST)",
            "from netronome.com (host-79-78-33-110.static.as9105.net\n\t[79.78.33.110]) by dpdk.org (Postfix) with ESMTP id 858361B3AE;\n\tTue, 10 Jul 2018 19:26:06 +0200 (CEST)",
            "from netronome.com (localhost [127.0.0.1])\n\tby netronome.com (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id\n\tw6AHPuxC007842; Tue, 10 Jul 2018 18:25:56 +0100",
            "(from alucero@localhost)\n\tby netronome.com (8.14.4/8.14.4/Submit) id w6AHPuvs007841;\n\tTue, 10 Jul 2018 18:25:56 +0100"
        ],
        "From": "Alejandro Lucero <alejandro.lucero@netronome.com>",
        "To": "dev@dpdk.org",
        "Cc": "stable@dpdk.org, anatoly.burakov@intel.com",
        "Date": "Tue, 10 Jul 2018 18:25:48 +0100",
        "Message-Id": "<1531243552-7795-2-git-send-email-alejandro.lucero@netronome.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1531243552-7795-1-git-send-email-alejandro.lucero@netronome.com>",
        "References": "<1531243552-7795-1-git-send-email-alejandro.lucero@netronome.com>",
        "Subject": "[dpdk-dev] [PATCH v4 1/5] mem: add function for checking memsegs\n\tIOVAs addresses",
        "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": "A device can suffer addressing limitations. This functions checks\nmemsegs have iovas within the supported range based on dma mask.\n\nPMD should use this during initialization if supported devices\nsuffer addressing limitations, returning an error if this function\nreturns memsegs out of range.\n\nAnother potential usage is for emulated IOMMU hardware with addressing\nlimitations.\n\nApplicable to v17.11.3 only.\n\nSigned-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n lib/librte_eal/common/eal_common_memory.c  | 48 ++++++++++++++++++++++++++++++\n lib/librte_eal/common/include/rte_memory.h |  3 ++\n lib/librte_eal/rte_eal_version.map         |  1 +\n 3 files changed, 52 insertions(+)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_memory.c b/lib/librte_eal/common/eal_common_memory.c\nindex fc6c44d..00ab393 100644\n--- a/lib/librte_eal/common/eal_common_memory.c\n+++ b/lib/librte_eal/common/eal_common_memory.c\n@@ -109,6 +109,54 @@\n \t}\n }\n \n+#if defined(RTE_ARCH_X86)\n+#define X86_VA_WIDTH 47 /* From Documentation/x86/x86_64/mm.txt */\n+#define MAX_DMA_MASK_BITS X86_VA_WIDTH\n+#else\n+/* 63 bits is good enough for a sanity check */\n+#define MAX_DMA_MASK_BITS 63\n+#endif\n+\n+/* check memseg iovas are within the required range based on dma mask */\n+int\n+rte_eal_check_dma_mask(uint8_t maskbits)\n+{\n+\n+\tconst struct rte_mem_config *mcfg;\n+\tuint64_t mask;\n+\tint i;\n+\n+\t/* sanity check */\n+\tif (maskbits > MAX_DMA_MASK_BITS) {\n+\t\tRTE_LOG(INFO, EAL, \"wrong dma mask size %u (Max: %u)\\n\",\n+\t\t\t\t   maskbits, MAX_DMA_MASK_BITS);\n+\t\treturn -1;\n+\t}\n+\n+\t/* create dma mask */\n+\tmask = ~((1ULL << maskbits) - 1);\n+\n+\t/* get pointer to global configuration */\n+\tmcfg = rte_eal_get_configuration()->mem_config;\n+\n+\tfor (i = 0; i < RTE_MAX_MEMSEG; i++) {\n+\t\tif (mcfg->memseg[i].addr == NULL)\n+\t\t\tbreak;\n+\n+\t\tif (mcfg->memseg[i].iova & mask) {\n+\t\t\tRTE_LOG(INFO, EAL,\n+\t\t\t\t\"memseg[%d] iova %\"PRIx64\" out of range:\\n\",\n+\t\t\t\ti, mcfg->memseg[i].iova);\n+\n+\t\t\tRTE_LOG(INFO, EAL, \"\\tusing dma mask %\"PRIx64\"\\n\",\n+\t\t\t\tmask);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n /* return the number of memory channels */\n unsigned rte_memory_get_nchannel(void)\n {\ndiff --git a/lib/librte_eal/common/include/rte_memory.h b/lib/librte_eal/common/include/rte_memory.h\nindex 80a8fc0..b2a0168 100644\n--- a/lib/librte_eal/common/include/rte_memory.h\n+++ b/lib/librte_eal/common/include/rte_memory.h\n@@ -209,6 +209,9 @@ struct rte_memseg {\n  */\n unsigned rte_memory_get_nrank(void);\n \n+/* check memsegs iovas are within a range based on dma mask */\n+int rte_eal_check_dma_mask(uint8_t maskbits);\n+\n /**\n  * Drivers based on uio will not load unless physical\n  * addresses are obtainable. It is only possible to get\ndiff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map\nindex f4f46c1..aa6cf87 100644\n--- a/lib/librte_eal/rte_eal_version.map\n+++ b/lib/librte_eal/rte_eal_version.map\n@@ -184,6 +184,7 @@ DPDK_17.11 {\n \n \trte_eal_create_uio_dev;\n \trte_bus_get_iommu_class;\n+\trte_eal_check_dma_mask;\n \trte_eal_has_pci;\n \trte_eal_iova_mode;\n \trte_eal_mbuf_default_mempool_ops;\n",
    "prefixes": [
        "v4",
        "1/5"
    ]
}