/* * snic_debugfs_init - Initialize debugfs for snic debug logging * * Description: * When Debugfs is configured this routine sets up fnic debugfs * filesystem. If not already created. this routine will crate the * fnic directory and statistics directory for trace buffer and * stats logging
*/ void snic_debugfs_init(void)
{
snic_glob->trc_root = debugfs_create_dir("snic", NULL);
/* * snic_debugfs_term - Tear down debugfs intrastructure * * Description: * When Debufs is configured this routine removes debugfs file system * elements that are specific to snic
*/ void
snic_debugfs_term(void)
{
debugfs_remove(snic_glob->stats_root);
snic_glob->stats_root = NULL;
/* * snic_reset_stats_read - Read a reset_stats debugfs file * @filp: The file pointer to read from. * @ubuf: The buffer tocopy the data to. * @cnt: The number of bytes to read. * @ppos: The position in the file to start reading frm. * * Description: * This routine reads value of variable reset_stats * and stores into local @buf. It will start reading file @ppos and * copy up to @cnt of data to @ubuf from @buf. * * Returns: * This function returns the amount of data that was read.
*/ static ssize_t
snic_reset_stats_read(struct file *filp, char __user *ubuf,
size_t cnt,
loff_t *ppos)
{ struct snic *snic = (struct snic *) filp->private_data; char buf[64]; int len;
/* * snic_reset_stats_write - Write to reset_stats debugfs file * @filp: The file pointer to write from * @ubuf: The buffer to copy the data from. * @cnt: The number of bytes to write. * @ppos: The position in the file to start writing to. * * Description: * This routine writes data from user buffer @ubuf to buffer @buf and * resets cumulative stats of snic. * * Returns: * This function returns the amount of data that was written.
*/ static ssize_t
snic_reset_stats_write(struct file *filp, constchar __user *ubuf,
size_t cnt,
loff_t *ppos)
{ struct snic *snic = (struct snic *) filp->private_data; struct snic_stats *stats = &snic->s_stats;
u64 *io_stats_p = (u64 *) &stats->io;
u64 *fw_stats_p = (u64 *) &stats->fw; char buf[64]; unsignedlong val; int ret;
if (cnt >= sizeof(buf)) return -EINVAL;
if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT;
buf[cnt] = '\0';
ret = kstrtoul(buf, 10, &val); if (ret < 0) return ret;
snic->reset_stats = val;
if (snic->reset_stats) { /* Skip variable is used to avoid descrepancies to Num IOs * and IO Completions stats. Skip incrementing No IO Compls * for pending active IOs after reset_stats
*/
atomic64_set(&snic->io_cmpl_skip,
atomic64_read(&stats->io.active));
memset(&stats->abts, 0, sizeof(struct snic_abort_stats));
memset(&stats->reset, 0, sizeof(struct snic_reset_stats));
memset(&stats->misc, 0, sizeof(struct snic_misc_stats));
memset(io_stats_p+1,
0, sizeof(struct snic_io_stats) - sizeof(u64));
memset(fw_stats_p+1,
0, sizeof(struct snic_fw_stats) - sizeof(u64));
}
/* * snic_stats_init - Initialize stats struct and create stats file * per snic * * Description: * When debugfs is cofigured this routine sets up the stats file per snic * It will create file stats and reset_stats under statistics/host# directory * to log per snic stats
*/ void snic_stats_debugfs_init(struct snic *snic)
{ char name[16];
/* * snic_stats_debugfs_remove - Tear down debugfs infrastructure of stats * * Description: * When Debufs is configured this routine removes debugfs file system * elements that are specific to to snic stats
*/ void
snic_stats_debugfs_remove(struct snic *snic)
{
debugfs_remove(snic->stats_file);
snic->stats_file = NULL;
/* * snic_trc_debugfs_term : cleans up the files created for trace under debugfs
*/ void
snic_trc_debugfs_term(void)
{
debugfs_lookup_and_remove(TRC_FILE, snic_glob->trc_root);
debugfs_lookup_and_remove(TRC_ENABLE_FILE, snic_glob->trc_root);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.