aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_attr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-30 20:43:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-30 20:43:10 -0500
commit590cf28580c999c8ba70dc39b40bab09d69e2630 (patch)
tree22b9aa4b148bea8a310b760521d1032eef7d743f /drivers/scsi/lpfc/lpfc_attr.c
parentf54a6ec0fd85002d94d05b4bb679508eeb066683 (diff)
parentfb5edd020fa0fbe991f4a473611ad530d2237425 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (104 commits) [SCSI] fcoe: fix configuration problems [SCSI] cxgb3i: fix select/depend problem [SCSI] fcoe: fix incorrect use of struct module [SCSI] cxgb3i: remove use of skb->sp [SCSI] cxgb3i: Add cxgb3i iSCSI driver. [SCSI] zfcp: Remove unnecessary warning message [SCSI] zfcp: Add support for unchained FSF requests [SCSI] zfcp: Remove busid macro [SCSI] zfcp: remove DID_DID flag [SCSI] zfcp: Simplify mask lookups for incoming RSCNs [SCSI] zfcp: Remove initial device data from zfcp_data [SCSI] zfcp: fix compile warning [SCSI] zfcp: Remove adapter list [SCSI] zfcp: Simplify SBAL allocation to fix sparse warnings [SCSI] zfcp: register with SCSI layer on ccw registration [SCSI] zfcp: Fix message line break [SCSI] qla2xxx: changes in multiq code [SCSI] eata: fix the data buffer accessors conversion regression [SCSI] ibmvfc: Improve async event handling [SCSI] lpfc : correct printk types on PPC compiles ...
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_attr.c169
1 files changed, 158 insertions, 11 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index aa3d6277581d..40cf0f4f327f 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -96,6 +96,61 @@ 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
99static ssize_t
100lpfc_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
118static ssize_t
119lpfc_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",
127 (unsigned long long)phba->bg_guard_err_cnt);
128}
129
130static ssize_t
131lpfc_bg_apptag_err_show(struct device *dev, struct device_attribute *attr,
132 char *buf)
133{
134 struct Scsi_Host *shost = class_to_shost(dev);
135 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
136 struct lpfc_hba *phba = vport->phba;
137
138 return snprintf(buf, PAGE_SIZE, "%llu\n",
139 (unsigned long long)phba->bg_apptag_err_cnt);
140}
141
142static ssize_t
143lpfc_bg_reftag_err_show(struct device *dev, struct device_attribute *attr,
144 char *buf)
145{
146 struct Scsi_Host *shost = class_to_shost(dev);
147 struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
148 struct lpfc_hba *phba = vport->phba;
149
150 return snprintf(buf, PAGE_SIZE, "%llu\n",
151 (unsigned long long)phba->bg_reftag_err_cnt);
152}
153
99/** 154/**
100 * lpfc_info_show: Return some pci info about the host in ascii. 155 * lpfc_info_show: Return some pci info about the host in ascii.
101 * @dev: class converted to a Scsi_host structure. 156 * @dev: class converted to a Scsi_host structure.
@@ -1485,6 +1540,10 @@ lpfc_vport_param_store(name)\
1485static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\ 1540static DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
1486 lpfc_##name##_show, lpfc_##name##_store) 1541 lpfc_##name##_show, lpfc_##name##_store)
1487 1542
1543static DEVICE_ATTR(bg_info, S_IRUGO, lpfc_bg_info_show, NULL);
1544static DEVICE_ATTR(bg_guard_err, S_IRUGO, lpfc_bg_guard_err_show, NULL);
1545static DEVICE_ATTR(bg_apptag_err, S_IRUGO, lpfc_bg_apptag_err_show, NULL);
1546static DEVICE_ATTR(bg_reftag_err, S_IRUGO, lpfc_bg_reftag_err_show, NULL);
1488static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL); 1547static DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL);
1489static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL); 1548static DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL);
1490static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL); 1549static DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL);
@@ -1970,6 +2029,7 @@ static DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
1970# LOG_LINK_EVENT 0x10 Link events 2029# LOG_LINK_EVENT 0x10 Link events
1971# LOG_FCP 0x40 FCP traffic history 2030# LOG_FCP 0x40 FCP traffic history
1972# LOG_NODE 0x80 Node table events 2031# LOG_NODE 0x80 Node table events
2032# LOG_BG 0x200 BlockBuard events
1973# LOG_MISC 0x400 Miscellaneous events 2033# LOG_MISC 0x400 Miscellaneous events
1974# LOG_SLI 0x800 SLI events 2034# LOG_SLI 0x800 SLI events
1975# LOG_FCP_ERROR 0x1000 Only log FCP errors 2035# LOG_FCP_ERROR 0x1000 Only log FCP errors
@@ -2769,6 +2829,42 @@ LPFC_ATTR_R(enable_hba_reset, 1, 0, 1, "Enable HBA resets from the driver.");
2769LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat."); 2829LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat.");
2770 2830
2771/* 2831/*
2832# lpfc_enable_bg: Enable BlockGuard (Emulex's Implementation of T10-DIF)
2833# 0 = BlockGuard disabled (default)
2834# 1 = BlockGuard enabled
2835# Value range is [0,1]. Default value is 0.
2836*/
2837LPFC_ATTR_R(enable_bg, 0, 0, 1, "Enable BlockGuard Support");
2838
2839
2840/*
2841# lpfc_prot_mask: i
2842# - Bit mask of host protection capabilities used to register with the
2843# SCSI mid-layer
2844# - Only meaningful if BG is turned on (lpfc_enable_bg=1).
2845# - Allows you to ultimately specify which profiles to use
2846# - Default will result in registering capabilities for all profiles.
2847#
2848*/
2849unsigned int lpfc_prot_mask = SHOST_DIX_TYPE0_PROTECTION;
2850
2851module_param(lpfc_prot_mask, uint, 0);
2852MODULE_PARM_DESC(lpfc_prot_mask, "host protection mask");
2853
2854/*
2855# lpfc_prot_guard: i
2856# - Bit mask of protection guard types to register with the SCSI mid-layer
2857# - Guard types are currently either 1) IP checksum 2) T10-DIF CRC
2858# - Allows you to ultimately specify which profiles to use
2859# - Default will result in registering capabilities for all guard types
2860#
2861*/
2862unsigned char lpfc_prot_guard = SHOST_DIX_GUARD_IP;
2863module_param(lpfc_prot_guard, byte, 0);
2864MODULE_PARM_DESC(lpfc_prot_guard, "host protection guard type");
2865
2866
2867/*
2772 * lpfc_sg_seg_cnt: Initial Maximum DMA Segment Count 2868 * 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 2869 * 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 2870 * 64, but may be increased to allow for larger Max I/O sizes. The scsi layer
@@ -2777,7 +2873,15 @@ LPFC_ATTR_R(enable_hba_heartbeat, 1, 0, 1, "Enable HBA Heartbeat.");
2777LPFC_ATTR_R(sg_seg_cnt, LPFC_DEFAULT_SG_SEG_CNT, LPFC_DEFAULT_SG_SEG_CNT, 2873LPFC_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"); 2874 LPFC_MAX_SG_SEG_CNT, "Max Scatter Gather Segment Count");
2779 2875
2876LPFC_ATTR_R(prot_sg_seg_cnt, LPFC_DEFAULT_PROT_SG_SEG_CNT,
2877 LPFC_DEFAULT_PROT_SG_SEG_CNT, LPFC_MAX_PROT_SG_SEG_CNT,
2878 "Max Protection Scatter Gather Segment Count");
2879
2780struct device_attribute *lpfc_hba_attrs[] = { 2880struct device_attribute *lpfc_hba_attrs[] = {
2881 &dev_attr_bg_info,
2882 &dev_attr_bg_guard_err,
2883 &dev_attr_bg_apptag_err,
2884 &dev_attr_bg_reftag_err,
2781 &dev_attr_info, 2885 &dev_attr_info,
2782 &dev_attr_serialnum, 2886 &dev_attr_serialnum,
2783 &dev_attr_modeldesc, 2887 &dev_attr_modeldesc,
@@ -2825,6 +2929,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
2825 &dev_attr_lpfc_poll, 2929 &dev_attr_lpfc_poll,
2826 &dev_attr_lpfc_poll_tmo, 2930 &dev_attr_lpfc_poll_tmo,
2827 &dev_attr_lpfc_use_msi, 2931 &dev_attr_lpfc_use_msi,
2932 &dev_attr_lpfc_enable_bg,
2828 &dev_attr_lpfc_soft_wwnn, 2933 &dev_attr_lpfc_soft_wwnn,
2829 &dev_attr_lpfc_soft_wwpn, 2934 &dev_attr_lpfc_soft_wwpn,
2830 &dev_attr_lpfc_soft_wwn_enable, 2935 &dev_attr_lpfc_soft_wwn_enable,
@@ -2833,6 +2938,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
2833 &dev_attr_lpfc_sg_seg_cnt, 2938 &dev_attr_lpfc_sg_seg_cnt,
2834 &dev_attr_lpfc_max_scsicmpl_time, 2939 &dev_attr_lpfc_max_scsicmpl_time,
2835 &dev_attr_lpfc_stat_data_ctrl, 2940 &dev_attr_lpfc_stat_data_ctrl,
2941 &dev_attr_lpfc_prot_sg_seg_cnt,
2836 NULL, 2942 NULL,
2837}; 2943};
2838 2944
@@ -3282,25 +3388,28 @@ lpfc_alloc_sysfs_attr(struct lpfc_vport *vport)
3282 int error; 3388 int error;
3283 3389
3284 error = sysfs_create_bin_file(&shost->shost_dev.kobj, 3390 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
3285 &sysfs_ctlreg_attr); 3391 &sysfs_drvr_stat_data_attr);
3286 if (error) 3392
3393 /* Virtual ports do not need ctrl_reg and mbox */
3394 if (error || vport->port_type == LPFC_NPIV_PORT)
3287 goto out; 3395 goto out;
3288 3396
3289 error = sysfs_create_bin_file(&shost->shost_dev.kobj, 3397 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
3290 &sysfs_mbox_attr); 3398 &sysfs_ctlreg_attr);
3291 if (error) 3399 if (error)
3292 goto out_remove_ctlreg_attr; 3400 goto out_remove_stat_attr;
3293 3401
3294 error = sysfs_create_bin_file(&shost->shost_dev.kobj, 3402 error = sysfs_create_bin_file(&shost->shost_dev.kobj,
3295 &sysfs_drvr_stat_data_attr); 3403 &sysfs_mbox_attr);
3296 if (error) 3404 if (error)
3297 goto out_remove_mbox_attr; 3405 goto out_remove_ctlreg_attr;
3298 3406
3299 return 0; 3407 return 0;
3300out_remove_mbox_attr:
3301 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr);
3302out_remove_ctlreg_attr: 3408out_remove_ctlreg_attr:
3303 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); 3409 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr);
3410out_remove_stat_attr:
3411 sysfs_remove_bin_file(&shost->shost_dev.kobj,
3412 &sysfs_drvr_stat_data_attr);
3304out: 3413out:
3305 return error; 3414 return error;
3306} 3415}
@@ -3315,6 +3424,9 @@ lpfc_free_sysfs_attr(struct lpfc_vport *vport)
3315 struct Scsi_Host *shost = lpfc_shost_from_vport(vport); 3424 struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
3316 sysfs_remove_bin_file(&shost->shost_dev.kobj, 3425 sysfs_remove_bin_file(&shost->shost_dev.kobj,
3317 &sysfs_drvr_stat_data_attr); 3426 &sysfs_drvr_stat_data_attr);
3427 /* Virtual ports do not need ctrl_reg and mbox */
3428 if (vport->port_type == LPFC_NPIV_PORT)
3429 return;
3318 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr); 3430 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_mbox_attr);
3319 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr); 3431 sysfs_remove_bin_file(&shost->shost_dev.kobj, &sysfs_ctlreg_attr);
3320} 3432}
@@ -3792,6 +3904,23 @@ lpfc_show_rport_##field (struct device *dev, \
3792 lpfc_rport_show_function(field, format_string, sz, ) \ 3904 lpfc_rport_show_function(field, format_string, sz, ) \
3793static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL) 3905static FC_RPORT_ATTR(field, S_IRUGO, lpfc_show_rport_##field, NULL)
3794 3906
3907/**
3908 * lpfc_set_vport_symbolic_name: Set the vport's symbolic name.
3909 * @fc_vport: The fc_vport who's symbolic name has been changed.
3910 *
3911 * Description:
3912 * This function is called by the transport after the @fc_vport's symbolic name
3913 * has been changed. This function re-registers the symbolic name with the
3914 * switch to propogate the change into the fabric if the vport is active.
3915 **/
3916static void
3917lpfc_set_vport_symbolic_name(struct fc_vport *fc_vport)
3918{
3919 struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
3920
3921 if (vport->port_state == LPFC_VPORT_READY)
3922 lpfc_ns_cmd(vport, SLI_CTNS_RSPN_ID, 0, 0);
3923}
3795 3924
3796struct fc_function_template lpfc_transport_functions = { 3925struct fc_function_template lpfc_transport_functions = {
3797 /* fixed attributes the driver supports */ 3926 /* fixed attributes the driver supports */
@@ -3801,6 +3930,7 @@ struct fc_function_template lpfc_transport_functions = {
3801 .show_host_supported_fc4s = 1, 3930 .show_host_supported_fc4s = 1,
3802 .show_host_supported_speeds = 1, 3931 .show_host_supported_speeds = 1,
3803 .show_host_maxframe_size = 1, 3932 .show_host_maxframe_size = 1,
3933 .show_host_symbolic_name = 1,
3804 3934
3805 /* dynamic attributes the driver supports */ 3935 /* dynamic attributes the driver supports */
3806 .get_host_port_id = lpfc_get_host_port_id, 3936 .get_host_port_id = lpfc_get_host_port_id,
@@ -3850,6 +3980,10 @@ struct fc_function_template lpfc_transport_functions = {
3850 .terminate_rport_io = lpfc_terminate_rport_io, 3980 .terminate_rport_io = lpfc_terminate_rport_io,
3851 3981
3852 .dd_fcvport_size = sizeof(struct lpfc_vport *), 3982 .dd_fcvport_size = sizeof(struct lpfc_vport *),
3983
3984 .vport_disable = lpfc_vport_disable,
3985
3986 .set_vport_symbolic_name = lpfc_set_vport_symbolic_name,
3853}; 3987};
3854 3988
3855struct fc_function_template lpfc_vport_transport_functions = { 3989struct fc_function_template lpfc_vport_transport_functions = {
@@ -3860,6 +3994,7 @@ struct fc_function_template lpfc_vport_transport_functions = {
3860 .show_host_supported_fc4s = 1, 3994 .show_host_supported_fc4s = 1,
3861 .show_host_supported_speeds = 1, 3995 .show_host_supported_speeds = 1,
3862 .show_host_maxframe_size = 1, 3996 .show_host_maxframe_size = 1,
3997 .show_host_symbolic_name = 1,
3863 3998
3864 /* dynamic attributes the driver supports */ 3999 /* dynamic attributes the driver supports */
3865 .get_host_port_id = lpfc_get_host_port_id, 4000 .get_host_port_id = lpfc_get_host_port_id,
@@ -3908,6 +4043,8 @@ struct fc_function_template lpfc_vport_transport_functions = {
3908 .terminate_rport_io = lpfc_terminate_rport_io, 4043 .terminate_rport_io = lpfc_terminate_rport_io,
3909 4044
3910 .vport_disable = lpfc_vport_disable, 4045 .vport_disable = lpfc_vport_disable,
4046
4047 .set_vport_symbolic_name = lpfc_set_vport_symbolic_name,
3911}; 4048};
3912 4049
3913/** 4050/**
@@ -3930,13 +4067,12 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
3930 lpfc_use_msi_init(phba, lpfc_use_msi); 4067 lpfc_use_msi_init(phba, lpfc_use_msi);
3931 lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset); 4068 lpfc_enable_hba_reset_init(phba, lpfc_enable_hba_reset);
3932 lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat); 4069 lpfc_enable_hba_heartbeat_init(phba, lpfc_enable_hba_heartbeat);
4070 lpfc_enable_bg_init(phba, lpfc_enable_bg);
3933 phba->cfg_poll = lpfc_poll; 4071 phba->cfg_poll = lpfc_poll;
3934 phba->cfg_soft_wwnn = 0L; 4072 phba->cfg_soft_wwnn = 0L;
3935 phba->cfg_soft_wwpn = 0L; 4073 phba->cfg_soft_wwpn = 0L;
3936 lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt); 4074 lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt);
3937 /* Also reinitialize the host templates with new values. */ 4075 lpfc_prot_sg_seg_cnt_init(phba, lpfc_prot_sg_seg_cnt);
3938 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
3939 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
3940 /* 4076 /*
3941 * Since the sg_tablesize is module parameter, the sg_dma_buf_size 4077 * Since the sg_tablesize is module parameter, the sg_dma_buf_size
3942 * used to create the sg_dma_buf_pool must be dynamically calculated. 4078 * used to create the sg_dma_buf_pool must be dynamically calculated.
@@ -3945,6 +4081,17 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
3945 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) + 4081 phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) +
3946 sizeof(struct fcp_rsp) + 4082 sizeof(struct fcp_rsp) +
3947 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64)); 4083 ((phba->cfg_sg_seg_cnt + 2) * sizeof(struct ulp_bde64));
4084
4085 if (phba->cfg_enable_bg) {
4086 phba->cfg_sg_seg_cnt = LPFC_MAX_SG_SEG_CNT;
4087 phba->cfg_sg_dma_buf_size +=
4088 phba->cfg_prot_sg_seg_cnt * sizeof(struct ulp_bde64);
4089 }
4090
4091 /* Also reinitialize the host templates with new values. */
4092 lpfc_vport_template.sg_tablesize = phba->cfg_sg_seg_cnt;
4093 lpfc_template.sg_tablesize = phba->cfg_sg_seg_cnt;
4094
3948 lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth); 4095 lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth);
3949 return; 4096 return;
3950} 4097}