lpfc 8.3.2 : Persistent Vport Support
Subsystems (2)
PATCH 16/17 lpfc 8.3.2 : Persistent Vport Support
Add support for persistent vport definitions at creation at boot time
Also includes a few misc fixes for:
- conversion to vpi name from vport slang name
- couple of small mailbox references
- some additional discovery mods
Signed-off-by James Smart <[email protected]>
---
lpfc_attr.c | 31 +++++++++ lpfc_hbadisc.c | 180 ++++++++++++++++++++++++++++++++++++++++++++------------- lpfc_init.c | 1 lpfc_mbox.c | 38 ++++++++++++ lpfc_scsi.c | 6 - lpfc_vport.c | 37 ++++++----- 6 files changed, 236 insertions(+), 57 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +31 -0
@@ -2277,6 +2277,36 @@ lpfc_param_init(topology, 0, 0, 6) static DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, lpfc_topology_show, lpfc_topology_store); +/** +* lpfc_static_vport_show: Read callback function for +* lpfc_static_vport sysfs file. +* @dev: Pointer to class device object. +* @attr: device attribute structure. +* @buf: Data buffer. +* +* This function is the read call back function for +* lpfc_static_vport sysfs file. The lpfc_static_vport +* sysfs file report the mageability of the vport. +**/ +static ssize_t +lpfc_static_vport_show (struct device *dev,struct device_attribute *attr, +char *buf) +{ +struct Scsi_Host *shost =class_to_shost (dev); +struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata; +if (vport->vport_flag &STATIC_VPORT ) +sprintf (buf,"1\n" ); +else +sprintf (buf,"0\n" ); + +return strlen (buf); +} + +/* +* Sysfs attribute to control the statistical data collection. +*/ +static DEVICE_ATTR(lpfc_static_vport, S_IRUGO, + lpfc_static_vport_show, NULL);/** * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file
@@ -3051,6 +3081,7 @@ struct device_attribute *lpfc_vport_attr &dev_attr_lpfc_enable_da_id, &dev_attr_lpfc_max_scsicmpl_time, &dev_attr_lpfc_stat_data_ctrl, + &dev_attr_lpfc_static_vport, NULL, };
drivers/scsi/lpfc/lpfc_hbadisc.c +141 -39
280 lines not on this page · raw message
drivers/scsi/lpfc/lpfc_init.c +1 -0
@@ -385,6 +385,7 @@ lpfc_config_port_post(struct lpfc_hba *p/* Update the fc_host data structures with new wwn. */ fc_host_node_name (shost) =wwn_to_u64 (vport->fc_nodename.u.wwn);fc_host_port_name (shost) =wwn_to_u64 (vport->fc_portname.u.wwn); +fc_host_max_npiv_vports (shost) = phba->max_vpi;/* If no serial number in VPD data, use low 6 bytes of WWNN */ /* This should be consolidated into parse_vpd ? - mr */
drivers/scsi/lpfc/lpfc_mbox.c +38 -0
@@ -41,6 +41,44 @@#include "lpfc_compat.h" /** +* lpfc_dump_static_vport - Dump HBA's static vport information. +* @phba: pointer to lpfc hba data structure. +* @pmb: pointer to the driver internal queue element for mailbox command. +* @offset: offset for dumping vport info. +* +* The dump mailbox command provides a method for the device driver to obtain +* various types of information from the HBA device. +* +* This routine prepares the mailbox command for dumping list of static +* vports to be created. +**/ +void +lpfc_dump_static_vport (struct lpfc_hba *phba,LPFC_MBOXQ_t *pmb, +uint16_t offset) +{ +MAILBOX_t *mb; +void *ctx; + + mb = &pmb->u.mb; + ctx = pmb->context2; + +/* Setup to dump vport info region */ +memset (pmb,0 ,sizeof (LPFC_MBOXQ_t)); + mb->mbxCommand =MBX_DUMP_MEMORY ; + mb->un.varDmp.cv =1 ; + mb->un.varDmp.type =DMP_NV_PARAMS ; + mb->un.varDmp.entry_index = offset; + mb->un.varDmp.region_id =DMP_REGION_VPORT ; + mb->un.varDmp.word_cnt =DMP_RSP_SIZE /sizeof (uint32_t ); + mb->un.varDmp.co =0 ; + mb->un.varDmp.resp_offset =0 ; + pmb->context2 = ctx; + mb->mbxOwner =OWN_HOST ; + +return ; +} + +/** * lpfc_dump_mem - Prepare a mailbox command for retrieving HBA's VPD memory * @phba: pointer to lpfc hba data structure. * @pmb: pointer to the driver internal queue element for mailbox command.
drivers/scsi/lpfc/lpfc_scsi.c +3 -3
@@ -329,7 +329,7 @@ lpfc_ramp_down_queue_handler(struct lpfc vports =lpfc_create_vport_work_array (phba);if (vports !=NULL ) -for (i =0 ; i <= phba->max_vpi && vports[i] !=NULL ; i++) { +for (i =0 ; i <= phba->max_vports && vports[i] !=NULL ; i++) { shost =lpfc_shost_from_vport (vports[i]);shost_for_each_device (sdev, shost) { new_queue_depth =
@@ -383,7 +383,7 @@ lpfc_ramp_up_queue_handler(struct lpfc_h vports =lpfc_create_vport_work_array (phba);if (vports !=NULL ) -for (i =0 ; i <= phba->max_vpi && vports[i] !=NULL ; i++) { +for (i =0 ; i <= phba->max_vports && vports[i] !=NULL ; i++) { shost =lpfc_shost_from_vport (vports[i]);shost_for_each_device (sdev, shost) { if (vports[i]->cfg_lun_queue_depth <=
@@ -431,7 +431,7 @@ lpfc_scsi_dev_block(struct lpfc_hba *phb vports =lpfc_create_vport_work_array (phba);if (vports !=NULL ) -for (i =0 ; i <= phba->max_vpi && vports[i] !=NULL ; i++) { +for (i =0 ; i <= phba->max_vports && vports[i] !=NULL ; i++) { shost =lpfc_shost_from_vport (vports[i]);shost_for_each_device (sdev, shost) { rport =starget_to_rport (scsi_target (sdev));
drivers/scsi/lpfc/lpfc_vport.c +22 -15
@@ -251,23 +251,22 @@ static void lpfc_discovery_wait(struct l (vport->fc_flag & wait_flags) || ((vport->port_state > LPFC_VPORT_FAILED) && (vport->port_state < LPFC_VPORT_READY))) { -lpfc_printf_log (phba,KERN_INFO ,LOG_VPORT , +lpfc_printf_vlog (vport,KERN_INFO ,LOG_VPORT ,"1833 Vport discovery quiesce Wait:" -" vpi x%x state x%x fc_flags x%x" +" state x%x fc_flags x%x" " num_nodes x%x, waiting 1000 msecs" " total wait msecs x%x\n" , - vport->vpi, vport->port_state, - vport->fc_flag, vport->num_disc_nodes, + vport->port_state, vport->fc_flag, + vport->num_disc_nodes,jiffies_to_msecs (jiffies - start_time));msleep (1000 ); } else {/* Base case. Wait variants satisfied. Break out */ -lpfc_printf_log (phba,KERN_INFO ,LOG_VPORT , +lpfc_printf_vlog (vport,KERN_INFO ,LOG_VPORT ,"1834 Vport discovery quiesced:" -" vpi x%x state x%x fc_flags x%x" +" state x%x fc_flags x%x" " wait msecs x%x\n" , - vport->vpi, vport->port_state, - vport->fc_flag, + vport->port_state, vport->fc_flag,jiffies_to_msecs (jiffies - start_time));break ;
@@ -275,12 +274,10 @@ static void lpfc_discovery_wait(struct l }if (time_after (jiffies, wait_time_max)) -lpfc_printf_log (phba,KERN_ERR ,LOG_VPORT , +lpfc_printf_vlog (vport,KERN_ERR ,LOG_VPORT ,"1835 Vport discovery quiesce failed:" -" vpi x%x state x%x fc_flags x%x" -" wait msecs x%x\n" , - vport->vpi, vport->port_state, - vport->fc_flag, +" state x%x fc_flags x%x wait msecs x%x\n" , + vport->port_state, vport->fc_flag,jiffies_to_msecs (jiffies - start_time)); }
@@ -558,6 +555,16 @@ lpfc_vport_delete(struct fc_vport *fc_vp "physical host\n");return VPORT_ERROR ; } + +/* If the vport is a static vport fail the deletion. */ +if ((vport->vport_flag &STATIC_VPORT ) && + !(phba->pport->load_flag &FC_UNLOADING )) { +lpfc_printf_vlog (vport,KERN_ERR ,LOG_VPORT , +"1837 vport_delete failed: Cannot delete " +"static vport.\n" ); +return VPORT_ERROR ; + } +/* * If we are not unloading the driver then prevent the vport_delete * from happening until after this vport's discovery is finished.
@@ -733,7 +740,7 @@ lpfc_create_vport_work_array(struct lpfcstruct lpfc_vport *port_iterator;struct lpfc_vport **vports;int index =0 ; - vports =kzalloc ((phba->max_vpi +1 ) *sizeof (struct lpfc_vport *), + vports =kzalloc ((phba->max_vports +1 ) *sizeof (struct lpfc_vport *),GFP_KERNEL );if (vports ==NULL )return NULL ;
@@ -757,7 +764,7 @@ lpfc_destroy_vport_work_array(struct lpfint i;if (vports ==NULL )return ; -for (i=0 ; vports[i] !=NULL && i <= phba->max_vpi; i++) +for (i =0 ; vports[i] !=NULL && i <= phba->max_vports; i++)scsi_host_put (lpfc_shost_from_vport (vports[i]));kfree (vports); }