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 6867CA00BE; Mon, 20 Dec 2021 11:28:29 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 63AF24069F; Mon, 20 Dec 2021 11:27:55 +0100 (CET) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00069.outbound.protection.outlook.com [40.107.0.69]) by mails.dpdk.org (Postfix) with ESMTP id 92BE541165 for ; Mon, 20 Dec 2021 11:27:54 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z+h7n5E1WDBtW3dUyZfrjbHL352DgvKSYQ2I1Sg2QgGxst0T+/rs511Br6A64E9+sBxcj38NyoqQMgEBa3Q96soKw/RExxYXEhyhB4+napywcjSRE3oxOC2OiA/Q6fgdhQ2mednM93uFWztOfuhzeG9sOVgGLOiNOpcLE9SXxiuwO40gB/MUovRPeMkmho5agag+vTzmlp8OZCaeiMjtvBo9L4ycRJrod4RSiFEL+FgTqiV082lkzTHN52ttvNDroI2eOoqQ+iQrz3JZXbcNwImCNZKP7hWLTlz82HZ+Emfx9Fi8ZKEm6WEx0KClUVPzw1z/oJFSgX+fmj/Wm8pqmQ== 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=f/WR2J9t5lAPCf3zrq/+VtoI5xhEbiMQaIP8lq7zvDE=; b=FzZIGFHQZPl1fZyTKqOU/HTw2f1/VCw65Csix57CG0z4Ul9Ft5D/k/cgH214HLCXXJkC5JQO9tTaNIIMXJk9IFcEVH4szpY00TefOhNXmWkI+7vM+sNeoZ2Uxq9Xbn54DkAjYEhvCNLEZOs9FYQMSes9FA7aRoRmhbehHEm3jhrsDTNnRSpz1GXkjyNmeSHHJRWoQwgJjoesZdBv2h8pQxfktCO6NvtKNQLij0eLeAsjIgUna9JQvVJskhZYO5KHlPTG78hnF32X7ibmAnPcShvI4w/OB5mJmt7cBJguXZEOcS/Q+f8uwdlzsYbwfQy0eJdXZKRgCrj+i3gvcq13lQ== 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=f/WR2J9t5lAPCf3zrq/+VtoI5xhEbiMQaIP8lq7zvDE=; b=UdnnJOAnO+RyJvJgaJzNxXi9psT/NfGf5foaOmuEjRQMPUoQdQNjXD2smVOp0PUB96DC8/pMErAs7VdIm7ezfwf+CA13ERJAQOUh+1X6muH6LZzxk9T5Ayrb1RE9/mt0FQlXxQZtkynmo93TF6KttxELqS/HADHvvpPA6uRwmCs= 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 AM6PR0402MB3703.eurprd04.prod.outlook.com (2603:10a6:209:19::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.20; Mon, 20 Dec 2021 10:27:53 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::71ab:27ce:856d:5aac]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::71ab:27ce:856d:5aac%4]) with mapi id 15.20.4801.020; Mon, 20 Dec 2021 10:27:53 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh Subject: [PATCH 8/8] crypto/dpaa_sec: add debug framework Date: Mon, 20 Dec 2021 15:57:10 +0530 Message-Id: <20211220102710.3083370-8-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211220102710.3083370-1-g.singh@nxp.com> References: <20211220102710.3083370-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0205.apcprd06.prod.outlook.com (2603:1096:4:68::13) 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: 5d7dfa01-52a7-4b3e-5a7c-08d9c3a3615f X-MS-TrafficTypeDiagnostic: AM6PR0402MB3703:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2276; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TWciJY+O3miJFvioEB8GHKzunnJWbkCd/q28901QJgJkDlytTFVU53w+P60UUgBGYjKfHnjDY1IIv5udqdJ9LH1ltN+Qw2OJ5S+HeKaXCvQGebRzLD6IXGxZq2dltzL1Z8hGJnTxxCG35FyLIy1GrXkome5VenwX+Z9QHCmoItXdMXvUySHLzEn+pHOZj9iYnDjB/vAOy7BgTiAvsbXYlnhRUDcewebagxrmDnj++WNq5VTPMDYHEJSwHE6yU4UG2L9eylg4WCxaRWW1ERotn7dE219CK9OKHJAO+CPohwzSbRng0eOaoP3MjVxJAI+sxsOf83o264NQDvS0AJMOuPImIsseKDzpRqHQ5ddQWG/p0uShNo6Esjgu72jsoq0fHk9KBGwK4WjsEWVxFZDEQRncjdxuqpScSKlfcB2qiAdBjyGL9Iq/FtIC+VRDwF/3BJbkteyNm6+n1E1axkkvMhBZMDc6+sXmHiW2G2jHUXrLC8Jl5gW86lEA9o7TXeUAqcTP0iqgBg3ezf332lCQLpd4FS/5cQM9eg8IhbQq8VGRekRSU1YFEzqrwFvyYzITkO2I0wzkkyJsMOFz5A1rJWCQzu4xYBn6EKm/tnhshwZ2KqxzGmQFCaRvz+N5gwRsZNLU1UheM8oIZdvICOrJP9otUjW8qGyWY5RQZyyrdqX9dia6Q2YrCERrSEeuTAakpmwwtqxCE1ifQvjbfmvRXg== 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)(83380400001)(5660300002)(38350700002)(8676002)(6666004)(38100700002)(316002)(55236004)(66556008)(186003)(66476007)(66946007)(2906002)(52116002)(26005)(6506007)(8936002)(86362001)(4326008)(6486002)(1076003)(2616005)(6512007)(508600001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?0EVrLWRvTw89IWVdacv43yJbW7HABpVWEaI6iuJsuM6RUXnTTxsYwFl68Cmk?= =?us-ascii?Q?1obeIkHBRKGvkpAzuJqB6b66KzYL++/Ab5N6BqTbVYteetCQGCs8hqtylY6D?= =?us-ascii?Q?JusvbA2uWcXPajo0AOmibNbTIDBODnDATd0uxD3gfxdOUDcNPNDdqZloBPO1?= =?us-ascii?Q?0aJwaee9OmLLw1/g/WDjCebuOUyBUVdnk5rQ5a70YDXD8IEkwYi6b5a4/drk?= =?us-ascii?Q?IY5QugKCXInTjIr8YRehGrvdRdoMSRsP26Ndi3p8xxTuS2T9FwxCBtYm30E4?= =?us-ascii?Q?fO4uBxsr6eIj7Rx0C7QlLJKPXOsYjNa/HRmR68XK+2f/XSzZb6VfFF8tEQX+?= =?us-ascii?Q?L9v7aowJaH031wr2GgWziEZnGtMqFQI5xuF3TvvTR4lcyvKLpHCEGMFOoF40?= =?us-ascii?Q?ZEGfEdyn5w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F3dJNP/d?= =?us-ascii?Q?802gSJPhXMRYdx942j62m/NjQC/bgfM9wqaOnzdC4CGKGcdpADz3r3gSHZPZ?= =?us-ascii?Q?pS7MhCZzgynDsDJ/NW9ukCgnIh6An3a3iE2dd8IU61xTCYBxdJ8cvwaO0e/I?= =?us-ascii?Q?0G3scHb2dibfJvFyFO6YyMEtduA0weBFWITjhPsY+EwysR/F14YkFsPqcgVc?= =?us-ascii?Q?9+Lrni5Bd1YbkbHLauXtBN6sAGkfXpCwSW/ve/E2EHGYTxL3lPwXlLnJAkUq?= =?us-ascii?Q?bwD4z8Zww76VONTQlnU=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d7dfa01-52a7-4b3e-5a7c-08d9c3a3615f X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2021 10:27:53.3483 (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: +dSbQyEJOrrJmXQVf9xK1FxNl2ndJBGqkerrW9ZvpTTASg237w3Vy9gqW43Q03/0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR0402MB3703 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 --- drivers/crypto/dpaa_sec/dpaa_sec.c | 160 ++++++++++++++++++++++++++++- 1 file changed, 159 insertions(+), 1 deletion(-) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c index af166252ca..fc73d8c4c1 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,15 @@ #include #include +/* 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 +659,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 +859,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; @@ -3533,6 +3681,16 @@ dpaa_sec_dev_init(struct rte_cryptodev *cryptodev) } } + if (getenv("DPAA_SEC_DP_DUMP_LEVEL")) { + dpaa_sec_dp_dump = + atoi(getenv("DPAA_SEC_DP_DUMP_LEVEL")); + if (dpaa_sec_dp_dump > DPAA_SEC_DP_FULL_DUMP) { + printf("WARN: DPAA_SEC_DP_DUMP_LEVEL is not " + "supported, changing to FULL error prints\n"); + dpaa_sec_dp_dump = DPAA_SEC_DP_FULL_DUMP; + } + } + RTE_LOG(INFO, PMD, "%s cryptodev init\n", cryptodev->data->name); return 0; -- 2.25.1