From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43EFAA034F; Tue, 28 Dec 2021 10:12:17 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A2A3141177; Tue, 28 Dec 2021 10:11:45 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00044.outbound.protection.outlook.com [40.107.0.44]) by mails.dpdk.org (Postfix) with ESMTP id C5DD541153 for ; Tue, 28 Dec 2021 10:11:41 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eMnQQS7GCkzE5ylcKfC7fnKz+mZm3yOKQW3mzOi56l3uNPonwGlwnAxE70muthwqb9/sJQcyyxJm8FoRLUMIEUhVDk6NQAWEQu+82GsRsBe0JkODeNYasfwJGsADisucuh6o/0qGYw7xWIFxneRkkc4NBxbXZ2YYVj3TqVoHFnpQanJ5Mb45X++tLb9PX47mWtBOFKpoLJYrPBEIIxSt5SYR5zi+OK3040pIClHOzU4cZB7KdU/rtoABd6LY3+rEqJJJKOdVxv016nYrCskyabGP7e5MNEcge6Ygm4IRg9FVGS2ZJguphNeVaLw+FbAW2IO9hPpnt7c2sHIB2FViag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=IU2NN7nMiPH5flCmhoJSxRo/EsTpbrFQ36SxG4Exj5E=; b=JROuRKsEB7IHpRI4goheK0A4RTn1YgcHFCfuhwrWaR37VBTwVdmUSL1omfFr/0gPjozk4pFfIwRUVe+eP7B57jg1NlI+THqO1mWerqTk++sxQHbt+6Tu874RsyDHLTN1B+uYMlxSNcjWkLLnPksxlD2YIqPMC6MKflQSYwEJIMTnmJ7uCCuh248o1zsl/07Den38n9EqiScsyhp+Aj8FU9UNHjRVkXROaaf2qiTnq1n/H7tGQaCpaK3+prczQtrpbX+AJSHS03XNr7e0eoUiNzi7bblZcH1gAyBwryD19sE6eIfhHO6nNZcvdjFE1MwX25QpKKLggXKYN58kbocBaQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=IU2NN7nMiPH5flCmhoJSxRo/EsTpbrFQ36SxG4Exj5E=; b=Glb+c5MmxsdhiWBWfc1hBzuONa5zAsR3UFCZrv1LMDAsqK23rPW2SyPpvq2F/reM6Z047azTDYtVx7ZOowwp6b4pm8lGLWTfOmRg+86ApjRn0HmYgaa8tGHiGEXSG1eyn9u6QoY0g8OHvf1Jzv+sAlYoIKSWZk88HSy4M4SN2Fk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AM6PR04MB6135.eurprd04.prod.outlook.com (2603:10a6:20b:bf::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.21; Tue, 28 Dec 2021 09:11:39 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::4c23:c171:682e:9085]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::4c23:c171:682e:9085%4]) with mapi id 15.20.4823.023; Tue, 28 Dec 2021 09:11:39 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh Subject: [PATCH v2 8/8] crypto/dpaa_sec: add debug framework Date: Tue, 28 Dec 2021 14:40:58 +0530 Message-Id: <20211228091058.3620177-9-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211228091058.3620177-1-g.singh@nxp.com> References: <20211220102710.3083370-1-g.singh@nxp.com> <20211228091058.3620177-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0118.apcprd06.prod.outlook.com (2603:1096:1:1d::20) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 109a1f65-57c4-4fe5-9519-08d9c9e20e17 X-MS-TrafficTypeDiagnostic: AM6PR04MB6135:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: OXziZKPxPuwFvCtdWnoz4aorhjGepeK0WTLv1TbVtuBSiTczfw6YcXFG+dIUxRWhpa2h7m20F0vjQLScn9r8xXrmQK/8fDnz/eiaRavvjqtJFXziQmEoR8uMn8YPm8R91+FCYmIuQsB6DlGPO0z5BQBDz1/lzfZCfEaBneEHJlNM7KJD20fzl32Js+KxpwnV8+Sd+5CtLLpEp9LEH3T42zlsz9WUNhkbpyrGgFmevVjUXbJTc0rzfL5NKdJrZoCKZRIieczuH801qqY80wScMcmNhLCtfbwrtPcao6UX43EhUwE2geUS7r4YP/CCuZeL/MQe8c0OBA1s5md9HqIydc4v2ATz4qL1ubk4q2dCbjrdq1KDUbdDMZDsJewk4M0U6gmuXvCl0LMnaDV7YWHHRNx8TM74mj2obkwOl6yF/ufG/MCMHk0icQtCv3dgyKsqrbHx33UgpR1LB4VS7jkSPfZPGYVpfxLC9fAhhtFnP1lRNFfg4t7yV5Er0u1Jie6qhSO3H5E2QcAWLSzT5PyC3zSgC4dRegsNTvMw3cfdLajHzfxAL7T6TNh2OOJ+vJ6WeB5voMZGS52KsLIxM6TJIEhVgGO2aAHvY99qptdZeg2FuDHRiEm7lujSvEm8JugcFaTBIMPcl0G/AqdgTEK+meY1Q4u63M1SyuiPo3UW9IlPs4QzG8foOLQ0Toe8O4enFV3Eq25EphAeZ3GRH8d+oQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(316002)(8676002)(2616005)(6486002)(4326008)(6506007)(30864003)(66556008)(66476007)(6512007)(6666004)(55236004)(38100700002)(38350700002)(36756003)(52116002)(83380400001)(2906002)(1076003)(66946007)(86362001)(26005)(5660300002)(8936002)(186003)(508600001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?kfUMfBOlegwIBgipGjlaZqU28q77qgHNWC3C4QUF/5BTA6lMJ+1j5sZmzz6L?= =?us-ascii?Q?935Sde68s++hw2zUZqRStLavHyzI64cRtcoZCohU+ardQPTrZfrV3Ihlzjc8?= =?us-ascii?Q?XLt8ospwdKaqOKqJUXBpray6NUj9T8ADMCEdIKDb9a/MSuibH+cNw9YKPqxi?= =?us-ascii?Q?fPbatOMUUhBWaJYZSq6p9QCZgkXADkWVBI+MP15VAPxJF6H5oktj0FRcytQh?= =?us-ascii?Q?6nmClubI/4i3r0mxFHGnw1+rzDw99T9he40IiYfzjj6hns9xkjgwe7preVrv?= =?us-ascii?Q?7B+6ve83YnDQQtUSXs1pxs7Fz9G1r9Zc8MLSvcW/12Fg6mtBWAHu4a6b316K?= =?us-ascii?Q?Rhgk7EX1rnKnRKPMDyqAaHOCQNvG8nCZXt3KKOZO4v9XUDnBj7KDQU18ZFvo?= =?us-ascii?Q?kvSWFnjZ3RS8i1Mg9rK/dgjg4cC8hpYGAIcuUc2si4Tj/jFzAXkVr3PX3REQ?= =?us-ascii?Q?tmlt015LKjiJbmDlToPXa6qGujrBo57xryvPekQBstDGr5sx7szElNEuJjx9?= =?us-ascii?Q?Okbkl1CXUtgUuyhJs4qtyI2/0H5xucsZ9Nn5AQX1mJHkMXJfD2/c6sZG2eL1?= =?us-ascii?Q?7hK+4vmXrn31GP+91ogsD9ICFO3JG9GMLE6vph+nU34FiqThCG6K9EE3ojGS?= =?us-ascii?Q?FTNVgrgUw6TOf2m5SLKN7vq3S31fSTI4UhZRuZf3A9iU+cZJt4uR+0XbqriY?= =?us-ascii?Q?zqwnYUgLUTGhgS3w4FPbOCIxayeOIhs/LVCviZRQpFIhyip85nIaDGM6TIpL?= =?us-ascii?Q?WpjMTCt7G2skkCs62qvJ9G1N+q4zjdiy3TL8rWx4BPYHQ97TXOyt7Bu82+Nr?= =?us-ascii?Q?qPd+y9oYegmdw6LKT4f5QAcKBfekT9jTbclYAzmW8BQcE3OpkaHnP5Vi21q5?= =?us-ascii?Q?lfxlcgaepUdRjDOrbB/8RpCBSyBncJDIE7/IETyJpVLchYqobRp2bbECsEZK?= =?us-ascii?Q?0hNYKzZDf7x2vPc6EWfKZy0bi4n/UuwXR/OvARQVVjJcIRFxmJX5N6Kisr6N?= =?us-ascii?Q?I0fUho2ZhrbqGuLg65+4cDXFai+RfhMRcMJQdomXmz+Rr3shvuva+9TElKgV?= =?us-ascii?Q?jEW1lztEx0CQQsRgHNPD3yNb8g/hkuTYQjZIjQnzKJsuhZ95stP+kakRZfyZ?= =?us-ascii?Q?2vyt6QIew9N3pGjgmCMjHK/PHZp1FKV7RcucwM3+ricpl5mQ7xrkhbdsKK1c?= =?us-ascii?Q?JC1G1YWI+HAnam1LkrWfFiIM3sIkSo7dO2dObZw++QJjmMNULw5paYH5B9Ac?= =?us-ascii?Q?ZVwP6yA0MHwcwHw5h0Dh8KA6H4eWbl0TBuf3bMnmnogdJ4038ph2GQYGVLPM?= =?us-ascii?Q?/f0g+DFZqgfOkwS0czv4ZbjTLdLjELd8UF4ZUDaMbgpy8770+WboA7CtxWBU?= =?us-ascii?Q?Wka3JbNDyMLWZZy2liyU/Wq2kE+vHrib4H3MhFBRP2wsNWmNp7PLLmuDsYnS?= =?us-ascii?Q?hiGLMPrYYdkGc8v32brr8Jz+FBwjIQ+nUuBSx/dGpQWRcGlz/KbKa/2C/VmW?= =?us-ascii?Q?/OSiLouBz50IyMLWixqqd5yI61ifvMJ+XKcffloxo3mFFr/DhrZdfmj+1SyB?= =?us-ascii?Q?WJ92cW3Hx8j052t5gwY=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 109a1f65-57c4-4fe5-9519-08d9c9e20e17 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2021 09:11:38.8835 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZHDYQ77GwzqQJSty4uL6QrJ/T7HRmmlBvphttUyzv9nl37/zgpx4fxdBsqlhsV0a X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6135 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Adding useful debug prints in DPAA driver for easy debugging. Signed-off-by: Gagandeep Singh --- doc/guides/cryptodevs/dpaa_sec.rst | 10 ++ drivers/bus/dpaa/dpaa_bus.c | 16 ++- drivers/crypto/dpaa_sec/dpaa_sec.c | 192 ++++++++++++++++++++++++++++- 3 files changed, 213 insertions(+), 5 deletions(-) diff --git a/doc/guides/cryptodevs/dpaa_sec.rst b/doc/guides/cryptodevs/dpaa_sec.rst index bac82421bc..0c8d6cf3da 100644 --- a/doc/guides/cryptodevs/dpaa_sec.rst +++ b/doc/guides/cryptodevs/dpaa_sec.rst @@ -123,3 +123,13 @@ For enabling logs, use the following EAL parameter: Using ``pmd.crypto.dpaa`` as log matching criteria, all Crypto PMD logs can be enabled which are lower than logging ``level``. + +Enabling debug prints +--------------------- + +Use dev arg option ``drv_dump_mode=x`` to dump useful debug prints on HW sec +error. There are 3 dump modes available 0, 1 and 2. Mode 0 means no dump print +on error, mode 1 means dump HW error code and mode 2 means dump HW error code +along with other useful debugging information like session, queue, descriptor +data. +e.g. ``dpaa_bus:dpaa_sec-1,drv_dump_mode=1`` diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index 737ac8d8c5..a1db25dce9 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -429,6 +429,7 @@ rte_dpaa_bus_parse(const char *name, void *out) { unsigned int i, j; size_t delta; + size_t max_name_len; /* There are two ways of passing device name, with and without * separator. "dpaa_bus:fm1-mac3" with separator, and "fm1-mac3" @@ -444,14 +445,21 @@ rte_dpaa_bus_parse(const char *name, void *out) delta = 5; } - if (sscanf(&name[delta], "fm%u-mac%u", &i, &j) != 2 || - i >= 2 || j >= 16) { - return -EINVAL; + if (strncmp("dpaa_sec", &name[delta], 8) == 0) { + if (sscanf(&name[delta], "dpaa_sec-%u", &i) != 1 || + i < 1 || i > 4) + return -EINVAL; + max_name_len = sizeof("dpaa_sec-.") - 1; + } else { + if (sscanf(&name[delta], "fm%u-mac%u", &i, &j) != 2 || + i >= 2 || j >= 16) + return -EINVAL; + + max_name_len = sizeof("fm.-mac..") - 1; } if (out != NULL) { char *out_name = out; - const size_t max_name_len = sizeof("fm.-mac..") - 1; /* Do not check for truncation, either name ends with * '\0' or the device name is followed by parameters and there diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index af166252ca..b436039117 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec.c +++ b/drivers/crypto/dpaa_sec/dpaa_sec.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,17 @@ #include #include +#define DRIVER_DUMP_MODE "drv_dump_mode" + +/* DPAA_SEC_DP_DUMP levels */ +enum dpaa_sec_dump_levels { + DPAA_SEC_DP_NO_DUMP, + DPAA_SEC_DP_ERR_DUMP, + DPAA_SEC_DP_FULL_DUMP +}; + +uint8_t dpaa_sec_dp_dump = DPAA_SEC_DP_ERR_DUMP; + uint8_t dpaa_cryptodev_driver_id; static inline void @@ -649,6 +661,139 @@ dpaa_sec_prep_cdb(dpaa_sec_session *ses) return 0; } +static void +dpaa_sec_dump(struct dpaa_sec_op_ctx *ctx, struct dpaa_sec_qp *qp) +{ + struct dpaa_sec_job *job = &ctx->job; + struct rte_crypto_op *op = ctx->op; + dpaa_sec_session *sess = NULL; + struct sec_cdb c_cdb, *cdb; + uint8_t bufsize; + struct rte_crypto_sym_op *sym_op; + struct qm_sg_entry sg[2]; + + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) + sess = (dpaa_sec_session *) + get_sym_session_private_data( + op->sym->session, + dpaa_cryptodev_driver_id); +#ifdef RTE_LIBRTE_SECURITY + else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) + sess = (dpaa_sec_session *) + get_sec_session_private_data( + op->sym->sec_session); +#endif + if (sess == NULL) { + printf("session is NULL\n"); + goto mbuf_dump; + } + + cdb = &sess->cdb; + rte_memcpy(&c_cdb, cdb, sizeof(struct sec_cdb)); +#ifdef RTE_LIBRTE_SECURITY + printf("\nsession protocol type = %d\n", sess->proto_alg); +#endif + printf("\n****************************************\n" + "session params:\n\tContext type:\t%d\n\tDirection:\t%s\n" + "\tCipher alg:\t%d\n\tAuth alg:\t%d\n\tAead alg:\t%d\n" + "\tCipher key len:\t%ld\n\tCipher alg:\t%d\n" + "\tCipher algmode:\t%d\n", sess->ctxt, + (sess->dir == DIR_ENC) ? "DIR_ENC" : "DIR_DEC", + sess->cipher_alg, sess->auth_alg, sess->aead_alg, + (long)sess->cipher_key.length, sess->cipher_key.alg, + sess->cipher_key.algmode); + rte_hexdump(stdout, "cipher key", sess->cipher_key.data, + sess->cipher_key.length); + rte_hexdump(stdout, "auth key", sess->auth_key.data, + sess->auth_key.length); + printf("\tAuth key len:\t%ld\n\tAuth alg:\t%d\n" + "\tAuth algmode:\t%d\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" + "\tdigest length:\t%d\n\tauth only len:\t\t%d\n" + "\taead cipher text:\t%d\n", + (long)sess->auth_key.length, sess->auth_key.alg, + sess->auth_key.algmode, + sess->iv.length, sess->iv.offset, + sess->digest_length, sess->auth_only_len, + sess->auth_cipher_text); +#ifdef RTE_LIBRTE_SECURITY + printf("PDCP session params:\n" + "\tDomain:\t\t%d\n\tBearer:\t\t%d\n\tpkt_dir:\t%d\n\thfn_ovd:" + "\t%d\n\tsn_size:\t%d\n\tsdap_enabled:\t%d\n\thfn_ovd_offset:" + "\t%d\n\thfn:\t\t%d\n" + "\thfn_threshold:\t0x%x\n", sess->pdcp.domain, + sess->pdcp.bearer, sess->pdcp.pkt_dir, sess->pdcp.hfn_ovd, + sess->pdcp.sn_size, sess->pdcp.sdap_enabled, + sess->pdcp.hfn_ovd_offset, sess->pdcp.hfn, + sess->pdcp.hfn_threshold); +#endif + c_cdb.sh_hdr.hi.word = rte_be_to_cpu_32(c_cdb.sh_hdr.hi.word); + c_cdb.sh_hdr.lo.word = rte_be_to_cpu_32(c_cdb.sh_hdr.lo.word); + bufsize = c_cdb.sh_hdr.hi.field.idlen; + + printf("cdb = %p\n\n", cdb); + printf("Descriptor size = %d\n", bufsize); + int m; + for (m = 0; m < bufsize; m++) + printf("0x%x\n", rte_be_to_cpu_32(c_cdb.sh_desc[m])); + + printf("\n"); +mbuf_dump: + sym_op = op->sym; + if (sym_op->m_src) { + printf("Source mbuf:\n"); + rte_pktmbuf_dump(stdout, sym_op->m_src, + sym_op->m_src->data_len); + } + if (sym_op->m_dst) { + printf("Destination mbuf:\n"); + rte_pktmbuf_dump(stdout, sym_op->m_dst, + sym_op->m_dst->data_len); + } + + printf("Session address = %p\ncipher offset: %d, length: %d\n" + "auth offset: %d, length: %d\n aead offset: %d, length: %d\n", + sym_op->session, sym_op->cipher.data.offset, + sym_op->cipher.data.length, + sym_op->auth.data.offset, sym_op->auth.data.length, + sym_op->aead.data.offset, sym_op->aead.data.length); + printf("\n"); + + printf("******************************************************\n"); + printf("ctx info:\n"); + printf("job->sg[0] output info:\n"); + memcpy(&sg[0], &job->sg[0], sizeof(sg[0])); + printf("\taddr = 0x%lx,\n\tlen = %d,\n\tfinal = %d,\n\textention = %d" + "\n\tbpid = %d\n\toffset = %d\n", + (unsigned long)sg[0].addr, sg[0].length, sg[0].final, + sg[0].extension, sg[0].bpid, sg[0].offset); + printf("\njob->sg[1] input info:\n"); + memcpy(&sg[1], &job->sg[1], sizeof(sg[1])); + hw_sg_to_cpu(&sg[1]); + printf("\taddr = 0x%lx,\n\tlen = %d,\n\tfinal = %d,\n\textention = %d" + "\n\tbpid = %d\n\toffset = %d\n", + (unsigned long)sg[1].addr, sg[1].length, sg[1].final, + sg[1].extension, sg[1].bpid, sg[1].offset); + + printf("\nctx pool addr = %p\n", ctx->ctx_pool); + if (ctx->ctx_pool) + printf("ctx pool available counts = %d\n", + rte_mempool_avail_count(ctx->ctx_pool)); + + printf("\nop pool addr = %p\n", op->mempool); + if (op->mempool) + printf("op pool available counts = %d\n", + rte_mempool_avail_count(op->mempool)); + + printf("********************************************************\n"); + printf("Queue data:\n"); + printf("\tFQID = 0x%x\n\tstate = %d\n\tnb_desc = %d\n" + "\tctx_pool = %p\n\trx_pkts = %d\n\ttx_pkts" + "= %d\n\trx_errs = %d\n\ttx_errs = %d\n\n", + qp->outq.fqid, qp->outq.state, qp->outq.nb_desc, + qp->ctx_pool, qp->rx_pkts, qp->tx_pkts, + qp->rx_errs, qp->tx_errs); +} + /* qp is lockless, should be accessed by only one thread */ static int dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops) @@ -716,7 +861,12 @@ dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops) if (!ctx->fd_status) { op->status = RTE_CRYPTO_OP_STATUS_SUCCESS; } else { - DPAA_SEC_DP_WARN("SEC return err:0x%x", ctx->fd_status); + if (dpaa_sec_dp_dump > DPAA_SEC_DP_NO_DUMP) { + DPAA_SEC_DP_WARN("SEC return err:0x%x\n", + ctx->fd_status); + if (dpaa_sec_dp_dump > DPAA_SEC_DP_ERR_DUMP) + dpaa_sec_dump(ctx, qp); + } op->status = RTE_CRYPTO_OP_STATUS_ERROR; } ops[pkts++] = op; @@ -3458,6 +3608,42 @@ dpaa_sec_uninit(struct rte_cryptodev *dev) return 0; } +static int +check_devargs_handler(__rte_unused const char *key, const char *value, + __rte_unused void *opaque) +{ + dpaa_sec_dp_dump = atoi(value); + if (dpaa_sec_dp_dump > DPAA_SEC_DP_FULL_DUMP) { + DPAA_SEC_WARN("WARN: DPAA_SEC_DP_DUMP_LEVEL is not " + "supported, changing to FULL error prints\n"); + dpaa_sec_dp_dump = DPAA_SEC_DP_FULL_DUMP; + } + + return 0; +} + +static void +dpaa_sec_get_devargs(struct rte_devargs *devargs, const char *key) +{ + struct rte_kvargs *kvlist; + + if (!devargs) + return; + + kvlist = rte_kvargs_parse(devargs->args, NULL); + if (!kvlist) + return; + + if (!rte_kvargs_count(kvlist, key)) { + rte_kvargs_free(kvlist); + return; + } + + rte_kvargs_process(kvlist, key, + check_devargs_handler, NULL); + rte_kvargs_free(kvlist); +} + static int dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) { @@ -3533,6 +3719,8 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) } } + dpaa_sec_get_devargs(cryptodev->device->devargs, DRIVER_DUMP_MODE); + RTE_LOG(INFO, PMD, "%s cryptodev init\n", cryptodev->data->name); return 0; @@ -3649,4 +3837,6 @@ static struct cryptodev_driver dpaa_sec_crypto_drv; RTE_PMD_REGISTER_DPAA(CRYPTODEV_NAME_DPAA_SEC_PMD, rte_dpaa_sec_driver); RTE_PMD_REGISTER_CRYPTO_DRIVER(dpaa_sec_crypto_drv, rte_dpaa_sec_driver.driver, dpaa_cryptodev_driver_id); +RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_DPAA_SEC_PMD, + DRIVER_DUMP_MODE "="); RTE_LOG_REGISTER(dpaa_logtype_sec, pmd.crypto.dpaa, NOTICE); -- 2.25.1