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 C9ADAA00C2; Thu, 10 Feb 2022 05:32:28 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 678FD4116A; Thu, 10 Feb 2022 05:32:08 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2077.outbound.protection.outlook.com [40.107.21.77]) by mails.dpdk.org (Postfix) with ESMTP id AA90841168 for ; Thu, 10 Feb 2022 05:32:07 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B8oxp7Oy0S5qWGdIma5AQ+ssDSlmviU3FxJg0/kyAr0AXXC8b/bInyYcy1pwLESVGct23nR7YkaI9PlTwGP1A+sOG3YIBv+Hp9JpGXB5wFm1xeYvTM2v+xYwlVlZBW/l+voeZS+PdSrQQlsIccc+68qRAaZMhAAv/LoqNMhJQ7h6X33966yzCq+vbatAkP3GC/g5hWG17ZJGrSzPWsjbTgeDen7xfiV4a5sX1afrKuwXfIyRTejPi5L3spk4IX8eVO3icShVRp9UER8V6/qRD3oO17q/7T7QgDtQdGDGCRtdvLqKAMmJNAW6KRabIYoR8muCD2GWoYDZJxONk3OmPQ== 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=b3t43XXJaHG1q/2ws9FZ2A4xaOzkV7ZIUArlwotl/ag=; b=NLF/TUcBnYDc8ttDuzpOaCDLFqPaeWk69TBWRtyMj5Cb6F5rLRTOUcmBsQxLSy7sBCWbKSdfakt7GYBdWXJGnS3WKoxjlIvkcZi+mqW9hADm+re/D96oWjY6v5fyJY1ifhW/xrMKwRwBlLTKwacIh7cTJ9Rtd/1/GGgWvXaV3bSebjrJFevUBnVnd/6zv54b0kXdL5PVnu0AmbMcaxS2X67/3ap4OhXaTKvAe+l29VTBZmhKoUitV7e7dSQeUov22Q631UzI7DMC/iwYCXKOj1MVAKitNd2g3rVilbq+/R7ka3Dk021KhXIkzKt87IQ/pGmmkO7nn7d/TYBenrXkVg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=b3t43XXJaHG1q/2ws9FZ2A4xaOzkV7ZIUArlwotl/ag=; b=RxSi5m+xV4lIsgALo29n/S5php2NtVDm/he3U/XYRWpkHgrx6qjXlVpIGLJMa6krg6cQRbGZIEHHiqX4480qLbpdwkVsKLupOynXzpDTv5ryPcT1mBCkV9fKi2TvlD8+NDdo+6aQ3RDGnZc7ofp1MSKNYJ8ac2Rhuuj2x9Z1owA= 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 DBBPR04MB6106.eurprd04.prod.outlook.com (2603:10a6:10:c5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Thu, 10 Feb 2022 04:32:06 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::4146:965b:5645:9269]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::4146:965b:5645:9269%4]) with mapi id 15.20.4975.011; Thu, 10 Feb 2022 04:32:06 +0000 From: Gagandeep Singh To: gakhil@marvell.com, dev@dpdk.org Cc: Gagandeep Singh Subject: [PATCH v3 4/7] crypto/dpaa2_sec: add useful debug prints in sec dequeue Date: Thu, 10 Feb 2022 10:01:33 +0530 Message-Id: <20220210043136.304845-5-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220210043136.304845-1-g.singh@nxp.com> References: <20211228091058.3620177-2-g.singh@nxp.com> <20220210043136.304845-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG3P274CA0003.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:be::15) 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: 33f1565d-99b0-4bf6-9979-08d9ec4e4b46 X-MS-TrafficTypeDiagnostic: DBBPR04MB6106:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b9v7LCxxDQEgBisvJbOhLFkM3NkykrasQ+Kni5GWNzWj0R8zlEPe7NRRUrxyhGvX0b4JOi5Yk7H5J6sappJcFfE8WYSpV0+6Li2Ro4VUk4QUtenlxDn0NDws7XWTjnGsRr9+c0JkZrlqarKYuLLMAPi5EIGOePxGt54feg0Oa/qxPBJoGgTNVLO9NWXvClilongXkUrIBeQzWr1nFCAwjCR6zilRo38HYp9alH8K2RswafdDGWLECuzwSisRgKh9a6xu+UxNkLCpwKxtDOzD5bOa2LTHf5semADVLKrawW7Mdl6HSNnJY9vXP29BpDZ8HTp85AJZomXHxFKYR0dNVpjER0siqBW7hiRiEUwgM301OIVQ3xi2H2qKknDWmN0J1fhyzPQyjGpEolBxMHQPoHItEImnoOBccw5AvAcTqft6sJ6RyVV2L7VtomMlgsTUPqB8HllUPn9chbu9A11gnozO6zvdgNPDBnO8bGUjFMN6i8zjf0UncwSiRcpewxb+04CpHtOlj5hqfIChFSx+S7ldC6Y7nqyZ6DyeG/vPuP5nepaGRxJBJgIQaw8txvLIyPMn+eTpcJC5MQTffsCdG522j/dkLnEWhs6vq0HrZuZRcyXxYVVlWgLVbVq1ZqDLWNO8q3boTrHb9JYCG3pMBcnQ5fUuKCoiUR/ROqcQeQi9NiD5r81k46LpLkNFv9j9tgPY0HDVfrh24zsCrm3oHQ== 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:(13230001)(4636009)(366004)(66556008)(6486002)(316002)(66946007)(4326008)(66476007)(8676002)(508600001)(36756003)(86362001)(38350700002)(38100700002)(1076003)(186003)(55236004)(52116002)(6512007)(2616005)(6666004)(26005)(6506007)(83380400001)(5660300002)(8936002)(2906002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?q6UyyA+NOuCzrdL0M5IfiBXxBaW1fJnaaCXy8y1Kf5l9SrvgO4I2EaWQWXqK?= =?us-ascii?Q?sFZnG1ngXQydwnPbJ12Nw/vEaRj604PWWynhO8i15gRlnW82RhWof5PiN4Je?= =?us-ascii?Q?vZCIAPUU1ZcO3NN+wD04BR04pw5tk274Rnq5N7XGyNPnzfPvlxMyLg2P2koV?= =?us-ascii?Q?3ooFnYz5lFFXtWLnbidbUMg7tW4legvFHWFNtAZWk7DVdd70RMKo3VQ4G4Jl?= =?us-ascii?Q?OWX8tlp6Km+aicsvfH0L92r1nJb25R0HsPMpxkjDItMD7ept2YAftKMo88H/?= =?us-ascii?Q?PulXojGoboxGBfGC7ccsJ5KyG4nu0EUiEW6Ln9CXqjI2VL0IIiHjiYO3PZLv?= =?us-ascii?Q?s4DJrUP337Zq3SFUfPjvM0m6W7Ozys3IgNqSDgFMiktid2eY/0Wzu0ziTc6I?= =?us-ascii?Q?cp7jjZMT+w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d?= =?us-ascii?Q?/atz3uoFg3zRtWoYcZV+42lZ6OpEXLx54JzlUSMAWdKcdSxxZOMh3myufAYQ?= =?us-ascii?Q?uV5wa3glJKPiIKKdGDnBJnhDQNP0D43PM+Vg4OM3dn6k5mwK2tW3us3uQz+c?= =?us-ascii?Q?ptntswN21yD3PSKutzBBP4KBPGD3nFz8Y2pZbaloQRPp44/OksqjV4jiqtKr?= =?us-ascii?Q?BTB0COraco6lkZKCRuKH5chWn07WF0/QAI7Rz7FYjK3vIw3sHejubMdKArJt?= =?us-ascii?Q?kGJWHcjPHTq38FIsVxw=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33f1565d-99b0-4bf6-9979-08d9ec4e4b46 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2022 04:32:06.6345 (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: 5+I45MDSAGmC07Si2gDmrc/YZf9NWIAVUCjvR11F6Ixgwaa+bOlUODKHTIgKr8HK X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB6106 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 Few useful debug prints added in dequeue function. Signed-off-by: Gagandeep Singh --- doc/guides/cryptodevs/dpaa2_sec.rst | 10 ++ drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 136 +++++++++++++++++++- 2 files changed, 144 insertions(+), 2 deletions(-) diff --git a/doc/guides/cryptodevs/dpaa2_sec.rst b/doc/guides/cryptodevs/dpaa2_sec.rst index 06de988d51..875d918068 100644 --- a/doc/guides/cryptodevs/dpaa2_sec.rst +++ b/doc/guides/cryptodevs/dpaa2_sec.rst @@ -175,3 +175,13 @@ For enabling logs, use the following EAL parameter: Using ``crypto.dpaa2`` 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. ``fslmc:dpseci.1,drv_dump_mode=1`` diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index 1e6b3e548a..444e1f0043 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "dpaa2_sec_priv.h" #include "dpaa2_sec_event.h" @@ -50,7 +51,17 @@ #define NO_PREFETCH 0 +#define DRIVER_DUMP_MODE "drv_dump_mode" + +/* DPAA2_SEC_DP_DUMP levels */ +enum dpaa2_sec_dump_levels { + DPAA2_SEC_DP_NO_DUMP, + DPAA2_SEC_DP_ERR_DUMP, + DPAA2_SEC_DP_FULL_DUMP +}; + uint8_t cryptodev_driver_id; +uint8_t dpaa2_sec_dp_dump = DPAA2_SEC_DP_ERR_DUMP; #ifdef RTE_LIB_SECURITY static inline int @@ -1621,6 +1632,83 @@ sec_fd_to_mbuf(const struct qbman_fd *fd) return op; } +static void +dpaa2_sec_dump(struct rte_crypto_op *op) +{ + int i; + dpaa2_sec_session *sess = NULL; + struct ctxt_priv *priv; + uint8_t bufsize; + struct rte_crypto_sym_op *sym_op; + + if (op->sess_type == RTE_CRYPTO_OP_WITH_SESSION) + sess = (dpaa2_sec_session *)get_sym_session_private_data( + op->sym->session, cryptodev_driver_id); +#ifdef RTE_LIBRTE_SECURITY + else if (op->sess_type == RTE_CRYPTO_OP_SECURITY_SESSION) + sess = (dpaa2_sec_session *)get_sec_session_private_data( + op->sym->sec_session); +#endif + + if (sess == NULL) + goto mbuf_dump; + + priv = (struct ctxt_priv *)sess->ctxt; + 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%zd\n", sess->ctxt_type, + (sess->dir == DIR_ENC) ? "DIR_ENC" : "DIR_DEC", + sess->cipher_alg, sess->auth_alg, sess->aead_alg, + sess->cipher_key.length); + 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%zd\n\tIV len:\t\t%d\n\tIV offset:\t%d\n" + "\tdigest length:\t%d\n\tstatus:\t\t%d\n\taead auth only" + " len:\t%d\n\taead cipher text:\t%d\n", + sess->auth_key.length, sess->iv.length, sess->iv.offset, + sess->digest_length, sess->status, + sess->ext_params.aead_ctxt.auth_only_len, + sess->ext_params.aead_ctxt.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\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.hfn_ovd_offset, sess->pdcp.hfn, + sess->pdcp.hfn_threshold); + +#endif + bufsize = (uint8_t)priv->flc_desc[0].flc.word1_sdl; + printf("Descriptor Dump:\n"); + for (i = 0; i < bufsize; i++) + printf("\tDESC[%d]:0x%x\n", i, priv->flc_desc[0].desc[i]); + + 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"); + +} + static uint16_t dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, uint16_t nb_ops) @@ -1702,8 +1790,13 @@ dpaa2_sec_dequeue_burst(void *qp, struct rte_crypto_op **ops, if (unlikely(fd->simple.frc)) { /* TODO Parse SEC errors */ - DPAA2_SEC_DP_ERR("SEC returned Error - %x\n", - fd->simple.frc); + if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_NO_DUMP) { + DPAA2_SEC_DP_ERR("SEC returned Error - %x\n", + fd->simple.frc); + if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_ERR_DUMP) + dpaa2_sec_dump(ops[num_rx]); + } + dpaa2_qp->rx_vq.err_pkts += 1; ops[num_rx]->status = RTE_CRYPTO_OP_STATUS_ERROR; } else { @@ -3883,6 +3976,42 @@ dpaa2_sec_uninit(const struct rte_cryptodev *dev) return 0; } +static int +check_devargs_handler(__rte_unused const char *key, const char *value, + __rte_unused void *opaque) +{ + dpaa2_sec_dp_dump = atoi(value); + if (dpaa2_sec_dp_dump > DPAA2_SEC_DP_FULL_DUMP) { + DPAA2_SEC_WARN("WARN: DPAA2_SEC_DP_DUMP_LEVEL is not " + "supported, changing to FULL error prints\n"); + dpaa2_sec_dp_dump = DPAA2_SEC_DP_FULL_DUMP; + } + + return 0; +} + +static void +dpaa2_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 dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) { @@ -3984,6 +4113,7 @@ dpaa2_sec_dev_init(struct rte_cryptodev *cryptodev) goto init_error; } + dpaa2_sec_get_devargs(cryptodev->device->devargs, DRIVER_DUMP_MODE); DPAA2_SEC_INFO("driver %s: created", cryptodev->data->name); return 0; @@ -4082,4 +4212,6 @@ static struct cryptodev_driver dpaa2_sec_crypto_drv; RTE_PMD_REGISTER_DPAA2(CRYPTODEV_NAME_DPAA2_SEC_PMD, rte_dpaa2_sec_driver); RTE_PMD_REGISTER_CRYPTO_DRIVER(dpaa2_sec_crypto_drv, rte_dpaa2_sec_driver.driver, cryptodev_driver_id); +RTE_PMD_REGISTER_PARAM_STRING(CRYPTODEV_NAME_DPAA2_SEC_PMD, + DRIVER_DUMP_MODE "="); RTE_LOG_REGISTER(dpaa2_logtype_sec, pmd.crypto.dpaa2, NOTICE); -- 2.25.1