get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52253,
    "url": "http://patches.dpdk.org/api/patches/52253/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/3ea665747b4eba6f682a82e2f592e79642f02c39.1554354506.git.shahafs@mellanox.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": "<3ea665747b4eba6f682a82e2f592e79642f02c39.1554354506.git.shahafs@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/3ea665747b4eba6f682a82e2f592e79642f02c39.1554354506.git.shahafs@mellanox.com",
    "date": "2019-04-04T05:14:43",
    "name": "[v2,3/3] app/testpmd: map anonymous memory for eth devices",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "b6818e33d7c701d937b9323e74e1606ca0789454",
    "submitter": {
        "id": 634,
        "url": "http://patches.dpdk.org/api/people/634/?format=api",
        "name": "Shahaf Shuler",
        "email": "shahafs@mellanox.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/3ea665747b4eba6f682a82e2f592e79642f02c39.1554354506.git.shahafs@mellanox.com/mbox/",
    "series": [
        {
            "id": 4104,
            "url": "http://patches.dpdk.org/api/series/4104/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4104",
            "date": "2019-04-04T05:14:43",
            "name": "DMA map anonymous memory to eth devices",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/4104/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52253/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/52253/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 908C64C96;\n\tThu,  4 Apr 2019 07:14:57 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id 647074C95\n\tfor <dev@dpdk.org>; Thu,  4 Apr 2019 07:14:55 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tshahafs@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 4 Apr 2019 08:14:50 +0300",
            "from unicorn01.mtl.labs.mlnx. (unicorn01.mtl.labs.mlnx\n\t[10.7.12.62])\n\tby labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x345Eogm010614;\n\tThu, 4 Apr 2019 08:14:50 +0300"
        ],
        "From": "Shahaf Shuler <shahafs@mellanox.com>",
        "To": "wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com",
        "Cc": "dev@dpdk.org, rasland@mellanox.com, thomas@monjalon.net,\n\tferruh.yigit@intel.com",
        "Date": "Thu,  4 Apr 2019 08:14:43 +0300",
        "Message-Id": "<3ea665747b4eba6f682a82e2f592e79642f02c39.1554354506.git.shahafs@mellanox.com>",
        "X-Mailer": "git-send-email 2.12.0",
        "In-Reply-To": "<cover.1554354506.git.shahafs@mellanox.com>",
        "References": "<cover.1554114165.git.shahafs@mellanox.com>\n\t<cover.1554354506.git.shahafs@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v2 3/3] app/testpmd: map anonymous memory for eth\n\tdevices",
        "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": "Mempools can be populated with anonymous memory when using command line\nparameter --mp-alloc=anon.\n\nConsidering the mempools are going to be used by the net devices,\nit is better to DMA map this memory.\n\nThis patch add such mapping now that we have the APIs in place[1].\n\n[1] commit c33a675b6276 (\"bus: introduce device level DMA memory mapping\")\n\nSigned-off-by: Shahaf Shuler <shahafs@mellanox.com>\n---\n app/test-pmd/testpmd.c | 65 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 65 insertions(+)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex dd449a9859..3ad111a143 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -834,6 +834,63 @@ setup_extmem(uint32_t nb_mbufs, uint32_t mbuf_sz, bool huge)\n \n \treturn 0;\n }\n+static void\n+dma_unmap_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,\n+\t     struct rte_mempool_memhdr *memhdr, unsigned mem_idx __rte_unused)\n+{\n+\tuint16_t pid = 0;\n+\tint ret;\n+\n+\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\tstruct rte_eth_dev *dev =\n+\t\t\t&rte_eth_devices[pid];\n+\n+\t\tret = rte_dev_dma_unmap(dev->device, memhdr->addr, 0,\n+\t\t\t\t\tmemhdr->len);\n+\t\tif (ret) {\n+\t\t\tTESTPMD_LOG(DEBUG,\n+\t\t\t\t    \"unable to DMA unmap addr 0x%p \"\n+\t\t\t\t    \"for device %s\\n\",\n+\t\t\t\t    memhdr->addr, dev->data->name);\n+\t\t}\n+\t}\n+\tret = rte_extmem_unregister(memhdr->addr, memhdr->len);\n+\tif (ret) {\n+\t\tTESTPMD_LOG(DEBUG,\n+\t\t\t    \"unable to un-register addr 0x%p\\n\", memhdr->addr);\n+\t\treturn;\n+\t}\n+}\n+\n+static void\n+dma_map_cb(struct rte_mempool *mp __rte_unused, void *opaque __rte_unused,\n+\t   struct rte_mempool_memhdr *memhdr, unsigned mem_idx __rte_unused)\n+{\n+\tuint16_t pid = 0;\n+\tsize_t page_size = sysconf(_SC_PAGESIZE);\n+\tint ret;\n+\n+\tret = rte_extmem_register(memhdr->addr, memhdr->len, NULL, 0,\n+\t\t\t\t  page_size);\n+\tif (ret) {\n+\t\tTESTPMD_LOG(DEBUG,\n+\t\t\t    \"unable to register addr 0x%p\\n\", memhdr->addr);\n+\t\treturn;\n+\t}\n+\tRTE_ETH_FOREACH_DEV(pid) {\n+\t\tstruct rte_eth_dev *dev =\n+\t\t\t&rte_eth_devices[pid];\n+\n+\t\tret = rte_dev_dma_map(dev->device, memhdr->addr, 0,\n+\t\t\t\t      memhdr->len);\n+\t\tif (ret) {\n+\t\t\tTESTPMD_LOG(DEBUG,\n+\t\t\t\t    \"unable to DMA map addr 0x%p \"\n+\t\t\t\t    \"for device %s\\n\",\n+\t\t\t\t    memhdr->addr, dev->data->name);\n+\t\t}\n+\t}\n+}\n \n /*\n  * Configuration initialisation done once at init time.\n@@ -879,6 +936,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf,\n \t\t\t}\n \t\t\trte_pktmbuf_pool_init(rte_mp, NULL);\n \t\t\trte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL);\n+\t\t\trte_mempool_mem_iter(rte_mp, dma_map_cb, NULL);\n \t\t\tbreak;\n \t\t}\n \tcase MP_ALLOC_XMEM:\n@@ -2410,6 +2468,13 @@ pmd_test_exit(void)\n \tif (test_done == 0)\n \t\tstop_packet_forwarding();\n \n+\tfor (i = 0 ; i < RTE_MAX_NUMA_NODES ; i++) {\n+\t\tif (mempools[i]) {\n+\t\t\tif (mp_alloc_type == MP_ALLOC_ANON)\n+\t\t\t\trte_mempool_mem_iter(mempools[i], dma_unmap_cb,\n+\t\t\t\t\t\t     NULL);\n+\t\t}\n+\t}\n \tif (ports != NULL) {\n \t\tno_link_check = 1;\n \t\tRTE_ETH_FOREACH_DEV(pt_id) {\n",
    "prefixes": [
        "v2",
        "3/3"
    ]
}