aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_debugfs.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_debugfs.c327
1 files changed, 310 insertions, 17 deletions
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 094b47e94b29..2588eadffbb9 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -1,7 +1,7 @@
1/******************************************************************* 1/*******************************************************************
2 * This file is part of the Emulex Linux Device Driver for * 2 * This file is part of the Emulex Linux Device Driver for *
3 * Fibre Channel Host Bus Adapters. * 3 * Fibre Channel Host Bus Adapters. *
4 * Copyright (C) 2007 Emulex. All rights reserved. * 4 * Copyright (C) 2007-2008 Emulex. All rights reserved. *
5 * EMULEX and SLI are trademarks of Emulex. * 5 * EMULEX and SLI are trademarks of Emulex. *
6 * www.emulex.com * 6 * www.emulex.com *
7 * * 7 * *
@@ -46,13 +46,14 @@
46#include "lpfc_debugfs.h" 46#include "lpfc_debugfs.h"
47 47
48#ifdef CONFIG_LPFC_DEBUG_FS 48#ifdef CONFIG_LPFC_DEBUG_FS
49/* debugfs interface 49/**
50 * debugfs interface
50 * 51 *
51 * To access this interface the user should: 52 * To access this interface the user should:
52 * # mkdir /debug 53 * # mkdir /debug
53 * # mount -t debugfs none /debug 54 * # mount -t debugfs none /debug
54 * 55 *
55 * The lpfc debugfs directory hierachy is: 56 * The lpfc debugfs directory hierarchy is:
56 * lpfc/lpfcX/vportY 57 * lpfc/lpfcX/vportY
57 * where X is the lpfc hba unique_id 58 * where X is the lpfc hba unique_id
58 * where Y is the vport VPI on that hba 59 * where Y is the vport VPI on that hba
@@ -61,14 +62,21 @@
61 * discovery_trace 62 * discovery_trace
62 * This is an ACSII readable file that contains a trace of the last 63 * This is an ACSII readable file that contains a trace of the last
63 * lpfc_debugfs_max_disc_trc events that happened on a specific vport. 64 * lpfc_debugfs_max_disc_trc events that happened on a specific vport.
64 * See lpfc_debugfs.h for different categories of 65 * See lpfc_debugfs.h for different categories of discovery events.
65 * discovery events. To enable the discovery trace, the following 66 * To enable the discovery trace, the following module parameters must be set:
66 * module parameters must be set:
67 * lpfc_debugfs_enable=1 Turns on lpfc debugfs filesystem support 67 * lpfc_debugfs_enable=1 Turns on lpfc debugfs filesystem support
68 * lpfc_debugfs_max_disc_trc=X Where X is the event trace depth for 68 * lpfc_debugfs_max_disc_trc=X Where X is the event trace depth for
69 * EACH vport. X MUST also be a power of 2. 69 * EACH vport. X MUST also be a power of 2.
70 * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in 70 * lpfc_debugfs_mask_disc_trc=Y Where Y is an event mask as defined in
71 * lpfc_debugfs.h . 71 * lpfc_debugfs.h .
72 *
73 * slow_ring_trace
74 * This is an ACSII readable file that contains a trace of the last
75 * lpfc_debugfs_max_slow_ring_trc events that happened on a specific HBA.
76 * To enable the slow ring trace, the following module parameters must be set:
77 * lpfc_debugfs_enable=1 Turns on lpfc debugfs filesystem support
78 * lpfc_debugfs_max_slow_ring_trc=X Where X is the event trace depth for
79 * the HBA. X MUST also be a power of 2.
72 */ 80 */
73static int lpfc_debugfs_enable = 1; 81static int lpfc_debugfs_enable = 1;
74module_param(lpfc_debugfs_enable, int, 0); 82module_param(lpfc_debugfs_enable, int, 0);
@@ -117,6 +125,25 @@ struct lpfc_debug {
117static atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0); 125static atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0);
118static unsigned long lpfc_debugfs_start_time = 0L; 126static unsigned long lpfc_debugfs_start_time = 0L;
119 127
128/**
129 * lpfc_debugfs_disc_trc_data - Dump discovery logging to a buffer.
130 * @vport: The vport to gather the log info from.
131 * @buf: The buffer to dump log into.
132 * @size: The maximum amount of data to process.
133 *
134 * Description:
135 * This routine gathers the lpfc discovery debugfs data from the @vport and
136 * dumps it to @buf up to @size number of bytes. It will start at the next entry
137 * in the log and process the log until the end of the buffer. Then it will
138 * gather from the beginning of the log and process until the current entry.
139 *
140 * Notes:
141 * Discovery logging will be disabled while while this routine dumps the log.
142 *
143 * Return Value:
144 * This routine returns the amount of bytes that were dumped into @buf and will
145 * not exceed @size.
146 **/
120static int 147static int
121lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size) 148lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
122{ 149{
@@ -125,7 +152,6 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
125 struct lpfc_debugfs_trc *dtp; 152 struct lpfc_debugfs_trc *dtp;
126 char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE]; 153 char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE];
127 154
128
129 enable = lpfc_debugfs_enable; 155 enable = lpfc_debugfs_enable;
130 lpfc_debugfs_enable = 0; 156 lpfc_debugfs_enable = 0;
131 157
@@ -159,6 +185,25 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
159 return len; 185 return len;
160} 186}
161 187
188/**
189 * lpfc_debugfs_slow_ring_trc_data - Dump slow ring logging to a buffer.
190 * @phba: The HBA to gather the log info from.
191 * @buf: The buffer to dump log into.
192 * @size: The maximum amount of data to process.
193 *
194 * Description:
195 * This routine gathers the lpfc slow ring debugfs data from the @phba and
196 * dumps it to @buf up to @size number of bytes. It will start at the next entry
197 * in the log and process the log until the end of the buffer. Then it will
198 * gather from the beginning of the log and process until the current entry.
199 *
200 * Notes:
201 * Slow ring logging will be disabled while while this routine dumps the log.
202 *
203 * Return Value:
204 * This routine returns the amount of bytes that were dumped into @buf and will
205 * not exceed @size.
206 **/
162static int 207static int
163lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size) 208lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size)
164{ 209{
@@ -203,6 +248,25 @@ lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size)
203 248
204static int lpfc_debugfs_last_hbq = -1; 249static int lpfc_debugfs_last_hbq = -1;
205 250
251/**
252 * lpfc_debugfs_hbqinfo_data - Dump host buffer queue info to a buffer.
253 * @phba: The HBA to gather host buffer info from.
254 * @buf: The buffer to dump log into.
255 * @size: The maximum amount of data to process.
256 *
257 * Description:
258 * This routine dumps the host buffer queue info from the @phba to @buf up to
259 * @size number of bytes. A header that describes the current hbq state will be
260 * dumped to @buf first and then info on each hbq entry will be dumped to @buf
261 * until @size bytes have been dumped or all the hbq info has been dumped.
262 *
263 * Notes:
264 * This routine will rotate through each configured HBQ each time called.
265 *
266 * Return Value:
267 * This routine returns the amount of bytes that were dumped into @buf and will
268 * not exceed @size.
269 **/
206static int 270static int
207lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size) 271lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size)
208{ 272{
@@ -303,6 +367,24 @@ skipit:
303 367
304static int lpfc_debugfs_last_hba_slim_off; 368static int lpfc_debugfs_last_hba_slim_off;
305 369
370/**
371 * lpfc_debugfs_dumpHBASlim_data - Dump HBA SLIM info to a buffer.
372 * @phba: The HBA to gather SLIM info from.
373 * @buf: The buffer to dump log into.
374 * @size: The maximum amount of data to process.
375 *
376 * Description:
377 * This routine dumps the current contents of HBA SLIM for the HBA associated
378 * with @phba to @buf up to @size bytes of data. This is the raw HBA SLIM data.
379 *
380 * Notes:
381 * This routine will only dump up to 1024 bytes of data each time called and
382 * should be called multiple times to dump the entire HBA SLIM.
383 *
384 * Return Value:
385 * This routine returns the amount of bytes that were dumped into @buf and will
386 * not exceed @size.
387 **/
306static int 388static int
307lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size) 389lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size)
308{ 390{
@@ -342,6 +424,21 @@ lpfc_debugfs_dumpHBASlim_data(struct lpfc_hba *phba, char *buf, int size)
342 return len; 424 return len;
343} 425}
344 426
427/**
428 * lpfc_debugfs_dumpHostSlim_data - Dump host SLIM info to a buffer.
429 * @phba: The HBA to gather Host SLIM info from.
430 * @buf: The buffer to dump log into.
431 * @size: The maximum amount of data to process.
432 *
433 * Description:
434 * This routine dumps the current contents of host SLIM for the host associated
435 * with @phba to @buf up to @size bytes of data. The dump will contain the
436 * Mailbox, PCB, Rings, and Registers that are located in host memory.
437 *
438 * Return Value:
439 * This routine returns the amount of bytes that were dumped into @buf and will
440 * not exceed @size.
441 **/
345static int 442static int
346lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size) 443lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size)
347{ 444{
@@ -430,6 +527,21 @@ lpfc_debugfs_dumpHostSlim_data(struct lpfc_hba *phba, char *buf, int size)
430 return len; 527 return len;
431} 528}
432 529
530/**
531 * lpfc_debugfs_nodelist_data - Dump target node list to a buffer.
532 * @vport: The vport to gather target node info from.
533 * @buf: The buffer to dump log into.
534 * @size: The maximum amount of data to process.
535 *
536 * Description:
537 * This routine dumps the current target node list associated with @vport to
538 * @buf up to @size bytes of data. Each node entry in the dump will contain a
539 * node state, DID, WWPN, WWNN, RPI, flags, type, and other useful fields.
540 *
541 * Return Value:
542 * This routine returns the amount of bytes that were dumped into @buf and will
543 * not exceed @size.
544 **/
433static int 545static int
434lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) 546lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
435{ 547{
@@ -513,7 +625,22 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
513} 625}
514#endif 626#endif
515 627
516 628/**
629 * lpfc_debugfs_disc_trc - Store discovery trace log.
630 * @vport: The vport to associate this trace string with for retrieval.
631 * @mask: Log entry classification.
632 * @fmt: Format string to be displayed when dumping the log.
633 * @data1: 1st data parameter to be applied to @fmt.
634 * @data2: 2nd data parameter to be applied to @fmt.
635 * @data3: 3rd data parameter to be applied to @fmt.
636 *
637 * Description:
638 * This routine is used by the driver code to add a debugfs log entry to the
639 * discovery trace buffer associated with @vport. Only entries with a @mask that
640 * match the current debugfs discovery mask will be saved. Entries that do not
641 * match will be thrown away. @fmt, @data1, @data2, and @data3 are used like
642 * printf when displaying the log.
643 **/
517inline void 644inline void
518lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt, 645lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt,
519 uint32_t data1, uint32_t data2, uint32_t data3) 646 uint32_t data1, uint32_t data2, uint32_t data3)
@@ -542,6 +669,19 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt,
542 return; 669 return;
543} 670}
544 671
672/**
673 * lpfc_debugfs_slow_ring_trc - Store slow ring trace log.
674 * @phba: The phba to associate this trace string with for retrieval.
675 * @fmt: Format string to be displayed when dumping the log.
676 * @data1: 1st data parameter to be applied to @fmt.
677 * @data2: 2nd data parameter to be applied to @fmt.
678 * @data3: 3rd data parameter to be applied to @fmt.
679 *
680 * Description:
681 * This routine is used by the driver code to add a debugfs log entry to the
682 * discovery trace buffer associated with @vport. @fmt, @data1, @data2, and
683 * @data3 are used like printf when displaying the log.
684 **/
545inline void 685inline void
546lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt, 686lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt,
547 uint32_t data1, uint32_t data2, uint32_t data3) 687 uint32_t data1, uint32_t data2, uint32_t data3)
@@ -568,6 +708,21 @@ lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt,
568} 708}
569 709
570#ifdef CONFIG_LPFC_DEBUG_FS 710#ifdef CONFIG_LPFC_DEBUG_FS
711/**
712 * lpfc_debugfs_disc_trc_open - Open the discovery trace log.
713 * @inode: The inode pointer that contains a vport pointer.
714 * @file: The file pointer to attach the log output.
715 *
716 * Description:
717 * This routine is the entry point for the debugfs open file operation. It gets
718 * the vport from the i_private field in @inode, allocates the necessary buffer
719 * for the log, fills the buffer from the in-memory log for this vport, and then
720 * returns a pointer to that log in the private_data field in @file.
721 *
722 * Returns:
723 * This function returns zero if successful. On error it will return an negative
724 * error value.
725 **/
571static int 726static int
572lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file) 727lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file)
573{ 728{
@@ -585,7 +740,7 @@ lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file)
585 if (!debug) 740 if (!debug)
586 goto out; 741 goto out;
587 742
588 /* Round to page boundry */ 743 /* Round to page boundary */
589 size = (lpfc_debugfs_max_disc_trc * LPFC_DEBUG_TRC_ENTRY_SIZE); 744 size = (lpfc_debugfs_max_disc_trc * LPFC_DEBUG_TRC_ENTRY_SIZE);
590 size = PAGE_ALIGN(size); 745 size = PAGE_ALIGN(size);
591 746
@@ -603,6 +758,21 @@ out:
603 return rc; 758 return rc;
604} 759}
605 760
761/**
762 * lpfc_debugfs_slow_ring_trc_open - Open the Slow Ring trace log.
763 * @inode: The inode pointer that contains a vport pointer.
764 * @file: The file pointer to attach the log output.
765 *
766 * Description:
767 * This routine is the entry point for the debugfs open file operation. It gets
768 * the vport from the i_private field in @inode, allocates the necessary buffer
769 * for the log, fills the buffer from the in-memory log for this vport, and then
770 * returns a pointer to that log in the private_data field in @file.
771 *
772 * Returns:
773 * This function returns zero if successful. On error it will return an negative
774 * error value.
775 **/
606static int 776static int
607lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file) 777lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file)
608{ 778{
@@ -620,7 +790,7 @@ lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file)
620 if (!debug) 790 if (!debug)
621 goto out; 791 goto out;
622 792
623 /* Round to page boundry */ 793 /* Round to page boundary */
624 size = (lpfc_debugfs_max_slow_ring_trc * LPFC_DEBUG_TRC_ENTRY_SIZE); 794 size = (lpfc_debugfs_max_slow_ring_trc * LPFC_DEBUG_TRC_ENTRY_SIZE);
625 size = PAGE_ALIGN(size); 795 size = PAGE_ALIGN(size);
626 796
@@ -638,6 +808,21 @@ out:
638 return rc; 808 return rc;
639} 809}
640 810
811/**
812 * lpfc_debugfs_hbqinfo_open - Open the hbqinfo debugfs buffer.
813 * @inode: The inode pointer that contains a vport pointer.
814 * @file: The file pointer to attach the log output.
815 *
816 * Description:
817 * This routine is the entry point for the debugfs open file operation. It gets
818 * the vport from the i_private field in @inode, allocates the necessary buffer
819 * for the log, fills the buffer from the in-memory log for this vport, and then
820 * returns a pointer to that log in the private_data field in @file.
821 *
822 * Returns:
823 * This function returns zero if successful. On error it will return an negative
824 * error value.
825 **/
641static int 826static int
642lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file) 827lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file)
643{ 828{
@@ -649,7 +834,7 @@ lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file)
649 if (!debug) 834 if (!debug)
650 goto out; 835 goto out;
651 836
652 /* Round to page boundry */ 837 /* Round to page boundary */
653 debug->buffer = kmalloc(LPFC_HBQINFO_SIZE, GFP_KERNEL); 838 debug->buffer = kmalloc(LPFC_HBQINFO_SIZE, GFP_KERNEL);
654 if (!debug->buffer) { 839 if (!debug->buffer) {
655 kfree(debug); 840 kfree(debug);
@@ -665,6 +850,21 @@ out:
665 return rc; 850 return rc;
666} 851}
667 852
853/**
854 * lpfc_debugfs_dumpHBASlim_open - Open the Dump HBA SLIM debugfs buffer.
855 * @inode: The inode pointer that contains a vport pointer.
856 * @file: The file pointer to attach the log output.
857 *
858 * Description:
859 * This routine is the entry point for the debugfs open file operation. It gets
860 * the vport from the i_private field in @inode, allocates the necessary buffer
861 * for the log, fills the buffer from the in-memory log for this vport, and then
862 * returns a pointer to that log in the private_data field in @file.
863 *
864 * Returns:
865 * This function returns zero if successful. On error it will return an negative
866 * error value.
867 **/
668static int 868static int
669lpfc_debugfs_dumpHBASlim_open(struct inode *inode, struct file *file) 869lpfc_debugfs_dumpHBASlim_open(struct inode *inode, struct file *file)
670{ 870{
@@ -676,7 +876,7 @@ lpfc_debugfs_dumpHBASlim_open(struct inode *inode, struct file *file)
676 if (!debug) 876 if (!debug)
677 goto out; 877 goto out;
678 878
679 /* Round to page boundry */ 879 /* Round to page boundary */
680 debug->buffer = kmalloc(LPFC_DUMPHBASLIM_SIZE, GFP_KERNEL); 880 debug->buffer = kmalloc(LPFC_DUMPHBASLIM_SIZE, GFP_KERNEL);
681 if (!debug->buffer) { 881 if (!debug->buffer) {
682 kfree(debug); 882 kfree(debug);
@@ -692,6 +892,21 @@ out:
692 return rc; 892 return rc;
693} 893}
694 894
895/**
896 * lpfc_debugfs_dumpHostSlim_open - Open the Dump Host SLIM debugfs buffer.
897 * @inode: The inode pointer that contains a vport pointer.
898 * @file: The file pointer to attach the log output.
899 *
900 * Description:
901 * This routine is the entry point for the debugfs open file operation. It gets
902 * the vport from the i_private field in @inode, allocates the necessary buffer
903 * for the log, fills the buffer from the in-memory log for this vport, and then
904 * returns a pointer to that log in the private_data field in @file.
905 *
906 * Returns:
907 * This function returns zero if successful. On error it will return an negative
908 * error value.
909 **/
695static int 910static int
696lpfc_debugfs_dumpHostSlim_open(struct inode *inode, struct file *file) 911lpfc_debugfs_dumpHostSlim_open(struct inode *inode, struct file *file)
697{ 912{
@@ -703,7 +918,7 @@ lpfc_debugfs_dumpHostSlim_open(struct inode *inode, struct file *file)
703 if (!debug) 918 if (!debug)
704 goto out; 919 goto out;
705 920
706 /* Round to page boundry */ 921 /* Round to page boundary */
707 debug->buffer = kmalloc(LPFC_DUMPHOSTSLIM_SIZE, GFP_KERNEL); 922 debug->buffer = kmalloc(LPFC_DUMPHOSTSLIM_SIZE, GFP_KERNEL);
708 if (!debug->buffer) { 923 if (!debug->buffer) {
709 kfree(debug); 924 kfree(debug);
@@ -719,6 +934,21 @@ out:
719 return rc; 934 return rc;
720} 935}
721 936
937/**
938 * lpfc_debugfs_nodelist_open - Open the nodelist debugfs file.
939 * @inode: The inode pointer that contains a vport pointer.
940 * @file: The file pointer to attach the log output.
941 *
942 * Description:
943 * This routine is the entry point for the debugfs open file operation. It gets
944 * the vport from the i_private field in @inode, allocates the necessary buffer
945 * for the log, fills the buffer from the in-memory log for this vport, and then
946 * returns a pointer to that log in the private_data field in @file.
947 *
948 * Returns:
949 * This function returns zero if successful. On error it will return an negative
950 * error value.
951 **/
722static int 952static int
723lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file) 953lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file)
724{ 954{
@@ -730,7 +960,7 @@ lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file)
730 if (!debug) 960 if (!debug)
731 goto out; 961 goto out;
732 962
733 /* Round to page boundry */ 963 /* Round to page boundary */
734 debug->buffer = kmalloc(LPFC_NODELIST_SIZE, GFP_KERNEL); 964 debug->buffer = kmalloc(LPFC_NODELIST_SIZE, GFP_KERNEL);
735 if (!debug->buffer) { 965 if (!debug->buffer) {
736 kfree(debug); 966 kfree(debug);
@@ -746,6 +976,23 @@ out:
746 return rc; 976 return rc;
747} 977}
748 978
979/**
980 * lpfc_debugfs_lseek - Seek through a debugfs file.
981 * @file: The file pointer to seek through.
982 * @off: The offset to seek to or the amount to seek by.
983 * @whence: Indicates how to seek.
984 *
985 * Description:
986 * This routine is the entry point for the debugfs lseek file operation. The
987 * @whence parameter indicates whether @off is the offset to directly seek to,
988 * or if it is a value to seek forward or reverse by. This function figures out
989 * what the new offset of the debugfs file will be and assigns that value to the
990 * f_pos field of @file.
991 *
992 * Returns:
993 * This function returns the new offset if successful and returns a negative
994 * error if unable to process the seek.
995 **/
749static loff_t 996static loff_t
750lpfc_debugfs_lseek(struct file *file, loff_t off, int whence) 997lpfc_debugfs_lseek(struct file *file, loff_t off, int whence)
751{ 998{
@@ -767,6 +1014,22 @@ lpfc_debugfs_lseek(struct file *file, loff_t off, int whence)
767 return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos); 1014 return (pos < 0 || pos > debug->len) ? -EINVAL : (file->f_pos = pos);
768} 1015}
769 1016
1017/**
1018 * lpfc_debugfs_read - Read a debugfs file.
1019 * @file: The file pointer to read from.
1020 * @buf: The buffer to copy the data to.
1021 * @nbytes: The number of bytes to read.
1022 * @ppos: The position in the file to start reading from.
1023 *
1024 * Description:
1025 * This routine reads data from from the buffer indicated in the private_data
1026 * field of @file. It will start reading at @ppos and copy up to @nbytes of
1027 * data to @buf.
1028 *
1029 * Returns:
1030 * This function returns the amount of data that was read (this could be less
1031 * than @nbytes if the end of the file was reached) or a negative error value.
1032 **/
770static ssize_t 1033static ssize_t
771lpfc_debugfs_read(struct file *file, char __user *buf, 1034lpfc_debugfs_read(struct file *file, char __user *buf,
772 size_t nbytes, loff_t *ppos) 1035 size_t nbytes, loff_t *ppos)
@@ -776,6 +1039,18 @@ lpfc_debugfs_read(struct file *file, char __user *buf,
776 debug->len); 1039 debug->len);
777} 1040}
778 1041
1042/**
1043 * lpfc_debugfs_release - Release the buffer used to store debugfs file data.
1044 * @inode: The inode pointer that contains a vport pointer. (unused)
1045 * @file: The file pointer that contains the buffer to release.
1046 *
1047 * Description:
1048 * This routine frees the buffer that was allocated when the debugfs file was
1049 * opened.
1050 *
1051 * Returns:
1052 * This function returns zero.
1053 **/
779static int 1054static int
780lpfc_debugfs_release(struct inode *inode, struct file *file) 1055lpfc_debugfs_release(struct inode *inode, struct file *file)
781{ 1056{
@@ -845,6 +1120,16 @@ static struct dentry *lpfc_debugfs_root = NULL;
845static atomic_t lpfc_debugfs_hba_count; 1120static atomic_t lpfc_debugfs_hba_count;
846#endif 1121#endif
847 1122
1123/**
1124 * lpfc_debugfs_initialize - Initialize debugfs for a vport.
1125 * @vport: The vport pointer to initialize.
1126 *
1127 * Description:
1128 * When Debugfs is configured this routine sets up the lpfc debugfs file system.
1129 * If not already created, this routine will create the lpfc directory, and
1130 * lpfcX directory (for this HBA), and vportX directory for this vport. It will
1131 * also create each file used to access lpfc specific debugfs information.
1132 **/
848inline void 1133inline void
849lpfc_debugfs_initialize(struct lpfc_vport *vport) 1134lpfc_debugfs_initialize(struct lpfc_vport *vport)
850{ 1135{
@@ -1033,7 +1318,17 @@ debug_failed:
1033#endif 1318#endif
1034} 1319}
1035 1320
1036 1321/**
1322 * lpfc_debugfs_terminate - Tear down debugfs infrastructure for this vport.
1323 * @vport: The vport pointer to remove from debugfs.
1324 *
1325 * Description:
1326 * When Debugfs is configured this routine removes debugfs file system elements
1327 * that are specific to this vport. It also checks to see if there are any
1328 * users left for the debugfs directories associated with the HBA and driver. If
1329 * this is the last user of the HBA directory or driver directory then it will
1330 * remove those from the debugfs infrastructure as well.
1331 **/
1037inline void 1332inline void
1038lpfc_debugfs_terminate(struct lpfc_vport *vport) 1333lpfc_debugfs_terminate(struct lpfc_vport *vport)
1039{ 1334{
@@ -1096,5 +1391,3 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
1096#endif 1391#endif
1097 return; 1392 return;
1098} 1393}
1099
1100