/******************************************************************* * This file is part of the Emulex Linux Device Driver for * * Fibre Channel Host Bus Adapters. * * Copyright (C) 2017-2024 Broadcom. All Rights Reserved. The term * * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. * * Copyright (C) 2007-2015 Emulex. All rights reserved. * * EMULEX and SLI are trademarks of Emulex. * * www.broadcom.com * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of version 2 of the GNU General * * Public License as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful. * * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND * * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE * * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD * * TO BE LEGALLY INVALID. See the GNU General Public License for * * more details, a copy of which can be found in the file COPYING * * included with this package. * *******************************************************************/ #include <linux/blkdev.h> #include <linux/delay.h> #include <linux/module.h> #include <linux/dma-mapping.h> #include <linux/idr.h> #include <linux/interrupt.h> #include <linux/kthread.h> #include <linux/slab.h> #include <linux/pci.h> #include <linux/spinlock.h> #include <linux/ctype.h> #include <linux/vmalloc.h> #include <scsi/scsi.h> #include <scsi/scsi_device.h> #include <scsi/scsi_host.h> #include <scsi/scsi_transport_fc.h> #include <scsi/fc/fc_fs.h> #include "lpfc_hw4.h" #include "lpfc_hw.h" #include "lpfc_sli.h" #include "lpfc_sli4.h" #include "lpfc_nl.h" #include "lpfc_disc.h" #include "lpfc.h" #include "lpfc_scsi.h" #include "lpfc_nvme.h" #include "lpfc_logmsg.h" #include "lpfc_crtn.h" #include "lpfc_vport.h" #include "lpfc_version.h" #include "lpfc_compat.h" #include "lpfc_debugfs.h" #include "lpfc_bsg.h" #ifdef CONFIG_SCSI_LPFC_DEBUG_FS /* * debugfs interface * * To access this interface the user should: * # mount -t debugfs none /sys/kernel/debug * * The lpfc debugfs directory hierarchy is: * /sys/kernel/debug/lpfc/fnX/vportY * where X is the lpfc hba function unique_id * where Y is the vport VPI on that hba * * Debugging services available per vport: * discovery_trace * This is an ACSII readable file that contains a trace of the last * lpfc_debugfs_max_disc_trc events that happened on a specific vport. * See lpfc_debugfs.h for different categories of discovery events. * To enable the discovery trace, the following module parameters must be set: * lpfc_debugfs_enable=1 Turns on lpfc debugfs filesystem support * lpfc_debugfs_max_disc_trc=X Where X is the event trace depth for * EACH vport. X MUST also be a power of 2. * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in * lpfc_debugfs.h . * * slow_ring_trace * This is an ACSII readable file that contains a trace of the last * lpfc_debugfs_max_slow_ring_trc events that happened on a specific HBA. * To enable the slow ring trace, the following module parameters must be set: * lpfc_debugfs_enable=1 Turns on lpfc debugfs filesystem support * lpfc_debugfs_max_slow_ring_trc=X Where X is the event trace depth for * the HBA. X MUST also be a power of 2. */ static int lpfc_debugfs_enable = …; module_param(lpfc_debugfs_enable, int, S_IRUGO); MODULE_PARM_DESC(…) …; /* This MUST be a power of 2 */ static int lpfc_debugfs_max_disc_trc; module_param(lpfc_debugfs_max_disc_trc, int, S_IRUGO); MODULE_PARM_DESC(…) …; /* This MUST be a power of 2 */ static int lpfc_debugfs_max_slow_ring_trc; module_param(lpfc_debugfs_max_slow_ring_trc, int, S_IRUGO); MODULE_PARM_DESC(…) …; /* This MUST be a power of 2 */ static int lpfc_debugfs_max_nvmeio_trc; module_param(lpfc_debugfs_max_nvmeio_trc, int, 0444); MODULE_PARM_DESC(…) …; static int lpfc_debugfs_mask_disc_trc; module_param(lpfc_debugfs_mask_disc_trc, int, S_IRUGO); MODULE_PARM_DESC(…) …; #include <linux/debugfs.h> static atomic_t lpfc_debugfs_seq_trc_cnt = …; static unsigned long lpfc_debugfs_start_time = …; /* iDiag */ static struct lpfc_idiag idiag; /** * lpfc_debugfs_disc_trc_data - Dump discovery logging to a buffer * @vport: The vport to gather the log info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine gathers the lpfc discovery debugfs data from the @vport and * dumps it to @buf up to @size number of bytes. It will start at the next entry * in the log and process the log until the end of the buffer. Then it will * gather from the beginning of the log and process until the current entry. * * Notes: * Discovery logging will be disabled while while this routine dumps the log. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) { … } /** * lpfc_debugfs_slow_ring_trc_data - Dump slow ring logging to a buffer * @phba: The HBA to gather the log info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine gathers the lpfc slow ring debugfs data from the @phba and * dumps it to @buf up to @size number of bytes. It will start at the next entry * in the log and process the log until the end of the buffer. Then it will * gather from the beginning of the log and process until the current entry. * * Notes: * Slow ring logging will be disabled while while this routine dumps the log. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) { … } static int lpfc_debugfs_last_hbq = …; /** * lpfc_debugfs_hbqinfo_data - Dump host buffer queue info to a buffer * @phba: The HBA to gather host buffer info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the host buffer queue info from the @phba to @buf up to * @size number of bytes. A header that describes the current hbq state will be * dumped to @buf first and then info on each hbq entry will be dumped to @buf * until @size bytes have been dumped or all the hbq info has been dumped. * * Notes: * This routine will rotate through each configured HBQ each time called. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) { … } static int lpfc_debugfs_last_xripool; /** * lpfc_debugfs_commonxripools_data - Dump Hardware Queue info to a buffer * @phba: The HBA to gather host buffer info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the Hardware Queue info from the @phba to @buf up to * @size number of bytes. A header that describes the current hdwq state will be * dumped to @buf first and then info on each hdwq entry will be dumped to @buf * until @size bytes have been dumped or all the hdwq info has been dumped. * * Notes: * This routine will rotate through each configured Hardware Queue each * time called. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_commonxripools_data(struct lpfc_hba *phba, char *buf, int size) { … } /** * lpfc_debugfs_multixripools_data - Display multi-XRI pools information * @phba: The HBA to gather host buffer info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine displays current multi-XRI pools information including XRI * count in public, private and txcmplq. It also displays current high and * low watermark. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_multixripools_data(struct lpfc_hba *phba, char *buf, int size) { … } #ifdef LPFC_HDWQ_LOCK_STAT static int lpfc_debugfs_last_lock; /** * lpfc_debugfs_lockstat_data - Dump Hardware Queue info to a buffer * @phba: The HBA to gather host buffer info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the Hardware Queue info from the @phba to @buf up to * @size number of bytes. A header that describes the current hdwq state will be * dumped to @buf first and then info on each hdwq entry will be dumped to @buf * until @size bytes have been dumped or all the hdwq info has been dumped. * * Notes: * This routine will rotate through each configured Hardware Queue each * time called. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_lockstat_data(struct lpfc_hba *phba, char *buf, int size) { struct lpfc_sli4_hdw_queue *qp; int len = 0; int i; if (phba->sli_rev != LPFC_SLI_REV4) return 0; if (!phba->sli4_hba.hdwq) return 0; for (i = 0; i < phba->cfg_hdw_queue; i++) { if (len > (LPFC_HDWQINFO_SIZE - 100)) break; qp = &phba->sli4_hba.hdwq[lpfc_debugfs_last_lock]; len += scnprintf(buf + len, size - len, "HdwQ %03d Lock ", i); if (phba->cfg_xri_rebalancing) { len += scnprintf(buf + len, size - len, "get_pvt:%d mv_pvt:%d " "mv2pub:%d mv2pvt:%d " "put_pvt:%d put_pub:%d wq:%d\n", qp->lock_conflict.alloc_pvt_pool, qp->lock_conflict.mv_from_pvt_pool, qp->lock_conflict.mv_to_pub_pool, qp->lock_conflict.mv_to_pvt_pool, qp->lock_conflict.free_pvt_pool, qp->lock_conflict.free_pub_pool, qp->lock_conflict.wq_access); } else { len += scnprintf(buf + len, size - len, "get:%d put:%d free:%d wq:%d\n", qp->lock_conflict.alloc_xri_get, qp->lock_conflict.alloc_xri_put, qp->lock_conflict.free_xri, qp->lock_conflict.wq_access); } lpfc_debugfs_last_lock++; if (lpfc_debugfs_last_lock >= phba->cfg_hdw_queue) lpfc_debugfs_last_lock = 0; } return len; } #endif static int lpfc_debugfs_last_hba_slim_off; /** * lpfc_debugfs_dumpHBASlim_data - Dump HBA SLIM info to a buffer * @phba: The HBA to gather SLIM info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the current contents of HBA SLIM for the HBA associated * with @phba to @buf up to @size bytes of data. This is the raw HBA SLIM data. * * Notes: * This routine will only dump up to 1024 bytes of data each time called and * should be called multiple times to dump the entire HBA SLIM. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size) { … } /** * lpfc_debugfs_dumpHostSlim_data - Dump host SLIM info to a buffer * @phba: The HBA to gather Host SLIM info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the current contents of host SLIM for the host associated * with @phba to @buf up to @size bytes of data. The dump will contain the * Mailbox, PCB, Rings, and Registers that are located in host memory. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size) { … } /** * lpfc_debugfs_nodelist_data - Dump target node list to a buffer * @vport: The vport to gather target node info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the current target node list associated with @vport to * @buf up to @size bytes of data. Each node entry in the dump will contain a * node state, DID, WWPN, WWNN, RPI, flags, type, and other useful fields. * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) { … } /** * lpfc_debugfs_nvmestat_data - Dump target node list to a buffer * @vport: The vport to gather target node info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the NVME statistics associated with @vport * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_nvmestat_data(struct lpfc_vport *vport, char *buf, int size) { … } /** * lpfc_debugfs_scsistat_data - Dump target node list to a buffer * @vport: The vport to gather target node info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the SCSI statistics associated with @vport * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_scsistat_data(struct lpfc_vport *vport, char *buf, int size) { … } void lpfc_io_ktime(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) { … } /** * lpfc_debugfs_ioktime_data - Dump target node list to a buffer * @vport: The vport to gather target node info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the NVME statistics associated with @vport * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_ioktime_data(struct lpfc_vport *vport, char *buf, int size) { … } /** * lpfc_debugfs_nvmeio_trc_data - Dump NVME IO trace list to a buffer * @phba: The phba to gather target node info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the NVME IO trace associated with @phba * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_nvmeio_trc_data(struct lpfc_hba *phba, char *buf, int size) { … } /** * lpfc_debugfs_hdwqstat_data - Dump I/O stats to a buffer * @vport: The vport to gather target node info from. * @buf: The buffer to dump log into. * @size: The maximum amount of data to process. * * Description: * This routine dumps the NVME + SCSI statistics associated with @vport * * Return Value: * This routine returns the amount of bytes that were dumped into @buf and will * not exceed @size. **/ static int lpfc_debugfs_hdwqstat_data(struct lpfc_vport *vport, char *buf, int size) { … } #endif /** * lpfc_debugfs_disc_trc - Store discovery trace log * @vport: The vport to associate this trace string with for retrieval. * @mask: Log entry classification. * @fmt: Format string to be displayed when dumping the log. * @data1: 1st data parameter to be applied to @fmt. * @data2: 2nd data parameter to be applied to @fmt. * @data3: 3rd data parameter to be applied to @fmt. * * Description: * This routine is used by the driver code to add a debugfs log entry to the * discovery trace buffer associated with @vport. Only entries with a @mask that * match the current debugfs discovery mask will be saved. Entries that do not * match will be thrown away. @fmt, @data1, @data2, and @data3 are used like * printf when displaying the log. **/ inline void lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt, uint32_t data1, uint32_t data2, uint32_t data3) { … } /** * lpfc_debugfs_slow_ring_trc - Store slow ring trace log * @phba: The phba to associate this trace string with for retrieval. * @fmt: Format string to be displayed when dumping the log. * @data1: 1st data parameter to be applied to @fmt. * @data2: 2nd data parameter to be applied to @fmt. * @data3: 3rd data parameter to be applied to @fmt. * * Description: * This routine is used by the driver code to add a debugfs log entry to the * discovery trace buffer associated with @vport. @fmt, @data1, @data2, and * @data3 are used like printf when displaying the log. **/ inline void lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt, uint32_t data1, uint32_t data2, uint32_t data3) { … } /** * lpfc_debugfs_nvme_trc - Store NVME/NVMET trace log * @phba: The phba to associate this trace string with for retrieval. * @fmt: Format string to be displayed when dumping the log. * @data1: 1st data parameter to be applied to @fmt. * @data2: 2nd data parameter to be applied to @fmt. * @data3: 3rd data parameter to be applied to @fmt. * * Description: * This routine is used by the driver code to add a debugfs log entry to the * nvme trace buffer associated with @phba. @fmt, @data1, @data2, and * @data3 are used like printf when displaying the log. **/ inline void lpfc_debugfs_nvme_trc(struct lpfc_hba *phba, char *fmt, uint16_t data1, uint16_t data2, uint32_t data3) { … } #ifdef CONFIG_SCSI_LPFC_DEBUG_FS /** * lpfc_debugfs_disc_trc_open - Open the discovery trace log * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_slow_ring_trc_open - Open the Slow Ring trace log * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_hbqinfo_open - Open the hbqinfo debugfs buffer * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_multixripools_open - Open the multixripool debugfs buffer * @inode: The inode pointer that contains a hba pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the hba from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this hba, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_multixripools_open(struct inode *inode, struct file *file) { … } #ifdef LPFC_HDWQ_LOCK_STAT /** * lpfc_debugfs_lockstat_open - Open the lockstat debugfs buffer * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_lockstat_open(struct inode *inode, struct file *file) { struct lpfc_hba *phba = inode->i_private; struct lpfc_debug *debug; int rc = -ENOMEM; debug = kmalloc(sizeof(*debug), GFP_KERNEL); if (!debug) goto out; /* Round to page boundary */ debug->buffer = kmalloc(LPFC_HDWQINFO_SIZE, GFP_KERNEL); if (!debug->buffer) { kfree(debug); goto out; } debug->len = lpfc_debugfs_lockstat_data(phba, debug->buffer, LPFC_HBQINFO_SIZE); file->private_data = debug; rc = 0; out: return rc; } static ssize_t lpfc_debugfs_lockstat_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { struct lpfc_debug *debug = file->private_data; struct lpfc_hba *phba = (struct lpfc_hba *)debug->i_private; struct lpfc_sli4_hdw_queue *qp; char mybuf[64]; char *pbuf; int i; size_t bsize; memset(mybuf, 0, sizeof(mybuf)); bsize = min(nbytes, (sizeof(mybuf) - 1)); if (copy_from_user(mybuf, buf, bsize)) return -EFAULT; pbuf = &mybuf[0]; if ((strncmp(pbuf, "reset", strlen("reset")) == 0) || (strncmp(pbuf, "zero", strlen("zero")) == 0)) { for (i = 0; i < phba->cfg_hdw_queue; i++) { qp = &phba->sli4_hba.hdwq[i]; qp->lock_conflict.alloc_xri_get = 0; qp->lock_conflict.alloc_xri_put = 0; qp->lock_conflict.free_xri = 0; qp->lock_conflict.wq_access = 0; qp->lock_conflict.alloc_pvt_pool = 0; qp->lock_conflict.mv_from_pvt_pool = 0; qp->lock_conflict.mv_to_pub_pool = 0; qp->lock_conflict.mv_to_pvt_pool = 0; qp->lock_conflict.free_pvt_pool = 0; qp->lock_conflict.free_pub_pool = 0; qp->lock_conflict.wq_access = 0; } } return bsize; } #endif static int lpfc_debugfs_ras_log_data(struct lpfc_hba *phba, char *buffer, int size) { … } static int lpfc_debugfs_ras_log_release(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_ras_log_open - Open the RAS log debugfs buffer * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_ras_log_open(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_dumpHBASlim_open - Open the Dump HBA SLIM debugfs buffer * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_dumpHBASlim_open(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_dumpHostSlim_open - Open the Dump Host SLIM debugfs buffer * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_dumpHostSlim_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } static ssize_t lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_debugfs_dif_err_release(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_nodelist_open - Open the nodelist debugfs file * @inode: The inode pointer that contains a vport pointer. * @file: The file pointer to attach the log output. * * Description: * This routine is the entry point for the debugfs open file operation. It gets * the vport from the i_private field in @inode, allocates the necessary buffer * for the log, fills the buffer from the in-memory log for this vport, and then * returns a pointer to that log in the private_data field in @file. * * Returns: * This function returns zero if successful. On error it will return a negative * error value. **/ static int lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_lseek - Seek through a debugfs file * @file: The file pointer to seek through. * @off: The offset to seek to or the amount to seek by. * @whence: Indicates how to seek. * * Description: * This routine is the entry point for the debugfs lseek file operation. The * @whence parameter indicates whether @off is the offset to directly seek to, * or if it is a value to seek forward or reverse by. This function figures out * what the new offset of the debugfs file will be and assigns that value to the * f_pos field of @file. * * Returns: * This function returns the new offset if successful and returns a negative * error if unable to process the seek. **/ static loff_t lpfc_debugfs_lseek(struct file *file, loff_t off, int whence) { … } /** * lpfc_debugfs_read - Read a debugfs file * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from from the buffer indicated in the private_data * field of @file. It will start reading at @ppos and copy up to @nbytes of * data to @buf. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_debugfs_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_debugfs_release - Release the buffer used to store debugfs file data * @inode: The inode pointer that contains a vport pointer. (unused) * @file: The file pointer that contains the buffer to release. * * Description: * This routine frees the buffer that was allocated when the debugfs file was * opened. * * Returns: * This function returns zero. **/ static int lpfc_debugfs_release(struct inode *inode, struct file *file) { … } /** * lpfc_debugfs_multixripools_write - Clear multi-XRI pools statistics * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * Description: * This routine clears multi-XRI pools statistics when buf contains "clear". * * Return Value: * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. **/ static ssize_t lpfc_debugfs_multixripools_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_debugfs_nvmestat_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_debugfs_nvmestat_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_debugfs_scsistat_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_debugfs_scsistat_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_debugfs_ioktime_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_debugfs_ioktime_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_debugfs_nvmeio_trc_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_debugfs_nvmeio_trc_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_debugfs_hdwqstat_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_debugfs_hdwqstat_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } /* * --------------------------------- * iDiag debugfs file access methods * --------------------------------- * * All access methods are through the proper SLI4 PCI function's debugfs * iDiag directory: * * /sys/kernel/debug/lpfc/fn<#>/iDiag */ /** * lpfc_idiag_cmd_get - Get and parse idiag debugfs comands from user space * @buf: The pointer to the user space buffer. * @nbytes: The number of bytes in the user space buffer. * @idiag_cmd: pointer to the idiag command struct. * * This routine reads data from debugfs user space buffer and parses the * buffer for getting the idiag command and arguments. The while space in * between the set of data is used as the parsing separator. * * This routine returns 0 when successful, it returns proper error code * back to the user space in error conditions. */ static int lpfc_idiag_cmd_get(const char __user *buf, size_t nbytes, struct lpfc_idiag_cmd *idiag_cmd) { … } /** * lpfc_idiag_open - idiag open debugfs * @inode: The inode pointer that contains a pointer to phba. * @file: The file pointer to attach the file operation. * * Description: * This routine is the entry point for the debugfs open file operation. It * gets the reference to phba from the i_private field in @inode, it then * allocates buffer for the file operation, performs the necessary PCI config * space read into the allocated buffer according to the idiag user command * setup, and then returns a pointer to buffer in the private_data field in * @file. * * Returns: * This function returns zero if successful. On error it will return an * negative error value. **/ static int lpfc_idiag_open(struct inode *inode, struct file *file) { … } /** * lpfc_idiag_release - Release idiag access file operation * @inode: The inode pointer that contains a vport pointer. (unused) * @file: The file pointer that contains the buffer to release. * * Description: * This routine is the generic release routine for the idiag access file * operation, it frees the buffer that was allocated when the debugfs file * was opened. * * Returns: * This function returns zero. **/ static int lpfc_idiag_release(struct inode *inode, struct file *file) { … } /** * lpfc_idiag_cmd_release - Release idiag cmd access file operation * @inode: The inode pointer that contains a vport pointer. (unused) * @file: The file pointer that contains the buffer to release. * * Description: * This routine frees the buffer that was allocated when the debugfs file * was opened. It also reset the fields in the idiag command struct in the * case of command for write operation. * * Returns: * This function returns zero. **/ static int lpfc_idiag_cmd_release(struct inode *inode, struct file *file) { … } /** * lpfc_idiag_pcicfg_read - idiag debugfs read pcicfg * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the @phba pci config space according to the * idiag command, and copies to user @buf. Depending on the PCI config space * read command setup, it does either a single register read of a byte * (8 bits), a word (16 bits), or a dword (32 bits) or browsing through all * registers from the 4K extended PCI config space. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_pcicfg_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_pcicfg_write - Syntax check and set up idiag pcicfg commands * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * This routine get the debugfs idiag command struct from user space and * then perform the syntax check for PCI config space read or write command * accordingly. In the case of PCI config space read command, it sets up * the command in the idiag command struct for the debugfs read operation. * In the case of PCI config space write operation, it executes the write * operation into the PCI config space accordingly. * * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. */ static ssize_t lpfc_idiag_pcicfg_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_baracc_read - idiag debugfs pci bar access read * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the @phba pci bar memory mapped space * according to the idiag command, and copies to user @buf. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_baracc_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_baracc_write - Syntax check and set up idiag bar access commands * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * This routine get the debugfs idiag command struct from user space and * then perform the syntax check for PCI bar memory mapped space read or * write command accordingly. In the case of PCI bar memory mapped space * read command, it sets up the command in the idiag command struct for * the debugfs read operation. In the case of PCI bar memorpy mapped space * write operation, it executes the write operation into the PCI bar memory * mapped space accordingly. * * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. */ static ssize_t lpfc_idiag_baracc_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } static int __lpfc_idiag_print_wq(struct lpfc_queue *qp, char *wqtype, char *pbuffer, int len) { … } static int lpfc_idiag_wqs_for_cq(struct lpfc_hba *phba, char *wqtype, char *pbuffer, int *len, int max_cnt, int cq_id) { … } static int __lpfc_idiag_print_cq(struct lpfc_queue *qp, char *cqtype, char *pbuffer, int len) { … } static int __lpfc_idiag_print_rqpair(struct lpfc_queue *qp, struct lpfc_queue *datqp, char *rqtype, char *pbuffer, int len) { … } static int lpfc_idiag_cqs_for_eq(struct lpfc_hba *phba, char *pbuffer, int *len, int max_cnt, int eqidx, int eq_id) { … } static int __lpfc_idiag_print_eq(struct lpfc_queue *qp, char *eqtype, char *pbuffer, int len) { … } /** * lpfc_idiag_queinfo_read - idiag debugfs read queue information * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the @phba SLI4 PCI function queue information, * and copies to user @buf. * This routine only returns 1 EQs worth of information. It remembers the last * EQ read and jumps to the next EQ. Thus subsequent calls to queInfo will * retrieve all EQs allocated for the phba. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_queinfo_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_que_param_check - queue access command parameter sanity check * @q: The pointer to queue structure. * @index: The index into a queue entry. * @count: The number of queue entries to access. * * Description: * The routine performs sanity check on device queue access method commands. * * Returns: * This function returns -EINVAL when fails the sanity check, otherwise, it * returns 0. **/ static int lpfc_idiag_que_param_check(struct lpfc_queue *q, int index, int count) { … } /** * lpfc_idiag_queacc_read_qe - read a single entry from the given queue index * @pbuffer: The pointer to buffer to copy the read data into. * @len: Length of the buffer. * @pque: The pointer to the queue to be read. * @index: The index into the queue entry. * * Description: * This routine reads out a single entry from the given queue's index location * and copies it into the buffer provided. * * Returns: * This function returns 0 when it fails, otherwise, it returns the length of * the data read into the buffer provided. **/ static int lpfc_idiag_queacc_read_qe(char *pbuffer, int len, struct lpfc_queue *pque, uint32_t index) { … } /** * lpfc_idiag_queacc_read - idiag debugfs read port queue * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the @phba device queue memory according to the * idiag command, and copies to user @buf. Depending on the queue dump read * command setup, it does either a single queue entry read or browing through * all entries of the queue. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_queacc_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_queacc_write - Syntax check and set up idiag queacc commands * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * This routine get the debugfs idiag command struct from user space and then * perform the syntax check for port queue read (dump) or write (set) command * accordingly. In the case of port queue read command, it sets up the command * in the idiag command struct for the following debugfs read operation. In * the case of port queue write operation, it executes the write operation * into the port queue entry accordingly. * * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. **/ static ssize_t lpfc_idiag_queacc_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_drbacc_read_reg - idiag debugfs read a doorbell register * @phba: The pointer to hba structure. * @pbuffer: The pointer to the buffer to copy the data to. * @len: The length of bytes to copied. * @drbregid: The id to doorbell registers. * * Description: * This routine reads a doorbell register and copies its content to the * user buffer pointed to by @pbuffer. * * Returns: * This function returns the amount of data that was copied into @pbuffer. **/ static int lpfc_idiag_drbacc_read_reg(struct lpfc_hba *phba, char *pbuffer, int len, uint32_t drbregid) { … } /** * lpfc_idiag_drbacc_read - idiag debugfs read port doorbell * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the @phba device doorbell register according * to the idiag command, and copies to user @buf. Depending on the doorbell * register read command setup, it does either a single doorbell register * read or dump all doorbell registers. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_drbacc_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_drbacc_write - Syntax check and set up idiag drbacc commands * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * This routine get the debugfs idiag command struct from user space and then * perform the syntax check for port doorbell register read (dump) or write * (set) command accordingly. In the case of port queue read command, it sets * up the command in the idiag command struct for the following debugfs read * operation. In the case of port doorbell register write operation, it * executes the write operation into the port doorbell register accordingly. * * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. **/ static ssize_t lpfc_idiag_drbacc_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_ctlacc_read_reg - idiag debugfs read a control registers * @phba: The pointer to hba structure. * @pbuffer: The pointer to the buffer to copy the data to. * @len: The length of bytes to copied. * @ctlregid: The id to doorbell registers. * * Description: * This routine reads a control register and copies its content to the * user buffer pointed to by @pbuffer. * * Returns: * This function returns the amount of data that was copied into @pbuffer. **/ static int lpfc_idiag_ctlacc_read_reg(struct lpfc_hba *phba, char *pbuffer, int len, uint32_t ctlregid) { … } /** * lpfc_idiag_ctlacc_read - idiag debugfs read port and device control register * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the @phba port and device registers according * to the idiag command, and copies to user @buf. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_ctlacc_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_ctlacc_write - Syntax check and set up idiag ctlacc commands * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * This routine get the debugfs idiag command struct from user space and then * perform the syntax check for port and device control register read (dump) * or write (set) command accordingly. * * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. **/ static ssize_t lpfc_idiag_ctlacc_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_mbxacc_get_setup - idiag debugfs get mailbox access setup * @phba: Pointer to HBA context object. * @pbuffer: Pointer to data buffer. * * Description: * This routine gets the driver mailbox access debugfs setup information. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static int lpfc_idiag_mbxacc_get_setup(struct lpfc_hba *phba, char *pbuffer) { … } /** * lpfc_idiag_mbxacc_read - idiag debugfs read on mailbox access * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the @phba driver mailbox access debugfs setup * information. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_mbxacc_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_mbxacc_write - Syntax check and set up idiag mbxacc commands * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * This routine get the debugfs idiag command struct from user space and then * perform the syntax check for driver mailbox command (dump) and sets up the * necessary states in the idiag command struct accordingly. * * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. **/ static ssize_t lpfc_idiag_mbxacc_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_extacc_avail_get - get the available extents information * @phba: pointer to lpfc hba data structure. * @pbuffer: pointer to internal buffer. * @len: length into the internal buffer data has been copied. * * Description: * This routine is to get the available extent information. * * Returns: * overall length of the data read into the internal buffer. **/ static int lpfc_idiag_extacc_avail_get(struct lpfc_hba *phba, char *pbuffer, int len) { … } /** * lpfc_idiag_extacc_alloc_get - get the allocated extents information * @phba: pointer to lpfc hba data structure. * @pbuffer: pointer to internal buffer. * @len: length into the internal buffer data has been copied. * * Description: * This routine is to get the allocated extent information. * * Returns: * overall length of the data read into the internal buffer. **/ static int lpfc_idiag_extacc_alloc_get(struct lpfc_hba *phba, char *pbuffer, int len) { … } /** * lpfc_idiag_extacc_drivr_get - get driver extent information * @phba: pointer to lpfc hba data structure. * @pbuffer: pointer to internal buffer. * @len: length into the internal buffer data has been copied. * * Description: * This routine is to get the driver extent information. * * Returns: * overall length of the data read into the internal buffer. **/ static int lpfc_idiag_extacc_drivr_get(struct lpfc_hba *phba, char *pbuffer, int len) { … } /** * lpfc_idiag_extacc_write - Syntax check and set up idiag extacc commands * @file: The file pointer to read from. * @buf: The buffer to copy the user data from. * @nbytes: The number of bytes to get. * @ppos: The position in the file to start reading from. * * This routine get the debugfs idiag command struct from user space and then * perform the syntax check for extent information access commands and sets * up the necessary states in the idiag command struct accordingly. * * It returns the @nbytges passing in from debugfs user space when successful. * In case of error conditions, it returns proper error code back to the user * space. **/ static ssize_t lpfc_idiag_extacc_write(struct file *file, const char __user *buf, size_t nbytes, loff_t *ppos) { … } /** * lpfc_idiag_extacc_read - idiag debugfs read access to extent information * @file: The file pointer to read from. * @buf: The buffer to copy the data to. * @nbytes: The number of bytes to read. * @ppos: The position in the file to start reading from. * * Description: * This routine reads data from the proper extent information according to * the idiag command, and copies to user @buf. * * Returns: * This function returns the amount of data that was read (this could be less * than @nbytes if the end of the file was reached) or a negative error value. **/ static ssize_t lpfc_idiag_extacc_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_cgn_buffer_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_cgn_buffer_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_cgn_buffer_release(struct inode *inode, struct file *file) { … } static int lpfc_rx_monitor_open(struct inode *inode, struct file *file) { … } static ssize_t lpfc_rx_monitor_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos) { … } static int lpfc_rx_monitor_release(struct inode *inode, struct file *file) { … } #undef lpfc_debugfs_op_disc_trc static const struct file_operations lpfc_debugfs_op_disc_trc = …; #undef lpfc_debugfs_op_nodelist static const struct file_operations lpfc_debugfs_op_nodelist = …; #undef lpfc_debugfs_op_multixripools static const struct file_operations lpfc_debugfs_op_multixripools = …; #undef lpfc_debugfs_op_hbqinfo static const struct file_operations lpfc_debugfs_op_hbqinfo = …; #ifdef LPFC_HDWQ_LOCK_STAT #undef lpfc_debugfs_op_lockstat static const struct file_operations lpfc_debugfs_op_lockstat = { .owner = THIS_MODULE, .open = lpfc_debugfs_lockstat_open, .llseek = lpfc_debugfs_lseek, .read = lpfc_debugfs_read, .write = lpfc_debugfs_lockstat_write, .release = lpfc_debugfs_release, }; #endif #undef lpfc_debugfs_ras_log static const struct file_operations lpfc_debugfs_ras_log = …; #undef lpfc_debugfs_op_dumpHBASlim static const struct file_operations lpfc_debugfs_op_dumpHBASlim = …; #undef lpfc_debugfs_op_dumpHostSlim static const struct file_operations lpfc_debugfs_op_dumpHostSlim = …; #undef lpfc_debugfs_op_nvmestat static const struct file_operations lpfc_debugfs_op_nvmestat = …; #undef lpfc_debugfs_op_scsistat static const struct file_operations lpfc_debugfs_op_scsistat = …; #undef lpfc_debugfs_op_ioktime static const struct file_operations lpfc_debugfs_op_ioktime = …; #undef lpfc_debugfs_op_nvmeio_trc static const struct file_operations lpfc_debugfs_op_nvmeio_trc = …; #undef lpfc_debugfs_op_hdwqstat static const struct file_operations lpfc_debugfs_op_hdwqstat = …; #undef lpfc_debugfs_op_dif_err static const struct file_operations lpfc_debugfs_op_dif_err = …; #undef lpfc_debugfs_op_slow_ring_trc static const struct file_operations lpfc_debugfs_op_slow_ring_trc = …; static struct dentry *lpfc_debugfs_root = …; static atomic_t lpfc_debugfs_hba_count; /* * File operations for the iDiag debugfs */ #undef lpfc_idiag_op_pciCfg static const struct file_operations lpfc_idiag_op_pciCfg = …; #undef lpfc_idiag_op_barAcc static const struct file_operations lpfc_idiag_op_barAcc = …; #undef lpfc_idiag_op_queInfo static const struct file_operations lpfc_idiag_op_queInfo = …; #undef lpfc_idiag_op_queAcc static const struct file_operations lpfc_idiag_op_queAcc = …; #undef lpfc_idiag_op_drbAcc static const struct file_operations lpfc_idiag_op_drbAcc = …; #undef lpfc_idiag_op_ctlAcc static const struct file_operations lpfc_idiag_op_ctlAcc = …; #undef lpfc_idiag_op_mbxAcc static const struct file_operations lpfc_idiag_op_mbxAcc = …; #undef lpfc_idiag_op_extAcc static const struct file_operations lpfc_idiag_op_extAcc = …; #undef lpfc_cgn_buffer_op static const struct file_operations lpfc_cgn_buffer_op = …; #undef lpfc_rx_monitor_op static const struct file_operations lpfc_rx_monitor_op = …; #endif /* lpfc_idiag_mbxacc_dump_bsg_mbox - idiag debugfs dump bsg mailbox command * @phba: Pointer to HBA context object. * @dmabuf: Pointer to a DMA buffer descriptor. * * Description: * This routine dump a bsg pass-through non-embedded mailbox command with * external buffer. **/ void lpfc_idiag_mbxacc_dump_bsg_mbox(struct lpfc_hba *phba, enum nemb_type nemb_tp, enum mbox_type mbox_tp, enum dma_type dma_tp, enum sta_type sta_tp, struct lpfc_dmabuf *dmabuf, uint32_t ext_buf) { … } /* lpfc_idiag_mbxacc_dump_issue_mbox - idiag debugfs dump issue mailbox command * @phba: Pointer to HBA context object. * @dmabuf: Pointer to a DMA buffer descriptor. * * Description: * This routine dump a pass-through non-embedded mailbox command from issue * mailbox command. **/ void lpfc_idiag_mbxacc_dump_issue_mbox(struct lpfc_hba *phba, MAILBOX_t *pmbox) { … } /** * lpfc_debugfs_initialize - Initialize debugfs for a vport * @vport: The vport pointer to initialize. * * Description: * When Debugfs is configured this routine sets up the lpfc debugfs file system. * If not already created, this routine will create the lpfc directory, and * lpfcX directory (for this HBA), and vportX directory for this vport. It will * also create each file used to access lpfc specific debugfs information. **/ inline void lpfc_debugfs_initialize(struct lpfc_vport *vport) { … } /** * lpfc_debugfs_terminate - Tear down debugfs infrastructure for this vport * @vport: The vport pointer to remove from debugfs. * * Description: * When Debugfs is configured this routine removes debugfs file system elements * that are specific to this vport. It also checks to see if there are any * users left for the debugfs directories associated with the HBA and driver. If * this is the last user of the HBA directory or driver directory then it will * remove those from the debugfs infrastructure as well. **/ inline void lpfc_debugfs_terminate(struct lpfc_vport *vport) { … } /* * Driver debug utility routines outside of debugfs. The debug utility * routines implemented here is intended to be used in the instrumented * debug driver for debugging host or port issues. */ /** * lpfc_debug_dump_all_queues - dump all the queues with a hba * @phba: Pointer to HBA context object. * * This function dumps entries of all the queues asociated with the @phba. **/ void lpfc_debug_dump_all_queues(struct lpfc_hba *phba) { … }