get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 126106,
    "url": "http://patches.dpdk.org/api/patches/126106/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230414174512.642-7-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-7-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230414174512.642-7-anoobj@marvell.com",
    "date": "2023-04-14T17:44:56",
    "name": "[v2,06/22] pdcp: add pre and post process for UL",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "511195b0bd7283c30197c75b33ba9f4fb1ec4084",
    "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-7-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/126106/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/126106/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 0F2DB42943;\n\tFri, 14 Apr 2023 19:46:07 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3456341153;\n\tFri, 14 Apr 2023 19:45:58 +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 9482E41153\n for <dev@dpdk.org>; Fri, 14 Apr 2023 19:45:56 +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 33EHJ0L4013323; Fri, 14 Apr 2023 10:45:55 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3py646s6je-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Fri, 14 Apr 2023 10:45:55 -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 Fri, 14 Apr 2023 10:45:53 -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; Fri, 14 Apr 2023 10:45:53 -0700",
            "from BG-LT92004.corp.innovium.com (unknown [10.28.161.183])\n by maili.marvell.com (Postfix) with ESMTP id 3CFCE3F7080;\n Fri, 14 Apr 2023 10:45:47 -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=yJH/D3Ngnbpyo9uu9omO5jdcCK/8KWuSOiL3Ff13G8k=;\n b=ad0RDAoondoKIBb78dmYZUWMO4sv3BDu1wwAmhWnHYIzEKFUwpcN3aNx3qzZkfJXvATP\n BNQ/KzPVHjYe2ARV2qFS+MKdDpyB+sPcAqKQF9BnGs6dEemA+QCZXZX3VGfTtXNfTvQJ\n O4D0l1qzrEBfZ2KmyCID6oJDM6ozGPUgvHnHak1YicXM42G8zSlQW/MoQE/bgikTuQna\n 5j7L11vuwjFqmP7eYhwZ7Lcw1kzudWqWbtv8fx5BXrRJfdoH6wkGpI5lMcIT3PqFPoKx\n /Tl61OS9MmVH138OmlXMNYkUNhhdhsLNo7+Jt4J/y6Ww3Rz+DJBGrn0oNBstuugeY2v7 ew==",
        "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": "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>",
        "Subject": "[PATCH v2 06/22] pdcp: add pre and post process for UL",
        "Date": "Fri, 14 Apr 2023 23:14:56 +0530",
        "Message-ID": "<20230414174512.642-7-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": "eal_7lGJfHfhhoFVRuoajNcya2RFVsrZ",
        "X-Proofpoint-ORIG-GUID": "eal_7lGJfHfhhoFVRuoajNcya2RFVsrZ",
        "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": "Add routines to perform pre & post processing based on the type of\nentity. To avoid checks in datapath, there are different function\npointers registered based on the following,\n1. Control plane v/s user plane\n2. 12 bit v/s 18 bit SN\n\nFor control plane only 12 bit SN need to be supported (as per PDCP\nspecification).\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  |  42 +++++\n lib/pdcp/pdcp_process.c | 330 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 372 insertions(+)",
    "diff": "diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h\nindex ca1d56b516..46cdaead09 100644\n--- a/lib/pdcp/pdcp_entity.h\n+++ b/lib/pdcp/pdcp_entity.h\n@@ -92,4 +92,46 @@ pdcp_hdr_size_get(enum rte_security_pdcp_sn_size sn_size)\n \treturn RTE_ALIGN_MUL_CEIL(sn_size, 8) / 8;\n }\n \n+static inline uint32_t\n+pdcp_window_size_get(enum rte_security_pdcp_sn_size sn_size)\n+{\n+\treturn 1 << (sn_size - 1);\n+}\n+\n+static inline uint32_t\n+pdcp_sn_mask_get(enum rte_security_pdcp_sn_size sn_size)\n+{\n+\treturn (1 << sn_size) - 1;\n+}\n+\n+static inline uint32_t\n+pdcp_sn_from_count_get(uint32_t count, enum rte_security_pdcp_sn_size sn_size)\n+{\n+\treturn (count & pdcp_sn_mask_get(sn_size));\n+}\n+\n+static inline uint32_t\n+pdcp_hfn_mask_get(enum rte_security_pdcp_sn_size sn_size)\n+{\n+\treturn ~pdcp_sn_mask_get(sn_size);\n+}\n+\n+static inline uint32_t\n+pdcp_hfn_from_count_get(uint32_t count, enum rte_security_pdcp_sn_size sn_size)\n+{\n+\treturn (count & pdcp_hfn_mask_get(sn_size)) >> sn_size;\n+}\n+\n+static inline uint32_t\n+pdcp_count_from_hfn_sn_get(uint32_t hfn, uint32_t sn, enum rte_security_pdcp_sn_size sn_size)\n+{\n+\treturn (((hfn << sn_size) & pdcp_hfn_mask_get(sn_size)) | (sn & pdcp_sn_mask_get(sn_size)));\n+}\n+\n+static inline uint32_t\n+pdcp_hfn_max(enum rte_security_pdcp_sn_size sn_size)\n+{\n+\treturn (1 << (32 - sn_size)) - 1;\n+}\n+\n #endif /* PDCP_ENTITY_H */\ndiff --git a/lib/pdcp/pdcp_process.c b/lib/pdcp/pdcp_process.c\nindex d4b158536d..7c1fc85fcb 100644\n--- a/lib/pdcp/pdcp_process.c\n+++ b/lib/pdcp/pdcp_process.c\n@@ -36,6 +36,332 @@ pdcp_crypto_xfrm_get(const struct rte_pdcp_entity_conf *conf, struct rte_crypto_\n \treturn 0;\n }\n \n+static inline void\n+cop_prepare(const struct entity_priv *en_priv, struct rte_mbuf *mb, struct rte_crypto_op *cop,\n+\t    uint8_t data_offset, uint32_t count, const bool is_auth)\n+{\n+\tconst struct rte_crypto_op cop_init = {\n+\t\t.type = RTE_CRYPTO_OP_TYPE_SYMMETRIC,\n+\t\t.status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED,\n+\t\t.sess_type = RTE_CRYPTO_OP_WITH_SESSION,\n+\t};\n+\tstruct rte_crypto_sym_op *op;\n+\tuint32_t pkt_len;\n+\n+\tconst uint8_t ciph_shift = 3 * en_priv->flags.is_ciph_in_bits;\n+\tconst uint8_t auth_shift = 3 * en_priv->flags.is_auth_in_bits;\n+\n+\top = cop->sym;\n+\tcop->raw = cop_init.raw;\n+\top->m_src = mb;\n+\top->m_dst = mb;\n+\n+\t/* Set IV */\n+\ten_priv->iv_gen(cop, en_priv, count);\n+\n+\t/* Prepare op */\n+\tpkt_len = rte_pktmbuf_pkt_len(mb);\n+\top->cipher.data.offset = data_offset << ciph_shift;\n+\top->cipher.data.length = (pkt_len - data_offset) << ciph_shift;\n+\n+\tif (is_auth) {\n+\t\top->auth.data.offset = 0;\n+\t\top->auth.data.length = (pkt_len - PDCP_MAC_I_LEN) << auth_shift;\n+\t\top->auth.digest.data = rte_pktmbuf_mtod_offset(mb, uint8_t *,\n+\t\t\t\t\t\t\t       (pkt_len - PDCP_MAC_I_LEN));\n+\t}\n+\n+\t__rte_crypto_sym_op_attach_sym_session(op, en_priv->crypto_sess);\n+}\n+\n+static inline bool\n+pdcp_pre_process_uplane_sn_12_ul_set_sn(struct entity_priv *en_priv, struct rte_mbuf *mb,\n+\t\t\t\t\tuint32_t *count)\n+{\n+\tstruct rte_pdcp_up_data_pdu_sn_12_hdr *pdu_hdr;\n+\tconst uint8_t hdr_sz = en_priv->hdr_sz;\n+\tuint32_t sn;\n+\n+\t/* Prepend PDU header */\n+\tpdu_hdr = (struct rte_pdcp_up_data_pdu_sn_12_hdr *)rte_pktmbuf_prepend(mb, hdr_sz);\n+\tif (unlikely(pdu_hdr == NULL))\n+\t\treturn false;\n+\n+\t/* Update sequence num in the PDU header */\n+\t*count = en_priv->state.tx_next++;\n+\tsn = pdcp_sn_from_count_get(*count, RTE_SECURITY_PDCP_SN_SIZE_12);\n+\n+\tpdu_hdr->d_c = RTE_PDCP_PDU_TYPE_DATA;\n+\tpdu_hdr->sn_11_8 = ((sn & 0xf00) >> 8);\n+\tpdu_hdr->sn_7_0 = (sn & 0xff);\n+\tpdu_hdr->r = 0;\n+\treturn true;\n+}\n+\n+static uint16_t\n+pdcp_pre_process_uplane_sn_12_ul(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+\tuint16_t nb_cop, nb_prep = 0, nb_err = 0;\n+\tstruct rte_mbuf *mb;\n+\tuint32_t count;\n+\tuint8_t *mac_i;\n+\tint i;\n+\n+\tconst uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz;\n+\tconst int is_null_auth = en_priv->flags.is_null_auth;\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+\tif (en_priv->flags.is_authenticated) {\n+\t\tfor (i = 0; i < nb_cop; i++) {\n+\t\t\tmb = in_mb[i];\n+\t\t\tmac_i = (uint8_t *)rte_pktmbuf_append(mb, PDCP_MAC_I_LEN);\n+\t\t\tif (unlikely(mac_i == NULL)) {\n+\t\t\t\tin_mb[nb_err++] = mb;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\t/* Clear MAC-I field for NULL auth */\n+\t\t\tif (is_null_auth)\n+\t\t\t\tmemset(mac_i, 0, PDCP_MAC_I_LEN);\n+\n+\t\t\tif (unlikely(!pdcp_pre_process_uplane_sn_12_ul_set_sn(en_priv, mb,\n+\t\t\t\t\t\t\t\t\t      &count))) {\n+\t\t\t\tin_mb[nb_err++] = mb;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, true);\n+\t\t}\n+\t} else {\n+\t\tfor (i = 0; i < nb_cop; i++) {\n+\t\t\tmb = in_mb[i];\n+\t\t\tif (unlikely(!pdcp_pre_process_uplane_sn_12_ul_set_sn(en_priv, mb,\n+\t\t\t\t\t\t\t\t\t      &count))) {\n+\t\t\t\tin_mb[nb_err++] = mb;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, false);\n+\t\t}\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 bool\n+pdcp_pre_process_uplane_sn_18_ul_set_sn(struct entity_priv *en_priv, struct rte_mbuf *mb,\n+\t\t\t\t\tuint32_t *count)\n+{\n+\tstruct rte_pdcp_up_data_pdu_sn_18_hdr *pdu_hdr;\n+\tconst uint8_t hdr_sz = en_priv->hdr_sz;\n+\tuint32_t sn;\n+\n+\t/* Prepend PDU header */\n+\tpdu_hdr = (struct rte_pdcp_up_data_pdu_sn_18_hdr *)rte_pktmbuf_prepend(mb, hdr_sz);\n+\tif (unlikely(pdu_hdr == NULL))\n+\t\treturn false;\n+\n+\t/* Update sequence num in the PDU header */\n+\t*count = en_priv->state.tx_next++;\n+\tsn = pdcp_sn_from_count_get(*count, RTE_SECURITY_PDCP_SN_SIZE_18);\n+\n+\tpdu_hdr->d_c = RTE_PDCP_PDU_TYPE_DATA;\n+\tpdu_hdr->sn_17_16 = ((sn & 0x30000) >> 16);\n+\tpdu_hdr->sn_15_8 = ((sn & 0xff00) >> 8);\n+\tpdu_hdr->sn_7_0 = (sn & 0xff);\n+\tpdu_hdr->r = 0;\n+\n+\treturn true;\n+}\n+\n+static inline uint16_t\n+pdcp_pre_process_uplane_sn_18_ul(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+\tuint16_t nb_cop, nb_prep = 0, nb_err = 0;\n+\tstruct rte_mbuf *mb;\n+\tuint32_t count;\n+\tuint8_t *mac_i;\n+\tint i;\n+\n+\tconst uint8_t data_offset = en_priv->hdr_sz + en_priv->aad_sz;\n+\tconst int is_null_auth = en_priv->flags.is_null_auth;\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+\tif (en_priv->flags.is_authenticated) {\n+\t\tfor (i = 0; i < nb_cop; i++) {\n+\t\t\tmb = in_mb[i];\n+\t\t\tmac_i = (uint8_t *)rte_pktmbuf_append(mb, PDCP_MAC_I_LEN);\n+\t\t\tif (unlikely(mac_i == NULL)) {\n+\t\t\t\tin_mb[nb_err++] = mb;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\t/* Clear MAC-I field for NULL auth */\n+\t\t\tif (is_null_auth)\n+\t\t\t\tmemset(mac_i, 0, PDCP_MAC_I_LEN);\n+\n+\t\t\tif (unlikely(!pdcp_pre_process_uplane_sn_18_ul_set_sn(en_priv, mb,\n+\t\t\t\t\t\t\t\t\t      &count))) {\n+\t\t\t\tin_mb[nb_err++] = mb;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, true);\n+\t\t}\n+\t} else {\n+\t\tfor (i = 0; i < nb_cop; i++) {\n+\t\t\tmb = in_mb[i];\n+\t\t\tif (unlikely(!pdcp_pre_process_uplane_sn_18_ul_set_sn(en_priv, mb,\n+\t\t\t\t\t\t\t\t\t      &count))) {\n+\n+\t\t\t\tin_mb[nb_err++] = mb;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, false);\n+\t\t}\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_cplane_sn_12_ul(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+\tstruct rte_mbuf *mb;\n+\tuint32_t count, sn;\n+\tuint8_t *mac_i;\n+\tint i;\n+\n+\tconst uint8_t hdr_sz = en_priv->hdr_sz;\n+\tconst uint8_t data_offset = hdr_sz + en_priv->aad_sz;\n+\tconst int is_null_auth = en_priv->flags.is_null_auth;\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+\tfor (i = 0; i < nb_cop; i++) {\n+\t\tmb = in_mb[i];\n+\t\t/* Prepend PDU header */\n+\t\tpdu_hdr = (struct rte_pdcp_cp_data_pdu_sn_12_hdr *)rte_pktmbuf_prepend(mb, hdr_sz);\n+\t\tif (unlikely(pdu_hdr == NULL)) {\n+\t\t\tin_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tmac_i = (uint8_t *)rte_pktmbuf_append(mb, PDCP_MAC_I_LEN);\n+\t\tif (unlikely(mac_i == NULL)) {\n+\t\t\tin_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\t/* Clear MAC-I field for NULL auth */\n+\t\tif (is_null_auth)\n+\t\t\tmemset(mac_i, 0, PDCP_MAC_I_LEN);\n+\n+\t\t/* Update sequence number in the PDU header */\n+\t\tcount = en_priv->state.tx_next++;\n+\t\tsn = pdcp_sn_from_count_get(count, RTE_SECURITY_PDCP_SN_SIZE_12);\n+\n+\t\tpdu_hdr->sn_11_8 = ((sn & 0xf00) >> 8);\n+\t\tpdu_hdr->sn_7_0 = (sn & 0xff);\n+\t\tpdu_hdr->r = 0;\n+\n+\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, true);\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_post_process_ul(const struct rte_pdcp_entity *entity,\n+\t\t     struct rte_mbuf *in_mb[], struct rte_mbuf *out_mb[],\n+\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 hdr_trim_sz = en_priv->aad_sz;\n+\tint i, nb_success = 0, nb_err = 0;\n+\tstruct rte_mbuf *mb, *err_mb[num];\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\terr_mb[nb_err++] = mb;\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (hdr_trim_sz)\n+\t\t\trte_pktmbuf_adj(mb, hdr_trim_sz);\n+\n+\t\tout_mb[nb_success++] = 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+\tentity->pre_process = NULL;\n+\tentity->post_process = NULL;\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_UPLINK)) {\n+\t\tentity->pre_process = pdcp_pre_process_cplane_sn_12_ul;\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_UPLINK)) {\n+\t\tentity->pre_process = pdcp_pre_process_uplane_sn_12_ul;\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_18) &&\n+\t    (conf->pdcp_xfrm.pkt_dir == RTE_SECURITY_PDCP_UPLINK)) {\n+\t\tentity->pre_process = pdcp_pre_process_uplane_sn_18_ul;\n+\t\tentity->post_process = pdcp_post_process_ul;\n+\t}\n+\n+\tif (entity->pre_process == NULL || entity->post_process == NULL)\n+\t\treturn -ENOTSUP;\n+\n+\treturn 0;\n+}\n+\n static int\n pdcp_entity_priv_populate(struct entity_priv *en_priv, const struct rte_pdcp_entity_conf *conf)\n {\n@@ -134,5 +460,9 @@ pdcp_process_func_set(struct rte_pdcp_entity *entity, const struct rte_pdcp_enti\n \tif (ret)\n \t\treturn ret;\n \n+\tret = pdcp_pre_post_func_set(entity, conf);\n+\tif (ret)\n+\t\treturn ret;\n+\n \treturn 0;\n }\n",
    "prefixes": [
        "v2",
        "06/22"
    ]
}