get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 127338,
    "url": "http://patches.dpdk.org/api/patches/127338/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20230524160116.304-8-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": "<20230524160116.304-8-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20230524160116.304-8-anoobj@marvell.com",
    "date": "2023-05-24T16:01:01",
    "name": "[v3,07/22] pdcp: add pre and post process for DL",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "5083a23c59b072c0ec1aea5877069f36b863356e",
    "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/20230524160116.304-8-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 28158,
            "url": "http://patches.dpdk.org/api/series/28158/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=28158",
            "date": "2023-05-24T16:00:54",
            "name": "lib: add pdcp protocol",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/28158/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/127338/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/127338/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 17E5042B8F;\n\tWed, 24 May 2023 18:02:37 +0200 (CEST)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id B2ADF42D5D;\n\tWed, 24 May 2023 18:02:00 +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 4A38E42D50\n for <dev@dpdk.org>; Wed, 24 May 2023 18:01:59 +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 34OEgC6p025096; Wed, 24 May 2023 09:01:57 -0700",
            "from dc5-exch02.marvell.com ([199.233.59.182])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3qsbxetjst-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT);\n Wed, 24 May 2023 09:01:57 -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 Wed, 24 May 2023 09:01:55 -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; Wed, 24 May 2023 09:01:55 -0700",
            "from BG-LT92004.corp.innovium.com (unknown [10.28.161.183])\n by maili.marvell.com (Postfix) with ESMTP id C21843F703F;\n Wed, 24 May 2023 09:01:51 -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=oit1ZNdsWsVeG/TR60GB5ofco/GOILqtOXj3zyYuTrg=;\n b=QG1yKP/ab2BwvQb/YQcADqkNtAqfuwVXZpV3WUb83O0Dg3ZI9KRNuGw4ypjOglQyga7J\n 3sUbP+PRmUVzw4VFnqiLFFJ8zjqFr4m+FUbFt2wsjyDxVO4JVXNoBelJ0Z9hhJoxgq+6\n iNRP+orIEOkb2oOG5xn/RYuete7G7QAxFF2FiUa8WjwIWsKsRjqPYX2kOUeD16z0Uwgv\n p8buibcx+jY0j2MtBxvBwE9IdIPpbUsyqP/7KPFfcxTpY2lt11cx8I8WRohbsWg2uqak\n KJdM/V8KEjfszyR6CD4EWm/UmAyBmx42gQqd1LzD9jByvnHSeMpCjfkanoWhLfx1L9YY sg==",
        "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 v3 07/22] pdcp: add pre and post process for DL",
        "Date": "Wed, 24 May 2023 21:31:01 +0530",
        "Message-ID": "<20230524160116.304-8-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20230524160116.304-1-anoobj@marvell.com>",
        "References": "<20230414174512.642-1-anoobj@marvell.com>\n <20230524160116.304-1-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-ORIG-GUID": "65drbmdKHk2wpuhU64wy8mSKZA9ClfV3",
        "X-Proofpoint-GUID": "65drbmdKHk2wpuhU64wy8mSKZA9ClfV3",
        "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-24_11,2023-05-24_01,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 | 454 ++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 456 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 2132a136d9..3af0df75ef 100644\n--- a/lib/pdcp/pdcp_process.c\n+++ b/lib/pdcp/pdcp_process.c\n@@ -329,9 +329,424 @@ 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+\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+\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, is_integ_protected);\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+\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+\t\tcop_prepare(en_priv, mb, cop[nb_prep++], data_offset, count, is_integ_protected);\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+\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+\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 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_sn_12_dl_flags(const struct rte_pdcp_entity *entity,\n+\t\t\t\t\tstruct rte_mbuf *in_mb[],\n+\t\t\t\t\tstruct rte_mbuf *out_mb[],\n+\t\t\t\t\tuint16_t num, uint16_t *nb_err_ret,\n+\t\t\t\t\tconst 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+\tint i, nb_success = 0, nb_err = 0, rsn = 0;\n+\tconst uint32_t aad_sz = en_priv->aad_sz;\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+\t\tpdu_hdr = rte_pktmbuf_mtod_offset(mb, struct rte_pdcp_up_data_pdu_sn_12_hdr *,\n+\t\t\t\t\t\t  aad_sz);\n+\n+\t\tRTE_ASSERT(pdu_hdr->d_c == RTE_PDCP_PDU_TYPE_DATA);\n+\t\trsn = ((pdu_hdr->sn_11_8 << 8) | (pdu_hdr->sn_7_0));\n+\n+\t\tif (unlikely(pdcp_sn_count_get(en_priv->state.rx_deliv, rsn, &count,\n+\t\t\t\t\t       RTE_SECURITY_PDCP_SN_SIZE_12)))\n+\t\t\tgoto error;\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_sn_12_dl_ip(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)\n+{\n+\treturn pdcp_post_process_uplane_sn_12_dl_flags(entity, in_mb, out_mb, num, nb_err, true);\n+}\n+\n+static uint16_t\n+pdcp_post_process_uplane_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)\n+{\n+\treturn pdcp_post_process_uplane_sn_12_dl_flags(entity, in_mb, out_mb, num, nb_err, false);\n+}\n+\n+static inline uint16_t\n+pdcp_post_process_uplane_sn_18_dl_flags(const struct rte_pdcp_entity *entity,\n+\t\t\t\t\tstruct rte_mbuf *in_mb[],\n+\t\t\t\t\tstruct rte_mbuf *out_mb[],\n+\t\t\t\t\tuint16_t num, uint16_t *nb_err_ret,\n+\t\t\t\t\tconst 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+\tconst uint32_t aad_sz = en_priv->aad_sz;\n+\tint i, nb_success = 0, nb_err = 0;\n+\tstruct rte_mbuf *mb, *err_mb[num];\n+\tint32_t rsn = 0;\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\tpdu_hdr = rte_pktmbuf_mtod_offset(mb, struct rte_pdcp_up_data_pdu_sn_18_hdr *,\n+\t\t\t\t\t\t  aad_sz);\n+\n+\t\tRTE_ASSERT(pdu_hdr->d_c == RTE_PDCP_PDU_TYPE_DATA);\n+\t\trsn = ((pdu_hdr->sn_17_16 << 16) | (pdu_hdr->sn_15_8 << 8) | (pdu_hdr->sn_7_0));\n+\n+\t\tif (unlikely(pdcp_sn_count_get(en_priv->state.rx_deliv, rsn, &count,\n+\t\t\t\t\t       RTE_SECURITY_PDCP_SN_SIZE_18)))\n+\t\t\tgoto error;\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_sn_18_dl_ip(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)\n+{\n+\treturn pdcp_post_process_uplane_sn_18_dl_flags(entity, in_mb, out_mb, num, nb_err, true);\n+}\n+\n+static uint16_t\n+pdcp_post_process_uplane_sn_18_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)\n+{\n+\treturn pdcp_post_process_uplane_sn_18_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+\tstruct rte_pdcp_cp_data_pdu_sn_12_hdr *pdu_hdr;\n+\tconst uint32_t aad_sz = en_priv->aad_sz;\n+\tint i, nb_success = 0, nb_err = 0;\n+\tstruct rte_mbuf *err_mb[num];\n+\tstruct rte_mbuf *mb;\n+\tuint32_t count;\n+\tint32_t rsn;\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\tpdu_hdr = rte_pktmbuf_mtod_offset(mb, struct rte_pdcp_cp_data_pdu_sn_12_hdr *,\n+\t\t\t\t\t\t  aad_sz);\n+\t\trsn = ((pdu_hdr->sn_11_8 << 8) | (pdu_hdr->sn_7_0));\n+\n+\t\tif (unlikely(pdcp_sn_count_get(en_priv->state.rx_deliv, rsn, &count,\n+\t\t\t\t\t       RTE_SECURITY_PDCP_SN_SIZE_12)))\n+\t\t\tgoto error;\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@@ -342,6 +757,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@@ -356,6 +778,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_sn_12_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_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_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_sn_18_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_sn_18_dl;\n+\t}\n+\n \tif (entity->pre_process == NULL || entity->post_process == NULL)\n \t\treturn -ENOTSUP;\n \n",
    "prefixes": [
        "v3",
        "07/22"
    ]
}