get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 43926,
    "url": "http://patches.dpdk.org/api/patches/43926/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20180828130105.30779-3-akhil.goyal@nxp.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": "<20180828130105.30779-3-akhil.goyal@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20180828130105.30779-3-akhil.goyal@nxp.com",
    "date": "2018-08-28T13:01:04",
    "name": "[2/3] crypto/dpaa2_sec: add sample pdcp descriptor apis",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "0319664498a6d4c55c5ed39a9cdbbf74c5ac121d",
    "submitter": {
        "id": 517,
        "url": "http://patches.dpdk.org/api/people/517/?format=api",
        "name": "Akhil Goyal",
        "email": "akhil.goyal@nxp.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/20180828130105.30779-3-akhil.goyal@nxp.com/mbox/",
    "series": [
        {
            "id": 1078,
            "url": "http://patches.dpdk.org/api/series/1078/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=1078",
            "date": "2018-08-28T13:01:02",
            "name": "security: support for pdcp",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/1078/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/43926/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/43926/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 78B3D4CAD;\n\tTue, 28 Aug 2018 15:04:23 +0200 (CEST)",
            "from EUR02-HE1-obe.outbound.protection.outlook.com\n\t(mail-eopbgr10078.outbound.protection.outlook.com [40.107.1.78])\n\tby dpdk.org (Postfix) with ESMTP id 61EFA4C9C\n\tfor <dev@dpdk.org>; Tue, 28 Aug 2018 15:04:20 +0200 (CEST)",
            "from GDB1.ap.freescale.net (14.143.30.134) by\n\tVI1PR04MB1390.eurprd04.prod.outlook.com (2a01:111:e400:5348::21) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17;\n\tTue, 28 Aug 2018 13:04:16 +0000"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1;\n\th=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n\tbh=XpidR79Wq8BCat0ueg0KROcuQrBOuXvMzo0FHRk7uww=;\n\tb=HQ+8K2fWLI//dLBJO0biDxSsY2AcDChebpdRCV/vbwGcjn3jAfK+fb1W+1w4EsUGWwxx+ryhKsfnBgb0S/yV83ETnM+ddSSmU6CWExejz6Cf6LqpXKhzSPo5wfKHnpt7+EPb4jB2/SOt8C03s32Yo56GDGUqu5zAwR4BwadwhrM=",
        "Authentication-Results": "spf=none (sender IP is )\n\tsmtp.mailfrom=akhil.goyal@nxp.com; ",
        "From": "akhil.goyal@nxp.com",
        "To": "dev@dpdk.org",
        "Cc": "Akhil Goyal <akhil.goyal@nxp.com>",
        "Date": "Tue, 28 Aug 2018 18:31:04 +0530",
        "Message-Id": "<20180828130105.30779-3-akhil.goyal@nxp.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20180828130105.30779-1-akhil.goyal@nxp.com>",
        "References": "<20180828130105.30779-1-akhil.goyal@nxp.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[14.143.30.134]",
        "X-ClientProxiedBy": "MAXPR0101CA0046.INDPRD01.PROD.OUTLOOK.COM\n\t(2603:1096:a00:d::32) To VI1PR04MB1390.eurprd04.prod.outlook.com\n\t(2a01:111:e400:5348::21)",
        "X-MS-PublicTrafficType": "Email",
        "X-MS-Office365-Filtering-Correlation-Id": "c5dc0dfd-3bb0-46b8-53bd-08d60ce6c335",
        "X-MS-Office365-Filtering-HT": "Tenant",
        "X-Microsoft-Antispam": "BCL:0; PCL:0;\n\tRULEID:(7020095)(4652040)(8989137)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);\n\tSRVR:VI1PR04MB1390; ",
        "X-Microsoft-Exchange-Diagnostics": [
            "1; VI1PR04MB1390;\n\t3:lLhS07AkTbLlPS2sJGWgqjj4M0LIEJLyXPekUOH0Nm6rG5dUk6PYQmG4JeaEm3L9v6yrWTtutF9YcurPcZNPTsTYxBvoZusJFC5Bh64aRF6bsoZYbF/4Junapjy/TDOnFD/R8XlZvtfuOx8ypvQKGW0jqrrzWH1uVuUj26zVPIQ5GqdRS6B/z0Ekutj3j3mQapDjzgkLoFiE+n50q+jSIhAecU3vu4zZdlEu1LT6g8fACwQs+ijVW+piZ6TeZNCj;\n\t25:syqw9VtJaXIYhP+jmaF/3WtZR2FNYPtFw1QRv+Ofv+Ug8EENIsWkTaMR/lPAT/m4Sdd+QxeX6Rpv/EbnWgDWG4mpeFmLqgemUDaBNd3HEx5n8R+gvcNvrsfFe+Q2WQQGCMXJ/qC7jEm3EG0pnnoWWIkNMIyR/VLE8WkdK0oLcm/u5wqqYUr7wN63F5FM/e3gnNEtqdXOgbIMWTy1XsgLNM1sZ30U/7hHFufak7GJGFNswF8oX22jcAXRk3hCkcGqZwJraPiJkL2xdxq6hgO6FFzlDiKWed+tZVKxOA7NvoFTD/kbfV1F2fA2kX/dWIa3YLtnV7UEKDmC65HhCVExnA==;\n\t31:DBLkTXqPB3wL/nlZA6cHiQ0yOFbZbkUqnzV9fp60tzzINge9GxlU4+MSfn3t1Pm4qvuGP2Dyv1ka2y6MuxYTr++AZiXQIo7CTsAp+T3sEk8kwmKmNVy6a707xno8rhhJVZsVA7sbGSbxIZjyYn4EV6m/f+KFLYMz3uRarrGmWSoeUXvhwnxvCyunaXDu8BrDyfAxMN00rVjDjskMW+bZm7nH3ZjjdUNveQfBjHvNTLg=",
            "1; VI1PR04MB1390;\n\t20:O7qSpmrtByRYPeiuGXZoGpG5C8qVGwoDn8062IzT27WspeEYpnuwanYBq/GjTNIxgqpRALiJzM0bTGur71xSvkk16RCZ+8By10Y+XnbQ7Mhtx16dvsEyKvmFiXApAErsXmMDIINJkfsOoqwqtVtx7BLZDTSgK8N+Rw8sdmXOKAg69ktlG4jtMv4AXCSR6L+Xq8cl1Udl5dg7SCumkKU/mm0DKDQKC8v9zAmJj6OFtuJcxv9k38S2JYwwYBgGkd0VMpEivAvNA+QyEJEwfWlBD059nCUhgvqKb78gyql+TKCu5FETJqXcq0O/7Klu4cSh9w7MMjNwtFUa+6I5pTSko1FQaE3csrKICpAxGVNEG9ENtHFmyvuyovXmt/4FQ6wHE/U+c8GreylgutHjadE+m17Gti1H4F0asyf37uuEPObsPp1UrYXijNSdWt0j926rhS2GAZ/5LkUnhNJCG6wxNc9Qd+RzT6O0QMm2S9NOi1K8Cmtcycimn15i93+FZRS+;\n\t4:hV0Ehpqlag9wisRsrh/feVcoBpyY3EY6xi285yNBRAd8kZPk+mhBO0t7hSda7ZGEBvCDYwdL6fBlGU+LrknT75OWqVGuX8Us1hiVHuqjboQ1iwZ4SAZmY+snfhn+p3FSnsqK6zmtnA22wbRJfytlyA0XdhXcnmPXMcr/FDE05TJ+jeOcuv71rc3EQAPCkrld+tKqkKZp5G3w2qw86Ait3iaWldh2ofEyjrxXtvo5DDFYbxFa1r0p3XTvERrxqWmwztU6NWf7MPEyoHbjEEA/u4j7yHMxS6cPu8CUlSZZVsuCfQd90k3N3vIjjY4bcqr0",
            "=?us-ascii?Q?1; VI1PR04MB1390;\n\t23:q8d2epKM05UgzcXwjWs497NWiKDauqy5oE8PAaO6w?=\n\tCfIwwpoE0Gpg9P1Zmr/XymaMWHqEPHTCtquilw1bs3F6AjADjKdRRqinfcR1b1KOWSkXdSAxuZ3M3ogWRWbqwzHPyDl1Xzhta+qgNUtuxlE6glPSwZBEJhH4WfUB/ZFKLNWBWJHTfktqg5o5iXmCJPfqq/NqCNXpFngfEO6yk5cLSd1FGMC/My/n5vUeVl9+tX6pg2dd5rM9dNKTQfhRt4MWIGzx9K8WHOeEt2lqNzWOPQDs38dKGnOX9DQ48/7QPgFmQw38DjPCzRZ7RrlkqifApqsyXARfZbzzpp5cyKNT9thbeJgsfNoSmdOh0HXgvq0QOEyBeTZFu34JUk1J13noGrtBriB0oLATpYVVzz7kiiXc59ciYZ2yWE9ZvJqYevE7LcHuj37hWcYh7iyFeYhw3ZsbdEOwAXeKqAMkk2AMKsWGHKWasZqws8JTkUrfJQJXk8cIyzaUqufMbzCuWsNGkIhtXkoet7RudRXI1Jcnddr5mj6WrpRypYd4TIBKUS7wT7lBBQ5CSHKGJVpeQIQSNExbKGa2DG6cPpqQoSv2/KNBmjwVgqzSwdFkaHzZfxRUawtzZ0obnHRT+cDluGlOkTrKgGOEjhfRGfkPMNxkj83u1wcFT2CT9s9V7hySP9SRvkMLdtIh9UHc8BIci1aMh6siO3NaJa1KbAKuvzM+96ZRgXiE0NsPQq722/be/pfc8JbasrDvCdYNx1gt+N+9z1lQEiNex8/oSlqX7xjifWzyRnYNFPoDucQtz2LceeWoWVhnHGaAi7InLMVj1Kt2z2Yxzpv0S0yENhzM9BkcFw3NUb07eoA77R6Bng3s2kdOS8J9PN6GURUU1ZVh9b5dy/yp1vxfmRxthgFHPkTy8op6yjSviy4xlb4ZvyDHJpWd1ouBUav0jO3aJeqAuQZzogUoEriUiX92iqbp0Z14cfoaTcnoMeguBKRauklKSAR2eGxaBlvDtwyfTOM3JIjC5MXidlC+9AydmtSIWB1s8MOIauUQZCTRkHuk25uFyw2Eew/eMHi1mTKIV1A+37vOVAWu3/OqN7nQsIRkiTUAbjpXqeCFOzwkQ0EsQFoPQt297AjvEdgoRJZGTLry3m0xl8SWKnDqfzvdazsKCJ2Qi2ByEl7mXE7qp1h15sEEbYToXO3LPojLzlPR/uFtFjpXWku7tAipD+Ux6uBE+kXcbWE3lVoOxPY+2RWfIK8323zP8Zoto2/h6b6r1LIxflBan4osE3CO3LaYlUcHb2bkgpWsRb5py0T6T4Ex1AsdvrHRstxDTzwJqwBdJN0SxtxRm4IzPvjE6sK+Dohld21UpsIEnxVCNTMHCwVIRhFcLZ/R3P7SQ/bIx3caoZnjJTfbEyViYOq56131Q3NBI1BXaTVXP5fdGye4rd4NAoYXyn7nOlIbzVT3nPHEXmb/NXdh9poe076fWxq0vQB+nlIc+GweKd6Vs5LbZ6kVo6kgec=",
            "1; VI1PR04MB1390;\n\t6:+n8NOVlZEa1t6hb2yMliCJZE7U1z+OvWn36/Z6ZOvdl1VtQYk9rWTtp3SJz/dnyxiolhICBTMk6GJzGCVNEtsgFZ+bJoTOuxQS8PMRCg4EhbbVrpT5s9upbNeLnOLmOx1x4UlLIqCiVwe4NrrpL0u6HetSROhUavgKJLy/i0RZ2eCbPeinqM+QQzR2E6NxtT3DYc3oXYexY3m/ROvaFYboj5wBo+VeysUjeB/rNfz7gwzJ97gRPC03EUFPIoPAI5CP7HoWJDrWlnhq+Wxs/pSSOb2rhFTexpaa4ZhYe02szzZpwOh5QBg7jRxS3TqqZERa9rdnebKu6e8wUpU8NI8GdrIcFTHI87ZfoPVnDen1DziIaEOSVCEgFLyyZA1Zaw+vAHCdfS8KYMdSQPjOOu579Ygr+Uqe89zHleT6CUtIXUqxKwa5yv08+n0lv37hSrlcFHWqfWv38XJy56Q4HSrA==;\n\t5:W00fyF/BYzeBMuvslhfNL8pPkwjb6dwnDF05/Ochea2hH2vwuWnuUWof2fUif62uqo9OV0I3eO3sRh0C/xZjk2GUJ9ZSwgxi8IQ60nNngjktVQ4PbJ2LD+1zOjMbygM5etUVULm7Fvvp8akpHvlxDqx/1q1qpAA9E9nlMWzFse4=;\n\t7:4Wi78ZIv3YXbtK/jXoTW7pBZM9yro4tN5hKT2hBYtLUNr27MyeHKfGXw4gA7zAU0S24P3FOXI1yx3Li2YuotqtYrQk0fD83oeHl3lxy/K6UgoHlSM87LYd/RaiLoN4e0eg1GDD1j0NrEWC6NCiEXuTSW8wyMXU9QIMZJijxQxYa6zRgGSGnzYr+XJ++K6Kppb4OX7AS4Ky6s/OS213Y05yXKvXDsMx9QU58eQxZMcqgcAa24SkZT8rnSD7t4YWDT"
        ],
        "X-MS-TrafficTypeDiagnostic": "VI1PR04MB1390:",
        "X-Microsoft-Antispam-PRVS": "<VI1PR04MB1390B07A06E6C4C1BE7335B0E60A0@VI1PR04MB1390.eurprd04.prod.outlook.com>",
        "X-Exchange-Antispam-Report-Test": "UriScan:(185117386973197);",
        "X-MS-Exchange-SenderADCheck": "1",
        "X-Exchange-Antispam-Report-CFA-Test": "BCL:0; PCL:0;\n\tRULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(823301075)(10201501046)(93006095)(93001095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123564045)(20161123560045)(20161123562045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699016);\n\tSRVR:VI1PR04MB1390; BCL:0; PCL:0; RULEID:; SRVR:VI1PR04MB1390; ",
        "X-Forefront-PRVS": "077884B8B5",
        "X-Forefront-Antispam-Report": "SFV:NSPM;\n\tSFS:(10009020)(39860400002)(346002)(136003)(376002)(366004)(396003)(189003)(199004)(5009440100003)(8676002)(55236004)(97736004)(316002)(186003)(26005)(6506007)(386003)(50466002)(50226002)(51416003)(16526019)(16586007)(48376002)(76176011)(8936002)(478600001)(52116002)(33896004)(53936002)(25786009)(956004)(47776003)(2351001)(6666003)(7736002)(14444005)(36756003)(85782001)(1076002)(5660300001)(2361001)(16200700003)(11346002)(105586002)(9686003)(66066001)(6512007)(53946003)(446003)(2906002)(106356001)(305945005)(486006)(4326008)(81156014)(81166006)(68736007)(6486002)(2616005)(476003)(6916009)(86362001)(575784001)(6116002)(3846002)(110426005)(85772001)(559001)(569006);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR04MB1390; H:GDB1.ap.freescale.net;\n\tFPR:; \n\tSPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; ",
        "Received-SPF": "None (protection.outlook.com: nxp.com does not designate\n\tpermitted sender hosts)",
        "X-Microsoft-Antispam-Message-Info": "Jy04tYgZG6xJ3Z/dAel6+qfzrvnaHVvgdeSbcDOVFdW5FfDIUvphPseY4mPLzZrCJsOHiFTkx4u97AXimqNoPKaU/vTZWguubL39+d9SgjdgkFsXggFUiW3NO6/4qNkOyhQuoUaB/RWM/HxQGaT2SNmlI9XvQncogXSOMGapvka917uVyJn65Ju1j+JtSBK4WN7jZGPPymaInIvnPMQn/malAEV1rSqk4b1Pf/fCcNIOnSUaoQAYKcGTTvS+wYuB8w0sDQISdOL8UjXJRLZjFZyBnpVteGxF5YWaD8gOm7jZEqc3LgGdc4sIuxa4P/8K19ZDynwNjc+Psxu6s1R3kw1QKH6+Oi8eZW03dbGbN2M=",
        "SpamDiagnosticOutput": "1:99",
        "SpamDiagnosticMetadata": "NSPM",
        "X-OriginatorOrg": "nxp.com",
        "X-MS-Exchange-CrossTenant-OriginalArrivalTime": "28 Aug 2018 13:04:16.7019\n\t(UTC)",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "c5dc0dfd-3bb0-46b8-53bd-08d60ce6c335",
        "X-MS-Exchange-CrossTenant-FromEntityHeader": "Hosted",
        "X-MS-Exchange-CrossTenant-Id": "686ea1d3-bc2b-4c6f-a92c-d99c5c301635",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "VI1PR04MB1390",
        "Subject": "[dpdk-dev] [PATCH 2/3] crypto/dpaa2_sec: add sample pdcp descriptor\n\tapis",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<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\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "From: Akhil Goyal <akhil.goyal@nxp.com>\n\nSigned-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>\nSigned-off-by: Horia Geanta Neag <horia.geanta@nxp.com>\nSigned-off-by: Alex Porosanu <alexandru.porosanu@nxp.com>\nSigned-off-by: Akhil Goyal <akhil.goyal@nxp.com>\n---\n drivers/crypto/dpaa2_sec/hw/desc.h      |    2 +-\n drivers/crypto/dpaa2_sec/hw/desc/pdcp.h | 2642 +++++++++++++++++++++++\n 2 files changed, 2643 insertions(+), 1 deletion(-)\n create mode 100644 drivers/crypto/dpaa2_sec/hw/desc/pdcp.h",
    "diff": "diff --git a/drivers/crypto/dpaa2_sec/hw/desc.h b/drivers/crypto/dpaa2_sec/hw/desc.h\nindex e92558329..f0e575922 100644\n--- a/drivers/crypto/dpaa2_sec/hw/desc.h\n+++ b/drivers/crypto/dpaa2_sec/hw/desc.h\n@@ -1332,7 +1332,7 @@\n #define OP_PCL_LTE_MIXED_AUTH_SHIFT\t0\n #define OP_PCL_LTE_MIXED_AUTH_MASK\t(3 << OP_PCL_LTE_MIXED_AUTH_SHIFT)\n #define OP_PCL_LTE_MIXED_ENC_SHIFT\t8\n-#define OP_PCL_LTE_MIXED_ENC_MASK\t(3 < OP_PCL_LTE_MIXED_ENC_SHIFT)\n+#define OP_PCL_LTE_MIXED_ENC_MASK\t(3 << OP_PCL_LTE_MIXED_ENC_SHIFT)\n #define OP_PCL_LTE_MIXED_AUTH_NULL\t(OP_PCL_LTE_NULL << \\\n \t\t\t\t\t OP_PCL_LTE_MIXED_AUTH_SHIFT)\n #define OP_PCL_LTE_MIXED_AUTH_SNOW\t(OP_PCL_LTE_SNOW << \\\ndiff --git a/drivers/crypto/dpaa2_sec/hw/desc/pdcp.h b/drivers/crypto/dpaa2_sec/hw/desc/pdcp.h\nnew file mode 100644\nindex 000000000..4e218f513\n--- /dev/null\n+++ b/drivers/crypto/dpaa2_sec/hw/desc/pdcp.h\n@@ -0,0 +1,2642 @@\n+/*\n+ * Copyright 2008-2013 Freescale Semiconductor, Inc.\n+ *\n+ * SPDX-License-Identifier: BSD-3-Clause or GPL-2.0+\n+ */\n+\n+#ifndef __DESC_PDCP_H__\n+#define __DESC_PDCP_H__\n+\n+#include \"hw/rta.h\"\n+#include \"common.h\"\n+\n+/**\n+ * DOC: PDCP Shared Descriptor Constructors\n+ *\n+ * Shared descriptors for PDCP protocol.\n+ */\n+\n+/**\n+ * PDCP_NULL_MAX_FRAME_LEN - The maximum frame frame length that is supported by\n+ *                           PDCP NULL protocol.\n+ */\n+#define PDCP_NULL_MAX_FRAME_LEN\t\t0x00002FFF\n+\n+/**\n+ * PDCP_MAC_I_LEN - The length of the MAC-I for PDCP protocol operation\n+ */\n+#define PDCP_MAC_I_LEN\t\t\t0x00000004\n+\n+/**\n+ * PDCP_MAX_FRAME_LEN_STATUS - The status returned in FD status/command field in\n+ *                             case the input frame is larger than\n+ *                             PDCP_NULL_MAX_FRAME_LEN.\n+ */\n+#define PDCP_MAX_FRAME_LEN_STATUS\t0xF1\n+\n+/**\n+ * PDCP_C_PLANE_SN_MASK - This mask is used in the PDCP descriptors for\n+ *                        extracting the sequence number (SN) from the PDCP\n+ *                        Control Plane header. For PDCP Control Plane, the SN\n+ *                        is constant (5 bits) as opposed to PDCP Data Plane\n+ *                        (7/12/15 bits).\n+ */\n+#define PDCP_C_PLANE_SN_MASK\t\t0x0000001F\n+\n+/**\n+ * PDCP_U_PLANE_15BIT_SN_MASK - This mask is used in the PDCP descriptors for\n+ *                              extracting the sequence number (SN) from the\n+ *                              PDCP User Plane header. For PDCP Control Plane,\n+ *                              the SN is constant (5 bits) as opposed to PDCP\n+ *                              Data Plane (7/12/15 bits).\n+ */\n+#define PDCP_U_PLANE_15BIT_SN_MASK\t0x00007FFF\n+\n+/**\n+ * PDCP_BEARER_MASK - This mask is used masking out the bearer for PDCP\n+ *                    processing with SNOW f9 in LTE.\n+ *\n+ * The value on which this mask is applied is formatted as below:\n+ *     Count-C (32 bit) | Bearer (5 bit) | Direction (1 bit) | 0 (26 bits)\n+ *\n+ * Applying this mask is done for creating the upper 64 bits of the IV needed\n+ * for SNOW f9.\n+ *\n+ * The lower 32 bits of the mask are used for masking the direction for AES\n+ * CMAC IV.\n+ */\n+#define PDCP_BEARER_MASK\t\t0xFFFFFFFF04000000ull\n+\n+/**\n+ * PDCP_DIR_MASK - This mask is used masking out the direction for PDCP\n+ *                 processing with SNOW f9 in LTE.\n+ *\n+ * The value on which this mask is applied is formatted as below:\n+ *     Bearer (5 bit) | Direction (1 bit) | 0 (26 bits)\n+ *\n+ * Applying this mask is done for creating the lower 32 bits of the IV needed\n+ * for SNOW f9.\n+ *\n+ * The upper 32 bits of the mask are used for masking the direction for AES\n+ * CMAC IV.\n+ */\n+#define PDCP_DIR_MASK\t\t\t0xF800000000000000ull\n+\n+/**\n+ * PDCP_NULL_INT_MAC_I_VAL - The value of the PDCP PDU MAC-I in case NULL\n+ *                           integrity is used.\n+ */\n+\n+#define PDCP_NULL_INT_MAC_I_VAL\t\t0x00000000\n+\n+/**\n+ * PDCP_NULL_INT_ICV_CHECK_FAILED_STATUS - The status used to report ICV check\n+ *                                         failed in case of NULL integrity\n+ *                                         Control Plane processing.\n+ */\n+#define PDCP_NULL_INT_ICV_CHECK_FAILED_STATUS\t0x0A\n+/**\n+ * PDCP_DPOVRD_HFN_OV_EN - Value to be used in the FD status/cmd field to\n+ *                         indicate the HFN override mechanism is active for the\n+ *                         frame.\n+ */\n+#define PDCP_DPOVRD_HFN_OV_EN\t\t0x80000000\n+\n+/**\n+ * PDCP_P4080REV2_HFN_OV_BUFLEN - The length in bytes of the supplementary space\n+ *                                that must be provided by the user at the\n+ *                                beginning of the input frame buffer for\n+ *                                P4080 REV 2.\n+ *\n+ * The format of the frame buffer is the following:\n+ *\n+ *  |<---PDCP_P4080REV2_HFN_OV_BUFLEN-->|\n+ * //===================================||============||==============\\\\\n+ * || PDCP_DPOVRD_HFN_OV_EN | HFN value || PDCP Header|| PDCP Payload ||\n+ * \\\\===================================||============||==============//\n+ *\n+ * If HFN override mechanism is not desired, then the MSB of the first 4 bytes\n+ * must be set to 0b.\n+ */\n+#define PDCP_P4080REV2_HFN_OV_BUFLEN\t4\n+\n+/**\n+ * enum cipher_type_pdcp - Type selectors for cipher types in PDCP protocol OP\n+ *                         instructions.\n+ * @PDCP_CIPHER_TYPE_NULL: NULL\n+ * @PDCP_CIPHER_TYPE_SNOW: SNOW F8\n+ * @PDCP_CIPHER_TYPE_AES: AES\n+ * @PDCP_CIPHER_TYPE_ZUC: ZUCE\n+ * @PDCP_CIPHER_TYPE_INVALID: invalid option\n+ */\n+enum cipher_type_pdcp {\n+\tPDCP_CIPHER_TYPE_NULL,\n+\tPDCP_CIPHER_TYPE_SNOW,\n+\tPDCP_CIPHER_TYPE_AES,\n+\tPDCP_CIPHER_TYPE_ZUC,\n+\tPDCP_CIPHER_TYPE_INVALID\n+};\n+\n+/**\n+ * enum auth_type_pdcp - Type selectors for integrity types in PDCP protocol OP\n+ *                       instructions.\n+ * @PDCP_AUTH_TYPE_NULL: NULL\n+ * @PDCP_AUTH_TYPE_SNOW: SNOW F9\n+ * @PDCP_AUTH_TYPE_AES: AES CMAC\n+ * @PDCP_AUTH_TYPE_ZUC: ZUCA\n+ * @PDCP_AUTH_TYPE_INVALID: invalid option\n+ */\n+enum auth_type_pdcp {\n+\tPDCP_AUTH_TYPE_NULL,\n+\tPDCP_AUTH_TYPE_SNOW,\n+\tPDCP_AUTH_TYPE_AES,\n+\tPDCP_AUTH_TYPE_ZUC,\n+\tPDCP_AUTH_TYPE_INVALID\n+};\n+\n+/**\n+ * enum pdcp_dir - Type selectors for direction for PDCP protocol\n+ * @PDCP_DIR_UPLINK: uplink direction\n+ * @PDCP_DIR_DOWNLINK: downlink direction\n+ * @PDCP_DIR_INVALID: invalid option\n+ */\n+enum pdcp_dir {\n+\tPDCP_DIR_UPLINK = 0,\n+\tPDCP_DIR_DOWNLINK = 1,\n+\tPDCP_DIR_INVALID\n+};\n+\n+/**\n+ * enum pdcp_plane - PDCP domain selectors\n+ * @PDCP_CONTROL_PLANE: Control Plane\n+ * @PDCP_DATA_PLANE: Data Plane\n+ * @PDCP_SHORT_MAC: Short MAC\n+ */\n+enum pdcp_plane {\n+\tPDCP_CONTROL_PLANE,\n+\tPDCP_DATA_PLANE,\n+\tPDCP_SHORT_MAC\n+};\n+\n+/**\n+ * enum pdcp_sn_size - Sequence Number Size selectors for PDCP protocol\n+ * @PDCP_SN_SIZE_5: 5bit sequence number\n+ * @PDCP_SN_SIZE_7: 7bit sequence number\n+ * @PDCP_SN_SIZE_12: 12bit sequence number\n+ * @PDCP_SN_SIZE_15: 15bit sequence number\n+ */\n+enum pdcp_sn_size {\n+\tPDCP_SN_SIZE_5 = 5,\n+\tPDCP_SN_SIZE_7 = 7,\n+\tPDCP_SN_SIZE_12 = 12,\n+\tPDCP_SN_SIZE_15 = 15\n+};\n+\n+/*\n+ * PDCP Control Plane Protocol Data Blocks\n+ */\n+#define PDCP_C_PLANE_PDB_HFN_SHIFT\t\t5\n+#define PDCP_C_PLANE_PDB_BEARER_SHIFT\t\t27\n+#define PDCP_C_PLANE_PDB_DIR_SHIFT\t\t26\n+#define PDCP_C_PLANE_PDB_HFN_THR_SHIFT\t\t5\n+\n+#define PDCP_U_PLANE_PDB_OPT_SHORT_SN\t\t0x2\n+#define PDCP_U_PLANE_PDB_OPT_15B_SN\t\t0x4\n+#define PDCP_U_PLANE_PDB_SHORT_SN_HFN_SHIFT\t7\n+#define PDCP_U_PLANE_PDB_LONG_SN_HFN_SHIFT\t12\n+#define PDCP_U_PLANE_PDB_15BIT_SN_HFN_SHIFT\t15\n+#define PDCP_U_PLANE_PDB_BEARER_SHIFT\t\t27\n+#define PDCP_U_PLANE_PDB_DIR_SHIFT\t\t26\n+#define PDCP_U_PLANE_PDB_SHORT_SN_HFN_THR_SHIFT\t7\n+#define PDCP_U_PLANE_PDB_LONG_SN_HFN_THR_SHIFT\t12\n+#define PDCP_U_PLANE_PDB_15BIT_SN_HFN_THR_SHIFT\t15\n+\n+struct pdcp_pdb {\n+\tunion {\n+\t\tuint32_t opt;\n+\t\tuint32_t rsvd;\n+\t} opt_res;\n+\tuint32_t hfn_res;\t/* HyperFrame number,(27, 25 or 21 bits),\n+\t\t\t\t * left aligned & right-padded with zeros. */\n+\tuint32_t bearer_dir_res;/* Bearer(5 bits), packet direction (1 bit),\n+\t\t\t\t * left aligned & right-padded with zeros. */\n+\tuint32_t hfn_thr_res;\t/* HyperFrame number threshold (27, 25 or 21\n+\t\t\t\t * bits), left aligned & right-padded with\n+\t\t\t\t * zeros. */\n+};\n+\n+/*\n+ * PDCP internal PDB types\n+ */\n+enum pdb_type_e {\n+\tPDCP_PDB_TYPE_NO_PDB,\n+\tPDCP_PDB_TYPE_FULL_PDB,\n+\tPDCP_PDB_TYPE_REDUCED_PDB,\n+\tPDCP_PDB_TYPE_INVALID\n+};\n+\n+/*\n+ * Function for appending the portion of a PDCP Control Plane shared descriptor\n+ * which performs NULL encryption and integrity (i.e. copies the input frame\n+ * to the output frame, appending 32 bits of zeros at the end (MAC-I for\n+ * NULL integrity).\n+ */\n+static inline int pdcp_insert_cplane_null_op(struct program *p,\n+\t\tstruct alginfo *cipherdata __maybe_unused,\n+\t\tstruct alginfo *authdata __maybe_unused,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override __maybe_unused)\n+{\n+\tLABEL(local_offset);\n+\tREFERENCE(move_cmd_read_descbuf);\n+\tREFERENCE(move_cmd_write_descbuf);\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\tMATHB(p, SEQINSZ, ADD, ZERO, VSEQINSZ, 4, 0);\n+\t\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t\telse\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t} else {\n+\t\tMATHB(p, SEQINSZ, ADD, ONE, VSEQINSZ, 4, 0);\n+\t\tMATHB(p, VSEQINSZ, SUB, ONE, VSEQINSZ, 4, 0);\n+\n+\t\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t\t\tMATHB(p, VSEQINSZ, SUB, ONE, MATH0, 4, 0);\n+\t\t} else {\n+\t\t\tMATHB(p, VSEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQINSZ, 4,\n+\t\t\t      IMMED2);\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t\t\tMATHB(p, VSEQOUTSZ, SUB, ONE, MATH0, 4, 0);\n+\t\t}\n+\n+\t\tMATHB(p, MATH0, ADD, ONE, MATH0, 4, 0);\n+\n+\t\t/*\n+\t\t * Since MOVELEN is available only starting with\n+\t\t * SEC ERA 3, use poor man's MOVELEN: create a MOVE\n+\t\t * command dynamically by writing the length from M1 by\n+\t\t * OR-ing the command in the M1 register and MOVE the\n+\t\t * result into the descriptor buffer. Care must be taken\n+\t\t * wrt. the location of the command because of SEC\n+\t\t * pipelining. The actual MOVEs are written at the end\n+\t\t * of the descriptor due to calculations needed on the\n+\t\t * offset in the descriptor for the MOVE command.\n+\t\t */\n+\t\tmove_cmd_read_descbuf = MOVE(p, DESCBUF, 0, MATH0, 0, 6,\n+\t\t\t\t\t     IMMED);\n+\t\tmove_cmd_write_descbuf = MOVE(p, MATH0, 0, DESCBUF, 0, 8,\n+\t\t\t\t\t      WAITCOMP | IMMED);\n+\t}\n+\tMATHB(p, VSEQINSZ, SUB, PDCP_NULL_MAX_FRAME_LEN, NONE, 4,\n+\t      IMMED2);\n+\tJUMP(p, PDCP_MAX_FRAME_LEN_STATUS, HALT_STATUS, ALL_FALSE, MATH_N);\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\t\tMATHB(p, VSEQINSZ, ADD, ZERO, MATH0, 4, 0);\n+\t\telse\n+\t\t\tMATHB(p, VSEQOUTSZ, ADD, ZERO, MATH0, 4, 0);\n+\t}\n+\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\tMOVE(p, AB1, 0, OFIFO, 0, MATH0, 0);\n+\t} else {\n+\t\tSET_LABEL(p, local_offset);\n+\n+\t\t/* Shut off automatic Info FIFO entries */\n+\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t/* Placeholder for MOVE command with length from M1 register */\n+\t\tMOVE(p, IFIFOAB1, 0, OFIFO, 0, 0, IMMED);\n+\t\t/* Enable automatic Info FIFO entries */\n+\t\tLOAD(p, 0, DCTRL, LDOFF_ENABLE_AUTO_NFIFO, 0, IMMED);\n+\t}\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tMATHB(p, MATH1, XOR, MATH1, MATH0, 8, 0);\n+\t\tMOVE(p, MATH0, 0, OFIFO, 0, 4, IMMED);\n+\t}\n+\n+\tif (rta_sec_era < RTA_SEC_ERA_3) {\n+\t\tPATCH_MOVE(p, move_cmd_read_descbuf, local_offset);\n+\t\tPATCH_MOVE(p, move_cmd_write_descbuf, local_offset);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline int insert_copy_frame_op(struct program *p,\n+\t\t\t\tstruct alginfo *cipherdata __maybe_unused,\n+\t\t\t\tunsigned dir __maybe_unused)\n+{\n+\tLABEL(local_offset);\n+\tREFERENCE(move_cmd_read_descbuf);\n+\tREFERENCE(move_cmd_write_descbuf);\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\tMATHB(p, SEQINSZ, ADD, ZERO, VSEQINSZ,  4, 0);\n+\t\tMATHB(p, SEQINSZ, ADD, ZERO, VSEQOUTSZ,  4, 0);\n+\t} else {\n+\t\tMATHB(p, SEQINSZ, ADD, ONE, VSEQINSZ,  4, 0);\n+\t\tMATHB(p, VSEQINSZ, SUB, ONE, VSEQINSZ,  4, 0);\n+\t\tMATHB(p, SEQINSZ, ADD, ONE, VSEQOUTSZ,  4, 0);\n+\t\tMATHB(p, VSEQOUTSZ, SUB, ONE, VSEQOUTSZ,  4, 0);\n+\t\tMATHB(p, VSEQINSZ, SUB, ONE, MATH0,  4, 0);\n+\t\tMATHB(p, MATH0, ADD, ONE, MATH0,  4, 0);\n+\n+\t\t/*\n+\t\t * Since MOVELEN is available only starting with\n+\t\t * SEC ERA 3, use poor man's MOVELEN: create a MOVE\n+\t\t * command dynamically by writing the length from M1 by\n+\t\t * OR-ing the command in the M1 register and MOVE the\n+\t\t * result into the descriptor buffer. Care must be taken\n+\t\t * wrt. the location of the command because of SEC\n+\t\t * pipelining. The actual MOVEs are written at the end\n+\t\t * of the descriptor due to calculations needed on the\n+\t\t * offset in the descriptor for the MOVE command.\n+\t\t */\n+\t\tmove_cmd_read_descbuf = MOVE(p, DESCBUF, 0, MATH0, 0, 6,\n+\t\t\t\t\t     IMMED);\n+\t\tmove_cmd_write_descbuf = MOVE(p, MATH0, 0, DESCBUF, 0, 8,\n+\t\t\t\t\t      WAITCOMP | IMMED);\n+\t}\n+\tMATHB(p, SEQINSZ, SUB, PDCP_NULL_MAX_FRAME_LEN, NONE,  4,\n+\t      IFB | IMMED2);\n+\tJUMP(p, PDCP_MAX_FRAME_LEN_STATUS, HALT_STATUS, ALL_FALSE, MATH_N);\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2)\n+\t\tMATHB(p, VSEQINSZ, ADD, ZERO, MATH0,  4, 0);\n+\n+\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\tMOVE(p, AB1, 0, OFIFO, 0, MATH0, 0);\n+\t} else {\n+\t\tSET_LABEL(p, local_offset);\n+\n+\t\t/* Shut off automatic Info FIFO entries */\n+\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\n+\t\t/* Placeholder for MOVE command with length from M0 register */\n+\t\tMOVE(p, IFIFOAB1, 0, OFIFO, 0, 0, IMMED);\n+\n+\t\t/* Enable automatic Info FIFO entries */\n+\t\tLOAD(p, 0, DCTRL, LDOFF_ENABLE_AUTO_NFIFO, 0, IMMED);\n+\t}\n+\n+\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\n+\tif (rta_sec_era < RTA_SEC_ERA_3) {\n+\t\tPATCH_MOVE(p, move_cmd_read_descbuf, local_offset);\n+\t\tPATCH_MOVE(p, move_cmd_write_descbuf, local_offset);\n+\t}\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_int_only_op(struct program *p,\n+\t\tstruct alginfo *cipherdata __maybe_unused,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override)\n+{\n+\tLABEL(local_offset);\n+\tREFERENCE(move_cmd_read_descbuf);\n+\tREFERENCE(move_cmd_write_descbuf);\n+\n+\tswitch (authdata->algtype) {\n+\tcase PDCP_AUTH_TYPE_SNOW:\n+\t\t/* Insert Auth Key */\n+\t\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\t\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2 ||\n+\t\t    (rta_sec_era == RTA_SEC_ERA_2 &&\n+\t\t\t\t   era_2_sw_hfn_override == 0)) {\n+\t\t\tSEQINPTR(p, 0, 1, RTO);\n+\t\t} else {\n+\t\t\tSEQINPTR(p, 0, 5, RTO);\n+\t\t\tSEQFIFOLOAD(p, SKIP, 4, 0);\n+\t\t}\n+\n+\t\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1,  8,\n+\t\t      IFB | IMMED2);\n+\t\tMATHB(p, MATH1, SHLD, MATH1, MATH1,  8, 0);\n+\t\tMOVE(p, DESCBUF, 8, MATH2, 0, 8, WAITCOMP | IMMED);\n+\t\tMATHB(p, MATH2, AND, PDCP_BEARER_MASK, MATH2, 8,\n+\t\t      IMMED2);\n+\t\tMOVE(p, DESCBUF, 0x0C, MATH3, 0, 4, WAITCOMP | IMMED);\n+\t\tMATHB(p, MATH3, AND, PDCP_DIR_MASK, MATH3, 8,\n+\t\t      IMMED2);\n+\t\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\t\tMOVE(p, MATH2, 0, CONTEXT2, 0, 0x0C, WAITCOMP | IMMED);\n+\n+\t\tif (dir == OP_TYPE_DECAP_PROTOCOL) {\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, MATH1, 4,\n+\t\t\t      IMMED2);\n+\t\t} else {\n+\t\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t\t} else {\n+\t\t\t\tMATHB(p, SEQINSZ, ADD, ONE, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t\t\tMATHB(p, MATH1, SUB, ONE, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMATHB(p, MATH1, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\t\tMATHB(p, MATH1, SUB, ZERO, VSEQOUTSZ, 4, 0);\n+\t\t} else {\n+\t\t\tMATHB(p, ZERO, ADD, MATH1, VSEQINSZ, 4, 0);\n+\t\t\tMATHB(p, ZERO, ADD, MATH1, VSEQOUTSZ, 4, 0);\n+\n+\t\t\t/*\n+\t\t\t * Since MOVELEN is available only starting with\n+\t\t\t * SEC ERA 3, use poor man's MOVELEN: create a MOVE\n+\t\t\t * command dynamically by writing the length from M1 by\n+\t\t\t * OR-ing the command in the M1 register and MOVE the\n+\t\t\t * result into the descriptor buffer. Care must be taken\n+\t\t\t * wrt. the location of the command because of SEC\n+\t\t\t * pipelining. The actual MOVEs are written at the end\n+\t\t\t * of the descriptor due to calculations needed on the\n+\t\t\t * offset in the descriptor for the MOVE command.\n+\t\t\t */\n+\t\t\tmove_cmd_read_descbuf = MOVE(p, DESCBUF, 0, MATH1, 0, 6,\n+\t\t\t\t\t\t     IMMED);\n+\t\t\tmove_cmd_write_descbuf = MOVE(p, MATH1, 0, DESCBUF, 0,\n+\t\t\t\t\t\t      8, WAITCOMP | IMMED);\n+\t\t}\n+\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F9, OP_ALG_AAI_F9,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t\t     ICV_CHECK_DISABLE : ICV_CHECK_ENABLE,\n+\t\t\t      DIR_ENC);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0,\n+\t\t\t\t    VLF | LAST1 | LAST2 | FLUSH1);\n+\t\t\tMOVE(p, AB1, 0, OFIFO, 0, MATH1, 0);\n+\t\t} else {\n+\t\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0,\n+\t\t\t\t    VLF | LAST1 | LAST2 | FLUSH1);\n+\t\t\tSET_LABEL(p, local_offset);\n+\n+\t\t\t/* Shut off automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t\t/*\n+\t\t\t * Placeholder for MOVE command with length from M1\n+\t\t\t * register\n+\t\t\t */\n+\t\t\tMOVE(p, IFIFOAB1, 0, OFIFO, 0, 0, IMMED);\n+\t\t\t/* Enable automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_ENABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t}\n+\n+\t\tif (dir == OP_TYPE_DECAP_PROTOCOL)\n+\t\t\tSEQFIFOLOAD(p, ICV2, 4, LAST2);\n+\t\telse\n+\t\t\tSEQSTORE(p, CONTEXT2, 0, 4, 0);\n+\n+\t\tbreak;\n+\n+\tcase PDCP_AUTH_TYPE_AES:\n+\t\t/* Insert Auth Key */\n+\t\tKEY(p, KEY1, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\t\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2 ||\n+\t\t    (rta_sec_era == RTA_SEC_ERA_2 &&\n+\t\t     era_2_sw_hfn_override == 0)) {\n+\t\t\tSEQINPTR(p, 0, 1, RTO);\n+\t\t} else {\n+\t\t\tSEQINPTR(p, 0, 5, RTO);\n+\t\t\tSEQFIFOLOAD(p, SKIP, 4, 0);\n+\t\t}\n+\n+\t\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8,\n+\t\t      IFB | IMMED2);\n+\t\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\t\tMOVE(p, DESCBUF, 8, MATH2, 0, 8, WAITCOMP | IMMED);\n+\t\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\t\tMOVE(p, MATH2, 0, IFIFOAB1, 0, 8, IMMED);\n+\t\tif (dir == OP_TYPE_DECAP_PROTOCOL) {\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, MATH1, 4,\n+\t\t\t      IMMED2);\n+\t\t} else {\n+\t\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t\t} else {\n+\t\t\t\tMATHB(p, SEQINSZ, ADD, ONE, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t\t\tMATHB(p, MATH1, SUB, ONE, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMATHB(p, MATH1, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\t\tMATHB(p, MATH1, SUB, ZERO, VSEQOUTSZ, 4, 0);\n+\t\t} else {\n+\t\t\tMATHB(p, ZERO, ADD, MATH1, VSEQINSZ, 4, 0);\n+\t\t\tMATHB(p, ZERO, ADD, MATH1, VSEQOUTSZ, 4, 0);\n+\n+\t\t\t/*\n+\t\t\t * Since MOVELEN is available only starting with\n+\t\t\t * SEC ERA 3, use poor man's MOVELEN: create a MOVE\n+\t\t\t * command dynamically by writing the length from M1 by\n+\t\t\t * OR-ing the command in the M1 register and MOVE the\n+\t\t\t * result into the descriptor buffer. Care must be taken\n+\t\t\t * wrt. the location of the command because of SEC\n+\t\t\t * pipelining. The actual MOVEs are written at the end\n+\t\t\t * of the descriptor due to calculations needed on the\n+\t\t\t * offset in the descriptor for the MOVE command.\n+\t\t\t */\n+\t\t\tmove_cmd_read_descbuf = MOVE(p, DESCBUF, 0, MATH1, 0, 6,\n+\t\t\t\t\t\t     IMMED);\n+\t\t\tmove_cmd_write_descbuf = MOVE(p, MATH1, 0, DESCBUF, 0,\n+\t\t\t\t\t\t      8, WAITCOMP | IMMED);\n+\t\t}\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CMAC,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t\t     ICV_CHECK_DISABLE : ICV_CHECK_ENABLE,\n+\t\t\t      DIR_ENC);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMOVE(p, AB2, 0, OFIFO, 0, MATH1, 0);\n+\t\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0,\n+\t\t\t\t    VLF | LAST1 | LAST2 | FLUSH1);\n+\t\t} else {\n+\t\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0,\n+\t\t\t\t    VLF | LAST1 | LAST2 | FLUSH1);\n+\t\t\tSET_LABEL(p, local_offset);\n+\n+\t\t\t/* Shut off automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\n+\t\t\t/*\n+\t\t\t * Placeholder for MOVE command with length from\n+\t\t\t * M1 register\n+\t\t\t * */\n+\t\t\tMOVE(p, IFIFOAB2, 0, OFIFO, 0, 0, IMMED);\n+\n+\t\t\t/* Enable automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_ENABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t}\n+\n+\t\tif (dir == OP_TYPE_DECAP_PROTOCOL)\n+\t\t\tSEQFIFOLOAD(p, ICV1, 4, LAST1 | FLUSH1);\n+\t\telse\n+\t\t\tSEQSTORE(p, CONTEXT1, 0, 4, 0);\n+\n+\t\tbreak;\n+\n+\tcase PDCP_AUTH_TYPE_ZUC:\n+\t\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\t\t/* Insert Auth Key */\n+\t\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\t\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\t\tSEQINPTR(p, 0, 1, RTO);\n+\t\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8,\n+\t\t      IFB | IMMED2);\n+\t\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\t\tMOVE(p, DESCBUF, 8, MATH2, 0, 8, WAITCOMP | IMMED);\n+\t\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\t\tMOVE(p, MATH2, 0, CONTEXT2, 0, 8, IMMED);\n+\n+\t\tif (dir == OP_TYPE_DECAP_PROTOCOL)\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, MATH1, 4,\n+\t\t\t      IMMED2);\n+\t\telse\n+\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, MATH1, 4, 0);\n+\n+\t\tMATHB(p, MATH1, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\tMATHB(p, MATH1, SUB, ZERO, VSEQOUTSZ, 4, 0);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCA,\n+\t\t\t      OP_ALG_AAI_F9,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t\t     ICV_CHECK_DISABLE : ICV_CHECK_ENABLE,\n+\t\t\t      DIR_ENC);\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST1 | LAST2 | FLUSH1);\n+\t\tMOVE(p, AB1, 0, OFIFO, 0, MATH1, 0);\n+\n+\t\tif (dir == OP_TYPE_DECAP_PROTOCOL)\n+\t\t\tSEQFIFOLOAD(p, ICV2, 4, LAST2);\n+\t\telse\n+\t\t\tSEQSTORE(p, CONTEXT2, 0, 4, 0);\n+\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tpr_err(\"%s: Invalid integrity algorithm selected: %d\\n\",\n+\t\t       \"pdcp_insert_cplane_int_only_op\", authdata->algtype);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (rta_sec_era < RTA_SEC_ERA_3) {\n+\t\tPATCH_MOVE(p, move_cmd_read_descbuf, local_offset);\n+\t\tPATCH_MOVE(p, move_cmd_write_descbuf, local_offset);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_enc_only_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata __maybe_unused,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override __maybe_unused)\n+{\n+\t/* Insert Cipher Key */\n+\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,\n+\t\t\t\t(uint16_t)cipherdata->algtype << 8);\n+\t\treturn 0;\n+\t}\n+\n+\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8, IFB | IMMED2);\n+\tSEQSTORE(p, MATH0, 7, 1, 0);\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 8, MATH2, 0, 8, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\n+\tswitch (cipherdata->algtype) {\n+\tcase PDCP_CIPHER_TYPE_SNOW:\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 8, WAITCOMP | IMMED);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\t} else {\n+\t\t\tMATHB(p, SEQINSZ, SUB, ONE, MATH1, 4, 0);\n+\t\t\tMATHB(p, MATH1, ADD, ONE, VSEQINSZ, 4, 0);\n+\t\t}\n+\n+\t\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t\telse\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F8,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL, ICV_CHECK_DISABLE,\n+\t\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t\t\tDIR_ENC : DIR_DEC);\n+\t\tbreak;\n+\n+\tcase PDCP_CIPHER_TYPE_AES:\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0x10, 0x10, WAITCOMP | IMMED);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\t} else {\n+\t\t\tMATHB(p, SEQINSZ, SUB, ONE, MATH1, 4, 0);\n+\t\t\tMATHB(p, MATH1, ADD, ONE, VSEQINSZ, 4, 0);\n+\t\t}\n+\n+\t\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t\telse\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CTR,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t\t\tDIR_ENC : DIR_DEC);\n+\t\tbreak;\n+\n+\tcase PDCP_CIPHER_TYPE_ZUC:\n+\t\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 0x08, IMMED);\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0x08, 0x08, WAITCOMP | IMMED);\n+\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\t\telse\n+\t\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4,\n+\t\t\t      IMMED2);\n+\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCE,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t\t\tDIR_ENC : DIR_DEC);\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tpr_err(\"%s: Invalid encrypt algorithm selected: %d\\n\",\n+\t\t       \"pdcp_insert_cplane_enc_only_op\", cipherdata->algtype);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF);\n+\t\tFIFOLOAD(p, MSG1, PDCP_NULL_INT_MAC_I_VAL, 4,\n+\t\t\t LAST1 | FLUSH1 | IMMED);\n+\t} else {\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\t\tMOVE(p, OFIFO, 0, MATH1, 4, PDCP_MAC_I_LEN, WAITCOMP | IMMED);\n+\t\tMATHB(p, MATH1, XOR, PDCP_NULL_INT_MAC_I_VAL, NONE, 4, IMMED2);\n+\t\tJUMP(p, PDCP_NULL_INT_ICV_CHECK_FAILED_STATUS,\n+\t\t     HALT_STATUS, ALL_FALSE, MATH_Z);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_acc_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_hfn_override __maybe_unused)\n+{\n+\t/* Insert Auth Key */\n+\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,\n+\t    INLINE_KEY(authdata));\n+\n+\t/* Insert Cipher Key */\n+\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL, (uint16_t)cipherdata->algtype);\n+\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_snow_aes_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override)\n+{\n+\tLABEL(back_to_sd_offset);\n+\tLABEL(end_desc);\n+\tLABEL(local_offset);\n+\tLABEL(jump_to_beginning);\n+\tLABEL(fifo_load_mac_i_offset);\n+\tREFERENCE(seqin_ptr_read);\n+\tREFERENCE(seqin_ptr_write);\n+\tREFERENCE(seq_out_read);\n+\tREFERENCE(jump_back_to_sd_cmd);\n+\tREFERENCE(move_mac_i_to_desc_buf);\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t\t\t\tcipherdata->keylen, INLINE_KEY(cipherdata));\n+\t\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key,\n+\t\t\t\tauthdata->keylen, INLINE_KEY(authdata));\n+\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,\n+\t\t\t ((uint16_t)cipherdata->algtype << 8) |\n+\t\t\t (uint16_t)authdata->algtype);\n+\n+\t\treturn 0;\n+\t}\n+\n+\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8, IFB | IMMED2);\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 4, MATH2, 0, 0x08, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\tSEQSTORE(p, MATH0, 7, 1, 0);\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2 ||\n+\t\t    (rta_sec_era == RTA_SEC_ERA_2 &&\n+\t\t\t\t   era_2_sw_hfn_override == 0)) {\n+\t\t\tSEQINPTR(p, 0, 1, RTO);\n+\t\t} else {\n+\t\t\tSEQINPTR(p, 0, 5, RTO);\n+\t\t\tSEQFIFOLOAD(p, SKIP, 4, 0);\n+\t\t}\n+\t\tKEY(p, KEY1, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tMOVE(p, MATH2, 0, IFIFOAB1, 0, 0x08, IMMED);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, MATH1, 4, 0);\n+\t\t\tMATHB(p, VSEQINSZ, ADD, PDCP_MAC_I_LEN - 1, VSEQOUTSZ,\n+\t\t\t      4, IMMED2);\n+\t\t} else {\n+\t\t\tMATHB(p, SEQINSZ, SUB, MATH3, VSEQINSZ, 4, 0);\n+\t\t\tMATHB(p, VSEQINSZ, ADD, PDCP_MAC_I_LEN - 1, VSEQOUTSZ,\n+\t\t\t      4, IMMED2);\n+\t\t\t/*\n+\t\t\t * Note: Although the calculations below might seem a\n+\t\t\t * little off, the logic is the following:\n+\t\t\t *\n+\t\t\t * - SEQ IN PTR RTO below needs the full length of the\n+\t\t\t *   frame; in case of P4080_REV_2_HFN_OV_WORKAROUND,\n+\t\t\t *   this means the length of the frame to be processed\n+\t\t\t *   + 4 bytes (the HFN override flag and value).\n+\t\t\t *   The length of the frame to be processed minus 1\n+\t\t\t *   byte is in the VSIL register (because\n+\t\t\t *   VSIL = SIL + 3, due to 1 byte, the header being\n+\t\t\t *   already written by the SEQ STORE above). So for\n+\t\t\t *   calculating the length to use in RTO, I add one\n+\t\t\t *   to the VSIL value in order to obtain the total\n+\t\t\t *   frame length. This helps in case of P4080 which\n+\t\t\t *   can have the value 0 as an operand in a MATH\n+\t\t\t *   command only as SRC1 When the HFN override\n+\t\t\t *   workaround is not enabled, the length of the\n+\t\t\t *   frame is given by the SIL register; the\n+\t\t\t *   calculation is similar to the one in the SEC 4.2\n+\t\t\t *   and SEC 5.3 cases.\n+\t\t\t */\n+\t\t\tif (era_2_sw_hfn_override)\n+\t\t\t\tMATHB(p, VSEQOUTSZ, ADD, ONE, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t\telse\n+\t\t\t\tMATHB(p, SEQINSZ, ADD, MATH3, MATH1, 4,\n+\t\t\t\t      0);\n+\t\t}\n+\t\t/*\n+\t\t * Placeholder for filling the length in\n+\t\t * SEQIN PTR RTO below\n+\t\t */\n+\t\tseqin_ptr_read = MOVE(p, DESCBUF, 0, MATH1, 0, 6, IMMED);\n+\t\tseqin_ptr_write = MOVE(p, MATH1, 0, DESCBUF, 0, 8,\n+\t\t\t\t       WAITCOMP | IMMED);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CMAC,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_DEC);\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\t\tMOVE(p, CONTEXT1, 0, MATH3, 0, 4, WAITCOMP | IMMED);\n+\t\tif (rta_sec_era <= RTA_SEC_ERA_3)\n+\t\t\tLOAD(p, CLRW_CLR_C1KEY |\n+\t\t\t     CLRW_CLR_C1CTX |\n+\t\t\t     CLRW_CLR_C1ICV |\n+\t\t\t     CLRW_CLR_C1DATAS |\n+\t\t\t     CLRW_CLR_C1MODE,\n+\t\t\t     CLRW, 0, 4, IMMED);\n+\t\telse\n+\t\t\tLOAD(p, CLRW_RESET_CLS1_CHA |\n+\t\t\t     CLRW_CLR_C1KEY |\n+\t\t\t     CLRW_CLR_C1CTX |\n+\t\t\t     CLRW_CLR_C1ICV |\n+\t\t\t     CLRW_CLR_C1DATAS |\n+\t\t\t     CLRW_CLR_C1MODE,\n+\t\t\t     CLRW, 0, 4, IMMED);\n+\n+\t\tif (rta_sec_era <= RTA_SEC_ERA_3)\n+\t\t\tLOAD(p, CCTRL_RESET_CHA_ALL, CCTRL, 0, 4, IMMED);\n+\n+\t\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\t\tSET_LABEL(p, local_offset);\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);\n+\t\tSEQINPTR(p, 0, 0, RTO);\n+\n+\t\tif (rta_sec_era == RTA_SEC_ERA_2 && era_2_sw_hfn_override) {\n+\t\t\tSEQFIFOLOAD(p, SKIP, 5, 0);\n+\t\t\tMATHB(p, SEQINSZ, ADD, ONE, SEQINSZ, 4, 0);\n+\t\t}\n+\n+\t\tMATHB(p, SEQINSZ, SUB, ONE, VSEQINSZ, 4, 0);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F8,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_ENC);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2 ||\n+\t\t    (rta_sec_era == RTA_SEC_ERA_2 &&\n+\t\t\t\t   era_2_sw_hfn_override == 0))\n+\t\t\tSEQFIFOLOAD(p, SKIP, 1, 0);\n+\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF);\n+\t\tMOVE(p, MATH3, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);\n+\t\tPATCH_MOVE(p, seqin_ptr_read, local_offset);\n+\t\tPATCH_MOVE(p, seqin_ptr_write, local_offset);\n+\t} else {\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);\n+\n+\t\tif (rta_sec_era >= RTA_SEC_ERA_5)\n+\t\t\tMOVE(p, CONTEXT1, 0, CONTEXT2, 0, 8, IMMED);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2)\n+\t\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\telse\n+\t\t\tMATHB(p, SEQINSZ, SUB, MATH3, VSEQINSZ, 4, 0);\n+\n+\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+/*\n+ * TODO: To be changed when proper support is added in RTA (can't load a\n+ * command that is also written by RTA (or patch it for that matter).\n+ * Change when proper RTA support is added.\n+ */\n+\t\tif (p->ps)\n+\t\t\tWORD(p, 0x168B0004);\n+\t\telse\n+\t\t\tWORD(p, 0x16880404);\n+\n+\t\tjump_back_to_sd_cmd = JUMP(p, 0, LOCAL_JUMP, ALL_TRUE, 0);\n+\t\t/*\n+\t\t * Placeholder for command reading  the SEQ OUT command in\n+\t\t * JD. Done for rereading the decrypted data and performing\n+\t\t * the integrity check\n+\t\t */\n+/*\n+ * TODO: RTA currently doesn't support patching of length of a MOVE command\n+ * Thus, it is inserted as a raw word, as per PS setting.\n+ */\n+\t\tif (p->ps)\n+\t\t\tseq_out_read = MOVE(p, DESCBUF, 0, MATH1, 0, 20,\n+\t\t\t\t\t    WAITCOMP | IMMED);\n+\t\telse\n+\t\t\tseq_out_read = MOVE(p, DESCBUF, 0, MATH1, 0, 16,\n+\t\t\t\t\t    WAITCOMP | IMMED);\n+\n+\t\tMATHB(p, MATH1, XOR, CMD_SEQ_IN_PTR ^ CMD_SEQ_OUT_PTR, MATH1, 4,\n+\t\t      IMMED2);\n+\t\t/* Placeholder for overwriting the SEQ IN  with SEQ OUT */\n+/*\n+ * TODO: RTA currently doesn't support patching of length of a MOVE command\n+ * Thus, it is inserted as a raw word, as per PS setting.\n+ */\n+\t\tif (p->ps)\n+\t\t\tMOVE(p, MATH1, 0, DESCBUF, 0, 24, IMMED);\n+\t\telse\n+\t\t\tMOVE(p, MATH1, 0, DESCBUF, 0, 20, IMMED);\n+\n+\t\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\n+\t\tif (rta_sec_era >= RTA_SEC_ERA_4)\n+\t\t\tMOVE(p, CONTEXT1, 0, CONTEXT2, 0, 8, IMMED);\n+\t\telse\n+\t\t\tMOVE(p, CONTEXT1, 0, MATH3, 0, 8, IMMED);\n+\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F8,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_DEC);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\n+\t\tif (rta_sec_era <= RTA_SEC_ERA_3)\n+\t\t\tmove_mac_i_to_desc_buf = MOVE(p, OFIFO, 0, DESCBUF, 0,\n+\t\t\t\t\t\t      4, WAITCOMP | IMMED);\n+\t\telse\n+\t\t\tMOVE(p, OFIFO, 0, MATH3, 0, 4, IMMED);\n+\n+\t\tif (rta_sec_era <= RTA_SEC_ERA_3)\n+\t\t\tLOAD(p, CCTRL_RESET_CHA_ALL, CCTRL, 0, 4, IMMED);\n+\t\telse\n+\t\t\tLOAD(p, CLRW_RESET_CLS1_CHA |\n+\t\t\t     CLRW_CLR_C1KEY |\n+\t\t\t     CLRW_CLR_C1CTX |\n+\t\t\t     CLRW_CLR_C1ICV |\n+\t\t\t     CLRW_CLR_C1DATAS |\n+\t\t\t     CLRW_CLR_C1MODE,\n+\t\t\t     CLRW, 0, 4, IMMED);\n+\n+\t\tKEY(p, KEY1, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\t/*\n+\t\t * Placeholder for jump in SD for executing the new SEQ IN PTR\n+\t\t * command (which is actually the old SEQ OUT PTR command\n+\t\t * copied over from JD.\n+\t\t */\n+\t\tSET_LABEL(p, jump_to_beginning);\n+\t\tJUMP(p, 1 - jump_to_beginning, LOCAL_JUMP, ALL_TRUE, 0);\n+\t\tSET_LABEL(p, back_to_sd_offset);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CMAC,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_ENABLE,\n+\t\t\t      DIR_DEC);\n+\n+\t\t/* Read the # of bytes written in the output buffer + 1 (HDR) */\n+\t\tMATHB(p, VSEQOUTSZ, ADD, ONE, VSEQINSZ, 4, 0);\n+\n+\t\tif (rta_sec_era <= RTA_SEC_ERA_3)\n+\t\t\tMOVE(p, MATH3, 0, IFIFOAB1, 0, 8, IMMED);\n+\t\telse\n+\t\t\tMOVE(p, CONTEXT2, 0, IFIFOAB1, 0, 8, IMMED);\n+\n+\t\tif (rta_sec_era == RTA_SEC_ERA_2 && era_2_sw_hfn_override)\n+\t\t\tSEQFIFOLOAD(p, SKIP, 4, 0);\n+\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\n+\t\tif (rta_sec_era >= RTA_SEC_ERA_4) {\n+\t\t\tLOAD(p, NFIFOENTRY_STYPE_ALTSOURCE |\n+\t\t\t     NFIFOENTRY_DEST_CLASS1 |\n+\t\t\t     NFIFOENTRY_DTYPE_ICV |\n+\t\t\t     NFIFOENTRY_LC1 |\n+\t\t\t     NFIFOENTRY_FC1 | 4, NFIFO_SZL, 0, 4, IMMED);\n+\t\t\tMOVE(p, MATH3, 0, ALTSOURCE, 0, 4, IMMED);\n+\t\t} else {\n+\t\t\tSET_LABEL(p, fifo_load_mac_i_offset);\n+\t\t\tFIFOLOAD(p, ICV1, fifo_load_mac_i_offset, 4,\n+\t\t\t\t LAST1 | FLUSH1 | IMMED);\n+\t\t}\n+\n+\t\tSET_LABEL(p, end_desc);\n+\n+\t\tif (!p->ps) {\n+\t\t\tPATCH_MOVE(p, seq_out_read, end_desc + 1);\n+\t\t\tPATCH_JUMP(p, jump_back_to_sd_cmd,\n+\t\t\t\t   back_to_sd_offset + jump_back_to_sd_cmd - 5);\n+\n+\t\t\tif (rta_sec_era <= RTA_SEC_ERA_3)\n+\t\t\t\tPATCH_MOVE(p, move_mac_i_to_desc_buf,\n+\t\t\t\t\t   fifo_load_mac_i_offset + 1);\n+\t\t} else {\n+\t\t\tPATCH_MOVE(p, seq_out_read, end_desc + 2);\n+\t\t\tPATCH_JUMP(p, jump_back_to_sd_cmd,\n+\t\t\t\t   back_to_sd_offset + jump_back_to_sd_cmd - 5);\n+\n+\t\t\tif (rta_sec_era <= RTA_SEC_ERA_3)\n+\t\t\t\tPATCH_MOVE(p, move_mac_i_to_desc_buf,\n+\t\t\t\t\t   fifo_load_mac_i_offset + 1);\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_aes_snow_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override __maybe_unused)\n+{\n+\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,\n+\t    INLINE_KEY(authdata));\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,\n+\t\t\t ((uint16_t)cipherdata->algtype << 8) |\n+\t\t\t (uint16_t)authdata->algtype);\n+\n+\t\treturn 0;\n+\t}\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\tMATHB(p, SEQINSZ, SUB, ONE, VSEQINSZ, 4, 0);\n+\n+\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);\n+\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8, IFB | IMMED2);\n+\tSEQSTORE(p, MATH0, 7, 1, 0);\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH1, 8, 0);\n+\tMOVE(p, MATH1, 0, CONTEXT1, 16, 8, IMMED);\n+\tMOVE(p, MATH1, 0, CONTEXT2, 0, 4, IMMED);\n+\tMATHB(p, MATH1, AND, lower_32_bits(PDCP_BEARER_MASK), MATH2, 4, IMMED2);\n+\tMATHB(p, MATH1, AND, upper_32_bits(PDCP_DIR_MASK), MATH3, 4, IMMED2);\n+\tMATHB(p, MATH3, SHLD, MATH3, MATH3, 8, 0);\n+\tMOVE(p, MATH2, 4, OFIFO, 0, 12, IMMED);\n+\tMOVE(p, OFIFO, 0, CONTEXT2, 4, 12, IMMED);\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\t} else {\n+\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, MATH1, 4, IMMED2);\n+\n+\t\tMATHB(p, ZERO, ADD, MATH1, VSEQOUTSZ, 4, 0);\n+\t\tMATHB(p, ZERO, ADD, MATH1, VSEQINSZ, 4, 0);\n+\t}\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\telse\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F9,\n+\t\t      OP_ALG_AAI_F9,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t     ICV_CHECK_DISABLE : ICV_CHECK_ENABLE,\n+\t\t      DIR_DEC);\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t      OP_ALG_AAI_CTR,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      ICV_CHECK_DISABLE,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ? DIR_ENC : DIR_DEC);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST2);\n+\t\tMOVE(p, CONTEXT2, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);\n+\t} else {\n+\t\tSEQFIFOLOAD(p, MSGOUTSNOOP, 0, VLF | LAST2);\n+\t\tSEQFIFOLOAD(p, MSG1, 4, LAST1 | FLUSH1);\n+\t\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CLASS1 | NOP | NIFP);\n+\n+\t\tif (rta_sec_era >= RTA_SEC_ERA_6)\n+\t\t\tLOAD(p, 0, DCTRL, 0, LDLEN_RST_CHA_OFIFO_PTR, IMMED);\n+\n+\t\tMOVE(p, OFIFO, 0, MATH0, 0, 4, WAITCOMP | IMMED);\n+\n+\t\tNFIFOADD(p, IFIFO, ICV2, 4, LAST2);\n+\n+\t\tif (rta_sec_era <= RTA_SEC_ERA_2) {\n+\t\t\t/* Shut off automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t\tMOVE(p, MATH0, 0, IFIFOAB2, 0, 4, WAITCOMP | IMMED);\n+\t\t} else {\n+\t\t\tMOVE(p, MATH0, 0, IFIFO, 0, 4, WAITCOMP | IMMED);\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_snow_zuc_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override __maybe_unused)\n+{\n+\tLABEL(keyjump);\n+\tREFERENCE(pkeyjump);\n+\n+\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\tpkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);\n+\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,\n+\t    INLINE_KEY(authdata));\n+\n+\tSET_LABEL(p, keyjump);\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,\n+\t\t\t ((uint16_t)cipherdata->algtype << 8) |\n+\t\t\t (uint16_t)authdata->algtype);\n+\t\treturn 0;\n+\t}\n+\n+\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);\n+\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8, IFB | IMMED2);\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\tMOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);\n+\tMOVE(p, MATH2, 0, CONTEXT2, 0, 8, WAITCOMP | IMMED);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\telse\n+\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\n+\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\tSEQSTORE(p, MATH0, 7, 1, 0);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST2);\n+\t} else {\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tSEQFIFOLOAD(p, MSGOUTSNOOP, 0, VLF | LAST1 | FLUSH1);\n+\t}\n+\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCA,\n+\t\t      OP_ALG_AAI_F9,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t     ICV_CHECK_DISABLE : ICV_CHECK_ENABLE,\n+\t\t      DIR_ENC);\n+\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F8,\n+\t\t      OP_ALG_AAI_F8,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      ICV_CHECK_DISABLE,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ? DIR_ENC : DIR_DEC);\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tMOVE(p, CONTEXT2, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);\n+\t} else {\n+\t\t/* Save ICV */\n+\t\tMOVE(p, OFIFO, 0, MATH0, 0, 4, IMMED);\n+\t\tLOAD(p, NFIFOENTRY_STYPE_ALTSOURCE |\n+\t\t     NFIFOENTRY_DEST_CLASS2 |\n+\t\t     NFIFOENTRY_DTYPE_ICV |\n+\t\t     NFIFOENTRY_LC2 | 4, NFIFO_SZL, 0, 4, IMMED);\n+\t\tMOVE(p, MATH0, 0, ALTSOURCE, 0, 4, WAITCOMP | IMMED);\n+\t}\n+\n+\t/* Reset ZUCA mode and done interrupt */\n+\tLOAD(p, CLRW_CLR_C2MODE, CLRW, 0, 4, IMMED);\n+\tLOAD(p, CIRQ_ZADI, ICTRL, 0, 4, IMMED);\n+\n+\tPATCH_JUMP(p, pkeyjump, keyjump);\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_aes_zuc_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override __maybe_unused)\n+{\n+\tLABEL(keyjump);\n+\tREFERENCE(pkeyjump);\n+\n+\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\tpkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);\n+\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,\n+\t    INLINE_KEY(authdata));\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,\n+\t\t\t ((uint16_t)cipherdata->algtype << 8) |\n+\t\t\t (uint16_t)authdata->algtype);\n+\n+\t\treturn 0;\n+\t}\n+\n+\tSET_LABEL(p, keyjump);\n+\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);\n+\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8, IFB | IMMED2);\n+\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\tMOVE(p, MATH2, 0, CONTEXT1, 16, 8, IMMED);\n+\tMOVE(p, MATH2, 0, CONTEXT2, 0, 8, WAITCOMP | IMMED);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL)\n+\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\telse\n+\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\n+\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\tSEQSTORE(p, MATH0, 7, 1, 0);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST2);\n+\t} else {\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tSEQFIFOLOAD(p, MSGOUTSNOOP, 0, VLF | LAST1 | FLUSH1);\n+\t}\n+\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCA,\n+\t\t      OP_ALG_AAI_F9,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t     ICV_CHECK_DISABLE : ICV_CHECK_ENABLE,\n+\t\t      DIR_ENC);\n+\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t      OP_ALG_AAI_CTR,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      ICV_CHECK_DISABLE,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ? DIR_ENC : DIR_DEC);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tMOVE(p, CONTEXT2, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);\n+\t} else {\n+\t\t/* Save ICV */\n+\t\tMOVE(p, OFIFO, 0, MATH0, 0, 4, IMMED);\n+\n+\t\tLOAD(p, NFIFOENTRY_STYPE_ALTSOURCE |\n+\t\t     NFIFOENTRY_DEST_CLASS2 |\n+\t\t     NFIFOENTRY_DTYPE_ICV |\n+\t\t     NFIFOENTRY_LC2 | 4, NFIFO_SZL, 0, 4, IMMED);\n+\t\tMOVE(p, MATH0, 0, ALTSOURCE, 0, 4, WAITCOMP | IMMED);\n+\t}\n+\n+\t/* Reset ZUCA mode and done interrupt */\n+\tLOAD(p, CLRW_CLR_C2MODE, CLRW, 0, 4, IMMED);\n+\tLOAD(p, CIRQ_ZADI, ICTRL, 0, 4, IMMED);\n+\n+\tPATCH_JUMP(p, pkeyjump, keyjump);\n+\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_zuc_snow_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override __maybe_unused)\n+{\n+\tLABEL(keyjump);\n+\tREFERENCE(pkeyjump);\n+\n+\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\tpkeyjump = JUMP(p, keyjump, LOCAL_JUMP, ALL_TRUE, SHRD | SELF | BOTH);\n+\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key, authdata->keylen,\n+\t    INLINE_KEY(authdata));\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,\n+\t\t\t ((uint16_t)cipherdata->algtype << 8) |\n+\t\t\t (uint16_t)authdata->algtype);\n+\n+\t\treturn 0;\n+\t}\n+\n+\tSET_LABEL(p, keyjump);\n+\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMOVE(p, MATH0, 7, IFIFOAB2, 0, 1, IMMED);\n+\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8, IFB | IMMED2);\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 4, MATH2, 0, 8, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH1, 8, 0);\n+\tMOVE(p, MATH1, 0, CONTEXT1, 0, 8, IMMED);\n+\tMOVE(p, MATH1, 0, CONTEXT2, 0, 4, IMMED);\n+\tMATHB(p, MATH1, AND, lower_32_bits(PDCP_BEARER_MASK), MATH2, 4, IMMED2);\n+\tMATHB(p, MATH1, AND, upper_32_bits(PDCP_DIR_MASK), MATH3, 4, IMMED2);\n+\tMATHB(p, MATH3, SHLD, MATH3, MATH3, 8, 0);\n+\tMOVE(p, MATH2, 4, OFIFO, 0, 12, IMMED);\n+\tMOVE(p, OFIFO, 0, CONTEXT2, 4, 12, IMMED);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tMATHB(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t} else {\n+\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\t\tMATHB(p, VSEQOUTSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t}\n+\n+\tSEQSTORE(p, MATH0, 7, 1, 0);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST2);\n+\t} else {\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tSEQFIFOLOAD(p, MSGOUTSNOOP, 0, VLF | LAST2);\n+\t}\n+\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F9,\n+\t\t      OP_ALG_AAI_F9,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ?\n+\t\t\t     ICV_CHECK_DISABLE : ICV_CHECK_ENABLE,\n+\t\t      DIR_DEC);\n+\n+\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCE,\n+\t\t      OP_ALG_AAI_F8,\n+\t\t      OP_ALG_AS_INITFINAL,\n+\t\t      ICV_CHECK_DISABLE,\n+\t\t      dir == OP_TYPE_ENCAP_PROTOCOL ? DIR_ENC : DIR_DEC);\n+\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tMOVE(p, CONTEXT2, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);\n+\t} else {\n+\t\tSEQFIFOLOAD(p, MSG1, 4, LAST1 | FLUSH1);\n+\t\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CLASS1 | NOP | NIFP);\n+\n+\t\tif (rta_sec_era >= RTA_SEC_ERA_6)\n+\t\t\t/*\n+\t\t\t * For SEC ERA 6, there's a problem with the OFIFO\n+\t\t\t * pointer, and thus it needs to be reset here before\n+\t\t\t * moving to M0.\n+\t\t\t */\n+\t\t\tLOAD(p, 0, DCTRL, 0, LDLEN_RST_CHA_OFIFO_PTR, IMMED);\n+\n+\t\t/* Put ICV to M0 before sending it to C2 for comparison. */\n+\t\tMOVE(p, OFIFO, 0, MATH0, 0, 4, WAITCOMP | IMMED);\n+\n+\t\tLOAD(p, NFIFOENTRY_STYPE_ALTSOURCE |\n+\t\t     NFIFOENTRY_DEST_CLASS2 |\n+\t\t     NFIFOENTRY_DTYPE_ICV |\n+\t\t     NFIFOENTRY_LC2 | 4, NFIFO_SZL, 0, 4, IMMED);\n+\t\tMOVE(p, MATH0, 0, ALTSOURCE, 0, 4, IMMED);\n+\t}\n+\n+\tPATCH_JUMP(p, pkeyjump, keyjump);\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_cplane_zuc_aes_op(struct program *p,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned dir,\n+\t\tunsigned char era_2_sw_hfn_override __maybe_unused)\n+{\n+\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t\t\t\tcipherdata->keylen, INLINE_KEY(cipherdata));\n+\t\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key,\n+\t\t\t\tauthdata->keylen, INLINE_KEY(authdata));\n+\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_CTRL_MIXED,\n+\t\t\t ((uint16_t)cipherdata->algtype << 8) |\n+\t\t\t (uint16_t)authdata->algtype);\n+\t\treturn 0;\n+\t}\n+\n+\tSEQLOAD(p, MATH0, 7, 1, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMATHB(p, MATH0, AND, PDCP_C_PLANE_SN_MASK, MATH1, 8, IFB | IMMED2);\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 4, MATH2, 0, 0x08, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\tSEQSTORE(p, MATH0, 7, 1, 0);\n+\tif (dir == OP_TYPE_ENCAP_PROTOCOL) {\n+\t\tKEY(p, KEY1, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tMOVE(p, MATH2, 0, IFIFOAB1, 0, 0x08, IMMED);\n+\t\tMOVE(p, MATH0, 7, IFIFOAB1, 0, 1, IMMED);\n+\n+\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\tMATHB(p, VSEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CMAC,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_DEC);\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\t\tMOVE(p, CONTEXT1, 0, MATH3, 0, 4, WAITCOMP | IMMED);\n+\t\tLOAD(p, CLRW_RESET_CLS1_CHA |\n+\t\t     CLRW_CLR_C1KEY |\n+\t\t     CLRW_CLR_C1CTX |\n+\t\t     CLRW_CLR_C1ICV |\n+\t\t     CLRW_CLR_C1DATAS |\n+\t\t     CLRW_CLR_C1MODE,\n+\t\t     CLRW, 0, 4, IMMED);\n+\n+\t\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);\n+\t\tSEQINPTR(p, 0, PDCP_NULL_MAX_FRAME_LEN, RTO);\n+\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCE,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_ENC);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\n+\t\tSEQFIFOLOAD(p, SKIP, 1, 0);\n+\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF);\n+\t\tMOVE(p, MATH3, 0, IFIFOAB1, 0, 4, LAST1 | FLUSH1 | IMMED);\n+\t} else {\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 8, IMMED);\n+\n+\t\tMOVE(p, CONTEXT1, 0, CONTEXT2, 0, 8, IMMED);\n+\n+\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\n+\t\tMATHB(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2);\n+\n+\t\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\n+\t\tMOVE(p, CONTEXT1, 0, CONTEXT2, 0, 8, IMMED);\n+\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCE,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_DEC);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF | CONT);\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\n+\t\tMOVE(p, OFIFO, 0, MATH3, 0, 4, IMMED);\n+\n+\t\tLOAD(p, CLRW_RESET_CLS1_CHA |\n+\t\t     CLRW_CLR_C1KEY |\n+\t\t     CLRW_CLR_C1CTX |\n+\t\t     CLRW_CLR_C1ICV |\n+\t\t     CLRW_CLR_C1DATAS |\n+\t\t     CLRW_CLR_C1MODE,\n+\t\t     CLRW, 0, 4, IMMED);\n+\n+\t\tKEY(p, KEY1, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\n+\t\tSEQINPTR(p, 0, 0, SOP);\n+\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CMAC,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_ENABLE,\n+\t\t\t      DIR_DEC);\n+\n+\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\n+\t\tMOVE(p, CONTEXT2, 0, IFIFOAB1, 0, 8, IMMED);\n+\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\n+\t\tLOAD(p, NFIFOENTRY_STYPE_ALTSOURCE |\n+\t\t     NFIFOENTRY_DEST_CLASS1 |\n+\t\t     NFIFOENTRY_DTYPE_ICV |\n+\t\t     NFIFOENTRY_LC1 |\n+\t\t     NFIFOENTRY_FC1 | 4, NFIFO_SZL, 0, 4, IMMED);\n+\t\tMOVE(p, MATH3, 0, ALTSOURCE, 0, 4, IMMED);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static inline int pdcp_insert_uplane_15bit_op(struct program *p,\n+\t\t\t\t\t      struct alginfo *cipherdata,\n+\t\t\t\t\t      unsigned dir)\n+{\n+\tint op;\n+\t/* Insert Cipher Key */\n+\tKEY(p, KEY1, cipherdata->key_enc_flags, cipherdata->key,\n+\t    cipherdata->keylen, INLINE_KEY(cipherdata));\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tPROTOCOL(p, dir, OP_PCLID_LTE_PDCP_USER,\n+\t\t\t (uint16_t)cipherdata->algtype);\n+\t\treturn 0;\n+\t}\n+\n+\tSEQLOAD(p, MATH0, 6, 2, 0);\n+\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\tMATHB(p, MATH0, AND, PDCP_U_PLANE_15BIT_SN_MASK, MATH1, 8,\n+\t      IFB | IMMED2);\n+\tSEQSTORE(p, MATH0, 6, 2, 0);\n+\tMATHB(p, MATH1, SHLD, MATH1, MATH1, 8, 0);\n+\tMOVE(p, DESCBUF, 8, MATH2, 0, 8, WAITCOMP | IMMED);\n+\tMATHB(p, MATH1, OR, MATH2, MATH2, 8, 0);\n+\n+\tMATHB(p, SEQINSZ, SUB, MATH3, VSEQINSZ, 4, 0);\n+\tMATHB(p, SEQINSZ, SUB, MATH3, VSEQOUTSZ, 4, 0);\n+\n+\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\n+\top = dir == OP_TYPE_ENCAP_PROTOCOL ? DIR_ENC : DIR_DEC;\n+\tswitch (cipherdata->algtype) {\n+\tcase PDCP_CIPHER_TYPE_SNOW:\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 8, WAITCOMP | IMMED);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F8,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      op);\n+\t\tbreak;\n+\n+\tcase PDCP_CIPHER_TYPE_AES:\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0x10, 0x10, WAITCOMP | IMMED);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CTR,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      op);\n+\t\tbreak;\n+\n+\tcase PDCP_CIPHER_TYPE_ZUC:\n+\t\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0, 0x08, IMMED);\n+\t\tMOVE(p, MATH2, 0, CONTEXT1, 0x08, 0x08, WAITCOMP | IMMED);\n+\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCE,\n+\t\t\t      OP_ALG_AAI_F8,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      op);\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tpr_err(\"%s: Invalid encrypt algorithm selected: %d\\n\",\n+\t\t       \"pdcp_insert_uplane_15bit_op\", cipherdata->algtype);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | FLUSH1);\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * Function for inserting the snippet of code responsible for creating\n+ * the HFN override code via either DPOVRD or via the input frame.\n+ */\n+static inline int insert_hfn_ov_op(struct program *p,\n+\t\t\t\t   uint32_t shift,\n+\t\t\t\t   enum pdb_type_e pdb_type,\n+\t\t\t\t   unsigned char era_2_sw_hfn_override)\n+{\n+\tuint32_t imm = 0x80000000;\n+\tuint16_t hfn_pdb_offset;\n+\n+\tif (rta_sec_era == RTA_SEC_ERA_2 && !era_2_sw_hfn_override)\n+\t\treturn 0;\n+\n+\tswitch (pdb_type) {\n+\tcase PDCP_PDB_TYPE_NO_PDB:\n+\t\t/*\n+\t\t * If there is no PDB, then HFN override mechanism does not\n+\t\t * make any sense, thus in this case the function will\n+\t\t * return the pointer to the current position in the\n+\t\t * descriptor buffer\n+\t\t */\n+\t\treturn 0;\n+\n+\tcase PDCP_PDB_TYPE_REDUCED_PDB:\n+\t\thfn_pdb_offset = 4;\n+\t\tbreak;\n+\n+\tcase PDCP_PDB_TYPE_FULL_PDB:\n+\t\thfn_pdb_offset = 8;\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\tMATHB(p, DPOVRD, AND, imm, NONE, 8, IFB | IMMED2);\n+\t} else {\n+\t\tSEQLOAD(p, MATH0, 4, 4, 0);\n+\t\tJUMP(p, 1, LOCAL_JUMP, ALL_TRUE, CALM);\n+\t\tMATHB(p, MATH0, AND, imm, NONE, 8, IFB | IMMED2);\n+\t\tSEQSTORE(p, MATH0, 4, 4, 0);\n+\t}\n+\n+\tJUMP(p, 5, LOCAL_JUMP, ALL_TRUE, MATH_Z);\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2)\n+\t\tMATHB(p, DPOVRD, LSHIFT, shift, MATH0, 4, IMMED2);\n+\telse\n+\t\tMATHB(p, MATH0, LSHIFT, shift, MATH0, 4, IMMED2);\n+\n+\tMATHB(p, MATH0, SHLD, MATH0, MATH0, 8, 0);\n+\tMOVE(p, MATH0, 0, DESCBUF, hfn_pdb_offset, 4, IMMED);\n+\n+\treturn 0;\n+}\n+\n+/*\n+ * PDCP Control PDB creation function\n+ */\n+static inline enum pdb_type_e cnstr_pdcp_c_plane_pdb(struct program *p,\n+\t\tuint32_t hfn,\n+\t\tunsigned char bearer,\n+\t\tunsigned char direction,\n+\t\tuint32_t hfn_threshold,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata)\n+{\n+\tstruct pdcp_pdb pdb;\n+\tenum pdb_type_e\n+\t\tpdb_mask[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID] = {\n+\t\t\t{\t/* NULL */\n+\t\t\t\tPDCP_PDB_TYPE_NO_PDB,\t\t/* NULL */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB,\t\t/* SNOW f9 */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB,\t\t/* AES CMAC */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB\t\t/* ZUC-I */\n+\t\t\t},\n+\t\t\t{\t/* SNOW f8 */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB,\t\t/* NULL */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB,\t\t/* SNOW f9 */\n+\t\t\t\tPDCP_PDB_TYPE_REDUCED_PDB,\t/* AES CMAC */\n+\t\t\t\tPDCP_PDB_TYPE_REDUCED_PDB\t/* ZUC-I */\n+\t\t\t},\n+\t\t\t{\t/* AES CTR */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB,\t\t/* NULL */\n+\t\t\t\tPDCP_PDB_TYPE_REDUCED_PDB,\t/* SNOW f9 */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB,\t\t/* AES CMAC */\n+\t\t\t\tPDCP_PDB_TYPE_REDUCED_PDB\t/* ZUC-I */\n+\t\t\t},\n+\t\t\t{\t/* ZUC-E */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB,\t\t/* NULL */\n+\t\t\t\tPDCP_PDB_TYPE_REDUCED_PDB,\t/* SNOW f9 */\n+\t\t\t\tPDCP_PDB_TYPE_REDUCED_PDB,\t/* AES CMAC */\n+\t\t\t\tPDCP_PDB_TYPE_FULL_PDB\t\t/* ZUC-I */\n+\t\t\t},\n+\t};\n+\n+\tif (rta_sec_era >= RTA_SEC_ERA_8) {\n+\t\tmemset(&pdb, 0x00, sizeof(struct pdcp_pdb));\n+\n+\t\t/* This is a HW issue. Bit 2 should be set to zero,\n+\t\t * but it does not work this way. Override here.\n+\t\t */\n+\t\tpdb.opt_res.rsvd = 0x00000002;\n+\n+\t\t/* Copy relevant information from user to PDB */\n+\t\tpdb.hfn_res = hfn << PDCP_C_PLANE_PDB_HFN_SHIFT;\n+\t\tpdb.bearer_dir_res = (uint32_t)\n+\t\t\t\t((bearer << PDCP_C_PLANE_PDB_BEARER_SHIFT) |\n+\t\t\t\t (direction << PDCP_C_PLANE_PDB_DIR_SHIFT));\n+\t\tpdb.hfn_thr_res =\n+\t\t\t\thfn_threshold << PDCP_C_PLANE_PDB_HFN_THR_SHIFT;\n+\n+\t\t/* copy PDB in descriptor*/\n+\t\t__rta_out32(p, pdb.opt_res.opt);\n+\t\t__rta_out32(p, pdb.hfn_res);\n+\t\t__rta_out32(p, pdb.bearer_dir_res);\n+\t\t__rta_out32(p, pdb.hfn_thr_res);\n+\n+\t\treturn PDCP_PDB_TYPE_FULL_PDB;\n+\t}\n+\n+\tswitch (pdb_mask[cipherdata->algtype][authdata->algtype]) {\n+\tcase PDCP_PDB_TYPE_NO_PDB:\n+\t\tbreak;\n+\n+\tcase PDCP_PDB_TYPE_REDUCED_PDB:\n+\t\t__rta_out32(p, (hfn << PDCP_C_PLANE_PDB_HFN_SHIFT));\n+\t\t__rta_out32(p,\n+\t\t\t    (uint32_t)((bearer <<\n+\t\t\t\t\tPDCP_C_PLANE_PDB_BEARER_SHIFT) |\n+\t\t\t\t\t(direction <<\n+\t\t\t\t\t PDCP_C_PLANE_PDB_DIR_SHIFT)));\n+\t\tbreak;\n+\n+\tcase PDCP_PDB_TYPE_FULL_PDB:\n+\t\tmemset(&pdb, 0x00, sizeof(struct pdcp_pdb));\n+\n+\t\t/* This is a HW issue. Bit 2 should be set to zero,\n+\t\t * but it does not work this way. Override here.\n+\t\t */\n+\t\tpdb.opt_res.rsvd = 0x00000002;\n+\n+\t\t/* Copy relevant information from user to PDB */\n+\t\tpdb.hfn_res = hfn << PDCP_C_PLANE_PDB_HFN_SHIFT;\n+\t\tpdb.bearer_dir_res = (uint32_t)\n+\t\t\t((bearer << PDCP_C_PLANE_PDB_BEARER_SHIFT) |\n+\t\t\t (direction << PDCP_C_PLANE_PDB_DIR_SHIFT));\n+\t\tpdb.hfn_thr_res =\n+\t\t\thfn_threshold << PDCP_C_PLANE_PDB_HFN_THR_SHIFT;\n+\n+\t\t/* copy PDB in descriptor*/\n+\t\t__rta_out32(p, pdb.opt_res.opt);\n+\t\t__rta_out32(p, pdb.hfn_res);\n+\t\t__rta_out32(p, pdb.bearer_dir_res);\n+\t\t__rta_out32(p, pdb.hfn_thr_res);\n+\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn PDCP_PDB_TYPE_INVALID;\n+\t}\n+\n+\treturn pdb_mask[cipherdata->algtype][authdata->algtype];\n+}\n+\n+/*\n+ * PDCP UPlane PDB creation function\n+ */\n+static inline int cnstr_pdcp_u_plane_pdb(struct program *p,\n+\t\t\t\t\t enum pdcp_sn_size sn_size,\n+\t\t\t\t\t uint32_t hfn, unsigned short bearer,\n+\t\t\t\t\t unsigned short direction,\n+\t\t\t\t\t uint32_t hfn_threshold)\n+{\n+\tstruct pdcp_pdb pdb;\n+\t/* Read options from user */\n+\t/* Depending on sequence number length, the HFN and HFN threshold\n+\t * have different lengths.\n+\t */\n+\tmemset(&pdb, 0x00, sizeof(struct pdcp_pdb));\n+\n+\tswitch (sn_size) {\n+\tcase PDCP_SN_SIZE_7:\n+\t\tpdb.opt_res.opt |= PDCP_U_PLANE_PDB_OPT_SHORT_SN;\n+\t\tpdb.hfn_res = hfn << PDCP_U_PLANE_PDB_SHORT_SN_HFN_SHIFT;\n+\t\tpdb.hfn_thr_res =\n+\t\t\thfn_threshold<<PDCP_U_PLANE_PDB_SHORT_SN_HFN_THR_SHIFT;\n+\t\tbreak;\n+\n+\tcase PDCP_SN_SIZE_12:\n+\t\tpdb.opt_res.opt &= (uint32_t)(~PDCP_U_PLANE_PDB_OPT_SHORT_SN);\n+\t\tpdb.hfn_res = hfn << PDCP_U_PLANE_PDB_LONG_SN_HFN_SHIFT;\n+\t\tpdb.hfn_thr_res =\n+\t\t\thfn_threshold<<PDCP_U_PLANE_PDB_LONG_SN_HFN_THR_SHIFT;\n+\t\tbreak;\n+\n+\tcase PDCP_SN_SIZE_15:\n+\t\tpdb.opt_res.opt = (uint32_t)(PDCP_U_PLANE_PDB_OPT_15B_SN);\n+\t\tpdb.hfn_res = hfn << PDCP_U_PLANE_PDB_15BIT_SN_HFN_SHIFT;\n+\t\tpdb.hfn_thr_res =\n+\t\t\thfn_threshold<<PDCP_U_PLANE_PDB_15BIT_SN_HFN_THR_SHIFT;\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tpr_err(\"Invalid Sequence Number Size setting in PDB\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tpdb.bearer_dir_res = (uint32_t)\n+\t\t\t\t((bearer << PDCP_U_PLANE_PDB_BEARER_SHIFT) |\n+\t\t\t\t (direction << PDCP_U_PLANE_PDB_DIR_SHIFT));\n+\n+\t/* copy PDB in descriptor*/\n+\t__rta_out32(p, pdb.opt_res.opt);\n+\t__rta_out32(p, pdb.hfn_res);\n+\t__rta_out32(p, pdb.bearer_dir_res);\n+\t__rta_out32(p, pdb.hfn_thr_res);\n+\n+\treturn 0;\n+}\n+/**\n+ * cnstr_shdsc_pdcp_c_plane_encap - Function for creating a PDCP Control Plane\n+ *                                  encapsulation descriptor.\n+ * @descbuf: pointer to buffer for descriptor construction\n+ * @ps: if 36/40bit addressing is desired, this parameter must be true\n+ * @swap: must be true when core endianness doesn't match SEC endianness\n+ * @hfn: starting Hyper Frame Number to be used together with the SN from the\n+ *       PDCP frames.\n+ * @bearer: radio bearer ID\n+ * @direction: the direction of the PDCP frame (UL/DL)\n+ * @hfn_threshold: HFN value that once reached triggers a warning from SEC that\n+ *                 keys should be renegotiated at the earliest convenience.\n+ * @cipherdata: pointer to block cipher transform definitions\n+ *              Valid algorithm values are those from cipher_type_pdcp enum.\n+ * @authdata: pointer to authentication transform definitions\n+ *            Valid algorithm values are those from auth_type_pdcp enum.\n+ * @era_2_sw_hfn_override: if software HFN override mechanism is desired for\n+ *                         this descriptor. Note: Can only be used for\n+ *                         SEC ERA 2.\n+ * Return: size of descriptor written in words or negative number on error.\n+ *         Once the function returns, the value of this parameter can be used\n+ *         for reclaiming the space that wasn't used for the descriptor.\n+ *\n+ * Note: descbuf must be large enough to contain a full 256 byte long\n+ * descriptor; after the function returns, by subtracting the actual number of\n+ * bytes used, the user can reuse the remaining buffer space for other purposes.\n+ */\n+static inline int cnstr_shdsc_pdcp_c_plane_encap(uint32_t *descbuf,\n+\t\tbool ps,\n+\t\tbool swap,\n+\t\tuint32_t hfn,\n+\t\tunsigned char bearer,\n+\t\tunsigned char direction,\n+\t\tuint32_t hfn_threshold,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned char era_2_sw_hfn_override)\n+{\n+\tstatic int\n+\t\t(*pdcp_cp_fp[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID])\n+\t\t\t(struct program*, struct alginfo *,\n+\t\t\t struct alginfo *, unsigned,\n+\t\t\tunsigned char __maybe_unused) = {\n+\t\t{\t/* NULL */\n+\t\t\tpdcp_insert_cplane_null_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_int_only_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_int_only_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_int_only_op\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* SNOW f8 */\n+\t\t\tpdcp_insert_cplane_enc_only_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_acc_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_snow_aes_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_snow_zuc_op\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* AES CTR */\n+\t\t\tpdcp_insert_cplane_enc_only_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_aes_snow_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_acc_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_aes_zuc_op\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* ZUC-E */\n+\t\t\tpdcp_insert_cplane_enc_only_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_zuc_snow_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_zuc_aes_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_acc_op\t/* ZUC-I */\n+\t\t},\n+\t};\n+\tstatic enum rta_share_type\n+\t\tdesc_share[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID] = {\n+\t\t{\t/* NULL */\n+\t\t\tSHR_WAIT,\t/* NULL */\n+\t\t\tSHR_ALWAYS,\t/* SNOW f9 */\n+\t\t\tSHR_ALWAYS,\t/* AES CMAC */\n+\t\t\tSHR_ALWAYS\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* SNOW f8 */\n+\t\t\tSHR_ALWAYS,\t/* NULL */\n+\t\t\tSHR_ALWAYS,\t/* SNOW f9 */\n+\t\t\tSHR_WAIT,\t/* AES CMAC */\n+\t\t\tSHR_WAIT\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* AES CTR */\n+\t\t\tSHR_ALWAYS,\t/* NULL */\n+\t\t\tSHR_ALWAYS,\t/* SNOW f9 */\n+\t\t\tSHR_ALWAYS,\t/* AES CMAC */\n+\t\t\tSHR_WAIT\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* ZUC-E */\n+\t\t\tSHR_ALWAYS,\t/* NULL */\n+\t\t\tSHR_WAIT,\t/* SNOW f9 */\n+\t\t\tSHR_WAIT,\t/* AES CMAC */\n+\t\t\tSHR_ALWAYS\t/* ZUC-I */\n+\t\t},\n+\t};\n+\tenum pdb_type_e pdb_type;\n+\tstruct program prg;\n+\tstruct program *p = &prg;\n+\tint err;\n+\tLABEL(pdb_end);\n+\n+\tif (rta_sec_era != RTA_SEC_ERA_2 && era_2_sw_hfn_override) {\n+\t\tpr_err(\"Cannot select SW HFN override for other era than 2\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tPROGRAM_CNTXT_INIT(p, descbuf, 0);\n+\tif (swap)\n+\t\tPROGRAM_SET_BSWAP(p);\n+\tif (ps)\n+\t\tPROGRAM_SET_36BIT_ADDR(p);\n+\n+\tSHR_HDR(p, desc_share[cipherdata->algtype][authdata->algtype], 0, 0);\n+\n+\tpdb_type = cnstr_pdcp_c_plane_pdb(p,\n+\t\t\thfn,\n+\t\t\tbearer,\n+\t\t\tdirection,\n+\t\t\thfn_threshold,\n+\t\t\tcipherdata,\n+\t\t\tauthdata);\n+\n+\tSET_LABEL(p, pdb_end);\n+\n+\terr = insert_hfn_ov_op(p, PDCP_SN_SIZE_5, pdb_type,\n+\t\t\t       era_2_sw_hfn_override);\n+\tif (err)\n+\t\treturn err;\n+\n+\terr = pdcp_cp_fp[cipherdata->algtype][authdata->algtype](p,\n+\t\tcipherdata,\n+\t\tauthdata,\n+\t\tOP_TYPE_ENCAP_PROTOCOL,\n+\t\tera_2_sw_hfn_override);\n+\tif (err)\n+\t\treturn err;\n+\n+\tPATCH_HDR(p, 0, pdb_end);\n+\n+\treturn PROGRAM_FINALIZE(p);\n+}\n+\n+/**\n+ * cnstr_shdsc_pdcp_c_plane_decap - Function for creating a PDCP Control Plane\n+ *                                  decapsulation descriptor.\n+ * @descbuf: pointer to buffer for descriptor construction\n+ * @ps: if 36/40bit addressing is desired, this parameter must be true\n+ * @swap: must be true when core endianness doesn't match SEC endianness\n+ * @hfn: starting Hyper Frame Number to be used together with the SN from the\n+ *       PDCP frames.\n+ * @bearer: radio bearer ID\n+ * @direction: the direction of the PDCP frame (UL/DL)\n+ * @hfn_threshold: HFN value that once reached triggers a warning from SEC that\n+ *                 keys should be renegotiated at the earliest convenience.\n+ * @cipherdata: pointer to block cipher transform definitions\n+ *              Valid algorithm values are those from cipher_type_pdcp enum.\n+ * @authdata: pointer to authentication transform definitions\n+ *            Valid algorithm values are those from auth_type_pdcp enum.\n+ * @era_2_sw_hfn_override: if software HFN override mechanism is desired for\n+ *                         this descriptor. Note: Can only be used for\n+ *                         SEC ERA 2.\n+ *\n+ * Return: size of descriptor written in words or negative number on error.\n+ *         Once the function returns, the value of this parameter can be used\n+ *         for reclaiming the space that wasn't used for the descriptor.\n+ *\n+ * Note: descbuf must be large enough to contain a full 256 byte long\n+ * descriptor; after the function returns, by subtracting the actual number of\n+ * bytes used, the user can reuse the remaining buffer space for other purposes.\n+ */\n+static inline int cnstr_shdsc_pdcp_c_plane_decap(uint32_t *descbuf,\n+\t\tbool ps,\n+\t\tbool swap,\n+\t\tuint32_t hfn,\n+\t\tunsigned char bearer,\n+\t\tunsigned char direction,\n+\t\tuint32_t hfn_threshold,\n+\t\tstruct alginfo *cipherdata,\n+\t\tstruct alginfo *authdata,\n+\t\tunsigned char era_2_sw_hfn_override)\n+{\n+\tstatic int\n+\t\t(*pdcp_cp_fp[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID])\n+\t\t\t(struct program*, struct alginfo *,\n+\t\t\t struct alginfo *, unsigned, unsigned char) = {\n+\t\t{\t/* NULL */\n+\t\t\tpdcp_insert_cplane_null_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_int_only_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_int_only_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_int_only_op\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* SNOW f8 */\n+\t\t\tpdcp_insert_cplane_enc_only_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_acc_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_snow_aes_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_snow_zuc_op\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* AES CTR */\n+\t\t\tpdcp_insert_cplane_enc_only_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_aes_snow_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_acc_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_aes_zuc_op\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* ZUC-E */\n+\t\t\tpdcp_insert_cplane_enc_only_op,\t/* NULL */\n+\t\t\tpdcp_insert_cplane_zuc_snow_op,\t/* SNOW f9 */\n+\t\t\tpdcp_insert_cplane_zuc_aes_op,\t/* AES CMAC */\n+\t\t\tpdcp_insert_cplane_acc_op\t/* ZUC-I */\n+\t\t},\n+\t};\n+\tstatic enum rta_share_type\n+\t\tdesc_share[PDCP_CIPHER_TYPE_INVALID][PDCP_AUTH_TYPE_INVALID] = {\n+\t\t{\t/* NULL */\n+\t\t\tSHR_WAIT,\t/* NULL */\n+\t\t\tSHR_ALWAYS,\t/* SNOW f9 */\n+\t\t\tSHR_ALWAYS,\t/* AES CMAC */\n+\t\t\tSHR_ALWAYS\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* SNOW f8 */\n+\t\t\tSHR_ALWAYS,\t/* NULL */\n+\t\t\tSHR_ALWAYS,\t/* SNOW f9 */\n+\t\t\tSHR_WAIT,\t/* AES CMAC */\n+\t\t\tSHR_WAIT\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* AES CTR */\n+\t\t\tSHR_ALWAYS,\t/* NULL */\n+\t\t\tSHR_ALWAYS,\t/* SNOW f9 */\n+\t\t\tSHR_ALWAYS,\t/* AES CMAC */\n+\t\t\tSHR_WAIT\t/* ZUC-I */\n+\t\t},\n+\t\t{\t/* ZUC-E */\n+\t\t\tSHR_ALWAYS,\t/* NULL */\n+\t\t\tSHR_WAIT,\t/* SNOW f9 */\n+\t\t\tSHR_WAIT,\t/* AES CMAC */\n+\t\t\tSHR_ALWAYS\t/* ZUC-I */\n+\t\t},\n+\t};\n+\tenum pdb_type_e pdb_type;\n+\tstruct program prg;\n+\tstruct program *p = &prg;\n+\tint err;\n+\tLABEL(pdb_end);\n+\n+\tif (rta_sec_era != RTA_SEC_ERA_2 && era_2_sw_hfn_override) {\n+\t\tpr_err(\"Cannot select SW HFN override for other era than 2\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tPROGRAM_CNTXT_INIT(p, descbuf, 0);\n+\tif (swap)\n+\t\tPROGRAM_SET_BSWAP(p);\n+\tif (ps)\n+\t\tPROGRAM_SET_36BIT_ADDR(p);\n+\n+\tSHR_HDR(p, desc_share[cipherdata->algtype][authdata->algtype], 0, 0);\n+\n+\tpdb_type = cnstr_pdcp_c_plane_pdb(p,\n+\t\t\thfn,\n+\t\t\tbearer,\n+\t\t\tdirection,\n+\t\t\thfn_threshold,\n+\t\t\tcipherdata,\n+\t\t\tauthdata);\n+\n+\tSET_LABEL(p, pdb_end);\n+\n+\terr = insert_hfn_ov_op(p, PDCP_SN_SIZE_5, pdb_type,\n+\t\t\t       era_2_sw_hfn_override);\n+\tif (err)\n+\t\treturn err;\n+\n+\terr = pdcp_cp_fp[cipherdata->algtype][authdata->algtype](p,\n+\t\tcipherdata,\n+\t\tauthdata,\n+\t\tOP_TYPE_DECAP_PROTOCOL,\n+\t\tera_2_sw_hfn_override);\n+\tif (err)\n+\t\treturn err;\n+\n+\tPATCH_HDR(p, 0, pdb_end);\n+\n+\treturn PROGRAM_FINALIZE(p);\n+}\n+\n+/**\n+ * cnstr_shdsc_pdcp_u_plane_encap - Function for creating a PDCP User Plane\n+ *                                  encapsulation descriptor.\n+ * @descbuf: pointer to buffer for descriptor construction\n+ * @ps: if 36/40bit addressing is desired, this parameter must be true\n+ * @swap: must be true when core endianness doesn't match SEC endianness\n+ * @sn_size: selects Sequence Number Size: 7/12/15 bits\n+ * @hfn: starting Hyper Frame Number to be used together with the SN from the\n+ *       PDCP frames.\n+ * @bearer: radio bearer ID\n+ * @direction: the direction of the PDCP frame (UL/DL)\n+ * @hfn_threshold: HFN value that once reached triggers a warning from SEC that\n+ *                 keys should be renegotiated at the earliest convenience.\n+ * @cipherdata: pointer to block cipher transform definitions\n+ *              Valid algorithm values are those from cipher_type_pdcp enum.\n+ * @era_2_sw_hfn_override: if software HFN override mechanism is desired for\n+ *                         this descriptor. Note: Can only be used for\n+ *                         SEC ERA 2.\n+ *\n+ * Return: size of descriptor written in words or negative number on error.\n+ *         Once the function returns, the value of this parameter can be used\n+ *         for reclaiming the space that wasn't used for the descriptor.\n+ *\n+ * Note: descbuf must be large enough to contain a full 256 byte long\n+ * descriptor; after the function returns, by subtracting the actual number of\n+ * bytes used, the user can reuse the remaining buffer space for other purposes.\n+ */\n+static inline int cnstr_shdsc_pdcp_u_plane_encap(uint32_t *descbuf,\n+\t\tbool ps,\n+\t\tbool swap,\n+\t\tenum pdcp_sn_size sn_size,\n+\t\tuint32_t hfn,\n+\t\tunsigned short bearer,\n+\t\tunsigned short direction,\n+\t\tuint32_t hfn_threshold,\n+\t\tstruct alginfo *cipherdata,\n+\t\tunsigned char era_2_sw_hfn_override)\n+{\n+\tstruct program prg;\n+\tstruct program *p = &prg;\n+\tint err;\n+\tLABEL(pdb_end);\n+\n+\tif (rta_sec_era != RTA_SEC_ERA_2 && era_2_sw_hfn_override) {\n+\t\tpr_err(\"Cannot select SW HFN override for other era than 2\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tPROGRAM_CNTXT_INIT(p, descbuf, 0);\n+\tif (swap)\n+\t\tPROGRAM_SET_BSWAP(p);\n+\tif (ps)\n+\t\tPROGRAM_SET_36BIT_ADDR(p);\n+\n+\tSHR_HDR(p, SHR_ALWAYS, 0, 0);\n+\tif (cnstr_pdcp_u_plane_pdb(p, sn_size, hfn, bearer, direction,\n+\t\t\t\t   hfn_threshold)) {\n+\t\tpr_err(\"Error creating PDCP UPlane PDB\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tSET_LABEL(p, pdb_end);\n+\n+\terr = insert_hfn_ov_op(p, sn_size, PDCP_PDB_TYPE_FULL_PDB,\n+\t\t\t       era_2_sw_hfn_override);\n+\tif (err)\n+\t\treturn err;\n+\n+\tswitch (sn_size) {\n+\tcase PDCP_SN_SIZE_7:\n+\tcase PDCP_SN_SIZE_12:\n+\t\tswitch (cipherdata->algtype) {\n+\t\tcase PDCP_CIPHER_TYPE_ZUC:\n+\t\t\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\t\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\t\t\treturn -ENOTSUP;\n+\t\t\t}\n+\t\tcase PDCP_CIPHER_TYPE_AES:\n+\t\tcase PDCP_CIPHER_TYPE_SNOW:\n+\t\t\t/* Insert Cipher Key */\n+\t\t\tKEY(p, KEY1, cipherdata->key_enc_flags,\n+\t\t\t    (uint64_t)cipherdata->key, cipherdata->keylen,\n+\t\t\t    INLINE_KEY(cipherdata));\n+\t\t\tPROTOCOL(p, OP_TYPE_ENCAP_PROTOCOL,\n+\t\t\t\t OP_PCLID_LTE_PDCP_USER,\n+\t\t\t\t (uint16_t)cipherdata->algtype);\n+\t\t\tbreak;\n+\t\tcase PDCP_CIPHER_TYPE_NULL:\n+\t\t\tinsert_copy_frame_op(p,\n+\t\t\t\t\t     cipherdata,\n+\t\t\t\t\t     OP_TYPE_ENCAP_PROTOCOL);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tpr_err(\"%s: Invalid encrypt algorithm selected: %d\\n\",\n+\t\t\t       \"cnstr_pcl_shdsc_pdcp_u_plane_decap\",\n+\t\t\t       cipherdata->algtype);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tbreak;\n+\n+\tcase PDCP_SN_SIZE_15:\n+\t\tswitch (cipherdata->algtype) {\n+\t\tcase PDCP_CIPHER_TYPE_NULL:\n+\t\t\tinsert_copy_frame_op(p,\n+\t\t\t\t\t     cipherdata,\n+\t\t\t\t\t     OP_TYPE_ENCAP_PROTOCOL);\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\terr = pdcp_insert_uplane_15bit_op(p, cipherdata,\n+\t\t\t\tOP_TYPE_ENCAP_PROTOCOL);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n+\t\t\tbreak;\n+\t\t}\n+\t\tbreak;\n+\n+\tcase PDCP_SN_SIZE_5:\n+\tdefault:\n+\t\tpr_err(\"Invalid SN size selected\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\tPATCH_HDR(p, 0, pdb_end);\n+\treturn PROGRAM_FINALIZE(p);\n+}\n+\n+/**\n+ * cnstr_shdsc_pdcp_u_plane_decap - Function for creating a PDCP User Plane\n+ *                                  decapsulation descriptor.\n+ * @descbuf: pointer to buffer for descriptor construction\n+ * @ps: if 36/40bit addressing is desired, this parameter must be true\n+ * @swap: must be true when core endianness doesn't match SEC endianness\n+ * @sn_size: selects Sequence Number Size: 7/12/15 bits\n+ * @hfn: starting Hyper Frame Number to be used together with the SN from the\n+ *       PDCP frames.\n+ * @bearer: radio bearer ID\n+ * @direction: the direction of the PDCP frame (UL/DL)\n+ * @hfn_threshold: HFN value that once reached triggers a warning from SEC that\n+ *                 keys should be renegotiated at the earliest convenience.\n+ * @cipherdata: pointer to block cipher transform definitions\n+ *              Valid algorithm values are those from cipher_type_pdcp enum.\n+ * @era_2_sw_hfn_override: if software HFN override mechanism is desired for\n+ *                         this descriptor. Note: Can only be used for\n+ *                         SEC ERA 2.\n+ *\n+ * Return: size of descriptor written in words or negative number on error.\n+ *         Once the function returns, the value of this parameter can be used\n+ *         for reclaiming the space that wasn't used for the descriptor.\n+ *\n+ * Note: descbuf must be large enough to contain a full 256 byte long\n+ * descriptor; after the function returns, by subtracting the actual number of\n+ * bytes used, the user can reuse the remaining buffer space for other purposes.\n+ */\n+static inline int cnstr_shdsc_pdcp_u_plane_decap(uint32_t *descbuf,\n+\t\tbool ps,\n+\t\tbool swap,\n+\t\tenum pdcp_sn_size sn_size,\n+\t\tuint32_t hfn,\n+\t\tunsigned short bearer,\n+\t\tunsigned short direction,\n+\t\tuint32_t hfn_threshold,\n+\t\tstruct alginfo *cipherdata,\n+\t\tunsigned char era_2_sw_hfn_override)\n+{\n+\tstruct program prg;\n+\tstruct program *p = &prg;\n+\tint err;\n+\tLABEL(pdb_end);\n+\n+\tif (rta_sec_era != RTA_SEC_ERA_2 && era_2_sw_hfn_override) {\n+\t\tpr_err(\"Cannot select SW HFN override for other era than 2\");\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tPROGRAM_CNTXT_INIT(p, descbuf, 0);\n+\tif (swap)\n+\t\tPROGRAM_SET_BSWAP(p);\n+\tif (ps)\n+\t\tPROGRAM_SET_36BIT_ADDR(p);\n+\n+\tSHR_HDR(p, SHR_ALWAYS, 0, 0);\n+\tif (cnstr_pdcp_u_plane_pdb(p, sn_size, hfn, bearer, direction,\n+\t\t\t\t   hfn_threshold)) {\n+\t\tpr_err(\"Error creating PDCP UPlane PDB\\n\");\n+\t\treturn -EINVAL;\n+\t}\n+\tSET_LABEL(p, pdb_end);\n+\n+\terr = insert_hfn_ov_op(p, sn_size, PDCP_PDB_TYPE_FULL_PDB,\n+\t\t\t       era_2_sw_hfn_override);\n+\tif (err)\n+\t\treturn err;\n+\n+\tswitch (sn_size) {\n+\tcase PDCP_SN_SIZE_7:\n+\tcase PDCP_SN_SIZE_12:\n+\t\tswitch (cipherdata->algtype) {\n+\t\tcase PDCP_CIPHER_TYPE_ZUC:\n+\t\t\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\t\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\t\t\treturn -ENOTSUP;\n+\t\t\t}\n+\t\tcase PDCP_CIPHER_TYPE_AES:\n+\t\tcase PDCP_CIPHER_TYPE_SNOW:\n+\t\t\t/* Insert Cipher Key */\n+\t\t\tKEY(p, KEY1, cipherdata->key_enc_flags,\n+\t\t\t    cipherdata->key, cipherdata->keylen,\n+\t\t\t    INLINE_KEY(cipherdata));\n+\t\t\tPROTOCOL(p, OP_TYPE_DECAP_PROTOCOL,\n+\t\t\t\t OP_PCLID_LTE_PDCP_USER,\n+\t\t\t\t (uint16_t)cipherdata->algtype);\n+\t\t\tbreak;\n+\t\tcase PDCP_CIPHER_TYPE_NULL:\n+\t\t\tinsert_copy_frame_op(p,\n+\t\t\t\t\t     cipherdata,\n+\t\t\t\t\t     OP_TYPE_DECAP_PROTOCOL);\n+\t\t\tbreak;\n+\t\tdefault:\n+\t\t\tpr_err(\"%s: Invalid encrypt algorithm selected: %d\\n\",\n+\t\t\t       \"cnstr_pcl_shdsc_pdcp_u_plane_decap\",\n+\t\t\t       cipherdata->algtype);\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\t\tbreak;\n+\n+\tcase PDCP_SN_SIZE_15:\n+\t\tswitch (cipherdata->algtype) {\n+\t\tcase PDCP_CIPHER_TYPE_NULL:\n+\t\t\tinsert_copy_frame_op(p,\n+\t\t\t\t\t     cipherdata,\n+\t\t\t\t\t     OP_TYPE_DECAP_PROTOCOL);\n+\t\t\tbreak;\n+\n+\t\tdefault:\n+\t\t\terr = pdcp_insert_uplane_15bit_op(p, cipherdata,\n+\t\t\t\tOP_TYPE_DECAP_PROTOCOL);\n+\t\t\tif (err)\n+\t\t\t\treturn err;\n+\t\t\tbreak;\n+\t\t}\n+\t\tbreak;\n+\n+\tcase PDCP_SN_SIZE_5:\n+\tdefault:\n+\t\tpr_err(\"Invalid SN size selected\\n\");\n+\t\treturn -ENOTSUP;\n+\t}\n+\n+\tPATCH_HDR(p, 0, pdb_end);\n+\treturn PROGRAM_FINALIZE(p);\n+}\n+\n+/**\n+ * cnstr_shdsc_pdcp_short_mac - Function for creating a PDCP Short MAC\n+ *                              descriptor.\n+ * @descbuf: pointer to buffer for descriptor construction\n+ * @ps: if 36/40bit addressing is desired, this parameter must be true\n+ * @swap: must be true when core endianness doesn't match SEC endianness\n+ * @authdata: pointer to authentication transform definitions\n+ *            Valid algorithm values are those from auth_type_pdcp enum.\n+ *\n+ * Return: size of descriptor written in words or negative number on error.\n+ *         Once the function returns, the value of this parameter can be used\n+ *         for reclaiming the space that wasn't used for the descriptor.\n+ *\n+ * Note: descbuf must be large enough to contain a full 256 byte long\n+ * descriptor; after the function returns, by subtracting the actual number of\n+ * bytes used, the user can reuse the remaining buffer space for other purposes.\n+ */\n+static inline int cnstr_shdsc_pdcp_short_mac(uint32_t *descbuf,\n+\t\tbool ps,\n+\t\tbool swap,\n+\t\tstruct alginfo *authdata)\n+{\n+\tstruct program prg;\n+\tstruct program *p = &prg;\n+\tuint32_t iv[3] = {0, 0, 0};\n+\tLABEL(local_offset);\n+\tREFERENCE(move_cmd_read_descbuf);\n+\tREFERENCE(move_cmd_write_descbuf);\n+\n+\tPROGRAM_CNTXT_INIT(p, descbuf, 0);\n+\tif (swap)\n+\t\tPROGRAM_SET_BSWAP(p);\n+\tif (ps)\n+\t\tPROGRAM_SET_36BIT_ADDR(p);\n+\n+\tSHR_HDR(p, SHR_ALWAYS, 1, 0);\n+\n+\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\tMATHB(p, SEQINSZ, SUB, ZERO, VSEQINSZ, 4, 0);\n+\t\tMATHB(p, SEQINSZ, SUB, ZERO, MATH1, 4, 0);\n+\t} else {\n+\t\tMATHB(p, SEQINSZ, ADD, ONE, MATH1, 4, 0);\n+\t\tMATHB(p, MATH1, SUB, ONE, MATH1, 4, 0);\n+\t\tMATHB(p, ZERO, ADD, MATH1, VSEQINSZ, 4, 0);\n+\t\tMOVE(p, MATH1, 0, MATH0, 0, 8, IMMED);\n+\n+\t\t/*\n+\t\t * Since MOVELEN is available only starting with\n+\t\t * SEC ERA 3, use poor man's MOVELEN: create a MOVE\n+\t\t * command dynamically by writing the length from M1 by\n+\t\t * OR-ing the command in the M1 register and MOVE the\n+\t\t * result into the descriptor buffer. Care must be taken\n+\t\t * wrt. the location of the command because of SEC\n+\t\t * pipelining. The actual MOVEs are written at the end\n+\t\t * of the descriptor due to calculations needed on the\n+\t\t * offset in the descriptor for the MOVE command.\n+\t\t */\n+\t\tmove_cmd_read_descbuf = MOVE(p, DESCBUF, 0, MATH0, 0, 6,\n+\t\t\t\t\t     IMMED);\n+\t\tmove_cmd_write_descbuf = MOVE(p, MATH0, 0, DESCBUF, 0, 8,\n+\t\t\t\t\t      WAITCOMP | IMMED);\n+\t}\n+\tMATHB(p, ZERO, ADD, MATH1, VSEQOUTSZ, 4, 0);\n+\n+\tswitch (authdata->algtype) {\n+\tcase PDCP_AUTH_TYPE_NULL:\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMOVE(p, AB1, 0, OFIFO, 0, MATH1, 0);\n+\t\t} else {\n+\t\t\tSET_LABEL(p, local_offset);\n+\n+\t\t\t/* Shut off automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\n+\t\t\t/* Placeholder for MOVE command with length from M1\n+\t\t\t * register\n+\t\t\t */\n+\t\t\tMOVE(p, IFIFOAB1, 0, OFIFO, 0, 0, IMMED);\n+\n+\t\t\t/* Enable automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_ENABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t}\n+\n+\t\tLOAD(p, (uintptr_t)iv, MATH0, 0, 8, IMMED | COPY);\n+\t\tSEQFIFOLOAD(p, MSG1, 0, VLF | LAST1 | LAST2 | FLUSH1);\n+\t\tSEQSTORE(p, MATH0, 0, 4, 0);\n+\n+\t\tbreak;\n+\n+\tcase PDCP_AUTH_TYPE_SNOW:\n+\t\tiv[0] = 0xFFFFFFFF;\n+\t\tiv[1] = swap ? swab32(0x04000000) : 0x04000000;\n+\t\tiv[2] = swap ? swab32(0xF8000000) : 0xF8000000;\n+\n+\t\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tLOAD(p, (uintptr_t)&iv, CONTEXT2, 0, 12, IMMED | COPY);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_SNOW_F9,\n+\t\t\t      OP_ALG_AAI_F9,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_ENC);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMOVE(p, AB1, 0, OFIFO, 0, MATH1, 0);\n+\t\t} else {\n+\t\t\tSET_LABEL(p, local_offset);\n+\n+\n+\t\t\t/* Shut off automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\n+\t\t\t/* Placeholder for MOVE command with length from M1\n+\t\t\t * register */\n+\t\t\tMOVE(p, IFIFOAB1, 0, OFIFO, 0, 0, IMMED);\n+\n+\t\t\t/* Enable automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_ENABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t}\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST1 | LAST2 | FLUSH1);\n+\t\tSEQSTORE(p, CONTEXT2, 0, 4, 0);\n+\n+\t\tbreak;\n+\n+\tcase PDCP_AUTH_TYPE_AES:\n+\t\tiv[0] = 0xFFFFFFFF;\n+\t\tiv[1] = swap ? swab32(0xFC000000) : 0xFC000000;\n+\t\tiv[2] = 0x00000000; /* unused */\n+\n+\t\tKEY(p, KEY1, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tLOAD(p, (uintptr_t)&iv, MATH0, 0, 8, IMMED | COPY);\n+\t\tMOVE(p, MATH0, 0, IFIFOAB1, 0, 8, IMMED);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_AES,\n+\t\t\t      OP_ALG_AAI_CMAC,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_ENC);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\n+\t\tif (rta_sec_era > RTA_SEC_ERA_2) {\n+\t\t\tMOVE(p, AB2, 0, OFIFO, 0, MATH1, 0);\n+\t\t} else {\n+\t\t\tSET_LABEL(p, local_offset);\n+\n+\t\t\t/* Shut off automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_DISABLE_AUTO_NFIFO, 0, IMMED);\n+\n+\t\t\t/* Placeholder for MOVE command with length from M1\n+\t\t\t * register */\n+\t\t\tMOVE(p, IFIFOAB2, 0, OFIFO, 0, 0, IMMED);\n+\n+\t\t\t/* Enable automatic Info FIFO entries */\n+\t\t\tLOAD(p, 0, DCTRL, LDOFF_ENABLE_AUTO_NFIFO, 0, IMMED);\n+\t\t}\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST1 | LAST2 | FLUSH1);\n+\t\tSEQSTORE(p, CONTEXT1, 0, 4, 0);\n+\n+\t\tbreak;\n+\n+\tcase PDCP_AUTH_TYPE_ZUC:\n+\t\tif (rta_sec_era < RTA_SEC_ERA_5) {\n+\t\t\tpr_err(\"Invalid era for selected algorithm\\n\");\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\t\tiv[0] = 0xFFFFFFFF;\n+\t\tiv[1] = swap ? swab32(0xFC000000) : 0xFC000000;\n+\t\tiv[2] = 0x00000000; /* unused */\n+\n+\t\tKEY(p, KEY2, authdata->key_enc_flags, authdata->key,\n+\t\t    authdata->keylen, INLINE_KEY(authdata));\n+\t\tLOAD(p, (uintptr_t)&iv, CONTEXT2, 0, 12, IMMED | COPY);\n+\t\tALG_OPERATION(p, OP_ALG_ALGSEL_ZUCA,\n+\t\t\t      OP_ALG_AAI_F9,\n+\t\t\t      OP_ALG_AS_INITFINAL,\n+\t\t\t      ICV_CHECK_DISABLE,\n+\t\t\t      DIR_ENC);\n+\t\tSEQFIFOSTORE(p, MSG, 0, 0, VLF);\n+\t\tMOVE(p, AB1, 0, OFIFO, 0, MATH1, 0);\n+\t\tSEQFIFOLOAD(p, MSGINSNOOP, 0, VLF | LAST1 | LAST2 | FLUSH1);\n+\t\tSEQSTORE(p, CONTEXT2, 0, 4, 0);\n+\n+\t\tbreak;\n+\n+\tdefault:\n+\t\tpr_err(\"%s: Invalid integrity algorithm selected: %d\\n\",\n+\t\t       \"cnstr_shdsc_pdcp_short_mac\", authdata->algtype);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\n+\tif (rta_sec_era < RTA_SEC_ERA_3) {\n+\t\tPATCH_MOVE(p, move_cmd_read_descbuf, local_offset);\n+\t\tPATCH_MOVE(p, move_cmd_write_descbuf, local_offset);\n+\t}\n+\n+\treturn PROGRAM_FINALIZE(p);\n+}\n+\n+#endif /* __DESC_PDCP_H__ */\n",
    "prefixes": [
        "2/3"
    ]
}