diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 119 |
1 files changed, 116 insertions, 3 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 7c015982b40f..9ec046001300 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -96,6 +96,58 @@ lpfc_drvr_version_show(struct device *dev, struct device_attribute *attr, | |||
96 | return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); | 96 | return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n"); |
97 | } | 97 | } |
98 | 98 | ||
99 | static ssize_t | ||
100 | lpfc_bg_info_show(struct device *dev, struct device_attribute *attr, | ||
101 | char *buf) | ||
102 | { | ||
103 | struct Scsi_Host *shost = class_to_shost(dev); | ||
104 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | ||
105 | struct lpfc_hba *phba = vport->phba; | ||
106 | |||
107 | if (phba->cfg_enable_bg) | ||
108 | if (phba->sli3_options & LPFC_SLI3_BG_ENABLED) | ||
109 | return snprintf(buf, PAGE_SIZE, "BlockGuard Enabled\n"); | ||
110 | else | ||
111 | return snprintf(buf, PAGE_SIZE, | ||
112 | "BlockGuard Not Supported\n"); | ||
113 | else | ||
114 | return snprintf(buf, PAGE_SIZE, | ||
115 | "BlockGuard Disabled\n"); | ||
116 | } | ||
117 | |||
118 | static ssize_t | ||
119 | lpfc_bg_guard_err_show(struct device *dev, struct device_attribute *attr, | ||
120 | char *buf) | ||
121 | { | ||
122 | struct Scsi_Host *shost = class_to_shost(dev); | ||
123 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | ||
124 | struct lpfc_hba *phba = vport->phba; | ||
125 | |||
126 | return snprintf(buf, PAGE_SIZE, "%llu\n", phba->bg_guard_err_cnt); | ||
127 | } | ||
128 | |||
129 | static ssize_t | ||
130 | lpfc_bg_apptag_err_show(struct device *dev, struct device_attribute *attr, | ||
131 | char *buf) | ||
132 | { | ||
133 | struct Scsi_Host *shost = class_to_shost(dev); | ||
134 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | ||
135 | struct lpfc_hba *phba = vport->phba; | ||
136 | |||
137 | return snprintf(buf, PAGE_SIZE, "%llu\n", phba->bg_apptag_err_cnt); | ||
138 | } | ||
139 | |||
140 | static ssize_t | ||
141 | lpfc_bg_reftag_err_show(struct device *dev, struct device_attribute *attr, | ||
142 | char *buf) | ||
143 | { | ||
144 | struct Scsi_Host *shost = class_to_shost(dev); | ||
145 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | ||
146 | struct lpfc_hba *phba = vport->phba; | ||
147 | |||
148 | return snprintf(buf, PAGE_SIZE, "%llu\n", phba->bg_reftag_err_cnt); | ||
149 | } | ||
150 | |||
99 | /** | 151 | /** |
100 | * lpfc_info_show: Return some pci info about the host in ascii. | 152 | * lpfc_info_show: Return some pci info about the host in ascii. |
101 | * @dev: class converted to a Scsi_host structure. | 153 | * @dev: class converted to a Scsi_host structure. |
@@ -1485,6 +1537,10 @@ lpfc_vport_param_store(name)\ | |||
1485 | static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ | 1537 | static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ |
1486 | lpfc_##name##_show, lpfc_##name##_store) | 1538 | lpfc_##name##_show, lpfc_##name##_store) |
1487 | 1539 | ||
1540 | static DEVICE_ATTR(bg_info, S_IRUGO, lpfc_bg_info_show, NULL); | ||
1541 | static DEVICE_ATTR(bg_guard_err, S_IRUGO, lpfc_bg_guard_err_show, NULL); | ||
1542 | static DEVICE_ATTR(bg_apptag_err, S_IRUGO, lpfc_bg_apptag_err_show, NULL); | ||
1543 | static DEVICE_ATTR(bg_reftag_err, S_IRUGO, lpfc_bg_reftag_err_show, NULL); | ||
1488 | static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); | 1544 | static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); |
1489 | static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); | 1545 | static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); |
1490 | static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); | 1546 | static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); |
@@ -1970,6 +2026,7 @@ static DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, | |||
1970 | # LOG_LINK_EVENT 0x10 Link events | 2026 | # LOG_LINK_EVENT 0x10 Link events |
1971 | # LOG_FCP 0x40 FCP traffic history | 2027 | # LOG_FCP 0x40 FCP traffic history |
1972 | # LOG_NODE 0x80 Node table events | 2028 | # LOG_NODE 0x80 Node table events |
2029 | # LOG_BG 0x200 BlockBuard events | ||
1973 | # LOG_MISC 0x400 Miscellaneous events | 2030 | # LOG_MISC 0x400 Miscellaneous events |
1974 | # LOG_SLI 0x800 SLI events | 2031 | # LOG_SLI 0x800 SLI events |
1975 | # LOG_FCP_ERROR 0x1000 Only log FCP errors | 2032 | # LOG_FCP_ERROR 0x1000 Only log FCP errors |
@@ -2769,6 +2826,42 @@ LPFC_ATTR_R(enable_hba_reset, 1, 0, 1, "Enable HBA resets from the driver."); | |||
2769 | LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); | 2826 | LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); |
2770 | 2827 | ||
2771 | /* | 2828 | /* |
2829 | # lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF) | ||
2830 | # 0 = BlockGuard disabled (default) | ||
2831 | # 1 = BlockGuard enabled | ||
2832 | # Value range is [0,1]. Default value is 0. | ||
2833 | */ | ||
2834 | LPFC_ATTR_R(enable_bg, 0, 0, 1, "Enable BlockGuard Support"); | ||
2835 | |||
2836 | |||
2837 | /* | ||
2838 | # lpfc_prot_mask: i | ||
2839 | # - Bit mask of host protection capabilities used to register with the | ||
2840 | # SCSI mid-layer | ||
2841 | # - Only meaningful if BG is turned on (lpfc_enable_bg=1). | ||
2842 | # - Allows you to ultimately specify which profiles to use | ||
2843 | # - Default will result in registering capabilities for all profiles. | ||
2844 | # | ||
2845 | */ | ||
2846 | unsigned int lpfc_prot_mask = SHOST_DIX_TYPE0_PROTECTION; | ||
2847 | |||
2848 | module_param(lpfc_prot_mask, uint, 0); | ||
2849 | MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask"); | ||
2850 | |||
2851 | /* | ||
2852 | # lpfc_prot_guard: i | ||
2853 | # - Bit mask of protection guard types to register with the SCSI mid-layer | ||
2854 | # - Guard types are currently either 1) IP checksum 2) T10-DIF CRC | ||
2855 | # - Allows you to ultimately specify which profiles to use | ||
2856 | # - Default will result in registering capabilities for all guard types | ||
2857 | # | ||
2858 | */ | ||
2859 | unsigned char lpfc_prot_guard = SHOST_DIX_GUARD_IP; | ||
2860 | module_param(lpfc_prot_guard, byte, 0); | ||
2861 | MODULE_PARM_DESC(lpfc_prot_guard, "host protection guard type"); | ||
2862 | |||
2863 | |||
2864 | /* | ||
2772 | * lpfc_sg_seg_cnt: Initial Maximum DMA Segment Count | 2865 | * lpfc_sg_seg_cnt: Initial Maximum DMA Segment Count |
2773 | * This value can be set to values between 64 and 256. The default value is | 2866 | * This value can be set to values between 64 and 256. The default value is |
2774 | * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer | 2867 | * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer |
@@ -2777,7 +2870,15 @@ LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); | |||
2777 | LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, | 2870 | LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, |
2778 | LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); | 2871 | LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count"); |
2779 | 2872 | ||
2873 | LPFC_ATTR_R(prot_sg_seg_cnt, LPFC_DEFAULT_PROT_SG_SEG_CNT, | ||
2874 | LPFC_DEFAULT_PROT_SG_SEG_CNT, LPFC_MAX_PROT_SG_SEG_CNT, | ||
2875 | "Max Protection Scatter Gather Segment Count"); | ||
2876 | |||
2780 | struct device_attribute *lpfc_hba_attrs[] = { | 2877 | struct device_attribute *lpfc_hba_attrs[] = { |
2878 | &dev_attr_bg_info, | ||
2879 | &dev_attr_bg_guard_err, | ||
2880 | &dev_attr_bg_apptag_err, | ||
2881 | &dev_attr_bg_reftag_err, | ||
2781 | &dev_attr_info, | 2882 | &dev_attr_info, |
2782 | &dev_attr_serialnum, | 2883 | &dev_attr_serialnum, |
2783 | &dev_attr_modeldesc, | 2884 | &dev_attr_modeldesc, |
@@ -2825,6 +2926,7 @@ struct device_attribute *lpfc_hba_attrs[] = { | |||
2825 | &dev_attr_lpfc_poll, | 2926 | &dev_attr_lpfc_poll, |
2826 | &dev_attr_lpfc_poll_tmo, | 2927 | &dev_attr_lpfc_poll_tmo, |
2827 | &dev_attr_lpfc_use_msi, | 2928 | &dev_attr_lpfc_use_msi, |
2929 | &dev_attr_lpfc_enable_bg, | ||
2828 | &dev_attr_lpfc_soft_wwnn, | 2930 | &dev_attr_lpfc_soft_wwnn, |
2829 | &dev_attr_lpfc_soft_wwpn, | 2931 | &dev_attr_lpfc_soft_wwpn, |
2830 | &dev_attr_lpfc_soft_wwn_enable, | 2932 | &dev_attr_lpfc_soft_wwn_enable, |
@@ -2833,6 +2935,7 @@ struct device_attribute *lpfc_hba_attrs[] = { | |||
2833 | &dev_attr_lpfc_sg_seg_cnt, | 2935 | &dev_attr_lpfc_sg_seg_cnt, |
2834 | &dev_attr_lpfc_max_scsicmpl_time, | 2936 | &dev_attr_lpfc_max_scsicmpl_time, |
2835 | &dev_attr_lpfc_stat_data_ctrl, | 2937 | &dev_attr_lpfc_stat_data_ctrl, |
2938 | &dev_attr_lpfc_prot_sg_seg_cnt, | ||
2836 | NULL, | 2939 | NULL, |
2837 | }; | 2940 | }; |
2838 | 2941 | ||
@@ -3961,13 +4064,12 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
3961 | lpfc_use_msi_init(phba, lpfc_use_msi); | 4064 | lpfc_use_msi_init(phba, lpfc_use_msi); |
3962 | lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset); | 4065 | lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset); |
3963 | lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat); | 4066 | lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat); |
4067 | lpfc_enable_bg_init(phba, lpfc_enable_bg); | ||
3964 | phba->cfg_poll = lpfc_poll; | 4068 | phba->cfg_poll = lpfc_poll; |
3965 | phba->cfg_soft_wwnn = 0L; | 4069 | phba->cfg_soft_wwnn = 0L; |
3966 | phba->cfg_soft_wwpn = 0L; | 4070 | phba->cfg_soft_wwpn = 0L; |
3967 | lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt); | 4071 | lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt); |
3968 | /* Also reinitialize the host templates with new values. */ | 4072 | lpfc_prot_sg_seg_cnt_init(phba, lpfc_prot_sg_seg_cnt); |
3969 | lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; | ||
3970 | lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; | ||
3971 | /* | 4073 | /* |
3972 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size | 4074 | * Since the sg_tablesize is module parameter, the sg_dma_buf_size |
3973 | * used to create the sg_dma_buf_pool must be dynamically calculated. | 4075 | * used to create the sg_dma_buf_pool must be dynamically calculated. |
@@ -3976,6 +4078,17 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
3976 | phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + | 4078 | phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + |
3977 | sizeof(struct fcp_rsp) + | 4079 | sizeof(struct fcp_rsp) + |
3978 | ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); | 4080 | ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); |
4081 | |||
4082 | if (phba->cfg_enable_bg) { | ||
4083 | phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT; | ||
4084 | phba->cfg_sg_dma_buf_size += | ||
4085 | phba->cfg_prot_sg_seg_cnt * sizeof(struct ulp_bde64); | ||
4086 | } | ||
4087 | |||
4088 | /* Also reinitialize the host templates with new values. */ | ||
4089 | lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt; | ||
4090 | lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt; | ||
4091 | |||
3979 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); | 4092 | lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); |
3980 | return; | 4093 | return; |
3981 | } | 4094 | } |