diff options
author | James Smart <james.smart@emulex.com> | 2011-10-10 21:34:11 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-10-16 12:32:53 -0400 |
commit | f9bb2da11db805fca899a18d7d1bb97860fc2cd5 (patch) | |
tree | f43a24da27b0600fb2e98c035cadf5c930bf2a79 /drivers/scsi/lpfc/lpfc_debugfs.c | |
parent | 5350d872c19a59ef8eadab1e70db83064c134cfa (diff) |
[SCSI] lpfc 8.3.27: T10 additions for SLI4
Added T10 DIFF error injection code.
Added T10 DIFF structure definitions for SLI4 devices.
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_debugfs.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_debugfs.c | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index a0424dd90e40..2cd844f7058f 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c | |||
@@ -996,6 +996,85 @@ lpfc_debugfs_dumpDataDif_write(struct file *file, const char __user *buf, | |||
996 | return nbytes; | 996 | return nbytes; |
997 | } | 997 | } |
998 | 998 | ||
999 | static int | ||
1000 | lpfc_debugfs_dif_err_open(struct inode *inode, struct file *file) | ||
1001 | { | ||
1002 | file->private_data = inode->i_private; | ||
1003 | return 0; | ||
1004 | } | ||
1005 | |||
1006 | static ssize_t | ||
1007 | lpfc_debugfs_dif_err_read(struct file *file, char __user *buf, | ||
1008 | size_t nbytes, loff_t *ppos) | ||
1009 | { | ||
1010 | struct dentry *dent = file->f_dentry; | ||
1011 | struct lpfc_hba *phba = file->private_data; | ||
1012 | char cbuf[16]; | ||
1013 | int cnt = 0; | ||
1014 | |||
1015 | if (dent == phba->debug_writeGuard) | ||
1016 | cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_wgrd_cnt); | ||
1017 | else if (dent == phba->debug_writeApp) | ||
1018 | cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_wapp_cnt); | ||
1019 | else if (dent == phba->debug_writeRef) | ||
1020 | cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_wref_cnt); | ||
1021 | else if (dent == phba->debug_readApp) | ||
1022 | cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_rapp_cnt); | ||
1023 | else if (dent == phba->debug_readRef) | ||
1024 | cnt = snprintf(cbuf, 16, "%u\n", phba->lpfc_injerr_rref_cnt); | ||
1025 | else if (dent == phba->debug_InjErrLBA) | ||
1026 | cnt = snprintf(cbuf, 16, "0x%lx\n", | ||
1027 | (unsigned long) phba->lpfc_injerr_lba); | ||
1028 | else | ||
1029 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
1030 | "0547 Unknown debugfs error injection entry\n"); | ||
1031 | |||
1032 | return simple_read_from_buffer(buf, nbytes, ppos, &cbuf, cnt); | ||
1033 | } | ||
1034 | |||
1035 | static ssize_t | ||
1036 | lpfc_debugfs_dif_err_write(struct file *file, const char __user *buf, | ||
1037 | size_t nbytes, loff_t *ppos) | ||
1038 | { | ||
1039 | struct dentry *dent = file->f_dentry; | ||
1040 | struct lpfc_hba *phba = file->private_data; | ||
1041 | char dstbuf[32]; | ||
1042 | unsigned long tmp; | ||
1043 | int size; | ||
1044 | |||
1045 | memset(dstbuf, 0, 32); | ||
1046 | size = (nbytes < 32) ? nbytes : 32; | ||
1047 | if (copy_from_user(dstbuf, buf, size)) | ||
1048 | return 0; | ||
1049 | |||
1050 | if (strict_strtoul(dstbuf, 0, &tmp)) | ||
1051 | return 0; | ||
1052 | |||
1053 | if (dent == phba->debug_writeGuard) | ||
1054 | phba->lpfc_injerr_wgrd_cnt = (uint32_t)tmp; | ||
1055 | else if (dent == phba->debug_writeApp) | ||
1056 | phba->lpfc_injerr_wapp_cnt = (uint32_t)tmp; | ||
1057 | else if (dent == phba->debug_writeRef) | ||
1058 | phba->lpfc_injerr_wref_cnt = (uint32_t)tmp; | ||
1059 | else if (dent == phba->debug_readApp) | ||
1060 | phba->lpfc_injerr_rapp_cnt = (uint32_t)tmp; | ||
1061 | else if (dent == phba->debug_readRef) | ||
1062 | phba->lpfc_injerr_rref_cnt = (uint32_t)tmp; | ||
1063 | else if (dent == phba->debug_InjErrLBA) | ||
1064 | phba->lpfc_injerr_lba = (sector_t)tmp; | ||
1065 | else | ||
1066 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
1067 | "0548 Unknown debugfs error injection entry\n"); | ||
1068 | |||
1069 | return nbytes; | ||
1070 | } | ||
1071 | |||
1072 | static int | ||
1073 | lpfc_debugfs_dif_err_release(struct inode *inode, struct file *file) | ||
1074 | { | ||
1075 | return 0; | ||
1076 | } | ||
1077 | |||
999 | /** | 1078 | /** |
1000 | * lpfc_debugfs_nodelist_open - Open the nodelist debugfs file | 1079 | * lpfc_debugfs_nodelist_open - Open the nodelist debugfs file |
1001 | * @inode: The inode pointer that contains a vport pointer. | 1080 | * @inode: The inode pointer that contains a vport pointer. |
@@ -3380,6 +3459,16 @@ static const struct file_operations lpfc_debugfs_op_dumpDif = { | |||
3380 | .release = lpfc_debugfs_dumpDataDif_release, | 3459 | .release = lpfc_debugfs_dumpDataDif_release, |
3381 | }; | 3460 | }; |
3382 | 3461 | ||
3462 | #undef lpfc_debugfs_op_dif_err | ||
3463 | static const struct file_operations lpfc_debugfs_op_dif_err = { | ||
3464 | .owner = THIS_MODULE, | ||
3465 | .open = lpfc_debugfs_dif_err_open, | ||
3466 | .llseek = lpfc_debugfs_lseek, | ||
3467 | .read = lpfc_debugfs_dif_err_read, | ||
3468 | .write = lpfc_debugfs_dif_err_write, | ||
3469 | .release = lpfc_debugfs_dif_err_release, | ||
3470 | }; | ||
3471 | |||
3383 | #undef lpfc_debugfs_op_slow_ring_trc | 3472 | #undef lpfc_debugfs_op_slow_ring_trc |
3384 | static const struct file_operations lpfc_debugfs_op_slow_ring_trc = { | 3473 | static const struct file_operations lpfc_debugfs_op_slow_ring_trc = { |
3385 | .owner = THIS_MODULE, | 3474 | .owner = THIS_MODULE, |
@@ -3788,6 +3877,74 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport) | |||
3788 | goto debug_failed; | 3877 | goto debug_failed; |
3789 | } | 3878 | } |
3790 | 3879 | ||
3880 | /* Setup DIF Error Injections */ | ||
3881 | snprintf(name, sizeof(name), "InjErrLBA"); | ||
3882 | phba->debug_InjErrLBA = | ||
3883 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
3884 | phba->hba_debugfs_root, | ||
3885 | phba, &lpfc_debugfs_op_dif_err); | ||
3886 | if (!phba->debug_InjErrLBA) { | ||
3887 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
3888 | "0807 Cannot create debugfs InjErrLBA\n"); | ||
3889 | goto debug_failed; | ||
3890 | } | ||
3891 | phba->lpfc_injerr_lba = LPFC_INJERR_LBA_OFF; | ||
3892 | |||
3893 | snprintf(name, sizeof(name), "writeGuardInjErr"); | ||
3894 | phba->debug_writeGuard = | ||
3895 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
3896 | phba->hba_debugfs_root, | ||
3897 | phba, &lpfc_debugfs_op_dif_err); | ||
3898 | if (!phba->debug_writeGuard) { | ||
3899 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
3900 | "0802 Cannot create debugfs writeGuard\n"); | ||
3901 | goto debug_failed; | ||
3902 | } | ||
3903 | |||
3904 | snprintf(name, sizeof(name), "writeAppInjErr"); | ||
3905 | phba->debug_writeApp = | ||
3906 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
3907 | phba->hba_debugfs_root, | ||
3908 | phba, &lpfc_debugfs_op_dif_err); | ||
3909 | if (!phba->debug_writeApp) { | ||
3910 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
3911 | "0803 Cannot create debugfs writeApp\n"); | ||
3912 | goto debug_failed; | ||
3913 | } | ||
3914 | |||
3915 | snprintf(name, sizeof(name), "writeRefInjErr"); | ||
3916 | phba->debug_writeRef = | ||
3917 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
3918 | phba->hba_debugfs_root, | ||
3919 | phba, &lpfc_debugfs_op_dif_err); | ||
3920 | if (!phba->debug_writeRef) { | ||
3921 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
3922 | "0804 Cannot create debugfs writeRef\n"); | ||
3923 | goto debug_failed; | ||
3924 | } | ||
3925 | |||
3926 | snprintf(name, sizeof(name), "readAppInjErr"); | ||
3927 | phba->debug_readApp = | ||
3928 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
3929 | phba->hba_debugfs_root, | ||
3930 | phba, &lpfc_debugfs_op_dif_err); | ||
3931 | if (!phba->debug_readApp) { | ||
3932 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
3933 | "0805 Cannot create debugfs readApp\n"); | ||
3934 | goto debug_failed; | ||
3935 | } | ||
3936 | |||
3937 | snprintf(name, sizeof(name), "readRefInjErr"); | ||
3938 | phba->debug_readRef = | ||
3939 | debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR, | ||
3940 | phba->hba_debugfs_root, | ||
3941 | phba, &lpfc_debugfs_op_dif_err); | ||
3942 | if (!phba->debug_readRef) { | ||
3943 | lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, | ||
3944 | "0806 Cannot create debugfs readApp\n"); | ||
3945 | goto debug_failed; | ||
3946 | } | ||
3947 | |||
3791 | /* Setup slow ring trace */ | 3948 | /* Setup slow ring trace */ |
3792 | if (lpfc_debugfs_max_slow_ring_trc) { | 3949 | if (lpfc_debugfs_max_slow_ring_trc) { |
3793 | num = lpfc_debugfs_max_slow_ring_trc - 1; | 3950 | num = lpfc_debugfs_max_slow_ring_trc - 1; |
@@ -4090,6 +4247,30 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport) | |||
4090 | debugfs_remove(phba->debug_dumpDif); /* dumpDif */ | 4247 | debugfs_remove(phba->debug_dumpDif); /* dumpDif */ |
4091 | phba->debug_dumpDif = NULL; | 4248 | phba->debug_dumpDif = NULL; |
4092 | } | 4249 | } |
4250 | if (phba->debug_InjErrLBA) { | ||
4251 | debugfs_remove(phba->debug_InjErrLBA); /* InjErrLBA */ | ||
4252 | phba->debug_InjErrLBA = NULL; | ||
4253 | } | ||
4254 | if (phba->debug_writeGuard) { | ||
4255 | debugfs_remove(phba->debug_writeGuard); /* writeGuard */ | ||
4256 | phba->debug_writeGuard = NULL; | ||
4257 | } | ||
4258 | if (phba->debug_writeApp) { | ||
4259 | debugfs_remove(phba->debug_writeApp); /* writeApp */ | ||
4260 | phba->debug_writeApp = NULL; | ||
4261 | } | ||
4262 | if (phba->debug_writeRef) { | ||
4263 | debugfs_remove(phba->debug_writeRef); /* writeRef */ | ||
4264 | phba->debug_writeRef = NULL; | ||
4265 | } | ||
4266 | if (phba->debug_readApp) { | ||
4267 | debugfs_remove(phba->debug_readApp); /* readApp */ | ||
4268 | phba->debug_readApp = NULL; | ||
4269 | } | ||
4270 | if (phba->debug_readRef) { | ||
4271 | debugfs_remove(phba->debug_readRef); /* readRef */ | ||
4272 | phba->debug_readRef = NULL; | ||
4273 | } | ||
4093 | 4274 | ||
4094 | if (phba->slow_ring_trc) { | 4275 | if (phba->slow_ring_trc) { |
4095 | kfree(phba->slow_ring_trc); | 4276 | kfree(phba->slow_ring_trc); |