Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: caam/qi2 - Add printing dpseci fq stats using debugfs

Add support of printing the dpseci frame queue statistics using debugfs.

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Vakul Garg and committed by
Herbert Xu
1c0ab408 1b82feb6

+105
+1
drivers/crypto/caam/Makefile
··· 30 30 obj-$(CONFIG_CRYPTO_DEV_FSL_DPAA2_CAAM) += dpaa2_caam.o 31 31 32 32 dpaa2_caam-y := caamalg_qi2.o dpseci.o 33 + dpaa2_caam-$(CONFIG_DEBUG_FS) += dpseci-debugfs.o
+5
drivers/crypto/caam/caamalg_qi2.c
··· 15 15 #include "key_gen.h" 16 16 #include "caamalg_desc.h" 17 17 #include "caamhash_desc.h" 18 + #include "dpseci-debugfs.h" 18 19 #include <linux/fsl/mc.h> 19 20 #include <soc/fsl/dpaa2-io.h> 20 21 #include <soc/fsl/dpaa2-fd.h> ··· 5099 5098 goto err_bind; 5100 5099 } 5101 5100 5101 + dpaa2_dpseci_debugfs_init(priv); 5102 + 5102 5103 /* register crypto algorithms the device supports */ 5103 5104 for (i = 0; i < ARRAY_SIZE(driver_algs); i++) { 5104 5105 struct caam_skcipher_alg *t_alg = driver_algs + i; ··· 5267 5264 5268 5265 dev = &ls_dev->dev; 5269 5266 priv = dev_get_drvdata(dev); 5267 + 5268 + dpaa2_dpseci_debugfs_exit(priv); 5270 5269 5271 5270 for (i = 0; i < ARRAY_SIZE(driver_aeads); i++) { 5272 5271 struct caam_aead_alg *t_alg = driver_aeads + i;
+2
drivers/crypto/caam/caamalg_qi2.h
··· 10 10 #include <soc/fsl/dpaa2-io.h> 11 11 #include <soc/fsl/dpaa2-fd.h> 12 12 #include <linux/threads.h> 13 + #include <linux/netdevice.h> 13 14 #include "dpseci.h" 14 15 #include "desc_constr.h" 15 16 ··· 65 64 struct iommu_domain *domain; 66 65 67 66 struct dpaa2_caam_priv_per_cpu __percpu *ppriv; 67 + struct dentry *dfs_root; 68 68 }; 69 69 70 70 /**
+79
drivers/crypto/caam/dpseci-debugfs.c
··· 1 + // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) 2 + /* Copyright 2019 NXP */ 3 + 4 + #include <linux/module.h> 5 + #include <linux/device.h> 6 + #include <linux/debugfs.h> 7 + #include "dpseci-debugfs.h" 8 + 9 + static int dpseci_dbg_fqs_show(struct seq_file *file, void *offset) 10 + { 11 + struct dpaa2_caam_priv *priv = (struct dpaa2_caam_priv *)file->private; 12 + u32 fqid, fcnt, bcnt; 13 + int i, err; 14 + 15 + seq_printf(file, "FQ stats for %s:\n", dev_name(priv->dev)); 16 + seq_printf(file, "%s%16s%16s\n", 17 + "Rx-VFQID", 18 + "Pending frames", 19 + "Pending bytes"); 20 + 21 + for (i = 0; i < priv->num_pairs; i++) { 22 + fqid = priv->rx_queue_attr[i].fqid; 23 + err = dpaa2_io_query_fq_count(NULL, fqid, &fcnt, &bcnt); 24 + if (err) 25 + continue; 26 + 27 + seq_printf(file, "%5d%16u%16u\n", fqid, fcnt, bcnt); 28 + } 29 + 30 + seq_printf(file, "%s%16s%16s\n", 31 + "Tx-VFQID", 32 + "Pending frames", 33 + "Pending bytes"); 34 + 35 + for (i = 0; i < priv->num_pairs; i++) { 36 + fqid = priv->tx_queue_attr[i].fqid; 37 + err = dpaa2_io_query_fq_count(NULL, fqid, &fcnt, &bcnt); 38 + if (err) 39 + continue; 40 + 41 + seq_printf(file, "%5d%16u%16u\n", fqid, fcnt, bcnt); 42 + } 43 + 44 + return 0; 45 + } 46 + 47 + static int dpseci_dbg_fqs_open(struct inode *inode, struct file *file) 48 + { 49 + int err; 50 + struct dpaa2_caam_priv *priv; 51 + 52 + priv = (struct dpaa2_caam_priv *)inode->i_private; 53 + 54 + err = single_open(file, dpseci_dbg_fqs_show, priv); 55 + if (err < 0) 56 + dev_err(priv->dev, "single_open() failed\n"); 57 + 58 + return err; 59 + } 60 + 61 + static const struct file_operations dpseci_dbg_fq_ops = { 62 + .open = dpseci_dbg_fqs_open, 63 + .read = seq_read, 64 + .llseek = seq_lseek, 65 + .release = single_release, 66 + }; 67 + 68 + void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv *priv) 69 + { 70 + priv->dfs_root = debugfs_create_dir(dev_name(priv->dev), NULL); 71 + 72 + debugfs_create_file("fq_stats", 0444, priv->dfs_root, priv, 73 + &dpseci_dbg_fq_ops); 74 + } 75 + 76 + void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv) 77 + { 78 + debugfs_remove_recursive(priv->dfs_root); 79 + }
+18
drivers/crypto/caam/dpseci-debugfs.h
··· 1 + /* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */ 2 + /* Copyright 2019 NXP */ 3 + 4 + #ifndef DPSECI_DEBUGFS_H 5 + #define DPSECI_DEBUGFS_H 6 + 7 + #include <linux/dcache.h> 8 + #include "caamalg_qi2.h" 9 + 10 + #ifdef CONFIG_DEBUG_FS 11 + void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv *priv); 12 + void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv); 13 + #else 14 + static inline void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv *priv) {} 15 + static inline void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv) {} 16 + #endif /* CONFIG_DEBUG_FS */ 17 + 18 + #endif /* DPSECI_DEBUGFS_H */