diff options
author | James Smart <james.smart@emulex.com> | 2010-11-20 23:11:48 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-12-21 13:23:59 -0500 |
commit | 76a95d75ede64e4f1684ddb8c626fdfdb641bda2 (patch) | |
tree | 53420aed0a91873a382b886bf3b3ca828df48edc /drivers | |
parent | 085c647c3377c3e39c8c572278507b1e1c7e7bf7 (diff) |
[SCSI] lpfc 8.3.19: Add SLI4 FC Discovery support
Add SLI4 FC Discovery support
- Replace READ_LA and READ_LA64 with READ_TOPOLOGY mailbox command.
- Converted the old READ_LA structure to use bf_set/get instead of bit fields.
- Rename HBA_FCOE_SUPPORT flag to HBA_FCOE_MODE. Flag now indicates function
is running as SLI-4 FC or FCoE port. Make sure flag reset each time
READ_REV completed as it can dynamically change.
- Removed BDE union in the READ_TOPOLOGY mailbox command and added a define to
define the ALPA MAP SIZE. Added FC Code for async events.
- Added code to support new 16G link speed.
- Define new set of values to keep track of valid user settable link speeds.
- Used new link speed definitions to define link speed max and bitmap.
- Redefined FDMI Port sppeds to be hax values and added the 16G value.
- Added new CQE trailer code for FC Events.
- Add lpfc_issue_init_vfi and lpfc_init_vfi_cmpl routines.
- Replace many calls to the initial_flogi routine with lpfc_issue_init_vfi.
- Add vp and vpi fields to the INIT_VFI mailbox command.
- Addapt lpfc_hba_init_link routine for SLI4 use.
- Use lpfc_hba_init_link call from lpfc_sli4_hba_setup.
- Add a check for FC mode to register the FCFI before init link.
- Convert lpfc_sli4_init_vpi to be called without a vpi (get it from vport).
Signed-off-by: Alex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: James Smart <james.smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/lpfc/lpfc.h | 19 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_attr.c | 91 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_bsg.c | 5 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_crtn.h | 5 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_ct.c | 48 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_els.c | 45 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hbadisc.c | 186 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw.h | 198 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_hw4.h | 7 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 137 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_mbox.c | 64 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli.c | 81 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_sli4.h | 2 | ||||
-rw-r--r-- | drivers/scsi/lpfc/lpfc_vport.c | 10 |
14 files changed, 516 insertions, 382 deletions
diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 196de40b906c..e86a0d2add3c 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h | |||
@@ -464,6 +464,23 @@ struct unsol_rcv_ct_ctx { | |||
464 | #define UNSOL_VALID 0x00000001 | 464 | #define UNSOL_VALID 0x00000001 |
465 | }; | 465 | }; |
466 | 466 | ||
467 | #define LPFC_USER_LINK_SPEED_AUTO 0 /* auto select (default)*/ | ||
468 | #define LPFC_USER_LINK_SPEED_1G 1 /* 1 Gigabaud */ | ||
469 | #define LPFC_USER_LINK_SPEED_2G 2 /* 2 Gigabaud */ | ||
470 | #define LPFC_USER_LINK_SPEED_4G 4 /* 4 Gigabaud */ | ||
471 | #define LPFC_USER_LINK_SPEED_8G 8 /* 8 Gigabaud */ | ||
472 | #define LPFC_USER_LINK_SPEED_10G 10 /* 10 Gigabaud */ | ||
473 | #define LPFC_USER_LINK_SPEED_16G 16 /* 16 Gigabaud */ | ||
474 | #define LPFC_USER_LINK_SPEED_MAX LPFC_USER_LINK_SPEED_16G | ||
475 | #define LPFC_USER_LINK_SPEED_BITMAP ((1 << LPFC_USER_LINK_SPEED_16G) | \ | ||
476 | (1 << LPFC_USER_LINK_SPEED_10G) | \ | ||
477 | (1 << LPFC_USER_LINK_SPEED_8G) | \ | ||
478 | (1 << LPFC_USER_LINK_SPEED_4G) | \ | ||
479 | (1 << LPFC_USER_LINK_SPEED_2G) | \ | ||
480 | (1 << LPFC_USER_LINK_SPEED_1G) | \ | ||
481 | (1 << LPFC_USER_LINK_SPEED_AUTO)) | ||
482 | #define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16" | ||
483 | |||
467 | struct lpfc_hba { | 484 | struct lpfc_hba { |
468 | /* SCSI interface function jump table entries */ | 485 | /* SCSI interface function jump table entries */ |
469 | int (*lpfc_new_scsi_buf) | 486 | int (*lpfc_new_scsi_buf) |
@@ -545,7 +562,7 @@ struct lpfc_hba { | |||
545 | uint32_t hba_flag; /* hba generic flags */ | 562 | uint32_t hba_flag; /* hba generic flags */ |
546 | #define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */ | 563 | #define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */ |
547 | #define DEFER_ERATT 0x2 /* Deferred error attention in progress */ | 564 | #define DEFER_ERATT 0x2 /* Deferred error attention in progress */ |
548 | #define HBA_FCOE_SUPPORT 0x4 /* HBA function supports FCOE */ | 565 | #define HBA_FCOE_MODE 0x4 /* HBA function in FCoE Mode */ |
549 | #define HBA_SP_QUEUE_EVT 0x8 /* Slow-path qevt posted to worker thread*/ | 566 | #define HBA_SP_QUEUE_EVT 0x8 /* Slow-path qevt posted to worker thread*/ |
550 | #define HBA_POST_RECEIVE_BUFFER 0x10 /* Rcv buffers need to be posted */ | 567 | #define HBA_POST_RECEIVE_BUFFER 0x10 /* Rcv buffers need to be posted */ |
551 | #define FCP_XRI_ABORT_EVENT 0x20 | 568 | #define FCP_XRI_ABORT_EVENT 0x20 |
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c1cbec01345d..45bd72a9f60e 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c | |||
@@ -52,10 +52,6 @@ | |||
52 | #define LPFC_MIN_DEVLOSS_TMO 1 | 52 | #define LPFC_MIN_DEVLOSS_TMO 1 |
53 | #define LPFC_MAX_DEVLOSS_TMO 255 | 53 | #define LPFC_MAX_DEVLOSS_TMO 255 |
54 | 54 | ||
55 | #define LPFC_MAX_LINK_SPEED 8 | ||
56 | #define LPFC_LINK_SPEED_BITMAP 0x00000117 | ||
57 | #define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8" | ||
58 | |||
59 | /** | 55 | /** |
60 | * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules | 56 | * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules |
61 | * @incr: integer to convert. | 57 | * @incr: integer to convert. |
@@ -463,7 +459,7 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr, | |||
463 | if (phba->sli.sli_flag & LPFC_MENLO_MAINT) | 459 | if (phba->sli.sli_flag & LPFC_MENLO_MAINT) |
464 | len += snprintf(buf + len, PAGE_SIZE-len, | 460 | len += snprintf(buf + len, PAGE_SIZE-len, |
465 | " Menlo Maint Mode\n"); | 461 | " Menlo Maint Mode\n"); |
466 | else if (phba->fc_topology == TOPOLOGY_LOOP) { | 462 | else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
467 | if (vport->fc_flag & FC_PUBLIC_LOOP) | 463 | if (vport->fc_flag & FC_PUBLIC_LOOP) |
468 | len += snprintf(buf + len, PAGE_SIZE-len, | 464 | len += snprintf(buf + len, PAGE_SIZE-len, |
469 | " Public Loop\n"); | 465 | " Public Loop\n"); |
@@ -2837,14 +2833,8 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = { | |||
2837 | /* | 2833 | /* |
2838 | # lpfc_link_speed: Link speed selection for initializing the Fibre Channel | 2834 | # lpfc_link_speed: Link speed selection for initializing the Fibre Channel |
2839 | # connection. | 2835 | # connection. |
2840 | # 0 = auto select (default) | 2836 | # Value range is [0,16]. Default value is 0. |
2841 | # 1 = 1 Gigabaud | ||
2842 | # 2 = 2 Gigabaud | ||
2843 | # 4 = 4 Gigabaud | ||
2844 | # 8 = 8 Gigabaud | ||
2845 | # Value range is [0,8]. Default value is 0. | ||
2846 | */ | 2837 | */ |
2847 | |||
2848 | /** | 2838 | /** |
2849 | * lpfc_link_speed_set - Set the adapters link speed | 2839 | * lpfc_link_speed_set - Set the adapters link speed |
2850 | * @phba: lpfc_hba pointer. | 2840 | * @phba: lpfc_hba pointer. |
@@ -2869,7 +2859,7 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, | |||
2869 | struct Scsi_Host *shost = class_to_shost(dev); | 2859 | struct Scsi_Host *shost = class_to_shost(dev); |
2870 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; | 2860 | struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; |
2871 | struct lpfc_hba *phba = vport->phba; | 2861 | struct lpfc_hba *phba = vport->phba; |
2872 | int val = 0; | 2862 | int val = LPFC_USER_LINK_SPEED_AUTO; |
2873 | int nolip = 0; | 2863 | int nolip = 0; |
2874 | const char *val_buf = buf; | 2864 | const char *val_buf = buf; |
2875 | int err; | 2865 | int err; |
@@ -2885,15 +2875,20 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, | |||
2885 | if (sscanf(val_buf, "%i", &val) != 1) | 2875 | if (sscanf(val_buf, "%i", &val) != 1) |
2886 | return -EINVAL; | 2876 | return -EINVAL; |
2887 | 2877 | ||
2888 | if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || | 2878 | if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || |
2889 | ((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || | 2879 | ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || |
2890 | ((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || | 2880 | ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || |
2891 | ((val == LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || | 2881 | ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || |
2892 | ((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb))) | 2882 | ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) || |
2883 | ((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb))) { | ||
2884 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | ||
2885 | "2879 lpfc_link_speed attribute cannot be set " | ||
2886 | "to %d. Speed is not supported by this port.\n", | ||
2887 | val); | ||
2893 | return -EINVAL; | 2888 | return -EINVAL; |
2894 | 2889 | } | |
2895 | if ((val >= 0 && val <= 8) | 2890 | if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && |
2896 | && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { | 2891 | (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { |
2897 | prev_val = phba->cfg_link_speed; | 2892 | prev_val = phba->cfg_link_speed; |
2898 | phba->cfg_link_speed = val; | 2893 | phba->cfg_link_speed = val; |
2899 | if (nolip) | 2894 | if (nolip) |
@@ -2906,11 +2901,9 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, | |||
2906 | } else | 2901 | } else |
2907 | return strlen(buf); | 2902 | return strlen(buf); |
2908 | } | 2903 | } |
2909 | |||
2910 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 2904 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
2911 | "%d:0469 lpfc_link_speed attribute cannot be set to %d, " | 2905 | "0469 lpfc_link_speed attribute cannot be set to %d, " |
2912 | "allowed range is [0, 8]\n", | 2906 | "allowed values are ["LPFC_LINK_SPEED_STRING"]\n", val); |
2913 | phba->brd_no, val); | ||
2914 | return -EINVAL; | 2907 | return -EINVAL; |
2915 | } | 2908 | } |
2916 | 2909 | ||
@@ -2938,8 +2931,8 @@ lpfc_param_show(link_speed) | |||
2938 | static int | 2931 | static int |
2939 | lpfc_link_speed_init(struct lpfc_hba *phba, int val) | 2932 | lpfc_link_speed_init(struct lpfc_hba *phba, int val) |
2940 | { | 2933 | { |
2941 | if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED) | 2934 | if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) && |
2942 | && (LPFC_LINK_SPEED_BITMAP & (1 << val))) { | 2935 | (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) { |
2943 | phba->cfg_link_speed = val; | 2936 | phba->cfg_link_speed = val; |
2944 | return 0; | 2937 | return 0; |
2945 | } | 2938 | } |
@@ -2947,12 +2940,12 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val) | |||
2947 | "0405 lpfc_link_speed attribute cannot " | 2940 | "0405 lpfc_link_speed attribute cannot " |
2948 | "be set to %d, allowed values are " | 2941 | "be set to %d, allowed values are " |
2949 | "["LPFC_LINK_SPEED_STRING"]\n", val); | 2942 | "["LPFC_LINK_SPEED_STRING"]\n", val); |
2950 | phba->cfg_link_speed = 0; | 2943 | phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; |
2951 | return -EINVAL; | 2944 | return -EINVAL; |
2952 | } | 2945 | } |
2953 | 2946 | ||
2954 | static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, | 2947 | static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, |
2955 | lpfc_link_speed_show, lpfc_link_speed_store); | 2948 | lpfc_link_speed_show, lpfc_link_speed_store); |
2956 | 2949 | ||
2957 | /* | 2950 | /* |
2958 | # lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER) | 2951 | # lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER) |
@@ -3798,8 +3791,7 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj, | |||
3798 | } | 3791 | } |
3799 | break; | 3792 | break; |
3800 | case MBX_READ_SPARM64: | 3793 | case MBX_READ_SPARM64: |
3801 | case MBX_READ_LA: | 3794 | case MBX_READ_TOPOLOGY: |
3802 | case MBX_READ_LA64: | ||
3803 | case MBX_REG_LOGIN: | 3795 | case MBX_REG_LOGIN: |
3804 | case MBX_REG_LOGIN64: | 3796 | case MBX_REG_LOGIN64: |
3805 | case MBX_CONFIG_PORT: | 3797 | case MBX_CONFIG_PORT: |
@@ -3989,7 +3981,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost) | |||
3989 | if (vport->port_type == LPFC_NPIV_PORT) { | 3981 | if (vport->port_type == LPFC_NPIV_PORT) { |
3990 | fc_host_port_type(shost) = FC_PORTTYPE_NPIV; | 3982 | fc_host_port_type(shost) = FC_PORTTYPE_NPIV; |
3991 | } else if (lpfc_is_link_up(phba)) { | 3983 | } else if (lpfc_is_link_up(phba)) { |
3992 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 3984 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
3993 | if (vport->fc_flag & FC_PUBLIC_LOOP) | 3985 | if (vport->fc_flag & FC_PUBLIC_LOOP) |
3994 | fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; | 3986 | fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; |
3995 | else | 3987 | else |
@@ -4058,23 +4050,26 @@ lpfc_get_host_speed(struct Scsi_Host *shost) | |||
4058 | 4050 | ||
4059 | if (lpfc_is_link_up(phba)) { | 4051 | if (lpfc_is_link_up(phba)) { |
4060 | switch(phba->fc_linkspeed) { | 4052 | switch(phba->fc_linkspeed) { |
4061 | case LA_1GHZ_LINK: | 4053 | case LPFC_LINK_SPEED_1GHZ: |
4062 | fc_host_speed(shost) = FC_PORTSPEED_1GBIT; | 4054 | fc_host_speed(shost) = FC_PORTSPEED_1GBIT; |
4063 | break; | 4055 | break; |
4064 | case LA_2GHZ_LINK: | 4056 | case LPFC_LINK_SPEED_2GHZ: |
4065 | fc_host_speed(shost) = FC_PORTSPEED_2GBIT; | 4057 | fc_host_speed(shost) = FC_PORTSPEED_2GBIT; |
4066 | break; | 4058 | break; |
4067 | case LA_4GHZ_LINK: | 4059 | case LPFC_LINK_SPEED_4GHZ: |
4068 | fc_host_speed(shost) = FC_PORTSPEED_4GBIT; | 4060 | fc_host_speed(shost) = FC_PORTSPEED_4GBIT; |
4069 | break; | 4061 | break; |
4070 | case LA_8GHZ_LINK: | 4062 | case LPFC_LINK_SPEED_8GHZ: |
4071 | fc_host_speed(shost) = FC_PORTSPEED_8GBIT; | 4063 | fc_host_speed(shost) = FC_PORTSPEED_8GBIT; |
4072 | break; | 4064 | break; |
4073 | case LA_10GHZ_LINK: | 4065 | case LPFC_LINK_SPEED_10GHZ: |
4074 | fc_host_speed(shost) = FC_PORTSPEED_10GBIT; | 4066 | fc_host_speed(shost) = FC_PORTSPEED_10GBIT; |
4075 | break; | 4067 | break; |
4076 | default: | 4068 | case LPFC_LINK_SPEED_16GHZ: |
4077 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; | 4069 | fc_host_speed(shost) = FC_PORTSPEED_16GBIT; |
4070 | break; | ||
4071 | default: | ||
4072 | fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; | ||
4078 | break; | 4073 | break; |
4079 | } | 4074 | } |
4080 | } else | 4075 | } else |
@@ -4097,7 +4092,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost) | |||
4097 | spin_lock_irq(shost->host_lock); | 4092 | spin_lock_irq(shost->host_lock); |
4098 | 4093 | ||
4099 | if ((vport->fc_flag & FC_FABRIC) || | 4094 | if ((vport->fc_flag & FC_FABRIC) || |
4100 | ((phba->fc_topology == TOPOLOGY_LOOP) && | 4095 | ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && |
4101 | (vport->fc_flag & FC_PUBLIC_LOOP))) | 4096 | (vport->fc_flag & FC_PUBLIC_LOOP))) |
4102 | node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); | 4097 | node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); |
4103 | else | 4098 | else |
@@ -4208,11 +4203,11 @@ lpfc_get_stats(struct Scsi_Host *shost) | |||
4208 | hs->invalid_crc_count -= lso->invalid_crc_count; | 4203 | hs->invalid_crc_count -= lso->invalid_crc_count; |
4209 | hs->error_frames -= lso->error_frames; | 4204 | hs->error_frames -= lso->error_frames; |
4210 | 4205 | ||
4211 | if (phba->hba_flag & HBA_FCOE_SUPPORT) { | 4206 | if (phba->hba_flag & HBA_FCOE_MODE) { |
4212 | hs->lip_count = -1; | 4207 | hs->lip_count = -1; |
4213 | hs->nos_count = (phba->link_events >> 1); | 4208 | hs->nos_count = (phba->link_events >> 1); |
4214 | hs->nos_count -= lso->link_events; | 4209 | hs->nos_count -= lso->link_events; |
4215 | } else if (phba->fc_topology == TOPOLOGY_LOOP) { | 4210 | } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
4216 | hs->lip_count = (phba->fc_eventTag >> 1); | 4211 | hs->lip_count = (phba->fc_eventTag >> 1); |
4217 | hs->lip_count -= lso->link_events; | 4212 | hs->lip_count -= lso->link_events; |
4218 | hs->nos_count = -1; | 4213 | hs->nos_count = -1; |
@@ -4303,7 +4298,7 @@ lpfc_reset_stats(struct Scsi_Host *shost) | |||
4303 | lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; | 4298 | lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; |
4304 | lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; | 4299 | lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; |
4305 | lso->error_frames = pmb->un.varRdLnk.crcCnt; | 4300 | lso->error_frames = pmb->un.varRdLnk.crcCnt; |
4306 | if (phba->hba_flag & HBA_FCOE_SUPPORT) | 4301 | if (phba->hba_flag & HBA_FCOE_MODE) |
4307 | lso->link_events = (phba->link_events >> 1); | 4302 | lso->link_events = (phba->link_events >> 1); |
4308 | else | 4303 | else |
4309 | lso->link_events = (phba->fc_eventTag >> 1); | 4304 | lso->link_events = (phba->fc_eventTag >> 1); |
diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index c216f4eb0e37..50dbfc8018f6 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c | |||
@@ -2601,12 +2601,11 @@ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba, | |||
2601 | phba->wait_4_mlo_maint_flg = 1; | 2601 | phba->wait_4_mlo_maint_flg = 1; |
2602 | } else if (mb->un.varWords[0] == SETVAR_MLORST) { | 2602 | } else if (mb->un.varWords[0] == SETVAR_MLORST) { |
2603 | phba->link_flag &= ~LS_LOOPBACK_MODE; | 2603 | phba->link_flag &= ~LS_LOOPBACK_MODE; |
2604 | phba->fc_topology = TOPOLOGY_PT_PT; | 2604 | phba->fc_topology = LPFC_TOPOLOGY_PT_PT; |
2605 | } | 2605 | } |
2606 | break; | 2606 | break; |
2607 | case MBX_READ_SPARM64: | 2607 | case MBX_READ_SPARM64: |
2608 | case MBX_READ_LA: | 2608 | case MBX_READ_TOPOLOGY: |
2609 | case MBX_READ_LA64: | ||
2610 | case MBX_REG_LOGIN: | 2609 | case MBX_REG_LOGIN: |
2611 | case MBX_REG_LOGIN64: | 2610 | case MBX_REG_LOGIN64: |
2612 | case MBX_CONFIG_PORT: | 2611 | case MBX_CONFIG_PORT: |
diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index a5f5a093a8a4..1ea3075e3c5d 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h | |||
@@ -31,7 +31,7 @@ void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *); | |||
31 | void lpfc_config_async(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t); | 31 | void lpfc_config_async(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t); |
32 | 32 | ||
33 | void lpfc_heart_beat(struct lpfc_hba *, LPFC_MBOXQ_t *); | 33 | void lpfc_heart_beat(struct lpfc_hba *, LPFC_MBOXQ_t *); |
34 | int lpfc_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *, struct lpfc_dmabuf *); | 34 | int lpfc_read_topology(struct lpfc_hba *, LPFC_MBOXQ_t *, struct lpfc_dmabuf *); |
35 | void lpfc_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *); | 35 | void lpfc_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *); |
36 | void lpfc_issue_clear_la(struct lpfc_hba *, struct lpfc_vport *); | 36 | void lpfc_issue_clear_la(struct lpfc_hba *, struct lpfc_vport *); |
37 | void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *); | 37 | void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *); |
@@ -64,7 +64,7 @@ void lpfc_cleanup_pending_mbox(struct lpfc_vport *); | |||
64 | int lpfc_linkdown(struct lpfc_hba *); | 64 | int lpfc_linkdown(struct lpfc_hba *); |
65 | void lpfc_linkdown_port(struct lpfc_vport *); | 65 | void lpfc_linkdown_port(struct lpfc_vport *); |
66 | void lpfc_port_link_failure(struct lpfc_vport *); | 66 | void lpfc_port_link_failure(struct lpfc_vport *); |
67 | void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *); | 67 | void lpfc_mbx_cmpl_read_topology(struct lpfc_hba *, LPFC_MBOXQ_t *); |
68 | void lpfc_init_vpi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *); | 68 | void lpfc_init_vpi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *); |
69 | void lpfc_cancel_all_vport_retry_delay_timer(struct lpfc_hba *); | 69 | void lpfc_cancel_all_vport_retry_delay_timer(struct lpfc_hba *); |
70 | void lpfc_retry_pport_discovery(struct lpfc_hba *); | 70 | void lpfc_retry_pport_discovery(struct lpfc_hba *); |
@@ -121,6 +121,7 @@ void lpfc_end_rscn(struct lpfc_vport *); | |||
121 | int lpfc_els_chk_latt(struct lpfc_vport *); | 121 | int lpfc_els_chk_latt(struct lpfc_vport *); |
122 | int lpfc_els_abort_flogi(struct lpfc_hba *); | 122 | int lpfc_els_abort_flogi(struct lpfc_hba *); |
123 | int lpfc_initial_flogi(struct lpfc_vport *); | 123 | int lpfc_initial_flogi(struct lpfc_vport *); |
124 | void lpfc_issue_init_vfi(struct lpfc_vport *); | ||
124 | int lpfc_initial_fdisc(struct lpfc_vport *); | 125 | int lpfc_initial_fdisc(struct lpfc_vport *); |
125 | int lpfc_issue_els_plogi(struct lpfc_vport *, uint32_t, uint8_t); | 126 | int lpfc_issue_els_plogi(struct lpfc_vport *, uint32_t, uint8_t); |
126 | int lpfc_issue_els_prli(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t); | 127 | int lpfc_issue_els_prli(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t); |
diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index 463b74902ac4..c004fa9a681e 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c | |||
@@ -48,14 +48,14 @@ | |||
48 | #include "lpfc_vport.h" | 48 | #include "lpfc_vport.h" |
49 | #include "lpfc_debugfs.h" | 49 | #include "lpfc_debugfs.h" |
50 | 50 | ||
51 | #define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver | 51 | /* FDMI Port Speed definitions */ |
52 | * incapable of reporting */ | 52 | #define HBA_PORTSPEED_1GBIT 0x0001 /* 1 GBit/sec */ |
53 | #define HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */ | 53 | #define HBA_PORTSPEED_2GBIT 0x0002 /* 2 GBit/sec */ |
54 | #define HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */ | 54 | #define HBA_PORTSPEED_4GBIT 0x0008 /* 4 GBit/sec */ |
55 | #define HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */ | 55 | #define HBA_PORTSPEED_10GBIT 0x0004 /* 10 GBit/sec */ |
56 | #define HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */ | 56 | #define HBA_PORTSPEED_8GBIT 0x0010 /* 8 GBit/sec */ |
57 | #define HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */ | 57 | #define HBA_PORTSPEED_16GBIT 0x0020 /* 16 GBit/sec */ |
58 | #define HBA_PORTSPEED_NOT_NEGOTIATED 5 /* Speed not established */ | 58 | #define HBA_PORTSPEED_UNKNOWN 0x0800 /* Unknown */ |
59 | 59 | ||
60 | #define FOURBYTES 4 | 60 | #define FOURBYTES 4 |
61 | 61 | ||
@@ -1593,8 +1593,10 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1593 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); | 1593 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); |
1594 | 1594 | ||
1595 | ae->un.SupportSpeed = 0; | 1595 | ae->un.SupportSpeed = 0; |
1596 | if (phba->lmt & LMT_16Gb) | ||
1597 | ae->un.SupportSpeed |= HBA_PORTSPEED_16GBIT; | ||
1596 | if (phba->lmt & LMT_10Gb) | 1598 | if (phba->lmt & LMT_10Gb) |
1597 | ae->un.SupportSpeed = HBA_PORTSPEED_10GBIT; | 1599 | ae->un.SupportSpeed |= HBA_PORTSPEED_10GBIT; |
1598 | if (phba->lmt & LMT_8Gb) | 1600 | if (phba->lmt & LMT_8Gb) |
1599 | ae->un.SupportSpeed |= HBA_PORTSPEED_8GBIT; | 1601 | ae->un.SupportSpeed |= HBA_PORTSPEED_8GBIT; |
1600 | if (phba->lmt & LMT_4Gb) | 1602 | if (phba->lmt & LMT_4Gb) |
@@ -1612,24 +1614,26 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) | |||
1612 | ae->ad.bits.AttrType = be16_to_cpu(PORT_SPEED); | 1614 | ae->ad.bits.AttrType = be16_to_cpu(PORT_SPEED); |
1613 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); | 1615 | ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); |
1614 | switch(phba->fc_linkspeed) { | 1616 | switch(phba->fc_linkspeed) { |
1615 | case LA_1GHZ_LINK: | 1617 | case LPFC_LINK_SPEED_1GHZ: |
1616 | ae->un.PortSpeed = HBA_PORTSPEED_1GBIT; | 1618 | ae->un.PortSpeed = HBA_PORTSPEED_1GBIT; |
1617 | break; | 1619 | break; |
1618 | case LA_2GHZ_LINK: | 1620 | case LPFC_LINK_SPEED_2GHZ: |
1619 | ae->un.PortSpeed = HBA_PORTSPEED_2GBIT; | 1621 | ae->un.PortSpeed = HBA_PORTSPEED_2GBIT; |
1620 | break; | 1622 | break; |
1621 | case LA_4GHZ_LINK: | 1623 | case LPFC_LINK_SPEED_4GHZ: |
1622 | ae->un.PortSpeed = HBA_PORTSPEED_4GBIT; | 1624 | ae->un.PortSpeed = HBA_PORTSPEED_4GBIT; |
1623 | break; | 1625 | break; |
1624 | case LA_8GHZ_LINK: | 1626 | case LPFC_LINK_SPEED_8GHZ: |
1625 | ae->un.PortSpeed = HBA_PORTSPEED_8GBIT; | 1627 | ae->un.PortSpeed = HBA_PORTSPEED_8GBIT; |
1626 | break; | 1628 | break; |
1627 | case LA_10GHZ_LINK: | 1629 | case LPFC_LINK_SPEED_10GHZ: |
1628 | ae->un.PortSpeed = HBA_PORTSPEED_10GBIT; | 1630 | ae->un.PortSpeed = HBA_PORTSPEED_10GBIT; |
1629 | break; | 1631 | break; |
1630 | default: | 1632 | case LPFC_LINK_SPEED_16GHZ: |
1631 | ae->un.PortSpeed = | 1633 | ae->un.PortSpeed = HBA_PORTSPEED_16GBIT; |
1632 | HBA_PORTSPEED_UNKNOWN; | 1634 | break; |
1635 | default: | ||
1636 | ae->un.PortSpeed = HBA_PORTSPEED_UNKNOWN; | ||
1633 | break; | 1637 | break; |
1634 | } | 1638 | } |
1635 | pab->ab.EntryCnt++; | 1639 | pab->ab.EntryCnt++; |
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 196a7bf905a1..04072ce9c905 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c | |||
@@ -523,7 +523,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
523 | phba->fc_edtovResol = sp->cmn.edtovResolution; | 523 | phba->fc_edtovResol = sp->cmn.edtovResolution; |
524 | phba->fc_ratov = (be32_to_cpu(sp->cmn.w2.r_a_tov) + 999) / 1000; | 524 | phba->fc_ratov = (be32_to_cpu(sp->cmn.w2.r_a_tov) + 999) / 1000; |
525 | 525 | ||
526 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 526 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
527 | spin_lock_irq(shost->host_lock); | 527 | spin_lock_irq(shost->host_lock); |
528 | vport->fc_flag |= FC_PUBLIC_LOOP; | 528 | vport->fc_flag |= FC_PUBLIC_LOOP; |
529 | spin_unlock_irq(shost->host_lock); | 529 | spin_unlock_irq(shost->host_lock); |
@@ -832,6 +832,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
832 | if (lpfc_els_retry(phba, cmdiocb, rspiocb)) | 832 | if (lpfc_els_retry(phba, cmdiocb, rspiocb)) |
833 | goto out; | 833 | goto out; |
834 | 834 | ||
835 | /* FLOGI failure */ | ||
836 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, | ||
837 | "0100 FLOGI failure Status:x%x/x%x TMO:x%x\n", | ||
838 | irsp->ulpStatus, irsp->un.ulpWord[4], | ||
839 | irsp->ulpTimeout); | ||
840 | |||
835 | /* FLOGI failed, so there is no fabric */ | 841 | /* FLOGI failed, so there is no fabric */ |
836 | spin_lock_irq(shost->host_lock); | 842 | spin_lock_irq(shost->host_lock); |
837 | vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); | 843 | vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); |
@@ -843,13 +849,16 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
843 | */ | 849 | */ |
844 | if (phba->alpa_map[0] == 0) { | 850 | if (phba->alpa_map[0] == 0) { |
845 | vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; | 851 | vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; |
852 | if ((phba->sli_rev == LPFC_SLI_REV4) && | ||
853 | (!(vport->fc_flag & FC_VFI_REGISTERED) || | ||
854 | (vport->fc_prevDID != vport->fc_myDID))) { | ||
855 | if (vport->fc_flag & FC_VFI_REGISTERED) | ||
856 | lpfc_sli4_unreg_all_rpis(vport); | ||
857 | lpfc_issue_reg_vfi(vport); | ||
858 | lpfc_nlp_put(ndlp); | ||
859 | goto out; | ||
860 | } | ||
846 | } | 861 | } |
847 | |||
848 | /* FLOGI failure */ | ||
849 | lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, | ||
850 | "0100 FLOGI failure Status:x%x/x%x TMO:x%x\n", | ||
851 | irsp->ulpStatus, irsp->un.ulpWord[4], | ||
852 | irsp->ulpTimeout); | ||
853 | goto flogifail; | 862 | goto flogifail; |
854 | } | 863 | } |
855 | spin_lock_irq(shost->host_lock); | 864 | spin_lock_irq(shost->host_lock); |
@@ -879,7 +888,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
879 | */ | 888 | */ |
880 | if (sp->cmn.fPort) | 889 | if (sp->cmn.fPort) |
881 | rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp); | 890 | rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp); |
882 | else if (!(phba->hba_flag & HBA_FCOE_SUPPORT)) | 891 | else if (!(phba->hba_flag & HBA_FCOE_MODE)) |
883 | rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp); | 892 | rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp); |
884 | else { | 893 | else { |
885 | lpfc_printf_vlog(vport, KERN_ERR, | 894 | lpfc_printf_vlog(vport, KERN_ERR, |
@@ -1027,7 +1036,7 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, | |||
1027 | icmd->ulpCt_l = 0; | 1036 | icmd->ulpCt_l = 0; |
1028 | } | 1037 | } |
1029 | 1038 | ||
1030 | if (phba->fc_topology != TOPOLOGY_LOOP) { | 1039 | if (phba->fc_topology != LPFC_TOPOLOGY_LOOP) { |
1031 | icmd->un.elsreq64.myID = 0; | 1040 | icmd->un.elsreq64.myID = 0; |
1032 | icmd->un.elsreq64.fl = 1; | 1041 | icmd->un.elsreq64.fl = 1; |
1033 | } | 1042 | } |
@@ -2722,7 +2731,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
2722 | if (cmd == ELS_CMD_FLOGI) { | 2731 | if (cmd == ELS_CMD_FLOGI) { |
2723 | if (PCI_DEVICE_ID_HORNET == | 2732 | if (PCI_DEVICE_ID_HORNET == |
2724 | phba->pcidev->device) { | 2733 | phba->pcidev->device) { |
2725 | phba->fc_topology = TOPOLOGY_LOOP; | 2734 | phba->fc_topology = LPFC_TOPOLOGY_LOOP; |
2726 | phba->pport->fc_myDID = 0; | 2735 | phba->pport->fc_myDID = 0; |
2727 | phba->alpa_map[0] = 0; | 2736 | phba->alpa_map[0] = 0; |
2728 | phba->alpa_map[1] = 0; | 2737 | phba->alpa_map[1] = 0; |
@@ -2877,7 +2886,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
2877 | retry = 1; | 2886 | retry = 1; |
2878 | 2887 | ||
2879 | if (((cmd == ELS_CMD_FLOGI) || (cmd == ELS_CMD_FDISC)) && | 2888 | if (((cmd == ELS_CMD_FLOGI) || (cmd == ELS_CMD_FDISC)) && |
2880 | (phba->fc_topology != TOPOLOGY_LOOP) && | 2889 | (phba->fc_topology != LPFC_TOPOLOGY_LOOP) && |
2881 | !lpfc_error_lost_link(irsp)) { | 2890 | !lpfc_error_lost_link(irsp)) { |
2882 | /* FLOGI retry policy */ | 2891 | /* FLOGI retry policy */ |
2883 | retry = 1; | 2892 | retry = 1; |
@@ -4597,7 +4606,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
4597 | 4606 | ||
4598 | lpfc_set_disctmo(vport); | 4607 | lpfc_set_disctmo(vport); |
4599 | 4608 | ||
4600 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 4609 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
4601 | /* We should never receive a FLOGI in loop mode, ignore it */ | 4610 | /* We should never receive a FLOGI in loop mode, ignore it */ |
4602 | did = icmd->un.elsreq64.remoteID; | 4611 | did = icmd->un.elsreq64.remoteID; |
4603 | 4612 | ||
@@ -4940,7 +4949,7 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
4940 | pcmd += sizeof(uint32_t); /* Skip past command */ | 4949 | pcmd += sizeof(uint32_t); /* Skip past command */ |
4941 | rps_rsp = (RPS_RSP *)pcmd; | 4950 | rps_rsp = (RPS_RSP *)pcmd; |
4942 | 4951 | ||
4943 | if (phba->fc_topology != TOPOLOGY_LOOP) | 4952 | if (phba->fc_topology != LPFC_TOPOLOGY_LOOP) |
4944 | status = 0x10; | 4953 | status = 0x10; |
4945 | else | 4954 | else |
4946 | status = 0x8; | 4955 | status = 0x8; |
@@ -5482,7 +5491,7 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, | |||
5482 | (memcmp(&phba->fc_fabparam.portName, &fp->FportName, | 5491 | (memcmp(&phba->fc_fabparam.portName, &fp->FportName, |
5483 | sizeof(struct lpfc_name)))) { | 5492 | sizeof(struct lpfc_name)))) { |
5484 | /* This port has switched fabrics. FLOGI is required */ | 5493 | /* This port has switched fabrics. FLOGI is required */ |
5485 | lpfc_initial_flogi(vport); | 5494 | lpfc_issue_init_vfi(vport); |
5486 | } else { | 5495 | } else { |
5487 | /* FAN verified - skip FLOGI */ | 5496 | /* FAN verified - skip FLOGI */ |
5488 | vport->fc_myDID = vport->fc_prevDID; | 5497 | vport->fc_myDID = vport->fc_prevDID; |
@@ -6373,7 +6382,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) | |||
6373 | if (!ndlp) { | 6382 | if (!ndlp) { |
6374 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); | 6383 | ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); |
6375 | if (!ndlp) { | 6384 | if (!ndlp) { |
6376 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 6385 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
6377 | lpfc_disc_start(vport); | 6386 | lpfc_disc_start(vport); |
6378 | return; | 6387 | return; |
6379 | } | 6388 | } |
@@ -6386,7 +6395,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) | |||
6386 | } else if (!NLP_CHK_NODE_ACT(ndlp)) { | 6395 | } else if (!NLP_CHK_NODE_ACT(ndlp)) { |
6387 | ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE); | 6396 | ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE); |
6388 | if (!ndlp) { | 6397 | if (!ndlp) { |
6389 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 6398 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
6390 | lpfc_disc_start(vport); | 6399 | lpfc_disc_start(vport); |
6391 | return; | 6400 | return; |
6392 | } | 6401 | } |
@@ -6510,7 +6519,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
6510 | spin_unlock_irq(shost->host_lock); | 6519 | spin_unlock_irq(shost->host_lock); |
6511 | if (vport->port_type == LPFC_PHYSICAL_PORT | 6520 | if (vport->port_type == LPFC_PHYSICAL_PORT |
6512 | && !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG)) | 6521 | && !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG)) |
6513 | lpfc_initial_flogi(vport); | 6522 | lpfc_issue_init_vfi(vport); |
6514 | else | 6523 | else |
6515 | lpfc_initial_fdisc(vport); | 6524 | lpfc_initial_fdisc(vport); |
6516 | break; | 6525 | break; |
@@ -6747,7 +6756,7 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, | |||
6747 | vport->fc_flag &= ~FC_VPORT_CVL_RCVD; | 6756 | vport->fc_flag &= ~FC_VPORT_CVL_RCVD; |
6748 | vport->fc_flag &= ~FC_VPORT_LOGO_RCVD; | 6757 | vport->fc_flag &= ~FC_VPORT_LOGO_RCVD; |
6749 | vport->fc_flag |= FC_FABRIC; | 6758 | vport->fc_flag |= FC_FABRIC; |
6750 | if (vport->phba->fc_topology == TOPOLOGY_LOOP) | 6759 | if (vport->phba->fc_topology == LPFC_TOPOLOGY_LOOP) |
6751 | vport->fc_flag |= FC_PUBLIC_LOOP; | 6760 | vport->fc_flag |= FC_PUBLIC_LOOP; |
6752 | spin_unlock_irq(shost->host_lock); | 6761 | spin_unlock_irq(shost->host_lock); |
6753 | 6762 | ||
diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index 57ab799da2e2..e8d27c958510 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c | |||
@@ -1064,7 +1064,7 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1064 | 1064 | ||
1065 | mempool_free(pmb, phba->mbox_mem_pool); | 1065 | mempool_free(pmb, phba->mbox_mem_pool); |
1066 | 1066 | ||
1067 | if (phba->fc_topology == TOPOLOGY_LOOP && | 1067 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP && |
1068 | vport->fc_flag & FC_PUBLIC_LOOP && | 1068 | vport->fc_flag & FC_PUBLIC_LOOP && |
1069 | !(vport->fc_flag & FC_LBIT)) { | 1069 | !(vport->fc_flag & FC_LBIT)) { |
1070 | /* Need to wait for FAN - use discovery timer | 1070 | /* Need to wait for FAN - use discovery timer |
@@ -1078,9 +1078,8 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
1078 | /* Start discovery by sending a FLOGI. port_state is identically | 1078 | /* Start discovery by sending a FLOGI. port_state is identically |
1079 | * LPFC_FLOGI while waiting for FLOGI cmpl | 1079 | * LPFC_FLOGI while waiting for FLOGI cmpl |
1080 | */ | 1080 | */ |
1081 | if (vport->port_state != LPFC_FLOGI) { | 1081 | if (vport->port_state != LPFC_FLOGI) |
1082 | lpfc_initial_flogi(vport); | 1082 | lpfc_initial_flogi(vport); |
1083 | } | ||
1084 | return; | 1083 | return; |
1085 | 1084 | ||
1086 | out: | 1085 | out: |
@@ -1131,7 +1130,7 @@ lpfc_mbx_cmpl_reg_fcfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
1131 | if (vport->port_state != LPFC_FLOGI) { | 1130 | if (vport->port_state != LPFC_FLOGI) { |
1132 | phba->hba_flag |= FCF_RR_INPROG; | 1131 | phba->hba_flag |= FCF_RR_INPROG; |
1133 | spin_unlock_irq(&phba->hbalock); | 1132 | spin_unlock_irq(&phba->hbalock); |
1134 | lpfc_initial_flogi(vport); | 1133 | lpfc_issue_init_vfi(vport); |
1135 | goto out; | 1134 | goto out; |
1136 | } | 1135 | } |
1137 | spin_unlock_irq(&phba->hbalock); | 1136 | spin_unlock_irq(&phba->hbalock); |
@@ -1353,7 +1352,7 @@ lpfc_register_fcf(struct lpfc_hba *phba) | |||
1353 | if (phba->pport->port_state != LPFC_FLOGI) { | 1352 | if (phba->pport->port_state != LPFC_FLOGI) { |
1354 | phba->hba_flag |= FCF_RR_INPROG; | 1353 | phba->hba_flag |= FCF_RR_INPROG; |
1355 | spin_unlock_irq(&phba->hbalock); | 1354 | spin_unlock_irq(&phba->hbalock); |
1356 | lpfc_initial_flogi(phba->pport); | 1355 | lpfc_issue_init_vfi(phba->pport); |
1357 | return; | 1356 | return; |
1358 | } | 1357 | } |
1359 | spin_unlock_irq(&phba->hbalock); | 1358 | spin_unlock_irq(&phba->hbalock); |
@@ -2331,7 +2330,7 @@ lpfc_mbx_cmpl_fcf_rr_read_fcf_rec(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
2331 | phba->fcf.current_rec.fcf_indx, fcf_index); | 2330 | phba->fcf.current_rec.fcf_indx, fcf_index); |
2332 | /* Wait 500 ms before retrying FLOGI to current FCF */ | 2331 | /* Wait 500 ms before retrying FLOGI to current FCF */ |
2333 | msleep(500); | 2332 | msleep(500); |
2334 | lpfc_initial_flogi(phba->pport); | 2333 | lpfc_issue_init_vfi(phba->pport); |
2335 | goto out; | 2334 | goto out; |
2336 | } | 2335 | } |
2337 | 2336 | ||
@@ -2422,6 +2421,63 @@ out: | |||
2422 | } | 2421 | } |
2423 | 2422 | ||
2424 | /** | 2423 | /** |
2424 | * lpfc_init_vfi_cmpl - Completion handler for init_vfi mbox command. | ||
2425 | * @phba: pointer to lpfc hba data structure. | ||
2426 | * @mboxq: pointer to mailbox data structure. | ||
2427 | * | ||
2428 | * This function handles completion of init vfi mailbox command. | ||
2429 | */ | ||
2430 | void | ||
2431 | lpfc_init_vfi_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | ||
2432 | { | ||
2433 | struct lpfc_vport *vport = mboxq->vport; | ||
2434 | |||
2435 | if (mboxq->u.mb.mbxStatus && (mboxq->u.mb.mbxStatus != 0x4002)) { | ||
2436 | lpfc_printf_vlog(vport, KERN_ERR, | ||
2437 | LOG_MBOX, | ||
2438 | "2891 Init VFI mailbox failed 0x%x\n", | ||
2439 | mboxq->u.mb.mbxStatus); | ||
2440 | mempool_free(mboxq, phba->mbox_mem_pool); | ||
2441 | lpfc_vport_set_state(vport, FC_VPORT_FAILED); | ||
2442 | return; | ||
2443 | } | ||
2444 | lpfc_initial_flogi(vport); | ||
2445 | mempool_free(mboxq, phba->mbox_mem_pool); | ||
2446 | return; | ||
2447 | } | ||
2448 | |||
2449 | /** | ||
2450 | * lpfc_issue_init_vfi - Issue init_vfi mailbox command. | ||
2451 | * @vport: pointer to lpfc_vport data structure. | ||
2452 | * | ||
2453 | * This function issue a init_vfi mailbox command to initialize the VFI and | ||
2454 | * VPI for the physical port. | ||
2455 | */ | ||
2456 | void | ||
2457 | lpfc_issue_init_vfi(struct lpfc_vport *vport) | ||
2458 | { | ||
2459 | LPFC_MBOXQ_t *mboxq; | ||
2460 | int rc; | ||
2461 | struct lpfc_hba *phba = vport->phba; | ||
2462 | |||
2463 | mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | ||
2464 | if (!mboxq) { | ||
2465 | lpfc_printf_vlog(vport, KERN_ERR, | ||
2466 | LOG_MBOX, "2892 Failed to allocate " | ||
2467 | "init_vfi mailbox\n"); | ||
2468 | return; | ||
2469 | } | ||
2470 | lpfc_init_vfi(mboxq, vport); | ||
2471 | mboxq->mbox_cmpl = lpfc_init_vfi_cmpl; | ||
2472 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); | ||
2473 | if (rc == MBX_NOT_FINISHED) { | ||
2474 | lpfc_printf_vlog(vport, KERN_ERR, | ||
2475 | LOG_MBOX, "2893 Failed to issue init_vfi mailbox\n"); | ||
2476 | mempool_free(mboxq, vport->phba->mbox_mem_pool); | ||
2477 | } | ||
2478 | } | ||
2479 | |||
2480 | /** | ||
2425 | * lpfc_init_vpi_cmpl - Completion handler for init_vpi mbox command. | 2481 | * lpfc_init_vpi_cmpl - Completion handler for init_vpi mbox command. |
2426 | * @phba: pointer to lpfc hba data structure. | 2482 | * @phba: pointer to lpfc hba data structure. |
2427 | * @mboxq: pointer to mailbox data structure. | 2483 | * @mboxq: pointer to mailbox data structure. |
@@ -2528,7 +2584,7 @@ lpfc_start_fdiscs(struct lpfc_hba *phba) | |||
2528 | FC_VPORT_FAILED); | 2584 | FC_VPORT_FAILED); |
2529 | continue; | 2585 | continue; |
2530 | } | 2586 | } |
2531 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 2587 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
2532 | lpfc_vport_set_state(vports[i], | 2588 | lpfc_vport_set_state(vports[i], |
2533 | FC_VPORT_LINKDOWN); | 2589 | FC_VPORT_LINKDOWN); |
2534 | continue; | 2590 | continue; |
@@ -2564,7 +2620,7 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
2564 | "2018 REG_VFI mbxStatus error x%x " | 2620 | "2018 REG_VFI mbxStatus error x%x " |
2565 | "HBA state x%x\n", | 2621 | "HBA state x%x\n", |
2566 | mboxq->u.mb.mbxStatus, vport->port_state); | 2622 | mboxq->u.mb.mbxStatus, vport->port_state); |
2567 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 2623 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
2568 | /* FLOGI failed, use loop map to make discovery list */ | 2624 | /* FLOGI failed, use loop map to make discovery list */ |
2569 | lpfc_disc_list_loopmap(vport); | 2625 | lpfc_disc_list_loopmap(vport); |
2570 | /* Start discovery */ | 2626 | /* Start discovery */ |
@@ -2582,8 +2638,18 @@ lpfc_mbx_cmpl_reg_vfi(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq) | |||
2582 | spin_unlock_irq(shost->host_lock); | 2638 | spin_unlock_irq(shost->host_lock); |
2583 | 2639 | ||
2584 | if (vport->port_state == LPFC_FABRIC_CFG_LINK) { | 2640 | if (vport->port_state == LPFC_FABRIC_CFG_LINK) { |
2585 | lpfc_start_fdiscs(phba); | 2641 | /* For private loop just start discovery and we are done. */ |
2586 | lpfc_do_scr_ns_plogi(phba, vport); | 2642 | if ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) && |
2643 | (phba->alpa_map[0] == 0) && | ||
2644 | !(vport->fc_flag & FC_PUBLIC_LOOP)) { | ||
2645 | /* Use loop map to make discovery list */ | ||
2646 | lpfc_disc_list_loopmap(vport); | ||
2647 | /* Start discovery */ | ||
2648 | lpfc_disc_start(vport); | ||
2649 | } else { | ||
2650 | lpfc_start_fdiscs(phba); | ||
2651 | lpfc_do_scr_ns_plogi(phba, vport); | ||
2652 | } | ||
2587 | } | 2653 | } |
2588 | 2654 | ||
2589 | fail_free_mem: | 2655 | fail_free_mem: |
@@ -2644,7 +2710,7 @@ out: | |||
2644 | } | 2710 | } |
2645 | 2711 | ||
2646 | static void | 2712 | static void |
2647 | lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | 2713 | lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la) |
2648 | { | 2714 | { |
2649 | struct lpfc_vport *vport = phba->pport; | 2715 | struct lpfc_vport *vport = phba->pport; |
2650 | LPFC_MBOXQ_t *sparam_mbox, *cfglink_mbox = NULL; | 2716 | LPFC_MBOXQ_t *sparam_mbox, *cfglink_mbox = NULL; |
@@ -2654,31 +2720,24 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
2654 | struct fcf_record *fcf_record; | 2720 | struct fcf_record *fcf_record; |
2655 | 2721 | ||
2656 | spin_lock_irq(&phba->hbalock); | 2722 | spin_lock_irq(&phba->hbalock); |
2657 | switch (la->UlnkSpeed) { | 2723 | switch (bf_get(lpfc_mbx_read_top_link_spd, la)) { |
2658 | case LA_1GHZ_LINK: | 2724 | case LPFC_LINK_SPEED_1GHZ: |
2659 | phba->fc_linkspeed = LA_1GHZ_LINK; | 2725 | case LPFC_LINK_SPEED_2GHZ: |
2660 | break; | 2726 | case LPFC_LINK_SPEED_4GHZ: |
2661 | case LA_2GHZ_LINK: | 2727 | case LPFC_LINK_SPEED_8GHZ: |
2662 | phba->fc_linkspeed = LA_2GHZ_LINK; | 2728 | case LPFC_LINK_SPEED_10GHZ: |
2663 | break; | 2729 | case LPFC_LINK_SPEED_16GHZ: |
2664 | case LA_4GHZ_LINK: | 2730 | phba->fc_linkspeed = bf_get(lpfc_mbx_read_top_link_spd, la); |
2665 | phba->fc_linkspeed = LA_4GHZ_LINK; | ||
2666 | break; | ||
2667 | case LA_8GHZ_LINK: | ||
2668 | phba->fc_linkspeed = LA_8GHZ_LINK; | ||
2669 | break; | ||
2670 | case LA_10GHZ_LINK: | ||
2671 | phba->fc_linkspeed = LA_10GHZ_LINK; | ||
2672 | break; | 2731 | break; |
2673 | default: | 2732 | default: |
2674 | phba->fc_linkspeed = LA_UNKNW_LINK; | 2733 | phba->fc_linkspeed = LPFC_LINK_SPEED_UNKNOWN; |
2675 | break; | 2734 | break; |
2676 | } | 2735 | } |
2677 | 2736 | ||
2678 | phba->fc_topology = la->topology; | 2737 | phba->fc_topology = bf_get(lpfc_mbx_read_top_topology, la); |
2679 | phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; | 2738 | phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED; |
2680 | 2739 | ||
2681 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 2740 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
2682 | phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED; | 2741 | phba->sli3_options &= ~LPFC_SLI3_NPIV_ENABLED; |
2683 | 2742 | ||
2684 | /* if npiv is enabled and this adapter supports npiv log | 2743 | /* if npiv is enabled and this adapter supports npiv log |
@@ -2689,11 +2748,11 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
2689 | "1309 Link Up Event npiv not supported in loop " | 2748 | "1309 Link Up Event npiv not supported in loop " |
2690 | "topology\n"); | 2749 | "topology\n"); |
2691 | /* Get Loop Map information */ | 2750 | /* Get Loop Map information */ |
2692 | if (la->il) | 2751 | if (bf_get(lpfc_mbx_read_top_il, la)) |
2693 | vport->fc_flag |= FC_LBIT; | 2752 | vport->fc_flag |= FC_LBIT; |
2694 | 2753 | ||
2695 | vport->fc_myDID = la->granted_AL_PA; | 2754 | vport->fc_myDID = bf_get(lpfc_mbx_read_top_alpa_granted, la); |
2696 | i = la->un.lilpBde64.tus.f.bdeSize; | 2755 | i = la->lilpBde64.tus.f.bdeSize; |
2697 | 2756 | ||
2698 | if (i == 0) { | 2757 | if (i == 0) { |
2699 | phba->alpa_map[0] = 0; | 2758 | phba->alpa_map[0] = 0; |
@@ -2764,7 +2823,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la) | |||
2764 | goto out; | 2823 | goto out; |
2765 | } | 2824 | } |
2766 | 2825 | ||
2767 | if (!(phba->hba_flag & HBA_FCOE_SUPPORT)) { | 2826 | if (!(phba->hba_flag & HBA_FCOE_MODE)) { |
2768 | cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 2827 | cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
2769 | if (!cfglink_mbox) | 2828 | if (!cfglink_mbox) |
2770 | goto out; | 2829 | goto out; |
@@ -2874,17 +2933,17 @@ lpfc_mbx_issue_link_down(struct lpfc_hba *phba) | |||
2874 | 2933 | ||
2875 | 2934 | ||
2876 | /* | 2935 | /* |
2877 | * This routine handles processing a READ_LA mailbox | 2936 | * This routine handles processing a READ_TOPOLOGY mailbox |
2878 | * command upon completion. It is setup in the LPFC_MBOXQ | 2937 | * command upon completion. It is setup in the LPFC_MBOXQ |
2879 | * as the completion routine when the command is | 2938 | * as the completion routine when the command is |
2880 | * handed off to the SLI layer. | 2939 | * handed off to the SLI layer. |
2881 | */ | 2940 | */ |
2882 | void | 2941 | void |
2883 | lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | 2942 | lpfc_mbx_cmpl_read_topology(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) |
2884 | { | 2943 | { |
2885 | struct lpfc_vport *vport = pmb->vport; | 2944 | struct lpfc_vport *vport = pmb->vport; |
2886 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 2945 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
2887 | READ_LA_VAR *la; | 2946 | struct lpfc_mbx_read_top *la; |
2888 | MAILBOX_t *mb = &pmb->u.mb; | 2947 | MAILBOX_t *mb = &pmb->u.mb; |
2889 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1); | 2948 | struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1); |
2890 | 2949 | ||
@@ -2897,15 +2956,15 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2897 | mb->mbxStatus, vport->port_state); | 2956 | mb->mbxStatus, vport->port_state); |
2898 | lpfc_mbx_issue_link_down(phba); | 2957 | lpfc_mbx_issue_link_down(phba); |
2899 | phba->link_state = LPFC_HBA_ERROR; | 2958 | phba->link_state = LPFC_HBA_ERROR; |
2900 | goto lpfc_mbx_cmpl_read_la_free_mbuf; | 2959 | goto lpfc_mbx_cmpl_read_topology_free_mbuf; |
2901 | } | 2960 | } |
2902 | 2961 | ||
2903 | la = (READ_LA_VAR *) &pmb->u.mb.un.varReadLA; | 2962 | la = (struct lpfc_mbx_read_top *) &pmb->u.mb.un.varReadTop; |
2904 | 2963 | ||
2905 | memcpy(&phba->alpa_map[0], mp->virt, 128); | 2964 | memcpy(&phba->alpa_map[0], mp->virt, 128); |
2906 | 2965 | ||
2907 | spin_lock_irq(shost->host_lock); | 2966 | spin_lock_irq(shost->host_lock); |
2908 | if (la->pb) | 2967 | if (bf_get(lpfc_mbx_read_top_pb, la)) |
2909 | vport->fc_flag |= FC_BYPASSED_MODE; | 2968 | vport->fc_flag |= FC_BYPASSED_MODE; |
2910 | else | 2969 | else |
2911 | vport->fc_flag &= ~FC_BYPASSED_MODE; | 2970 | vport->fc_flag &= ~FC_BYPASSED_MODE; |
@@ -2914,41 +2973,48 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2914 | if ((phba->fc_eventTag < la->eventTag) || | 2973 | if ((phba->fc_eventTag < la->eventTag) || |
2915 | (phba->fc_eventTag == la->eventTag)) { | 2974 | (phba->fc_eventTag == la->eventTag)) { |
2916 | phba->fc_stat.LinkMultiEvent++; | 2975 | phba->fc_stat.LinkMultiEvent++; |
2917 | if (la->attType == AT_LINK_UP) | 2976 | if (bf_get(lpfc_mbx_read_top_att_type, la) == LPFC_ATT_LINK_UP) |
2918 | if (phba->fc_eventTag != 0) | 2977 | if (phba->fc_eventTag != 0) |
2919 | lpfc_linkdown(phba); | 2978 | lpfc_linkdown(phba); |
2920 | } | 2979 | } |
2921 | 2980 | ||
2922 | phba->fc_eventTag = la->eventTag; | 2981 | phba->fc_eventTag = la->eventTag; |
2923 | spin_lock_irq(&phba->hbalock); | 2982 | spin_lock_irq(&phba->hbalock); |
2924 | if (la->mm) | 2983 | if (bf_get(lpfc_mbx_read_top_mm, la)) |
2925 | phba->sli.sli_flag |= LPFC_MENLO_MAINT; | 2984 | phba->sli.sli_flag |= LPFC_MENLO_MAINT; |
2926 | else | 2985 | else |
2927 | phba->sli.sli_flag &= ~LPFC_MENLO_MAINT; | 2986 | phba->sli.sli_flag &= ~LPFC_MENLO_MAINT; |
2928 | spin_unlock_irq(&phba->hbalock); | 2987 | spin_unlock_irq(&phba->hbalock); |
2929 | 2988 | ||
2930 | phba->link_events++; | 2989 | phba->link_events++; |
2931 | if (la->attType == AT_LINK_UP && (!la->mm)) { | 2990 | if ((bf_get(lpfc_mbx_read_top_att_type, la) == LPFC_ATT_LINK_UP) && |
2991 | (!bf_get(lpfc_mbx_read_top_mm, la))) { | ||
2932 | phba->fc_stat.LinkUp++; | 2992 | phba->fc_stat.LinkUp++; |
2933 | if (phba->link_flag & LS_LOOPBACK_MODE) { | 2993 | if (phba->link_flag & LS_LOOPBACK_MODE) { |
2934 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 2994 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
2935 | "1306 Link Up Event in loop back mode " | 2995 | "1306 Link Up Event in loop back mode " |
2936 | "x%x received Data: x%x x%x x%x x%x\n", | 2996 | "x%x received Data: x%x x%x x%x x%x\n", |
2937 | la->eventTag, phba->fc_eventTag, | 2997 | la->eventTag, phba->fc_eventTag, |
2938 | la->granted_AL_PA, la->UlnkSpeed, | 2998 | bf_get(lpfc_mbx_read_top_alpa_granted, |
2999 | la), | ||
3000 | bf_get(lpfc_mbx_read_top_link_spd, la), | ||
2939 | phba->alpa_map[0]); | 3001 | phba->alpa_map[0]); |
2940 | } else { | 3002 | } else { |
2941 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 3003 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
2942 | "1303 Link Up Event x%x received " | 3004 | "1303 Link Up Event x%x received " |
2943 | "Data: x%x x%x x%x x%x x%x x%x %d\n", | 3005 | "Data: x%x x%x x%x x%x x%x x%x %d\n", |
2944 | la->eventTag, phba->fc_eventTag, | 3006 | la->eventTag, phba->fc_eventTag, |
2945 | la->granted_AL_PA, la->UlnkSpeed, | 3007 | bf_get(lpfc_mbx_read_top_alpa_granted, |
3008 | la), | ||
3009 | bf_get(lpfc_mbx_read_top_link_spd, la), | ||
2946 | phba->alpa_map[0], | 3010 | phba->alpa_map[0], |
2947 | la->mm, la->fa, | 3011 | bf_get(lpfc_mbx_read_top_mm, la), |
3012 | bf_get(lpfc_mbx_read_top_fa, la), | ||
2948 | phba->wait_4_mlo_maint_flg); | 3013 | phba->wait_4_mlo_maint_flg); |
2949 | } | 3014 | } |
2950 | lpfc_mbx_process_link_up(phba, la); | 3015 | lpfc_mbx_process_link_up(phba, la); |
2951 | } else if (la->attType == AT_LINK_DOWN) { | 3016 | } else if (bf_get(lpfc_mbx_read_top_att_type, la) == |
3017 | LPFC_ATT_LINK_DOWN) { | ||
2952 | phba->fc_stat.LinkDown++; | 3018 | phba->fc_stat.LinkDown++; |
2953 | if (phba->link_flag & LS_LOOPBACK_MODE) { | 3019 | if (phba->link_flag & LS_LOOPBACK_MODE) { |
2954 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 3020 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
@@ -2964,11 +3030,13 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2964 | "Data: x%x x%x x%x x%x x%x\n", | 3030 | "Data: x%x x%x x%x x%x x%x\n", |
2965 | la->eventTag, phba->fc_eventTag, | 3031 | la->eventTag, phba->fc_eventTag, |
2966 | phba->pport->port_state, vport->fc_flag, | 3032 | phba->pport->port_state, vport->fc_flag, |
2967 | la->mm, la->fa); | 3033 | bf_get(lpfc_mbx_read_top_mm, la), |
3034 | bf_get(lpfc_mbx_read_top_fa, la)); | ||
2968 | } | 3035 | } |
2969 | lpfc_mbx_issue_link_down(phba); | 3036 | lpfc_mbx_issue_link_down(phba); |
2970 | } | 3037 | } |
2971 | if (la->mm && la->attType == AT_LINK_UP) { | 3038 | if ((bf_get(lpfc_mbx_read_top_mm, la)) && |
3039 | (bf_get(lpfc_mbx_read_top_att_type, la) == LPFC_ATT_LINK_UP)) { | ||
2972 | if (phba->link_state != LPFC_LINK_DOWN) { | 3040 | if (phba->link_state != LPFC_LINK_DOWN) { |
2973 | phba->fc_stat.LinkDown++; | 3041 | phba->fc_stat.LinkDown++; |
2974 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, | 3042 | lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT, |
@@ -2996,14 +3064,15 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
2996 | } | 3064 | } |
2997 | } | 3065 | } |
2998 | 3066 | ||
2999 | if (la->fa) { | 3067 | if (bf_get(lpfc_mbx_read_top_fa, la)) { |
3000 | if (la->mm) | 3068 | if (bf_get(lpfc_mbx_read_top_mm, la)) |
3001 | lpfc_issue_clear_la(phba, vport); | 3069 | lpfc_issue_clear_la(phba, vport); |
3002 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, | 3070 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, |
3003 | "1311 fa %d\n", la->fa); | 3071 | "1311 fa %d\n", |
3072 | bf_get(lpfc_mbx_read_top_fa, la)); | ||
3004 | } | 3073 | } |
3005 | 3074 | ||
3006 | lpfc_mbx_cmpl_read_la_free_mbuf: | 3075 | lpfc_mbx_cmpl_read_topology_free_mbuf: |
3007 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | 3076 | lpfc_mbuf_free(phba, mp->virt, mp->phys); |
3008 | kfree(mp); | 3077 | kfree(mp); |
3009 | mempool_free(pmb, phba->mbox_mem_pool); | 3078 | mempool_free(pmb, phba->mbox_mem_pool); |
@@ -3333,7 +3402,7 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | |||
3333 | kfree(mp); | 3402 | kfree(mp); |
3334 | mempool_free(pmb, phba->mbox_mem_pool); | 3403 | mempool_free(pmb, phba->mbox_mem_pool); |
3335 | 3404 | ||
3336 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 3405 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
3337 | /* FLOGI failed, use loop map to make discovery list */ | 3406 | /* FLOGI failed, use loop map to make discovery list */ |
3338 | lpfc_disc_list_loopmap(vport); | 3407 | lpfc_disc_list_loopmap(vport); |
3339 | 3408 | ||
@@ -3413,7 +3482,7 @@ out: | |||
3413 | /* If no other thread is using the ndlp, free it */ | 3482 | /* If no other thread is using the ndlp, free it */ |
3414 | lpfc_nlp_not_used(ndlp); | 3483 | lpfc_nlp_not_used(ndlp); |
3415 | 3484 | ||
3416 | if (phba->fc_topology == TOPOLOGY_LOOP) { | 3485 | if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) { |
3417 | /* | 3486 | /* |
3418 | * RegLogin failed, use loop map to make discovery | 3487 | * RegLogin failed, use loop map to make discovery |
3419 | * list | 3488 | * list |
@@ -4441,7 +4510,7 @@ lpfc_disc_list_loopmap(struct lpfc_vport *vport) | |||
4441 | if (!lpfc_is_link_up(phba)) | 4510 | if (!lpfc_is_link_up(phba)) |
4442 | return; | 4511 | return; |
4443 | 4512 | ||
4444 | if (phba->fc_topology != TOPOLOGY_LOOP) | 4513 | if (phba->fc_topology != LPFC_TOPOLOGY_LOOP) |
4445 | return; | 4514 | return; |
4446 | 4515 | ||
4447 | /* Check for loop map present or not */ | 4516 | /* Check for loop map present or not */ |
@@ -4793,7 +4862,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport) | |||
4793 | } | 4862 | } |
4794 | } | 4863 | } |
4795 | if (vport->port_state != LPFC_FLOGI) { | 4864 | if (vport->port_state != LPFC_FLOGI) { |
4796 | lpfc_initial_flogi(vport); | 4865 | if (phba->sli_rev <= LPFC_SLI_REV3) |
4866 | lpfc_initial_flogi(vport); | ||
4867 | else | ||
4868 | lpfc_issue_init_vfi(vport); | ||
4797 | return; | 4869 | return; |
4798 | } | 4870 | } |
4799 | break; | 4871 | break; |
@@ -5559,7 +5631,7 @@ lpfc_unregister_unused_fcf(struct lpfc_hba *phba) | |||
5559 | * registered, do nothing. | 5631 | * registered, do nothing. |
5560 | */ | 5632 | */ |
5561 | spin_lock_irq(&phba->hbalock); | 5633 | spin_lock_irq(&phba->hbalock); |
5562 | if (!(phba->hba_flag & HBA_FCOE_SUPPORT) || | 5634 | if (!(phba->hba_flag & HBA_FCOE_MODE) || |
5563 | !(phba->fcf.fcf_flag & FCF_REGISTERED) || | 5635 | !(phba->fcf.fcf_flag & FCF_REGISTERED) || |
5564 | !(phba->hba_flag & HBA_FIP_SUPPORT) || | 5636 | !(phba->hba_flag & HBA_FIP_SUPPORT) || |
5565 | (phba->fcf.fcf_flag & FCF_DISCOVERY) || | 5637 | (phba->fcf.fcf_flag & FCF_DISCOVERY) || |
diff --git a/drivers/scsi/lpfc/lpfc_hw.h b/drivers/scsi/lpfc/lpfc_hw.h index 1044c438bb95..a253216e1f18 100644 --- a/drivers/scsi/lpfc/lpfc_hw.h +++ b/drivers/scsi/lpfc/lpfc_hw.h | |||
@@ -1370,7 +1370,6 @@ typedef struct { /* FireFly BIU registers */ | |||
1370 | #define MBX_READ_LNK_STAT 0x12 | 1370 | #define MBX_READ_LNK_STAT 0x12 |
1371 | #define MBX_REG_LOGIN 0x13 | 1371 | #define MBX_REG_LOGIN 0x13 |
1372 | #define MBX_UNREG_LOGIN 0x14 | 1372 | #define MBX_UNREG_LOGIN 0x14 |
1373 | #define MBX_READ_LA 0x15 | ||
1374 | #define MBX_CLEAR_LA 0x16 | 1373 | #define MBX_CLEAR_LA 0x16 |
1375 | #define MBX_DUMP_MEMORY 0x17 | 1374 | #define MBX_DUMP_MEMORY 0x17 |
1376 | #define MBX_DUMP_CONTEXT 0x18 | 1375 | #define MBX_DUMP_CONTEXT 0x18 |
@@ -1404,7 +1403,7 @@ typedef struct { /* FireFly BIU registers */ | |||
1404 | #define MBX_READ_SPARM64 0x8D | 1403 | #define MBX_READ_SPARM64 0x8D |
1405 | #define MBX_READ_RPI64 0x8F | 1404 | #define MBX_READ_RPI64 0x8F |
1406 | #define MBX_REG_LOGIN64 0x93 | 1405 | #define MBX_REG_LOGIN64 0x93 |
1407 | #define MBX_READ_LA64 0x95 | 1406 | #define MBX_READ_TOPOLOGY 0x95 |
1408 | #define MBX_REG_VPI 0x96 | 1407 | #define MBX_REG_VPI 0x96 |
1409 | #define MBX_UNREG_VPI 0x97 | 1408 | #define MBX_UNREG_VPI 0x97 |
1410 | 1409 | ||
@@ -1825,12 +1824,13 @@ typedef struct { | |||
1825 | #define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */ | 1824 | #define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */ |
1826 | 1825 | ||
1827 | uint32_t link_speed; | 1826 | uint32_t link_speed; |
1828 | #define LINK_SPEED_AUTO 0 /* Auto selection */ | 1827 | #define LINK_SPEED_AUTO 0x0 /* Auto selection */ |
1829 | #define LINK_SPEED_1G 1 /* 1 Gigabaud */ | 1828 | #define LINK_SPEED_1G 0x1 /* 1 Gigabaud */ |
1830 | #define LINK_SPEED_2G 2 /* 2 Gigabaud */ | 1829 | #define LINK_SPEED_2G 0x2 /* 2 Gigabaud */ |
1831 | #define LINK_SPEED_4G 4 /* 4 Gigabaud */ | 1830 | #define LINK_SPEED_4G 0x4 /* 4 Gigabaud */ |
1832 | #define LINK_SPEED_8G 8 /* 8 Gigabaud */ | 1831 | #define LINK_SPEED_8G 0x8 /* 8 Gigabaud */ |
1833 | #define LINK_SPEED_10G 16 /* 10 Gigabaud */ | 1832 | #define LINK_SPEED_10G 0x10 /* 10 Gigabaud */ |
1833 | #define LINK_SPEED_16G 0x11 /* 16 Gigabaud */ | ||
1834 | 1834 | ||
1835 | } INIT_LINK_VAR; | 1835 | } INIT_LINK_VAR; |
1836 | 1836 | ||
@@ -2001,6 +2001,7 @@ typedef struct { | |||
2001 | #define LMT_4Gb 0x040 | 2001 | #define LMT_4Gb 0x040 |
2002 | #define LMT_8Gb 0x080 | 2002 | #define LMT_8Gb 0x080 |
2003 | #define LMT_10Gb 0x100 | 2003 | #define LMT_10Gb 0x100 |
2004 | #define LMT_16Gb 0x200 | ||
2004 | uint32_t rsvd2; | 2005 | uint32_t rsvd2; |
2005 | uint32_t rsvd3; | 2006 | uint32_t rsvd3; |
2006 | uint32_t max_xri; | 2007 | uint32_t max_xri; |
@@ -2396,100 +2397,93 @@ typedef struct { | |||
2396 | #endif | 2397 | #endif |
2397 | } UNREG_D_ID_VAR; | 2398 | } UNREG_D_ID_VAR; |
2398 | 2399 | ||
2399 | /* Structure for MB Command READ_LA (21) */ | 2400 | /* Structure for MB Command READ_TOPOLOGY (0x95) */ |
2400 | /* Structure for MB Command READ_LA64 (0x95) */ | 2401 | struct lpfc_mbx_read_top { |
2401 | |||
2402 | typedef struct { | ||
2403 | uint32_t eventTag; /* Event tag */ | 2402 | uint32_t eventTag; /* Event tag */ |
2404 | #ifdef __BIG_ENDIAN_BITFIELD | 2403 | uint32_t word2; |
2405 | uint32_t rsvd1:19; | 2404 | #define lpfc_mbx_read_top_fa_SHIFT 12 |
2406 | uint32_t fa:1; | 2405 | #define lpfc_mbx_read_top_fa_MASK 0x00000001 |
2407 | uint32_t mm:1; /* Menlo Maintenance mode enabled */ | 2406 | #define lpfc_mbx_read_top_fa_WORD word2 |
2408 | uint32_t rx:1; | 2407 | #define lpfc_mbx_read_top_mm_SHIFT 11 |
2409 | uint32_t pb:1; | 2408 | #define lpfc_mbx_read_top_mm_MASK 0x00000001 |
2410 | uint32_t il:1; | 2409 | #define lpfc_mbx_read_top_mm_WORD word2 |
2411 | uint32_t attType:8; | 2410 | #define lpfc_mbx_read_top_pb_SHIFT 9 |
2412 | #else /* __LITTLE_ENDIAN_BITFIELD */ | 2411 | #define lpfc_mbx_read_top_pb_MASK 0X00000001 |
2413 | uint32_t attType:8; | 2412 | #define lpfc_mbx_read_top_pb_WORD word2 |
2414 | uint32_t il:1; | 2413 | #define lpfc_mbx_read_top_il_SHIFT 8 |
2415 | uint32_t pb:1; | 2414 | #define lpfc_mbx_read_top_il_MASK 0x00000001 |
2416 | uint32_t rx:1; | 2415 | #define lpfc_mbx_read_top_il_WORD word2 |
2417 | uint32_t mm:1; | 2416 | #define lpfc_mbx_read_top_att_type_SHIFT 0 |
2418 | uint32_t fa:1; | 2417 | #define lpfc_mbx_read_top_att_type_MASK 0x000000FF |
2419 | uint32_t rsvd1:19; | 2418 | #define lpfc_mbx_read_top_att_type_WORD word2 |
2420 | #endif | 2419 | #define LPFC_ATT_RESERVED 0x00 /* Reserved - attType */ |
2421 | 2420 | #define LPFC_ATT_LINK_UP 0x01 /* Link is up */ | |
2422 | #define AT_RESERVED 0x00 /* Reserved - attType */ | 2421 | #define LPFC_ATT_LINK_DOWN 0x02 /* Link is down */ |
2423 | #define AT_LINK_UP 0x01 /* Link is up */ | 2422 | uint32_t word3; |
2424 | #define AT_LINK_DOWN 0x02 /* Link is down */ | 2423 | #define lpfc_mbx_read_top_alpa_granted_SHIFT 24 |
2425 | 2424 | #define lpfc_mbx_read_top_alpa_granted_MASK 0x000000FF | |
2426 | #ifdef __BIG_ENDIAN_BITFIELD | 2425 | #define lpfc_mbx_read_top_alpa_granted_WORD word3 |
2427 | uint8_t granted_AL_PA; | 2426 | #define lpfc_mbx_read_top_lip_alps_SHIFT 16 |
2428 | uint8_t lipAlPs; | 2427 | #define lpfc_mbx_read_top_lip_alps_MASK 0x000000FF |
2429 | uint8_t lipType; | 2428 | #define lpfc_mbx_read_top_lip_alps_WORD word3 |
2430 | uint8_t topology; | 2429 | #define lpfc_mbx_read_top_lip_type_SHIFT 8 |
2431 | #else /* __LITTLE_ENDIAN_BITFIELD */ | 2430 | #define lpfc_mbx_read_top_lip_type_MASK 0x000000FF |
2432 | uint8_t topology; | 2431 | #define lpfc_mbx_read_top_lip_type_WORD word3 |
2433 | uint8_t lipType; | 2432 | #define lpfc_mbx_read_top_topology_SHIFT 0 |
2434 | uint8_t lipAlPs; | 2433 | #define lpfc_mbx_read_top_topology_MASK 0x000000FF |
2435 | uint8_t granted_AL_PA; | 2434 | #define lpfc_mbx_read_top_topology_WORD word3 |
2436 | #endif | 2435 | #define LPFC_TOPOLOGY_PT_PT 0x01 /* Topology is pt-pt / pt-fabric */ |
2437 | 2436 | #define LPFC_TOPOLOGY_LOOP 0x02 /* Topology is FC-AL */ | |
2438 | #define TOPOLOGY_PT_PT 0x01 /* Topology is pt-pt / pt-fabric */ | 2437 | #define LPFC_TOPOLOGY_MM 0x05 /* maint mode zephtr to menlo */ |
2439 | #define TOPOLOGY_LOOP 0x02 /* Topology is FC-AL */ | 2438 | /* store the LILP AL_PA position map into */ |
2440 | #define TOPOLOGY_LNK_MENLO_MAINTENANCE 0x05 /* maint mode zephtr to menlo */ | 2439 | struct ulp_bde64 lilpBde64; |
2441 | 2440 | #define LPFC_ALPA_MAP_SIZE 128 | |
2442 | union { | 2441 | uint32_t word7; |
2443 | struct ulp_bde lilpBde; /* This BDE points to a 128 byte buffer | 2442 | #define lpfc_mbx_read_top_ld_lu_SHIFT 31 |
2444 | to */ | 2443 | #define lpfc_mbx_read_top_ld_lu_MASK 0x00000001 |
2445 | /* store the LILP AL_PA position map into */ | 2444 | #define lpfc_mbx_read_top_ld_lu_WORD word7 |
2446 | struct ulp_bde64 lilpBde64; | 2445 | #define lpfc_mbx_read_top_ld_tf_SHIFT 30 |
2447 | } un; | 2446 | #define lpfc_mbx_read_top_ld_tf_MASK 0x00000001 |
2448 | 2447 | #define lpfc_mbx_read_top_ld_tf_WORD word7 | |
2449 | #ifdef __BIG_ENDIAN_BITFIELD | 2448 | #define lpfc_mbx_read_top_ld_link_spd_SHIFT 8 |
2450 | uint32_t Dlu:1; | 2449 | #define lpfc_mbx_read_top_ld_link_spd_MASK 0x000000FF |
2451 | uint32_t Dtf:1; | 2450 | #define lpfc_mbx_read_top_ld_link_spd_WORD word7 |
2452 | uint32_t Drsvd2:14; | 2451 | #define lpfc_mbx_read_top_ld_nl_port_SHIFT 4 |
2453 | uint32_t DlnkSpeed:8; | 2452 | #define lpfc_mbx_read_top_ld_nl_port_MASK 0x0000000F |
2454 | uint32_t DnlPort:4; | 2453 | #define lpfc_mbx_read_top_ld_nl_port_WORD word7 |
2455 | uint32_t Dtx:2; | 2454 | #define lpfc_mbx_read_top_ld_tx_SHIFT 2 |
2456 | uint32_t Drx:2; | 2455 | #define lpfc_mbx_read_top_ld_tx_MASK 0x00000003 |
2457 | #else /* __LITTLE_ENDIAN_BITFIELD */ | 2456 | #define lpfc_mbx_read_top_ld_tx_WORD word7 |
2458 | uint32_t Drx:2; | 2457 | #define lpfc_mbx_read_top_ld_rx_SHIFT 0 |
2459 | uint32_t Dtx:2; | 2458 | #define lpfc_mbx_read_top_ld_rx_MASK 0x00000003 |
2460 | uint32_t DnlPort:4; | 2459 | #define lpfc_mbx_read_top_ld_rx_WORD word7 |
2461 | uint32_t DlnkSpeed:8; | 2460 | uint32_t word8; |
2462 | uint32_t Drsvd2:14; | 2461 | #define lpfc_mbx_read_top_lu_SHIFT 31 |
2463 | uint32_t Dtf:1; | 2462 | #define lpfc_mbx_read_top_lu_MASK 0x00000001 |
2464 | uint32_t Dlu:1; | 2463 | #define lpfc_mbx_read_top_lu_WORD word8 |
2465 | #endif | 2464 | #define lpfc_mbx_read_top_tf_SHIFT 30 |
2466 | 2465 | #define lpfc_mbx_read_top_tf_MASK 0x00000001 | |
2467 | #ifdef __BIG_ENDIAN_BITFIELD | 2466 | #define lpfc_mbx_read_top_tf_WORD word8 |
2468 | uint32_t Ulu:1; | 2467 | #define lpfc_mbx_read_top_link_spd_SHIFT 8 |
2469 | uint32_t Utf:1; | 2468 | #define lpfc_mbx_read_top_link_spd_MASK 0x000000FF |
2470 | uint32_t Ursvd2:14; | 2469 | #define lpfc_mbx_read_top_link_spd_WORD word8 |
2471 | uint32_t UlnkSpeed:8; | 2470 | #define lpfc_mbx_read_top_nl_port_SHIFT 4 |
2472 | uint32_t UnlPort:4; | 2471 | #define lpfc_mbx_read_top_nl_port_MASK 0x0000000F |
2473 | uint32_t Utx:2; | 2472 | #define lpfc_mbx_read_top_nl_port_WORD word8 |
2474 | uint32_t Urx:2; | 2473 | #define lpfc_mbx_read_top_tx_SHIFT 2 |
2475 | #else /* __LITTLE_ENDIAN_BITFIELD */ | 2474 | #define lpfc_mbx_read_top_tx_MASK 0x00000003 |
2476 | uint32_t Urx:2; | 2475 | #define lpfc_mbx_read_top_tx_WORD word8 |
2477 | uint32_t Utx:2; | 2476 | #define lpfc_mbx_read_top_rx_SHIFT 0 |
2478 | uint32_t UnlPort:4; | 2477 | #define lpfc_mbx_read_top_rx_MASK 0x00000003 |
2479 | uint32_t UlnkSpeed:8; | 2478 | #define lpfc_mbx_read_top_rx_WORD word8 |
2480 | uint32_t Ursvd2:14; | 2479 | #define LPFC_LINK_SPEED_UNKNOWN 0x0 |
2481 | uint32_t Utf:1; | 2480 | #define LPFC_LINK_SPEED_1GHZ 0x04 |
2482 | uint32_t Ulu:1; | 2481 | #define LPFC_LINK_SPEED_2GHZ 0x08 |
2483 | #endif | 2482 | #define LPFC_LINK_SPEED_4GHZ 0x10 |
2484 | 2483 | #define LPFC_LINK_SPEED_8GHZ 0x20 | |
2485 | #define LA_UNKNW_LINK 0x0 /* lnkSpeed */ | 2484 | #define LPFC_LINK_SPEED_10GHZ 0x40 |
2486 | #define LA_1GHZ_LINK 0x04 /* lnkSpeed */ | 2485 | #define LPFC_LINK_SPEED_16GHZ 0x80 |
2487 | #define LA_2GHZ_LINK 0x08 /* lnkSpeed */ | 2486 | }; |
2488 | #define LA_4GHZ_LINK 0x10 /* lnkSpeed */ | ||
2489 | #define LA_8GHZ_LINK 0x20 /* lnkSpeed */ | ||
2490 | #define LA_10GHZ_LINK 0x40 /* lnkSpeed */ | ||
2491 | |||
2492 | } READ_LA_VAR; | ||
2493 | 2487 | ||
2494 | /* Structure for MB Command CLEAR_LA (22) */ | 2488 | /* Structure for MB Command CLEAR_LA (22) */ |
2495 | 2489 | ||
@@ -3018,7 +3012,6 @@ typedef union { | |||
3018 | READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */ | 3012 | READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */ |
3019 | REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */ | 3013 | REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */ |
3020 | UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */ | 3014 | UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */ |
3021 | READ_LA_VAR varReadLA; /* cmd = 21 (READ_LA(64)) */ | ||
3022 | CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */ | 3015 | CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */ |
3023 | DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */ | 3016 | DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */ |
3024 | UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */ | 3017 | UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */ |
@@ -3028,6 +3021,7 @@ typedef union { | |||
3028 | struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ) */ | 3021 | struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ) */ |
3029 | struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/ | 3022 | struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/ |
3030 | CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */ | 3023 | CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */ |
3024 | struct lpfc_mbx_read_top varReadTop; /* cmd = 0x95 (READ_TOPOLOGY) */ | ||
3031 | REG_VPI_VAR varRegVpi; /* cmd = 0x96 (REG_VPI) */ | 3025 | REG_VPI_VAR varRegVpi; /* cmd = 0x96 (REG_VPI) */ |
3032 | UNREG_VPI_VAR varUnregVpi; /* cmd = 0x97 (UNREG_VPI) */ | 3026 | UNREG_VPI_VAR varUnregVpi; /* cmd = 0x97 (UNREG_VPI) */ |
3033 | ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */ | 3027 | ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */ |
diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 7fbc58713f19..4e3a11b98299 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h | |||
@@ -1444,10 +1444,16 @@ struct lpfc_mbx_init_vfi { | |||
1444 | #define lpfc_init_vfi_vf_SHIFT 29 | 1444 | #define lpfc_init_vfi_vf_SHIFT 29 |
1445 | #define lpfc_init_vfi_vf_MASK 0x00000001 | 1445 | #define lpfc_init_vfi_vf_MASK 0x00000001 |
1446 | #define lpfc_init_vfi_vf_WORD word1 | 1446 | #define lpfc_init_vfi_vf_WORD word1 |
1447 | #define lpfc_init_vfi_vp_SHIFT 28 | ||
1448 | #define lpfc_init_vfi_vp_MASK 0x00000001 | ||
1449 | #define lpfc_init_vfi_vp_WORD word1 | ||
1447 | #define lpfc_init_vfi_vfi_SHIFT 0 | 1450 | #define lpfc_init_vfi_vfi_SHIFT 0 |
1448 | #define lpfc_init_vfi_vfi_MASK 0x0000FFFF | 1451 | #define lpfc_init_vfi_vfi_MASK 0x0000FFFF |
1449 | #define lpfc_init_vfi_vfi_WORD word1 | 1452 | #define lpfc_init_vfi_vfi_WORD word1 |
1450 | uint32_t word2; | 1453 | uint32_t word2; |
1454 | #define lpfc_init_vfi_vpi_SHIFT 16 | ||
1455 | #define lpfc_init_vfi_vpi_MASK 0x0000FFFF | ||
1456 | #define lpfc_init_vfi_vpi_WORD word2 | ||
1451 | #define lpfc_init_vfi_fcfi_SHIFT 0 | 1457 | #define lpfc_init_vfi_fcfi_SHIFT 0 |
1452 | #define lpfc_init_vfi_fcfi_MASK 0x0000FFFF | 1458 | #define lpfc_init_vfi_fcfi_MASK 0x0000FFFF |
1453 | #define lpfc_init_vfi_fcfi_WORD word2 | 1459 | #define lpfc_init_vfi_fcfi_WORD word2 |
@@ -2155,6 +2161,7 @@ struct lpfc_mcqe { | |||
2155 | #define LPFC_TRAILER_CODE_FCOE 0x2 | 2161 | #define LPFC_TRAILER_CODE_FCOE 0x2 |
2156 | #define LPFC_TRAILER_CODE_DCBX 0x3 | 2162 | #define LPFC_TRAILER_CODE_DCBX 0x3 |
2157 | #define LPFC_TRAILER_CODE_GRP5 0x5 | 2163 | #define LPFC_TRAILER_CODE_GRP5 0x5 |
2164 | #define LPFC_TRAILER_CODE_FC 0x10 | ||
2158 | }; | 2165 | }; |
2159 | 2166 | ||
2160 | struct lpfc_acqe_link { | 2167 | struct lpfc_acqe_link { |
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index 912b5959f068..432afc7db1cc 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -446,23 +446,25 @@ lpfc_config_port_post(struct lpfc_hba *phba) | |||
446 | /* Get the default values for Model Name and Description */ | 446 | /* Get the default values for Model Name and Description */ |
447 | lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); | 447 | lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); |
448 | 448 | ||
449 | if ((phba->cfg_link_speed > LINK_SPEED_10G) | 449 | if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_16G) |
450 | || ((phba->cfg_link_speed == LINK_SPEED_1G) | 450 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G) |
451 | && !(phba->lmt & LMT_1Gb)) | 451 | && !(phba->lmt & LMT_1Gb)) |
452 | || ((phba->cfg_link_speed == LINK_SPEED_2G) | 452 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G) |
453 | && !(phba->lmt & LMT_2Gb)) | 453 | && !(phba->lmt & LMT_2Gb)) |
454 | || ((phba->cfg_link_speed == LINK_SPEED_4G) | 454 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G) |
455 | && !(phba->lmt & LMT_4Gb)) | 455 | && !(phba->lmt & LMT_4Gb)) |
456 | || ((phba->cfg_link_speed == LINK_SPEED_8G) | 456 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G) |
457 | && !(phba->lmt & LMT_8Gb)) | 457 | && !(phba->lmt & LMT_8Gb)) |
458 | || ((phba->cfg_link_speed == LINK_SPEED_10G) | 458 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G) |
459 | && !(phba->lmt & LMT_10Gb))) { | 459 | && !(phba->lmt & LMT_10Gb)) |
460 | || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G) | ||
461 | && !(phba->lmt & LMT_16Gb))) { | ||
460 | /* Reset link speed to auto */ | 462 | /* Reset link speed to auto */ |
461 | lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, | 463 | lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, |
462 | "1302 Invalid speed for this board: " | 464 | "1302 Invalid speed for this board: " |
463 | "Reset link speed to auto: x%x\n", | 465 | "Reset link speed to auto: x%x\n", |
464 | phba->cfg_link_speed); | 466 | phba->cfg_link_speed); |
465 | phba->cfg_link_speed = LINK_SPEED_AUTO; | 467 | phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO; |
466 | } | 468 | } |
467 | 469 | ||
468 | phba->link_state = LPFC_LINK_DOWN; | 470 | phba->link_state = LPFC_LINK_DOWN; |
@@ -648,22 +650,23 @@ lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) | |||
648 | mb = &pmb->u.mb; | 650 | mb = &pmb->u.mb; |
649 | pmb->vport = vport; | 651 | pmb->vport = vport; |
650 | 652 | ||
651 | lpfc_init_link(phba, pmb, phba->cfg_topology, | 653 | lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed); |
652 | phba->cfg_link_speed); | ||
653 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | 654 | pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; |
654 | lpfc_set_loopback_flag(phba); | 655 | lpfc_set_loopback_flag(phba); |
655 | rc = lpfc_sli_issue_mbox(phba, pmb, flag); | 656 | rc = lpfc_sli_issue_mbox(phba, pmb, flag); |
656 | if (rc != MBX_SUCCESS) { | 657 | if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) { |
657 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 658 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
658 | "0498 Adapter failed to init, mbxCmd x%x " | 659 | "0498 Adapter failed to init, mbxCmd x%x " |
659 | "INIT_LINK, mbxStatus x%x\n", | 660 | "INIT_LINK, mbxStatus x%x\n", |
660 | mb->mbxCommand, mb->mbxStatus); | 661 | mb->mbxCommand, mb->mbxStatus); |
661 | /* Clear all interrupt enable conditions */ | 662 | if (phba->sli_rev <= LPFC_SLI_REV3) { |
662 | writel(0, phba->HCregaddr); | 663 | /* Clear all interrupt enable conditions */ |
663 | readl(phba->HCregaddr); /* flush */ | 664 | writel(0, phba->HCregaddr); |
664 | /* Clear all pending interrupts */ | 665 | readl(phba->HCregaddr); /* flush */ |
665 | writel(0xffffffff, phba->HAregaddr); | 666 | /* Clear all pending interrupts */ |
666 | readl(phba->HAregaddr); /* flush */ | 667 | writel(0xffffffff, phba->HAregaddr); |
668 | readl(phba->HAregaddr); /* flush */ | ||
669 | } | ||
667 | phba->link_state = LPFC_HBA_ERROR; | 670 | phba->link_state = LPFC_HBA_ERROR; |
668 | if (rc != MBX_BUSY || flag == MBX_POLL) | 671 | if (rc != MBX_BUSY || flag == MBX_POLL) |
669 | mempool_free(pmb, phba->mbox_mem_pool); | 672 | mempool_free(pmb, phba->mbox_mem_pool); |
@@ -1459,8 +1462,8 @@ lpfc_handle_latt(struct lpfc_hba *phba) | |||
1459 | lpfc_els_flush_all_cmd(phba); | 1462 | lpfc_els_flush_all_cmd(phba); |
1460 | 1463 | ||
1461 | psli->slistat.link_event++; | 1464 | psli->slistat.link_event++; |
1462 | lpfc_read_la(phba, pmb, mp); | 1465 | lpfc_read_topology(phba, pmb, mp); |
1463 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_la; | 1466 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; |
1464 | pmb->vport = vport; | 1467 | pmb->vport = vport; |
1465 | /* Block ELS IOCBs until we have processed this mbox command */ | 1468 | /* Block ELS IOCBs until we have processed this mbox command */ |
1466 | phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; | 1469 | phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; |
@@ -3059,20 +3062,20 @@ lpfc_sli4_parse_latt_type(struct lpfc_hba *phba, | |||
3059 | switch (bf_get(lpfc_acqe_link_status, acqe_link)) { | 3062 | switch (bf_get(lpfc_acqe_link_status, acqe_link)) { |
3060 | case LPFC_ASYNC_LINK_STATUS_DOWN: | 3063 | case LPFC_ASYNC_LINK_STATUS_DOWN: |
3061 | case LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN: | 3064 | case LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN: |
3062 | att_type = AT_LINK_DOWN; | 3065 | att_type = LPFC_ATT_LINK_DOWN; |
3063 | break; | 3066 | break; |
3064 | case LPFC_ASYNC_LINK_STATUS_UP: | 3067 | case LPFC_ASYNC_LINK_STATUS_UP: |
3065 | /* Ignore physical link up events - wait for logical link up */ | 3068 | /* Ignore physical link up events - wait for logical link up */ |
3066 | att_type = AT_RESERVED; | 3069 | att_type = LPFC_ATT_RESERVED; |
3067 | break; | 3070 | break; |
3068 | case LPFC_ASYNC_LINK_STATUS_LOGICAL_UP: | 3071 | case LPFC_ASYNC_LINK_STATUS_LOGICAL_UP: |
3069 | att_type = AT_LINK_UP; | 3072 | att_type = LPFC_ATT_LINK_UP; |
3070 | break; | 3073 | break; |
3071 | default: | 3074 | default: |
3072 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 3075 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
3073 | "0399 Invalid link attention type: x%x\n", | 3076 | "0399 Invalid link attention type: x%x\n", |
3074 | bf_get(lpfc_acqe_link_status, acqe_link)); | 3077 | bf_get(lpfc_acqe_link_status, acqe_link)); |
3075 | att_type = AT_RESERVED; | 3078 | att_type = LPFC_ATT_RESERVED; |
3076 | break; | 3079 | break; |
3077 | } | 3080 | } |
3078 | return att_type; | 3081 | return att_type; |
@@ -3096,32 +3099,28 @@ lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba, | |||
3096 | 3099 | ||
3097 | switch (bf_get(lpfc_acqe_link_speed, acqe_link)) { | 3100 | switch (bf_get(lpfc_acqe_link_speed, acqe_link)) { |
3098 | case LPFC_ASYNC_LINK_SPEED_ZERO: | 3101 | case LPFC_ASYNC_LINK_SPEED_ZERO: |
3099 | link_speed = LA_UNKNW_LINK; | ||
3100 | break; | ||
3101 | case LPFC_ASYNC_LINK_SPEED_10MBPS: | 3102 | case LPFC_ASYNC_LINK_SPEED_10MBPS: |
3102 | link_speed = LA_UNKNW_LINK; | ||
3103 | break; | ||
3104 | case LPFC_ASYNC_LINK_SPEED_100MBPS: | 3103 | case LPFC_ASYNC_LINK_SPEED_100MBPS: |
3105 | link_speed = LA_UNKNW_LINK; | 3104 | link_speed = LPFC_LINK_SPEED_UNKNOWN; |
3106 | break; | 3105 | break; |
3107 | case LPFC_ASYNC_LINK_SPEED_1GBPS: | 3106 | case LPFC_ASYNC_LINK_SPEED_1GBPS: |
3108 | link_speed = LA_1GHZ_LINK; | 3107 | link_speed = LPFC_LINK_SPEED_1GHZ; |
3109 | break; | 3108 | break; |
3110 | case LPFC_ASYNC_LINK_SPEED_10GBPS: | 3109 | case LPFC_ASYNC_LINK_SPEED_10GBPS: |
3111 | link_speed = LA_10GHZ_LINK; | 3110 | link_speed = LPFC_LINK_SPEED_10GHZ; |
3112 | break; | 3111 | break; |
3113 | default: | 3112 | default: |
3114 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, | 3113 | lpfc_printf_log(phba, KERN_ERR, LOG_INIT, |
3115 | "0483 Invalid link-attention link speed: x%x\n", | 3114 | "0483 Invalid link-attention link speed: x%x\n", |
3116 | bf_get(lpfc_acqe_link_speed, acqe_link)); | 3115 | bf_get(lpfc_acqe_link_speed, acqe_link)); |
3117 | link_speed = LA_UNKNW_LINK; | 3116 | link_speed = LPFC_LINK_SPEED_UNKNOWN; |
3118 | break; | 3117 | break; |
3119 | } | 3118 | } |
3120 | return link_speed; | 3119 | return link_speed; |
3121 | } | 3120 | } |
3122 | 3121 | ||
3123 | /** | 3122 | /** |
3124 | * lpfc_sli4_async_link_evt - Process the asynchronous link event | 3123 | * lpfc_sli4_async_link_evt - Process the asynchronous FC or FCoE link event |
3125 | * @phba: pointer to lpfc hba data structure. | 3124 | * @phba: pointer to lpfc hba data structure. |
3126 | * @acqe_link: pointer to the async link completion queue entry. | 3125 | * @acqe_link: pointer to the async link completion queue entry. |
3127 | * | 3126 | * |
@@ -3134,11 +3133,12 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3134 | struct lpfc_dmabuf *mp; | 3133 | struct lpfc_dmabuf *mp; |
3135 | LPFC_MBOXQ_t *pmb; | 3134 | LPFC_MBOXQ_t *pmb; |
3136 | MAILBOX_t *mb; | 3135 | MAILBOX_t *mb; |
3137 | READ_LA_VAR *la; | 3136 | struct lpfc_mbx_read_top *la; |
3138 | uint8_t att_type; | 3137 | uint8_t att_type; |
3138 | int rc; | ||
3139 | 3139 | ||
3140 | att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); | 3140 | att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); |
3141 | if (att_type != AT_LINK_DOWN && att_type != AT_LINK_UP) | 3141 | if (att_type != LPFC_ATT_LINK_DOWN && att_type != LPFC_ATT_LINK_UP) |
3142 | return; | 3142 | return; |
3143 | phba->fcoe_eventtag = acqe_link->event_tag; | 3143 | phba->fcoe_eventtag = acqe_link->event_tag; |
3144 | pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 3144 | pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
@@ -3169,28 +3169,11 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3169 | /* Update link event statistics */ | 3169 | /* Update link event statistics */ |
3170 | phba->sli.slistat.link_event++; | 3170 | phba->sli.slistat.link_event++; |
3171 | 3171 | ||
3172 | /* Create pseudo lpfc_handle_latt mailbox command from link ACQE */ | 3172 | /* Create lpfc_handle_latt mailbox command from link ACQE */ |
3173 | lpfc_read_la(phba, pmb, mp); | 3173 | lpfc_read_topology(phba, pmb, mp); |
3174 | pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology; | ||
3174 | pmb->vport = phba->pport; | 3175 | pmb->vport = phba->pport; |
3175 | 3176 | ||
3176 | /* Parse and translate status field */ | ||
3177 | mb = &pmb->u.mb; | ||
3178 | mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba, acqe_link); | ||
3179 | |||
3180 | /* Parse and translate link attention fields */ | ||
3181 | la = (READ_LA_VAR *) &pmb->u.mb.un.varReadLA; | ||
3182 | la->eventTag = acqe_link->event_tag; | ||
3183 | la->attType = att_type; | ||
3184 | la->UlnkSpeed = lpfc_sli4_parse_latt_link_speed(phba, acqe_link); | ||
3185 | |||
3186 | /* Fake the the following irrelvant fields */ | ||
3187 | la->topology = TOPOLOGY_PT_PT; | ||
3188 | la->granted_AL_PA = 0; | ||
3189 | la->il = 0; | ||
3190 | la->pb = 0; | ||
3191 | la->fa = 0; | ||
3192 | la->mm = 0; | ||
3193 | |||
3194 | /* Keep the link status for extra SLI4 state machine reference */ | 3177 | /* Keep the link status for extra SLI4 state machine reference */ |
3195 | phba->sli4_hba.link_state.speed = | 3178 | phba->sli4_hba.link_state.speed = |
3196 | bf_get(lpfc_acqe_link_speed, acqe_link); | 3179 | bf_get(lpfc_acqe_link_speed, acqe_link); |
@@ -3204,9 +3187,42 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, | |||
3204 | bf_get(lpfc_acqe_link_fault, acqe_link); | 3187 | bf_get(lpfc_acqe_link_fault, acqe_link); |
3205 | phba->sli4_hba.link_state.logical_speed = | 3188 | phba->sli4_hba.link_state.logical_speed = |
3206 | bf_get(lpfc_acqe_qos_link_speed, acqe_link); | 3189 | bf_get(lpfc_acqe_qos_link_speed, acqe_link); |
3190 | /* | ||
3191 | * For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch | ||
3192 | * topology info. Note: Optional for non FC-AL ports. | ||
3193 | */ | ||
3194 | if (!(phba->hba_flag & HBA_FCOE_MODE)) { | ||
3195 | rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT); | ||
3196 | if (rc == MBX_NOT_FINISHED) | ||
3197 | goto out_free_dmabuf; | ||
3198 | return; | ||
3199 | } | ||
3200 | /* | ||
3201 | * For FCoE Mode: fill in all the topology information we need and call | ||
3202 | * the READ_TOPOLOGY completion routine to continue without actually | ||
3203 | * sending the READ_TOPOLOGY mailbox command to the port. | ||
3204 | */ | ||
3205 | /* Parse and translate status field */ | ||
3206 | mb = &pmb->u.mb; | ||
3207 | mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba, acqe_link); | ||
3208 | |||
3209 | /* Parse and translate link attention fields */ | ||
3210 | la = (struct lpfc_mbx_read_top *) &pmb->u.mb.un.varReadTop; | ||
3211 | la->eventTag = acqe_link->event_tag; | ||
3212 | bf_set(lpfc_mbx_read_top_att_type, la, att_type); | ||
3213 | bf_set(lpfc_mbx_read_top_link_spd, la, | ||
3214 | lpfc_sli4_parse_latt_link_speed(phba, acqe_link)); | ||
3215 | |||
3216 | /* Fake the the following irrelvant fields */ | ||
3217 | bf_set(lpfc_mbx_read_top_topology, la, LPFC_TOPOLOGY_PT_PT); | ||
3218 | bf_set(lpfc_mbx_read_top_alpa_granted, la, 0); | ||
3219 | bf_set(lpfc_mbx_read_top_il, la, 0); | ||
3220 | bf_set(lpfc_mbx_read_top_pb, la, 0); | ||
3221 | bf_set(lpfc_mbx_read_top_fa, la, 0); | ||
3222 | bf_set(lpfc_mbx_read_top_mm, la, 0); | ||
3207 | 3223 | ||
3208 | /* Invoke the lpfc_handle_latt mailbox command callback function */ | 3224 | /* Invoke the lpfc_handle_latt mailbox command callback function */ |
3209 | lpfc_mbx_cmpl_read_la(phba, pmb); | 3225 | lpfc_mbx_cmpl_read_topology(phba, pmb); |
3210 | 3226 | ||
3211 | return; | 3227 | return; |
3212 | 3228 | ||
@@ -3295,15 +3311,15 @@ lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) | |||
3295 | } | 3311 | } |
3296 | 3312 | ||
3297 | /** | 3313 | /** |
3298 | * lpfc_sli4_async_fcoe_evt - Process the asynchronous fcoe event | 3314 | * lpfc_sli4_async_fip_evt - Process the asynchronous FCoE FIP event |
3299 | * @phba: pointer to lpfc hba data structure. | 3315 | * @phba: pointer to lpfc hba data structure. |
3300 | * @acqe_link: pointer to the async fcoe completion queue entry. | 3316 | * @acqe_link: pointer to the async fcoe completion queue entry. |
3301 | * | 3317 | * |
3302 | * This routine is to handle the SLI4 asynchronous fcoe event. | 3318 | * This routine is to handle the SLI4 asynchronous fcoe event. |
3303 | **/ | 3319 | **/ |
3304 | static void | 3320 | static void |
3305 | lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, | 3321 | lpfc_sli4_async_fip_evt(struct lpfc_hba *phba, |
3306 | struct lpfc_acqe_fcoe *acqe_fcoe) | 3322 | struct lpfc_acqe_fcoe *acqe_fcoe) |
3307 | { | 3323 | { |
3308 | uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe); | 3324 | uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe); |
3309 | int rc; | 3325 | int rc; |
@@ -3605,12 +3621,13 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) | |||
3605 | /* Process the asynchronous event */ | 3621 | /* Process the asynchronous event */ |
3606 | switch (bf_get(lpfc_trailer_code, &cq_event->cqe.mcqe_cmpl)) { | 3622 | switch (bf_get(lpfc_trailer_code, &cq_event->cqe.mcqe_cmpl)) { |
3607 | case LPFC_TRAILER_CODE_LINK: | 3623 | case LPFC_TRAILER_CODE_LINK: |
3624 | case LPFC_TRAILER_CODE_FC: | ||
3608 | lpfc_sli4_async_link_evt(phba, | 3625 | lpfc_sli4_async_link_evt(phba, |
3609 | &cq_event->cqe.acqe_link); | 3626 | &cq_event->cqe.acqe_link); |
3610 | break; | 3627 | break; |
3611 | case LPFC_TRAILER_CODE_FCOE: | 3628 | case LPFC_TRAILER_CODE_FCOE: |
3612 | lpfc_sli4_async_fcoe_evt(phba, | 3629 | lpfc_sli4_async_fip_evt(phba, |
3613 | &cq_event->cqe.acqe_fcoe); | 3630 | &cq_event->cqe.acqe_fcoe); |
3614 | break; | 3631 | break; |
3615 | case LPFC_TRAILER_CODE_DCBX: | 3632 | case LPFC_TRAILER_CODE_DCBX: |
3616 | lpfc_sli4_async_dcbx_evt(phba, | 3633 | lpfc_sli4_async_dcbx_evt(phba, |
diff --git a/drivers/scsi/lpfc/lpfc_mbox.c b/drivers/scsi/lpfc/lpfc_mbox.c index 62d0957e1d4c..b1dab92628ee 100644 --- a/drivers/scsi/lpfc/lpfc_mbox.c +++ b/drivers/scsi/lpfc/lpfc_mbox.c | |||
@@ -263,18 +263,19 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
263 | } | 263 | } |
264 | 264 | ||
265 | /** | 265 | /** |
266 | * lpfc_read_la - Prepare a mailbox command for reading HBA link attention | 266 | * lpfc_read_topology - Prepare a mailbox command for reading HBA topology |
267 | * @phba: pointer to lpfc hba data structure. | 267 | * @phba: pointer to lpfc hba data structure. |
268 | * @pmb: pointer to the driver internal queue element for mailbox command. | 268 | * @pmb: pointer to the driver internal queue element for mailbox command. |
269 | * @mp: DMA buffer memory for reading the link attention information into. | 269 | * @mp: DMA buffer memory for reading the link attention information into. |
270 | * | 270 | * |
271 | * The read link attention mailbox command is issued to read the Link Event | 271 | * The read topology mailbox command is issued to read the link topology |
272 | * Attention information indicated by the HBA port when the Link Event bit | 272 | * information indicated by the HBA port when the Link Event bit of the Host |
273 | * of the Host Attention (HSTATT) register is set to 1. A Link Event | 273 | * Attention (HSTATT) register is set to 1 (For SLI-3) or when an FC Link |
274 | * Attention ACQE is received from the port (For SLI-4). A Link Event | ||
274 | * Attention occurs based on an exception detected at the Fibre Channel link | 275 | * Attention occurs based on an exception detected at the Fibre Channel link |
275 | * interface. | 276 | * interface. |
276 | * | 277 | * |
277 | * This routine prepares the mailbox command for reading HBA link attention | 278 | * This routine prepares the mailbox command for reading HBA link topology |
278 | * information. A DMA memory has been set aside and address passed to the | 279 | * information. A DMA memory has been set aside and address passed to the |
279 | * HBA through @mp for the HBA to DMA link attention information into the | 280 | * HBA through @mp for the HBA to DMA link attention information into the |
280 | * memory as part of the execution of the mailbox command. | 281 | * memory as part of the execution of the mailbox command. |
@@ -283,7 +284,8 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) | |||
283 | * 0 - Success (currently always return 0) | 284 | * 0 - Success (currently always return 0) |
284 | **/ | 285 | **/ |
285 | int | 286 | int |
286 | lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp) | 287 | lpfc_read_topology(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, |
288 | struct lpfc_dmabuf *mp) | ||
287 | { | 289 | { |
288 | MAILBOX_t *mb; | 290 | MAILBOX_t *mb; |
289 | struct lpfc_sli *psli; | 291 | struct lpfc_sli *psli; |
@@ -293,15 +295,15 @@ lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp) | |||
293 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); | 295 | memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); |
294 | 296 | ||
295 | INIT_LIST_HEAD(&mp->list); | 297 | INIT_LIST_HEAD(&mp->list); |
296 | mb->mbxCommand = MBX_READ_LA64; | 298 | mb->mbxCommand = MBX_READ_TOPOLOGY; |
297 | mb->un.varReadLA.un.lilpBde64.tus.f.bdeSize = 128; | 299 | mb->un.varReadTop.lilpBde64.tus.f.bdeSize = LPFC_ALPA_MAP_SIZE; |
298 | mb->un.varReadLA.un.lilpBde64.addrHigh = putPaddrHigh(mp->phys); | 300 | mb->un.varReadTop.lilpBde64.addrHigh = putPaddrHigh(mp->phys); |
299 | mb->un.varReadLA.un.lilpBde64.addrLow = putPaddrLow(mp->phys); | 301 | mb->un.varReadTop.lilpBde64.addrLow = putPaddrLow(mp->phys); |
300 | 302 | ||
301 | /* Save address for later completion and set the owner to host so that | 303 | /* Save address for later completion and set the owner to host so that |
302 | * the FW knows this mailbox is available for processing. | 304 | * the FW knows this mailbox is available for processing. |
303 | */ | 305 | */ |
304 | pmb->context1 = (uint8_t *) mp; | 306 | pmb->context1 = (uint8_t *)mp; |
305 | mb->mbxOwner = OWN_HOST; | 307 | mb->mbxOwner = OWN_HOST; |
306 | return (0); | 308 | return (0); |
307 | } | 309 | } |
@@ -516,18 +518,33 @@ lpfc_init_link(struct lpfc_hba * phba, | |||
516 | vpd = &phba->vpd; | 518 | vpd = &phba->vpd; |
517 | if (vpd->rev.feaLevelHigh >= 0x02){ | 519 | if (vpd->rev.feaLevelHigh >= 0x02){ |
518 | switch(linkspeed){ | 520 | switch(linkspeed){ |
519 | case LINK_SPEED_1G: | 521 | case LPFC_USER_LINK_SPEED_1G: |
520 | case LINK_SPEED_2G: | 522 | mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; |
521 | case LINK_SPEED_4G: | 523 | mb->un.varInitLnk.link_speed = LINK_SPEED_1G; |
522 | case LINK_SPEED_8G: | 524 | break; |
523 | mb->un.varInitLnk.link_flags |= | 525 | case LPFC_USER_LINK_SPEED_2G: |
524 | FLAGS_LINK_SPEED; | 526 | mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; |
525 | mb->un.varInitLnk.link_speed = linkspeed; | 527 | mb->un.varInitLnk.link_speed = LINK_SPEED_2G; |
528 | break; | ||
529 | case LPFC_USER_LINK_SPEED_4G: | ||
530 | mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; | ||
531 | mb->un.varInitLnk.link_speed = LINK_SPEED_4G; | ||
532 | break; | ||
533 | case LPFC_USER_LINK_SPEED_8G: | ||
534 | mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; | ||
535 | mb->un.varInitLnk.link_speed = LINK_SPEED_8G; | ||
536 | break; | ||
537 | case LPFC_USER_LINK_SPEED_10G: | ||
538 | mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; | ||
539 | mb->un.varInitLnk.link_speed = LINK_SPEED_10G; | ||
540 | break; | ||
541 | case LPFC_USER_LINK_SPEED_16G: | ||
542 | mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED; | ||
543 | mb->un.varInitLnk.link_speed = LINK_SPEED_16G; | ||
526 | break; | 544 | break; |
527 | case LINK_SPEED_AUTO: | 545 | case LPFC_USER_LINK_SPEED_AUTO: |
528 | default: | 546 | default: |
529 | mb->un.varInitLnk.link_speed = | 547 | mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO; |
530 | LINK_SPEED_AUTO; | ||
531 | break; | 548 | break; |
532 | } | 549 | } |
533 | 550 | ||
@@ -1918,11 +1935,14 @@ lpfc_init_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport) | |||
1918 | struct lpfc_mbx_init_vfi *init_vfi; | 1935 | struct lpfc_mbx_init_vfi *init_vfi; |
1919 | 1936 | ||
1920 | memset(mbox, 0, sizeof(*mbox)); | 1937 | memset(mbox, 0, sizeof(*mbox)); |
1938 | mbox->vport = vport; | ||
1921 | init_vfi = &mbox->u.mqe.un.init_vfi; | 1939 | init_vfi = &mbox->u.mqe.un.init_vfi; |
1922 | bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VFI); | 1940 | bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VFI); |
1923 | bf_set(lpfc_init_vfi_vr, init_vfi, 1); | 1941 | bf_set(lpfc_init_vfi_vr, init_vfi, 1); |
1924 | bf_set(lpfc_init_vfi_vt, init_vfi, 1); | 1942 | bf_set(lpfc_init_vfi_vt, init_vfi, 1); |
1943 | bf_set(lpfc_init_vfi_vp, init_vfi, 1); | ||
1925 | bf_set(lpfc_init_vfi_vfi, init_vfi, vport->vfi + vport->phba->vfi_base); | 1944 | bf_set(lpfc_init_vfi_vfi, init_vfi, vport->vfi + vport->phba->vfi_base); |
1945 | bf_set(lpfc_init_vpi_vpi, init_vfi, vport->vpi + vport->phba->vpi_base); | ||
1926 | bf_set(lpfc_init_vfi_fcfi, init_vfi, vport->phba->fcf.fcfi); | 1946 | bf_set(lpfc_init_vfi_fcfi, init_vfi, vport->phba->fcf.fcfi); |
1927 | } | 1947 | } |
1928 | 1948 | ||
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 06b1655b4d59..bedaa4e7cbf8 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -1634,7 +1634,6 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand) | |||
1634 | case MBX_READ_LNK_STAT: | 1634 | case MBX_READ_LNK_STAT: |
1635 | case MBX_REG_LOGIN: | 1635 | case MBX_REG_LOGIN: |
1636 | case MBX_UNREG_LOGIN: | 1636 | case MBX_UNREG_LOGIN: |
1637 | case MBX_READ_LA: | ||
1638 | case MBX_CLEAR_LA: | 1637 | case MBX_CLEAR_LA: |
1639 | case MBX_DUMP_MEMORY: | 1638 | case MBX_DUMP_MEMORY: |
1640 | case MBX_DUMP_CONTEXT: | 1639 | case MBX_DUMP_CONTEXT: |
@@ -1656,7 +1655,7 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand) | |||
1656 | case MBX_READ_SPARM64: | 1655 | case MBX_READ_SPARM64: |
1657 | case MBX_READ_RPI64: | 1656 | case MBX_READ_RPI64: |
1658 | case MBX_REG_LOGIN64: | 1657 | case MBX_REG_LOGIN64: |
1659 | case MBX_READ_LA64: | 1658 | case MBX_READ_TOPOLOGY: |
1660 | case MBX_WRITE_WWN: | 1659 | case MBX_WRITE_WWN: |
1661 | case MBX_SET_DEBUG: | 1660 | case MBX_SET_DEBUG: |
1662 | case MBX_LOAD_EXP_ROM: | 1661 | case MBX_LOAD_EXP_ROM: |
@@ -4357,13 +4356,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4357 | } | 4356 | } |
4358 | 4357 | ||
4359 | rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size); | 4358 | rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size); |
4360 | if (unlikely(rc)) | 4359 | if (unlikely(rc)) { |
4361 | goto out_free_vpd; | 4360 | kfree(vpd); |
4362 | 4361 | goto out_free_mbox; | |
4362 | } | ||
4363 | mqe = &mboxq->u.mqe; | 4363 | mqe = &mboxq->u.mqe; |
4364 | phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev); | 4364 | phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev); |
4365 | if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev)) | 4365 | if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev)) |
4366 | phba->hba_flag |= HBA_FCOE_SUPPORT; | 4366 | phba->hba_flag |= HBA_FCOE_MODE; |
4367 | else | ||
4368 | phba->hba_flag &= ~HBA_FCOE_MODE; | ||
4367 | 4369 | ||
4368 | if (bf_get(lpfc_mbx_rd_rev_cee_ver, &mqe->un.read_rev) == | 4370 | if (bf_get(lpfc_mbx_rd_rev_cee_ver, &mqe->un.read_rev) == |
4369 | LPFC_DCBX_CEE_MODE) | 4371 | LPFC_DCBX_CEE_MODE) |
@@ -4372,13 +4374,14 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4372 | phba->hba_flag &= ~HBA_FIP_SUPPORT; | 4374 | phba->hba_flag &= ~HBA_FIP_SUPPORT; |
4373 | 4375 | ||
4374 | if (phba->sli_rev != LPFC_SLI_REV4 || | 4376 | if (phba->sli_rev != LPFC_SLI_REV4 || |
4375 | !(phba->hba_flag & HBA_FCOE_SUPPORT)) { | 4377 | !(phba->hba_flag & HBA_FCOE_MODE)) { |
4376 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, | 4378 | lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, |
4377 | "0376 READ_REV Error. SLI Level %d " | 4379 | "0376 READ_REV Error. SLI Level %d " |
4378 | "FCoE enabled %d\n", | 4380 | "FCoE enabled %d\n", |
4379 | phba->sli_rev, phba->hba_flag & HBA_FCOE_SUPPORT); | 4381 | phba->sli_rev, phba->hba_flag & HBA_FCOE_MODE); |
4380 | rc = -EIO; | 4382 | rc = -EIO; |
4381 | goto out_free_vpd; | 4383 | kfree(vpd); |
4384 | goto out_free_mbox; | ||
4382 | } | 4385 | } |
4383 | /* | 4386 | /* |
4384 | * Evaluate the read rev and vpd data. Populate the driver | 4387 | * Evaluate the read rev and vpd data. Populate the driver |
@@ -4392,6 +4395,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4392 | "Using defaults.\n", rc); | 4395 | "Using defaults.\n", rc); |
4393 | rc = 0; | 4396 | rc = 0; |
4394 | } | 4397 | } |
4398 | kfree(vpd); | ||
4395 | 4399 | ||
4396 | /* Save information as VPD data */ | 4400 | /* Save information as VPD data */ |
4397 | phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev; | 4401 | phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev; |
@@ -4428,7 +4432,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4428 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | 4432 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); |
4429 | if (unlikely(rc)) { | 4433 | if (unlikely(rc)) { |
4430 | rc = -EIO; | 4434 | rc = -EIO; |
4431 | goto out_free_vpd; | 4435 | goto out_free_mbox; |
4432 | } | 4436 | } |
4433 | 4437 | ||
4434 | /* | 4438 | /* |
@@ -4476,7 +4480,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4476 | if (rc) { | 4480 | if (rc) { |
4477 | phba->link_state = LPFC_HBA_ERROR; | 4481 | phba->link_state = LPFC_HBA_ERROR; |
4478 | rc = -ENOMEM; | 4482 | rc = -ENOMEM; |
4479 | goto out_free_vpd; | 4483 | goto out_free_mbox; |
4480 | } | 4484 | } |
4481 | 4485 | ||
4482 | mboxq->vport = vport; | 4486 | mboxq->vport = vport; |
@@ -4501,7 +4505,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4501 | rc, bf_get(lpfc_mqe_status, mqe)); | 4505 | rc, bf_get(lpfc_mqe_status, mqe)); |
4502 | phba->link_state = LPFC_HBA_ERROR; | 4506 | phba->link_state = LPFC_HBA_ERROR; |
4503 | rc = -EIO; | 4507 | rc = -EIO; |
4504 | goto out_free_vpd; | 4508 | goto out_free_mbox; |
4505 | } | 4509 | } |
4506 | 4510 | ||
4507 | if (phba->cfg_soft_wwnn) | 4511 | if (phba->cfg_soft_wwnn) |
@@ -4526,7 +4530,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4526 | "0582 Error %d during sgl post operation\n", | 4530 | "0582 Error %d during sgl post operation\n", |
4527 | rc); | 4531 | rc); |
4528 | rc = -ENODEV; | 4532 | rc = -ENODEV; |
4529 | goto out_free_vpd; | 4533 | goto out_free_mbox; |
4530 | } | 4534 | } |
4531 | 4535 | ||
4532 | /* Register SCSI SGL pool to the device */ | 4536 | /* Register SCSI SGL pool to the device */ |
@@ -4538,7 +4542,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4538 | /* Some Scsi buffers were moved to the abort scsi list */ | 4542 | /* Some Scsi buffers were moved to the abort scsi list */ |
4539 | /* A pci function reset will repost them */ | 4543 | /* A pci function reset will repost them */ |
4540 | rc = -ENODEV; | 4544 | rc = -ENODEV; |
4541 | goto out_free_vpd; | 4545 | goto out_free_mbox; |
4542 | } | 4546 | } |
4543 | 4547 | ||
4544 | /* Post the rpi header region to the device. */ | 4548 | /* Post the rpi header region to the device. */ |
@@ -4548,7 +4552,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4548 | "0393 Error %d during rpi post operation\n", | 4552 | "0393 Error %d during rpi post operation\n", |
4549 | rc); | 4553 | rc); |
4550 | rc = -ENODEV; | 4554 | rc = -ENODEV; |
4551 | goto out_free_vpd; | 4555 | goto out_free_mbox; |
4552 | } | 4556 | } |
4553 | 4557 | ||
4554 | /* Set up all the queues to the device */ | 4558 | /* Set up all the queues to the device */ |
@@ -4608,33 +4612,33 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) | |||
4608 | } | 4612 | } |
4609 | } | 4613 | } |
4610 | 4614 | ||
4615 | if (!(phba->hba_flag & HBA_FCOE_MODE)) { | ||
4616 | /* | ||
4617 | * The FC Port needs to register FCFI (index 0) | ||
4618 | */ | ||
4619 | lpfc_reg_fcfi(phba, mboxq); | ||
4620 | mboxq->vport = phba->pport; | ||
4621 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); | ||
4622 | if (rc == MBX_SUCCESS) | ||
4623 | rc = 0; | ||
4624 | else | ||
4625 | goto out_unset_queue; | ||
4626 | } | ||
4611 | /* | 4627 | /* |
4612 | * The port is ready, set the host's link state to LINK_DOWN | 4628 | * The port is ready, set the host's link state to LINK_DOWN |
4613 | * in preparation for link interrupts. | 4629 | * in preparation for link interrupts. |
4614 | */ | 4630 | */ |
4615 | lpfc_init_link(phba, mboxq, phba->cfg_topology, phba->cfg_link_speed); | ||
4616 | mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl; | ||
4617 | lpfc_set_loopback_flag(phba); | ||
4618 | /* Change driver state to LPFC_LINK_DOWN right before init link */ | ||
4619 | spin_lock_irq(&phba->hbalock); | 4631 | spin_lock_irq(&phba->hbalock); |
4620 | phba->link_state = LPFC_LINK_DOWN; | 4632 | phba->link_state = LPFC_LINK_DOWN; |
4621 | spin_unlock_irq(&phba->hbalock); | 4633 | spin_unlock_irq(&phba->hbalock); |
4622 | rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); | 4634 | rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT); |
4623 | if (unlikely(rc != MBX_NOT_FINISHED)) { | 4635 | out_unset_queue: |
4624 | kfree(vpd); | ||
4625 | return 0; | ||
4626 | } else | ||
4627 | rc = -EIO; | ||
4628 | |||
4629 | /* Unset all the queues set up in this routine when error out */ | 4636 | /* Unset all the queues set up in this routine when error out */ |
4630 | if (rc) | 4637 | if (rc) |
4631 | lpfc_sli4_queue_unset(phba); | 4638 | lpfc_sli4_queue_unset(phba); |
4632 | |||
4633 | out_stop_timers: | 4639 | out_stop_timers: |
4634 | if (rc) | 4640 | if (rc) |
4635 | lpfc_stop_hba_timers(phba); | 4641 | lpfc_stop_hba_timers(phba); |
4636 | out_free_vpd: | ||
4637 | kfree(vpd); | ||
4638 | out_free_mbox: | 4642 | out_free_mbox: |
4639 | mempool_free(mboxq, phba->mbox_mem_pool); | 4643 | mempool_free(mboxq, phba->mbox_mem_pool); |
4640 | return rc; | 4644 | return rc; |
@@ -12157,42 +12161,37 @@ lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp) | |||
12157 | 12161 | ||
12158 | /** | 12162 | /** |
12159 | * lpfc_sli4_init_vpi - Initialize a vpi with the port | 12163 | * lpfc_sli4_init_vpi - Initialize a vpi with the port |
12160 | * @phba: pointer to lpfc hba data structure. | 12164 | * @vport: Pointer to the vport for which the vpi is being initialized |
12161 | * @vpi: vpi value to activate with the port. | ||
12162 | * | 12165 | * |
12163 | * This routine is invoked to activate a vpi with the | 12166 | * This routine is invoked to activate a vpi with the port. |
12164 | * port when the host intends to use vports with a | ||
12165 | * nonzero vpi. | ||
12166 | * | 12167 | * |
12167 | * Returns: | 12168 | * Returns: |
12168 | * 0 success | 12169 | * 0 success |
12169 | * -Evalue otherwise | 12170 | * -Evalue otherwise |
12170 | **/ | 12171 | **/ |
12171 | int | 12172 | int |
12172 | lpfc_sli4_init_vpi(struct lpfc_hba *phba, uint16_t vpi) | 12173 | lpfc_sli4_init_vpi(struct lpfc_vport *vport) |
12173 | { | 12174 | { |
12174 | LPFC_MBOXQ_t *mboxq; | 12175 | LPFC_MBOXQ_t *mboxq; |
12175 | int rc = 0; | 12176 | int rc = 0; |
12176 | int retval = MBX_SUCCESS; | 12177 | int retval = MBX_SUCCESS; |
12177 | uint32_t mbox_tmo; | 12178 | uint32_t mbox_tmo; |
12178 | 12179 | struct lpfc_hba *phba = vport->phba; | |
12179 | if (vpi == 0) | ||
12180 | return -EINVAL; | ||
12181 | mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); | 12180 | mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); |
12182 | if (!mboxq) | 12181 | if (!mboxq) |
12183 | return -ENOMEM; | 12182 | return -ENOMEM; |
12184 | lpfc_init_vpi(phba, mboxq, vpi); | 12183 | lpfc_init_vpi(phba, mboxq, vport->vpi); |
12185 | mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI); | 12184 | mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI); |
12186 | rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); | 12185 | rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); |
12187 | if (rc != MBX_SUCCESS) { | 12186 | if (rc != MBX_SUCCESS) { |
12188 | lpfc_printf_log(phba, KERN_ERR, LOG_SLI, | 12187 | lpfc_printf_vlog(vport, KERN_ERR, LOG_SLI, |
12189 | "2022 INIT VPI Mailbox failed " | 12188 | "2022 INIT VPI Mailbox failed " |
12190 | "status %d, mbxStatus x%x\n", rc, | 12189 | "status %d, mbxStatus x%x\n", rc, |
12191 | bf_get(lpfc_mqe_status, &mboxq->u.mqe)); | 12190 | bf_get(lpfc_mqe_status, &mboxq->u.mqe)); |
12192 | retval = -EIO; | 12191 | retval = -EIO; |
12193 | } | 12192 | } |
12194 | if (rc != MBX_TIMEOUT) | 12193 | if (rc != MBX_TIMEOUT) |
12195 | mempool_free(mboxq, phba->mbox_mem_pool); | 12194 | mempool_free(mboxq, vport->phba->mbox_mem_pool); |
12196 | 12195 | ||
12197 | return retval; | 12196 | return retval; |
12198 | } | 12197 | } |
diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index c4483feb8b71..bc30fcf3f804 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h | |||
@@ -548,7 +548,7 @@ int lpfc_sli4_brdreset(struct lpfc_hba *); | |||
548 | int lpfc_sli4_add_fcf_record(struct lpfc_hba *, struct fcf_record *); | 548 | int lpfc_sli4_add_fcf_record(struct lpfc_hba *, struct fcf_record *); |
549 | void lpfc_sli_remove_dflt_fcf(struct lpfc_hba *); | 549 | void lpfc_sli_remove_dflt_fcf(struct lpfc_hba *); |
550 | int lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *); | 550 | int lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *); |
551 | int lpfc_sli4_init_vpi(struct lpfc_hba *, uint16_t); | 551 | int lpfc_sli4_init_vpi(struct lpfc_vport *); |
552 | uint32_t lpfc_sli4_cq_release(struct lpfc_queue *, bool); | 552 | uint32_t lpfc_sli4_cq_release(struct lpfc_queue *, bool); |
553 | uint32_t lpfc_sli4_eq_release(struct lpfc_queue *, bool); | 553 | uint32_t lpfc_sli4_eq_release(struct lpfc_queue *, bool); |
554 | void lpfc_sli4_fcfi_unreg(struct lpfc_hba *, uint16_t); | 554 | void lpfc_sli4_fcfi_unreg(struct lpfc_hba *, uint16_t); |
diff --git a/drivers/scsi/lpfc/lpfc_vport.c b/drivers/scsi/lpfc/lpfc_vport.c index a5281ce893d0..6b8d2952e32f 100644 --- a/drivers/scsi/lpfc/lpfc_vport.c +++ b/drivers/scsi/lpfc/lpfc_vport.c | |||
@@ -395,8 +395,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
395 | * by the port. | 395 | * by the port. |
396 | */ | 396 | */ |
397 | if ((phba->sli_rev == LPFC_SLI_REV4) && | 397 | if ((phba->sli_rev == LPFC_SLI_REV4) && |
398 | (pport->fc_flag & FC_VFI_REGISTERED)) { | 398 | (pport->fc_flag & FC_VFI_REGISTERED)) { |
399 | rc = lpfc_sli4_init_vpi(phba, vpi); | 399 | rc = lpfc_sli4_init_vpi(vport); |
400 | if (rc) { | 400 | if (rc) { |
401 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, | 401 | lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, |
402 | "1838 Failed to INIT_VPI on vpi %d " | 402 | "1838 Failed to INIT_VPI on vpi %d " |
@@ -418,7 +418,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) | |||
418 | 418 | ||
419 | if ((phba->link_state < LPFC_LINK_UP) || | 419 | if ((phba->link_state < LPFC_LINK_UP) || |
420 | (pport->port_state < LPFC_FABRIC_CFG_LINK) || | 420 | (pport->port_state < LPFC_FABRIC_CFG_LINK) || |
421 | (phba->fc_topology == TOPOLOGY_LOOP)) { | 421 | (phba->fc_topology == LPFC_TOPOLOGY_LOOP)) { |
422 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); | 422 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); |
423 | rc = VPORT_OK; | 423 | rc = VPORT_OK; |
424 | goto out; | 424 | goto out; |
@@ -514,7 +514,7 @@ enable_vport(struct fc_vport *fc_vport) | |||
514 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); | 514 | struct Scsi_Host *shost = lpfc_shost_from_vport(vport); |
515 | 515 | ||
516 | if ((phba->link_state < LPFC_LINK_UP) || | 516 | if ((phba->link_state < LPFC_LINK_UP) || |
517 | (phba->fc_topology == TOPOLOGY_LOOP)) { | 517 | (phba->fc_topology == LPFC_TOPOLOGY_LOOP)) { |
518 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); | 518 | lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); |
519 | return VPORT_OK; | 519 | return VPORT_OK; |
520 | } | 520 | } |
@@ -665,7 +665,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport) | |||
665 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) && | 665 | if (ndlp && NLP_CHK_NODE_ACT(ndlp) && |
666 | ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && | 666 | ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && |
667 | phba->link_state >= LPFC_LINK_UP && | 667 | phba->link_state >= LPFC_LINK_UP && |
668 | phba->fc_topology != TOPOLOGY_LOOP) { | 668 | phba->fc_topology != LPFC_TOPOLOGY_LOOP) { |
669 | if (vport->cfg_enable_da_id) { | 669 | if (vport->cfg_enable_da_id) { |
670 | timeout = msecs_to_jiffies(phba->fc_ratov * 2000); | 670 | timeout = msecs_to_jiffies(phba->fc_ratov * 2000); |
671 | if (!lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0)) | 671 | if (!lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0)) |