diff options
author | Xabier Marquiegui <reibax@gmail.com> | 2023-10-12 00:39:57 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-10-15 20:07:52 +0100 |
commit | 403376ddb4221be9db5326ae334773807df71ffe (patch) | |
tree | 027d7c1055733aecd925d4941b8a7d90296e57f6 /drivers/ptp/ptp_clock.c | |
parent | c5a445b1e9347b14752b01f1a304bd7a2f260acc (diff) |
ptp: add debugfs interface to see applied channel masks
Use debugfs to be able to view channel mask applied to every timestamp
event queue.
Every time the device is opened, a new entry is created in
`$DEBUGFS_MOUNTPOINT/ptpN/$INSTANCE_ADDRESS/mask`.
The mask value can be viewed grouped in 32bit decimal values using cat,
or converted to hexadecimal with the included `ptpchmaskfmt.sh` script.
32 bit values are listed from least significant to most significant.
Signed-off-by: Xabier Marquiegui <reibax@gmail.com>
Suggested-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp/ptp_clock.c')
-rw-r--r-- | drivers/ptp/ptp_clock.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c index ed16d9787ce9..2e801cd33220 100644 --- a/drivers/ptp/ptp_clock.c +++ b/drivers/ptp/ptp_clock.c @@ -15,6 +15,7 @@ #include <linux/slab.h> #include <linux/syscalls.h> #include <linux/uaccess.h> +#include <linux/debugfs.h> #include <uapi/linux/sched/types.h> #include "ptp_private.h" @@ -185,6 +186,7 @@ static void ptp_clock_release(struct device *dev) spin_unlock_irqrestore(&tsevq->lock, flags); bitmap_free(tsevq->mask); kfree(tsevq); + debugfs_remove(ptp->debugfs_root); ida_free(&ptp_clocks_map, ptp->index); kfree(ptp); } @@ -218,6 +220,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, struct ptp_clock *ptp; struct timestamp_event_queue *queue = NULL; int err = 0, index, major = MAJOR(ptp_devt); + char debugfsname[8]; size_t size; if (info->n_alarm > PTP_MAX_ALARMS) @@ -339,6 +342,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, return ERR_PTR(err); } + /* Debugfs initialization */ + sprintf(debugfsname, "ptp%d", ptp->index); + ptp->debugfs_root = debugfs_create_dir(debugfsname, NULL); + return ptp; no_pps: |