get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 135444,
    "url": "https://patches.dpdk.org/api/patches/135444/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20231221123545.510-15-anoobj@marvell.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<20231221123545.510-15-anoobj@marvell.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231221123545.510-15-anoobj@marvell.com",
    "date": "2023-12-21T12:35:35",
    "name": "[14/24] crypto/cnxk: separate IPsec from security common code",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "01f8c878754fddb43802199b8b115f3ddd74026a",
    "submitter": {
        "id": 1205,
        "url": "https://patches.dpdk.org/api/people/1205/?format=api",
        "name": "Anoob Joseph",
        "email": "anoobj@marvell.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20231221123545.510-15-anoobj@marvell.com/mbox/",
    "series": [
        {
            "id": 30646,
            "url": "https://patches.dpdk.org/api/series/30646/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=30646",
            "date": "2023-12-21T12:35:21",
            "name": "Fixes and improvements in crypto cnxk",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/30646/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/135444/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/135444/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 E6F5143750;\n\tThu, 21 Dec 2023 13:37:29 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D21B542E7C;\n\tThu, 21 Dec 2023 13:36:30 +0100 (CET)",
            "from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com\n [67.231.148.174])\n by mails.dpdk.org (Postfix) with ESMTP id 8641C42EB0\n for <dev@dpdk.org>; Thu, 21 Dec 2023 13:36:29 +0100 (CET)",
            "from pps.filterd (m0045849.ppops.net [127.0.0.1])\n by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id\n 3BLCVT4V019308 for <dev@dpdk.org>; Thu, 21 Dec 2023 04:36:28 -0800",
            "from dc5-exch01.marvell.com ([199.233.59.181])\n by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3v4nekg0jd-1\n (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT)\n for <dev@dpdk.org>; Thu, 21 Dec 2023 04:36:28 -0800 (PST)",
            "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 Thu, 21 Dec 2023 04:36:27 -0800",
            "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; Thu, 21 Dec 2023 04:36:27 -0800",
            "from BG-LT92004.corp.innovium.com (unknown [10.193.71.152])\n by maili.marvell.com (Postfix) with ESMTP id 41A643F7073;\n Thu, 21 Dec 2023 04:36:23 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=\n from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding:content-type; s=\n pfpt0220; bh=cMICx3xSH7h8+wI7RU/qhkuhn+dc7a/7NJls34bYNXg=; b=IC0\n xdwzhGELlCEdd/InrRCEbbArnHo5HJBoXXmGxpN/gQH2Ah0+nZj4MNiFz9awg0Ir\n /BWs+sOQDbj5x49sRky3HAj1fyDYcQBiKkvXmJlpJKUAh2IzFzrSB8xgk5RnILKs\n EdZuT3cwRhxmObuWra9A2X6j5Rpmm/Jak6g2H49MBn4rx6SS4uqw1GRx/FdW6GFY\n ppAHVzD3mRgX7LSS5YYwCs9MK3AHT7pRk8UR5eU6G0P1e2aOieVUTsJk2CG38/VX\n 30fG9A4cfqeRKOwRXPrmMfEdd4CVUK63C9hUvIxRpSMUvFVSP9IrEfhopdmiPDKN\n mS476QMlG6cc54kgK6w==",
        "From": "Anoob Joseph <anoobj@marvell.com>",
        "To": "Akhil Goyal <gakhil@marvell.com>",
        "CC": "Jerin Jacob <jerinj@marvell.com>, Vidya Sagar Velumuri\n <vvelumuri@marvell.com>,\n Tejasree Kondoj <ktejasree@marvell.com>, <dev@dpdk.org>",
        "Subject": "[PATCH 14/24] crypto/cnxk: separate IPsec from security common code",
        "Date": "Thu, 21 Dec 2023 18:05:35 +0530",
        "Message-ID": "<20231221123545.510-15-anoobj@marvell.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20231221123545.510-1-anoobj@marvell.com>",
        "References": "<20231221123545.510-1-anoobj@marvell.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Content-Type": "text/plain",
        "X-Proofpoint-GUID": "JvwZICjLeXQaghH2MlLewFfSaIAtHEy1",
        "X-Proofpoint-ORIG-GUID": "JvwZICjLeXQaghH2MlLewFfSaIAtHEy1",
        "X-Proofpoint-Virus-Version": "vendor=baseguard\n engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26\n definitions=2023-12-09_02,2023-12-07_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": "The current structs and functions assume only IPsec offload. Separate it\nout to allow for addition of TLS.\n\nSigned-off-by: Anoob Joseph <anoobj@marvell.com>\nSigned-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>\n---\n drivers/crypto/cnxk/cn10k_cryptodev.c     |   2 +-\n drivers/crypto/cnxk/cn10k_cryptodev_sec.c | 127 ++++++++++++++++++++++\n drivers/crypto/cnxk/cn10k_cryptodev_sec.h |  61 +++++++++++\n drivers/crypto/cnxk/cn10k_ipsec.c         | 127 +++-------------------\n drivers/crypto/cnxk/cn10k_ipsec.h         |  45 +++-----\n drivers/crypto/cnxk/cn10k_ipsec_la_ops.h  |   1 +\n drivers/crypto/cnxk/meson.build           |   1 +\n 7 files changed, 218 insertions(+), 146 deletions(-)\n create mode 100644 drivers/crypto/cnxk/cn10k_cryptodev_sec.c\n create mode 100644 drivers/crypto/cnxk/cn10k_cryptodev_sec.h",
    "diff": "diff --git a/drivers/crypto/cnxk/cn10k_cryptodev.c b/drivers/crypto/cnxk/cn10k_cryptodev.c\nindex 2fd4df3c5d..5ed918e18e 100644\n--- a/drivers/crypto/cnxk/cn10k_cryptodev.c\n+++ b/drivers/crypto/cnxk/cn10k_cryptodev.c\n@@ -12,7 +12,7 @@\n \n #include \"cn10k_cryptodev.h\"\n #include \"cn10k_cryptodev_ops.h\"\n-#include \"cn10k_ipsec.h\"\n+#include \"cn10k_cryptodev_sec.h\"\n #include \"cnxk_cryptodev.h\"\n #include \"cnxk_cryptodev_capabilities.h\"\n #include \"cnxk_cryptodev_sec.h\"\ndiff --git a/drivers/crypto/cnxk/cn10k_cryptodev_sec.c b/drivers/crypto/cnxk/cn10k_cryptodev_sec.c\nnew file mode 100644\nindex 0000000000..0fd0a5b03c\n--- /dev/null\n+++ b/drivers/crypto/cnxk/cn10k_cryptodev_sec.c\n@@ -0,0 +1,127 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2023 Marvell.\n+ */\n+\n+#include <rte_security.h>\n+\n+#include \"cn10k_cryptodev_ops.h\"\n+#include \"cn10k_cryptodev_sec.h\"\n+#include \"cnxk_cryptodev_ops.h\"\n+\n+static int\n+cn10k_sec_session_create(void *dev, struct rte_security_session_conf *conf,\n+\t\t\t struct rte_security_session *sess)\n+{\n+\tstruct rte_cryptodev *crypto_dev = dev;\n+\tstruct cnxk_cpt_vf *vf;\n+\tstruct cnxk_cpt_qp *qp;\n+\n+\tif (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL)\n+\t\treturn -EINVAL;\n+\n+\tqp = crypto_dev->data->queue_pairs[0];\n+\tif (qp == NULL) {\n+\t\tplt_err(\"Setup cryptodev queue pair before creating security session\");\n+\t\treturn -EPERM;\n+\t}\n+\n+\tvf = crypto_dev->data->dev_private;\n+\n+\tif (conf->protocol == RTE_SECURITY_PROTOCOL_IPSEC) {\n+\t\t((struct cn10k_sec_session *)sess)->userdata = conf->userdata;\n+\t\treturn cn10k_ipsec_session_create(vf, qp, &conf->ipsec, conf->crypto_xform, sess);\n+\t}\n+\n+\treturn -ENOTSUP;\n+}\n+\n+static int\n+cn10k_sec_session_destroy(void *dev, struct rte_security_session *sec_sess)\n+{\n+\tstruct cn10k_sec_session *cn10k_sec_sess;\n+\tstruct rte_cryptodev *crypto_dev = dev;\n+\tstruct cnxk_cpt_qp *qp;\n+\n+\tif (unlikely(sec_sess == NULL))\n+\t\treturn -EINVAL;\n+\n+\tqp = crypto_dev->data->queue_pairs[0];\n+\tif (unlikely(qp == NULL))\n+\t\treturn -ENOTSUP;\n+\n+\tcn10k_sec_sess = (struct cn10k_sec_session *)sec_sess;\n+\n+\tif (cn10k_sec_sess->proto == RTE_SECURITY_PROTOCOL_IPSEC)\n+\t\treturn cn10k_sec_ipsec_session_destroy(qp, cn10k_sec_sess);\n+\n+\treturn -EINVAL;\n+}\n+\n+static unsigned int\n+cn10k_sec_session_get_size(void *dev __rte_unused)\n+{\n+\treturn sizeof(struct cn10k_sec_session) - sizeof(struct rte_security_session);\n+}\n+\n+static int\n+cn10k_sec_session_stats_get(void *dev, struct rte_security_session *sec_sess,\n+\t\t\t    struct rte_security_stats *stats)\n+{\n+\tstruct cn10k_sec_session *cn10k_sec_sess;\n+\tstruct rte_cryptodev *crypto_dev = dev;\n+\tstruct cnxk_cpt_qp *qp;\n+\n+\tif (unlikely(sec_sess == NULL))\n+\t\treturn -EINVAL;\n+\n+\tqp = crypto_dev->data->queue_pairs[0];\n+\tif (unlikely(qp == NULL))\n+\t\treturn -ENOTSUP;\n+\n+\tcn10k_sec_sess = (struct cn10k_sec_session *)sec_sess;\n+\n+\tif (cn10k_sec_sess->proto == RTE_SECURITY_PROTOCOL_IPSEC)\n+\t\treturn cn10k_ipsec_stats_get(qp, cn10k_sec_sess, stats);\n+\n+\treturn -ENOTSUP;\n+}\n+\n+static int\n+cn10k_sec_session_update(void *dev, struct rte_security_session *sec_sess,\n+\t\t\t struct rte_security_session_conf *conf)\n+{\n+\tstruct cn10k_sec_session *cn10k_sec_sess;\n+\tstruct rte_cryptodev *crypto_dev = dev;\n+\tstruct cnxk_cpt_qp *qp;\n+\tstruct cnxk_cpt_vf *vf;\n+\n+\tif (sec_sess == NULL)\n+\t\treturn -EINVAL;\n+\n+\tqp = crypto_dev->data->queue_pairs[0];\n+\tif (qp == NULL)\n+\t\treturn -EINVAL;\n+\n+\tvf = crypto_dev->data->dev_private;\n+\n+\tcn10k_sec_sess = (struct cn10k_sec_session *)sec_sess;\n+\n+\tif (cn10k_sec_sess->proto == RTE_SECURITY_PROTOCOL_IPSEC)\n+\t\treturn cn10k_ipsec_session_update(vf, qp, cn10k_sec_sess, conf);\n+\n+\treturn -ENOTSUP;\n+}\n+\n+/* Update platform specific security ops */\n+void\n+cn10k_sec_ops_override(void)\n+{\n+\t/* Update platform specific ops */\n+\tcnxk_sec_ops.session_create = cn10k_sec_session_create;\n+\tcnxk_sec_ops.session_destroy = cn10k_sec_session_destroy;\n+\tcnxk_sec_ops.session_get_size = cn10k_sec_session_get_size;\n+\tcnxk_sec_ops.session_stats_get = cn10k_sec_session_stats_get;\n+\tcnxk_sec_ops.session_update = cn10k_sec_session_update;\n+\tcnxk_sec_ops.inb_pkt_rx_inject = cn10k_cryptodev_sec_inb_rx_inject;\n+\tcnxk_sec_ops.rx_inject_configure = cn10k_cryptodev_sec_rx_inject_configure;\n+}\ndiff --git a/drivers/crypto/cnxk/cn10k_cryptodev_sec.h b/drivers/crypto/cnxk/cn10k_cryptodev_sec.h\nnew file mode 100644\nindex 0000000000..02fd35eab7\n--- /dev/null\n+++ b/drivers/crypto/cnxk/cn10k_cryptodev_sec.h\n@@ -0,0 +1,61 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(C) 2023 Marvell.\n+ */\n+\n+#ifndef __CN10K_CRYPTODEV_SEC_H__\n+#define __CN10K_CRYPTODEV_SEC_H__\n+\n+#include <rte_security.h>\n+\n+#include \"roc_constants.h\"\n+#include \"roc_cpt.h\"\n+\n+#include \"cn10k_ipsec.h\"\n+\n+struct cn10k_sec_session {\n+\tstruct rte_security_session rte_sess;\n+\n+\t/** PMD private space */\n+\n+\tenum rte_security_session_protocol proto;\n+\t/** Pre-populated CPT inst words */\n+\tstruct cnxk_cpt_inst_tmpl inst;\n+\tuint16_t max_extended_len;\n+\tuint16_t iv_offset;\n+\tuint8_t iv_length;\n+\tunion {\n+\t\tstruct {\n+\t\t\tuint8_t ip_csum;\n+\t\t\tbool is_outbound;\n+\t\t} ipsec;\n+\t};\n+\t/** Queue pair */\n+\tstruct cnxk_cpt_qp *qp;\n+\t/** Userdata to be set for Rx inject */\n+\tvoid *userdata;\n+\n+\t/**\n+\t * End of SW mutable area\n+\t */\n+\tunion {\n+\t\tstruct cn10k_ipsec_sa sa;\n+\t};\n+} __rte_aligned(ROC_ALIGN);\n+\n+static inline uint64_t\n+cpt_inst_w7_get(struct roc_cpt *roc_cpt, void *cptr)\n+{\n+\tunion cpt_inst_w7 w7;\n+\n+\tw7.u64 = 0;\n+\tw7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_IE];\n+\tw7.s.ctx_val = 1;\n+\tw7.s.cptr = (uint64_t)cptr;\n+\trte_mb();\n+\n+\treturn w7.u64;\n+}\n+\n+void cn10k_sec_ops_override(void);\n+\n+#endif /* __CN10K_CRYPTODEV_SEC_H__ */\ndiff --git a/drivers/crypto/cnxk/cn10k_ipsec.c b/drivers/crypto/cnxk/cn10k_ipsec.c\nindex a9c673ea83..74d6cd70d1 100644\n--- a/drivers/crypto/cnxk/cn10k_ipsec.c\n+++ b/drivers/crypto/cnxk/cn10k_ipsec.c\n@@ -11,6 +11,7 @@\n #include <rte_udp.h>\n \n #include \"cn10k_cryptodev_ops.h\"\n+#include \"cn10k_cryptodev_sec.h\"\n #include \"cn10k_ipsec.h\"\n #include \"cnxk_cryptodev.h\"\n #include \"cnxk_cryptodev_ops.h\"\n@@ -19,20 +20,6 @@\n \n #include \"roc_api.h\"\n \n-static uint64_t\n-cpt_inst_w7_get(struct roc_cpt *roc_cpt, void *sa)\n-{\n-\tunion cpt_inst_w7 w7;\n-\n-\tw7.u64 = 0;\n-\tw7.s.egrp = roc_cpt->eng_grp[CPT_ENG_TYPE_IE];\n-\tw7.s.ctx_val = 1;\n-\tw7.s.cptr = (uint64_t)sa;\n-\trte_mb();\n-\n-\treturn w7.u64;\n-}\n-\n static int\n cn10k_ipsec_outb_sa_create(struct roc_cpt *roc_cpt, struct roc_cpt_lf *lf,\n \t\t\t   struct rte_security_ipsec_xform *ipsec_xfrm,\n@@ -260,29 +247,19 @@ cn10k_ipsec_inb_sa_create(struct roc_cpt *roc_cpt, struct roc_cpt_lf *lf,\n \treturn ret;\n }\n \n-static int\n-cn10k_ipsec_session_create(void *dev,\n+int\n+cn10k_ipsec_session_create(struct cnxk_cpt_vf *vf, struct cnxk_cpt_qp *qp,\n \t\t\t   struct rte_security_ipsec_xform *ipsec_xfrm,\n \t\t\t   struct rte_crypto_sym_xform *crypto_xfrm,\n \t\t\t   struct rte_security_session *sess)\n {\n-\tstruct rte_cryptodev *crypto_dev = dev;\n \tstruct roc_cpt *roc_cpt;\n-\tstruct cnxk_cpt_vf *vf;\n-\tstruct cnxk_cpt_qp *qp;\n \tint ret;\n \n-\tqp = crypto_dev->data->queue_pairs[0];\n-\tif (qp == NULL) {\n-\t\tplt_err(\"Setup cpt queue pair before creating security session\");\n-\t\treturn -EPERM;\n-\t}\n-\n \tret = cnxk_ipsec_xform_verify(ipsec_xfrm, crypto_xfrm);\n \tif (ret)\n \t\treturn ret;\n \n-\tvf = crypto_dev->data->dev_private;\n \troc_cpt = &vf->cpt;\n \n \tif (ipsec_xfrm->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS)\n@@ -293,38 +270,15 @@ cn10k_ipsec_session_create(void *dev,\n \t\t\t\t\t\t  (struct cn10k_sec_session *)sess);\n }\n \n-static int\n-cn10k_sec_session_create(void *device, struct rte_security_session_conf *conf,\n-\t\t\t struct rte_security_session *sess)\n-{\n-\tif (conf->action_type != RTE_SECURITY_ACTION_TYPE_LOOKASIDE_PROTOCOL)\n-\t\treturn -EINVAL;\n-\n-\tif (conf->protocol == RTE_SECURITY_PROTOCOL_IPSEC) {\n-\t\t((struct cn10k_sec_session *)sess)->userdata = conf->userdata;\n-\t\treturn cn10k_ipsec_session_create(device, &conf->ipsec, conf->crypto_xform, sess);\n-\t}\n-\treturn -ENOTSUP;\n-}\n-\n-static int\n-cn10k_sec_ipsec_session_destroy(void *dev, struct rte_security_session *sec_sess)\n+int\n+cn10k_sec_ipsec_session_destroy(struct cnxk_cpt_qp *qp, struct cn10k_sec_session *sess)\n {\n-\tstruct rte_cryptodev *crypto_dev = dev;\n \tunion roc_ot_ipsec_sa_word2 *w2;\n-\tstruct cn10k_sec_session *sess;\n \tstruct cn10k_ipsec_sa *sa;\n-\tstruct cnxk_cpt_qp *qp;\n \tstruct roc_cpt_lf *lf;\n \tvoid *sa_dptr = NULL;\n \tint ret;\n \n-\tsess = (struct cn10k_sec_session *)sec_sess;\n-\n-\tqp = crypto_dev->data->queue_pairs[0];\n-\tif (unlikely(qp == NULL))\n-\t\treturn -ENOTSUP;\n-\n \tlf = &qp->lf;\n \n \tsa = &sess->sa;\n@@ -374,48 +328,18 @@ cn10k_sec_ipsec_session_destroy(void *dev, struct rte_security_session *sec_sess\n \treturn 0;\n }\n \n-static int\n-cn10k_sec_session_destroy(void *dev, struct rte_security_session *sec_sess)\n+int\n+cn10k_ipsec_stats_get(struct cnxk_cpt_qp *qp, struct cn10k_sec_session *sess,\n+\t\t      struct rte_security_stats *stats)\n {\n-\tif (unlikely(sec_sess == NULL))\n-\t\treturn -EINVAL;\n-\n-\tif (((struct cn10k_sec_session *)sec_sess)->proto == RTE_SECURITY_PROTOCOL_IPSEC)\n-\t\treturn cn10k_sec_ipsec_session_destroy(dev, sec_sess);\n-\n-\treturn -EINVAL;\n-}\n-\n-static unsigned int\n-cn10k_sec_session_get_size(void *device __rte_unused)\n-{\n-\treturn sizeof(struct cn10k_sec_session) - sizeof(struct rte_security_session);\n-}\n-\n-static int\n-cn10k_sec_session_stats_get(void *device, struct rte_security_session *sess,\n-\t\t\t    struct rte_security_stats *stats)\n-{\n-\tstruct rte_cryptodev *crypto_dev = device;\n \tstruct roc_ot_ipsec_outb_sa *out_sa;\n \tstruct roc_ot_ipsec_inb_sa *in_sa;\n-\tstruct cn10k_sec_session *priv;\n \tstruct cn10k_ipsec_sa *sa;\n-\tstruct cnxk_cpt_qp *qp;\n-\n-\tif (unlikely(sess == NULL))\n-\t\treturn -EINVAL;\n-\n-\tpriv = (struct cn10k_sec_session *)sess;\n-\n-\tqp = crypto_dev->data->queue_pairs[0];\n-\tif (qp == NULL)\n-\t\treturn -EINVAL;\n \n \tstats->protocol = RTE_SECURITY_PROTOCOL_IPSEC;\n-\tsa = &priv->sa;\n+\tsa = &sess->sa;\n \n-\tif (priv->ipsec.is_outbound) {\n+\tif (sess->ipsec.is_outbound) {\n \t\tout_sa = &sa->out_sa;\n \t\troc_cpt_lf_ctx_flush(&qp->lf, out_sa, false);\n \t\trte_delay_ms(1);\n@@ -432,23 +356,13 @@ cn10k_sec_session_stats_get(void *device, struct rte_security_session *sess,\n \treturn 0;\n }\n \n-static int\n-cn10k_sec_session_update(void *device, struct rte_security_session *sess,\n-\t\t\t struct rte_security_session_conf *conf)\n+int\n+cn10k_ipsec_session_update(struct cnxk_cpt_vf *vf, struct cnxk_cpt_qp *qp,\n+\t\t\t   struct cn10k_sec_session *sess, struct rte_security_session_conf *conf)\n {\n-\tstruct rte_cryptodev *crypto_dev = device;\n \tstruct roc_cpt *roc_cpt;\n-\tstruct cnxk_cpt_qp *qp;\n-\tstruct cnxk_cpt_vf *vf;\n \tint ret;\n \n-\tif (sess == NULL)\n-\t\treturn -EINVAL;\n-\n-\tqp = crypto_dev->data->queue_pairs[0];\n-\tif (qp == NULL)\n-\t\treturn -EINVAL;\n-\n \tif (conf->ipsec.direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS)\n \t\treturn -ENOTSUP;\n \n@@ -456,23 +370,8 @@ cn10k_sec_session_update(void *device, struct rte_security_session *sess,\n \tif (ret)\n \t\treturn ret;\n \n-\tvf = crypto_dev->data->dev_private;\n \troc_cpt = &vf->cpt;\n \n \treturn cn10k_ipsec_outb_sa_create(roc_cpt, &qp->lf, &conf->ipsec, conf->crypto_xform,\n \t\t\t\t\t  (struct cn10k_sec_session *)sess);\n }\n-\n-/* Update platform specific security ops */\n-void\n-cn10k_sec_ops_override(void)\n-{\n-\t/* Update platform specific ops */\n-\tcnxk_sec_ops.session_create = cn10k_sec_session_create;\n-\tcnxk_sec_ops.session_destroy = cn10k_sec_session_destroy;\n-\tcnxk_sec_ops.session_get_size = cn10k_sec_session_get_size;\n-\tcnxk_sec_ops.session_stats_get = cn10k_sec_session_stats_get;\n-\tcnxk_sec_ops.session_update = cn10k_sec_session_update;\n-\tcnxk_sec_ops.inb_pkt_rx_inject = cn10k_cryptodev_sec_inb_rx_inject;\n-\tcnxk_sec_ops.rx_inject_configure = cn10k_cryptodev_sec_rx_inject_configure;\n-}\ndiff --git a/drivers/crypto/cnxk/cn10k_ipsec.h b/drivers/crypto/cnxk/cn10k_ipsec.h\nindex 2b7a3e6acf..0d1e14a065 100644\n--- a/drivers/crypto/cnxk/cn10k_ipsec.h\n+++ b/drivers/crypto/cnxk/cn10k_ipsec.h\n@@ -11,9 +11,12 @@\n #include \"roc_constants.h\"\n #include \"roc_ie_ot.h\"\n \n+#include \"cnxk_cryptodev.h\"\n+#include \"cnxk_cryptodev_ops.h\"\n #include \"cnxk_ipsec.h\"\n \n-typedef void *CN10K_SA_CONTEXT_MARKER[0];\n+/* Forward declaration */\n+struct cn10k_sec_session;\n \n struct cn10k_ipsec_sa {\n \tunion {\n@@ -24,34 +27,14 @@ struct cn10k_ipsec_sa {\n \t};\n } __rte_aligned(ROC_ALIGN);\n \n-struct cn10k_sec_session {\n-\tstruct rte_security_session rte_sess;\n-\n-\t/** PMD private space */\n-\n-\tenum rte_security_session_protocol proto;\n-\t/** Pre-populated CPT inst words */\n-\tstruct cnxk_cpt_inst_tmpl inst;\n-\tuint16_t max_extended_len;\n-\tuint16_t iv_offset;\n-\tuint8_t iv_length;\n-\tunion {\n-\t\tstruct {\n-\t\t\tuint8_t ip_csum;\n-\t\t\tbool is_outbound;\n-\t\t} ipsec;\n-\t};\n-\t/** Queue pair */\n-\tstruct cnxk_cpt_qp *qp;\n-\t/** Userdata to be set for Rx inject */\n-\tvoid *userdata;\n-\n-\t/**\n-\t * End of SW mutable area\n-\t */\n-\tstruct cn10k_ipsec_sa sa;\n-} __rte_aligned(ROC_ALIGN);\n-\n-void cn10k_sec_ops_override(void);\n-\n+int cn10k_ipsec_session_create(struct cnxk_cpt_vf *vf, struct cnxk_cpt_qp *qp,\n+\t\t\t       struct rte_security_ipsec_xform *ipsec_xfrm,\n+\t\t\t       struct rte_crypto_sym_xform *crypto_xfrm,\n+\t\t\t       struct rte_security_session *sess);\n+int cn10k_sec_ipsec_session_destroy(struct cnxk_cpt_qp *qp, struct cn10k_sec_session *sess);\n+int cn10k_ipsec_stats_get(struct cnxk_cpt_qp *qp, struct cn10k_sec_session *sess,\n+\t\t\t  struct rte_security_stats *stats);\n+int cn10k_ipsec_session_update(struct cnxk_cpt_vf *vf, struct cnxk_cpt_qp *qp,\n+\t\t\t       struct cn10k_sec_session *sess,\n+\t\t\t       struct rte_security_session_conf *conf);\n #endif /* __CN10K_IPSEC_H__ */\ndiff --git a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h\nindex af2c85022e..a30b8e413d 100644\n--- a/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h\n+++ b/drivers/crypto/cnxk/cn10k_ipsec_la_ops.h\n@@ -11,6 +11,7 @@\n #include \"roc_ie.h\"\n \n #include \"cn10k_cryptodev.h\"\n+#include \"cn10k_cryptodev_sec.h\"\n #include \"cn10k_ipsec.h\"\n #include \"cnxk_cryptodev.h\"\n #include \"cnxk_cryptodev_ops.h\"\ndiff --git a/drivers/crypto/cnxk/meson.build b/drivers/crypto/cnxk/meson.build\nindex 3d9a0dbbf0..d6fafd43d9 100644\n--- a/drivers/crypto/cnxk/meson.build\n+++ b/drivers/crypto/cnxk/meson.build\n@@ -14,6 +14,7 @@ sources = files(\n         'cn9k_ipsec.c',\n         'cn10k_cryptodev.c',\n         'cn10k_cryptodev_ops.c',\n+        'cn10k_cryptodev_sec.c',\n         'cn10k_ipsec.c',\n         'cnxk_cryptodev.c',\n         'cnxk_cryptodev_capabilities.c',\n",
    "prefixes": [
        "14/24"
    ]
}