File: dpseci-debugfs.c

package info (click to toggle)
linux 5.10.218-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,146,196 kB
  • sloc: ansic: 19,551,519; asm: 264,269; sh: 75,283; makefile: 44,828; perl: 34,675; python: 32,447; cpp: 6,075; yacc: 4,748; lex: 2,743; awk: 1,215; ruby: 25; sed: 5
file content (60 lines) | stat: -rw-r--r-- 1,458 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/* Copyright 2019 NXP */

#include <linux/module.h>
#include <linux/device.h>
#include <linux/debugfs.h>
#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;
}

DEFINE_SHOW_ATTRIBUTE(dpseci_dbg_fqs);

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_fqs_fops);
}

void dpaa2_dpseci_debugfs_exit(struct dpaa2_caam_priv *priv)
{
	debugfs_remove_recursive(priv->dfs_root);
}