get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127572,
    "url": "http://patchwork.dpdk.org/api/patches/127572/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20230526210214.617-7-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": "<20230526210214.617-7-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230526210214.617-7-anoobj@marvell.com",
    "date": "2023-05-26T21:01:58",
    "name": "[v4,06/22] pdcp: add pre and post process for UL",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "f376340495ed10eb2602eeb2a76849259430edf8",
    "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/20230526210214.617-7-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 28214,
            "url": "http://patchwork.dpdk.org/api/series/28214/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=28214",
            "date": "2023-05-26T21:01:52",
            "name": "lib: add pdcp protocol",
            "version": 4,
            "mbox": "http://patchwork.dpdk.org/series/28214/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/127572/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/127572/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 5376B42BAD;\n\tFri, 26 May 2023 23:03:17 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 3238342D38;\n\tFri, 26 May 2023 23:03:03 +0200 (CEST)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 33B5742D44\n for <dev@dpdk.org>; Fri, 26 May 2023 23:03:02 +0200 (CEST)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id\n 34QHeL1u019577; Fri, 26 May 2023 14:03:00 -0700",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qu1c78ne1-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Fri, 26 May 2023 14:03:00 -0700",
            "from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com\n (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48;\n Fri, 26 May 2023 14:02:58 -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, 26 May 2023 14:02:58 -0700",
            "from BG-LT92004.corp.innovium.com (unknown [10.193.32.169])\n by maili.marvell.com (Postfix) with ESMTP id 38CE73F706F;\n Fri, 26 May 2023 14:02:53 -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=KZ35jhczaqSpZc6Eb3hq+JCn4wmu0oG12vKcE4G/Tfw=;\n b=WTgpcJGxZjst1C4Ztvp2apsLqfsTdwAcR27jAjwyDfMbDfOTRb1zr66uaBC9D9jaFKm5\n Ct7Ihmv66JUwri09KqykSL9BXqBl8zwFV3j7Y11MmxRJWvgf6IrlMR6+AOMbg5NGO3Ab\n T4QFaQozBVCIRLx8XXuq+xNDNFtHZhXL+ZwC9p0YYEqtuZgFplN9JuQHZQAW8Np5rvk3\n xku3LPxQDvMO47CJUxXc0AVYwicURPYlJlqdQBY+lt/NxWvy/5FSMbZ+/4HA5G8Dy4FP\n v0YCGEfxSC10ocuzxVXSQrvB5TO2/609NoCAjZ5OF+QYJS5RZPEu+yzURUfZDvmEG7pe +g==",
        "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 v4 06/22] pdcp: add pre and post process for UL",
        "Date": "Sat, 27 May 2023 02:31:58 +0530",
        "Message-ID": "<20230526210214.617-7-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230526210214.617-1-anoobj@marvell.com>",
        "References": "<20230524160116.304-1-anoobj@marvell.com>\n <20230526210214.617-1-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "B2nlqjL8gpZckyZYw1T3MIhWi4AKNrDw",
        "X-Proofpoint-ORIG-GUID": "B2nlqjL8gpZckyZYw1T3MIhWi4AKNrDw",
        "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-26_10,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 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>\nAcked-by: Akhil Goyal <gakhil@marvell.com>\n---\n lib/pdcp/pdcp_entity.h  |  24 +++\n lib/pdcp/pdcp_process.c | 334 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 358 insertions(+)",
    "diff": "diff --git a/lib/pdcp/pdcp_entity.h b/lib/pdcp/pdcp_entity.h\nindex 000297588f..23628ebad4 100644\n--- a/lib/pdcp/pdcp_entity.h\n+++ b/lib/pdcp/pdcp_entity.h\n@@ -92,22 +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 79f5dce5db..9b7de39db6 100644\n--- a/lib/pdcp/pdcp_process.c\n+++ b/lib/pdcp/pdcp_process.c\n@@ -36,6 +36,336 @@ 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 cipher_shift = 3 * en_priv->flags.is_cipher_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 << cipher_shift;\n+\top->cipher.data.length = (pkt_len - data_offset) << cipher_shift;\n+\n+\tif (is_auth) {\n+\t\top->auth.data.offset = 0;\n+\t\top->auth.data.length = (pkt_len - RTE_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 - RTE_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, RTE_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, RTE_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+\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+\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, RTE_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, RTE_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+\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+\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, RTE_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, RTE_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 +464,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": [
        "v4",
        "06/22"
    ]
}