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 C8F1245AFD; Thu, 10 Oct 2024 08:03:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 657B0400EF; Thu, 10 Oct 2024 08:03:20 +0200 (CEST) Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011017.outbound.protection.outlook.com [52.101.70.17]) by mails.dpdk.org (Postfix) with ESMTP id 68943400D6 for ; Thu, 10 Oct 2024 08:03:18 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=An8mlU19dYHPFL4wdcKaRYnXCIChvrdze33+6wcqlDQhOfEWH+wcQezEWOv6+OdejQdKE4JrVMHShq+YtDpXsVjsv+GN8ZMjgwEaXNu+fidlSyAC+htK5jFamdT32F9reqDbdDidghhZKetdzJUKgkmHuZiorZGQJE17d6JkuQo9U8BmBHfg1xp2EjIaL+K0T/PzDxqtxW5UApPVSB4KgPxg17W3ZsxHqNQn9MWvdUuqwr4t3x4sW1+TI2R9TtRgehv732Yz+FlntJtdMMeD7i6jLYbcFYmCok9yuHe0QHyBYiCPje1D68HiWKHWThZmaOsJnlusMgUiVlaFEfctOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=6iloBb4HmS9x/JWgKgaBJ+vb2SebmdnuucMZskJccBs=; b=dDR0hRP38z35//csoCC2suoPIzwr7Y1BUYS9crfy2rHg8/T3mMTQNr4EB/ANWwsl3mEILnWgTk8+opvxWNwu1NsuahartjkDtolivkqqKwhV9Wi2TpwxhG/NRxfVK9RA+jSI4xlp/JZh6S1es+jXtX+Q4Ry/KUlC2QQApKDGPo9MOjCylYcd5KlhTuzaM7lxltZ/ntTVseFh1CsScmwp8BDNeU4tZ8j5ld7uRgOIrE64MxEEZ5YXR6vjF6yRr7jM86x+TgAEKnfjCQbEzULo6vzh7qXzdOm5EGN1GtQCW9j6LGYTsMDE1Juqnn6K9nCjBr1Es6hw5r6rq4cHtt6jZA== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=6iloBb4HmS9x/JWgKgaBJ+vb2SebmdnuucMZskJccBs=; b=PNs6mpB7eC0aIu5PaQXwCFppNnOKUF/9VuZCnLarVtZMhIBpFoqJjGqyJIMvrp2nLeIUOT+ge9sEZXjKvxJC0YVn7hLpKDayjXcsmwDBc+NYpjHjoFY6Q0fZeDzYB63wUS1ndjf/Nl9QtBUd4NuiMAaUexYm3RrjddlGCtkB9A/za36Sk9OBoptilUxeK4xB6enmgAqxzudqGrAiXm4j0E/Wd7FEHvtSFfwsyEt9ATaLpxNDhshzYPLZe4Z6Mo0/rtqiPXkk4EoHrINjeRA6XQWZ8IYiPp2ToMBjXQNnSgJHOsPayRY5CQY9Ls/8VYue/1bWPOzOlwUBCD7nAcdbWg== 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 AS8PR04MB8369.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.23; Thu, 10 Oct 2024 06:03:16 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195%4]) with mapi id 15.20.8048.017; Thu, 10 Oct 2024 06:03:16 +0000 From: Gagandeep Singh To: dev@dpdk.org, Hemant Agrawal Cc: Jun Yang Subject: [v3] crypto/dpaa2_sec: rework debug code Date: Thu, 10 Oct 2024 11:33:00 +0530 Message-Id: <20241010060300.2308647-1-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241009050716.2007024-1-g.singh@nxp.com> References: <20241009050716.2007024-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR02CA0108.apcprd02.prod.outlook.com (2603:1096:4:92::24) To PAXPR04MB8205.eurprd04.prod.outlook.com (2603:10a6:102:1c2::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AS8PR04MB8369:EE_ X-MS-Office365-Filtering-Correlation-Id: 989bfd0d-b6e0-41d2-5bbe-08dce8f13b38 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|366016|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rANByyWhJ1LOrrLPJb4siTOwZ3ES5rghF0HvwoKRdML1Un/rSe0UqzsWkYx+?= =?us-ascii?Q?gj3Kyj5GdhW6HLAqH6xECOEGJuQpWr1tyTLCYMvKf2CbpM6UklEZwLIUl+jO?= =?us-ascii?Q?zhW46Y1jI+Cze1GVcn8RnmLh3kJ2J/tRagaRvPUjG2ZAvqd1oYryomtz0onu?= =?us-ascii?Q?XiLT5NduCqDysxXmbEDc2yYVtCqfsZR4dem/ILGVWEKxhXV/rl5OTcEjYWke?= =?us-ascii?Q?Xx2WZZKRJLlNNkx6Y8179f+7Qbz7QN4RKsBdCfgYqO5+P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KOwXp9CZi+2R12JURIgcRIgaVnQ5VqTa3RlBIkPCvno?= =?us-ascii?Q?yJC7LHHkbKSyLrNsyuqoRN0VOoXLfYuDzYrQ6Bp8Ek7Wgorj8g9tuyXWzl5u?= =?us-ascii?Q?KeUhBQ5er/M0juyTOHW5zgp1WAKMQyzLmyuqRi1+fecxrY5AIJyPNgZtSNge?= =?us-ascii?Q?fPJ00739/g4GM65k5ttX+VuqqFPPV/62c1+YnlEhcVvMeA=3D=3D?= 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:(13230040)(1800799024)(366016)(376014)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?A8lAyDOHyYCVdLUSzkC0qyeyf5DAQML7fglx6y+bl5dcVI9ZGYNdBZ+D40cV?= =?us-ascii?Q?EsXK/VV4NzxBHq83Az1y+vJO++RzTYjS/IEftCKYhm7bynXkyBwTDpl1THfj?= =?us-ascii?Q?x6DVsAIgeU0puWYYBjpLNY8bceQuol0uQxr8xE1Dvpzx8bLu4lbiPaYBJZdX?= =?us-ascii?Q?hcmTmwCt1puDgdNzZlSDg4ir1Ks48tVJWfbXStgvNmqgdcoIxNFNTo6kvMZ0?= =?us-ascii?Q?mLUT6yCG6yuejwy4Q2aiQpnCBEQpYp7kYESHTEuZ96DfLNFBM5Qd1R2bpSwQ?= =?us-ascii?Q?E5RqArI7QBqyloDbO/bb1e0jjpgFlzT030sryadJdWGmzNcHwloQYyBMkCJc?= =?us-ascii?Q?8la+emPSXKxBAErpkO6pR0FS8ceo08fWrS1a49Pndzhn4nl1p7+vxblapJI1?= =?us-ascii?Q?6k+YHfBWYsychqhIPcSFYxniCJPSMo/dNru5N0+GzZUxzx5slBMxKF1QXDj+?= =?us-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Lo1sENZyFzr7W/CkH+tm//EM53qH?= =?us-ascii?Q?YUVMF2oDLY6CJfSgYcUL5Xj/9YBCGhqhCD337QnIv9Zzhc3rv3Y7e4TS2GDn?= =?us-ascii?Q?j1oohJD6hm6RA5iTLvB0LLqxTmc6Zmh2ITgFKWJ0bHAHTgVWX04+c9qWoXK+?= =?us-ascii?Q?tNkeRmNWoUqCChK8lbUbAok0ggqfkIByeUTOrkMLzw2+e5YVltf1tEhrNogG?= =?us-ascii?Q?zccQMCZkQdr4hZQVeq8=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 989bfd0d-b6e0-41d2-5bbe-08dce8f13b38 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB8205.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 06:03:16.5964 (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: jVgtL4tUr/qG9w0BPJrf8c0l8z2BF6AOfGk6ii3Ui6J7Yoq1IiPXDRP/wBjtUuj8 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8369 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 Move the duplicate code in a common function and remove un-necessary newline characters from the logs. Signed-off-by: Jun Yang Signed-off-by: Gagandeep Singh --- drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c | 110 ++++++++------------ 1 file changed, 44 insertions(+), 66 deletions(-) diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c index b34183d594..a1e8dffe4a 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c @@ -65,6 +65,47 @@ enum dpaa2_sec_dump_levels { uint8_t cryptodev_driver_id; uint8_t dpaa2_sec_dp_dump = DPAA2_SEC_DP_ERR_DUMP; +static inline void +dpaa2_sec_dp_fd_dump(const struct qbman_fd *fd, uint16_t bpid, + struct rte_mbuf *mbuf, bool tx) +{ +#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) + char debug_str[1024]; + int offset; + + if (tx) { + offset = sprintf(debug_str, + "CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ", + DPAA2_GET_FD_ADDR(fd), + bpid < MAX_BPID ? "SW" : "BMAN"); + if (bpid < MAX_BPID) { + offset += sprintf(&debug_str[offset], + "bpid = %d ", bpid); + } + } else { + offset = sprintf(debug_str, "Mbuf %p from %s pool ", + mbuf, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN"); + if (!DPAA2_GET_FD_IVP(fd)) { + offset += sprintf(&debug_str[offset], "bpid = %d ", + DPAA2_GET_FD_BPID(fd)); + } + } + offset += sprintf(&debug_str[offset], + "private size = %d ", + mbuf->pool->private_data_size); + offset += sprintf(&debug_str[offset], + "addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d", + mbuf->buf_addr, DPAA2_GET_FD_ADDR(fd), + DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); + DPAA2_SEC_DP_DEBUG("%s", debug_str); +#else + RTE_SET_USED(bpid); + RTE_SET_USED(tx); + RTE_SET_USED(mbuf); + RTE_SET_USED(fd); +#endif +} + static inline void free_fle(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp) { @@ -1107,10 +1148,6 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op, struct rte_mbuf *mbuf; uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, sess->iv.offset); -#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) - char debug_str[1024]; - int offset; -#endif data_len = sym_op->cipher.data.length; data_offset = sym_op->cipher.data.offset; @@ -1215,26 +1252,7 @@ build_cipher_sg_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op, DPAA2_SET_FD_LEN(fd, ip_fle->length); DPAA2_SET_FD_COMPOUND_FMT(fd); DPAA2_SET_FD_FLC(fd, DPAA2_VADDR_TO_IOVA(flc)); - -#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) - offset = sprintf(debug_str, - "CIPHER SG: fdaddr =%" PRIx64 ", from %s pool ", - DPAA2_GET_FD_ADDR(fd), - bpid < MAX_BPID ? "SW" : "BMAN"); - if (bpid < MAX_BPID) { - offset += sprintf(&debug_str[offset], - "bpid = %d ", bpid); - } - offset += sprintf(&debug_str[offset], - "private size = %d ", - mbuf->pool->private_data_size); - offset += sprintf(&debug_str[offset], - "off =%d, len =%d", - DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); - DPAA2_SEC_DP_DEBUG("%s", debug_str); -#else - RTE_SET_USED(bpid); -#endif + dpaa2_sec_dp_fd_dump(fd, bpid, mbuf, true); return 0; } @@ -1251,10 +1269,6 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op, uint8_t *iv_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, sess->iv.offset); struct rte_mbuf *dst; -#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) - char debug_str[1024]; - int offset; -#endif data_len = sym_op->cipher.data.length; data_offset = sym_op->cipher.data.offset; @@ -1345,24 +1359,7 @@ build_cipher_fd(dpaa2_sec_session *sess, struct rte_crypto_op *op, sge->length = data_len; DPAA2_SET_FLE_FIN(sge); DPAA2_SET_FLE_FIN(fle); - -#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) - offset = sprintf(debug_str, - "CIPHER: fdaddr =%" PRIx64 ", from %s pool ", - DPAA2_GET_FD_ADDR(fd), - bpid < MAX_BPID ? "SW" : "BMAN"); - if (bpid < MAX_BPID) { - offset += sprintf(&debug_str[offset], - "bpid = %d ", bpid); - } - offset += sprintf(&debug_str[offset], - "private size = %d ", - dst->pool->private_data_size); - offset += sprintf(&debug_str[offset], - "off =%d, len =%d", - DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); - DPAA2_SEC_DP_DEBUG("%s", debug_str); -#endif + dpaa2_sec_dp_fd_dump(fd, bpid, dst, true); return 0; } @@ -1595,10 +1592,6 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp) struct qbman_fle *fle; struct rte_crypto_op *op; struct rte_mbuf *dst, *src; -#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) - char debug_str[1024]; - int offset; -#endif if (DPAA2_FD_GET_FORMAT(fd) == qbman_fd_single) return sec_simple_fd_to_mbuf(fd); @@ -1636,22 +1629,7 @@ sec_fd_to_mbuf(const struct qbman_fd *fd, struct dpaa2_sec_qp *qp) } dst->data_len = len; } - -#if (RTE_LOG_DEBUG <= RTE_LOG_DP_LEVEL) - offset = sprintf(debug_str, "Mbuf %p from %s pool ", - dst, DPAA2_GET_FD_IVP(fd) ? "SW" : "BMAN"); - if (!DPAA2_GET_FD_IVP(fd)) { - offset += sprintf(&debug_str[offset], "bpid = %d ", - DPAA2_GET_FD_BPID(fd)); - } - offset += sprintf(&debug_str[offset], - "private size = %d ", dst->pool->private_data_size); - offset += sprintf(&debug_str[offset], - "addr %p, fdaddr =%" PRIx64 ", off =%d, len =%d", - dst->buf_addr, DPAA2_GET_FD_ADDR(fd), - DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_LEN(fd)); - DPAA2_SEC_DP_DEBUG("%s", debug_str); -#endif + dpaa2_sec_dp_fd_dump(fd, 0, dst, false); /* free the fle memory */ if (likely(rte_pktmbuf_is_contiguous(src))) { -- 2.25.1