get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 64628,
    "url": "http://patches.dpdk.org/api/patches/64628/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1578993305-15165-4-git-send-email-viacheslavo@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": "<1578993305-15165-4-git-send-email-viacheslavo@mellanox.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1578993305-15165-4-git-send-email-viacheslavo@mellanox.com",
    "date": "2020-01-14T09:15:04",
    "name": "[v3,3/4] app/testpmd: add mempool with external data buffers",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "3d8b3974ca1ede33cee9376d964567677b4accd7",
    "submitter": {
        "id": 1102,
        "url": "http://patches.dpdk.org/api/people/1102/?format=api",
        "name": "Slava Ovsiienko",
        "email": "viacheslavo@mellanox.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/1578993305-15165-4-git-send-email-viacheslavo@mellanox.com/mbox/",
    "series": [
        {
            "id": 8105,
            "url": "http://patches.dpdk.org/api/series/8105/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=8105",
            "date": "2020-01-14T09:15:01",
            "name": "mbuf: detach mbuf with pinned external buffer",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/8105/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/64628/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/64628/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 60949A04FD;\n\tTue, 14 Jan 2020 10:15:32 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id E95C81C2A3;\n\tTue, 14 Jan 2020 10:15:20 +0100 (CET)",
            "from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129])\n by dpdk.org (Postfix) with ESMTP id E8FBA1C2A2\n for <dev@dpdk.org>; Tue, 14 Jan 2020 10:15:19 +0100 (CET)",
            "from Internal Mail-Server by MTLPINE1 (envelope-from\n viacheslavo@mellanox.com)\n with ESMTPS (AES256-SHA encrypted); 14 Jan 2020 11:15:16 +0200",
            "from pegasus11.mtr.labs.mlnx (pegasus11.mtr.labs.mlnx\n [10.210.16.104])\n by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00E9FGRZ027368;\n Tue, 14 Jan 2020 11:15:16 +0200",
            "from pegasus11.mtr.labs.mlnx (localhost [127.0.0.1])\n by pegasus11.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id 00E9FGfv015228;\n Tue, 14 Jan 2020 09:15:16 GMT",
            "(from viacheslavo@localhost)\n by pegasus11.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id 00E9FG0l015227;\n Tue, 14 Jan 2020 09:15:16 GMT"
        ],
        "X-Authentication-Warning": "pegasus11.mtr.labs.mlnx: viacheslavo set sender to\n viacheslavo@mellanox.com using -f",
        "From": "Viacheslav Ovsiienko <viacheslavo@mellanox.com>",
        "To": "dev@dpdk.org",
        "Cc": "matan@mellanox.com, rasland@mellanox.com, orika@mellanox.com,\n shahafs@mellanox.com, olivier.matz@6wind.com, stephen@networkplumber.org",
        "Date": "Tue, 14 Jan 2020 09:15:04 +0000",
        "Message-Id": "<1578993305-15165-4-git-send-email-viacheslavo@mellanox.com>",
        "X-Mailer": "git-send-email 1.8.3.1",
        "In-Reply-To": "<1578993305-15165-1-git-send-email-viacheslavo@mellanox.com>",
        "References": "<20191118094938.192850-1-shahafs@mellanox.com>\n <1578993305-15165-1-git-send-email-viacheslavo@mellanox.com>",
        "Subject": "[dpdk-dev] [PATCH v3 3/4] app/testpmd: add mempool with external\n\tdata buffers",
        "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 new mbuf pool type is added to testpmd. To engage the\nmbuf pool with externally attached data buffers the parameter\n\"--mp-alloc=xbuf\" should be specified in testpmd command line.\n\nThe objective of this patch is just to test whether mbuf pool\nwith externally attached data buffers works OK. The memory for\ndata buffers is allocated from DPDK memory, so this is not\n\"true\" external memory from some physical device (this is\nsupposed the most common use case for such kind of mbuf pool).\n\nThe user should be aware that not all drivers support the mbuf\nwith EXT_ATTACHED_BUF flags set in newly allocated mbuf (many\nPMDs just overwrite ol_flags field and flag value is getting\nlost).\n\nSigned-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>\n---\n app/test-pmd/config.c     |  2 ++\n app/test-pmd/flowgen.c    |  3 +-\n app/test-pmd/parameters.c |  2 ++\n app/test-pmd/testpmd.c    | 81 +++++++++++++++++++++++++++++++++++++++++++++++\n app/test-pmd/testpmd.h    |  4 ++-\n app/test-pmd/txonly.c     |  3 +-\n 6 files changed, 92 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c\nindex 9da1ffb..5c6fe18 100644\n--- a/app/test-pmd/config.c\n+++ b/app/test-pmd/config.c\n@@ -2395,6 +2395,8 @@ struct igb_ring_desc_16_bytes {\n \t\treturn \"xmem\";\n \tcase MP_ALLOC_XMEM_HUGE:\n \t\treturn \"xmemhuge\";\n+\tcase MP_ALLOC_XBUF:\n+\t\treturn \"xbuf\";\n \tdefault:\n \t\treturn \"invalid\";\n \t}\ndiff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c\nindex 03b72aa..ae50cdc 100644\n--- a/app/test-pmd/flowgen.c\n+++ b/app/test-pmd/flowgen.c\n@@ -199,7 +199,8 @@\n \t\t\t\t\t\t\t   sizeof(*ip_hdr));\n \t\tpkt->nb_segs\t\t= 1;\n \t\tpkt->pkt_len\t\t= pkt_size;\n-\t\tpkt->ol_flags\t\t= ol_flags;\n+\t\tpkt->ol_flags\t\t&= EXT_ATTACHED_MBUF;\n+\t\tpkt->ol_flags\t\t|= ol_flags;\n \t\tpkt->vlan_tci\t\t= vlan_tci;\n \t\tpkt->vlan_tci_outer\t= vlan_tci_outer;\n \t\tpkt->l2_len\t\t= sizeof(struct rte_ether_hdr);\ndiff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c\nindex 2e7a504..6340104 100644\n--- a/app/test-pmd/parameters.c\n+++ b/app/test-pmd/parameters.c\n@@ -841,6 +841,8 @@\n \t\t\t\t\tmp_alloc_type = MP_ALLOC_XMEM;\n \t\t\t\telse if (!strcmp(optarg, \"xmemhuge\"))\n \t\t\t\t\tmp_alloc_type = MP_ALLOC_XMEM_HUGE;\n+\t\t\t\telse if (!strcmp(optarg, \"xbuf\"))\n+\t\t\t\t\tmp_alloc_type = MP_ALLOC_XBUF;\n \t\t\t\telse\n \t\t\t\t\trte_exit(EXIT_FAILURE,\n \t\t\t\t\t\t\"mp-alloc %s invalid - must be: \"\ndiff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c\nindex 2eec8af..5f910ba 100644\n--- a/app/test-pmd/testpmd.c\n+++ b/app/test-pmd/testpmd.c\n@@ -78,6 +78,7 @@\n #endif\n \n #define EXTMEM_HEAP_NAME \"extmem\"\n+#define EXTBUF_ZONE_SIZE RTE_PGSIZE_2M\n \n uint16_t verbose_level = 0; /**< Silent by default. */\n int testpmd_logtype; /**< Log type for testpmd logs */\n@@ -865,6 +866,66 @@ struct extmem_param {\n \t}\n }\n \n+static unsigned int\n+setup_extbuf(uint32_t nb_mbufs, uint16_t mbuf_sz, unsigned int socket_id,\n+\t    char *pool_name, struct rte_pktmbuf_extmem **ext_mem)\n+{\n+\tstruct rte_pktmbuf_extmem *xmem;\n+\tunsigned int ext_num, zone_num, elt_num;\n+\tuint16_t elt_size;\n+\n+\telt_size = RTE_ALIGN_CEIL(mbuf_sz, RTE_CACHE_LINE_SIZE);\n+\telt_num = EXTBUF_ZONE_SIZE / elt_size;\n+\tzone_num = (nb_mbufs + elt_num - 1) / elt_num;\n+\n+\txmem = malloc(sizeof(struct rte_pktmbuf_extmem) * zone_num);\n+\tif (xmem == NULL) {\n+\t\tTESTPMD_LOG(ERR, \"Cannot allocate memory for \"\n+\t\t\t\t \"external buffer descriptors\\n\");\n+\t\t*ext_mem = NULL;\n+\t\treturn 0;\n+\t}\n+\tfor (ext_num = 0; ext_num < zone_num; ext_num++) {\n+\t\tstruct rte_pktmbuf_extmem *xseg = xmem + ext_num;\n+\t\tconst struct rte_memzone *mz;\n+\t\tchar mz_name[RTE_MEMZONE_NAMESIZE];\n+\t\tint ret;\n+\n+\t\tret = snprintf(mz_name, sizeof(mz_name),\n+\t\t\tRTE_MEMPOOL_MZ_FORMAT \"_xb_%u\", pool_name, ext_num);\n+\t\tif (ret < 0 || ret >= (int)sizeof(mz_name)) {\n+\t\t\terrno = ENAMETOOLONG;\n+\t\t\text_num = 0;\n+\t\t\tbreak;\n+\t\t}\n+\t\tmz = rte_memzone_reserve_aligned(mz_name, EXTBUF_ZONE_SIZE,\n+\t\t\t\t\t\t socket_id,\n+\t\t\t\t\t\t RTE_MEMZONE_IOVA_CONTIG |\n+\t\t\t\t\t\t RTE_MEMZONE_1GB |\n+\t\t\t\t\t\t RTE_MEMZONE_SIZE_HINT_ONLY,\n+\t\t\t\t\t\t EXTBUF_ZONE_SIZE);\n+\t\tif (mz == NULL) {\n+\t\t\t/*\n+\t\t\t * The caller exits on external buffer creation\n+\t\t\t * error, so there is no need to free memzones.\n+\t\t\t */\n+\t\t\terrno = ENOMEM;\n+\t\t\text_num = 0;\n+\t\t\tbreak;\n+\t\t}\n+\t\txseg->buf_ptr = mz->addr;\n+\t\txseg->buf_iova = mz->iova;\n+\t\txseg->buf_len = EXTBUF_ZONE_SIZE;\n+\t\txseg->elt_size = elt_size;\n+\t}\n+\tif (ext_num == 0 && xmem != NULL) {\n+\t\tfree(xmem);\n+\t\txmem = NULL;\n+\t}\n+\t*ext_mem = xmem;\n+\treturn ext_num;\n+}\n+\n /*\n  * Configuration initialisation done once at init time.\n  */\n@@ -933,6 +994,26 @@ struct extmem_param {\n \t\t\t\t\theap_socket);\n \t\t\tbreak;\n \t\t}\n+\tcase MP_ALLOC_XBUF:\n+\t\t{\n+\t\t\tstruct rte_pktmbuf_extmem *ext_mem;\n+\t\t\tunsigned int ext_num;\n+\n+\t\t\text_num = setup_extbuf(nb_mbuf,\tmbuf_seg_size,\n+\t\t\t\t\t       socket_id, pool_name, &ext_mem);\n+\t\t\tif (ext_num == 0)\n+\t\t\t\trte_exit(EXIT_FAILURE,\n+\t\t\t\t\t \"Can't create pinned data buffers\\n\");\n+\n+\t\t\tTESTPMD_LOG(INFO, \"preferred mempool ops selected: %s\\n\",\n+\t\t\t\t\trte_mbuf_best_mempool_ops());\n+\t\t\trte_mp = rte_pktmbuf_pool_create_extbuf\n+\t\t\t\t\t(pool_name, nb_mbuf, mb_mempool_cache,\n+\t\t\t\t\t 0, mbuf_seg_size, socket_id,\n+\t\t\t\t\t ext_mem, ext_num);\n+\t\t\tfree(ext_mem);\n+\t\t\tbreak;\n+\t\t}\n \tdefault:\n \t\t{\n \t\t\trte_exit(EXIT_FAILURE, \"Invalid mempool creation mode\\n\");\ndiff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h\nindex 857a11f..a47f214 100644\n--- a/app/test-pmd/testpmd.h\n+++ b/app/test-pmd/testpmd.h\n@@ -76,8 +76,10 @@ enum {\n \t/**< allocate mempool natively, but populate using anonymous memory */\n \tMP_ALLOC_XMEM,\n \t/**< allocate and populate mempool using anonymous memory */\n-\tMP_ALLOC_XMEM_HUGE\n+\tMP_ALLOC_XMEM_HUGE,\n \t/**< allocate and populate mempool using anonymous hugepage memory */\n+\tMP_ALLOC_XBUF\n+\t/**< allocate mempool natively, use rte_pktmbuf_pool_create_extbuf */\n };\n \n #ifdef RTE_TEST_PMD_RECORD_BURST_STATS\ndiff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c\nindex 3caf281..871cf6c 100644\n--- a/app/test-pmd/txonly.c\n+++ b/app/test-pmd/txonly.c\n@@ -170,7 +170,8 @@\n \n \trte_pktmbuf_reset_headroom(pkt);\n \tpkt->data_len = tx_pkt_seg_lengths[0];\n-\tpkt->ol_flags = ol_flags;\n+\tpkt->ol_flags &= EXT_ATTACHED_MBUF;\n+\tpkt->ol_flags |= ol_flags;\n \tpkt->vlan_tci = vlan_tci;\n \tpkt->vlan_tci_outer = vlan_tci_outer;\n \tpkt->l2_len = sizeof(struct rte_ether_hdr);\n",
    "prefixes": [
        "v3",
        "3/4"
    ]
}