diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_attr.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 120 |
1 files changed, 85 insertions, 35 deletions
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index bf33b315f93e..ad05b266e950 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/interrupt.h> | 25 | #include <linux/interrupt.h> |
26 | #include <linux/aer.h> | 26 | #include <linux/aer.h> |
27 | #include <linux/gfp.h> | 27 | #include <linux/gfp.h> |
28 | #include <linux/kernel.h> | ||
28 | 29 | ||
29 | #include <scsi/scsi.h> | 30 | #include <scsi/scsi.h> |
30 | #include <scsi/scsi_device.h> | 31 | #include <scsi/scsi_device.h> |
@@ -506,10 +507,10 @@ lpfc_link_state_store(struct device *dev, struct device_attribute *attr, | |||
506 | 507 | ||
507 | if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && | 508 | if ((strncmp(buf, "up", sizeof("up") - 1) == 0) && |
508 | (phba->link_state == LPFC_LINK_DOWN)) | 509 | (phba->link_state == LPFC_LINK_DOWN)) |
509 | status = phba->lpfc_hba_init_link(phba); | 510 | status = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); |
510 | else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && | 511 | else if ((strncmp(buf, "down", sizeof("down") - 1) == 0) && |
511 | (phba->link_state >= LPFC_LINK_UP)) | 512 | (phba->link_state >= LPFC_LINK_UP)) |
512 | status = phba->lpfc_hba_down_link(phba); | 513 | status = phba->lpfc_hba_down_link(phba, MBX_NOWAIT); |
513 | 514 | ||
514 | if (status == 0) | 515 | if (status == 0) |
515 | return strlen(buf); | 516 | return strlen(buf); |
@@ -864,7 +865,6 @@ lpfc_get_hba_info(struct lpfc_hba *phba, | |||
864 | uint32_t *mrpi, uint32_t *arpi, | 865 | uint32_t *mrpi, uint32_t *arpi, |
865 | uint32_t *mvpi, uint32_t *avpi) | 866 | uint32_t *mvpi, uint32_t *avpi) |
866 | { | 867 | { |
867 | struct lpfc_sli *psli = &phba->sli; | ||
868 | struct lpfc_mbx_read_config *rd_config; | 868 | struct lpfc_mbx_read_config *rd_config; |
869 | LPFC_MBOXQ_t *pmboxq; | 869 | LPFC_MBOXQ_t *pmboxq; |
870 | MAILBOX_t *pmb; | 870 | MAILBOX_t *pmb; |
@@ -893,8 +893,7 @@ lpfc_get_hba_info(struct lpfc_hba *phba, | |||
893 | pmb->mbxOwner = OWN_HOST; | 893 | pmb->mbxOwner = OWN_HOST; |
894 | pmboxq->context1 = NULL; | 894 | pmboxq->context1 = NULL; |
895 | 895 | ||
896 | if ((phba->pport->fc_flag & FC_OFFLINE_MODE) || | 896 | if (phba->pport->fc_flag & FC_OFFLINE_MODE) |
897 | (!(psli->sli_flag & LPFC_SLI_ACTIVE))) | ||
898 | rc = MBX_NOT_FINISHED; | 897 | rc = MBX_NOT_FINISHED; |
899 | else | 898 | else |
900 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); | 899 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
@@ -1797,12 +1796,11 @@ lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr, | |||
1797 | 1796 | ||
1798 | /* Validate and store the new name */ | 1797 | /* Validate and store the new name */ |
1799 | for (i=0, j=0; i < 16; i++) { | 1798 | for (i=0, j=0; i < 16; i++) { |
1800 | if ((*buf >= 'a') && (*buf <= 'f')) | 1799 | int value; |
1801 | j = ((j << 4) | ((*buf++ -'a') + 10)); | 1800 | |
1802 | else if ((*buf >= 'A') && (*buf <= 'F')) | 1801 | value = hex_to_bin(*buf++); |
1803 | j = ((j << 4) | ((*buf++ -'A') + 10)); | 1802 | if (value >= 0) |
1804 | else if ((*buf >= '0') && (*buf <= '9')) | 1803 | j = (j << 4) | value; |
1805 | j = ((j << 4) | (*buf++ -'0')); | ||
1806 | else | 1804 | else |
1807 | return -EINVAL; | 1805 | return -EINVAL; |
1808 | if (i % 2) { | 1806 | if (i % 2) { |
@@ -1890,12 +1888,11 @@ lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr, | |||
1890 | 1888 | ||
1891 | /* Validate and store the new name */ | 1889 | /* Validate and store the new name */ |
1892 | for (i=0, j=0; i < 16; i++) { | 1890 | for (i=0, j=0; i < 16; i++) { |
1893 | if ((*buf >= 'a') && (*buf <= 'f')) | 1891 | int value; |
1894 | j = ((j << 4) | ((*buf++ -'a') + 10)); | 1892 | |
1895 | else if ((*buf >= 'A') && (*buf <= 'F')) | 1893 | value = hex_to_bin(*buf++); |
1896 | j = ((j << 4) | ((*buf++ -'A') + 10)); | 1894 | if (value >= 0) |
1897 | else if ((*buf >= '0') && (*buf <= '9')) | 1895 | j = (j << 4) | value; |
1898 | j = ((j << 4) | (*buf++ -'0')); | ||
1899 | else | 1896 | else |
1900 | return -EINVAL; | 1897 | return -EINVAL; |
1901 | if (i % 2) { | 1898 | if (i % 2) { |
@@ -1949,6 +1946,59 @@ static DEVICE_ATTR(lpfc_enable_npiv, S_IRUGO, lpfc_enable_npiv_show, NULL); | |||
1949 | LPFC_ATTR_R(suppress_link_up, LPFC_INITIALIZE_LINK, LPFC_INITIALIZE_LINK, | 1946 | LPFC_ATTR_R(suppress_link_up, LPFC_INITIALIZE_LINK, LPFC_INITIALIZE_LINK, |
1950 | LPFC_DELAY_INIT_LINK_INDEFINITELY, | 1947 | LPFC_DELAY_INIT_LINK_INDEFINITELY, |
1951 | "Suppress Link Up at initialization"); | 1948 | "Suppress Link Up at initialization"); |
1949 | /* | ||
1950 | # lpfc_cnt: Number of IOCBs allocated for ELS, CT, and ABTS | ||
1951 | # 1 - (1024) | ||
1952 | # 2 - (2048) | ||
1953 | # 3 - (3072) | ||
1954 | # 4 - (4096) | ||
1955 | # 5 - (5120) | ||
1956 | */ | ||
1957 | static ssize_t | ||
1958 | lpfc_iocb_hw_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1959 | { | ||
1960 | struct Scsi_Host *shost = class_to_shost(dev); | ||
1961 | struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; | ||
1962 | |||
1963 | return snprintf(buf, PAGE_SIZE, "%d\n", phba->iocb_max); | ||
1964 | } | ||
1965 | |||
1966 | static DEVICE_ATTR(iocb_hw, S_IRUGO, | ||
1967 | lpfc_iocb_hw_show, NULL); | ||
1968 | static ssize_t | ||
1969 | lpfc_txq_hw_show(struct device *dev, struct device_attribute *attr, char *buf) | ||
1970 | { | ||
1971 | struct Scsi_Host *shost = class_to_shost(dev); | ||
1972 | struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; | ||
1973 | |||
1974 | return snprintf(buf, PAGE_SIZE, "%d\n", | ||
1975 | phba->sli.ring[LPFC_ELS_RING].txq_max); | ||
1976 | } | ||
1977 | |||
1978 | static DEVICE_ATTR(txq_hw, S_IRUGO, | ||
1979 | lpfc_txq_hw_show, NULL); | ||
1980 | static ssize_t | ||
1981 | lpfc_txcmplq_hw_show(struct device *dev, struct device_attribute *attr, | ||
1982 | char *buf) | ||
1983 | { | ||
1984 | struct Scsi_Host *shost = class_to_shost(dev); | ||
1985 | struct lpfc_hba *phba = ((struct lpfc_vport *) shost->hostdata)->phba; | ||
1986 | |||
1987 | return snprintf(buf, PAGE_SIZE, "%d\n", | ||
1988 | phba->sli.ring[LPFC_ELS_RING].txcmplq_max); | ||
1989 | } | ||
1990 | |||
1991 | static DEVICE_ATTR(txcmplq_hw, S_IRUGO, | ||
1992 | lpfc_txcmplq_hw_show, NULL); | ||
1993 | |||
1994 | int lpfc_iocb_cnt = 2; | ||
1995 | module_param(lpfc_iocb_cnt, int, 1); | ||
1996 | MODULE_PARM_DESC(lpfc_iocb_cnt, | ||
1997 | "Number of IOCBs alloc for ELS, CT, and ABTS: 1k to 5k IOCBs"); | ||
1998 | lpfc_param_show(iocb_cnt); | ||
1999 | lpfc_param_init(iocb_cnt, 2, 1, 5); | ||
2000 | static DEVICE_ATTR(lpfc_iocb_cnt, S_IRUGO, | ||
2001 | lpfc_iocb_cnt_show, NULL); | ||
1952 | 2002 | ||
1953 | /* | 2003 | /* |
1954 | # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear | 2004 | # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear |
@@ -2157,6 +2207,13 @@ LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128, | |||
2157 | "Max number of FCP commands we can queue to a specific LUN"); | 2207 | "Max number of FCP commands we can queue to a specific LUN"); |
2158 | 2208 | ||
2159 | /* | 2209 | /* |
2210 | # tgt_queue_depth: This parameter is used to limit the number of outstanding | ||
2211 | # commands per target port. Value range is [10,65535]. Default value is 65535. | ||
2212 | */ | ||
2213 | LPFC_VPORT_ATTR_R(tgt_queue_depth, 65535, 10, 65535, | ||
2214 | "Max number of FCP commands we can queue to a specific target port"); | ||
2215 | |||
2216 | /* | ||
2160 | # hba_queue_depth: This parameter is used to limit the number of outstanding | 2217 | # hba_queue_depth: This parameter is used to limit the number of outstanding |
2161 | # commands per lpfc HBA. Value range is [32,8192]. If this parameter | 2218 | # commands per lpfc HBA. Value range is [32,8192]. If this parameter |
2162 | # value is greater than the maximum number of exchanges supported by the HBA, | 2219 | # value is greater than the maximum number of exchanges supported by the HBA, |
@@ -2720,7 +2777,6 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = { | |||
2720 | .attr = { | 2777 | .attr = { |
2721 | .name = "lpfc_drvr_stat_data", | 2778 | .name = "lpfc_drvr_stat_data", |
2722 | .mode = S_IRUSR, | 2779 | .mode = S_IRUSR, |
2723 | .owner = THIS_MODULE, | ||
2724 | }, | 2780 | }, |
2725 | .size = LPFC_MAX_TARGET * MAX_STAT_DATA_SIZE_PER_TARGET, | 2781 | .size = LPFC_MAX_TARGET * MAX_STAT_DATA_SIZE_PER_TARGET, |
2726 | .read = sysfs_drvr_stat_data_read, | 2782 | .read = sysfs_drvr_stat_data_read, |
@@ -2890,9 +2946,6 @@ lpfc_aer_support_store(struct device *dev, struct device_attribute *attr, | |||
2890 | struct lpfc_hba *phba = vport->phba; | 2946 | struct lpfc_hba *phba = vport->phba; |
2891 | int val = 0, rc = -EINVAL; | 2947 | int val = 0, rc = -EINVAL; |
2892 | 2948 | ||
2893 | /* AER not supported on OC devices yet */ | ||
2894 | if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) | ||
2895 | return -EPERM; | ||
2896 | if (!isdigit(buf[0])) | 2949 | if (!isdigit(buf[0])) |
2897 | return -EINVAL; | 2950 | return -EINVAL; |
2898 | if (sscanf(buf, "%i", &val) != 1) | 2951 | if (sscanf(buf, "%i", &val) != 1) |
@@ -2965,12 +3018,6 @@ lpfc_param_show(aer_support) | |||
2965 | static int | 3018 | static int |
2966 | lpfc_aer_support_init(struct lpfc_hba *phba, int val) | 3019 | lpfc_aer_support_init(struct lpfc_hba *phba, int val) |
2967 | { | 3020 | { |
2968 | /* AER not supported on OC devices yet */ | ||
2969 | if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) { | ||
2970 | phba->cfg_aer_support = 0; | ||
2971 | return -EPERM; | ||
2972 | } | ||
2973 | |||
2974 | if (val == 0 || val == 1) { | 3021 | if (val == 0 || val == 1) { |
2975 | phba->cfg_aer_support = val; | 3022 | phba->cfg_aer_support = val; |
2976 | return 0; | 3023 | return 0; |
@@ -3015,9 +3062,6 @@ lpfc_aer_cleanup_state(struct device *dev, struct device_attribute *attr, | |||
3015 | struct lpfc_hba *phba = vport->phba; | 3062 | struct lpfc_hba *phba = vport->phba; |
3016 | int val, rc = -1; | 3063 | int val, rc = -1; |
3017 | 3064 | ||
3018 | /* AER not supported on OC devices yet */ | ||
3019 | if (phba->pci_dev_grp == LPFC_PCI_DEV_OC) | ||
3020 | return -EPERM; | ||
3021 | if (!isdigit(buf[0])) | 3065 | if (!isdigit(buf[0])) |
3022 | return -EINVAL; | 3066 | return -EINVAL; |
3023 | if (sscanf(buf, "%i", &val) != 1) | 3067 | if (sscanf(buf, "%i", &val) != 1) |
@@ -3083,7 +3127,7 @@ lpfc_max_scsicmpl_time_set(struct lpfc_vport *vport, int val) | |||
3083 | continue; | 3127 | continue; |
3084 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) | 3128 | if (ndlp->nlp_state == NLP_STE_UNUSED_NODE) |
3085 | continue; | 3129 | continue; |
3086 | ndlp->cmd_qdepth = LPFC_MAX_TGT_QDEPTH; | 3130 | ndlp->cmd_qdepth = vport->cfg_tgt_queue_depth; |
3087 | } | 3131 | } |
3088 | spin_unlock_irq(shost->host_lock); | 3132 | spin_unlock_irq(shost->host_lock); |
3089 | return 0; | 3133 | return 0; |
@@ -3287,6 +3331,7 @@ struct device_attribute *lpfc_hba_attrs[] = { | |||
3287 | &dev_attr_lpfc_temp_sensor, | 3331 | &dev_attr_lpfc_temp_sensor, |
3288 | &dev_attr_lpfc_log_verbose, | 3332 | &dev_attr_lpfc_log_verbose, |
3289 | &dev_attr_lpfc_lun_queue_depth, | 3333 | &dev_attr_lpfc_lun_queue_depth, |
3334 | &dev_attr_lpfc_tgt_queue_depth, | ||
3290 | &dev_attr_lpfc_hba_queue_depth, | 3335 | &dev_attr_lpfc_hba_queue_depth, |
3291 | &dev_attr_lpfc_peer_port_login, | 3336 | &dev_attr_lpfc_peer_port_login, |
3292 | &dev_attr_lpfc_nodev_tmo, | 3337 | &dev_attr_lpfc_nodev_tmo, |
@@ -3334,6 +3379,10 @@ struct device_attribute *lpfc_hba_attrs[] = { | |||
3334 | &dev_attr_lpfc_aer_support, | 3379 | &dev_attr_lpfc_aer_support, |
3335 | &dev_attr_lpfc_aer_state_cleanup, | 3380 | &dev_attr_lpfc_aer_state_cleanup, |
3336 | &dev_attr_lpfc_suppress_link_up, | 3381 | &dev_attr_lpfc_suppress_link_up, |
3382 | &dev_attr_lpfc_iocb_cnt, | ||
3383 | &dev_attr_iocb_hw, | ||
3384 | &dev_attr_txq_hw, | ||
3385 | &dev_attr_txcmplq_hw, | ||
3337 | NULL, | 3386 | NULL, |
3338 | }; | 3387 | }; |
3339 | 3388 | ||
@@ -3344,6 +3393,7 @@ struct device_attribute *lpfc_vport_attrs[] = { | |||
3344 | &dev_attr_lpfc_drvr_version, | 3393 | &dev_attr_lpfc_drvr_version, |
3345 | &dev_attr_lpfc_log_verbose, | 3394 | &dev_attr_lpfc_log_verbose, |
3346 | &dev_attr_lpfc_lun_queue_depth, | 3395 | &dev_attr_lpfc_lun_queue_depth, |
3396 | &dev_attr_lpfc_tgt_queue_depth, | ||
3347 | &dev_attr_lpfc_nodev_tmo, | 3397 | &dev_attr_lpfc_nodev_tmo, |
3348 | &dev_attr_lpfc_devloss_tmo, | 3398 | &dev_attr_lpfc_devloss_tmo, |
3349 | &dev_attr_lpfc_hba_queue_depth, | 3399 | &dev_attr_lpfc_hba_queue_depth, |
@@ -4042,8 +4092,7 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
4042 | pmboxq->context1 = NULL; | 4092 | pmboxq->context1 = NULL; |
4043 | pmboxq->vport = vport; | 4093 | pmboxq->vport = vport; |
4044 | 4094 | ||
4045 | if ((vport->fc_flag & FC_OFFLINE_MODE) || | 4095 | if (vport->fc_flag & FC_OFFLINE_MODE) |
4046 | (!(psli->sli_flag & LPFC_SLI_ACTIVE))) | ||
4047 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); | 4096 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); |
4048 | else | 4097 | else |
4049 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); | 4098 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
@@ -4067,8 +4116,7 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
4067 | pmboxq->context1 = NULL; | 4116 | pmboxq->context1 = NULL; |
4068 | pmboxq->vport = vport; | 4117 | pmboxq->vport = vport; |
4069 | 4118 | ||
4070 | if ((vport->fc_flag & FC_OFFLINE_MODE) || | 4119 | if (vport->fc_flag & FC_OFFLINE_MODE) |
4071 | (!(psli->sli_flag & LPFC_SLI_ACTIVE))) | ||
4072 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); | 4120 | rc = lpfc_sli_issue_mbox(phba, pmboxq, MBX_POLL); |
4073 | else | 4121 | else |
4074 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); | 4122 | rc = lpfc_sli_issue_mbox_wait(phba, pmboxq, phba->fc_ratov * 2); |
@@ -4521,6 +4569,7 @@ lpfc_get_cfgparam(struct lpfc_hba *phba) | |||
4521 | lpfc_hba_log_verbose_init(phba, lpfc_log_verbose); | 4569 | lpfc_hba_log_verbose_init(phba, lpfc_log_verbose); |
4522 | lpfc_aer_support_init(phba, lpfc_aer_support); | 4570 | lpfc_aer_support_init(phba, lpfc_aer_support); |
4523 | lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up); | 4571 | lpfc_suppress_link_up_init(phba, lpfc_suppress_link_up); |
4572 | lpfc_iocb_cnt_init(phba, lpfc_iocb_cnt); | ||
4524 | return; | 4573 | return; |
4525 | } | 4574 | } |
4526 | 4575 | ||
@@ -4533,6 +4582,7 @@ lpfc_get_vport_cfgparam(struct lpfc_vport *vport) | |||
4533 | { | 4582 | { |
4534 | lpfc_log_verbose_init(vport, lpfc_log_verbose); | 4583 | lpfc_log_verbose_init(vport, lpfc_log_verbose); |
4535 | lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth); | 4584 | lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth); |
4585 | lpfc_tgt_queue_depth_init(vport, lpfc_tgt_queue_depth); | ||
4536 | lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo); | 4586 | lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo); |
4537 | lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo); | 4587 | lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo); |
4538 | lpfc_peer_port_login_init(vport, lpfc_peer_port_login); | 4588 | lpfc_peer_port_login_init(vport, lpfc_peer_port_login); |