From patchwork Tue Jul 23 09:14:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Vakul Garg X-Patchwork-Id: 11054157 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AFB5A912 for ; Tue, 23 Jul 2019 09:14:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9F2BF27528 for ; Tue, 23 Jul 2019 09:14:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8FB56285D4; Tue, 23 Jul 2019 09:14:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5AA027528 for ; Tue, 23 Jul 2019 09:14:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388799AbfGWJO3 (ORCPT ); Tue, 23 Jul 2019 05:14:29 -0400 Received: from mail-eopbgr50052.outbound.protection.outlook.com ([40.107.5.52]:55623 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388800AbfGWJO3 (ORCPT ); Tue, 23 Jul 2019 05:14:29 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V2D5aMWUUeoW+kTLd9XL8qXPKV9CceJispKmOb7UV2DcnZnJtpI6HOce80e2SYx9KeYwGuQI1RcLXZOiQFnC6eqXKJ4XsKepKFT1eWpIzSwFATA4qWOB3Rs+NQTgS5sCmMD+b0w9po2QjY55mckEGn7P9w3TV6EHpeH+jN/131MQ3hkmRb7iKtv2EzMfnA9KLbEaj8Yo7JUOPiCyeZCrMBSbd/yDzMtnBxUOu/57t40Y1nJdVKcTLRQ3GnUaZWl2cMNoQOkFW1inDmWWyfvZ/TWhKt8jsiVxwpdMhdM9bqbAAKtDVc7cf8Qqk19m3Klsw+B7/sOAg1YZPZ4+PibuqQ== 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-SenderADCheck; bh=3OFLoU3/opHq18+o4QwaUu5lCEjmmzRPBU8mJDlk9rg=; b=U5iWKuO75j4LhwUy5J89JsiD1u8ZJy42JC/5lrEHVN//z2xDxssHcctzhNKY2tAjJ/tEjdDpiSD+i0d/Cze/uaxr6jHRk6I84FcBFu5FyhfNm5pWbfi1eZVU9sPBjRdb296Ye+cNcJUs56D11BS9V6kRTulP0k2kU7/n9mKufE2g1AOdEeGUcZ5HfpPz3vLz73C3fDDdYDCn7bQ8+K/uXDKuYWAifeWhrzk6QnuyHZ1kTBwEmKHUGC7C+knJzw0I6JHpahqTPuhFRorz9ekd3lbGwA+Ym6dUSOasIO7lvZzLuaukmFtNtqSEz4gSYpP4EkfvBZPfgHMP+ZgV4P5GBA== 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=3OFLoU3/opHq18+o4QwaUu5lCEjmmzRPBU8mJDlk9rg=; b=jjwyhpc+j6tLlfcp+mypBC0kBKyve0F9TtIV5OIUuomjq2Z8RxjAhmJK7+RCq6QrgPSUUn8npSLX3nWEXtKdCkQjfkozCoXuKYKfc7zdP6SGdZ5FSwjSfXnJHQ1PKVd+izLw916l1S7g3d4i5frHETeJD/UfiqOoFKfL90RBy5I= Received: from DB7PR04MB4620.eurprd04.prod.outlook.com (52.135.140.28) by DB7PR04MB4457.eurprd04.prod.outlook.com (52.135.141.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2094.17; Tue, 23 Jul 2019 09:14:24 +0000 Received: from DB7PR04MB4620.eurprd04.prod.outlook.com ([fe80::94ce:fde8:cab7:873f]) by DB7PR04MB4620.eurprd04.prod.outlook.com ([fe80::94ce:fde8:cab7:873f%5]) with mapi id 15.20.2094.013; Tue, 23 Jul 2019 09:14:24 +0000 From: Vakul Garg To: "linux-crypto@vger.kernel.org" CC: Horia Geanta , Aymen Sghaier , "herbert@gondor.apana.org.au" , Vakul Garg Subject: [PATCH v5] crypto: caam/qi2 - Add printing dpseci fq stats using debugfs Thread-Topic: [PATCH v5] crypto: caam/qi2 - Add printing dpseci fq stats using debugfs Thread-Index: AQHVQTcF+gEt00n54EefuTviasufew== Date: Tue, 23 Jul 2019 09:14:24 +0000 Message-ID: <20190723091005.827-1-vakul.garg@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: MA1PR01CA0131.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:35::25) To DB7PR04MB4620.eurprd04.prod.outlook.com (2603:10a6:5:39::28) authentication-results: spf=none (sender IP is ) smtp.mailfrom=vakul.garg@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.13.6 x-originating-ip: [92.120.1.70] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 88526cf8-1e92-4b92-eaf3-08d70f4e2776 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:DB7PR04MB4457; x-ms-traffictypediagnostic: DB7PR04MB4457: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:327; x-forefront-prvs: 0107098B6C x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(136003)(39860400002)(396003)(346002)(376002)(366004)(199004)(189003)(305945005)(256004)(14444005)(478600001)(54906003)(36756003)(3846002)(8936002)(6116002)(86362001)(81156014)(476003)(50226002)(7736002)(81166006)(2616005)(316002)(8676002)(26005)(71200400001)(66066001)(71190400001)(2501003)(6506007)(2906002)(186003)(5660300002)(1076003)(66556008)(6512007)(102836004)(6436002)(66476007)(5640700003)(66946007)(386003)(64756008)(66446008)(14454004)(6916009)(4326008)(486006)(52116002)(53936002)(44832011)(25786009)(2351001)(99286004)(68736007)(6486002);DIR:OUT;SFP:1101;SCL:1;SRVR:DB7PR04MB4457;H:DB7PR04MB4620.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: /QcdpLr2e83lj0T29egVNzak97sBcaR3ip9V7L1VXhdzGi1VeELw6yFQEXTC8CE5jjkevxlak7zR5FAOJ+oVXDSuTgj2qsToUBxjz33AL7Iz9toM8EIvNJOGSTyDJI+FQWnO4c9t2rLz79xN2E7XFglDQtUy7eN6uPiR6yDcX3V5X1U03BYxhjk+zhDGRPMYjm8eTfUjaKg83+tkQ5JRBPL/amjj4bqTUfZWBGZiKN5zwJEPO1fFvnFmETsfCbcZYlFt0KiBKy1GsyvV+9rfKOgpin1mKD+akLrB7wgC7uJNXGeZd2QUUUSza/dtdkCgaznMt56gYa/JaAPT6NeBjZ7u09sv+Dnlm6RyS1bCxfcv0ejID3AX2K/QFcYHeC344r3RXWvGyQJ/bU42LROTkz9u5Za3mxGnXgHDS5rkYBQ= MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 88526cf8-1e92-4b92-eaf3-08d70f4e2776 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jul 2019 09:14:24.1894 (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: vakul.garg@nxp.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4457 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support of printing the dpseci frame queue statistics using debugfs. Signed-off-by: Vakul Garg Reviewed-by: Horia Geantă --- Changes since v4: - Corrected license header commenting style drivers/crypto/caam/Makefile | 1 + drivers/crypto/caam/caamalg_qi2.c | 5 +++ drivers/crypto/caam/caamalg_qi2.h | 2 + drivers/crypto/caam/dpseci-debugfs.c | 79 ++++++++++++++++++++++++++++++++++++ drivers/crypto/caam/dpseci-debugfs.h | 18 ++++++++ 5 files changed, 105 insertions(+) create mode 100644 drivers/crypto/caam/dpseci-debugfs.c create mode 100644 drivers/crypto/caam/dpseci-debugfs.h diff --git a/drivers/crypto/caam/Makefile b/drivers/crypto/caam/Makefile index 9ab4e81ea21e..68d5cc0f28e2 100644 --- a/drivers/crypto/caam/Makefile +++ b/drivers/crypto/caam/Makefile @@ -30,3 +30,4 @@ endif obj-$(CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM) += dpaa2_caam.o dpaa2_caam-y := caamalg_qi2.o dpseci.o +dpaa2_caam-$(CONFIG_DEBUG_FS) += dpseci-debugfs.o diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c index 06bf32c32cbd..a78a36dfa7b9 100644 --- a/drivers/crypto/caam/caamalg_qi2.c +++ b/drivers/crypto/caam/caamalg_qi2.c @@ -15,6 +15,7 @@ #include "key_gen.h" #include "caamalg_desc.h" #include "caamhash_desc.h" +#include "dpseci-debugfs.h" #include #include #include @@ -5098,6 +5099,8 @@ static int dpaa2_caam_probe(struct fsl_mc_device *dpseci_dev) goto err_bind; } + dpaa2_dpseci_debugfs_init(priv); + /* register crypto algorithms the device supports */ for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { struct caam_skcipher_alg *t_alg = driver_algs + i; @@ -5265,6 +5268,8 @@ static int __cold dpaa2_caam_remove(struct fsl_mc_device *ls_dev) dev = &ls_dev->dev; priv = dev_get_drvdata(dev); + dpaa2_dpseci_debugfs_exit(priv); + for (i = 0; i < ARRAY_SIZE(driver_aeads); i++) { struct caam_aead_alg *t_alg = driver_aeads + i; diff --git a/drivers/crypto/caam/caamalg_qi2.h b/drivers/crypto/caam/caamalg_qi2.h index be5085451053..17130dbe6465 100644 --- a/drivers/crypto/caam/caamalg_qi2.h +++ b/drivers/crypto/caam/caamalg_qi2.h @@ -10,6 +10,7 @@ #include #include #include +#include #include "dpseci.h" #include "desc_constr.h" @@ -64,6 +65,7 @@ struct dpaa2_caam_priv { struct iommu_domain *domain; struct dpaa2_caam_priv_per_cpu __percpu *ppriv; + struct dentry *dfs_root; }; /** diff --git a/drivers/crypto/caam/dpseci-debugfs.c b/drivers/crypto/caam/dpseci-debugfs.c new file mode 100644 index 000000000000..c5bfc923abd8 --- /dev/null +++ b/drivers/crypto/caam/dpseci-debugfs.c @@ -0,0 +1,79 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) +/* Copyright 2019 NXP */ + +#include +#include +#include +#include "dpseci-debugfs.h" + +static int dpseci_dbg_fqs_show(struct seq_file *file, void *offset) +{ + struct dpaa2_caam_priv *priv = (struct dpaa2_caam_priv *)file->private; + u32 fqid, fcnt, bcnt; + int i, err; + + seq_printf(file, "FQ stats for %s:\n", dev_name(priv->dev)); + seq_printf(file, "%s%16s%16s\n", + "Rx-VFQID", + "Pending frames", + "Pending bytes"); + + for (i = 0; i < priv->num_pairs; i++) { + fqid = priv->rx_queue_attr[i].fqid; + err = dpaa2_io_query_fq_count(NULL, fqid, &fcnt, &bcnt); + if (err) + continue; + + seq_printf(file, "%5d%16u%16u\n", fqid, fcnt, bcnt); + } + + seq_printf(file, "%s%16s%16s\n", + "Tx-VFQID", + "Pending frames", + "Pending bytes"); + + for (i = 0; i < priv->num_pairs; i++) { + fqid = priv->tx_queue_attr[i].fqid; + err = dpaa2_io_query_fq_count(NULL, fqid, &fcnt, &bcnt); + if (err) + continue; + + seq_printf(file, "%5d%16u%16u\n", fqid, fcnt, bcnt); + } + + return 0; +} + +static int dpseci_dbg_fqs_open(struct inode *inode, struct file *file) +{ + int err; + struct dpaa2_caam_priv *priv; + + priv = (struct dpaa2_caam_priv *)inode->i_private; + + err = single_open(file, dpseci_dbg_fqs_show, priv); + if (err < 0) + dev_err(priv->dev, "single_open() failed\n"); + + return err; +} + +static const struct file_operations dpseci_dbg_fq_ops = { + .open = dpseci_dbg_fqs_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, +}; + +void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv *priv) +{ + priv->dfs_root = debugfs_create_dir(dev_name(priv->dev), NULL); + + debugfs_create_file("fq_stats", 0444, priv->dfs_root, priv, + &dpseci_dbg_fq_ops); +} + +void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv) +{ + debugfs_remove_recursive(priv->dfs_root); +} diff --git a/drivers/crypto/caam/dpseci-debugfs.h b/drivers/crypto/caam/dpseci-debugfs.h new file mode 100644 index 000000000000..bc22af7bec37 --- /dev/null +++ b/drivers/crypto/caam/dpseci-debugfs.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ +/* Copyright 2019 NXP */ + +#ifndef DPSECI_DEBUGFS_H +#define DPSECI_DEBUGFS_H + +#include +#include "caamalg_qi2.h" + +#ifdef CONFIG_DEBUG_FS +void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv *priv); +void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv); +#else +static inline void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv *priv) {} +static inline void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv) {} +#endif /* CONFIG_DEBUG_FS */ + +#endif /* DPSECI_DEBUGFS_H */