Commit 4258e98e authored by James Smart's avatar James Smart Committed by Martin K. Petersen

lpfc: Modularize and cleanup FDMI code in driver

Modularize, cleanup, add comments - for FDMI code in driver

Note: I don't like the comments with leading # - but as we have a lot if
present, I'm deferring to handle it in one big fix later.
Signed-off-by: default avatarDick Kennedy <dick.kennedy@avagotech.com>
Signed-off-by: default avatarJames Smart <james.smart@avagotech.com>
Reviewed-by: default avatarHannes Reinicke <hare@suse.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent c90261dc
......@@ -386,7 +386,6 @@ struct lpfc_vport {
uint32_t work_port_events; /* Timeout to be handled */
#define WORKER_DISC_TMO 0x1 /* vport: Discovery timeout */
#define WORKER_ELS_TMO 0x2 /* vport: ELS timeout */
#define WORKER_FDMI_TMO 0x4 /* vport: FDMI timeout */
#define WORKER_DELAYED_DISC_TMO 0x8 /* vport: delayed discovery */
#define WORKER_MBOX_TMO 0x100 /* hba: MBOX timeout */
......@@ -396,7 +395,6 @@ struct lpfc_vport {
#define WORKER_RAMP_UP_QUEUE 0x1000 /* hba: Increase Q depth */
#define WORKER_SERVICE_TXQ 0x2000 /* hba: IOCBs on the txq */
struct timer_list fc_fdmitmo;
struct timer_list els_tmofunc;
struct timer_list delayed_disc_tmo;
......@@ -405,6 +403,7 @@ struct lpfc_vport {
uint8_t load_flag;
#define FC_LOADING 0x1 /* HBA in process of loading drvr */
#define FC_UNLOADING 0x2 /* HBA in process of unloading drvr */
#define FC_ALLOW_FDMI 0x4 /* port is ready for FDMI requests */
/* Vport Config Parameters */
uint32_t cfg_scan_down;
uint32_t cfg_lun_queue_depth;
......@@ -414,10 +413,6 @@ struct lpfc_vport {
uint32_t cfg_peer_port_login;
uint32_t cfg_fcp_class;
uint32_t cfg_use_adisc;
uint32_t cfg_fdmi_on;
#define LPFC_FDMI_SUPPORT 1 /* bit 0 - FDMI supported? */
#define LPFC_FDMI_REG_DELAY 2 /* bit 1 - 60 sec registration delay */
#define LPFC_FDMI_ALL_ATTRIB 4 /* bit 2 - register ALL attributes? */
uint32_t cfg_discovery_threads;
uint32_t cfg_log_verbose;
uint32_t cfg_max_luns;
......@@ -443,6 +438,10 @@ struct lpfc_vport {
unsigned long rcv_buffer_time_stamp;
uint32_t vport_flag;
#define STATIC_VPORT 1
uint16_t fdmi_num_disc;
uint32_t fdmi_hba_mask;
uint32_t fdmi_port_mask;
};
struct hbq_s {
......@@ -755,6 +754,11 @@ struct lpfc_hba {
#define LPFC_DELAY_INIT_LINK 1 /* layered driver hold off */
#define LPFC_DELAY_INIT_LINK_INDEFINITELY 2 /* wait, manual intervention */
uint32_t cfg_enable_dss;
uint32_t cfg_fdmi_on;
#define LPFC_FDMI_NO_SUPPORT 0 /* FDMI not supported */
#define LPFC_FDMI_SUPPORT 1 /* FDMI supported? */
#define LPFC_FDMI_SMART_SAN 2 /* SmartSAN supported */
uint32_t cfg_enable_SmartSAN;
lpfc_vpd_t vpd; /* vital product data */
struct pci_dev *pcidev;
......
......@@ -4572,19 +4572,27 @@ LPFC_ATTR_R(multi_ring_type, FC_TYPE_IP, 1,
255, "Identifies TYPE for additional ring configuration");
/*
# lpfc_fdmi_on: controls FDMI support.
# Set NOT Set
# bit 0 = FDMI support no FDMI support
# LPFC_FDMI_SUPPORT just turns basic support on/off
# bit 1 = Register delay no register delay (60 seconds)
# LPFC_FDMI_REG_DELAY 60 sec registration delay after FDMI login
# bit 2 = All attributes Use a attribute subset
# LPFC_FDMI_ALL_ATTRIB applies to both port and HBA attributes
# Port attrutes subset: 1 thru 6 OR all: 1 thru 0xd 0x101 0x102 0x103
# HBA attributes subset: 1 thru 0xb OR all: 1 thru 0xc
# Value range [0,7]. Default value is 0.
# lpfc_enable_SmartSAN: Sets up FDMI support for SmartSAN
# 0 = SmartSAN functionality disabled (default)
# 1 = SmartSAN functionality enabled
# This parameter will override the value of lpfc_fdmi_on module parameter.
# Value range is [0,1]. Default value is 0.
*/
LPFC_VPORT_ATTR_RW(fdmi_on, 0, 0, 7, "Enable FDMI support");
LPFC_ATTR_R(enable_SmartSAN, 0, 0, 1, "Enable SmartSAN functionality");
/*
# lpfc_fdmi_on: Controls FDMI support.
# 0 No FDMI support (default)
# 1 Traditional FDMI support
# 2 Smart SAN support
# If lpfc_enable_SmartSAN is set 1, the driver sets lpfc_fdmi_on to value 2
# overwriting the current value. If lpfc_enable_SmartSAN is set 0, the
# driver uses the current value of lpfc_fdmi_on provided it has value 0 or 1.
# A value of 2 with lpfc_enable_SmartSAN set to 0 causes the driver to
# set lpfc_fdmi_on back to 1.
# Value range [0,2]. Default value is 0.
*/
LPFC_ATTR_R(fdmi_on, 0, 0, 2, "Enable FDMI support");
/*
# Specifies the maximum number of ELS cmds we can have outstanding (for
......@@ -4815,6 +4823,7 @@ struct device_attribute *lpfc_hba_attrs[] = {
&dev_attr_lpfc_multi_ring_rctl,
&dev_attr_lpfc_multi_ring_type,
&dev_attr_lpfc_fdmi_on,
&dev_attr_lpfc_enable_SmartSAN,
&dev_attr_lpfc_max_luns,
&dev_attr_lpfc_enable_npiv,
&dev_attr_lpfc_fcf_failover_policy,
......@@ -4887,7 +4896,6 @@ struct device_attribute *lpfc_vport_attrs[] = {
&dev_attr_lpfc_fcp_class,
&dev_attr_lpfc_use_adisc,
&dev_attr_lpfc_first_burst_size,
&dev_attr_lpfc_fdmi_on,
&dev_attr_lpfc_max_luns,
&dev_attr_nport_evt_cnt,
&dev_attr_npiv_info,
......@@ -5826,6 +5834,8 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
lpfc_enable_npiv_init(phba, lpfc_enable_npiv);
lpfc_fcf_failover_policy_init(phba, lpfc_fcf_failover_policy);
lpfc_enable_rrq_init(phba, lpfc_enable_rrq);
lpfc_fdmi_on_init(phba, lpfc_fdmi_on);
lpfc_enable_SmartSAN_init(phba, lpfc_enable_SmartSAN);
lpfc_use_msi_init(phba, lpfc_use_msi);
lpfc_fcp_imax_init(phba, lpfc_fcp_imax);
lpfc_fcp_cpu_map_init(phba, lpfc_fcp_cpu_map);
......@@ -5846,6 +5856,15 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
phba->cfg_poll = 0;
else
phba->cfg_poll = lpfc_poll;
/* Ensure fdmi_on and enable_SmartSAN don't conflict */
if (phba->cfg_enable_SmartSAN) {
phba->cfg_fdmi_on = LPFC_FDMI_SMART_SAN;
} else {
if (phba->cfg_fdmi_on == LPFC_FDMI_SMART_SAN)
phba->cfg_fdmi_on = LPFC_FDMI_SUPPORT;
}
phba->cfg_soft_wwnn = 0L;
phba->cfg_soft_wwpn = 0L;
lpfc_sg_seg_cnt_init(phba, lpfc_sg_seg_cnt);
......@@ -5879,7 +5898,6 @@ lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
lpfc_use_adisc_init(vport, lpfc_use_adisc);
lpfc_first_burst_size_init(vport, lpfc_first_burst_size);
lpfc_max_scsicmpl_time_init(vport, lpfc_max_scsicmpl_time);
lpfc_fdmi_on_init(vport, lpfc_fdmi_on);
lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
lpfc_max_luns_init(vport, lpfc_max_luns);
lpfc_scan_down_init(vport, lpfc_scan_down);
......
......@@ -168,9 +168,8 @@ void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
struct lpfc_iocbq *);
int lpfc_ct_handle_unsol_abort(struct lpfc_hba *, struct hbq_dmabuf *);
int lpfc_ns_cmd(struct lpfc_vport *, int, uint8_t, uint32_t);
int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int);
void lpfc_fdmi_tmo(unsigned long);
void lpfc_fdmi_timeout_handler(struct lpfc_vport *);
int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int, uint32_t);
void lpfc_fdmi_num_disc_check(struct lpfc_vport *);
void lpfc_delayed_disc_tmo(unsigned long);
void lpfc_delayed_disc_timeout_handler(struct lpfc_vport *);
......
This diff is collapsed.
......@@ -688,6 +688,21 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
sp->cmn.bbRcvSizeLsb;
fabric_param_changed = lpfc_check_clean_addr_bit(vport, sp);
if (fabric_param_changed) {
/* Reset FDMI attribute masks based on config parameter */
if (phba->cfg_fdmi_on == LPFC_FDMI_NO_SUPPORT) {
vport->fdmi_hba_mask = 0;
vport->fdmi_port_mask = 0;
} else {
/* Setup appropriate attribute masks */
vport->fdmi_hba_mask = LPFC_FDMI2_HBA_ATTR;
if (phba->cfg_fdmi_on == LPFC_FDMI_SMART_SAN)
vport->fdmi_port_mask = LPFC_FDMI2_SMART_ATTR;
else
vport->fdmi_port_mask = LPFC_FDMI2_PORT_ATTR;
}
}
memcpy(&vport->fabric_portname, &sp->portName,
sizeof(struct lpfc_name));
memcpy(&vport->fabric_nodename, &sp->nodeName,
......@@ -4690,6 +4705,23 @@ lpfc_rdp_res_link_error(struct fc_rdp_link_error_status_desc *desc,
desc->length = cpu_to_be32(sizeof(desc->info));
}
int
lpfc_rdp_res_fec_desc(struct fc_fec_rdp_desc *desc, READ_LNK_VAR *stat)
{
if (bf_get(lpfc_read_link_stat_gec2, stat) == 0)
return 0;
desc->tag = cpu_to_be32(RDP_FEC_DESC_TAG);
desc->info.CorrectedBlocks =
cpu_to_be32(stat->fecCorrBlkCount);
desc->info.UncorrectableBlocks =
cpu_to_be32(stat->fecUncorrBlkCount);
desc->length = cpu_to_be32(sizeof(desc->info));
return sizeof(struct fc_fec_rdp_desc);
}
void
lpfc_rdp_res_speed(struct fc_rdp_port_speed_desc *desc, struct lpfc_hba *phba)
{
......@@ -4800,7 +4832,7 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context,
struct ls_rjt *stat;
struct fc_rdp_res_frame *rdp_res;
uint32_t cmdsize;
int rc;
int rc, fec_size;
if (status != SUCCESS)
goto error;
......@@ -4840,8 +4872,9 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_rdp_context *rdp_context,
lpfc_rdp_res_diag_port_names(&rdp_res->diag_port_names_desc, phba);
lpfc_rdp_res_attach_port_names(&rdp_res->attached_port_names_desc,
vport, ndlp);
rdp_res->length = cpu_to_be32(RDP_DESC_PAYLOAD_SIZE);
fec_size = lpfc_rdp_res_fec_desc(&rdp_res->fec_desc,
&rdp_context->link_stat);
rdp_res->length = cpu_to_be32(fec_size + RDP_DESC_PAYLOAD_SIZE);
elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
phba->fc_stat.elsXmitACC++;
......@@ -7704,6 +7737,35 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
}
}
void
lpfc_start_fdmi(struct lpfc_vport *vport)
{
struct lpfc_hba *phba = vport->phba;
struct lpfc_nodelist *ndlp;
/* If this is the first time, allocate an ndlp and initialize
* it. Otherwise, make sure the node is enabled and then do the
* login.
*/
ndlp = lpfc_findnode_did(vport, FDMI_DID);
if (!ndlp) {
ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
if (ndlp) {
lpfc_nlp_init(vport, ndlp, FDMI_DID);
ndlp->nlp_type |= NLP_FABRIC;
} else {
return;
}
}
if (!NLP_CHK_NODE_ACT(ndlp))
ndlp = lpfc_enable_node(vport, ndlp, NLP_STE_NPR_NODE);
if (ndlp) {
lpfc_nlp_set_state(vport, ndlp, NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0);
}
}
/**
* lpfc_do_scr_ns_plogi - Issue a plogi to the name server for scr
* @phba: pointer to lpfc hba data structure.
......@@ -7720,7 +7782,7 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
void
lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
{
struct lpfc_nodelist *ndlp, *ndlp_fdmi;
struct lpfc_nodelist *ndlp;
struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
/*
......@@ -7778,32 +7840,9 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
return;
}
if (vport->cfg_fdmi_on & LPFC_FDMI_SUPPORT) {
/* If this is the first time, allocate an ndlp and initialize
* it. Otherwise, make sure the node is enabled and then do the
* login.
*/
ndlp_fdmi = lpfc_findnode_did(vport, FDMI_DID);
if (!ndlp_fdmi) {
ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool,
GFP_KERNEL);
if (ndlp_fdmi) {
lpfc_nlp_init(vport, ndlp_fdmi, FDMI_DID);
ndlp_fdmi->nlp_type |= NLP_FABRIC;
} else
return;
}
if (!NLP_CHK_NODE_ACT(ndlp_fdmi))
ndlp_fdmi = lpfc_enable_node(vport,
ndlp_fdmi,
NLP_STE_NPR_NODE);
if (ndlp_fdmi) {
lpfc_nlp_set_state(vport, ndlp_fdmi,
NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(vport, ndlp_fdmi->nlp_DID, 0);
}
}
if ((phba->cfg_fdmi_on > LPFC_FDMI_NO_SUPPORT) &&
(vport->load_flag & FC_ALLOW_FDMI))
lpfc_start_fdmi(vport);
}
/**
......
......@@ -674,8 +674,6 @@ lpfc_work_done(struct lpfc_hba *phba)
lpfc_mbox_timeout_handler(phba);
if (work_port_events & WORKER_FABRIC_BLOCK_TMO)
lpfc_unblock_fabric_iocbs(phba);
if (work_port_events & WORKER_FDMI_TMO)
lpfc_fdmi_timeout_handler(vport);
if (work_port_events & WORKER_RAMP_DOWN_QUEUE)
lpfc_ramp_down_queue_handler(phba);
if (work_port_events & WORKER_DELAYED_DISC_TMO)
......@@ -5554,15 +5552,15 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
ndlp->nlp_usg_map, ndlp);
/*
* Start issuing Fabric-Device Management Interface (FDMI) command to
* 0xfffffa (FDMI well known port) or Delay issuing FDMI command if
* fdmi-on=2 (supporting RPA/hostnmae)
* 0xfffffa (FDMI well known port).
* DHBA -> DPRT -> RHBA -> RPA (physical port)
* DPRT -> RPRT (vports)
*/
if (vport->cfg_fdmi_on & LPFC_FDMI_REG_DELAY)
mod_timer(&vport->fc_fdmitmo,
jiffies + msecs_to_jiffies(1000 * 60));
if (vport->port_type == LPFC_PHYSICAL_PORT)
lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA, 0);
else
lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA);
lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DPRT, 0);
/* decrement the node reference count held for this callback
* function.
......
......@@ -1097,6 +1097,18 @@ struct fc_rdp_port_name_desc {
};
struct fc_rdp_fec_info {
uint32_t CorrectedBlocks;
uint32_t UncorrectableBlocks;
};
#define RDP_FEC_DESC_TAG 0x00010005
struct fc_fec_rdp_desc {
uint32_t tag;
uint32_t length;
struct fc_rdp_fec_info info;
};
struct fc_rdp_link_error_status_payload_info {
struct fc_link_status link_status; /* 24 bytes */
uint32_t port_type; /* bits 31-30 only */
......@@ -1196,6 +1208,7 @@ struct fc_rdp_res_frame {
struct fc_rdp_link_error_status_desc link_error_desc; /* Word 13-21 */
struct fc_rdp_port_name_desc diag_port_names_desc; /* Word 22-27 */
struct fc_rdp_port_name_desc attached_port_names_desc;/* Word 28-33 */
struct fc_fec_rdp_desc fec_desc; /* FC Word 34 - 37 */
};
......@@ -1233,31 +1246,10 @@ struct lpfc_fdmi_attr_def { /* Defined in TLV format */
/* Attribute Entry */
struct lpfc_fdmi_attr_entry {
union {
uint32_t VendorSpecific;
uint32_t SupportClass;
uint32_t SupportSpeed;
uint32_t PortSpeed;
uint32_t MaxFrameSize;
uint32_t MaxCTPayloadLen;
uint32_t PortState;
uint32_t PortId;
struct lpfc_name NodeName;
struct lpfc_name PortName;
struct lpfc_name FabricName;
uint8_t FC4Types[32];
uint8_t Manufacturer[64];
uint8_t SerialNumber[64];
uint8_t Model[256];
uint8_t ModelDescription[256];
uint8_t HardwareVersion[256];
uint8_t DriverVersion[256];
uint8_t OptionROMVersion[256];
uint8_t FirmwareVersion[256];
uint8_t OsHostName[256];
uint8_t NodeSymName[256];
uint8_t OsDeviceName[256];
uint8_t OsNameVersion[256];
uint8_t HostName[256];
uint32_t AttrInt;
uint8_t AttrTypes[32];
uint8_t AttrString[256];
struct lpfc_name AttrWWN;
} un;
};
......@@ -1327,6 +1319,8 @@ struct lpfc_fdmi_reg_portattr {
#define SLI_MGMT_DPRT 0x310 /* De-register Port */
#define SLI_MGMT_DPA 0x311 /* De-register Port attributes */
#define LPFC_FDMI_MAX_RETRY 3 /* Max retries for a FDMI command */
/*
* HBA Attribute Types
*/
......@@ -1342,6 +1336,39 @@ struct lpfc_fdmi_reg_portattr {
#define RHBA_OS_NAME_VERSION 0xa /* 4 to 256 byte ASCII string */
#define RHBA_MAX_CT_PAYLOAD_LEN 0xb /* 32-bit unsigned int */
#define RHBA_SYM_NODENAME 0xc /* 4 to 256 byte ASCII string */
#define RHBA_VENDOR_INFO 0xd /* 32-bit unsigned int */
#define RHBA_NUM_PORTS 0xe /* 32-bit unsigned int */
#define RHBA_FABRIC_WWNN 0xf /* 8 byte WWNN */
#define RHBA_BIOS_VERSION 0x10 /* 4 to 256 byte ASCII string */
#define RHBA_BIOS_STATE 0x11 /* 32-bit unsigned int */
#define RHBA_VENDOR_ID 0xe0 /* 8 byte ASCII string */
/* Bit mask for all individual HBA attributes */
#define LPFC_FDMI_HBA_ATTR_wwnn 0x00000001
#define LPFC_FDMI_HBA_ATTR_manufacturer 0x00000002
#define LPFC_FDMI_HBA_ATTR_sn 0x00000004
#define LPFC_FDMI_HBA_ATTR_model 0x00000008
#define LPFC_FDMI_HBA_ATTR_description 0x00000010
#define LPFC_FDMI_HBA_ATTR_hdw_ver 0x00000020
#define LPFC_FDMI_HBA_ATTR_drvr_ver 0x00000040
#define LPFC_FDMI_HBA_ATTR_rom_ver 0x00000080
#define LPFC_FDMI_HBA_ATTR_fmw_ver 0x00000100
#define LPFC_FDMI_HBA_ATTR_os_ver 0x00000200
#define LPFC_FDMI_HBA_ATTR_ct_len 0x00000400
#define LPFC_FDMI_HBA_ATTR_symbolic_name 0x00000800
#define LPFC_FDMI_HBA_ATTR_vendor_info 0x00001000 /* Not used */
#define LPFC_FDMI_HBA_ATTR_num_ports 0x00002000
#define LPFC_FDMI_HBA_ATTR_fabric_wwnn 0x00004000
#define LPFC_FDMI_HBA_ATTR_bios_ver 0x00008000
#define LPFC_FDMI_HBA_ATTR_bios_state 0x00010000 /* Not used */
#define LPFC_FDMI_HBA_ATTR_vendor_id 0x00020000
/* Bit mask for FDMI-1 defined HBA attributes */
#define LPFC_FDMI1_HBA_ATTR 0x000007ff
/* Bit mask for FDMI-2 defined HBA attributes */
/* Skip vendor_info and bios_state */
#define LPFC_FDMI2_HBA_ATTR 0x0002efff
/*
* Port Attrubute Types
......@@ -1353,15 +1380,65 @@ struct lpfc_fdmi_reg_portattr {
#define RPRT_OS_DEVICE_NAME 0x5 /* 4 to 256 byte ASCII string */
#define RPRT_HOST_NAME 0x6 /* 4 to 256 byte ASCII string */
#define RPRT_NODENAME 0x7 /* 8 byte WWNN */
#define RPRT_PORTNAME 0x8 /* 8 byte WWNN */
#define RPRT_PORTNAME 0x8 /* 8 byte WWPN */
#define RPRT_SYM_PORTNAME 0x9 /* 4 to 256 byte ASCII string */
#define RPRT_PORT_TYPE 0xa /* 32-bit unsigned int */
#define RPRT_SUPPORTED_CLASS 0xb /* 32-bit unsigned int */
#define RPRT_FABRICNAME 0xc /* 8 byte Fabric WWNN */
#define RPRT_FABRICNAME 0xc /* 8 byte Fabric WWPN */
#define RPRT_ACTIVE_FC4_TYPES 0xd /* 32 byte binary array */
#define RPRT_PORT_STATE 0x101 /* 32-bit unsigned int */
#define RPRT_DISC_PORT 0x102 /* 32-bit unsigned int */
#define RPRT_PORT_ID 0x103 /* 32-bit unsigned int */
#define RPRT_SMART_SERVICE 0xf100 /* 4 to 256 byte ASCII string */
#define RPRT_SMART_GUID 0xf101 /* 8 byte WWNN + 8 byte WWPN */
#define RPRT_SMART_VERSION 0xf102 /* 4 to 256 byte ASCII string */
#define RPRT_SMART_MODEL 0xf103 /* 4 to 256 byte ASCII string */
#define RPRT_SMART_PORT_INFO 0xf104 /* 32-bit unsigned int */
#define RPRT_SMART_QOS 0xf105 /* 32-bit unsigned int */
#define RPRT_SMART_SECURITY 0xf106 /* 32-bit unsigned int */
/* Bit mask for all individual PORT attributes */
#define LPFC_FDMI_PORT_ATTR_fc4type 0x00000001
#define LPFC_FDMI_PORT_ATTR_support_speed 0x00000002
#define LPFC_FDMI_PORT_ATTR_speed 0x00000004
#define LPFC_FDMI_PORT_ATTR_max_frame 0x00000008
#define LPFC_FDMI_PORT_ATTR_os_devname 0x00000010
#define LPFC_FDMI_PORT_ATTR_host_name 0x00000020
#define LPFC_FDMI_PORT_ATTR_wwnn 0x00000040
#define LPFC_FDMI_PORT_ATTR_wwpn 0x00000080
#define LPFC_FDMI_PORT_ATTR_symbolic_name 0x00000100
#define LPFC_FDMI_PORT_ATTR_port_type 0x00000200
#define LPFC_FDMI_PORT_ATTR_class 0x00000400
#define LPFC_FDMI_PORT_ATTR_fabric_wwpn 0x00000800
#define LPFC_FDMI_PORT_ATTR_port_state 0x00001000
#define LPFC_FDMI_PORT_ATTR_active_fc4type 0x00002000
#define LPFC_FDMI_PORT_ATTR_num_disc 0x00004000
#define LPFC_FDMI_PORT_ATTR_nportid 0x00008000
#define LPFC_FDMI_SMART_ATTR_service 0x00010000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_guid 0x00020000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_version 0x00040000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_model 0x00080000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_port_info 0x00100000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_qos 0x00200000 /* Vendor specific */
#define LPFC_FDMI_SMART_ATTR_security 0x00400000 /* Vendor specific */
/* Bit mask for FDMI-1 defined PORT attributes */
#define LPFC_FDMI1_PORT_ATTR 0x0000003f
/* Bit mask for FDMI-2 defined PORT attributes */
#define LPFC_FDMI2_PORT_ATTR 0x0000ffff
/* Bit mask for Smart SAN defined PORT attributes */
#define LPFC_FDMI2_SMART_ATTR 0x007fffff
/* Defines for PORT port state attribute */
#define LPFC_FDMI_PORTSTATE_UNKNOWN 1
#define LPFC_FDMI_PORTSTATE_ONLINE 2
/* Defines for PORT port type attribute */
#define LPFC_FDMI_PORTTYPE_UNKNOWN 0
#define LPFC_FDMI_PORTTYPE_NPORT 1
#define LPFC_FDMI_PORTTYPE_NLPORT 2
/*
* Begin HBA configuration parameters.
......@@ -2498,10 +2575,38 @@ typedef struct {
/* Structure for MB Command READ_LINK_STAT (18) */
typedef struct {
uint32_t rsvd1;
uint32_t word0;
#define lpfc_read_link_stat_rec_SHIFT 0
#define lpfc_read_link_stat_rec_MASK 0x1
#define lpfc_read_link_stat_rec_WORD word0
#define lpfc_read_link_stat_gec_SHIFT 1
#define lpfc_read_link_stat_gec_MASK 0x1
#define lpfc_read_link_stat_gec_WORD word0
#define lpfc_read_link_stat_w02oftow23of_SHIFT 2
#define lpfc_read_link_stat_w02oftow23of_MASK 0x3FFFFF
#define lpfc_read_link_stat_w02oftow23of_WORD word0
#define lpfc_read_link_stat_rsvd_SHIFT 24
#define lpfc_read_link_stat_rsvd_MASK 0x1F
#define lpfc_read_link_stat_rsvd_WORD word0
#define lpfc_read_link_stat_gec2_SHIFT 29
#define lpfc_read_link_stat_gec2_MASK 0x1
#define lpfc_read_link_stat_gec2_WORD word0
#define lpfc_read_link_stat_clrc_SHIFT 30
#define lpfc_read_link_stat_clrc_MASK 0x1
#define lpfc_read_link_stat_clrc_WORD word0
#define lpfc_read_link_stat_clof_SHIFT 31
#define lpfc_read_link_stat_clof_MASK 0x1
#define lpfc_read_link_stat_clof_WORD word0
uint32_t linkFailureCnt;
uint32_t lossSyncCnt;
uint32_t lossSignalCnt;
uint32_t primSeqErrCnt;
uint32_t invalidXmitWord;
......@@ -2509,6 +2614,19 @@ typedef struct {
uint32_t primSeqTimeout;
uint32_t elasticOverrun;
uint32_t arbTimeout;
uint32_t advRecBufCredit;
uint32_t curRecBufCredit;
uint32_t advTransBufCredit;
uint32_t curTransBufCredit;
uint32_t recEofCount;
uint32_t recEofdtiCount;
uint32_t recEofniCount;
uint32_t recSofcount;
uint32_t rsvd1;
uint32_t rsvd2;
uint32_t recDrpXriCount;
uint32_t fecCorrBlkCount;
uint32_t fecUncorrBlkCount;
} READ_LNK_VAR;
/* Structure for MB Command REG_LOGIN (19) */
......
......@@ -1184,8 +1184,10 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
vports = lpfc_create_vport_work_array(phba);
if (vports != NULL)
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++)
for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
lpfc_rcv_seq_check_edtov(vports[i]);
lpfc_fdmi_num_disc_check(vports[i]);
}
lpfc_destroy_vport_work_array(phba, vports);
if ((phba->link_state == LPFC_HBA_ERROR) ||
......@@ -1290,6 +1292,10 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
jiffies +
msecs_to_jiffies(1000 * LPFC_HB_MBOX_TIMEOUT));
}
} else {
mod_timer(&phba->hb_tmofunc,
jiffies +
msecs_to_jiffies(1000 * LPFC_HB_MBOX_INTERVAL));
}
}
......@@ -2621,7 +2627,6 @@ void
lpfc_stop_vport_timers(struct lpfc_vport *vport)
{
del_timer_sync(&vport->els_tmofunc);
del_timer_sync(&vport->fc_fdmitmo);
del_timer_sync(&vport->delayed_disc_tmo);
lpfc_can_disctmo(vport);
return;
......@@ -3340,10 +3345,6 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
vport->fc_disctmo.function = lpfc_disc_timeout;
vport->fc_disctmo.data = (unsigned long)vport;
init_timer(&vport->fc_fdmitmo);
vport->fc_fdmitmo.function = lpfc_fdmi_tmo;
vport->fc_fdmitmo.data = (unsigned long)vport;
init_timer(&vport->els_tmofunc);
vport->els_tmofunc.function = lpfc_els_timeout;
vport->els_tmofunc.data = (unsigned long)vport;
......@@ -6159,6 +6160,20 @@ lpfc_create_shost(struct lpfc_hba *phba)
/* Put reference to SCSI host to driver's device private data */
pci_set_drvdata(phba->pcidev, shost);
/*
* At this point we are fully registered with PSA. In addition,
* any initial discovery should be completed.
*/
vport->load_flag |= FC_ALLOW_FDMI;
if (phba->cfg_fdmi_on > LPFC_FDMI_NO_SUPPORT) {
/* Setup appropriate attribute masks */
vport->fdmi_hba_mask = LPFC_FDMI2_HBA_ATTR;
if (phba->cfg_fdmi_on == LPFC_FDMI_SMART_SAN)
vport->fdmi_port_mask = LPFC_FDMI2_SMART_ATTR;
else
vport->fdmi_port_mask = LPFC_FDMI2_PORT_ATTR;
}
return 0;
}
......
......@@ -393,6 +393,14 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
*(struct lpfc_vport **)fc_vport->dd_data = vport;
vport->fc_vport = fc_vport;
/* At this point we are fully registered with SCSI Layer. */
vport->load_flag |= FC_ALLOW_FDMI;
if (phba->cfg_fdmi_on > LPFC_FDMI_NO_SUPPORT) {
/* Setup appropriate attribute masks */
vport->fdmi_hba_mask = phba->pport->fdmi_hba_mask;
vport->fdmi_port_mask = phba->pport->fdmi_port_mask;
}
/*
* In SLI4, the vpi must be activated before it can be used
* by the port.
......
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