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.c80
1 files changed, 65 insertions, 15 deletions
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 22e17be04d8a..5bdf2eecb178 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-2011 Emulex. All rights reserved. * 4 * Copyright (C) 2007-2012 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 * *
@@ -1010,25 +1010,35 @@ lpfc_debugfs_dif_err_read(struct file *file, char __user *buf,
1010{ 1010{
1011 struct dentry *dent = file->f_dentry; 1011 struct dentry *dent = file->f_dentry;
1012 struct lpfc_hba *phba = file->private_data; 1012 struct lpfc_hba *phba = file->private_data;
1013 char cbuf[16]; 1013 char cbuf[32];
1014 uint64_t tmp = 0;
1014 int cnt = 0; 1015 int cnt = 0;
1015 1016
1016 if (dent == phba->debug_writeGuard) 1017 if (dent == phba->debug_writeGuard)
1017 cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_wgrd_cnt); 1018 cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wgrd_cnt);
1018 else if (dent == phba->debug_writeApp) 1019 else if (dent == phba->debug_writeApp)
1019 cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_wapp_cnt); 1020 cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wapp_cnt);
1020 else if (dent == phba->debug_writeRef) 1021 else if (dent == phba->debug_writeRef)
1021 cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_wref_cnt); 1022 cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_wref_cnt);
1022 else if (dent == phba->debug_readGuard) 1023 else if (dent == phba->debug_readGuard)
1023 cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_rgrd_cnt); 1024 cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rgrd_cnt);
1024 else if (dent == phba->debug_readApp) 1025 else if (dent == phba->debug_readApp)
1025 cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_rapp_cnt); 1026 cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rapp_cnt);
1026 else if (dent == phba->debug_readRef) 1027 else if (dent == phba->debug_readRef)
1027 cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_rref_cnt); 1028 cnt = snprintf(cbuf, 32, "%u\n", phba->lpfc_injerr_rref_cnt);
1028 else if (dent == phba->debug_InjErrLBA) 1029 else if (dent == phba->debug_InjErrNPortID)
1029 cnt = snprintf(cbuf, 16, "0x%lx\n", 1030 cnt = snprintf(cbuf, 32, "0x%06x\n", phba->lpfc_injerr_nportid);
1030 (unsigned long) phba->lpfc_injerr_lba); 1031 else if (dent == phba->debug_InjErrWWPN) {
1031 else 1032 memcpy(&tmp, &phba->lpfc_injerr_wwpn, sizeof(struct lpfc_name));
1033 tmp = cpu_to_be64(tmp);
1034 cnt = snprintf(cbuf, 32, "0x%016llx\n", tmp);
1035 } else if (dent == phba->debug_InjErrLBA) {
1036 if (phba->lpfc_injerr_lba == (sector_t)(-1))
1037 cnt = snprintf(cbuf, 32, "off\n");
1038 else
1039 cnt = snprintf(cbuf, 32, "0x%llx\n",
1040 (uint64_t) phba->lpfc_injerr_lba);
1041 } else
1032 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1042 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1033 "0547 Unknown debugfs error injection entry\n"); 1043 "0547 Unknown debugfs error injection entry\n");
1034 1044
@@ -1042,7 +1052,7 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
1042 struct dentry *dent = file->f_dentry; 1052 struct dentry *dent = file->f_dentry;
1043 struct lpfc_hba *phba = file->private_data; 1053 struct lpfc_hba *phba = file->private_data;
1044 char dstbuf[32]; 1054 char dstbuf[32];
1045 unsigned long tmp; 1055 uint64_t tmp = 0;
1046 int size; 1056 int size;
1047 1057
1048 memset(dstbuf, 0, 32); 1058 memset(dstbuf, 0, 32);
@@ -1050,7 +1060,12 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
1050 if (copy_from_user(dstbuf, buf, size)) 1060 if (copy_from_user(dstbuf, buf, size))
1051 return 0; 1061 return 0;
1052 1062
1053 if (strict_strtoul(dstbuf, 0, &tmp)) 1063 if (dent == phba->debug_InjErrLBA) {
1064 if ((buf[0] == 'o') && (buf[1] == 'f') && (buf[2] == 'f'))
1065 tmp = (uint64_t)(-1);
1066 }
1067
1068 if ((tmp == 0) && (kstrtoull(dstbuf, 0, &tmp)))
1054 return 0; 1069 return 0;
1055 1070
1056 if (dent == phba->debug_writeGuard) 1071 if (dent == phba->debug_writeGuard)
@@ -1067,7 +1082,12 @@ lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf,
1067 phba->lpfc_injerr_rref_cnt = (uint32_t)tmp; 1082 phba->lpfc_injerr_rref_cnt = (uint32_t)tmp;
1068 else if (dent == phba->debug_InjErrLBA) 1083 else if (dent == phba->debug_InjErrLBA)
1069 phba->lpfc_injerr_lba = (sector_t)tmp; 1084 phba->lpfc_injerr_lba = (sector_t)tmp;
1070 else 1085 else if (dent == phba->debug_InjErrNPortID)
1086 phba->lpfc_injerr_nportid = (uint32_t)(tmp & Mask_DID);
1087 else if (dent == phba->debug_InjErrWWPN) {
1088 tmp = cpu_to_be64(tmp);
1089 memcpy(&phba->lpfc_injerr_wwpn, &tmp, sizeof(struct lpfc_name));
1090 } else
1071 lpfc_printf_log(phba, KERN_ERR, LOG_INIT, 1091 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
1072 "0548 Unknown debugfs error injection entry\n"); 1092 "0548 Unknown debugfs error injection entry\n");
1073 1093
@@ -3949,6 +3969,28 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
3949 } 3969 }
3950 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; 3970 phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF;
3951 3971
3972 snprintf(name, sizeof(name), "InjErrNPortID");
3973 phba->debug_InjErrNPortID =
3974 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
3975 phba->hba_debugfs_root,
3976 phba, &lpfc_debugfs_op_dif_err);
3977 if (!phba->debug_InjErrNPortID) {
3978 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
3979 "0809 Cannot create debugfs InjErrNPortID\n");
3980 goto debug_failed;
3981 }
3982
3983 snprintf(name, sizeof(name), "InjErrWWPN");
3984 phba->debug_InjErrWWPN =
3985 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
3986 phba->hba_debugfs_root,
3987 phba, &lpfc_debugfs_op_dif_err);
3988 if (!phba->debug_InjErrWWPN) {
3989 lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
3990 "0810 Cannot create debugfs InjErrWWPN\n");
3991 goto debug_failed;
3992 }
3993
3952 snprintf(name, sizeof(name), "writeGuardInjErr"); 3994 snprintf(name, sizeof(name), "writeGuardInjErr");
3953 phba->debug_writeGuard = 3995 phba->debug_writeGuard =
3954 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, 3996 debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
@@ -4321,6 +4363,14 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
4321 debugfs_remove(phba->debug_InjErrLBA); /* InjErrLBA */ 4363 debugfs_remove(phba->debug_InjErrLBA); /* InjErrLBA */
4322 phba->debug_InjErrLBA = NULL; 4364 phba->debug_InjErrLBA = NULL;
4323 } 4365 }
4366 if (phba->debug_InjErrNPortID) { /* InjErrNPortID */
4367 debugfs_remove(phba->debug_InjErrNPortID);
4368 phba->debug_InjErrNPortID = NULL;
4369 }
4370 if (phba->debug_InjErrWWPN) {
4371 debugfs_remove(phba->debug_InjErrWWPN); /* InjErrWWPN */
4372 phba->debug_InjErrWWPN = NULL;
4373 }
4324 if (phba->debug_writeGuard) { 4374 if (phba->debug_writeGuard) {
4325 debugfs_remove(phba->debug_writeGuard); /* writeGuard */ 4375 debugfs_remove(phba->debug_writeGuard); /* writeGuard */
4326 phba->debug_writeGuard = NULL; 4376 phba->debug_writeGuard = NULL;