1 // SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
2 /* Copyright 2019 NXP */
4 #include <linux/module.h>
5 #include <linux/device.h>
6 #include <linux/debugfs.h>
7 #include "dpseci-debugfs.h"
9 static int dpseci_dbg_fqs_show(struct seq_file
*file
, void *offset
)
11 struct dpaa2_caam_priv
*priv
= (struct dpaa2_caam_priv
*)file
->private;
15 seq_printf(file
, "FQ stats for %s:\n", dev_name(priv
->dev
));
16 seq_printf(file
, "%s%16s%16s\n",
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
);
27 seq_printf(file
, "%5d%16u%16u\n", fqid
, fcnt
, bcnt
);
30 seq_printf(file
, "%s%16s%16s\n",
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
);
41 seq_printf(file
, "%5d%16u%16u\n", fqid
, fcnt
, bcnt
);
47 static int dpseci_dbg_fqs_open(struct inode
*inode
, struct file
*file
)
50 struct dpaa2_caam_priv
*priv
;
52 priv
= (struct dpaa2_caam_priv
*)inode
->i_private
;
54 err
= single_open(file
, dpseci_dbg_fqs_show
, priv
);
56 dev_err(priv
->dev
, "single_open() failed\n");
61 static const struct file_operations dpseci_dbg_fq_ops
= {
62 .open
= dpseci_dbg_fqs_open
,
65 .release
= single_release
,
68 void dpaa2_dpseci_debugfs_init(struct dpaa2_caam_priv
*priv
)
70 priv
->dfs_root
= debugfs_create_dir(dev_name(priv
->dev
), NULL
);
72 debugfs_create_file("fq_stats", 0444, priv
->dfs_root
, priv
,
76 void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv
*priv
)
78 debugfs_remove_recursive(priv
->dfs_root
);