aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 484070c82974..83855a5a1826 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -1524,13 +1524,18 @@ lpfc_scsi_free(struct lpfc_hba *phba)
1524} 1524}
1525 1525
1526struct lpfc_vport * 1526struct lpfc_vport *
1527lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport) 1527lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
1528{ 1528{
1529 struct lpfc_vport *vport; 1529 struct lpfc_vport *vport;
1530 struct Scsi_Host *shost; 1530 struct Scsi_Host *shost;
1531 int error = 0; 1531 int error = 0;
1532 1532
1533 shost = scsi_host_alloc(&lpfc_template, sizeof(struct lpfc_vport)); 1533 if (dev != &phba->pcidev->dev)
1534 shost = scsi_host_alloc(&lpfc_vport_template,
1535 sizeof(struct lpfc_vport));
1536 else
1537 shost = scsi_host_alloc(&lpfc_template,
1538 sizeof(struct lpfc_vport));
1534 if (!shost) 1539 if (!shost)
1535 goto out; 1540 goto out;
1536 1541
@@ -1540,9 +1545,10 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
1540 vport->load_flag |= FC_LOADING; 1545 vport->load_flag |= FC_LOADING;
1541 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI; 1546 vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
1542 1547
1548 lpfc_get_vport_cfgparam(vport);
1543 shost->unique_id = instance; 1549 shost->unique_id = instance;
1544 shost->max_id = LPFC_MAX_TARGET; 1550 shost->max_id = LPFC_MAX_TARGET;
1545 shost->max_lun = phba->cfg_max_luns; 1551 shost->max_lun = vport->cfg_max_luns;
1546 shost->this_id = -1; 1552 shost->this_id = -1;
1547 shost->max_cmd_len = 16; 1553 shost->max_cmd_len = 16;
1548 /* 1554 /*
@@ -1551,7 +1557,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
1551 * max xri value determined in hba setup. 1557 * max xri value determined in hba setup.
1552 */ 1558 */
1553 shost->can_queue = phba->cfg_hba_queue_depth - 10; 1559 shost->can_queue = phba->cfg_hba_queue_depth - 10;
1554 if (fc_vport != NULL) { 1560 if (dev != &phba->pcidev->dev) {
1555 shost->transportt = lpfc_vport_transport_template; 1561 shost->transportt = lpfc_vport_transport_template;
1556 vport->port_type = LPFC_NPIV_PORT; 1562 vport->port_type = LPFC_NPIV_PORT;
1557 } else { 1563 } else {
@@ -1575,11 +1581,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
1575 vport->els_tmofunc.function = lpfc_els_timeout; 1581 vport->els_tmofunc.function = lpfc_els_timeout;
1576 vport->els_tmofunc.data = (unsigned long)vport; 1582 vport->els_tmofunc.data = (unsigned long)vport;
1577 1583
1578 if (fc_vport != NULL) { 1584 error = scsi_add_host(shost, dev);
1579 error = scsi_add_host(shost, &fc_vport->dev);
1580 } else {
1581 error = scsi_add_host(shost, &phba->pcidev->dev);
1582 }
1583 if (error) 1585 if (error)
1584 goto out_put_shost; 1586 goto out_put_shost;
1585 1587
@@ -1895,7 +1897,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1895 /* Initialize list of fabric iocbs */ 1897 /* Initialize list of fabric iocbs */
1896 INIT_LIST_HEAD(&phba->fabric_iocb_list); 1898 INIT_LIST_HEAD(&phba->fabric_iocb_list);
1897 1899
1898 vport = lpfc_create_port(phba, phba->brd_no, NULL); 1900 vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev);
1899 if (!vport) 1901 if (!vport)
1900 goto out_kthread_stop; 1902 goto out_kthread_stop;
1901 1903