Commit 76a95d75 authored by James Smart's avatar James Smart Committed by James Bottomley

[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: default avatarAlex Iannicelli <alex.iannicelli@emulex.com>
Signed-off-by: default avatarJames Smart <james.smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 085c647c
...@@ -464,6 +464,23 @@ struct unsol_rcv_ct_ctx { ...@@ -464,6 +464,23 @@ struct unsol_rcv_ct_ctx {
#define UNSOL_VALID 0x00000001 #define UNSOL_VALID 0x00000001
}; };
#define LPFC_USER_LINK_SPEED_AUTO 0 /* auto select (default)*/
#define LPFC_USER_LINK_SPEED_1G 1 /* 1 Gigabaud */
#define LPFC_USER_LINK_SPEED_2G 2 /* 2 Gigabaud */
#define LPFC_USER_LINK_SPEED_4G 4 /* 4 Gigabaud */
#define LPFC_USER_LINK_SPEED_8G 8 /* 8 Gigabaud */
#define LPFC_USER_LINK_SPEED_10G 10 /* 10 Gigabaud */
#define LPFC_USER_LINK_SPEED_16G 16 /* 16 Gigabaud */
#define LPFC_USER_LINK_SPEED_MAX LPFC_USER_LINK_SPEED_16G
#define LPFC_USER_LINK_SPEED_BITMAP ((1 << LPFC_USER_LINK_SPEED_16G) | \
(1 << LPFC_USER_LINK_SPEED_10G) | \
(1 << LPFC_USER_LINK_SPEED_8G) | \
(1 << LPFC_USER_LINK_SPEED_4G) | \
(1 << LPFC_USER_LINK_SPEED_2G) | \
(1 << LPFC_USER_LINK_SPEED_1G) | \
(1 << LPFC_USER_LINK_SPEED_AUTO))
#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8, 10, 16"
struct lpfc_hba { struct lpfc_hba {
/* SCSI interface function jump table entries */ /* SCSI interface function jump table entries */
int (*lpfc_new_scsi_buf) int (*lpfc_new_scsi_buf)
...@@ -545,7 +562,7 @@ struct lpfc_hba { ...@@ -545,7 +562,7 @@ struct lpfc_hba {
uint32_t hba_flag; /* hba generic flags */ uint32_t hba_flag; /* hba generic flags */
#define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */ #define HBA_ERATT_HANDLED 0x1 /* This flag is set when eratt handled */
#define DEFER_ERATT 0x2 /* Deferred error attention in progress */ #define DEFER_ERATT 0x2 /* Deferred error attention in progress */
#define HBA_FCOE_SUPPORT 0x4 /* HBA function supports FCOE */ #define HBA_FCOE_MODE 0x4 /* HBA function in FCoE Mode */
#define HBA_SP_QUEUE_EVT 0x8 /* Slow-path qevt posted to worker thread*/ #define HBA_SP_QUEUE_EVT 0x8 /* Slow-path qevt posted to worker thread*/
#define HBA_POST_RECEIVE_BUFFER 0x10 /* Rcv buffers need to be posted */ #define HBA_POST_RECEIVE_BUFFER 0x10 /* Rcv buffers need to be posted */
#define FCP_XRI_ABORT_EVENT 0x20 #define FCP_XRI_ABORT_EVENT 0x20
......
...@@ -52,10 +52,6 @@ ...@@ -52,10 +52,6 @@
#define LPFC_MIN_DEVLOSS_TMO 1 #define LPFC_MIN_DEVLOSS_TMO 1
#define LPFC_MAX_DEVLOSS_TMO 255 #define LPFC_MAX_DEVLOSS_TMO 255
#define LPFC_MAX_LINK_SPEED 8
#define LPFC_LINK_SPEED_BITMAP 0x00000117
#define LPFC_LINK_SPEED_STRING "0, 1, 2, 4, 8"
/** /**
* lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules * lpfc_jedec_to_ascii - Hex to ascii convertor according to JEDEC rules
* @incr: integer to convert. * @incr: integer to convert.
...@@ -463,7 +459,7 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr, ...@@ -463,7 +459,7 @@ lpfc_link_state_show(struct device *dev, struct device_attribute *attr,
if (phba->sli.sli_flag & LPFC_MENLO_MAINT) if (phba->sli.sli_flag & LPFC_MENLO_MAINT)
len += snprintf(buf + len, PAGE_SIZE-len, len += snprintf(buf + len, PAGE_SIZE-len,
" Menlo Maint Mode\n"); " Menlo Maint Mode\n");
else if (phba->fc_topology == TOPOLOGY_LOOP) { else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
if (vport->fc_flag & FC_PUBLIC_LOOP) if (vport->fc_flag & FC_PUBLIC_LOOP)
len += snprintf(buf + len, PAGE_SIZE-len, len += snprintf(buf + len, PAGE_SIZE-len,
" Public Loop\n"); " Public Loop\n");
...@@ -2837,14 +2833,8 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = { ...@@ -2837,14 +2833,8 @@ static struct bin_attribute sysfs_drvr_stat_data_attr = {
/* /*
# lpfc_link_speed: Link speed selection for initializing the Fibre Channel # lpfc_link_speed: Link speed selection for initializing the Fibre Channel
# connection. # connection.
# 0 = auto select (default) # Value range is [0,16]. Default value is 0.
# 1 = 1 Gigabaud
# 2 = 2 Gigabaud
# 4 = 4 Gigabaud
# 8 = 8 Gigabaud
# Value range is [0,8]. Default value is 0.
*/ */
/** /**
* lpfc_link_speed_set - Set the adapters link speed * lpfc_link_speed_set - Set the adapters link speed
* @phba: lpfc_hba pointer. * @phba: lpfc_hba pointer.
...@@ -2869,7 +2859,7 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, ...@@ -2869,7 +2859,7 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
struct Scsi_Host *shost = class_to_shost(dev); struct Scsi_Host *shost = class_to_shost(dev);
struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
struct lpfc_hba *phba = vport->phba; struct lpfc_hba *phba = vport->phba;
int val = 0; int val = LPFC_USER_LINK_SPEED_AUTO;
int nolip = 0; int nolip = 0;
const char *val_buf = buf; const char *val_buf = buf;
int err; int err;
...@@ -2885,15 +2875,20 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, ...@@ -2885,15 +2875,20 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
if (sscanf(val_buf, "%i", &val) != 1) if (sscanf(val_buf, "%i", &val) != 1)
return -EINVAL; return -EINVAL;
if (((val == LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) || if (((val == LPFC_USER_LINK_SPEED_1G) && !(phba->lmt & LMT_1Gb)) ||
((val == LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) || ((val == LPFC_USER_LINK_SPEED_2G) && !(phba->lmt & LMT_2Gb)) ||
((val == LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) || ((val == LPFC_USER_LINK_SPEED_4G) && !(phba->lmt & LMT_4Gb)) ||
((val == LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) || ((val == LPFC_USER_LINK_SPEED_8G) && !(phba->lmt & LMT_8Gb)) ||
((val == LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb))) ((val == LPFC_USER_LINK_SPEED_10G) && !(phba->lmt & LMT_10Gb)) ||
((val == LPFC_USER_LINK_SPEED_16G) && !(phba->lmt & LMT_16Gb))) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"2879 lpfc_link_speed attribute cannot be set "
"to %d. Speed is not supported by this port.\n",
val);
return -EINVAL; return -EINVAL;
}
if ((val >= 0 && val <= 8) if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
&& (LPFC_LINK_SPEED_BITMAP & (1 << val))) { (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) {
prev_val = phba->cfg_link_speed; prev_val = phba->cfg_link_speed;
phba->cfg_link_speed = val; phba->cfg_link_speed = val;
if (nolip) if (nolip)
...@@ -2906,11 +2901,9 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr, ...@@ -2906,11 +2901,9 @@ lpfc_link_speed_store(struct device *dev, struct device_attribute *attr,
} else } else
return strlen(buf); return strlen(buf);
} }
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"%d:0469 lpfc_link_speed attribute cannot be set to %d, " "0469 lpfc_link_speed attribute cannot be set to %d, "
"allowed range is [0, 8]\n", "allowed values are ["LPFC_LINK_SPEED_STRING"]\n", val);
phba->brd_no, val);
return -EINVAL; return -EINVAL;
} }
...@@ -2938,8 +2931,8 @@ lpfc_param_show(link_speed) ...@@ -2938,8 +2931,8 @@ lpfc_param_show(link_speed)
static int static int
lpfc_link_speed_init(struct lpfc_hba *phba, int val) lpfc_link_speed_init(struct lpfc_hba *phba, int val)
{ {
if ((val >= 0 && val <= LPFC_MAX_LINK_SPEED) if ((val >= 0) && (val <= LPFC_USER_LINK_SPEED_MAX) &&
&& (LPFC_LINK_SPEED_BITMAP & (1 << val))) { (LPFC_USER_LINK_SPEED_BITMAP & (1 << val))) {
phba->cfg_link_speed = val; phba->cfg_link_speed = val;
return 0; return 0;
} }
...@@ -2947,7 +2940,7 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val) ...@@ -2947,7 +2940,7 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val)
"0405 lpfc_link_speed attribute cannot " "0405 lpfc_link_speed attribute cannot "
"be set to %d, allowed values are " "be set to %d, allowed values are "
"["LPFC_LINK_SPEED_STRING"]\n", val); "["LPFC_LINK_SPEED_STRING"]\n", val);
phba->cfg_link_speed = 0; phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO;
return -EINVAL; return -EINVAL;
} }
...@@ -3798,8 +3791,7 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj, ...@@ -3798,8 +3791,7 @@ sysfs_mbox_read(struct file *filp, struct kobject *kobj,
} }
break; break;
case MBX_READ_SPARM64: case MBX_READ_SPARM64:
case MBX_READ_LA: case MBX_READ_TOPOLOGY:
case MBX_READ_LA64:
case MBX_REG_LOGIN: case MBX_REG_LOGIN:
case MBX_REG_LOGIN64: case MBX_REG_LOGIN64:
case MBX_CONFIG_PORT: case MBX_CONFIG_PORT:
...@@ -3989,7 +3981,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost) ...@@ -3989,7 +3981,7 @@ lpfc_get_host_port_type(struct Scsi_Host *shost)
if (vport->port_type == LPFC_NPIV_PORT) { if (vport->port_type == LPFC_NPIV_PORT) {
fc_host_port_type(shost) = FC_PORTTYPE_NPIV; fc_host_port_type(shost) = FC_PORTTYPE_NPIV;
} else if (lpfc_is_link_up(phba)) { } else if (lpfc_is_link_up(phba)) {
if (phba->fc_topology == TOPOLOGY_LOOP) { if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
if (vport->fc_flag & FC_PUBLIC_LOOP) if (vport->fc_flag & FC_PUBLIC_LOOP)
fc_host_port_type(shost) = FC_PORTTYPE_NLPORT; fc_host_port_type(shost) = FC_PORTTYPE_NLPORT;
else else
...@@ -4058,21 +4050,24 @@ lpfc_get_host_speed(struct Scsi_Host *shost) ...@@ -4058,21 +4050,24 @@ lpfc_get_host_speed(struct Scsi_Host *shost)
if (lpfc_is_link_up(phba)) { if (lpfc_is_link_up(phba)) {
switch(phba->fc_linkspeed) { switch(phba->fc_linkspeed) {
case LA_1GHZ_LINK: case LPFC_LINK_SPEED_1GHZ:
fc_host_speed(shost) = FC_PORTSPEED_1GBIT; fc_host_speed(shost) = FC_PORTSPEED_1GBIT;
break; break;
case LA_2GHZ_LINK: case LPFC_LINK_SPEED_2GHZ:
fc_host_speed(shost) = FC_PORTSPEED_2GBIT; fc_host_speed(shost) = FC_PORTSPEED_2GBIT;
break; break;
case LA_4GHZ_LINK: case LPFC_LINK_SPEED_4GHZ:
fc_host_speed(shost) = FC_PORTSPEED_4GBIT; fc_host_speed(shost) = FC_PORTSPEED_4GBIT;
break; break;
case LA_8GHZ_LINK: case LPFC_LINK_SPEED_8GHZ:
fc_host_speed(shost) = FC_PORTSPEED_8GBIT; fc_host_speed(shost) = FC_PORTSPEED_8GBIT;
break; break;
case LA_10GHZ_LINK: case LPFC_LINK_SPEED_10GHZ:
fc_host_speed(shost) = FC_PORTSPEED_10GBIT; fc_host_speed(shost) = FC_PORTSPEED_10GBIT;
break; break;
case LPFC_LINK_SPEED_16GHZ:
fc_host_speed(shost) = FC_PORTSPEED_16GBIT;
break;
default: default:
fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN; fc_host_speed(shost) = FC_PORTSPEED_UNKNOWN;
break; break;
...@@ -4097,7 +4092,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost) ...@@ -4097,7 +4092,7 @@ lpfc_get_host_fabric_name (struct Scsi_Host *shost)
spin_lock_irq(shost->host_lock); spin_lock_irq(shost->host_lock);
if ((vport->fc_flag & FC_FABRIC) || if ((vport->fc_flag & FC_FABRIC) ||
((phba->fc_topology == TOPOLOGY_LOOP) && ((phba->fc_topology == LPFC_TOPOLOGY_LOOP) &&
(vport->fc_flag & FC_PUBLIC_LOOP))) (vport->fc_flag & FC_PUBLIC_LOOP)))
node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn); node_name = wwn_to_u64(phba->fc_fabparam.nodeName.u.wwn);
else else
...@@ -4208,11 +4203,11 @@ lpfc_get_stats(struct Scsi_Host *shost) ...@@ -4208,11 +4203,11 @@ lpfc_get_stats(struct Scsi_Host *shost)
hs->invalid_crc_count -= lso->invalid_crc_count; hs->invalid_crc_count -= lso->invalid_crc_count;
hs->error_frames -= lso->error_frames; hs->error_frames -= lso->error_frames;
if (phba->hba_flag & HBA_FCOE_SUPPORT) { if (phba->hba_flag & HBA_FCOE_MODE) {
hs->lip_count = -1; hs->lip_count = -1;
hs->nos_count = (phba->link_events >> 1); hs->nos_count = (phba->link_events >> 1);
hs->nos_count -= lso->link_events; hs->nos_count -= lso->link_events;
} else if (phba->fc_topology == TOPOLOGY_LOOP) { } else if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
hs->lip_count = (phba->fc_eventTag >> 1); hs->lip_count = (phba->fc_eventTag >> 1);
hs->lip_count -= lso->link_events; hs->lip_count -= lso->link_events;
hs->nos_count = -1; hs->nos_count = -1;
...@@ -4303,7 +4298,7 @@ lpfc_reset_stats(struct Scsi_Host *shost) ...@@ -4303,7 +4298,7 @@ lpfc_reset_stats(struct Scsi_Host *shost)
lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord; lso->invalid_tx_word_count = pmb->un.varRdLnk.invalidXmitWord;
lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt; lso->invalid_crc_count = pmb->un.varRdLnk.crcCnt;
lso->error_frames = pmb->un.varRdLnk.crcCnt; lso->error_frames = pmb->un.varRdLnk.crcCnt;
if (phba->hba_flag & HBA_FCOE_SUPPORT) if (phba->hba_flag & HBA_FCOE_MODE)
lso->link_events = (phba->link_events >> 1); lso->link_events = (phba->link_events >> 1);
else else
lso->link_events = (phba->fc_eventTag >> 1); lso->link_events = (phba->fc_eventTag >> 1);
......
...@@ -2601,12 +2601,11 @@ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba, ...@@ -2601,12 +2601,11 @@ static int lpfc_bsg_check_cmd_access(struct lpfc_hba *phba,
phba->wait_4_mlo_maint_flg = 1; phba->wait_4_mlo_maint_flg = 1;
} else if (mb->un.varWords[0] == SETVAR_MLORST) { } else if (mb->un.varWords[0] == SETVAR_MLORST) {
phba->link_flag &= ~LS_LOOPBACK_MODE; phba->link_flag &= ~LS_LOOPBACK_MODE;
phba->fc_topology = TOPOLOGY_PT_PT; phba->fc_topology = LPFC_TOPOLOGY_PT_PT;
} }
break; break;
case MBX_READ_SPARM64: case MBX_READ_SPARM64:
case MBX_READ_LA: case MBX_READ_TOPOLOGY:
case MBX_READ_LA64:
case MBX_REG_LOGIN: case MBX_REG_LOGIN:
case MBX_REG_LOGIN64: case MBX_REG_LOGIN64:
case MBX_CONFIG_PORT: case MBX_CONFIG_PORT:
......
...@@ -31,7 +31,7 @@ void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *); ...@@ -31,7 +31,7 @@ void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_config_async(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t); void lpfc_config_async(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t);
void lpfc_heart_beat(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_heart_beat(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *, struct lpfc_dmabuf *); int lpfc_read_topology(struct lpfc_hba *, LPFC_MBOXQ_t *, struct lpfc_dmabuf *);
void lpfc_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_issue_clear_la(struct lpfc_hba *, struct lpfc_vport *); void lpfc_issue_clear_la(struct lpfc_hba *, struct lpfc_vport *);
void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
...@@ -64,7 +64,7 @@ void lpfc_cleanup_pending_mbox(struct lpfc_vport *); ...@@ -64,7 +64,7 @@ void lpfc_cleanup_pending_mbox(struct lpfc_vport *);
int lpfc_linkdown(struct lpfc_hba *); int lpfc_linkdown(struct lpfc_hba *);
void lpfc_linkdown_port(struct lpfc_vport *); void lpfc_linkdown_port(struct lpfc_vport *);
void lpfc_port_link_failure(struct lpfc_vport *); void lpfc_port_link_failure(struct lpfc_vport *);
void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_mbx_cmpl_read_topology(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_init_vpi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *); void lpfc_init_vpi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_cancel_all_vport_retry_delay_timer(struct lpfc_hba *); void lpfc_cancel_all_vport_retry_delay_timer(struct lpfc_hba *);
void lpfc_retry_pport_discovery(struct lpfc_hba *); void lpfc_retry_pport_discovery(struct lpfc_hba *);
...@@ -121,6 +121,7 @@ void lpfc_end_rscn(struct lpfc_vport *); ...@@ -121,6 +121,7 @@ void lpfc_end_rscn(struct lpfc_vport *);
int lpfc_els_chk_latt(struct lpfc_vport *); int lpfc_els_chk_latt(struct lpfc_vport *);
int lpfc_els_abort_flogi(struct lpfc_hba *); int lpfc_els_abort_flogi(struct lpfc_hba *);
int lpfc_initial_flogi(struct lpfc_vport *); int lpfc_initial_flogi(struct lpfc_vport *);
void lpfc_issue_init_vfi(struct lpfc_vport *);
int lpfc_initial_fdisc(struct lpfc_vport *); int lpfc_initial_fdisc(struct lpfc_vport *);
int lpfc_issue_els_plogi(struct lpfc_vport *, uint32_t, uint8_t); int lpfc_issue_els_plogi(struct lpfc_vport *, uint32_t, uint8_t);
int lpfc_issue_els_prli(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t); int lpfc_issue_els_prli(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t);
......
...@@ -48,14 +48,14 @@ ...@@ -48,14 +48,14 @@
#include "lpfc_vport.h" #include "lpfc_vport.h"
#include "lpfc_debugfs.h" #include "lpfc_debugfs.h"
#define HBA_PORTSPEED_UNKNOWN 0 /* Unknown - transceiver /* FDMI Port Speed definitions */
* incapable of reporting */ #define HBA_PORTSPEED_1GBIT 0x0001 /* 1 GBit/sec */
#define HBA_PORTSPEED_1GBIT 1 /* 1 GBit/sec */ #define HBA_PORTSPEED_2GBIT 0x0002 /* 2 GBit/sec */
#define HBA_PORTSPEED_2GBIT 2 /* 2 GBit/sec */ #define HBA_PORTSPEED_4GBIT 0x0008 /* 4 GBit/sec */
#define HBA_PORTSPEED_4GBIT 8 /* 4 GBit/sec */ #define HBA_PORTSPEED_10GBIT 0x0004 /* 10 GBit/sec */
#define HBA_PORTSPEED_8GBIT 16 /* 8 GBit/sec */ #define HBA_PORTSPEED_8GBIT 0x0010 /* 8 GBit/sec */
#define HBA_PORTSPEED_10GBIT 4 /* 10 GBit/sec */ #define HBA_PORTSPEED_16GBIT 0x0020 /* 16 GBit/sec */
#define HBA_PORTSPEED_NOT_NEGOTIATED 5 /* Speed not established */ #define HBA_PORTSPEED_UNKNOWN 0x0800 /* Unknown */
#define FOURBYTES 4 #define FOURBYTES 4
...@@ -1593,8 +1593,10 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) ...@@ -1593,8 +1593,10 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4);
ae->un.SupportSpeed = 0; ae->un.SupportSpeed = 0;
if (phba->lmt & LMT_16Gb)
ae->un.SupportSpeed |= HBA_PORTSPEED_16GBIT;
if (phba->lmt & LMT_10Gb) if (phba->lmt & LMT_10Gb)
ae->un.SupportSpeed = HBA_PORTSPEED_10GBIT; ae->un.SupportSpeed |= HBA_PORTSPEED_10GBIT;
if (phba->lmt & LMT_8Gb) if (phba->lmt & LMT_8Gb)
ae->un.SupportSpeed |= HBA_PORTSPEED_8GBIT; ae->un.SupportSpeed |= HBA_PORTSPEED_8GBIT;
if (phba->lmt & LMT_4Gb) if (phba->lmt & LMT_4Gb)
...@@ -1612,24 +1614,26 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode) ...@@ -1612,24 +1614,26 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
ae->ad.bits.AttrType = be16_to_cpu(PORT_SPEED); ae->ad.bits.AttrType = be16_to_cpu(PORT_SPEED);
ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4); ae->ad.bits.AttrLen = be16_to_cpu(FOURBYTES + 4);
switch(phba->fc_linkspeed) { switch(phba->fc_linkspeed) {
case LA_1GHZ_LINK: case LPFC_LINK_SPEED_1GHZ:
ae->un.PortSpeed = HBA_PORTSPEED_1GBIT; ae->un.PortSpeed = HBA_PORTSPEED_1GBIT;
break; break;
case LA_2GHZ_LINK: case LPFC_LINK_SPEED_2GHZ:
ae->un.PortSpeed = HBA_PORTSPEED_2GBIT; ae->un.PortSpeed = HBA_PORTSPEED_2GBIT;
break; break;
case LA_4GHZ_LINK: case LPFC_LINK_SPEED_4GHZ:
ae->un.PortSpeed = HBA_PORTSPEED_4GBIT; ae->un.PortSpeed = HBA_PORTSPEED_4GBIT;
break; break;
case LA_8GHZ_LINK: case LPFC_LINK_SPEED_8GHZ:
ae->un.PortSpeed = HBA_PORTSPEED_8GBIT; ae->un.PortSpeed = HBA_PORTSPEED_8GBIT;
break; break;
case LA_10GHZ_LINK: case LPFC_LINK_SPEED_10GHZ:
ae->un.PortSpeed = HBA_PORTSPEED_10GBIT; ae->un.PortSpeed = HBA_PORTSPEED_10GBIT;
break; break;
case LPFC_LINK_SPEED_16GHZ:
ae->un.PortSpeed = HBA_PORTSPEED_16GBIT;
break;
default: default:
ae->un.PortSpeed = ae->un.PortSpeed = HBA_PORTSPEED_UNKNOWN;
HBA_PORTSPEED_UNKNOWN;
break; break;
} }
pab->ab.EntryCnt++; pab->ab.EntryCnt++;
......
...@@ -523,7 +523,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ...@@ -523,7 +523,7 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
phba->fc_edtovResol = sp->cmn.edtovResolution; phba->fc_edtovResol = sp->cmn.edtovResolution;
phba->fc_ratov = (be32_to_cpu(sp->cmn.w2.r_a_tov) + 999) / 1000; phba->fc_ratov = (be32_to_cpu(sp->cmn.w2.r_a_tov) + 999) / 1000;
if (phba->fc_topology == TOPOLOGY_LOOP) { if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
spin_lock_irq(shost->host_lock); spin_lock_irq(shost->host_lock);
vport->fc_flag |= FC_PUBLIC_LOOP; vport->fc_flag |= FC_PUBLIC_LOOP;
spin_unlock_irq(shost->host_lock); spin_unlock_irq(shost->host_lock);
...@@ -832,6 +832,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -832,6 +832,12 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
if (lpfc_els_retry(phba, cmdiocb, rspiocb)) if (lpfc_els_retry(phba, cmdiocb, rspiocb))
goto out; goto out;
/* FLOGI failure */
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
"0100 FLOGI failure Status:x%x/x%x TMO:x%x\n",
irsp->ulpStatus, irsp->un.ulpWord[4],
irsp->ulpTimeout);
/* FLOGI failed, so there is no fabric */ /* FLOGI failed, so there is no fabric */
spin_lock_irq(shost->host_lock); spin_lock_irq(shost->host_lock);
vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP); 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,13 +849,16 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
*/ */
if (phba->alpa_map[0] == 0) { if (phba->alpa_map[0] == 0) {
vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS; vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS;
if ((phba->sli_rev == LPFC_SLI_REV4) &&
(!(vport->fc_flag & FC_VFI_REGISTERED) ||
(vport->fc_prevDID != vport->fc_myDID))) {
if (vport->fc_flag & FC_VFI_REGISTERED)
lpfc_sli4_unreg_all_rpis(vport);
lpfc_issue_reg_vfi(vport);
lpfc_nlp_put(ndlp);
goto out;
}
} }
/* FLOGI failure */
lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
"0100 FLOGI failure Status:x%x/x%x TMO:x%x\n",
irsp->ulpStatus, irsp->un.ulpWord[4],
irsp->ulpTimeout);
goto flogifail; goto flogifail;
} }
spin_lock_irq(shost->host_lock); spin_lock_irq(shost->host_lock);
...@@ -879,7 +888,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -879,7 +888,7 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
*/ */
if (sp->cmn.fPort) if (sp->cmn.fPort)
rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp); rc = lpfc_cmpl_els_flogi_fabric(vport, ndlp, sp, irsp);
else if (!(phba->hba_flag & HBA_FCOE_SUPPORT)) else if (!(phba->hba_flag & HBA_FCOE_MODE))
rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp); rc = lpfc_cmpl_els_flogi_nport(vport, ndlp, sp);
else { else {
lpfc_printf_vlog(vport, KERN_ERR, lpfc_printf_vlog(vport, KERN_ERR,
...@@ -1027,7 +1036,7 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, ...@@ -1027,7 +1036,7 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
icmd->ulpCt_l = 0; icmd->ulpCt_l = 0;
} }
if (phba->fc_topology != TOPOLOGY_LOOP) { if (phba->fc_topology != LPFC_TOPOLOGY_LOOP) {
icmd->un.elsreq64.myID = 0; icmd->un.elsreq64.myID = 0;
icmd->un.elsreq64.fl = 1; icmd->un.elsreq64.fl = 1;
} }
...@@ -2722,7 +2731,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -2722,7 +2731,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
if (cmd == ELS_CMD_FLOGI) { if (cmd == ELS_CMD_FLOGI) {
if (PCI_DEVICE_ID_HORNET == if (PCI_DEVICE_ID_HORNET ==
phba->pcidev->device) { phba->pcidev->device) {
phba->fc_topology = TOPOLOGY_LOOP; phba->fc_topology = LPFC_TOPOLOGY_LOOP;
phba->pport->fc_myDID = 0; phba->pport->fc_myDID = 0;
phba->alpa_map[0] = 0; phba->alpa_map[0] = 0;
phba->alpa_map[1] = 0; phba->alpa_map[1] = 0;
...@@ -2877,7 +2886,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -2877,7 +2886,7 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
retry = 1; retry = 1;
if (((cmd == ELS_CMD_FLOGI) || (cmd == ELS_CMD_FDISC)) && if (((cmd == ELS_CMD_FLOGI) || (cmd == ELS_CMD_FDISC)) &&
(phba->fc_topology != TOPOLOGY_LOOP) && (phba->fc_topology != LPFC_TOPOLOGY_LOOP) &&
!lpfc_error_lost_link(irsp)) { !lpfc_error_lost_link(irsp)) {
/* FLOGI retry policy */ /* FLOGI retry policy */
retry = 1; retry = 1;
...@@ -4597,7 +4606,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, ...@@ -4597,7 +4606,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
lpfc_set_disctmo(vport); lpfc_set_disctmo(vport);
if (phba->fc_topology == TOPOLOGY_LOOP) { if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
/* We should never receive a FLOGI in loop mode, ignore it */ /* We should never receive a FLOGI in loop mode, ignore it */
did = icmd->un.elsreq64.remoteID; did = icmd->un.elsreq64.remoteID;
...@@ -4940,7 +4949,7 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -4940,7 +4949,7 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
pcmd += sizeof(uint32_t); /* Skip past command */ pcmd += sizeof(uint32_t); /* Skip past command */
rps_rsp = (RPS_RSP *)pcmd; rps_rsp = (RPS_RSP *)pcmd;
if (phba->fc_topology != TOPOLOGY_LOOP) if (phba->fc_topology != LPFC_TOPOLOGY_LOOP)
status = 0x10; status = 0x10;
else else
status = 0x8; status = 0x8;
...@@ -5482,7 +5491,7 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb, ...@@ -5482,7 +5491,7 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
(memcmp(&phba->fc_fabparam.portName, &fp->FportName, (memcmp(&phba->fc_fabparam.portName, &fp->FportName,
sizeof(struct lpfc_name)))) { sizeof(struct lpfc_name)))) {
/* This port has switched fabrics. FLOGI is required */ /* This port has switched fabrics. FLOGI is required */
lpfc_initial_flogi(vport); lpfc_issue_init_vfi(vport);
} else { } else {
/* FAN verified - skip FLOGI */ /* FAN verified - skip FLOGI */
vport->fc_myDID = vport->fc_prevDID; vport->fc_myDID = vport->fc_prevDID;
...@@ -6373,7 +6382,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) ...@@ -6373,7 +6382,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
if (!ndlp) { if (!ndlp) {
ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL); ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
if (!ndlp) { if (!ndlp) {
if (phba->fc_topology == TOPOLOGY_LOOP) { if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
lpfc_disc_start(vport); lpfc_disc_start(vport);
return; return;
} }
...@@ -6386,7 +6395,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport) ...@@ -6386,7 +6395,7 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
} else if (!NLP_CHK_NODE_ACT(ndlp)) { } else if (!NLP_CHK_NODE_ACT(ndlp)) {
ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE); ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_UNUSED_NODE);
if (!ndlp) { if (!ndlp) {
if (phba->fc_topology == TOPOLOGY_LOOP) { if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
lpfc_disc_start(vport); lpfc_disc_start(vport);
return; return;
} }
...@@ -6510,7 +6519,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) ...@@ -6510,7 +6519,7 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
spin_unlock_irq(shost->host_lock); spin_unlock_irq(shost->host_lock);
if (vport->port_type == LPFC_PHYSICAL_PORT if (vport->port_type == LPFC_PHYSICAL_PORT
&& !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG)) && !(vport->fc_flag & FC_LOGO_RCVD_DID_CHNG))
lpfc_initial_flogi(vport); lpfc_issue_init_vfi(vport);
else else
lpfc_initial_fdisc(vport); lpfc_initial_fdisc(vport);
break; break;
...@@ -6747,7 +6756,7 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, ...@@ -6747,7 +6756,7 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
vport->fc_flag &= ~FC_VPORT_CVL_RCVD; vport->fc_flag &= ~FC_VPORT_CVL_RCVD;
vport->fc_flag &= ~FC_VPORT_LOGO_RCVD; vport->fc_flag &= ~FC_VPORT_LOGO_RCVD;
vport->fc_flag |= FC_FABRIC; vport->fc_flag |= FC_FABRIC;
if (vport->phba->fc_topology == TOPOLOGY_LOOP) if (vport->phba->fc_topology == LPFC_TOPOLOGY_LOOP)
vport->fc_flag |= FC_PUBLIC_LOOP; vport->fc_flag |= FC_PUBLIC_LOOP;
spin_unlock_irq(shost->host_lock); spin_unlock_irq(shost->host_lock);
......
This diff is collapsed.
...@@ -1370,7 +1370,6 @@ typedef struct { /* FireFly BIU registers */ ...@@ -1370,7 +1370,6 @@ typedef struct { /* FireFly BIU registers */
#define MBX_READ_LNK_STAT 0x12 #define MBX_READ_LNK_STAT 0x12
#define MBX_REG_LOGIN 0x13 #define MBX_REG_LOGIN 0x13
#define MBX_UNREG_LOGIN 0x14 #define MBX_UNREG_LOGIN 0x14
#define MBX_READ_LA 0x15
#define MBX_CLEAR_LA 0x16 #define MBX_CLEAR_LA 0x16
#define MBX_DUMP_MEMORY 0x17 #define MBX_DUMP_MEMORY 0x17
#define MBX_DUMP_CONTEXT 0x18 #define MBX_DUMP_CONTEXT 0x18
...@@ -1404,7 +1403,7 @@ typedef struct { /* FireFly BIU registers */ ...@@ -1404,7 +1403,7 @@ typedef struct { /* FireFly BIU registers */
#define MBX_READ_SPARM64 0x8D #define MBX_READ_SPARM64 0x8D
#define MBX_READ_RPI64 0x8F #define MBX_READ_RPI64 0x8F
#define MBX_REG_LOGIN64 0x93 #define MBX_REG_LOGIN64 0x93
#define MBX_READ_LA64 0x95 #define MBX_READ_TOPOLOGY 0x95
#define MBX_REG_VPI 0x96 #define MBX_REG_VPI 0x96
#define MBX_UNREG_VPI 0x97 #define MBX_UNREG_VPI 0x97
...@@ -1825,12 +1824,13 @@ typedef struct { ...@@ -1825,12 +1824,13 @@ typedef struct {
#define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */ #define FLAGS_IMED_ABORT 0x04000 /* Bit 14 */
uint32_t link_speed; uint32_t link_speed;
#define LINK_SPEED_AUTO 0 /* Auto selection */ #define LINK_SPEED_AUTO 0x0 /* Auto selection */
#define LINK_SPEED_1G 1 /* 1 Gigabaud */ #define LINK_SPEED_1G 0x1 /* 1 Gigabaud */
#define LINK_SPEED_2G 2 /* 2 Gigabaud */ #define LINK_SPEED_2G 0x2 /* 2 Gigabaud */
#define LINK_SPEED_4G 4 /* 4 Gigabaud */ #define LINK_SPEED_4G 0x4 /* 4 Gigabaud */
#define LINK_SPEED_8G 8 /* 8 Gigabaud */ #define LINK_SPEED_8G 0x8 /* 8 Gigabaud */
#define LINK_SPEED_10G 16 /* 10 Gigabaud */ #define LINK_SPEED_10G 0x10 /* 10 Gigabaud */
#define LINK_SPEED_16G 0x11 /* 16 Gigabaud */
} INIT_LINK_VAR; } INIT_LINK_VAR;
...@@ -2001,6 +2001,7 @@ typedef struct { ...@@ -2001,6 +2001,7 @@ typedef struct {
#define LMT_4Gb 0x040 #define LMT_4Gb 0x040
#define LMT_8Gb 0x080 #define LMT_8Gb 0x080
#define LMT_10Gb 0x100 #define LMT_10Gb 0x100
#define LMT_16Gb 0x200
uint32_t rsvd2; uint32_t rsvd2;
uint32_t rsvd3; uint32_t rsvd3;
uint32_t max_xri; uint32_t max_xri;
...@@ -2396,100 +2397,93 @@ typedef struct { ...@@ -2396,100 +2397,93 @@ typedef struct {
#endif #endif
} UNREG_D_ID_VAR; } UNREG_D_ID_VAR;
/* Structure for MB Command READ_LA (21) */ /* Structure for MB Command READ_TOPOLOGY (0x95) */
/* Structure for MB Command READ_LA64 (0x95) */ struct lpfc_mbx_read_top {
typedef struct {
uint32_t eventTag; /* Event tag */ uint32_t eventTag; /* Event tag */
#ifdef __BIG_ENDIAN_BITFIELD uint32_t word2;
uint32_t rsvd1:19; #define lpfc_mbx_read_top_fa_SHIFT 12
uint32_t fa:1; #define lpfc_mbx_read_top_fa_MASK 0x00000001
uint32_t mm:1; /* Menlo Maintenance mode enabled */ #define lpfc_mbx_read_top_fa_WORD word2
uint32_t rx:1; #define lpfc_mbx_read_top_mm_SHIFT 11
uint32_t pb:1; #define lpfc_mbx_read_top_mm_MASK 0x00000001
uint32_t il:1; #define lpfc_mbx_read_top_mm_WORD word2
uint32_t attType:8; #define lpfc_mbx_read_top_pb_SHIFT 9
#else /* __LITTLE_ENDIAN_BITFIELD */ #define lpfc_mbx_read_top_pb_MASK 0X00000001
uint32_t attType:8; #define lpfc_mbx_read_top_pb_WORD word2
uint32_t il:1; #define lpfc_mbx_read_top_il_SHIFT 8
uint32_t pb:1; #define lpfc_mbx_read_top_il_MASK 0x00000001
uint32_t rx:1; #define lpfc_mbx_read_top_il_WORD word2
uint32_t mm:1; #define lpfc_mbx_read_top_att_type_SHIFT 0
uint32_t fa:1; #define lpfc_mbx_read_top_att_type_MASK 0x000000FF
uint32_t rsvd1:19; #define lpfc_mbx_read_top_att_type_WORD word2
#endif #define LPFC_ATT_RESERVED 0x00 /* Reserved - attType */
#define LPFC_ATT_LINK_UP 0x01 /* Link is up */
#define AT_RESERVED 0x00 /* Reserved - attType */ #define LPFC_ATT_LINK_DOWN 0x02 /* Link is down */
#define AT_LINK_UP 0x01 /* Link is up */ uint32_t word3;
#define AT_LINK_DOWN 0x02 /* Link is down */ #define lpfc_mbx_read_top_alpa_granted_SHIFT 24
#define lpfc_mbx_read_top_alpa_granted_MASK 0x000000FF
#ifdef __BIG_ENDIAN_BITFIELD #define lpfc_mbx_read_top_alpa_granted_WORD word3
uint8_t granted_AL_PA; #define lpfc_mbx_read_top_lip_alps_SHIFT 16
uint8_t lipAlPs; #define lpfc_mbx_read_top_lip_alps_MASK 0x000000FF
uint8_t lipType; #define lpfc_mbx_read_top_lip_alps_WORD word3
uint8_t topology; #define lpfc_mbx_read_top_lip_type_SHIFT 8
#else /* __LITTLE_ENDIAN_BITFIELD */ #define lpfc_mbx_read_top_lip_type_MASK 0x000000FF
uint8_t topology; #define lpfc_mbx_read_top_lip_type_WORD word3
uint8_t lipType; #define lpfc_mbx_read_top_topology_SHIFT 0
uint8_t lipAlPs; #define lpfc_mbx_read_top_topology_MASK 0x000000FF
uint8_t granted_AL_PA; #define lpfc_mbx_read_top_topology_WORD word3
#endif #define LPFC_TOPOLOGY_PT_PT 0x01 /* Topology is pt-pt / pt-fabric */
#define LPFC_TOPOLOGY_LOOP 0x02 /* Topology is FC-AL */
#define TOPOLOGY_PT_PT 0x01 /* Topology is pt-pt / pt-fabric */ #define LPFC_TOPOLOGY_MM 0x05 /* maint mode zephtr to menlo */
#define TOPOLOGY_LOOP 0x02 /* Topology is FC-AL */
#define TOPOLOGY_LNK_MENLO_MAINTENANCE 0x05 /* maint mode zephtr to menlo */
union {
struct ulp_bde lilpBde; /* This BDE points to a 128 byte buffer
to */
/* store the LILP AL_PA position map into */ /* store the LILP AL_PA position map into */
struct ulp_bde64 lilpBde64; struct ulp_bde64 lilpBde64;
} un; #define LPFC_ALPA_MAP_SIZE 128
uint32_t word7;
#ifdef __BIG_ENDIAN_BITFIELD #define lpfc_mbx_read_top_ld_lu_SHIFT 31
uint32_t Dlu:1; #define lpfc_mbx_read_top_ld_lu_MASK 0x00000001
uint32_t Dtf:1; #define lpfc_mbx_read_top_ld_lu_WORD word7
uint32_t Drsvd2:14; #define lpfc_mbx_read_top_ld_tf_SHIFT 30
uint32_t DlnkSpeed:8; #define lpfc_mbx_read_top_ld_tf_MASK 0x00000001
uint32_t DnlPort:4; #define lpfc_mbx_read_top_ld_tf_WORD word7
uint32_t Dtx:2; #define lpfc_mbx_read_top_ld_link_spd_SHIFT 8
uint32_t Drx:2; #define lpfc_mbx_read_top_ld_link_spd_MASK 0x000000FF
#else /* __LITTLE_ENDIAN_BITFIELD */ #define lpfc_mbx_read_top_ld_link_spd_WORD word7
uint32_t Drx:2; #define lpfc_mbx_read_top_ld_nl_port_SHIFT 4
uint32_t Dtx:2; #define lpfc_mbx_read_top_ld_nl_port_MASK 0x0000000F
uint32_t DnlPort:4; #define lpfc_mbx_read_top_ld_nl_port_WORD word7
uint32_t DlnkSpeed:8; #define lpfc_mbx_read_top_ld_tx_SHIFT 2
uint32_t Drsvd2:14; #define lpfc_mbx_read_top_ld_tx_MASK 0x00000003
uint32_t Dtf:1; #define lpfc_mbx_read_top_ld_tx_WORD word7
uint32_t Dlu:1; #define lpfc_mbx_read_top_ld_rx_SHIFT 0
#endif #define lpfc_mbx_read_top_ld_rx_MASK 0x00000003
#define lpfc_mbx_read_top_ld_rx_WORD word7
#ifdef __BIG_ENDIAN_BITFIELD uint32_t word8;
uint32_t Ulu:1; #define lpfc_mbx_read_top_lu_SHIFT 31
uint32_t Utf:1; #define lpfc_mbx_read_top_lu_MASK 0x00000001
uint32_t Ursvd2:14; #define lpfc_mbx_read_top_lu_WORD word8
uint32_t UlnkSpeed:8; #define lpfc_mbx_read_top_tf_SHIFT 30
uint32_t UnlPort:4; #define lpfc_mbx_read_top_tf_MASK 0x00000001
uint32_t Utx:2; #define lpfc_mbx_read_top_tf_WORD word8
uint32_t Urx:2; #define lpfc_mbx_read_top_link_spd_SHIFT 8
#else /* __LITTLE_ENDIAN_BITFIELD */ #define lpfc_mbx_read_top_link_spd_MASK 0x000000FF
uint32_t Urx:2; #define lpfc_mbx_read_top_link_spd_WORD word8
uint32_t Utx:2; #define lpfc_mbx_read_top_nl_port_SHIFT 4
uint32_t UnlPort:4; #define lpfc_mbx_read_top_nl_port_MASK 0x0000000F
uint32_t UlnkSpeed:8; #define lpfc_mbx_read_top_nl_port_WORD word8
uint32_t Ursvd2:14; #define lpfc_mbx_read_top_tx_SHIFT 2
uint32_t Utf:1; #define lpfc_mbx_read_top_tx_MASK 0x00000003
uint32_t Ulu:1; #define lpfc_mbx_read_top_tx_WORD word8
#endif #define lpfc_mbx_read_top_rx_SHIFT 0
#define lpfc_mbx_read_top_rx_MASK 0x00000003
#define LA_UNKNW_LINK 0x0 /* lnkSpeed */ #define lpfc_mbx_read_top_rx_WORD word8
#define LA_1GHZ_LINK 0x04 /* lnkSpeed */ #define LPFC_LINK_SPEED_UNKNOWN 0x0
#define LA_2GHZ_LINK 0x08 /* lnkSpeed */ #define LPFC_LINK_SPEED_1GHZ 0x04
#define LA_4GHZ_LINK 0x10 /* lnkSpeed */ #define LPFC_LINK_SPEED_2GHZ 0x08
#define LA_8GHZ_LINK 0x20 /* lnkSpeed */ #define LPFC_LINK_SPEED_4GHZ 0x10
#define LA_10GHZ_LINK 0x40 /* lnkSpeed */ #define LPFC_LINK_SPEED_8GHZ 0x20
#define LPFC_LINK_SPEED_10GHZ 0x40
} READ_LA_VAR; #define LPFC_LINK_SPEED_16GHZ 0x80
};
/* Structure for MB Command CLEAR_LA (22) */ /* Structure for MB Command CLEAR_LA (22) */
...@@ -3018,7 +3012,6 @@ typedef union { ...@@ -3018,7 +3012,6 @@ typedef union {
READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */ READ_LNK_VAR varRdLnk; /* cmd = 18 (READ_LNK_STAT) */
REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */ REG_LOGIN_VAR varRegLogin; /* cmd = 19 (REG_LOGIN(64)) */
UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */ UNREG_LOGIN_VAR varUnregLogin; /* cmd = 20 (UNREG_LOGIN) */
READ_LA_VAR varReadLA; /* cmd = 21 (READ_LA(64)) */
CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */ CLEAR_LA_VAR varClearLA; /* cmd = 22 (CLEAR_LA) */
DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */ DUMP_VAR varDmp; /* Warm Start DUMP mbx cmd */
UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */ UNREG_D_ID_VAR varUnregDID; /* cmd = 0x23 (UNREG_D_ID) */
...@@ -3028,6 +3021,7 @@ typedef union { ...@@ -3028,6 +3021,7 @@ typedef union {
struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ) */ struct config_hbq_var varCfgHbq;/* cmd = 0x7c (CONFIG_HBQ) */
struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/ struct update_cfg_var varUpdateCfg; /* cmd = 0x1B (UPDATE_CFG)*/
CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */ CONFIG_PORT_VAR varCfgPort; /* cmd = 0x88 (CONFIG_PORT) */
struct lpfc_mbx_read_top varReadTop; /* cmd = 0x95 (READ_TOPOLOGY) */
REG_VPI_VAR varRegVpi; /* cmd = 0x96 (REG_VPI) */ REG_VPI_VAR varRegVpi; /* cmd = 0x96 (REG_VPI) */
UNREG_VPI_VAR varUnregVpi; /* cmd = 0x97 (UNREG_VPI) */ UNREG_VPI_VAR varUnregVpi; /* cmd = 0x97 (UNREG_VPI) */
ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */ ASYNCEVT_ENABLE_VAR varCfgAsyncEvent; /*cmd = x33 (CONFIG_ASYNC) */
......
...@@ -1444,10 +1444,16 @@ struct lpfc_mbx_init_vfi { ...@@ -1444,10 +1444,16 @@ struct lpfc_mbx_init_vfi {
#define lpfc_init_vfi_vf_SHIFT 29 #define lpfc_init_vfi_vf_SHIFT 29
#define lpfc_init_vfi_vf_MASK 0x00000001 #define lpfc_init_vfi_vf_MASK 0x00000001
#define lpfc_init_vfi_vf_WORD word1 #define lpfc_init_vfi_vf_WORD word1
#define lpfc_init_vfi_vp_SHIFT 28
#define lpfc_init_vfi_vp_MASK 0x00000001
#define lpfc_init_vfi_vp_WORD word1
#define lpfc_init_vfi_vfi_SHIFT 0 #define lpfc_init_vfi_vfi_SHIFT 0
#define lpfc_init_vfi_vfi_MASK 0x0000FFFF #define lpfc_init_vfi_vfi_MASK 0x0000FFFF
#define lpfc_init_vfi_vfi_WORD word1 #define lpfc_init_vfi_vfi_WORD word1
uint32_t word2; uint32_t word2;
#define lpfc_init_vfi_vpi_SHIFT 16
#define lpfc_init_vfi_vpi_MASK 0x0000FFFF
#define lpfc_init_vfi_vpi_WORD word2
#define lpfc_init_vfi_fcfi_SHIFT 0 #define lpfc_init_vfi_fcfi_SHIFT 0
#define lpfc_init_vfi_fcfi_MASK 0x0000FFFF #define lpfc_init_vfi_fcfi_MASK 0x0000FFFF
#define lpfc_init_vfi_fcfi_WORD word2 #define lpfc_init_vfi_fcfi_WORD word2
...@@ -2155,6 +2161,7 @@ struct lpfc_mcqe { ...@@ -2155,6 +2161,7 @@ struct lpfc_mcqe {
#define LPFC_TRAILER_CODE_FCOE 0x2 #define LPFC_TRAILER_CODE_FCOE 0x2
#define LPFC_TRAILER_CODE_DCBX 0x3 #define LPFC_TRAILER_CODE_DCBX 0x3
#define LPFC_TRAILER_CODE_GRP5 0x5 #define LPFC_TRAILER_CODE_GRP5 0x5
#define LPFC_TRAILER_CODE_FC 0x10
}; };
struct lpfc_acqe_link { struct lpfc_acqe_link {
......
...@@ -446,23 +446,25 @@ lpfc_config_port_post(struct lpfc_hba *phba) ...@@ -446,23 +446,25 @@ lpfc_config_port_post(struct lpfc_hba *phba)
/* Get the default values for Model Name and Description */ /* Get the default values for Model Name and Description */
lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc);
if ((phba->cfg_link_speed > LINK_SPEED_10G) if ((phba->cfg_link_speed > LPFC_USER_LINK_SPEED_16G)
|| ((phba->cfg_link_speed == LINK_SPEED_1G) || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_1G)
&& !(phba->lmt & LMT_1Gb)) && !(phba->lmt & LMT_1Gb))
|| ((phba->cfg_link_speed == LINK_SPEED_2G) || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_2G)
&& !(phba->lmt & LMT_2Gb)) && !(phba->lmt & LMT_2Gb))
|| ((phba->cfg_link_speed == LINK_SPEED_4G) || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_4G)
&& !(phba->lmt & LMT_4Gb)) && !(phba->lmt & LMT_4Gb))
|| ((phba->cfg_link_speed == LINK_SPEED_8G) || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_8G)
&& !(phba->lmt & LMT_8Gb)) && !(phba->lmt & LMT_8Gb))
|| ((phba->cfg_link_speed == LINK_SPEED_10G) || ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_10G)
&& !(phba->lmt & LMT_10Gb))) { && !(phba->lmt & LMT_10Gb))
|| ((phba->cfg_link_speed == LPFC_USER_LINK_SPEED_16G)
&& !(phba->lmt & LMT_16Gb))) {
/* Reset link speed to auto */ /* Reset link speed to auto */
lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT, lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT,
"1302 Invalid speed for this board: " "1302 Invalid speed for this board: "
"Reset link speed to auto: x%x\n", "Reset link speed to auto: x%x\n",
phba->cfg_link_speed); phba->cfg_link_speed);
phba->cfg_link_speed = LINK_SPEED_AUTO; phba->cfg_link_speed = LPFC_USER_LINK_SPEED_AUTO;
} }
phba->link_state = LPFC_LINK_DOWN; phba->link_state = LPFC_LINK_DOWN;
...@@ -648,22 +650,23 @@ lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag) ...@@ -648,22 +650,23 @@ lpfc_hba_init_link(struct lpfc_hba *phba, uint32_t flag)
mb = &pmb->u.mb; mb = &pmb->u.mb;
pmb->vport = vport; pmb->vport = vport;
lpfc_init_link(phba, pmb, phba->cfg_topology, lpfc_init_link(phba, pmb, phba->cfg_topology, phba->cfg_link_speed);
phba->cfg_link_speed);
pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl; pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
lpfc_set_loopback_flag(phba); lpfc_set_loopback_flag(phba);
rc = lpfc_sli_issue_mbox(phba, pmb, flag); rc = lpfc_sli_issue_mbox(phba, pmb, flag);
if (rc != MBX_SUCCESS) { if ((rc != MBX_BUSY) && (rc != MBX_SUCCESS)) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0498 Adapter failed to init, mbxCmd x%x " "0498 Adapter failed to init, mbxCmd x%x "
"INIT_LINK, mbxStatus x%x\n", "INIT_LINK, mbxStatus x%x\n",
mb->mbxCommand, mb->mbxStatus); mb->mbxCommand, mb->mbxStatus);
if (phba->sli_rev <= LPFC_SLI_REV3) {
/* Clear all interrupt enable conditions */ /* Clear all interrupt enable conditions */
writel(0, phba->HCregaddr); writel(0, phba->HCregaddr);
readl(phba->HCregaddr); /* flush */ readl(phba->HCregaddr); /* flush */
/* Clear all pending interrupts */ /* Clear all pending interrupts */
writel(0xffffffff, phba->HAregaddr); writel(0xffffffff, phba->HAregaddr);
readl(phba->HAregaddr); /* flush */ readl(phba->HAregaddr); /* flush */
}
phba->link_state = LPFC_HBA_ERROR; phba->link_state = LPFC_HBA_ERROR;
if (rc != MBX_BUSY || flag == MBX_POLL) if (rc != MBX_BUSY || flag == MBX_POLL)
mempool_free(pmb, phba->mbox_mem_pool); mempool_free(pmb, phba->mbox_mem_pool);
...@@ -1459,8 +1462,8 @@ lpfc_handle_latt(struct lpfc_hba *phba) ...@@ -1459,8 +1462,8 @@ lpfc_handle_latt(struct lpfc_hba *phba)
lpfc_els_flush_all_cmd(phba); lpfc_els_flush_all_cmd(phba);
psli->slistat.link_event++; psli->slistat.link_event++;
lpfc_read_la(phba, pmb, mp); lpfc_read_topology(phba, pmb, mp);
pmb->mbox_cmpl = lpfc_mbx_cmpl_read_la; pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology;
pmb->vport = vport; pmb->vport = vport;
/* Block ELS IOCBs until we have processed this mbox command */ /* Block ELS IOCBs until we have processed this mbox command */
phba->sli.ring[LPFC_ELS_RING].flag |= LPFC_STOP_IOCB_EVENT; 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,20 +3062,20 @@ lpfc_sli4_parse_latt_type(struct lpfc_hba *phba,
switch (bf_get(lpfc_acqe_link_status, acqe_link)) { switch (bf_get(lpfc_acqe_link_status, acqe_link)) {
case LPFC_ASYNC_LINK_STATUS_DOWN: case LPFC_ASYNC_LINK_STATUS_DOWN:
case LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN: case LPFC_ASYNC_LINK_STATUS_LOGICAL_DOWN:
att_type = AT_LINK_DOWN; att_type = LPFC_ATT_LINK_DOWN;
break; break;
case LPFC_ASYNC_LINK_STATUS_UP: case LPFC_ASYNC_LINK_STATUS_UP:
/* Ignore physical link up events - wait for logical link up */ /* Ignore physical link up events - wait for logical link up */
att_type = AT_RESERVED; att_type = LPFC_ATT_RESERVED;
break; break;
case LPFC_ASYNC_LINK_STATUS_LOGICAL_UP: case LPFC_ASYNC_LINK_STATUS_LOGICAL_UP:
att_type = AT_LINK_UP; att_type = LPFC_ATT_LINK_UP;
break; break;
default: default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0399 Invalid link attention type: x%x\n", "0399 Invalid link attention type: x%x\n",
bf_get(lpfc_acqe_link_status, acqe_link)); bf_get(lpfc_acqe_link_status, acqe_link));
att_type = AT_RESERVED; att_type = LPFC_ATT_RESERVED;
break; break;
} }
return att_type; return att_type;
...@@ -3096,32 +3099,28 @@ lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba, ...@@ -3096,32 +3099,28 @@ lpfc_sli4_parse_latt_link_speed(struct lpfc_hba *phba,
switch (bf_get(lpfc_acqe_link_speed, acqe_link)) { switch (bf_get(lpfc_acqe_link_speed, acqe_link)) {
case LPFC_ASYNC_LINK_SPEED_ZERO: case LPFC_ASYNC_LINK_SPEED_ZERO:
link_speed = LA_UNKNW_LINK;
break;
case LPFC_ASYNC_LINK_SPEED_10MBPS: case LPFC_ASYNC_LINK_SPEED_10MBPS:
link_speed = LA_UNKNW_LINK;
break;
case LPFC_ASYNC_LINK_SPEED_100MBPS: case LPFC_ASYNC_LINK_SPEED_100MBPS:
link_speed = LA_UNKNW_LINK; link_speed = LPFC_LINK_SPEED_UNKNOWN;
break; break;
case LPFC_ASYNC_LINK_SPEED_1GBPS: case LPFC_ASYNC_LINK_SPEED_1GBPS:
link_speed = LA_1GHZ_LINK; link_speed = LPFC_LINK_SPEED_1GHZ;
break; break;
case LPFC_ASYNC_LINK_SPEED_10GBPS: case LPFC_ASYNC_LINK_SPEED_10GBPS:
link_speed = LA_10GHZ_LINK; link_speed = LPFC_LINK_SPEED_10GHZ;
break; break;
default: default:
lpfc_printf_log(phba, KERN_ERR, LOG_INIT, lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
"0483 Invalid link-attention link speed: x%x\n", "0483 Invalid link-attention link speed: x%x\n",
bf_get(lpfc_acqe_link_speed, acqe_link)); bf_get(lpfc_acqe_link_speed, acqe_link));
link_speed = LA_UNKNW_LINK; link_speed = LPFC_LINK_SPEED_UNKNOWN;
break; break;
} }
return link_speed; return link_speed;
} }
/** /**
* lpfc_sli4_async_link_evt - Process the asynchronous link event * lpfc_sli4_async_link_evt - Process the asynchronous FC or FCoE link event
* @phba: pointer to lpfc hba data structure. * @phba: pointer to lpfc hba data structure.
* @acqe_link: pointer to the async link completion queue entry. * @acqe_link: pointer to the async link completion queue entry.
* *
...@@ -3134,11 +3133,12 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, ...@@ -3134,11 +3133,12 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
struct lpfc_dmabuf *mp; struct lpfc_dmabuf *mp;
LPFC_MBOXQ_t *pmb; LPFC_MBOXQ_t *pmb;
MAILBOX_t *mb; MAILBOX_t *mb;
READ_LA_VAR *la; struct lpfc_mbx_read_top *la;
uint8_t att_type; uint8_t att_type;
int rc;
att_type = lpfc_sli4_parse_latt_type(phba, acqe_link); att_type = lpfc_sli4_parse_latt_type(phba, acqe_link);
if (att_type != AT_LINK_DOWN && att_type != AT_LINK_UP) if (att_type != LPFC_ATT_LINK_DOWN && att_type != LPFC_ATT_LINK_UP)
return; return;
phba->fcoe_eventtag = acqe_link->event_tag; phba->fcoe_eventtag = acqe_link->event_tag;
pmb = (LPFC_MBOXQ_t *)mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); 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,28 +3169,11 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
/* Update link event statistics */ /* Update link event statistics */
phba->sli.slistat.link_event++; phba->sli.slistat.link_event++;
/* Create pseudo lpfc_handle_latt mailbox command from link ACQE */ /* Create lpfc_handle_latt mailbox command from link ACQE */
lpfc_read_la(phba, pmb, mp); lpfc_read_topology(phba, pmb, mp);
pmb->mbox_cmpl = lpfc_mbx_cmpl_read_topology;
pmb->vport = phba->pport; pmb->vport = phba->pport;
/* Parse and translate status field */
mb = &pmb->u.mb;
mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba, acqe_link);
/* Parse and translate link attention fields */
la = (READ_LA_VAR *) &pmb->u.mb.un.varReadLA;
la->eventTag = acqe_link->event_tag;
la->attType = att_type;
la->UlnkSpeed = lpfc_sli4_parse_latt_link_speed(phba, acqe_link);
/* Fake the the following irrelvant fields */
la->topology = TOPOLOGY_PT_PT;
la->granted_AL_PA = 0;
la->il = 0;
la->pb = 0;
la->fa = 0;
la->mm = 0;
/* Keep the link status for extra SLI4 state machine reference */ /* Keep the link status for extra SLI4 state machine reference */
phba->sli4_hba.link_state.speed = phba->sli4_hba.link_state.speed =
bf_get(lpfc_acqe_link_speed, acqe_link); bf_get(lpfc_acqe_link_speed, acqe_link);
...@@ -3204,9 +3187,42 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba, ...@@ -3204,9 +3187,42 @@ lpfc_sli4_async_link_evt(struct lpfc_hba *phba,
bf_get(lpfc_acqe_link_fault, acqe_link); bf_get(lpfc_acqe_link_fault, acqe_link);
phba->sli4_hba.link_state.logical_speed = phba->sli4_hba.link_state.logical_speed =
bf_get(lpfc_acqe_qos_link_speed, acqe_link); bf_get(lpfc_acqe_qos_link_speed, acqe_link);
/*
* For FC Mode: issue the READ_TOPOLOGY mailbox command to fetch
* topology info. Note: Optional for non FC-AL ports.
*/
if (!(phba->hba_flag & HBA_FCOE_MODE)) {
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
if (rc == MBX_NOT_FINISHED)
goto out_free_dmabuf;
return;
}
/*
* For FCoE Mode: fill in all the topology information we need and call
* the READ_TOPOLOGY completion routine to continue without actually
* sending the READ_TOPOLOGY mailbox command to the port.
*/
/* Parse and translate status field */
mb = &pmb->u.mb;
mb->mbxStatus = lpfc_sli4_parse_latt_fault(phba, acqe_link);
/* Parse and translate link attention fields */
la = (struct lpfc_mbx_read_top *) &pmb->u.mb.un.varReadTop;
la->eventTag = acqe_link->event_tag;
bf_set(lpfc_mbx_read_top_att_type, la, att_type);
bf_set(lpfc_mbx_read_top_link_spd, la,
lpfc_sli4_parse_latt_link_speed(phba, acqe_link));
/* Fake the the following irrelvant fields */
bf_set(lpfc_mbx_read_top_topology, la, LPFC_TOPOLOGY_PT_PT);
bf_set(lpfc_mbx_read_top_alpa_granted, la, 0);
bf_set(lpfc_mbx_read_top_il, la, 0);
bf_set(lpfc_mbx_read_top_pb, la, 0);
bf_set(lpfc_mbx_read_top_fa, la, 0);
bf_set(lpfc_mbx_read_top_mm, la, 0);
/* Invoke the lpfc_handle_latt mailbox command callback function */ /* Invoke the lpfc_handle_latt mailbox command callback function */
lpfc_mbx_cmpl_read_la(phba, pmb); lpfc_mbx_cmpl_read_topology(phba, pmb);
return; return;
...@@ -3295,14 +3311,14 @@ lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba) ...@@ -3295,14 +3311,14 @@ lpfc_sli4_perform_all_vport_cvl(struct lpfc_hba *phba)
} }
/** /**
* lpfc_sli4_async_fcoe_evt - Process the asynchronous fcoe event * lpfc_sli4_async_fip_evt - Process the asynchronous FCoE FIP event
* @phba: pointer to lpfc hba data structure. * @phba: pointer to lpfc hba data structure.
* @acqe_link: pointer to the async fcoe completion queue entry. * @acqe_link: pointer to the async fcoe completion queue entry.
* *
* This routine is to handle the SLI4 asynchronous fcoe event. * This routine is to handle the SLI4 asynchronous fcoe event.
**/ **/
static void static void
lpfc_sli4_async_fcoe_evt(struct lpfc_hba *phba, lpfc_sli4_async_fip_evt(struct lpfc_hba *phba,
struct lpfc_acqe_fcoe *acqe_fcoe) struct lpfc_acqe_fcoe *acqe_fcoe)
{ {
uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe); uint8_t event_type = bf_get(lpfc_acqe_fcoe_event_type, acqe_fcoe);
...@@ -3605,11 +3621,12 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba) ...@@ -3605,11 +3621,12 @@ void lpfc_sli4_async_event_proc(struct lpfc_hba *phba)
/* Process the asynchronous event */ /* Process the asynchronous event */
switch (bf_get(lpfc_trailer_code, &cq_event->cqe.mcqe_cmpl)) { switch (bf_get(lpfc_trailer_code, &cq_event->cqe.mcqe_cmpl)) {
case LPFC_TRAILER_CODE_LINK: case LPFC_TRAILER_CODE_LINK:
case LPFC_TRAILER_CODE_FC:
lpfc_sli4_async_link_evt(phba, lpfc_sli4_async_link_evt(phba,
&cq_event->cqe.acqe_link); &cq_event->cqe.acqe_link);
break; break;
case LPFC_TRAILER_CODE_FCOE: case LPFC_TRAILER_CODE_FCOE:
lpfc_sli4_async_fcoe_evt(phba, lpfc_sli4_async_fip_evt(phba,
&cq_event->cqe.acqe_fcoe); &cq_event->cqe.acqe_fcoe);
break; break;
case LPFC_TRAILER_CODE_DCBX: case LPFC_TRAILER_CODE_DCBX:
......
...@@ -263,18 +263,19 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb) ...@@ -263,18 +263,19 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
} }
/** /**
* lpfc_read_la - Prepare a mailbox command for reading HBA link attention * lpfc_read_topology - Prepare a mailbox command for reading HBA topology
* @phba: pointer to lpfc hba data structure. * @phba: pointer to lpfc hba data structure.
* @pmb: pointer to the driver internal queue element for mailbox command. * @pmb: pointer to the driver internal queue element for mailbox command.
* @mp: DMA buffer memory for reading the link attention information into. * @mp: DMA buffer memory for reading the link attention information into.
* *
* The read link attention mailbox command is issued to read the Link Event * The read topology mailbox command is issued to read the link topology
* Attention information indicated by the HBA port when the Link Event bit * information indicated by the HBA port when the Link Event bit of the Host
* of the Host Attention (HSTATT) register is set to 1. A Link Event * Attention (HSTATT) register is set to 1 (For SLI-3) or when an FC Link
* Attention ACQE is received from the port (For SLI-4). A Link Event
* Attention occurs based on an exception detected at the Fibre Channel link * Attention occurs based on an exception detected at the Fibre Channel link
* interface. * interface.
* *
* This routine prepares the mailbox command for reading HBA link attention * This routine prepares the mailbox command for reading HBA link topology
* information. A DMA memory has been set aside and address passed to the * information. A DMA memory has been set aside and address passed to the
* HBA through @mp for the HBA to DMA link attention information into the * HBA through @mp for the HBA to DMA link attention information into the
* memory as part of the execution of the mailbox command. * 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,7 +284,8 @@ lpfc_heart_beat(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
* 0 - Success (currently always return 0) * 0 - Success (currently always return 0)
**/ **/
int int
lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp) lpfc_read_topology(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb,
struct lpfc_dmabuf *mp)
{ {
MAILBOX_t *mb; MAILBOX_t *mb;
struct lpfc_sli *psli; struct lpfc_sli *psli;
...@@ -293,15 +295,15 @@ lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp) ...@@ -293,15 +295,15 @@ lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb, struct lpfc_dmabuf *mp)
memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
INIT_LIST_HEAD(&mp->list); INIT_LIST_HEAD(&mp->list);
mb->mbxCommand = MBX_READ_LA64; mb->mbxCommand = MBX_READ_TOPOLOGY;
mb->un.varReadLA.un.lilpBde64.tus.f.bdeSize = 128; mb->un.varReadTop.lilpBde64.tus.f.bdeSize = LPFC_ALPA_MAP_SIZE;
mb->un.varReadLA.un.lilpBde64.addrHigh = putPaddrHigh(mp->phys); mb->un.varReadTop.lilpBde64.addrHigh = putPaddrHigh(mp->phys);
mb->un.varReadLA.un.lilpBde64.addrLow = putPaddrLow(mp->phys); mb->un.varReadTop.lilpBde64.addrLow = putPaddrLow(mp->phys);
/* Save address for later completion and set the owner to host so that /* Save address for later completion and set the owner to host so that
* the FW knows this mailbox is available for processing. * the FW knows this mailbox is available for processing.
*/ */
pmb->context1 = (uint8_t *) mp; pmb->context1 = (uint8_t *)mp;
mb->mbxOwner = OWN_HOST; mb->mbxOwner = OWN_HOST;
return (0); return (0);
} }
...@@ -516,18 +518,33 @@ lpfc_init_link(struct lpfc_hba * phba, ...@@ -516,18 +518,33 @@ lpfc_init_link(struct lpfc_hba * phba,
vpd = &phba->vpd; vpd = &phba->vpd;
if (vpd->rev.feaLevelHigh >= 0x02){ if (vpd->rev.feaLevelHigh >= 0x02){
switch(linkspeed){ switch(linkspeed){
case LINK_SPEED_1G: case LPFC_USER_LINK_SPEED_1G:
case LINK_SPEED_2G: mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
case LINK_SPEED_4G: mb->un.varInitLnk.link_speed = LINK_SPEED_1G;
case LINK_SPEED_8G: break;
mb->un.varInitLnk.link_flags |= case LPFC_USER_LINK_SPEED_2G:
FLAGS_LINK_SPEED; mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
mb->un.varInitLnk.link_speed = linkspeed; mb->un.varInitLnk.link_speed = LINK_SPEED_2G;
break;
case LPFC_USER_LINK_SPEED_4G:
mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
mb->un.varInitLnk.link_speed = LINK_SPEED_4G;
break;
case LPFC_USER_LINK_SPEED_8G:
mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
mb->un.varInitLnk.link_speed = LINK_SPEED_8G;
break; break;
case LINK_SPEED_AUTO: case LPFC_USER_LINK_SPEED_10G:
mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
mb->un.varInitLnk.link_speed = LINK_SPEED_10G;
break;
case LPFC_USER_LINK_SPEED_16G:
mb->un.varInitLnk.link_flags |= FLAGS_LINK_SPEED;
mb->un.varInitLnk.link_speed = LINK_SPEED_16G;
break;
case LPFC_USER_LINK_SPEED_AUTO:
default: default:
mb->un.varInitLnk.link_speed = mb->un.varInitLnk.link_speed = LINK_SPEED_AUTO;
LINK_SPEED_AUTO;
break; break;
} }
...@@ -1918,11 +1935,14 @@ lpfc_init_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport) ...@@ -1918,11 +1935,14 @@ lpfc_init_vfi(struct lpfcMboxq *mbox, struct lpfc_vport *vport)
struct lpfc_mbx_init_vfi *init_vfi; struct lpfc_mbx_init_vfi *init_vfi;
memset(mbox, 0, sizeof(*mbox)); memset(mbox, 0, sizeof(*mbox));
mbox->vport = vport;
init_vfi = &mbox->u.mqe.un.init_vfi; init_vfi = &mbox->u.mqe.un.init_vfi;
bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VFI); bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_INIT_VFI);
bf_set(lpfc_init_vfi_vr, init_vfi, 1); bf_set(lpfc_init_vfi_vr, init_vfi, 1);
bf_set(lpfc_init_vfi_vt, init_vfi, 1); bf_set(lpfc_init_vfi_vt, init_vfi, 1);
bf_set(lpfc_init_vfi_vp, init_vfi, 1);
bf_set(lpfc_init_vfi_vfi, init_vfi, vport->vfi + vport->phba->vfi_base); bf_set(lpfc_init_vfi_vfi, init_vfi, vport->vfi + vport->phba->vfi_base);
bf_set(lpfc_init_vpi_vpi, init_vfi, vport->vpi + vport->phba->vpi_base);
bf_set(lpfc_init_vfi_fcfi, init_vfi, vport->phba->fcf.fcfi); bf_set(lpfc_init_vfi_fcfi, init_vfi, vport->phba->fcf.fcfi);
} }
......
...@@ -1634,7 +1634,6 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand) ...@@ -1634,7 +1634,6 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
case MBX_READ_LNK_STAT: case MBX_READ_LNK_STAT:
case MBX_REG_LOGIN: case MBX_REG_LOGIN:
case MBX_UNREG_LOGIN: case MBX_UNREG_LOGIN:
case MBX_READ_LA:
case MBX_CLEAR_LA: case MBX_CLEAR_LA:
case MBX_DUMP_MEMORY: case MBX_DUMP_MEMORY:
case MBX_DUMP_CONTEXT: case MBX_DUMP_CONTEXT:
...@@ -1656,7 +1655,7 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand) ...@@ -1656,7 +1655,7 @@ lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
case MBX_READ_SPARM64: case MBX_READ_SPARM64:
case MBX_READ_RPI64: case MBX_READ_RPI64:
case MBX_REG_LOGIN64: case MBX_REG_LOGIN64:
case MBX_READ_LA64: case MBX_READ_TOPOLOGY:
case MBX_WRITE_WWN: case MBX_WRITE_WWN:
case MBX_SET_DEBUG: case MBX_SET_DEBUG:
case MBX_LOAD_EXP_ROM: case MBX_LOAD_EXP_ROM:
...@@ -4357,13 +4356,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4357,13 +4356,16 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
} }
rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size); rc = lpfc_sli4_read_rev(phba, mboxq, vpd, &vpd_size);
if (unlikely(rc)) if (unlikely(rc)) {
goto out_free_vpd; kfree(vpd);
goto out_free_mbox;
}
mqe = &mboxq->u.mqe; mqe = &mboxq->u.mqe;
phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev); phba->sli_rev = bf_get(lpfc_mbx_rd_rev_sli_lvl, &mqe->un.read_rev);
if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev)) if (bf_get(lpfc_mbx_rd_rev_fcoe, &mqe->un.read_rev))
phba->hba_flag |= HBA_FCOE_SUPPORT; phba->hba_flag |= HBA_FCOE_MODE;
else
phba->hba_flag &= ~HBA_FCOE_MODE;
if (bf_get(lpfc_mbx_rd_rev_cee_ver, &mqe->un.read_rev) == if (bf_get(lpfc_mbx_rd_rev_cee_ver, &mqe->un.read_rev) ==
LPFC_DCBX_CEE_MODE) LPFC_DCBX_CEE_MODE)
...@@ -4372,13 +4374,14 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4372,13 +4374,14 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
phba->hba_flag &= ~HBA_FIP_SUPPORT; phba->hba_flag &= ~HBA_FIP_SUPPORT;
if (phba->sli_rev != LPFC_SLI_REV4 || if (phba->sli_rev != LPFC_SLI_REV4 ||
!(phba->hba_flag & HBA_FCOE_SUPPORT)) { !(phba->hba_flag & HBA_FCOE_MODE)) {
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI, lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
"0376 READ_REV Error. SLI Level %d " "0376 READ_REV Error. SLI Level %d "
"FCoE enabled %d\n", "FCoE enabled %d\n",
phba->sli_rev, phba->hba_flag & HBA_FCOE_SUPPORT); phba->sli_rev, phba->hba_flag & HBA_FCOE_MODE);
rc = -EIO; rc = -EIO;
goto out_free_vpd; kfree(vpd);
goto out_free_mbox;
} }
/* /*
* Evaluate the read rev and vpd data. Populate the driver * Evaluate the read rev and vpd data. Populate the driver
...@@ -4392,6 +4395,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4392,6 +4395,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
"Using defaults.\n", rc); "Using defaults.\n", rc);
rc = 0; rc = 0;
} }
kfree(vpd);
/* Save information as VPD data */ /* Save information as VPD data */
phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev; phba->vpd.rev.biuRev = mqe->un.read_rev.first_hw_rev;
...@@ -4428,7 +4432,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4428,7 +4432,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL); rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
if (unlikely(rc)) { if (unlikely(rc)) {
rc = -EIO; rc = -EIO;
goto out_free_vpd; goto out_free_mbox;
} }
/* /*
...@@ -4476,7 +4480,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4476,7 +4480,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
if (rc) { if (rc) {
phba->link_state = LPFC_HBA_ERROR; phba->link_state = LPFC_HBA_ERROR;
rc = -ENOMEM; rc = -ENOMEM;
goto out_free_vpd; goto out_free_mbox;
} }
mboxq->vport = vport; mboxq->vport = vport;
...@@ -4501,7 +4505,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4501,7 +4505,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
rc, bf_get(lpfc_mqe_status, mqe)); rc, bf_get(lpfc_mqe_status, mqe));
phba->link_state = LPFC_HBA_ERROR; phba->link_state = LPFC_HBA_ERROR;
rc = -EIO; rc = -EIO;
goto out_free_vpd; goto out_free_mbox;
} }
if (phba->cfg_soft_wwnn) if (phba->cfg_soft_wwnn)
...@@ -4526,7 +4530,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4526,7 +4530,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
"0582 Error %d during sgl post operation\n", "0582 Error %d during sgl post operation\n",
rc); rc);
rc = -ENODEV; rc = -ENODEV;
goto out_free_vpd; goto out_free_mbox;
} }
/* Register SCSI SGL pool to the device */ /* Register SCSI SGL pool to the device */
...@@ -4538,7 +4542,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4538,7 +4542,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
/* Some Scsi buffers were moved to the abort scsi list */ /* Some Scsi buffers were moved to the abort scsi list */
/* A pci function reset will repost them */ /* A pci function reset will repost them */
rc = -ENODEV; rc = -ENODEV;
goto out_free_vpd; goto out_free_mbox;
} }
/* Post the rpi header region to the device. */ /* Post the rpi header region to the device. */
...@@ -4548,7 +4552,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4548,7 +4552,7 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
"0393 Error %d during rpi post operation\n", "0393 Error %d during rpi post operation\n",
rc); rc);
rc = -ENODEV; rc = -ENODEV;
goto out_free_vpd; goto out_free_mbox;
} }
/* Set up all the queues to the device */ /* Set up all the queues to the device */
...@@ -4608,33 +4612,33 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba) ...@@ -4608,33 +4612,33 @@ lpfc_sli4_hba_setup(struct lpfc_hba *phba)
} }
} }
if (!(phba->hba_flag & HBA_FCOE_MODE)) {
/*
* The FC Port needs to register FCFI (index 0)
*/
lpfc_reg_fcfi(phba, mboxq);
mboxq->vport = phba->pport;
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_POLL);
if (rc == MBX_SUCCESS)
rc = 0;
else
goto out_unset_queue;
}
/* /*
* The port is ready, set the host's link state to LINK_DOWN * The port is ready, set the host's link state to LINK_DOWN
* in preparation for link interrupts. * in preparation for link interrupts.
*/ */
lpfc_init_link(phba, mboxq, phba->cfg_topology, phba->cfg_link_speed);
mboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
lpfc_set_loopback_flag(phba);
/* Change driver state to LPFC_LINK_DOWN right before init link */
spin_lock_irq(&phba->hbalock); spin_lock_irq(&phba->hbalock);
phba->link_state = LPFC_LINK_DOWN; phba->link_state = LPFC_LINK_DOWN;
spin_unlock_irq(&phba->hbalock); spin_unlock_irq(&phba->hbalock);
rc = lpfc_sli_issue_mbox(phba, mboxq, MBX_NOWAIT); rc = phba->lpfc_hba_init_link(phba, MBX_NOWAIT);
if (unlikely(rc != MBX_NOT_FINISHED)) { out_unset_queue:
kfree(vpd);
return 0;
} else
rc = -EIO;
/* Unset all the queues set up in this routine when error out */ /* Unset all the queues set up in this routine when error out */
if (rc) if (rc)
lpfc_sli4_queue_unset(phba); lpfc_sli4_queue_unset(phba);
out_stop_timers: out_stop_timers:
if (rc) if (rc)
lpfc_stop_hba_timers(phba); lpfc_stop_hba_timers(phba);
out_free_vpd:
kfree(vpd);
out_free_mbox: out_free_mbox:
mempool_free(mboxq, phba->mbox_mem_pool); mempool_free(mboxq, phba->mbox_mem_pool);
return rc; return rc;
...@@ -12157,42 +12161,37 @@ lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp) ...@@ -12157,42 +12161,37 @@ lpfc_sli4_resume_rpi(struct lpfc_nodelist *ndlp)
/** /**
* lpfc_sli4_init_vpi - Initialize a vpi with the port * lpfc_sli4_init_vpi - Initialize a vpi with the port
* @phba: pointer to lpfc hba data structure. * @vport: Pointer to the vport for which the vpi is being initialized
* @vpi: vpi value to activate with the port.
* *
* This routine is invoked to activate a vpi with the * This routine is invoked to activate a vpi with the port.
* port when the host intends to use vports with a
* nonzero vpi.
* *
* Returns: * Returns:
* 0 success * 0 success
* -Evalue otherwise * -Evalue otherwise
**/ **/
int int
lpfc_sli4_init_vpi(struct lpfc_hba *phba, uint16_t vpi) lpfc_sli4_init_vpi(struct lpfc_vport *vport)
{ {
LPFC_MBOXQ_t *mboxq; LPFC_MBOXQ_t *mboxq;
int rc = 0; int rc = 0;
int retval = MBX_SUCCESS; int retval = MBX_SUCCESS;
uint32_t mbox_tmo; uint32_t mbox_tmo;
struct lpfc_hba *phba = vport->phba;
if (vpi == 0)
return -EINVAL;
mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); mboxq = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
if (!mboxq) if (!mboxq)
return -ENOMEM; return -ENOMEM;
lpfc_init_vpi(phba, mboxq, vpi); lpfc_init_vpi(phba, mboxq, vport->vpi);
mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI); mbox_tmo = lpfc_mbox_tmo_val(phba, MBX_INIT_VPI);
rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo); rc = lpfc_sli_issue_mbox_wait(phba, mboxq, mbox_tmo);
if (rc != MBX_SUCCESS) { if (rc != MBX_SUCCESS) {
lpfc_printf_log(phba, KERN_ERR, LOG_SLI, lpfc_printf_vlog(vport, KERN_ERR, LOG_SLI,
"2022 INIT VPI Mailbox failed " "2022 INIT VPI Mailbox failed "
"status %d, mbxStatus x%x\n", rc, "status %d, mbxStatus x%x\n", rc,
bf_get(lpfc_mqe_status, &mboxq->u.mqe)); bf_get(lpfc_mqe_status, &mboxq->u.mqe));
retval = -EIO; retval = -EIO;
} }
if (rc != MBX_TIMEOUT) if (rc != MBX_TIMEOUT)
mempool_free(mboxq, phba->mbox_mem_pool); mempool_free(mboxq, vport->phba->mbox_mem_pool);
return retval; return retval;
} }
......
...@@ -548,7 +548,7 @@ int lpfc_sli4_brdreset(struct lpfc_hba *); ...@@ -548,7 +548,7 @@ int lpfc_sli4_brdreset(struct lpfc_hba *);
int lpfc_sli4_add_fcf_record(struct lpfc_hba *, struct fcf_record *); int lpfc_sli4_add_fcf_record(struct lpfc_hba *, struct fcf_record *);
void lpfc_sli_remove_dflt_fcf(struct lpfc_hba *); void lpfc_sli_remove_dflt_fcf(struct lpfc_hba *);
int lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *); int lpfc_sli4_get_els_iocb_cnt(struct lpfc_hba *);
int lpfc_sli4_init_vpi(struct lpfc_hba *, uint16_t); int lpfc_sli4_init_vpi(struct lpfc_vport *);
uint32_t lpfc_sli4_cq_release(struct lpfc_queue *, bool); uint32_t lpfc_sli4_cq_release(struct lpfc_queue *, bool);
uint32_t lpfc_sli4_eq_release(struct lpfc_queue *, bool); uint32_t lpfc_sli4_eq_release(struct lpfc_queue *, bool);
void lpfc_sli4_fcfi_unreg(struct lpfc_hba *, uint16_t); void lpfc_sli4_fcfi_unreg(struct lpfc_hba *, uint16_t);
......
...@@ -396,7 +396,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) ...@@ -396,7 +396,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
*/ */
if ((phba->sli_rev == LPFC_SLI_REV4) && if ((phba->sli_rev == LPFC_SLI_REV4) &&
(pport->fc_flag & FC_VFI_REGISTERED)) { (pport->fc_flag & FC_VFI_REGISTERED)) {
rc = lpfc_sli4_init_vpi(phba, vpi); rc = lpfc_sli4_init_vpi(vport);
if (rc) { if (rc) {
lpfc_printf_log(phba, KERN_ERR, LOG_VPORT, lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
"1838 Failed to INIT_VPI on vpi %d " "1838 Failed to INIT_VPI on vpi %d "
...@@ -418,7 +418,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable) ...@@ -418,7 +418,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
if ((phba->link_state < LPFC_LINK_UP) || if ((phba->link_state < LPFC_LINK_UP) ||
(pport->port_state < LPFC_FABRIC_CFG_LINK) || (pport->port_state < LPFC_FABRIC_CFG_LINK) ||
(phba->fc_topology == TOPOLOGY_LOOP)) { (phba->fc_topology == LPFC_TOPOLOGY_LOOP)) {
lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN);
rc = VPORT_OK; rc = VPORT_OK;
goto out; goto out;
...@@ -514,7 +514,7 @@ enable_vport(struct fc_vport *fc_vport) ...@@ -514,7 +514,7 @@ enable_vport(struct fc_vport *fc_vport)
struct Scsi_Host *shost = lpfc_shost_from_vport(vport); struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
if ((phba->link_state < LPFC_LINK_UP) || if ((phba->link_state < LPFC_LINK_UP) ||
(phba->fc_topology == TOPOLOGY_LOOP)) { (phba->fc_topology == LPFC_TOPOLOGY_LOOP)) {
lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN); lpfc_vport_set_state(vport, FC_VPORT_LINKDOWN);
return VPORT_OK; return VPORT_OK;
} }
...@@ -665,7 +665,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport) ...@@ -665,7 +665,7 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
if (ndlp && NLP_CHK_NODE_ACT(ndlp) && if (ndlp && NLP_CHK_NODE_ACT(ndlp) &&
ndlp->nlp_state == NLP_STE_UNMAPPED_NODE && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE &&
phba->link_state >= LPFC_LINK_UP && phba->link_state >= LPFC_LINK_UP &&
phba->fc_topology != TOPOLOGY_LOOP) { phba->fc_topology != LPFC_TOPOLOGY_LOOP) {
if (vport->cfg_enable_da_id) { if (vport->cfg_enable_da_id) {
timeout = msecs_to_jiffies(phba->fc_ratov * 2000); timeout = msecs_to_jiffies(phba->fc_ratov * 2000);
if (!lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0)) if (!lpfc_ns_cmd(vport, SLI_CTNS_DA_ID, 0, 0))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment