get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 47167,
    "url": "https://patches.dpdk.org/api/patches/47167/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20181022141657.4727-11-g.singh@nxp.com/",
    "project": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20181022141657.4727-11-g.singh@nxp.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181022141657.4727-11-g.singh@nxp.com",
    "date": "2018-10-22T14:17:54",
    "name": "[v4,10/15] crypto/caam_jr: add enqueue dequeue operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "71beee40e2055cdd97aa404ae2fc5925715ac93c",
    "submitter": {
        "id": 1068,
        "url": "https://patches.dpdk.org/api/people/1068/?format=api",
        "name": "Gagandeep Singh",
        "email": "g.singh@nxp.com"
    },
    "delegate": {
        "id": 6690,
        "url": "https://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20181022141657.4727-11-g.singh@nxp.com/mbox/",
    "series": [
        {
            "id": 2012,
            "url": "https://patches.dpdk.org/api/series/2012/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=2012",
            "date": "2018-10-22T14:17:33",
            "name": "Introducing the NXP CAAM job ring driver",
            "version": 4,
            "mbox": "https://patches.dpdk.org/series/2012/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/47167/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/47167/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 6054E1B1F8;\n\tMon, 22 Oct 2018 16:18:06 +0200 (CEST)",
            "from EUR03-DB5-obe.outbound.protection.outlook.com\n\t(mail-eopbgr40067.outbound.protection.outlook.com [40.107.4.67])\n\tby dpdk.org (Postfix) with ESMTP id 45CD11B134\n\tfor <dev@dpdk.org>; Mon, 22 Oct 2018 16:17:56 +0200 (CEST)",
            "from HE1PR04MB1530.eurprd04.prod.outlook.com (10.164.48.20) by\n\tHE1PR04MB3242.eurprd04.prod.outlook.com (10.170.251.154) with\n\tMicrosoft SMTP Server (version=TLS1_2,\n\tcipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n\t15.20.1250.30; Mon, 22 Oct 2018 14:17:54 +0000",
            "from HE1PR04MB1530.eurprd04.prod.outlook.com\n\t([fe80::95cd:198:d5c5:59a4]) by\n\tHE1PR04MB1530.eurprd04.prod.outlook.com\n\t([fe80::95cd:198:d5c5:59a4%5]) with mapi id 15.20.1250.028;\n\tMon, 22 Oct 2018 14:17:54 +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=JmNsEu++aBJmKJUhq9OV0wlCp1weTR7JvaOfvZmVV64=;\n\tb=V6GSJ5WYJnKefl3Q+9O3ZWsunGKKYhks+bNOh/kEgKzI3ouKTDtepERfucMHgjOBcbjto7V7+IzCcko0MJpI5XQeazT2CkdMB8cGri3pHjnzSpzBFMNI5x8M1UrJ18qPop32bpn41f7dm6Pdd/7GMq0ZV1aD7vodveGiLqDs40Q=",
        "From": "Gagandeep Singh <G.Singh@nxp.com>",
        "To": "\"dev@dpdk.org\" <dev@dpdk.org>, Akhil Goyal <akhil.goyal@nxp.com>",
        "CC": "Gagandeep Singh <G.Singh@nxp.com>,\n\tHemant Agrawal <hemant.agrawal@nxp.com>",
        "Thread-Topic": "[PATCH v4 10/15] crypto/caam_jr: add enqueue dequeue operations",
        "Thread-Index": "AQHUahIFQGVIyZJbv0ahzTtteuejvQ==",
        "Date": "Mon, 22 Oct 2018 14:17:54 +0000",
        "Message-ID": "<20181022141657.4727-11-g.singh@nxp.com>",
        "References": "<20181022133021.11264-1-g.singh@nxp.com>\n\t<20181022141657.4727-1-g.singh@nxp.com>",
        "In-Reply-To": "<20181022141657.4727-1-g.singh@nxp.com>",
        "Accept-Language": "en-US",
        "Content-Language": "en-US",
        "X-MS-Has-Attach": "",
        "X-MS-TNEF-Correlator": "",
        "x-clientproxiedby": "BM1PR0101CA0025.INDPRD01.PROD.OUTLOOK.COM\n\t(2603:1096:b00:1a::11) To HE1PR04MB1530.eurprd04.prod.outlook.com\n\t(2a01:111:e400:59a8::20)",
        "x-ms-exchange-messagesentrepresentingtype": "1",
        "x-originating-ip": "[14.142.187.166]",
        "x-ms-publictraffictype": "Email",
        "x-microsoft-exchange-diagnostics": "1; HE1PR04MB3242;\n\t6:ejbETBCDEzsajDNxYjsEzKAFjlAC/Pfol3LvQdSoeKbNFFEG6zO0NrcLeniTe85jgMibBdNrecjXpT9fmfIOGyjd486Gwc2iTAUaN+g3r2qTlWgjWgBp88WeCwswipk0N9Ku5eBMBNSpIW+WfZrKciIEG6+VheCW/x32bs8IdtkXVeKd7xkXHcUGp9cJwpzzkm6CBfnIcHyusIdgkp+eVZ1KUZ/1oU42aMY/tFYJ+htB8cpu0Cl65CFggJ+oav8J9owI4N63pdNCx6mI4Z0Cr2eFFCNjlM7GFWtFuAGqE8mR5HJAeavL9fYWdKoIu1WfF9ylRNMIPepqtIkMf89oXK/exliapj5UFGerljXg5RHSB1D21vzRQpkYBSPsf15fpWszlscoRdODgO1IRLuPOwA1ZUB9Bwe49YMki602fD4CVeJ9Q0g5MWYl0UBaVQh/JwcoWek55ggBPNqTZO2SgA==;\n\t5:EyPWtUZ43FGaVzjjE7pGnYqqbAYCVG0gT2O21Q6T71DdWH2gE/FoPzsAaj6XcUqYnRldhboK/MJlnZR+mfG/g6wCUDxGIJudG0/dEdYT3+xHj0q4jq7hUBOH68k2lp1C/iiN8Ol2sCUYkwpJp0zGqc3h77LjI51JPfU+cgNQ+1g=;\n\t7:cl+DWRJN6BfhaordMnWhBRv3fLOOiQY5L8EmQq39pJEuZRsd3gHSuXbt1gDG0TVNwfNMFxKObw71QplAcJSRFH81ZT9YWSCCzAKcHgWfR1AO2sABuQqdvy9osM1FXamwF5X6nKUgNO5rHjii9m7VlEFlG0cwEh236EeiVaDz0jmxCrLruhS3HflQRkXkDeM8c8lmj5pXF+lsecTTepcwOFXcUpRDYjon+QzLfsRUFm+GWUCqcxadcv0sHB2ATqPN",
        "x-ms-office365-filtering-correlation-id": "873c44b2-78ec-4a01-5cee-08d63829282d",
        "x-ms-office365-filtering-ht": "Tenant",
        "x-microsoft-antispam": "BCL:0; PCL:0;\n\tRULEID:(7020095)(4652040)(8989299)(4534185)(7168020)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);\n\tSRVR:HE1PR04MB3242; ",
        "x-ms-traffictypediagnostic": "HE1PR04MB3242:",
        "x-microsoft-antispam-prvs": "<HE1PR04MB324248DB03E935155754CC24E1F40@HE1PR04MB3242.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)(3002001)(3231355)(944501410)(52105095)(10201501046)(93006095)(93001095)(6055026)(148016)(149066)(150057)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201708071742011)(7699051)(76991095);\n\tSRVR:HE1PR04MB3242; BCL:0; PCL:0; RULEID:; SRVR:HE1PR04MB3242; ",
        "x-forefront-prvs": "08331F819E",
        "x-forefront-antispam-report": "SFV:NSPM;\n\tSFS:(10009020)(366004)(136003)(396003)(376002)(346002)(39860400002)(199004)(189003)(4744004)(86362001)(68736007)(72206003)(1076002)(3846002)(6116002)(5660300001)(71200400001)(71190400001)(110136005)(54906003)(105586002)(78486010)(106356001)(6636002)(2906002)(575784001)(7736002)(8936002)(305945005)(478600001)(81166006)(316002)(81156014)(8676002)(4326008)(25786009)(2900100001)(476003)(16200700003)(53936002)(53946003)(66066001)(6486002)(14444005)(446003)(6436002)(6512007)(99286004)(52116002)(76176011)(36756003)(14454004)(256004)(6346003)(97736004)(2616005)(11346002)(486006)(186003)(26005)(2501003)(5250100002)(55236004)(102836004)(6506007)(386003)(134034003)(579004)(559001)(569006);\n\tDIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR04MB3242;\n\tH:HE1PR04MB1530.eurprd04.prod.outlook.com; FPR:; SPF:None; LANG:en;\n\tPTR:InfoNoRecords; A:1; MX:1; ",
        "received-spf": "None (protection.outlook.com: nxp.com does not designate\n\tpermitted sender hosts)",
        "authentication-results": "spf=none (sender IP is )\n\tsmtp.mailfrom=G.Singh@nxp.com; ",
        "x-microsoft-antispam-message-info": "vtJFExYkDfAbuSGNUS6FgGCCWS7IH2WehiKqDZTOiwTUbUAvcwh/U4STE8JVCQDjt8elnwIu/cPGVypvH0XmfOimXr9/DopCAfrPge6RJUIr+i7/GtxRvElkCQz19XVIDf/Ysl1O9lMEZ+3HmmTGyO7EFFohbnJoONbJ8b2fYkqpEeu7UcmQD6wy8k28ysmzSY9YD5ov1MqnJ8c/3sZ5io8GuZaHCxZ95c+FloLqMCeU4yB/LyfRbnZP4YLAmgMkybug34UYXwKGGWFLPcarbqY3RaVxiqVeZGOPc8Dfq5bnclxFWOrBRTR2E5UViOaNr1goTghd2+H7G0Vq5AeQKLdKg1yCEFMOzbpzLZBGdM4=",
        "spamdiagnosticoutput": "1:99",
        "spamdiagnosticmetadata": "NSPM",
        "Content-Type": "text/plain; charset=\"iso-8859-1\"",
        "Content-Transfer-Encoding": "quoted-printable",
        "MIME-Version": "1.0",
        "X-OriginatorOrg": "nxp.com",
        "X-MS-Exchange-CrossTenant-Network-Message-Id": "873c44b2-78ec-4a01-5cee-08d63829282d",
        "X-MS-Exchange-CrossTenant-originalarrivaltime": "22 Oct 2018 14:17:54.5896\n\t(UTC)",
        "X-MS-Exchange-CrossTenant-fromentityheader": "Hosted",
        "X-MS-Exchange-CrossTenant-id": "686ea1d3-bc2b-4c6f-a92c-d99c5c301635",
        "X-MS-Exchange-Transport-CrossTenantHeadersStamped": "HE1PR04MB3242",
        "Subject": "[dpdk-dev] [PATCH v4 10/15] crypto/caam_jr: add enqueue dequeue\n\toperations",
        "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": "This patch add support for :\n1. creating run time sec hw decriptors for a given request.\n2. enqueue operation to the caam jr ring\n3. dequeue operation from the caam jr ring in poll mode\n4. creating a crypto protocol descriptor for session - first time.\n\nSigned-off-by: Gagandeep Singh <g.singh@nxp.com>\nSigned-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>\nAcked-by: Akhil Goyal <akhil.goyal@nxp.com>\n---\n drivers/crypto/caam_jr/caam_jr.c      | 875 +++++++++++++++++++++++++-\n drivers/crypto/caam_jr/caam_jr_desc.h | 285 +++++++++\n 2 files changed, 1158 insertions(+), 2 deletions(-)\n create mode 100644 drivers/crypto/caam_jr/caam_jr_desc.h",
    "diff": "diff --git a/drivers/crypto/caam_jr/caam_jr.c b/drivers/crypto/caam_jr/caam_jr.c\nindex 96b18be12..594ae8ded 100644\n--- a/drivers/crypto/caam_jr/caam_jr.c\n+++ b/drivers/crypto/caam_jr/caam_jr.c\n@@ -20,6 +20,7 @@\n #include <caam_jr_config.h>\n #include <caam_jr_hw_specific.h>\n #include <caam_jr_pvt.h>\n+#include <caam_jr_desc.h>\n #include <caam_jr_log.h>\n \n /* RTA header files */\n@@ -52,6 +53,343 @@ static enum sec_driver_state_e g_driver_state = SEC_DRIVER_STATE_IDLE;\n static int g_job_rings_no;\n static int g_job_rings_max;\n \n+struct sec_outring_entry {\n+\tphys_addr_t desc;\t/* Pointer to completed descriptor */\n+\tuint32_t status;\t/* Status for completed descriptor */\n+} __rte_packed;\n+\n+/* virtual address conversin when mempool support is available for ctx */\n+static inline phys_addr_t\n+caam_jr_vtop_ctx(struct caam_jr_op_ctx *ctx, void *vaddr)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\treturn (size_t)vaddr - ctx->vtop_offset;\n+}\n+\n+static inline void\n+caam_jr_op_ending(struct caam_jr_op_ctx *ctx)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\t/* report op status to sym->op and then free the ctx memeory  */\n+\trte_mempool_put(ctx->ctx_pool, (void *)ctx);\n+}\n+\n+static inline struct caam_jr_op_ctx *\n+caam_jr_alloc_ctx(struct caam_jr_session *ses)\n+{\n+\tstruct caam_jr_op_ctx *ctx;\n+\tint ret;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\tret = rte_mempool_get(ses->ctx_pool, (void **)(&ctx));\n+\tif (!ctx || ret) {\n+\t\tCAAM_JR_DP_WARN(\"Alloc sec descriptor failed!\");\n+\t\treturn NULL;\n+\t}\n+\t/*\n+\t * Clear SG memory. There are 16 SG entries of 16 Bytes each.\n+\t * one call to dcbz_64() clear 64 bytes, hence calling it 4 times\n+\t * to clear all the SG entries. caam_jr_alloc_ctx() is called for\n+\t * each packet, memset is costlier than dcbz_64().\n+\t */\n+\tdcbz_64(&ctx->sg[SG_CACHELINE_0]);\n+\tdcbz_64(&ctx->sg[SG_CACHELINE_1]);\n+\tdcbz_64(&ctx->sg[SG_CACHELINE_2]);\n+\tdcbz_64(&ctx->sg[SG_CACHELINE_3]);\n+\n+\tctx->ctx_pool = ses->ctx_pool;\n+\tctx->vtop_offset = (size_t) ctx - rte_mempool_virt2iova(ctx);\n+\n+\treturn ctx;\n+}\n+\n+static inline int\n+is_cipher_only(struct caam_jr_session *ses)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\treturn ((ses->cipher_alg != RTE_CRYPTO_CIPHER_NULL) &&\n+\t\t(ses->auth_alg == RTE_CRYPTO_AUTH_NULL));\n+}\n+\n+static inline int\n+is_auth_only(struct caam_jr_session *ses)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\treturn ((ses->cipher_alg == RTE_CRYPTO_CIPHER_NULL) &&\n+\t\t(ses->auth_alg != RTE_CRYPTO_AUTH_NULL));\n+}\n+\n+static inline int\n+is_aead(struct caam_jr_session *ses)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\treturn ((ses->cipher_alg == 0) &&\n+\t\t(ses->auth_alg == 0) &&\n+\t\t(ses->aead_alg != 0));\n+}\n+\n+static inline int\n+is_auth_cipher(struct caam_jr_session *ses)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\treturn ((ses->cipher_alg != RTE_CRYPTO_CIPHER_NULL) &&\n+\t\t(ses->auth_alg != RTE_CRYPTO_AUTH_NULL));\n+}\n+\n+static inline int\n+is_encode(struct caam_jr_session *ses)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\treturn ses->dir == DIR_ENC;\n+}\n+\n+static inline int\n+is_decode(struct caam_jr_session *ses)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\treturn ses->dir == DIR_DEC;\n+}\n+\n+static inline void\n+caam_auth_alg(struct caam_jr_session *ses, struct alginfo *alginfo_a)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\tswitch (ses->auth_alg) {\n+\tcase RTE_CRYPTO_AUTH_NULL:\n+\t\tses->digest_length = 0;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_MD5_HMAC:\n+\t\talginfo_a->algtype = OP_ALG_ALGSEL_MD5;\n+\t\talginfo_a->algmode = OP_ALG_AAI_HMAC;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA1_HMAC:\n+\t\talginfo_a->algtype = OP_ALG_ALGSEL_SHA1;\n+\t\talginfo_a->algmode = OP_ALG_AAI_HMAC;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA224_HMAC:\n+\t\talginfo_a->algtype = OP_ALG_ALGSEL_SHA224;\n+\t\talginfo_a->algmode = OP_ALG_AAI_HMAC;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA256_HMAC:\n+\t\talginfo_a->algtype = OP_ALG_ALGSEL_SHA256;\n+\t\talginfo_a->algmode = OP_ALG_AAI_HMAC;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA384_HMAC:\n+\t\talginfo_a->algtype = OP_ALG_ALGSEL_SHA384;\n+\t\talginfo_a->algmode = OP_ALG_AAI_HMAC;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_AUTH_SHA512_HMAC:\n+\t\talginfo_a->algtype = OP_ALG_ALGSEL_SHA512;\n+\t\talginfo_a->algmode = OP_ALG_AAI_HMAC;\n+\t\tbreak;\n+\tdefault:\n+\t\tCAAM_JR_DEBUG(\"unsupported auth alg %u\", ses->auth_alg);\n+\t}\n+}\n+\n+static inline void\n+caam_cipher_alg(struct caam_jr_session *ses, struct alginfo *alginfo_c)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\tswitch (ses->cipher_alg) {\n+\tcase RTE_CRYPTO_CIPHER_NULL:\n+\t\tbreak;\n+\tcase RTE_CRYPTO_CIPHER_AES_CBC:\n+\t\talginfo_c->algtype = OP_ALG_ALGSEL_AES;\n+\t\talginfo_c->algmode = OP_ALG_AAI_CBC;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_CIPHER_3DES_CBC:\n+\t\talginfo_c->algtype = OP_ALG_ALGSEL_3DES;\n+\t\talginfo_c->algmode = OP_ALG_AAI_CBC;\n+\t\tbreak;\n+\tcase RTE_CRYPTO_CIPHER_AES_CTR:\n+\t\talginfo_c->algtype = OP_ALG_ALGSEL_AES;\n+\t\talginfo_c->algmode = OP_ALG_AAI_CTR;\n+\t\tbreak;\n+\tdefault:\n+\t\tCAAM_JR_DEBUG(\"unsupported cipher alg %d\", ses->cipher_alg);\n+\t}\n+}\n+\n+static inline void\n+caam_aead_alg(struct caam_jr_session *ses, struct alginfo *alginfo)\n+{\n+\tPMD_INIT_FUNC_TRACE();\n+\tswitch (ses->aead_alg) {\n+\tcase RTE_CRYPTO_AEAD_AES_GCM:\n+\t\talginfo->algtype = OP_ALG_ALGSEL_AES;\n+\t\talginfo->algmode = OP_ALG_AAI_GCM;\n+\t\tbreak;\n+\tdefault:\n+\t\tCAAM_JR_DEBUG(\"unsupported AEAD alg %d\", ses->aead_alg);\n+\t}\n+}\n+\n+/* prepare command block of the session */\n+static int\n+caam_jr_prep_cdb(struct caam_jr_session *ses)\n+{\n+\tstruct alginfo alginfo_c = {0}, alginfo_a = {0}, alginfo = {0};\n+\tint32_t shared_desc_len = 0;\n+\tstruct sec_cdb *cdb;\n+\tint err;\n+#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN\n+\tint swap = false;\n+#else\n+\tint swap = true;\n+#endif\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\tif (ses->cdb)\n+\t\tcaam_jr_dma_free(ses->cdb);\n+\n+\tcdb = caam_jr_dma_mem_alloc(L1_CACHE_BYTES, sizeof(struct sec_cdb));\n+\tif (!cdb) {\n+\t\tCAAM_JR_ERR(\"failed to allocate memory for cdb\\n\");\n+\t\treturn -1;\n+\t}\n+\n+\tses->cdb = cdb;\n+\n+\tmemset(cdb, 0, sizeof(struct sec_cdb));\n+\n+\tif (is_cipher_only(ses)) {\n+\t\tcaam_cipher_alg(ses, &alginfo_c);\n+\t\tif (alginfo_c.algtype == (unsigned int)CAAM_JR_ALG_UNSUPPORT) {\n+\t\t\tCAAM_JR_ERR(\"not supported cipher alg\");\n+\t\t\trte_free(cdb);\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\n+\t\talginfo_c.key = (size_t)ses->cipher_key.data;\n+\t\talginfo_c.keylen = ses->cipher_key.length;\n+\t\talginfo_c.key_enc_flags = 0;\n+\t\talginfo_c.key_type = RTA_DATA_IMM;\n+\n+\t\tshared_desc_len = cnstr_shdsc_blkcipher(\n+\t\t\t\t\t\tcdb->sh_desc, true,\n+\t\t\t\t\t\tswap, &alginfo_c,\n+\t\t\t\t\t\tNULL,\n+\t\t\t\t\t\tses->iv.length,\n+\t\t\t\t\t\tses->dir);\n+\t} else if (is_auth_only(ses)) {\n+\t\tcaam_auth_alg(ses, &alginfo_a);\n+\t\tif (alginfo_a.algtype == (unsigned int)CAAM_JR_ALG_UNSUPPORT) {\n+\t\t\tCAAM_JR_ERR(\"not supported auth alg\");\n+\t\t\trte_free(cdb);\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\n+\t\talginfo_a.key = (size_t)ses->auth_key.data;\n+\t\talginfo_a.keylen = ses->auth_key.length;\n+\t\talginfo_a.key_enc_flags = 0;\n+\t\talginfo_a.key_type = RTA_DATA_IMM;\n+\n+\t\tshared_desc_len = cnstr_shdsc_hmac(cdb->sh_desc, true,\n+\t\t\t\t\t\t   swap, &alginfo_a,\n+\t\t\t\t\t\t   !ses->dir,\n+\t\t\t\t\t\t   ses->digest_length);\n+\t} else if (is_aead(ses)) {\n+\t\tcaam_aead_alg(ses, &alginfo);\n+\t\tif (alginfo.algtype == (unsigned int)CAAM_JR_ALG_UNSUPPORT) {\n+\t\t\tCAAM_JR_ERR(\"not supported aead alg\");\n+\t\t\trte_free(cdb);\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\t\talginfo.key = (size_t)ses->aead_key.data;\n+\t\talginfo.keylen = ses->aead_key.length;\n+\t\talginfo.key_enc_flags = 0;\n+\t\talginfo.key_type = RTA_DATA_IMM;\n+\n+\t\tif (ses->dir == DIR_ENC)\n+\t\t\tshared_desc_len = cnstr_shdsc_gcm_encap(\n+\t\t\t\t\tcdb->sh_desc, true, swap,\n+\t\t\t\t\t&alginfo,\n+\t\t\t\t\tses->iv.length,\n+\t\t\t\t\tses->digest_length);\n+\t\telse\n+\t\t\tshared_desc_len = cnstr_shdsc_gcm_decap(\n+\t\t\t\t\tcdb->sh_desc, true, swap,\n+\t\t\t\t\t&alginfo,\n+\t\t\t\t\tses->iv.length,\n+\t\t\t\t\tses->digest_length);\n+\t} else {\n+\t\tcaam_cipher_alg(ses, &alginfo_c);\n+\t\tif (alginfo_c.algtype == (unsigned int)CAAM_JR_ALG_UNSUPPORT) {\n+\t\t\tCAAM_JR_ERR(\"not supported cipher alg\");\n+\t\t\trte_free(cdb);\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\n+\t\talginfo_c.key = (size_t)ses->cipher_key.data;\n+\t\talginfo_c.keylen = ses->cipher_key.length;\n+\t\talginfo_c.key_enc_flags = 0;\n+\t\talginfo_c.key_type = RTA_DATA_IMM;\n+\n+\t\tcaam_auth_alg(ses, &alginfo_a);\n+\t\tif (alginfo_a.algtype == (unsigned int)CAAM_JR_ALG_UNSUPPORT) {\n+\t\t\tCAAM_JR_ERR(\"not supported auth alg\");\n+\t\t\trte_free(cdb);\n+\t\t\treturn -ENOTSUP;\n+\t\t}\n+\n+\t\talginfo_a.key = (size_t)ses->auth_key.data;\n+\t\talginfo_a.keylen = ses->auth_key.length;\n+\t\talginfo_a.key_enc_flags = 0;\n+\t\talginfo_a.key_type = RTA_DATA_IMM;\n+\n+\t\tcdb->sh_desc[0] = alginfo_c.keylen;\n+\t\tcdb->sh_desc[1] = alginfo_a.keylen;\n+\t\terr = rta_inline_query(IPSEC_AUTH_VAR_AES_DEC_BASE_DESC_LEN,\n+\t\t\t\t       MIN_JOB_DESC_SIZE,\n+\t\t\t\t       (unsigned int *)cdb->sh_desc,\n+\t\t\t\t       &cdb->sh_desc[2], 2);\n+\n+\t\tif (err < 0) {\n+\t\t\tCAAM_JR_ERR(\"Crypto: Incorrect key lengths\");\n+\t\t\trte_free(cdb);\n+\t\t\treturn err;\n+\t\t}\n+\t\tif (cdb->sh_desc[2] & 1)\n+\t\t\talginfo_c.key_type = RTA_DATA_IMM;\n+\t\telse {\n+\t\t\talginfo_c.key = (size_t)caam_jr_mem_vtop(\n+\t\t\t\t\t\t(void *)(size_t)alginfo_c.key);\n+\t\t\talginfo_c.key_type = RTA_DATA_PTR;\n+\t\t}\n+\t\tif (cdb->sh_desc[2] & (1<<1))\n+\t\t\talginfo_a.key_type = RTA_DATA_IMM;\n+\t\telse {\n+\t\t\talginfo_a.key = (size_t)caam_jr_mem_vtop(\n+\t\t\t\t\t\t(void *)(size_t)alginfo_a.key);\n+\t\t\talginfo_a.key_type = RTA_DATA_PTR;\n+\t\t}\n+\t\tcdb->sh_desc[0] = 0;\n+\t\tcdb->sh_desc[1] = 0;\n+\t\tcdb->sh_desc[2] = 0;\n+\t\t\t/* Auth_only_len is set as 0 here and it will be\n+\t\t\t * overwritten in fd for each packet.\n+\t\t\t */\n+\t\t\tshared_desc_len = cnstr_shdsc_authenc(cdb->sh_desc,\n+\t\t\t\t\ttrue, swap, &alginfo_c, &alginfo_a,\n+\t\t\t\t\tses->iv.length, 0,\n+\t\t\t\t\tses->digest_length, ses->dir);\n+\t}\n+\n+\tif (shared_desc_len < 0) {\n+\t\tCAAM_JR_ERR(\"error in preparing command block\");\n+\t\treturn shared_desc_len;\n+\t}\n+\n+#if CAAM_JR_DBG\n+\tSEC_DUMP_DESC(cdb->sh_desc);\n+#endif\n+\n+\tcdb->sh_hdr.hi.field.idlen = shared_desc_len;\n+\n+\treturn 0;\n+}\n+\n /* @brief Poll the HW for already processed jobs in the JR\n  * and silently discard the available jobs or notify them to UA\n  * with indicated error code.\n@@ -100,6 +438,539 @@ hw_flush_job_ring(struct sec_job_ring_t *job_ring,\n \t}\n }\n \n+/* @brief Poll the HW for already processed jobs in the JR\n+ * and notify the available jobs to UA.\n+ *\n+ * @param [in]  job_ring\tThe job ring to poll.\n+ * @param [in]  limit           The maximum number of jobs to notify.\n+ *                              If set to negative value, all available jobs are\n+ *\t\t\t\tnotified.\n+ *\n+ * @retval >=0 for No of jobs notified to UA.\n+ * @retval -1 for error\n+ */\n+static int\n+hw_poll_job_ring(struct sec_job_ring_t *job_ring,\n+\t\t struct rte_crypto_op **ops, int32_t limit,\n+\t\t struct caam_jr_qp *jr_qp)\n+{\n+\tint32_t jobs_no_to_notify = 0; /* the number of done jobs to notify*/\n+\tint32_t number_of_jobs_available = 0;\n+\tint32_t notified_descs_no = 0;\n+\tuint32_t sec_error_code = 0;\n+\tstruct job_descriptor *current_desc;\n+\tphys_addr_t current_desc_addr;\n+\tphys_addr_t *temp_addr;\n+\tstruct caam_jr_op_ctx *ctx;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\t/* TODO check for ops have memory*/\n+\t/* check here if any JR error that cannot be written\n+\t * in the output status word has occurred\n+\t */\n+\tif (JR_REG_JRINT_JRE_EXTRACT(GET_JR_REG(JRINT, job_ring))) {\n+\t\tCAAM_JR_INFO(\"err received\");\n+\t\tsec_error_code = JR_REG_JRINT_ERR_TYPE_EXTRACT(\n+\t\t\t\t\tGET_JR_REG(JRINT, job_ring));\n+\t\tif (unlikely(sec_error_code)) {\n+\t\t\thw_job_ring_error_print(job_ring, sec_error_code);\n+\t\t\treturn -1;\n+\t\t}\n+\t}\n+\t/* compute the number of jobs available in the job ring based on the\n+\t * producer and consumer index values.\n+\t */\n+\tnumber_of_jobs_available = hw_get_no_finished_jobs(job_ring);\n+\t/* Compute the number of notifications that need to be raised to UA\n+\t * If limit > total number of done jobs -> notify all done jobs\n+\t * If limit = 0 -> error\n+\t * If limit < total number of done jobs -> notify a number\n+\t * of done jobs equal with limit\n+\t */\n+\tjobs_no_to_notify = (limit > number_of_jobs_available) ?\n+\t\t\t\tnumber_of_jobs_available : limit;\n+\tCAAM_JR_DP_DEBUG(\n+\t\t\"Jr[%p] pi[%d] ci[%d].limit =%d Available=%d.Jobs to notify=%d\",\n+\t\tjob_ring, job_ring->pidx, job_ring->cidx,\n+\t\tlimit, number_of_jobs_available, jobs_no_to_notify);\n+\n+\trte_smp_rmb();\n+\n+\twhile (jobs_no_to_notify > notified_descs_no) {\n+\t\tstatic uint64_t false_alarm;\n+\t\tstatic uint64_t real_poll;\n+\n+\t\t/* Get job status here */\n+\t\tsec_error_code = job_ring->output_ring[job_ring->cidx].status;\n+\t\t/* Get completed descriptor */\n+\t\ttemp_addr = &(job_ring->output_ring[job_ring->cidx].desc);\n+\t\tcurrent_desc_addr = (phys_addr_t)sec_read_addr(temp_addr);\n+\n+\t\treal_poll++;\n+\t\t/* todo check if it is false alarm no desc present */\n+\t\tif (!current_desc_addr) {\n+\t\t\tfalse_alarm++;\n+\t\t\tprintf(\"false alarm %\" PRIu64 \"real %\" PRIu64\n+\t\t\t\t\" sec_err =0x%x cidx Index =0%d\\n\",\n+\t\t\t\tfalse_alarm, real_poll,\n+\t\t\t\tsec_error_code, job_ring->cidx);\n+\t\t\trte_panic(\"CAAM JR descriptor NULL\");\n+\t\t\treturn notified_descs_no;\n+\t\t}\n+\t\tcurrent_desc = (struct job_descriptor *)\n+\t\t\t\tcaam_jr_dma_ptov(current_desc_addr);\n+\t\t/* now increment the consumer index for the current job ring,\n+\t\t * AFTER saving job in temporary location!\n+\t\t */\n+\t\tjob_ring->cidx = SEC_CIRCULAR_COUNTER(job_ring->cidx,\n+\t\t\t\t SEC_JOB_RING_SIZE);\n+\t\t/* Signal that the job has been processed and the slot is free*/\n+\t\thw_remove_entries(job_ring, 1);\n+\t\t/*TODO for multiple ops, packets*/\n+\t\tctx = container_of(current_desc, struct caam_jr_op_ctx, jobdes);\n+\t\tif (unlikely(sec_error_code)) {\n+\t\t\tCAAM_JR_ERR(\"desc at cidx %d generated error 0x%x\\n\",\n+\t\t\t\tjob_ring->cidx, sec_error_code);\n+\t\t\thw_handle_job_ring_error(job_ring, sec_error_code);\n+\t\t\t//todo improve with exact errors\n+\t\t\tctx->op->status = RTE_CRYPTO_OP_STATUS_ERROR;\n+\t\t\tjr_qp->rx_errs++;\n+\t\t} else {\n+\t\t\tctx->op->status = RTE_CRYPTO_OP_STATUS_SUCCESS;\n+#if CAAM_JR_DBG\n+\t\t\tif (ctx->op->sym->m_dst) {\n+\t\t\t\trte_hexdump(stdout, \"PROCESSED\",\n+\t\t\t\trte_pktmbuf_mtod(ctx->op->sym->m_dst, void *),\n+\t\t\t\trte_pktmbuf_data_len(ctx->op->sym->m_dst));\n+\t\t\t} else {\n+\t\t\t\trte_hexdump(stdout, \"PROCESSED\",\n+\t\t\t\trte_pktmbuf_mtod(ctx->op->sym->m_src, void *),\n+\t\t\t\trte_pktmbuf_data_len(ctx->op->sym->m_src));\n+\t\t\t}\n+#endif\n+\t\t}\n+\t\t*ops = ctx->op;\n+\t\tcaam_jr_op_ending(ctx);\n+\t\tops++;\n+\t\tnotified_descs_no++;\n+\t}\n+\treturn notified_descs_no;\n+}\n+\n+static uint16_t\n+caam_jr_dequeue_burst(void *qp, struct rte_crypto_op **ops,\n+\t\t       uint16_t nb_ops)\n+{\n+\tstruct caam_jr_qp *jr_qp = (struct caam_jr_qp *)qp;\n+\tstruct sec_job_ring_t *ring = jr_qp->ring;\n+\tint num_rx;\n+\tint ret;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\tCAAM_JR_DP_DEBUG(\"Jr[%p]Polling. limit[%d]\", ring, nb_ops);\n+\n+\t/* Poll job ring\n+\t * If nb_ops < 0 -> poll JR until no more notifications are available.\n+\t * If nb_ops > 0 -> poll JR until limit is reached.\n+\t */\n+\n+\t/* Run hw poll job ring */\n+\tnum_rx = hw_poll_job_ring(ring, ops, nb_ops, jr_qp);\n+\tif (num_rx < 0) {\n+\t\tCAAM_JR_ERR(\"Error polling SEC engine (%d)\", num_rx);\n+\t\treturn 0;\n+\t}\n+\n+\tCAAM_JR_DP_DEBUG(\"Jr[%p].Jobs notified[%d]. \", ring, num_rx);\n+\n+\tif (ring->jr_mode == SEC_NOTIFICATION_TYPE_NAPI) {\n+\t\tif (num_rx < nb_ops) {\n+\t\t\tret = caam_jr_enable_irqs(ring->irq_fd);\n+\t\t\tSEC_ASSERT(ret == 0, ret,\n+\t\t\t\"Failed to enable irqs for job ring %p\", ring);\n+\t\t}\n+\t} else if (ring->jr_mode == SEC_NOTIFICATION_TYPE_IRQ) {\n+\n+\t\t/* Always enable IRQ generation when in pure IRQ mode */\n+\t\tret = caam_jr_enable_irqs(ring->irq_fd);\n+\t\tSEC_ASSERT(ret == 0, ret,\n+\t\t\t\"Failed to enable irqs for job ring %p\", ring);\n+\t}\n+\n+\tjr_qp->rx_pkts += num_rx;\n+\n+\treturn num_rx;\n+}\n+\n+static inline struct caam_jr_op_ctx *\n+build_auth_only(struct rte_crypto_op *op, struct caam_jr_session *ses)\n+{\n+\tstruct rte_crypto_sym_op *sym = op->sym;\n+\tstruct caam_jr_op_ctx *ctx;\n+\tstruct sec4_sg_entry *sg;\n+\trte_iova_t start_addr;\n+\tstruct sec_cdb *cdb;\n+\tuint64_t sdesc_offset;\n+\tstruct sec_job_descriptor_t *jobdescr;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\tctx = caam_jr_alloc_ctx(ses);\n+\tif (!ctx)\n+\t\treturn NULL;\n+\n+\tctx->op = op;\n+\n+\tcdb = ses->cdb;\n+\tsdesc_offset = (size_t) ((char *)&cdb->sh_desc - (char *)cdb);\n+\n+\tstart_addr = rte_pktmbuf_iova(sym->m_src);\n+\n+\tjobdescr = (struct sec_job_descriptor_t *) ctx->jobdes.desc;\n+\n+\tSEC_JD_INIT(jobdescr);\n+\tSEC_JD_SET_SD(jobdescr,\n+\t\t(phys_addr_t)(caam_jr_dma_vtop(cdb)) + sdesc_offset,\n+\t\tcdb->sh_hdr.hi.field.idlen);\n+\n+\t/* output */\n+\tSEC_JD_SET_OUT_PTR(jobdescr, (uint64_t)sym->auth.digest.phys_addr,\n+\t\t\t0, ses->digest_length);\n+\n+\t/*input */\n+\tif (is_decode(ses)) {\n+\t\tsg = &ctx->sg[0];\n+\t\tSEC_JD_SET_IN_PTR(jobdescr,\n+\t\t\t(uint64_t)caam_jr_vtop_ctx(ctx, sg), 0,\n+\t\t\t(sym->auth.data.length + ses->digest_length));\n+\t\t/* enabling sg list */\n+\t\t(jobdescr)->seq_in.command.word  |= 0x01000000;\n+\n+\t\t/* hash result or digest, save digest first */\n+\t\trte_memcpy(ctx->digest, sym->auth.digest.data,\n+\t\t\t   ses->digest_length);\n+\t\tsg->ptr = cpu_to_caam64(start_addr + sym->auth.data.offset);\n+\t\tsg->len = cpu_to_caam32(sym->auth.data.length);\n+\n+#if CAAM_JR_DBG\n+\t\trte_hexdump(stdout, \"ICV\", ctx->digest, ses->digest_length);\n+#endif\n+\t\t/* let's check digest by hw */\n+\t\tsg++;\n+\t\tsg->ptr = cpu_to_caam64(caam_jr_vtop_ctx(ctx, ctx->digest));\n+\t\tsg->len = cpu_to_caam32(ses->digest_length);\n+\t\t/* last element*/\n+\t\tsg->len |= cpu_to_caam32(SEC4_SG_LEN_FIN);\n+\t} else {\n+\t\tSEC_JD_SET_IN_PTR(jobdescr, (uint64_t)start_addr,\n+\t\t\tsym->auth.data.offset, sym->auth.data.length);\n+\t}\n+\treturn ctx;\n+}\n+\n+static inline struct caam_jr_op_ctx *\n+build_cipher_only(struct rte_crypto_op *op, struct caam_jr_session *ses)\n+{\n+\tstruct rte_crypto_sym_op *sym = op->sym;\n+\tstruct caam_jr_op_ctx *ctx;\n+\tstruct sec4_sg_entry *sg;\n+\trte_iova_t src_start_addr, dst_start_addr;\n+\tstruct sec_cdb *cdb;\n+\tuint64_t sdesc_offset;\n+\tuint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,\n+\t\t\tses->iv.offset);\n+\tstruct sec_job_descriptor_t *jobdescr;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\tctx = caam_jr_alloc_ctx(ses);\n+\tif (!ctx)\n+\t\treturn NULL;\n+\n+\tctx->op = op;\n+\tcdb = ses->cdb;\n+\tsdesc_offset = (size_t) ((char *)&cdb->sh_desc - (char *)cdb);\n+\n+\tsrc_start_addr = rte_pktmbuf_iova(sym->m_src);\n+\tif (sym->m_dst)\n+\t\tdst_start_addr = rte_pktmbuf_iova(sym->m_dst);\n+\telse\n+\t\tdst_start_addr = src_start_addr;\n+\n+\tjobdescr = (struct sec_job_descriptor_t *) ctx->jobdes.desc;\n+\n+\tSEC_JD_INIT(jobdescr);\n+\tSEC_JD_SET_SD(jobdescr,\n+\t\t(phys_addr_t)(caam_jr_dma_vtop(cdb)) + sdesc_offset,\n+\t\tcdb->sh_hdr.hi.field.idlen);\n+\n+#if CAAM_JR_DBG\n+\tCAAM_JR_INFO(\"mbuf offset =%d, cipher offset = %d, length =%d+%d\",\n+\t\t\tsym->m_src->data_off, sym->cipher.data.offset,\n+\t\t\tsym->cipher.data.length, ses->iv.length);\n+#endif\n+\t/* output */\n+\tSEC_JD_SET_OUT_PTR(jobdescr, (uint64_t)dst_start_addr,\n+\t\t\tsym->cipher.data.offset,\n+\t\t\tsym->cipher.data.length + ses->iv.length);\n+\n+\t/*input */\n+\tsg = &ctx->sg[0];\n+\tSEC_JD_SET_IN_PTR(jobdescr, (uint64_t)caam_jr_vtop_ctx(ctx, sg), 0,\n+\t\t\t\tsym->cipher.data.length + ses->iv.length);\n+\t/*enabling sg bit */\n+\t(jobdescr)->seq_in.command.word  |= 0x01000000;\n+\n+\tsg->ptr = cpu_to_caam64(caam_jr_dma_vtop(IV_ptr));\n+\tsg->len = cpu_to_caam32(ses->iv.length);\n+\n+\tsg = &ctx->sg[1];\n+\tsg->ptr = cpu_to_caam64(src_start_addr + sym->cipher.data.offset);\n+\tsg->len = cpu_to_caam32(sym->cipher.data.length);\n+\t/* last element*/\n+\tsg->len |= cpu_to_caam32(SEC4_SG_LEN_FIN);\n+\n+\treturn ctx;\n+}\n+\n+static inline struct caam_jr_op_ctx *\n+build_cipher_auth(struct rte_crypto_op *op, struct caam_jr_session *ses)\n+{\n+\tstruct rte_crypto_sym_op *sym = op->sym;\n+\tstruct caam_jr_op_ctx *ctx;\n+\tstruct sec4_sg_entry *sg;\n+\trte_iova_t src_start_addr, dst_start_addr;\n+\tuint32_t length = 0;\n+\tstruct sec_cdb *cdb;\n+\tuint64_t sdesc_offset;\n+\tuint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *,\n+\t\t\tses->iv.offset);\n+\tstruct sec_job_descriptor_t *jobdescr;\n+\tuint32_t auth_only_len;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\tauth_only_len = op->sym->auth.data.length -\n+\t\t\t\top->sym->cipher.data.length;\n+\n+\tsrc_start_addr = rte_pktmbuf_iova(sym->m_src);\n+\tif (sym->m_dst)\n+\t\tdst_start_addr = rte_pktmbuf_iova(sym->m_dst);\n+\telse\n+\t\tdst_start_addr = src_start_addr;\n+\n+\tctx = caam_jr_alloc_ctx(ses);\n+\tif (!ctx)\n+\t\treturn NULL;\n+\n+\tctx->op = op;\n+\tcdb = ses->cdb;\n+\tsdesc_offset = (size_t) ((char *)&cdb->sh_desc - (char *)cdb);\n+\n+\tjobdescr = (struct sec_job_descriptor_t *) ctx->jobdes.desc;\n+\n+\tSEC_JD_INIT(jobdescr);\n+\tSEC_JD_SET_SD(jobdescr,\n+\t\t(phys_addr_t)(caam_jr_dma_vtop(cdb)) + sdesc_offset,\n+\t\tcdb->sh_hdr.hi.field.idlen);\n+\n+\t/* input */\n+\tsg = &ctx->sg[0];\n+\tif (is_encode(ses)) {\n+\t\tsg->ptr = cpu_to_caam64(caam_jr_dma_vtop(IV_ptr));\n+\t\tsg->len = cpu_to_caam32(ses->iv.length);\n+\t\tlength += ses->iv.length;\n+\n+\t\tsg++;\n+\t\tsg->ptr = cpu_to_caam64(src_start_addr + sym->auth.data.offset);\n+\t\tsg->len = cpu_to_caam32(sym->auth.data.length);\n+\t\tlength += sym->auth.data.length;\n+\t\t/* last element*/\n+\t\tsg->len |= cpu_to_caam32(SEC4_SG_LEN_FIN);\n+\t} else {\n+\t\tsg->ptr = cpu_to_caam64(caam_jr_dma_vtop(IV_ptr));\n+\t\tsg->len = cpu_to_caam32(ses->iv.length);\n+\t\tlength += ses->iv.length;\n+\n+\t\tsg++;\n+\t\tsg->ptr = cpu_to_caam64(src_start_addr + sym->auth.data.offset);\n+\t\tsg->len = cpu_to_caam32(sym->auth.data.length);\n+\t\tlength += sym->auth.data.length;\n+\n+\t\trte_memcpy(ctx->digest, sym->auth.digest.data,\n+\t\t       ses->digest_length);\n+\t\tsg++;\n+\t\tsg->ptr = cpu_to_caam64(caam_jr_dma_vtop(ctx->digest));\n+\t\tsg->len = cpu_to_caam32(ses->digest_length);\n+\t\tlength += ses->digest_length;\n+\t\t/* last element*/\n+\t\tsg->len |= cpu_to_caam32(SEC4_SG_LEN_FIN);\n+\t}\n+\n+\tSEC_JD_SET_IN_PTR(jobdescr, (uint64_t)caam_jr_dma_vtop(&ctx->sg[0]), 0,\n+\t\t\t\tlength);\n+\t/* set sg bit */\n+\t(jobdescr)->seq_in.command.word  |= 0x01000000;\n+\n+\t/* output */\n+\tsg = &ctx->sg[6];\n+\n+\tsg->ptr = cpu_to_caam64(dst_start_addr + sym->cipher.data.offset);\n+\tsg->len = cpu_to_caam32(sym->cipher.data.length);\n+\tlength = sym->cipher.data.length;\n+\n+\tif (is_encode(ses)) {\n+\t\t/* set auth output */\n+\t\tsg++;\n+\t\tsg->ptr = cpu_to_caam64(sym->auth.digest.phys_addr);\n+\t\tsg->len = cpu_to_caam32(ses->digest_length);\n+\t\tlength += ses->digest_length;\n+\t}\n+\t/* last element*/\n+\tsg->len |= cpu_to_caam32(SEC4_SG_LEN_FIN);\n+\n+\tSEC_JD_SET_OUT_PTR(jobdescr,\n+\t\t\t   (uint64_t)caam_jr_dma_vtop(&ctx->sg[6]), 0, length);\n+\t/* set sg bit */\n+\t(jobdescr)->seq_out.command.word  |= 0x01000000;\n+\n+\t/* Auth_only_len is set as 0 in descriptor and it is\n+\t * overwritten here in the jd which will update\n+\t * the DPOVRD reg.\n+\t */\n+\tif (auth_only_len)\n+\t\t/* set sg bit */\n+\t\t(jobdescr)->dpovrd = 0x80000000 | auth_only_len;\n+\n+\treturn ctx;\n+}\n+static int\n+caam_jr_enqueue_op(struct rte_crypto_op *op, struct caam_jr_qp *qp)\n+{\n+\tstruct sec_job_ring_t *ring = qp->ring;\n+\tstruct caam_jr_session *ses;\n+\tstruct caam_jr_op_ctx *ctx = NULL;\n+\tstruct sec_job_descriptor_t *jobdescr __rte_unused;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\tswitch (op->sess_type) {\n+\tcase RTE_CRYPTO_OP_WITH_SESSION:\n+\t\tses = (struct caam_jr_session *)\n+\t\tget_sym_session_private_data(op->sym->session,\n+\t\t\t\t\tcryptodev_driver_id);\n+\t\tbreak;\n+\tdefault:\n+\t\tCAAM_JR_DP_ERR(\"sessionless crypto op not supported\");\n+\t\tqp->tx_errs++;\n+\t\treturn -1;\n+\t}\n+\n+\tif (unlikely(!ses->qp || ses->qp != qp)) {\n+\t\tCAAM_JR_DP_DEBUG(\"Old:sess->qp=%p New qp = %p\\n\", ses->qp, qp);\n+\t\tses->qp = qp;\n+\t\tcaam_jr_prep_cdb(ses);\n+\t}\n+\n+\tif (rte_pktmbuf_is_contiguous(op->sym->m_src)) {\n+\t\tif (is_auth_cipher(ses))\n+\t\t\tctx = build_cipher_auth(op, ses);\n+\t\telse if (is_aead(ses))\n+\t\t\tgoto err1;\n+\t\telse if (is_auth_only(ses))\n+\t\t\tctx = build_auth_only(op, ses);\n+\t\telse if (is_cipher_only(ses))\n+\t\t\tctx = build_cipher_only(op, ses);\n+\t} else {\n+\t\tif (is_aead(ses))\n+\t\t\tgoto err1;\n+\t}\n+err1:\n+\tif (unlikely(!ctx)) {\n+\t\tqp->tx_errs++;\n+\t\tCAAM_JR_ERR(\"not supported sec op\");\n+\t\treturn -1;\n+\t}\n+#if CAAM_JR_DBG\n+\tif (is_decode(ses))\n+\t\trte_hexdump(stdout, \"DECODE\",\n+\t\t\trte_pktmbuf_mtod(op->sym->m_src, void *),\n+\t\t\trte_pktmbuf_data_len(op->sym->m_src));\n+\telse\n+\t\trte_hexdump(stdout, \"ENCODE\",\n+\t\t\trte_pktmbuf_mtod(op->sym->m_src, void *),\n+\t\t\trte_pktmbuf_data_len(op->sym->m_src));\n+\n+\tprintf(\"\\n JD before conversion\\n\");\n+\tfor (int i = 0; i < 12; i++)\n+\t\tprintf(\"\\n 0x%08x\", ctx->jobdes.desc[i]);\n+#endif\n+\n+\tCAAM_JR_DP_DEBUG(\"Jr[%p] pi[%d] ci[%d].Before sending desc\",\n+\t\t      ring, ring->pidx, ring->cidx);\n+\n+\t/* todo - do we want to retry */\n+\tif (SEC_JOB_RING_IS_FULL(ring->pidx, ring->cidx,\n+\t\t\t SEC_JOB_RING_SIZE, SEC_JOB_RING_SIZE)) {\n+\t\tCAAM_JR_DP_DEBUG(\"Ring FULL Jr[%p] pi[%d] ci[%d].Size = %d\",\n+\t\t\t      ring, ring->pidx, ring->cidx, SEC_JOB_RING_SIZE);\n+\t\tcaam_jr_op_ending(ctx);\n+\t\tqp->tx_ring_full++;\n+\t\treturn -EBUSY;\n+\t}\n+\n+#if CORE_BYTE_ORDER != CAAM_BYTE_ORDER\n+\tjobdescr = (struct sec_job_descriptor_t *) ctx->jobdes.desc;\n+\n+\tjobdescr->deschdr.command.word =\n+\t\tcpu_to_caam32(jobdescr->deschdr.command.word);\n+\tjobdescr->sd_ptr = cpu_to_caam64(jobdescr->sd_ptr);\n+\tjobdescr->seq_out.command.word =\n+\t\tcpu_to_caam32(jobdescr->seq_out.command.word);\n+\tjobdescr->seq_out_ptr = cpu_to_caam64(jobdescr->seq_out_ptr);\n+\tjobdescr->out_ext_length = cpu_to_caam32(jobdescr->out_ext_length);\n+\tjobdescr->seq_in.command.word =\n+\t\tcpu_to_caam32(jobdescr->seq_in.command.word);\n+\tjobdescr->seq_in_ptr = cpu_to_caam64(jobdescr->seq_in_ptr);\n+\tjobdescr->in_ext_length = cpu_to_caam32(jobdescr->in_ext_length);\n+\tjobdescr->load_dpovrd.command.word =\n+\t\tcpu_to_caam32(jobdescr->load_dpovrd.command.word);\n+\tjobdescr->dpovrd = cpu_to_caam32(jobdescr->dpovrd);\n+#endif\n+\n+\t/* Set ptr in input ring to current descriptor\t*/\n+\tsec_write_addr(&ring->input_ring[ring->pidx],\n+\t\t\t(phys_addr_t)caam_jr_vtop_ctx(ctx, ctx->jobdes.desc));\n+\trte_smp_wmb();\n+\n+\t/* Notify HW that a new job is enqueued */\n+\thw_enqueue_desc_on_job_ring(ring);\n+\n+\t/* increment the producer index for the current job ring */\n+\tring->pidx = SEC_CIRCULAR_COUNTER(ring->pidx, SEC_JOB_RING_SIZE);\n+\n+\treturn 0;\n+}\n+\n+static uint16_t\n+caam_jr_enqueue_burst(void *qp, struct rte_crypto_op **ops,\n+\t\t       uint16_t nb_ops)\n+{\n+\t/* Function to transmit the frames to given device and queuepair */\n+\tuint32_t loop;\n+\tint32_t ret;\n+\tstruct caam_jr_qp *jr_qp = (struct caam_jr_qp *)qp;\n+\tuint16_t num_tx = 0;\n+\n+\tPMD_INIT_FUNC_TRACE();\n+\t/*Prepare each packet which is to be sent*/\n+\tfor (loop = 0; loop < nb_ops; loop++) {\n+\t\tret = caam_jr_enqueue_op(ops[loop], jr_qp);\n+\t\tif (!ret)\n+\t\t\tnum_tx++;\n+\t}\n+\n+\tjr_qp->tx_pkts += num_tx;\n+\n+\treturn num_tx;\n+}\n+\n /* Release queue pair */\n static int\n caam_jr_queue_pair_release(struct rte_cryptodev *dev,\n@@ -726,8 +1597,8 @@ caam_jr_dev_init(const char *name,\n \tdev->dev_ops = &caam_jr_ops;\n \n \t/* register rx/tx burst functions for data path */\n-\tdev->dequeue_burst = NULL;\n-\tdev->enqueue_burst = NULL;\n+\tdev->dequeue_burst = caam_jr_dequeue_burst;\n+\tdev->enqueue_burst = caam_jr_enqueue_burst;\n \tdev->feature_flags = RTE_CRYPTODEV_FF_SYMMETRIC_CRYPTO |\n \t\t\tRTE_CRYPTODEV_FF_HW_ACCELERATED |\n \t\t\tRTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING |\ndiff --git a/drivers/crypto/caam_jr/caam_jr_desc.h b/drivers/crypto/caam_jr/caam_jr_desc.h\nnew file mode 100644\nindex 000000000..6683ea835\n--- /dev/null\n+++ b/drivers/crypto/caam_jr/caam_jr_desc.h\n@@ -0,0 +1,285 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright 2017-2018 NXP\n+ */\n+\n+#ifndef CAAM_JR_DESC_H\n+#define CAAM_JR_DESC_H\n+\n+#define CMD_HDR_CTYPE_SD\t\t0x16\n+#define CMD_HDR_CTYPE_JD\t\t0x17\n+\n+/* The maximum size of a SEC descriptor, in WORDs (32 bits). */\n+#define MAX_DESC_SIZE_WORDS                     64\n+\n+/*\n+ * Macros manipulating descriptors\n+ */\n+/* Macro for setting the SD pointer in a JD. Common for all protocols\n+ * supported by the SEC driver.\n+ */\n+#define SEC_JD_SET_SD(descriptor, ptr, len)\t   {\t  \\\n+\t(descriptor)->sd_ptr = (ptr);\t\t\t       \\\n+\t(descriptor)->deschdr.command.jd.shr_desc_len = (len);      \\\n+}\n+\n+/* Macro for setting a pointer to the job which this descriptor processes.\n+ * It eases the lookup procedure for identifying the descriptor that has\n+ * completed.\n+ */\n+#define SEC_JD_SET_JOB_PTR(descriptor, ptr) \\\n+\t((descriptor)->job_ptr = (ptr))\n+\n+/* Macro for setting up a JD. The structure of the JD is common across all\n+ * supported protocols, thus its structure is identical.\n+ */\n+#define SEC_JD_INIT(descriptor)\t      ({ \\\n+\t/* CTYPE = job descriptor\t\t\t       \\\n+\t * RSMS, DNR = 0\n+\t * ONE = 1\n+\t * Start Index = 0\n+\t * ZRO,TD, MTD = 0\n+\t * SHR = 1 (there's a shared descriptor referenced\n+\t *\t  by this job descriptor,pointer in next word)\n+\t * REO = 1 (execute job descr. first, shared descriptor\n+\t *\t  after)\n+\t * SHARE = DEFER\n+\t * Descriptor Length = 0 ( to be completed @ runtime ) */ \\\n+\t(descriptor)->deschdr.command.word = 0xB0801C0D;\t\\\n+\t/*\n+\t * CTYPE = SEQ OUT command * Scater Gather Flag = 0\n+\t * (can be updated @ runtime) PRE = 0 * EXT = 1\n+\t * (data length is in next word, following the * command)\n+\t * RTO = 0 */\t\t\t\t\t\t\\\n+\t(descriptor)->seq_out.command.word = 0xF8400000; /**/\t\\\n+\t/*\n+\t * CTYPE = SEQ IN command\n+\t * Scater Gather Flag = 0 (can be updated @ runtime)\n+\t * PRE = 0\n+\t * EXT = 1 ( data length is in next word, following the\n+\t *\t   command)\n+\t * RTO = 0 */\t\t\t\t\t\t\\\n+\t(descriptor)->seq_in.command.word  = 0xF0400000; /**/\t\\\n+\t/*\n+\t * In order to be compatible with QI scenarios, the DPOVRD value\n+\t * loaded must be formated like this:\n+\t * DPOVRD_EN (1b) | Res| DPOVRD Value (right aligned). */ \\\n+\t(descriptor)->load_dpovrd.command.word = 0x16870004;\t\\\n+\t/* By default, DPOVRD mechanism is disabled, thus the value to be\n+\t * LOAD-ed through the above descriptor command will be\n+\t * 0x0000_0000. */\t\t\t\t\t\\\n+\t(descriptor)->dpovrd = 0x00000000;\t\t\t\\\n+})\n+\n+/* Macro for setting the pointer to the input buffer in the JD, according to\n+ * the parameters set by the user in the ::sec_packet_t structure.\n+ */\n+#define SEC_JD_SET_IN_PTR(descriptor, phys_addr, offset, length) {     \\\n+\t(descriptor)->seq_in_ptr = (phys_addr) + (offset);\t      \\\n+\t(descriptor)->in_ext_length = (length);\t\t\t \\\n+}\n+\n+/* Macro for setting the pointer to the output buffer in the JD, according to\n+ * the parameters set by the user in the ::sec_packet_t structure.\n+ */\n+#define SEC_JD_SET_OUT_PTR(descriptor, phys_addr, offset, length) {    \\\n+\t(descriptor)->seq_out_ptr = (phys_addr) + (offset);\t     \\\n+\t(descriptor)->out_ext_length = (length);\t\t\t\\\n+}\n+\n+/* Macro for setting the Scatter-Gather flag in the SEQ IN command. Used in\n+ * case the input buffer is split in multiple buffers, according to the user\n+ * specification.\n+ */\n+#define SEC_JD_SET_SG_IN(descriptor) \\\n+\t((descriptor)->seq_in.command.field.sgf =  1)\n+\n+/* Macro for setting the Scatter-Gather flag in the SEQ OUT command. Used in\n+ * case the output buffer is split in multiple buffers, according to the user\n+ * specification.\n+ */\n+#define SEC_JD_SET_SG_OUT(descriptor) \\\n+\t((descriptor)->seq_out.command.field.sgf = 1)\n+\n+#define SEC_JD_SET_DPOVRD(descriptor) \\\n+\n+/* Macro for retrieving a descriptor's length. Works for both SD and JD. */\n+#define SEC_GET_DESC_LEN(descriptor)\t\t\t\t\t\\\n+\t(((struct descriptor_header_s *)(descriptor))->command.sd.ctype == \\\n+\tCMD_HDR_CTYPE_SD ? ((struct descriptor_header_s *) \\\n+\t(descriptor))->command.sd.desclen :\t\\\n+\t((struct descriptor_header_s *)(descriptor))->command.jd.desclen)\n+\n+/* Helper macro for dumping the hex representation of a descriptor */\n+#define SEC_DUMP_DESC(descriptor) {\t\t\t\t\t\\\n+\tint __i;\t\t\t\t\t\t\t\\\n+\tCAAM_JR_INFO(\"Des@ 0x%08x\\n\", (uint32_t)((uint32_t *)(descriptor)));\\\n+\tfor (__i = 0;\t\t\t\t\t\t\\\n+\t\t__i < SEC_GET_DESC_LEN(descriptor);\t\t\t\\\n+\t\t__i++) {\t\t\t\t\t\t\\\n+\t\tprintf(\"0x%08x: 0x%08x\\n\",\t\t\t\\\n+\t\t\t(uint32_t)(((uint32_t *)(descriptor)) + __i),\t\\\n+\t\t\t*(((uint32_t *)(descriptor)) + __i));\t\t\\\n+\t}\t\t\t\t\t\t\t\t\\\n+}\n+/* Union describing a descriptor header.\n+ */\n+struct descriptor_header_s {\n+\tunion {\n+\t\tuint32_t word;\n+\t\tstruct {\n+\t\t\t/* 4  */ unsigned int ctype:5;\n+\t\t\t/* 5  */ unsigned int res1:2;\n+\t\t\t/* 7  */ unsigned int dnr:1;\n+\t\t\t/* 8  */ unsigned int one:1;\n+\t\t\t/* 9  */ unsigned int res2:1;\n+\t\t\t/* 10 */ unsigned int start_idx:6;\n+\t\t\t/* 16 */ unsigned int res3:2;\n+\t\t\t/* 18 */ unsigned int cif:1;\n+\t\t\t/* 19 */ unsigned int sc:1;\n+\t\t\t/* 20 */ unsigned int pd:1;\n+\t\t\t/* 21 */ unsigned int res4:1;\n+\t\t\t/* 22 */ unsigned int share:2;\n+\t\t\t/* 24 */ unsigned int res5:2;\n+\t\t\t/* 26 */ unsigned int desclen:6;\n+\t\t} sd;\n+\t\tstruct {\n+\t\t\t/* TODO only below struct members are corrected,\n+\t\t\t * all others also need to be reversed please verify it\n+\t\t\t */\n+\t\t\t/* 0 */ unsigned int desclen:7;\n+\t\t\t/* 7 */ unsigned int res4:1;\n+\t\t\t/* 8 */ unsigned int share:3;\n+\t\t\t/* 11 */ unsigned int reo:1;\n+\t\t\t/* 12 */ unsigned int shr:1;\n+\t\t\t/* 13 */ unsigned int mtd:1;\n+\t\t\t/* 14 */ unsigned int td:1;\n+\t\t\t/* 15 */ unsigned int zero:1;\n+\t\t\t/* 16 */ unsigned int shr_desc_len:6;\n+\t\t\t/* 22  */ unsigned int res2:1;\n+\t\t\t/* 23  */ unsigned int one:1;\n+\t\t\t/* 24  */ unsigned int dnr:1;\n+\t\t\t/* 25  */ unsigned int rsms:1;\n+\t\t\t/* 26  */ unsigned int res1:1;\n+\t\t\t/* 27  */ unsigned int ctype:5;\n+\t\t} jd;\n+\t} __rte_packed command;\n+} __rte_packed;\n+\n+/* Union describing a KEY command in a descriptor.\n+ */\n+struct key_command_s {\n+\tunion {\n+\t\tuint32_t word;\n+\t\tstruct {\n+\t\t\tunsigned int ctype:5;\n+\t\t\tunsigned int cls:2;\n+\t\t\tunsigned int sgf:1;\n+\t\t\tunsigned int imm:1;\n+\t\t\tunsigned int enc:1;\n+\t\t\tunsigned int nwb:1;\n+\t\t\tunsigned int ekt:1;\n+\t\t\tunsigned int kdest:4;\n+\t\t\tunsigned int tk:1;\n+\t\t\tunsigned int rsvd1:5;\n+\t\t\tunsigned int length:10;\n+\t\t} __rte_packed field;\n+\t} __rte_packed command;\n+} __rte_packed;\n+\n+/* Union describing a PROTOCOL command\n+ * in a descriptor.\n+ */\n+struct protocol_operation_command_s {\n+\tunion {\n+\t\tuint32_t word;\n+\t\tstruct {\n+\t\t\tunsigned int ctype:5;\n+\t\t\tunsigned int optype:3;\n+\t\t\tunsigned char protid;\n+\t\t\tunsigned short protinfo;\n+\t\t} __rte_packed field;\n+\t} __rte_packed command;\n+} __rte_packed;\n+\n+/* Union describing a SEQIN command in a\n+ * descriptor.\n+ */\n+struct seq_in_command_s {\n+\tunion {\n+\t\tuint32_t word;\n+\t\tstruct {\n+\t\t\tunsigned int ctype:5;\n+\t\t\tunsigned int res1:1;\n+\t\t\tunsigned int inl:1;\n+\t\t\tunsigned int sgf:1;\n+\t\t\tunsigned int pre:1;\n+\t\t\tunsigned int ext:1;\n+\t\t\tunsigned int rto:1;\n+\t\t\tunsigned int rjd:1;\n+\t\t\tunsigned int res2:4;\n+\t\t\tunsigned int length:16;\n+\t\t} field;\n+\t} __rte_packed command;\n+} __rte_packed;\n+\n+/* Union describing a SEQOUT command in a\n+ * descriptor.\n+ */\n+struct seq_out_command_s {\n+\tunion {\n+\t\tuint32_t word;\n+\t\tstruct {\n+\t\t\tunsigned int ctype:5;\n+\t\t\tunsigned int res1:2;\n+\t\t\tunsigned int sgf:1;\n+\t\t\tunsigned int pre:1;\n+\t\t\tunsigned int ext:1;\n+\t\t\tunsigned int rto:1;\n+\t\t\tunsigned int res2:5;\n+\t\t\tunsigned int length:16;\n+\t\t} field;\n+\t} __rte_packed command;\n+} __rte_packed;\n+\n+struct load_command_s {\n+\tunion {\n+\t\tuint32_t word;\n+\t\tstruct {\n+\t\t\tunsigned int ctype:5;\n+\t\t\tunsigned int class:2;\n+\t\t\tunsigned int sgf:1;\n+\t\t\tunsigned int imm:1;\n+\t\t\tunsigned int dst:7;\n+\t\t\tunsigned char offset;\n+\t\t\tunsigned char length;\n+\t\t} fields;\n+\t} __rte_packed command;\n+} __rte_packed;\n+\n+/* Structure encompassing a general shared descriptor of maximum\n+ * size (64 WORDs). Usually, other specific shared descriptor structures\n+ * will be type-casted to this one\n+ * this one.\n+ */\n+struct sec_sd_t {\n+\tuint32_t rsvd[MAX_DESC_SIZE_WORDS];\n+} __attribute__((packed, aligned(64)));\n+\n+/* Structure encompassing a job descriptor which processes\n+ * a single packet from a context. The job descriptor references\n+ * a shared descriptor from a SEC context.\n+ */\n+struct sec_job_descriptor_t {\n+\tstruct descriptor_header_s deschdr;\n+\tdma_addr_t sd_ptr;\n+\tstruct seq_out_command_s seq_out;\n+\tdma_addr_t seq_out_ptr;\n+\tuint32_t out_ext_length;\n+\tstruct seq_in_command_s seq_in;\n+\tdma_addr_t seq_in_ptr;\n+\tuint32_t in_ext_length;\n+\tstruct load_command_s load_dpovrd;\n+\tuint32_t dpovrd;\n+} __attribute__((packed, aligned(64)));\n+\n+#endif\n",
    "prefixes": [
        "v4",
        "10/15"
    ]
}