^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * QLogic FCoE Offload Driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2016-2018 QLogic Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/uaccess.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include "qedf.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include "qedf_dbg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) static struct dentry *qedf_dbg_root;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * qedf_dbg_host_init - setup the debugfs file for the pf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) qedf_dbg_host_init(struct qedf_dbg_ctx *qedf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) const struct qedf_debugfs_ops *dops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) const struct file_operations *fops)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) char host_dirname[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) QEDF_INFO(qedf, QEDF_LOG_DEBUGFS, "Creating debugfs host node\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /* create pf dir */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) sprintf(host_dirname, "host%u", qedf->host_no);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) qedf->bdf_dentry = debugfs_create_dir(host_dirname, qedf_dbg_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) /* create debugfs files */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) while (dops) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) if (!(dops->name))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) debugfs_create_file(dops->name, 0600, qedf->bdf_dentry, qedf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) dops++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) fops++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * qedf_dbg_host_exit - clear out the pf's debugfs entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) qedf_dbg_host_exit(struct qedf_dbg_ctx *qedf_dbg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "Destroying debugfs host "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) "entry\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) /* remove debugfs entries of this PF */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) debugfs_remove_recursive(qedf_dbg->bdf_dentry);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) qedf_dbg->bdf_dentry = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * qedf_dbg_init - start up debugfs for the driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) qedf_dbg_init(char *drv_name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) QEDF_INFO(NULL, QEDF_LOG_DEBUGFS, "Creating debugfs root node\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) /* create qed dir in root of debugfs. NULL means debugfs root */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) qedf_dbg_root = debugfs_create_dir(drv_name, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) * qedf_dbg_exit - clean out the driver's debugfs entries
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) qedf_dbg_exit(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) QEDF_INFO(NULL, QEDF_LOG_DEBUGFS, "Destroying debugfs root "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) "entry\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /* remove qed dir in root of debugfs */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) debugfs_remove_recursive(qedf_dbg_root);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) qedf_dbg_root = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) const struct qedf_debugfs_ops qedf_debugfs_ops[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) { "fp_int", NULL },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) { "io_trace", NULL },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) { "debug", NULL },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) { "stop_io_on_error", NULL},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) { "driver_stats", NULL},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) { "clear_stats", NULL},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) { "offload_stats", NULL},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) /* This must be last */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) { NULL, NULL }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) DECLARE_PER_CPU(struct qedf_percpu_iothread_s, qedf_percpu_iothreads);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) qedf_dbg_fp_int_cmd_read(struct file *filp, char __user *buffer, size_t count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) size_t cnt = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct qedf_fastpath *fp = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct qedf_dbg_ctx *qedf_dbg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) (struct qedf_dbg_ctx *)filp->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) struct qedf_ctx *qedf = container_of(qedf_dbg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) struct qedf_ctx, dbg_ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "entered\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) cnt = sprintf(buffer, "\nFastpath I/O completions\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) for (id = 0; id < qedf->num_queues; id++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) fp = &(qedf->fp_array[id]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) if (fp->sb_id == QEDF_SB_ID_NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) cnt += sprintf((buffer + cnt), "#%d: %lu\n", id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) fp->completions);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) cnt = min_t(int, count, cnt - *ppos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) *ppos += cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) return cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) qedf_dbg_fp_int_cmd_write(struct file *filp, const char __user *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) size_t count, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) if (!count || *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) qedf_dbg_debug_cmd_read(struct file *filp, char __user *buffer, size_t count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) int cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) struct qedf_dbg_ctx *qedf_dbg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) (struct qedf_dbg_ctx *)filp->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "debug mask=0x%x\n", qedf_debug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) cnt = sprintf(buffer, "debug mask = 0x%x\n", qedf_debug);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) cnt = min_t(int, count, cnt - *ppos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) *ppos += cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) return cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) qedf_dbg_debug_cmd_write(struct file *filp, const char __user *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) size_t count, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) uint32_t val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) void *kern_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) int rval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) struct qedf_dbg_ctx *qedf_dbg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) (struct qedf_dbg_ctx *)filp->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) if (!count || *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) kern_buf = memdup_user(buffer, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) if (IS_ERR(kern_buf))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) return PTR_ERR(kern_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) rval = kstrtouint(kern_buf, 10, &val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) kfree(kern_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) if (rval)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) return rval;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) if (val == 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) qedf_debug = QEDF_DEFAULT_LOG_MASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) qedf_debug = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "Setting debug=0x%x.\n", val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) qedf_dbg_stop_io_on_error_cmd_read(struct file *filp, char __user *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) size_t count, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) int cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) struct qedf_dbg_ctx *qedf_dbg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) (struct qedf_dbg_ctx *)filp->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) struct qedf_ctx *qedf = container_of(qedf_dbg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) struct qedf_ctx, dbg_ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "entered\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) cnt = sprintf(buffer, "%s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) qedf->stop_io_on_error ? "true" : "false");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) cnt = min_t(int, count, cnt - *ppos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) *ppos += cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) return cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) qedf_dbg_stop_io_on_error_cmd_write(struct file *filp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) const char __user *buffer, size_t count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) void *kern_buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) struct qedf_dbg_ctx *qedf_dbg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) (struct qedf_dbg_ctx *)filp->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) struct qedf_ctx *qedf = container_of(qedf_dbg, struct qedf_ctx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) dbg_ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "entered\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) if (!count || *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) kern_buf = memdup_user(buffer, 6);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) if (IS_ERR(kern_buf))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) return PTR_ERR(kern_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) if (strncmp(kern_buf, "false", 5) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) qedf->stop_io_on_error = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) else if (strncmp(kern_buf, "true", 4) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) qedf->stop_io_on_error = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) else if (strncmp(kern_buf, "now", 3) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) /* Trigger from user to stop all I/O on this host */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) set_bit(QEDF_DBG_STOP_IO, &qedf->flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) kfree(kern_buf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) qedf_io_trace_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) int i, idx = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) struct qedf_ctx *qedf = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) struct qedf_dbg_ctx *qedf_dbg = &qedf->dbg_ctx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) struct qedf_io_log *io_log;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) if (!qedf_io_tracing) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) seq_puts(s, "I/O tracing not enabled.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "entered\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) spin_lock_irqsave(&qedf->io_trace_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) idx = qedf->io_trace_idx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) for (i = 0; i < QEDF_IO_TRACE_SIZE; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) io_log = &qedf->io_trace_buf[idx];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) seq_printf(s, "%d:", io_log->direction);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) seq_printf(s, "0x%x:", io_log->task_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) seq_printf(s, "0x%06x:", io_log->port_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) seq_printf(s, "%d:", io_log->lun);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) seq_printf(s, "0x%02x:", io_log->op);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) seq_printf(s, "0x%02x%02x%02x%02x:", io_log->lba[0],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) io_log->lba[1], io_log->lba[2], io_log->lba[3]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) seq_printf(s, "%d:", io_log->bufflen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) seq_printf(s, "%d:", io_log->sg_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) seq_printf(s, "0x%08x:", io_log->result);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) seq_printf(s, "%lu:", io_log->jiffies);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) seq_printf(s, "%d:", io_log->refcount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) seq_printf(s, "%d:", io_log->req_cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) seq_printf(s, "%d:", io_log->int_cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) seq_printf(s, "%d:", io_log->rsp_cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) seq_printf(s, "%d\n", io_log->sge_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) idx++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) if (idx == QEDF_IO_TRACE_SIZE)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) idx = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) spin_unlock_irqrestore(&qedf->io_trace_lock, flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) qedf_dbg_io_trace_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) struct qedf_dbg_ctx *qedf_dbg = inode->i_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) struct qedf_ctx *qedf = container_of(qedf_dbg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) struct qedf_ctx, dbg_ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) return single_open(file, qedf_io_trace_show, qedf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /* Based on fip_state enum from libfcoe.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) static char *fip_state_names[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) "FIP_ST_DISABLED",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) "FIP_ST_LINK_WAIT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) "FIP_ST_AUTO",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) "FIP_ST_NON_FIP",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) "FIP_ST_ENABLED",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) "FIP_ST_VNMP_START",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) "FIP_ST_VNMP_PROBE1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) "FIP_ST_VNMP_PROBE2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) "FIP_ST_VNMP_CLAIM",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) "FIP_ST_VNMP_UP",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) /* Based on fc_rport_state enum from libfc.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) static char *fc_rport_state_names[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) "RPORT_ST_INIT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) "RPORT_ST_FLOGI",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) "RPORT_ST_PLOGI_WAIT",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) "RPORT_ST_PLOGI",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) "RPORT_ST_PRLI",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) "RPORT_ST_RTV",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) "RPORT_ST_READY",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) "RPORT_ST_ADISC",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) "RPORT_ST_DELETE",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) qedf_driver_stats_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) struct qedf_ctx *qedf = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) struct qedf_rport *fcport;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) struct fc_rport_priv *rdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) seq_printf(s, "Host WWNN/WWPN: %016llx/%016llx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) qedf->wwnn, qedf->wwpn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) seq_printf(s, "Host NPortID: %06x\n", qedf->lport->port_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) seq_printf(s, "Link State: %s\n", atomic_read(&qedf->link_state) ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) "Up" : "Down");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) seq_printf(s, "Logical Link State: %s\n", qedf->lport->link_up ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) "Up" : "Down");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) seq_printf(s, "FIP state: %s\n", fip_state_names[qedf->ctlr.state]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) seq_printf(s, "FIP VLAN ID: %d\n", qedf->vlan_id & 0xfff);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) seq_printf(s, "FIP 802.1Q Priority: %d\n", qedf->prio);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) if (qedf->ctlr.sel_fcf) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) seq_printf(s, "FCF WWPN: %016llx\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) qedf->ctlr.sel_fcf->switch_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) seq_printf(s, "FCF MAC: %pM\n", qedf->ctlr.sel_fcf->fcf_mac);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) seq_puts(s, "FCF not selected\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) seq_puts(s, "\nSGE stats:\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) seq_printf(s, "cmg_mgr free io_reqs: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) atomic_read(&qedf->cmd_mgr->free_list_cnt));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) seq_printf(s, "slow SGEs: %d\n", qedf->slow_sge_ios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) seq_printf(s, "fast SGEs: %d\n\n", qedf->fast_sge_ios);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) seq_puts(s, "Offloaded ports:\n\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) rcu_read_lock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) list_for_each_entry_rcu(fcport, &qedf->fcports, peers) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) rdata = fcport->rdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) if (rdata == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) seq_printf(s, "%016llx/%016llx/%06x: state=%s, free_sqes=%d, num_active_ios=%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) rdata->rport->node_name, rdata->rport->port_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) rdata->ids.port_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) fc_rport_state_names[rdata->rp_state],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) atomic_read(&fcport->free_sqes),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) atomic_read(&fcport->num_active_ios));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) rcu_read_unlock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) qedf_dbg_driver_stats_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) struct qedf_dbg_ctx *qedf_dbg = inode->i_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) struct qedf_ctx *qedf = container_of(qedf_dbg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) struct qedf_ctx, dbg_ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) return single_open(file, qedf_driver_stats_show, qedf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) qedf_dbg_clear_stats_cmd_read(struct file *filp, char __user *buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) size_t count, loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) int cnt = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) /* Essentially a read stub */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) cnt = min_t(int, count, cnt - *ppos);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) *ppos += cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) return cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) static ssize_t
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) qedf_dbg_clear_stats_cmd_write(struct file *filp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) const char __user *buffer, size_t count,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) loff_t *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) struct qedf_dbg_ctx *qedf_dbg =
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) (struct qedf_dbg_ctx *)filp->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) struct qedf_ctx *qedf = container_of(qedf_dbg, struct qedf_ctx,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) dbg_ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) QEDF_INFO(qedf_dbg, QEDF_LOG_DEBUGFS, "Clearing stat counters.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) if (!count || *ppos)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) /* Clear stat counters exposed by 'stats' node */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) qedf->slow_sge_ios = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) qedf->fast_sge_ios = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) qedf_offload_stats_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) struct qedf_ctx *qedf = s->private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) struct qed_fcoe_stats *fw_fcoe_stats;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) fw_fcoe_stats = kmalloc(sizeof(struct qed_fcoe_stats), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) if (!fw_fcoe_stats) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) QEDF_ERR(&(qedf->dbg_ctx), "Could not allocate memory for "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) "fw_fcoe_stats.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) goto out;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) /* Query firmware for offload stats */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) qed_ops->get_stats(qedf->cdev, fw_fcoe_stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) seq_printf(s, "fcoe_rx_byte_cnt=%llu\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) "fcoe_rx_data_pkt_cnt=%llu\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) "fcoe_rx_xfer_pkt_cnt=%llu\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) "fcoe_rx_other_pkt_cnt=%llu\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) "fcoe_silent_drop_pkt_cmdq_full_cnt=%u\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) "fcoe_silent_drop_pkt_crc_error_cnt=%u\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) "fcoe_silent_drop_pkt_task_invalid_cnt=%u\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) "fcoe_silent_drop_total_pkt_cnt=%u\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) "fcoe_silent_drop_pkt_rq_full_cnt=%u\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) "fcoe_tx_byte_cnt=%llu\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) "fcoe_tx_data_pkt_cnt=%llu\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) "fcoe_tx_xfer_pkt_cnt=%llu\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) "fcoe_tx_other_pkt_cnt=%llu\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) fw_fcoe_stats->fcoe_rx_byte_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) fw_fcoe_stats->fcoe_rx_data_pkt_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) fw_fcoe_stats->fcoe_rx_xfer_pkt_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) fw_fcoe_stats->fcoe_rx_other_pkt_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) fw_fcoe_stats->fcoe_silent_drop_pkt_cmdq_full_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) fw_fcoe_stats->fcoe_silent_drop_pkt_crc_error_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) fw_fcoe_stats->fcoe_silent_drop_pkt_task_invalid_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) fw_fcoe_stats->fcoe_silent_drop_total_pkt_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) fw_fcoe_stats->fcoe_silent_drop_pkt_rq_full_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) fw_fcoe_stats->fcoe_tx_byte_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) fw_fcoe_stats->fcoe_tx_data_pkt_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) fw_fcoe_stats->fcoe_tx_xfer_pkt_cnt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) fw_fcoe_stats->fcoe_tx_other_pkt_cnt);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) kfree(fw_fcoe_stats);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) out:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) qedf_dbg_offload_stats_open(struct inode *inode, struct file *file)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) struct qedf_dbg_ctx *qedf_dbg = inode->i_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) struct qedf_ctx *qedf = container_of(qedf_dbg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) struct qedf_ctx, dbg_ctx);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467) return single_open(file, qedf_offload_stats_show, qedf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) const struct file_operations qedf_dbg_fops[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471) qedf_dbg_fileops(qedf, fp_int),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) qedf_dbg_fileops_seq(qedf, io_trace),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) qedf_dbg_fileops(qedf, debug),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) qedf_dbg_fileops(qedf, stop_io_on_error),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) qedf_dbg_fileops_seq(qedf, driver_stats),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476) qedf_dbg_fileops(qedf, clear_stats),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) qedf_dbg_fileops_seq(qedf, offload_stats),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) /* This must be last */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479) { },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) #else /* CONFIG_DEBUG_FS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) void qedf_dbg_host_init(struct qedf_dbg_ctx *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) void qedf_dbg_host_exit(struct qedf_dbg_ctx *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485) void qedf_dbg_init(char *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) void qedf_dbg_exit(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) #endif /* CONFIG_DEBUG_FS */