get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127608,
    "url": "http://patchwork.dpdk.org/api/patches/127608/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230527085910.972-8-anoobj@marvell.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.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": "<20230527085910.972-8-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230527085910.972-8-anoobj@marvell.com",
    "date": "2023-05-27T08:58:56",
    "name": "[v5,07/21] pdcp: add pre and post process for DL",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "9a6c956bbd3835c576a98b753193b5d911d130cc",
    "submitter": {
        "id": 1205,
        "url": "http://patchwork.dpdk.org/api/people/1205/?format=api",
        "name": "Anoob Joseph",
        "email": "anoobj@marvell.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patchwork.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20230527085910.972-8-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 28216,
            "url": "http://patchwork.dpdk.org/api/series/28216/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=28216",
            "date": "2023-05-27T08:58:50",
            "name": "lib: add pdcp protocol",
            "version": 5,
            "mbox": "http://patchwork.dpdk.org/series/28216/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/127608/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/127608/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 9EA1C42BB3;\n\tSat, 27 May 2023 11:54:32 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9034A42D41;\n\tSat, 27 May 2023 11:54:32 +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 A1C4842D20\n for <dev@dpdk.org>; Sat, 27 May 2023 11:54:31 +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 34R8oT8J003477; Sat, 27 May 2023 02:54:30 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3quaj6rkn7-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Sat, 27 May 2023 02:54:30 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Sat, 27 May 2023 02:54:28 -0700",
            "from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com\n (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend\n Transport; Sat, 27 May 2023 02:54:28 -0700",
            "from BG-LT92004.corp.innovium.com (unknown [10.193.65.175])\n by maili.marvell.com (Postfix) with ESMTP id 5A00D5E72D8;\n Sat, 27 May 2023 01:59:46 -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=cQZgUJ73QNVZTXCEQeW445gk1qeKzfem28PeADrKJP4=;\n b=eim5dfvP9po8Arao3CgLfAVhgCWxtg8Vp/Dl8oUX1/ZXHdTzmevsmcXOA2mGDyWdaUUI\n mPbDafXg3TSDRHPQwieJFPwDwMEHcN5Mk0fHw6A7bcGIwY8anGgzH5vjEKygK3FNKzQc\n QNblcP6scr/Os/8RHLzKjDMVUJ8yvz6N/E0JcJ4u5wIAjSG+WyAcpW4GAn+vp7aB7eY0\n C7PCR5e8vP+vBL6dAiUFjqlR/VEJHATTIt3TMwDRc8hFuddNsS8ZNkEIMmZhKGlTaDnj\n x2rL5Q/Ps/ue2qelfbgSRcAqHsu5eIMfkO0gPMmoqh0AMFoSrMy5197KldmGBZjr6Ecl ZA==",
        "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>",
        "CC": "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>,\n Volodymyr Fialko <vfialko@marvell.com>, <dev@dpdk.org>,\n Olivier Matz <olivier.matz@6wind.com>,\n Stephen Hemminger <stephen@networkplumber.org>",
        "Subject": "[PATCH v5 07/21] pdcp: add pre and post process for DL",
        "Date": "Sat, 27 May 2023 14:28:56 +0530",
        "Message-ID": "<20230527085910.972-8-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230527085910.972-1-anoobj@marvell.com>",
        "References": "<20230526210214.617-1-anoobj@marvell.com>\n <20230527085910.972-1-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "DYGI7geMmyph1lLHtlonIlRJlgQKdxL2",
        "X-Proofpoint-ORIG-GUID": "DYGI7geMmyph1lLHtlonIlRJlgQKdxL2",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26\n definitions=2023-05-27_06,2023-05-25_03,2023-05-22_02",
        "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": "Add routines to perform pre & post processing for down link entities.\n\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\nSigned-off-by: Kiran Kumar K <kirankumark@marvell.com>\nSigned-off-by: Volodymyr Fialko <vfialko@marvell.com>\n---\n lib/pdcp/pdcp_entity.h  |   2 +\n lib/pdcp/pdcp_process.c | 384 ++++++++++++++++++++++++++++++++++++++++\n lib/pdcp/pdcp_process.h |  11 ++\n lib/pdcp/rte_pdcp.c     |  23 +++\n 4 files changed, 420 insertions(+)",
    "diff": "diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h\nindex 23628ebad4..1d4a43a3bc 100644\n--- a/lib/pdcp/pdcp_entity.h\n+++ b/lib/pdcp/pdcp_entity.h\n@@ -13,6 +13,8 @@\n \n struct entity_priv;\n \n+#define PDCP_HFN_MIN 0\n+\n /* IV generation function based on the entity configuration */\n typedef void (*iv_gen_t)(struct rte_crypto_op *cop, const struct entity_priv *en_priv,\n \t\t\t uint32_t count);\ndiff --git a/lib/pdcp/pdcp_process.c b/lib/pdcp/pdcp_process.c\nindex 9b7de39db6..bd75e6f802 100644\n--- a/lib/pdcp/pdcp_process.c\n+++ b/lib/pdcp/pdcp_process.c\n@@ -6,6 +6,7 @@\n #include <rte_crypto_sym.h>\n #include <rte_cryptodev.h>\n #include <rte_memcpy.h>\n+#include <rte_mbuf_dyn.h>\n #include <rte_pdcp.h>\n #include <rte_pdcp_hdr.h>\n \n@@ -333,9 +334,353 @@ pdcp_post_process_ul(const struct rte_pdcp_entity *entity,\n \treturn nb_success;\n }\n \n+static inline int\n+pdcp_sn_count_get(const uint32_t rx_deliv, int32_t rsn, uint32_t *count,\n+\t\t  const enum rte_security_pdcp_sn_size sn_size)\n+{\n+\tconst uint32_t rx_deliv_sn = pdcp_sn_from_count_get(rx_deliv, sn_size);\n+\tconst uint32_t window_sz = pdcp_window_size_get(sn_size);\n+\tuint32_t rhfn;\n+\n+\trhfn = pdcp_hfn_from_count_get(rx_deliv, sn_size);\n+\n+\tif (rsn < (int32_t)(rx_deliv_sn - window_sz)) {\n+\t\tif (unlikely(rhfn == pdcp_hfn_max(sn_size)))\n+\t\t\treturn -ERANGE;\n+\t\trhfn += 1;\n+\t} else if ((uint32_t)rsn >= (rx_deliv_sn + window_sz)) {\n+\t\tif (unlikely(rhfn == PDCP_HFN_MIN))\n+\t\t\treturn -ERANGE;\n+\t\trhfn -= 1;\n+\t}\n+\n+\t*count = pdcp_count_from_hfn_sn_get(rhfn, rsn, sn_size);\n+\n+\treturn 0;\n+}\n+\n+static inline uint16_t\n+pdcp_pre_process_uplane_sn_12_dl_flags(const struct rte_pdcp_entity *entity,\n+\t\t\t\t       struct rte_mbuf *in_mb[], struct rte_crypto_op *cop[],\n+\t\t\t\t       uint16_t num, uint16_t *nb_err_ret,\n+\t\t\t\t       const bool is_integ_protected)\n+{\n+\tstruct entity_priv *en_priv = entity_priv_get(entity);\n+\tstruct rte_pdcp_up_data_pdu_sn_12_hdr *pdu_hdr;\n+\tuint16_t nb_cop, nb_prep = 0, nb_err = 0;\n+\trte_pdcp_dynfield_t *mb_dynfield;\n+\tstruct rte_mbuf *mb;\n+\tint32_t rsn = 0;\n+\tuint32_t count;\n+\tint i;\n+\n+\tconst uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz;\n+\n+\tnb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop,\n+\t\t\t\t\t  num);\n+\n+\tconst uint32_t rx_deliv = en_priv->state.rx_deliv;\n+\n+\tfor (i = 0; i < nb_cop; i++) {\n+\t\tmb = in_mb[i];\n+\t\tpdu_hdr = rte_pktmbuf_mtod(mb, struct rte_pdcp_up_data_pdu_sn_12_hdr *);\n+\n+\t\t/* Check for PDU type */\n+\t\tif (likely(pdu_hdr->d_c == RTE_PDCP_PDU_TYPE_DATA)) {\n+\t\t\trsn = ((pdu_hdr->sn_11_8 << 8) | (pdu_hdr->sn_7_0));\n+\t\t} else {\n+\t\t\t/** NOTE: Control PDU not handled.*/\n+\t\t\tin_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (unlikely(pdcp_sn_count_get(rx_deliv, rsn, &count,\n+\t\t\t\t\t       RTE_SECURITY_PDCP_SN_SIZE_12))) {\n+\t\t\tin_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, is_integ_protected);\n+\n+\t\tmb_dynfield = pdcp_dynfield(mb);\n+\t\t*mb_dynfield = count;\n+\t}\n+\n+\tif (unlikely(nb_err))\n+\t\trte_mempool_put_bulk(en_priv->cop_pool, (void *)&cop[nb_prep], nb_cop - nb_prep);\n+\n+\t*nb_err_ret = num - nb_prep;\n+\n+\treturn nb_prep;\n+}\n+\n+static uint16_t\n+pdcp_pre_process_uplane_sn_12_dl_ip(const struct rte_pdcp_entity *entity, struct rte_mbuf *mb[],\n+\t\t\t\t    struct rte_crypto_op *cop[], uint16_t num, uint16_t *nb_err)\n+{\n+\treturn pdcp_pre_process_uplane_sn_12_dl_flags(entity, mb, cop, num, nb_err, true);\n+}\n+\n+static uint16_t\n+pdcp_pre_process_uplane_sn_12_dl(const struct rte_pdcp_entity *entity, struct rte_mbuf *mb[],\n+\t\t\t\t struct rte_crypto_op *cop[], uint16_t num, uint16_t *nb_err)\n+{\n+\treturn pdcp_pre_process_uplane_sn_12_dl_flags(entity, mb, cop, num, nb_err, false);\n+}\n+\n+static inline uint16_t\n+pdcp_pre_process_uplane_sn_18_dl_flags(const struct rte_pdcp_entity *entity,\n+\t\t\t\t       struct rte_mbuf *in_mb[], struct rte_crypto_op *cop[],\n+\t\t\t\t       uint16_t num, uint16_t *nb_err_ret,\n+\t\t\t\t       const bool is_integ_protected)\n+{\n+\tstruct entity_priv *en_priv = entity_priv_get(entity);\n+\tstruct rte_pdcp_up_data_pdu_sn_18_hdr *pdu_hdr;\n+\tuint16_t nb_cop, nb_prep = 0, nb_err = 0;\n+\trte_pdcp_dynfield_t *mb_dynfield;\n+\tstruct rte_mbuf *mb;\n+\tint32_t rsn = 0;\n+\tuint32_t count;\n+\tint i;\n+\n+\tconst uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz;\n+\tnb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop,\n+\t\t\t\t\t  num);\n+\n+\tconst uint32_t rx_deliv = en_priv->state.rx_deliv;\n+\n+\tfor (i = 0; i < nb_cop; i++) {\n+\t\tmb = in_mb[i];\n+\t\tpdu_hdr = rte_pktmbuf_mtod(mb, struct rte_pdcp_up_data_pdu_sn_18_hdr *);\n+\n+\t\t/* Check for PDU type */\n+\t\tif (likely(pdu_hdr->d_c == RTE_PDCP_PDU_TYPE_DATA)) {\n+\t\t\trsn = ((pdu_hdr->sn_17_16 << 16) | (pdu_hdr->sn_15_8 << 8) |\n+\t\t\t       (pdu_hdr->sn_7_0));\n+\t\t} else {\n+\t\t\t/** NOTE: Control PDU not handled.*/\n+\t\t\tin_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (unlikely(pdcp_sn_count_get(rx_deliv, rsn, &count,\n+\t\t\t\t\t       RTE_SECURITY_PDCP_SN_SIZE_18))) {\n+\t\t\tin_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, is_integ_protected);\n+\n+\t\tmb_dynfield = pdcp_dynfield(mb);\n+\t\t*mb_dynfield = count;\n+\t}\n+\n+\tif (unlikely(nb_err))\n+\t\t/* Using mempool API since crypto API is not providing bulk free */\n+\t\trte_mempool_put_bulk(en_priv->cop_pool, (void *)&cop[nb_prep], nb_cop - nb_prep);\n+\n+\t*nb_err_ret = num - nb_prep;\n+\n+\treturn nb_prep;\n+}\n+\n+static uint16_t\n+pdcp_pre_process_uplane_sn_18_dl_ip(const struct rte_pdcp_entity *entity, struct rte_mbuf *mb[],\n+\t\t\t\t    struct rte_crypto_op *cop[], uint16_t num, uint16_t *nb_err)\n+{\n+\treturn pdcp_pre_process_uplane_sn_18_dl_flags(entity, mb, cop, num, nb_err, true);\n+}\n+\n+static uint16_t\n+pdcp_pre_process_uplane_sn_18_dl(const struct rte_pdcp_entity *entity, struct rte_mbuf *mb[],\n+\t\t\t\t struct rte_crypto_op *cop[], uint16_t num, uint16_t *nb_err)\n+{\n+\treturn pdcp_pre_process_uplane_sn_18_dl_flags(entity, mb, cop, num, nb_err, false);\n+}\n+\n+static uint16_t\n+pdcp_pre_process_cplane_sn_12_dl(const struct rte_pdcp_entity *entity, struct rte_mbuf *in_mb[],\n+\t\t\t\t struct rte_crypto_op *cop[], uint16_t num, uint16_t *nb_err_ret)\n+{\n+\tstruct entity_priv *en_priv = entity_priv_get(entity);\n+\tstruct rte_pdcp_cp_data_pdu_sn_12_hdr *pdu_hdr;\n+\tuint16_t nb_cop, nb_prep = 0, nb_err = 0;\n+\trte_pdcp_dynfield_t *mb_dynfield;\n+\tstruct rte_mbuf *mb;\n+\tuint32_t count;\n+\tint32_t rsn;\n+\tint i;\n+\n+\tconst uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz;\n+\n+\tnb_cop = rte_crypto_op_bulk_alloc(en_priv->cop_pool, RTE_CRYPTO_OP_TYPE_SYMMETRIC, cop,\n+\t\t\t\t\t  num);\n+\n+\tconst uint32_t rx_deliv = en_priv->state.rx_deliv;\n+\n+\tfor (i = 0; i < nb_cop; i++) {\n+\t\tmb = in_mb[i];\n+\t\tpdu_hdr = rte_pktmbuf_mtod(mb, struct rte_pdcp_cp_data_pdu_sn_12_hdr *);\n+\t\trsn = ((pdu_hdr->sn_11_8 << 8) | (pdu_hdr->sn_7_0));\n+\t\tif (unlikely(pdcp_sn_count_get(rx_deliv, rsn, &count,\n+\t\t\t\t\t       RTE_SECURITY_PDCP_SN_SIZE_12))) {\n+\t\t\tin_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, true);\n+\n+\t\tmb_dynfield = pdcp_dynfield(mb);\n+\t\t*mb_dynfield = count;\n+\t}\n+\n+\tif (unlikely(nb_err))\n+\t\t/* Using mempool API since crypto API is not providing bulk free */\n+\t\trte_mempool_put_bulk(en_priv->cop_pool, (void *)&cop[nb_prep], nb_cop - nb_prep);\n+\n+\t*nb_err_ret = num - nb_prep;\n+\n+\treturn nb_prep;\n+}\n+\n+static inline void\n+pdcp_packet_strip(struct rte_mbuf *mb, const uint32_t hdr_trim_sz, const bool trim_mac)\n+{\n+\tchar *p = rte_pktmbuf_adj(mb, hdr_trim_sz);\n+\tRTE_ASSERT(p != NULL);\n+\tRTE_SET_USED(p);\n+\n+\tif (trim_mac) {\n+\t\tint ret = rte_pktmbuf_trim(mb, RTE_PDCP_MAC_I_LEN);\n+\t\tRTE_ASSERT(ret == 0);\n+\t\tRTE_SET_USED(ret);\n+\t}\n+}\n+\n+static inline bool\n+pdcp_post_process_update_entity_state(const struct rte_pdcp_entity *entity,\n+\t\t\t\t      const uint32_t count)\n+{\n+\tstruct entity_priv *en_priv = entity_priv_get(entity);\n+\n+\tif (count < en_priv->state.rx_deliv)\n+\t\treturn false;\n+\n+\t/* t-Reordering timer is not supported - SDU will be delivered immediately.\n+\t * Update RX_DELIV to the COUNT value of the first PDCP SDU which has not\n+\t * been delivered to upper layers\n+\t */\n+\ten_priv->state.rx_next = count + 1;\n+\n+\tif (count >= en_priv->state.rx_next)\n+\t\ten_priv->state.rx_next = count + 1;\n+\n+\treturn true;\n+}\n+\n+static inline uint16_t\n+pdcp_post_process_uplane_dl_flags(const struct rte_pdcp_entity *entity, struct rte_mbuf *in_mb[],\n+\t\t\t\t  struct rte_mbuf *out_mb[], uint16_t num, uint16_t *nb_err_ret,\n+\t\t\t\t  const bool is_integ_protected)\n+{\n+\tstruct entity_priv *en_priv = entity_priv_get(entity);\n+\tconst uint32_t aad_sz = en_priv->aad_sz;\n+\tint i, nb_success = 0, nb_err = 0;\n+\trte_pdcp_dynfield_t *mb_dynfield;\n+\tstruct rte_mbuf *err_mb[num];\n+\tstruct rte_mbuf *mb;\n+\tuint32_t count;\n+\n+\tconst uint32_t hdr_trim_sz = en_priv->hdr_sz + aad_sz;\n+\n+\tfor (i = 0; i < num; i++) {\n+\t\tmb = in_mb[i];\n+\t\tif (unlikely(mb->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED))\n+\t\t\tgoto error;\n+\n+\t\tmb_dynfield = pdcp_dynfield(mb);\n+\t\tcount = *mb_dynfield;\n+\n+\t\tif (unlikely(!pdcp_post_process_update_entity_state(entity, count)))\n+\t\t\tgoto error;\n+\n+\t\tpdcp_packet_strip(mb, hdr_trim_sz, is_integ_protected);\n+\t\tout_mb[nb_success++] = mb;\n+\t\tcontinue;\n+\n+error:\n+\t\terr_mb[nb_err++] = mb;\n+\t}\n+\n+\tif (unlikely(nb_err != 0))\n+\t\trte_memcpy(&out_mb[nb_success], err_mb, nb_err * sizeof(struct rte_mbuf *));\n+\n+\t*nb_err_ret = nb_err;\n+\treturn nb_success;\n+}\n+\n+static uint16_t\n+pdcp_post_process_uplane_dl_ip(const struct rte_pdcp_entity *entity, struct rte_mbuf *in_mb[],\n+\t\t\t       struct rte_mbuf *out_mb[], uint16_t num, uint16_t *nb_err)\n+{\n+\treturn pdcp_post_process_uplane_dl_flags(entity, in_mb, out_mb, num, nb_err, true);\n+}\n+\n+static uint16_t\n+pdcp_post_process_uplane_dl(const struct rte_pdcp_entity *entity, struct rte_mbuf *in_mb[],\n+\t\t\t   struct rte_mbuf *out_mb[], uint16_t num, uint16_t *nb_err)\n+{\n+\treturn pdcp_post_process_uplane_dl_flags(entity, in_mb, out_mb, num, nb_err, false);\n+}\n+\n+static uint16_t\n+pdcp_post_process_cplane_sn_12_dl(const struct rte_pdcp_entity *entity,\n+\t\t\t\t  struct rte_mbuf *in_mb[],\n+\t\t\t\t  struct rte_mbuf *out_mb[],\n+\t\t\t\t  uint16_t num, uint16_t *nb_err_ret)\n+{\n+\tstruct entity_priv *en_priv = entity_priv_get(entity);\n+\tconst uint32_t aad_sz = en_priv->aad_sz;\n+\tint i, nb_success = 0, nb_err = 0;\n+\trte_pdcp_dynfield_t *mb_dynfield;\n+\tstruct rte_mbuf *err_mb[num];\n+\tstruct rte_mbuf *mb;\n+\tuint32_t count;\n+\n+\tconst uint32_t hdr_trim_sz = en_priv->hdr_sz + aad_sz;\n+\n+\tfor (i = 0; i < num; i++) {\n+\t\tmb = in_mb[i];\n+\t\tif (unlikely(mb->ol_flags & RTE_MBUF_F_RX_SEC_OFFLOAD_FAILED))\n+\t\t\tgoto error;\n+\n+\t\tmb_dynfield = pdcp_dynfield(mb);\n+\t\tcount = *mb_dynfield;\n+\n+\t\tif (unlikely(!pdcp_post_process_update_entity_state(entity, count)))\n+\t\t\tgoto error;\n+\n+\t\tpdcp_packet_strip(mb, hdr_trim_sz, true);\n+\n+\t\tout_mb[nb_success++] = mb;\n+\t\tcontinue;\n+\n+error:\n+\t\terr_mb[nb_err++] = mb;\n+\t}\n+\n+\tif (unlikely(nb_err != 0))\n+\t\trte_memcpy(&out_mb[nb_success], err_mb, nb_err * sizeof(struct rte_mbuf *));\n+\n+\t*nb_err_ret = nb_err;\n+\treturn nb_success;\n+}\n+\n static int\n pdcp_pre_post_func_set(struct rte_pdcp_entity *entity, const struct rte_pdcp_entity_conf *conf)\n {\n+\tstruct entity_priv *en_priv = entity_priv_get(entity);\n+\n \tentity->pre_process = NULL;\n \tentity->post_process = NULL;\n \n@@ -346,6 +691,13 @@ pdcp_pre_post_func_set(struct rte_pdcp_entity *entity, const struct rte_pdcp_ent\n \t\tentity->post_process = pdcp_post_process_ul;\n \t}\n \n+\tif ((conf->pdcp_xfrm.domain == RTE_SECURITY_PDCP_MODE_CONTROL) &&\n+\t    (conf->pdcp_xfrm.sn_size == RTE_SECURITY_PDCP_SN_SIZE_12) &&\n+\t    (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK)) {\n+\t\tentity->pre_process = pdcp_pre_process_cplane_sn_12_dl;\n+\t\tentity->post_process = pdcp_post_process_cplane_sn_12_dl;\n+\t}\n+\n \tif ((conf->pdcp_xfrm.domain == RTE_SECURITY_PDCP_MODE_DATA) &&\n \t    (conf->pdcp_xfrm.sn_size == RTE_SECURITY_PDCP_SN_SIZE_12) &&\n \t    (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_UPLINK)) {\n@@ -360,6 +712,38 @@ pdcp_pre_post_func_set(struct rte_pdcp_entity *entity, const struct rte_pdcp_ent\n \t\tentity->post_process = pdcp_post_process_ul;\n \t}\n \n+\tif ((conf->pdcp_xfrm.domain == RTE_SECURITY_PDCP_MODE_DATA) &&\n+\t    (conf->pdcp_xfrm.sn_size == RTE_SECURITY_PDCP_SN_SIZE_12) &&\n+\t    (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) &&\n+\t    (en_priv->flags.is_authenticated)) {\n+\t\tentity->pre_process = pdcp_pre_process_uplane_sn_12_dl_ip;\n+\t\tentity->post_process = pdcp_post_process_uplane_dl_ip;\n+\t}\n+\n+\tif ((conf->pdcp_xfrm.domain == RTE_SECURITY_PDCP_MODE_DATA) &&\n+\t    (conf->pdcp_xfrm.sn_size == RTE_SECURITY_PDCP_SN_SIZE_12) &&\n+\t    (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) &&\n+\t    (!en_priv->flags.is_authenticated)) {\n+\t\tentity->pre_process = pdcp_pre_process_uplane_sn_12_dl;\n+\t\tentity->post_process = pdcp_post_process_uplane_dl;\n+\t}\n+\n+\tif ((conf->pdcp_xfrm.domain == RTE_SECURITY_PDCP_MODE_DATA) &&\n+\t    (conf->pdcp_xfrm.sn_size == RTE_SECURITY_PDCP_SN_SIZE_18) &&\n+\t    (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) &&\n+\t    (en_priv->flags.is_authenticated)) {\n+\t\tentity->pre_process = pdcp_pre_process_uplane_sn_18_dl_ip;\n+\t\tentity->post_process = pdcp_post_process_uplane_dl_ip;\n+\t}\n+\n+\tif ((conf->pdcp_xfrm.domain == RTE_SECURITY_PDCP_MODE_DATA) &&\n+\t    (conf->pdcp_xfrm.sn_size == RTE_SECURITY_PDCP_SN_SIZE_18) &&\n+\t    (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_DOWNLINK) &&\n+\t    (!en_priv->flags.is_authenticated)) {\n+\t\tentity->pre_process = pdcp_pre_process_uplane_sn_18_dl;\n+\t\tentity->post_process = pdcp_post_process_uplane_dl;\n+\t}\n+\n \tif (entity->pre_process == NULL || entity->post_process == NULL)\n \t\treturn -ENOTSUP;\n \ndiff --git a/lib/pdcp/pdcp_process.h b/lib/pdcp/pdcp_process.h\nindex fd53fff0aa..a52f769b82 100644\n--- a/lib/pdcp/pdcp_process.h\n+++ b/lib/pdcp/pdcp_process.h\n@@ -5,8 +5,19 @@\n #ifndef PDCP_PROCESS_H\n #define PDCP_PROCESS_H\n \n+#include <rte_mbuf_dyn.h>\n #include <rte_pdcp.h>\n \n+typedef uint32_t rte_pdcp_dynfield_t;\n+\n+extern int rte_pdcp_dynfield_offset;\n+\n+static inline rte_pdcp_dynfield_t *\n+pdcp_dynfield(struct rte_mbuf *mbuf)\n+{\n+\treturn RTE_MBUF_DYNFIELD(mbuf, rte_pdcp_dynfield_offset, rte_pdcp_dynfield_t *);\n+}\n+\n int\n pdcp_process_func_set(struct rte_pdcp_entity *entity, const struct rte_pdcp_entity_conf *conf);\n \ndiff --git a/lib/pdcp/rte_pdcp.c b/lib/pdcp/rte_pdcp.c\nindex adcad5dd25..91dab91f73 100644\n--- a/lib/pdcp/rte_pdcp.c\n+++ b/lib/pdcp/rte_pdcp.c\n@@ -10,6 +10,26 @@\n #include \"pdcp_entity.h\"\n #include \"pdcp_process.h\"\n \n+#define RTE_PDCP_DYNFIELD_NAME \"rte_pdcp_dynfield\"\n+\n+int rte_pdcp_dynfield_offset = -1;\n+\n+static int\n+pdcp_dynfield_register(void)\n+{\n+\tconst struct rte_mbuf_dynfield dynfield_desc = {\n+\t\t.name = RTE_PDCP_DYNFIELD_NAME,\n+\t\t.size = sizeof(rte_pdcp_dynfield_t),\n+\t\t.align = __alignof__(rte_pdcp_dynfield_t),\n+\t};\n+\n+\tif (rte_pdcp_dynfield_offset != -1)\n+\t\treturn rte_pdcp_dynfield_offset;\n+\n+\trte_pdcp_dynfield_offset = rte_mbuf_dynfield_register(&dynfield_desc);\n+\treturn rte_pdcp_dynfield_offset;\n+}\n+\n static int\n pdcp_entity_size_get(const struct rte_pdcp_entity_conf *conf)\n {\n@@ -35,6 +55,9 @@ rte_pdcp_entity_establish(const struct rte_pdcp_entity_conf *conf)\n \tint ret, entity_size;\n \tuint32_t count;\n \n+\tif (pdcp_dynfield_register() < 0)\n+\t\treturn NULL;\n+\n \tif (conf == NULL || conf->cop_pool == NULL) {\n \t\trte_errno = EINVAL;\n \t\treturn NULL;\n",
    "prefixes": [
        "v5",
        "07/21"
    ]
}