get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 52375,
    "url": "http://patches.dpdk.org/api/patches/52375/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/d125dec9668393b662e345cde51c6fa4a356158b.1554613242.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": "<d125dec9668393b662e345cde51c6fa4a356158b.1554613242.git.shahafs@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/d125dec9668393b662e345cde51c6fa4a356158b.1554613242.git.shahafs@mellanox.com",
    "date": "2019-04-07T05:02:26",
    "name": "[v4,3/3] app/testpmd: map anonymous memory for eth devices",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "225f6c26d4162318bd2a6692f3af89a0fb956a96",
    "submitter": {
        "id": 634,
        "url": "http://patches.dpdk.org/api/people/634/?format=api",
        "name": "Shahaf Shuler",
        "email": "shahafs@mellanox.com"
    },
    "delegate": {
        "id": 319,
        "url": "http://patches.dpdk.org/api/users/319/?format=api",
        "username": "fyigit",
        "first_name": "Ferruh",
        "last_name": "Yigit",
        "email": "ferruh.yigit@amd.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/d125dec9668393b662e345cde51c6fa4a356158b.1554613242.git.shahafs@mellanox.com/mbox/",
    "series": [
        {
            "id": 4153,
            "url": "http://patches.dpdk.org/api/series/4153/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=4153",
            "date": "2019-04-07T05:02:23",
            "name": "DMA map anonymous memory to eth devices",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/4153/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/52375/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/52375/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 D6B284F91;\n\tSun,  7 Apr 2019 07:02:57 +0200 (CEST)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n\tby dpdk.org (Postfix) with ESMTP id 35A052E8F\n\tfor <dev@dpdk.org>; Sun,  7 Apr 2019 07:02:44 +0200 (CEST)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n\tshahafs@mellanox.com)\n\twith ESMTPS (AES256-SHA encrypted); 7 Apr 2019 08:02:36 +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 x3752Zb3016030;\n\tSun, 7 Apr 2019 08:02:36 +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": "Sun,  7 Apr 2019 08:02:26 +0300",
        "Message-Id": "<d125dec9668393b662e345cde51c6fa4a356158b.1554613242.git.shahafs@mellanox.com>",
        "X-Mailer": "git-send-email 2.12.0",
        "In-Reply-To": "<cover.1554613242.git.shahafs@mellanox.com>",
        "References": "<cover.1554406293.git.shahafs@mellanox.com>\n\t<cover.1554613242.git.shahafs@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v4 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>\nAcked-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n app/test-pmd/testpmd.c | 64 +++++++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 64 insertions(+)",
    "diff": "diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 3b5ef0b6c1..2e99d99e12 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -834,6 +834,62 @@ 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}\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 +935,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@@ -2407,6 +2464,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": [
        "v4",
        "3/3"
    ]
}