get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 126120,
    "url": "http://patches.dpdk.org/api/patches/126120/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230414174512.642-21-anoobj@marvell.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": "<20230414174512.642-21-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230414174512.642-21-anoobj@marvell.com",
    "date": "2023-04-14T17:45:10",
    "name": "[v2,20/22] pdcp: allocate reorder buffer alongside with entity",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "e8b5fa20efdaedfaac1484e6ead5009951e15f6d",
    "submitter": {
        "id": 1205,
        "url": "http://patches.dpdk.org/api/people/1205/?format=api",
        "name": "Anoob Joseph",
        "email": "anoobj@marvell.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20230414174512.642-21-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 27723,
            "url": "http://patches.dpdk.org/api/series/27723/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=27723",
            "date": "2023-04-14T17:44:50",
            "name": "lib: add pdcp protocol",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/27723/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/126120/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/126120/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 mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id B9CB742943;\n\tFri, 14 Apr 2023 19:48:13 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 0EA2642D53;\n\tFri, 14 Apr 2023 19:48:06 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com\n [67.231.156.173])\n by mails.dpdk.org (Postfix) with ESMTP id 56FFA42D0E\n for <dev@dpdk.org>; Fri, 14 Apr 2023 19:48:04 +0200 (CEST)",
            "from pps.filterd (m0045851.ppops.net [127.0.0.1])\n by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 33EGNfCF012938; Fri, 14 Apr 2023 10:48:03 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3py646s6wq-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Fri, 14 Apr 2023 10:48:03 -0700",
            "from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Fri, 14 Apr 2023 10:48:01 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Fri, 14 Apr 2023 10:48:00 -0700",
            "from BG-LT92004.corp.innovium.com (unknown [10.28.161.183])\n by maili.marvell.com (Postfix) with ESMTP id 9FE333F7081;\n Fri, 14 Apr 2023 10:47:55 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com;\n h=from : to : cc :\n subject : date : message-id : in-reply-to : references : mime-version :\n content-transfer-encoding : content-type; s=pfpt0220;\n bh=1jkkjwIDUYYWhP5vVAaiXgdr6KkOgEm9UlGmCDMVCVw=;\n b=g/Hr6WBm66Ao/qP22ka/KHuZoGXyvndoOxf420oELi03mnUdhCKXdSpTW5t6ysPuEohQ\n S3DhlpZL1drDciHzcrr0IHx+A+kf3t3eDlibrzx8EejMEMPeZbpCzbRDDFRMneASoA4m\n W+x9pgVsWlqQcP85woennaap6MF6ak33SJANuMdPOJCfkCOZlWCua8YNLqMl5DlgYA0g\n c+ocITW/KoF016qfkB/PZyVaaRIviw0C3LjoTm/MQeV5kF774HND/KVRTI1csFdsQjAt\n 0dvL53OrFvXdDO3W9sN6YsCUrz8Rycf2G6rlrT1VBbu9IpBxRih8cxJF3FbpXr0tXFWm GQ==",
        "From": "Anoob Joseph <anoobj@marvell.com>",
        "To": "Thomas Monjalon <thomas@monjalon.net>, Akhil Goyal <gakhil@marvell.com>,\n Jerin Jacob <jerinj@marvell.com>, Konstantin Ananyev\n <konstantin.v.ananyev@yandex.ru>, Bernard Iremonger\n <bernard.iremonger@intel.com>",
        "CC": "Volodymyr Fialko <vfialko@marvell.com>,\n Hemant Agrawal <hemant.agrawal@nxp.com>,\n =?utf-8?q?Mattias_R=C3=B6nnblom?= <mattias.ronnblom@ericsson.com>,\n Kiran Kumar K <kirankumark@marvell.com>, <dev@dpdk.org>,\n Olivier Matz <olivier.matz@6wind.com>",
        "Subject": "[PATCH v2 20/22] pdcp: allocate reorder buffer alongside with entity",
        "Date": "Fri, 14 Apr 2023 23:15:10 +0530",
        "Message-ID": "<20230414174512.642-21-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230414174512.642-1-anoobj@marvell.com>",
        "References": "<20221222092522.1628-1-anoobj@marvell.com>\n <20230414174512.642-1-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "7paThd-LU_WAMYK_Vju3FZVie9GusVuW",
        "X-Proofpoint-ORIG-GUID": "7paThd-LU_WAMYK_Vju3FZVie9GusVuW",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22\n definitions=2023-04-14_10,2023-04-14_01,2023-02-09_01",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "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"
    },
    "content": "From: Volodymyr Fialko <vfialko@marvell.com>\n\nInstead of allocating reorder buffer separately on heap, allocate memory\nfor it together with rest of entity, and then only initialize buffer via\n`rte_reorder_init()`.\n\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\nSigned-off-by: Volodymyr Fialko <vfialko@marvell.com>\n---\n lib/pdcp/pdcp_cnt.c     |  9 +++----\n lib/pdcp/pdcp_cnt.h     |  3 ++-\n lib/pdcp/pdcp_entity.h  |  2 +-\n lib/pdcp/pdcp_reorder.c | 11 ++------\n lib/pdcp/pdcp_reorder.h | 12 ++++++---\n lib/pdcp/rte_pdcp.c     | 58 ++++++++++++++++++++++++++---------------\n 6 files changed, 55 insertions(+), 40 deletions(-)",
    "diff": "diff --git a/lib/pdcp/pdcp_cnt.c b/lib/pdcp/pdcp_cnt.c\nindex af027b00d3..e1d0634b4d 100644\n--- a/lib/pdcp/pdcp_cnt.c\n+++ b/lib/pdcp/pdcp_cnt.c\n@@ -20,15 +20,14 @@ pdcp_cnt_bitmap_get_memory_footprint(const struct rte_pdcp_entity_conf *conf)\n }\n \n int\n-pdcp_cnt_bitmap_create(struct entity_priv_dl_part *dl, void *bitmap_mem, uint32_t window_size)\n+pdcp_cnt_bitmap_create(struct entity_priv_dl_part *dl, uint32_t nb_elem,\n+\t\t       void *bitmap_mem, uint32_t mem_size)\n {\n-\tuint32_t mem_size = rte_bitmap_get_memory_footprint(window_size);\n-\n-\tdl->bitmap.bmp = rte_bitmap_init(window_size, bitmap_mem, mem_size);\n+\tdl->bitmap.bmp = rte_bitmap_init(nb_elem, bitmap_mem, mem_size);\n \tif (dl->bitmap.bmp == NULL)\n \t\treturn -EINVAL;\n \n-\tdl->bitmap.size = window_size;\n+\tdl->bitmap.size = nb_elem;\n \n \treturn 0;\n }\ndiff --git a/lib/pdcp/pdcp_cnt.h b/lib/pdcp/pdcp_cnt.h\nindex 5941b7a406..87b011f9dc 100644\n--- a/lib/pdcp/pdcp_cnt.h\n+++ b/lib/pdcp/pdcp_cnt.h\n@@ -10,7 +10,8 @@\n #include \"pdcp_entity.h\"\n \n uint32_t pdcp_cnt_bitmap_get_memory_footprint(const struct rte_pdcp_entity_conf *conf);\n-int pdcp_cnt_bitmap_create(struct entity_priv_dl_part *dl, void *bitmap_mem, uint32_t window_size);\n+int pdcp_cnt_bitmap_create(struct entity_priv_dl_part *dl, uint32_t nb_elem,\n+\t\t\t   void *bitmap_mem, uint32_t mem_size);\n \n void pdcp_cnt_bitmap_set(struct pdcp_cnt_bitmap bitmap, uint32_t count);\n bool pdcp_cnt_bitmap_is_set(struct pdcp_cnt_bitmap bitmap, uint32_t count);\ndiff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h\nindex 8e1d6254dd..38fa71acef 100644\n--- a/lib/pdcp/pdcp_entity.h\n+++ b/lib/pdcp/pdcp_entity.h\n@@ -132,7 +132,7 @@ struct pdcp_cnt_bitmap {\n };\n \n /*\n- * Layout of PDCP entity: [rte_pdcp_entity] [entity_priv] [entity_dl/ul]\n+ * Layout of PDCP entity: [rte_pdcp_entity] [entity_priv] [entity_dl/ul] [reorder/bitmap]\n  */\n \n struct entity_priv {\ndiff --git a/lib/pdcp/pdcp_reorder.c b/lib/pdcp/pdcp_reorder.c\nindex 5399f0dc28..bc45f2e19b 100644\n--- a/lib/pdcp/pdcp_reorder.c\n+++ b/lib/pdcp/pdcp_reorder.c\n@@ -8,20 +8,13 @@\n #include \"pdcp_reorder.h\"\n \n int\n-pdcp_reorder_create(struct pdcp_reorder *reorder, uint32_t window_size)\n+pdcp_reorder_create(struct pdcp_reorder *reorder, size_t nb_elem, void *mem, size_t mem_size)\n {\n-\treorder->buf = rte_reorder_create(\"reorder_buffer\", SOCKET_ID_ANY, window_size);\n+\treorder->buf = rte_reorder_init(mem, mem_size, \"reorder_buffer\", nb_elem);\n \tif (reorder->buf == NULL)\n \t\treturn -rte_errno;\n \n-\treorder->window_size = window_size;\n \treorder->is_active = false;\n \n \treturn 0;\n }\n-\n-void\n-pdcp_reorder_destroy(const struct pdcp_reorder *reorder)\n-{\n-\trte_reorder_free(reorder->buf);\n-}\ndiff --git a/lib/pdcp/pdcp_reorder.h b/lib/pdcp/pdcp_reorder.h\nindex 6a2f61d6ae..7e4f079d4b 100644\n--- a/lib/pdcp/pdcp_reorder.h\n+++ b/lib/pdcp/pdcp_reorder.h\n@@ -9,12 +9,18 @@\n \n struct pdcp_reorder {\n \tstruct rte_reorder_buffer *buf;\n-\tuint32_t window_size;\n \tbool is_active;\n };\n \n-int pdcp_reorder_create(struct pdcp_reorder *reorder, uint32_t window_size);\n-void pdcp_reorder_destroy(const struct pdcp_reorder *reorder);\n+int pdcp_reorder_create(struct pdcp_reorder *reorder, size_t nb_elem, void *mem, size_t mem_size);\n+\n+/* NOTE: replace with `rte_reorder_memory_footprint_get` after DPDK 23.07 */\n+#define SIZE_OF_REORDER_BUFFER (4 * RTE_CACHE_LINE_SIZE)\n+static inline size_t\n+pdcp_reorder_memory_footprint_get(size_t nb_elem)\n+{\n+\treturn SIZE_OF_REORDER_BUFFER + (2 * nb_elem * sizeof(struct rte_mbuf *));\n+}\n \n static inline uint32_t\n pdcp_reorder_get_sequential(struct pdcp_reorder *reorder, struct rte_mbuf **mbufs,\ndiff --git a/lib/pdcp/rte_pdcp.c b/lib/pdcp/rte_pdcp.c\nindex ce846d687e..95d2283cef 100644\n--- a/lib/pdcp/rte_pdcp.c\n+++ b/lib/pdcp/rte_pdcp.c\n@@ -12,49 +12,65 @@\n #include \"pdcp_entity.h\"\n #include \"pdcp_process.h\"\n \n-static int bitmap_mem_offset;\n+struct entity_layout {\n+\tsize_t bitmap_offset;\n+\tsize_t bitmap_size;\n+\n+\tsize_t reorder_buf_offset;\n+\tsize_t reorder_buf_size;\n+\n+\tsize_t total_size;\n+};\n \n static int\n-pdcp_entity_size_get(const struct rte_pdcp_entity_conf *conf)\n+pdcp_entity_layout_get(const struct rte_pdcp_entity_conf *conf, struct entity_layout *layout)\n {\n-\tint size;\n+\tsize_t size;\n+\tconst uint32_t window_size = pdcp_window_size_get(conf->pdcp_xfrm.sn_size);\n \n \tsize = sizeof(struct rte_pdcp_entity) + sizeof(struct entity_priv);\n \n \tif (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) {\n \t\tsize += sizeof(struct entity_priv_dl_part);\n+\t\t/* Bitmap require memory to be cache aligned */\n \t\tsize = RTE_CACHE_LINE_ROUNDUP(size);\n-\t\tbitmap_mem_offset = size;\n-\t\tsize += pdcp_cnt_bitmap_get_memory_footprint(conf);\n+\t\tlayout->bitmap_offset = size;\n+\t\tlayout->bitmap_size = pdcp_cnt_bitmap_get_memory_footprint(conf);\n+\t\tsize += layout->bitmap_size;\n+\t\tlayout->reorder_buf_offset = size;\n+\t\tlayout->reorder_buf_size = pdcp_reorder_memory_footprint_get(window_size);\n+\t\tsize += layout->reorder_buf_size;\n \t} else if (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_UPLINK)\n \t\tsize += sizeof(struct entity_priv_ul_part);\n \telse\n \t\treturn -EINVAL;\n \n-\treturn RTE_ALIGN_CEIL(size, RTE_CACHE_LINE_SIZE);\n+\tlayout->total_size = size;\n+\n+\treturn 0;\n }\n \n static int\n-pdcp_dl_establish(struct rte_pdcp_entity *entity, const struct rte_pdcp_entity_conf *conf)\n+pdcp_dl_establish(struct rte_pdcp_entity *entity, const struct rte_pdcp_entity_conf *conf,\n+\t\t  const struct entity_layout *layout)\n {\n \tconst uint32_t window_size = pdcp_window_size_get(conf->pdcp_xfrm.sn_size);\n \tstruct entity_priv_dl_part *dl = entity_dl_part_get(entity);\n-\tvoid *bitmap_mem;\n+\tvoid *memory;\n \tint ret;\n \n \tentity->max_pkt_cache = RTE_MAX(entity->max_pkt_cache, window_size);\n \tdl->t_reorder.handle = conf->t_reordering;\n \n-\tret = pdcp_reorder_create(&dl->reorder, window_size);\n+\tmemory = RTE_PTR_ADD(entity, layout->reorder_buf_offset);\n+\tret = pdcp_reorder_create(&dl->reorder, window_size, memory, layout->reorder_buf_size);\n \tif (ret)\n \t\treturn ret;\n \n-\tbitmap_mem = RTE_PTR_ADD(entity, bitmap_mem_offset);\n-\tret = pdcp_cnt_bitmap_create(dl, bitmap_mem, window_size);\n-\tif (ret) {\n-\t\tpdcp_reorder_destroy(&dl->reorder);\n+\tmemory = RTE_PTR_ADD(entity, layout->bitmap_offset);\n+\tret = pdcp_cnt_bitmap_create(dl, window_size, memory, layout->bitmap_size);\n+\tif (ret)\n \t\treturn ret;\n-\t}\n \n \treturn 0;\n }\n@@ -62,9 +78,10 @@ pdcp_dl_establish(struct rte_pdcp_entity *entity, const struct rte_pdcp_entity_c\n struct rte_pdcp_entity *\n rte_pdcp_entity_establish(const struct rte_pdcp_entity_conf *conf)\n {\n+\tstruct entity_layout entity_layout = { 0 };\n \tstruct rte_pdcp_entity *entity = NULL;\n \tstruct entity_priv *en_priv;\n-\tint ret, entity_size;\n+\tint ret;\n \n \tif (conf == NULL || conf->cop_pool == NULL || conf->ctr_pdu_pool == NULL) {\n \t\trte_errno = -EINVAL;\n@@ -94,13 +111,14 @@ rte_pdcp_entity_establish(const struct rte_pdcp_entity_conf *conf)\n \t\treturn NULL;\n \t}\n \n-\tentity_size = pdcp_entity_size_get(conf);\n-\tif (entity_size < 0) {\n+\tret = pdcp_entity_layout_get(conf, &entity_layout);\n+\tif (ret < 0) {\n \t\trte_errno = -EINVAL;\n \t\treturn NULL;\n \t}\n \n-\tentity = rte_zmalloc_socket(\"pdcp_entity\", entity_size, RTE_CACHE_LINE_SIZE, SOCKET_ID_ANY);\n+\tentity = rte_zmalloc_socket(\"pdcp_entity\", entity_layout.total_size, RTE_CACHE_LINE_SIZE,\n+\t\t\t\t    SOCKET_ID_ANY);\n \tif (entity == NULL) {\n \t\trte_errno = -ENOMEM;\n \t\treturn NULL;\n@@ -123,7 +141,7 @@ rte_pdcp_entity_establish(const struct rte_pdcp_entity_conf *conf)\n \t\tgoto crypto_sess_destroy;\n \n \tif (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) {\n-\t\tret = pdcp_dl_establish(entity, conf);\n+\t\tret = pdcp_dl_establish(entity, conf, &entity_layout);\n \t\tif (ret)\n \t\t\tgoto crypto_sess_destroy;\n \t}\n@@ -148,8 +166,6 @@ pdcp_dl_release(struct rte_pdcp_entity *entity, struct rte_mbuf *out_mb[])\n \tnb_out = pdcp_reorder_up_to_get(&dl->reorder, out_mb, entity->max_pkt_cache,\n \t\t\ten_priv->state.rx_next);\n \n-\tpdcp_reorder_destroy(&dl->reorder);\n-\n \treturn nb_out;\n }\n \n",
    "prefixes": [
        "v2",
        "20/22"
    ]
}