]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_vport.c
iommu: Add domain_has_cap iommu_ops
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_vport.c
index a7de1cc02b40fd755f4634b633a669bde66a4d65..63b54c66756c27c6a72f674d1ce7a746718d2dd9 100644 (file)
@@ -288,10 +288,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        int vpi;
        int rc = VPORT_ERROR;
        int status;
-       int size;
 
-       if ((phba->sli_rev < 3) ||
-               !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) {
+       if ((phba->sli_rev < 3) || !(phba->cfg_enable_npiv)) {
                lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
                                "1808 Create VPORT failed: "
                                "NPIV is not enabled: SLImode:%d\n",
@@ -351,20 +349,6 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
 
        memcpy(vport->fc_portname.u.wwn, vport->fc_sparam.portName.u.wwn, 8);
        memcpy(vport->fc_nodename.u.wwn, vport->fc_sparam.nodeName.u.wwn, 8);
-       size = strnlen(fc_vport->symbolic_name, LPFC_VNAME_LEN);
-       if (size) {
-               vport->vname = kzalloc(size+1, GFP_KERNEL);
-               if (!vport->vname) {
-                       lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
-                                        "1814 Create VPORT failed. "
-                                        "vname allocation failed.\n");
-                       rc = VPORT_ERROR;
-                       lpfc_free_vpi(phba, vpi);
-                       destroy_port(vport);
-                       goto error_out;
-               }
-               memcpy(vport->vname, fc_vport->symbolic_name, size+1);
-       }
        if (fc_vport->node_name != 0)
                u64_to_wwn(fc_vport->node_name, vport->fc_nodename.u.wwn);
        if (fc_vport->port_name != 0)
@@ -394,6 +378,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
                goto error_out;
        }
 
+       /* Create binary sysfs attribute for vport */
+       lpfc_alloc_sysfs_attr(vport);
+
        *(struct lpfc_vport **)fc_vport->dd_data = vport;
        vport->fc_vport = fc_vport;
 
@@ -405,6 +392,7 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        }
 
        if (disable) {
+               lpfc_vport_set_state(vport, FC_VPORT_DISABLED);
                rc = VPORT_OK;
                goto out;
        }
@@ -587,8 +575,12 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
        spin_lock_irq(&phba->hbalock);
        vport->load_flag |= FC_UNLOADING;
        spin_unlock_irq(&phba->hbalock);
-       kfree(vport->vname);
+
+       lpfc_free_sysfs_attr(vport);
+
        lpfc_debugfs_terminate(vport);
+
+       /* Remove FC host and then SCSI host with the vport */
        fc_remove_host(lpfc_shost_from_vport(vport));
        scsi_remove_host(lpfc_shost_from_vport(vport));