aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/fcoe/fcoe.c50
-rw-r--r--drivers/scsi/libfc/fc_exch.c1
-rw-r--r--drivers/scsi/libfc/fc_lport.c1
-rw-r--r--drivers/scsi/libfc/fc_npiv.c9
4 files changed, 29 insertions, 32 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 495456fe4520..0b5fbb8940c4 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -928,8 +928,9 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
928 struct device *parent, int npiv) 928 struct device *parent, int npiv)
929{ 929{
930 struct net_device *netdev = fcoe->netdev; 930 struct net_device *netdev = fcoe->netdev;
931 struct fc_lport *lport = NULL; 931 struct fc_lport *lport, *n_port;
932 struct fcoe_port *port; 932 struct fcoe_port *port;
933 struct Scsi_Host *shost;
933 int rc; 934 int rc;
934 /* 935 /*
935 * parent is only a vport if npiv is 1, 936 * parent is only a vport if npiv is 1,
@@ -939,13 +940,11 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
939 940
940 FCOE_NETDEV_DBG(netdev, "Create Interface\n"); 941 FCOE_NETDEV_DBG(netdev, "Create Interface\n");
941 942
942 if (!npiv) { 943 if (!npiv)
943 lport = libfc_host_alloc(&fcoe_shost_template, 944 lport = libfc_host_alloc(&fcoe_shost_template, sizeof(*port));
944 sizeof(struct fcoe_port)); 945 else
945 } else { 946 lport = libfc_vport_create(vport, sizeof(*port));
946 lport = libfc_vport_create(vport, 947
947 sizeof(struct fcoe_port));
948 }
949 if (!lport) { 948 if (!lport) {
950 FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n"); 949 FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n");
951 rc = -ENOMEM; 950 rc = -ENOMEM;
@@ -998,24 +997,27 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe,
998 goto out_lp_destroy; 997 goto out_lp_destroy;
999 } 998 }
1000 999
1001 if (!npiv) { 1000 /*
1002 /* 1001 * fcoe_em_alloc() and fcoe_hostlist_add() both
1003 * fcoe_em_alloc() and fcoe_hostlist_add() both 1002 * need to be atomic with respect to other changes to the
1004 * need to be atomic with respect to other changes to the 1003 * hostlist since fcoe_em_alloc() looks for an existing EM
1005 * hostlist since fcoe_em_alloc() looks for an existing EM 1004 * instance on host list updated by fcoe_hostlist_add().
1006 * instance on host list updated by fcoe_hostlist_add(). 1005 *
1007 * 1006 * This is currently handled through the fcoe_config_mutex
1008 * This is currently handled through the fcoe_config_mutex 1007 * begin held.
1009 * begin held. 1008 */
1010 */ 1009 if (!npiv)
1011
1012 /* lport exch manager allocation */ 1010 /* lport exch manager allocation */
1013 rc = fcoe_em_config(lport); 1011 rc = fcoe_em_config(lport);
1014 if (rc) { 1012 else {
1015 FCOE_NETDEV_DBG(netdev, "Could not configure the EM " 1013 shost = vport_to_shost(vport);
1016 "for the interface\n"); 1014 n_port = shost_priv(shost);
1017 goto out_lp_destroy; 1015 rc = fc_exch_mgr_list_clone(n_port, lport);
1018 } 1016 }
1017
1018 if (rc) {
1019 FCOE_NETDEV_DBG(netdev, "Could not configure the EM\n");
1020 goto out_lp_destroy;
1019 } 1021 }
1020 1022
1021 fcoe_interface_get(fcoe); 1023 fcoe_interface_get(fcoe);
diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c
index 10a5436aff77..28231badd9e6 100644
--- a/drivers/scsi/libfc/fc_exch.c
+++ b/drivers/scsi/libfc/fc_exch.c
@@ -2175,6 +2175,7 @@ err:
2175 fc_exch_mgr_del(ema); 2175 fc_exch_mgr_del(ema);
2176 return -ENOMEM; 2176 return -ENOMEM;
2177} 2177}
2178EXPORT_SYMBOL(fc_exch_mgr_list_clone);
2178 2179
2179/** 2180/**
2180 * fc_exch_mgr_alloc() - Allocate an exchange manager 2181 * fc_exch_mgr_alloc() - Allocate an exchange manager
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 735f1f82ccfd..8c08b210001d 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1590,6 +1590,7 @@ void fc_lport_enter_flogi(struct fc_lport *lport)
1590 */ 1590 */
1591int fc_lport_config(struct fc_lport *lport) 1591int fc_lport_config(struct fc_lport *lport)
1592{ 1592{
1593 INIT_LIST_HEAD(&lport->ema_list);
1593 INIT_DELAYED_WORK(&lport->retry_work, fc_lport_timeout); 1594 INIT_DELAYED_WORK(&lport->retry_work, fc_lport_timeout);
1594 mutex_init(&lport->lp_mutex); 1595 mutex_init(&lport->lp_mutex);
1595 1596
diff --git a/drivers/scsi/libfc/fc_npiv.c b/drivers/scsi/libfc/fc_npiv.c
index 076cd5ff0e40..f33b897e4784 100644
--- a/drivers/scsi/libfc/fc_npiv.c
+++ b/drivers/scsi/libfc/fc_npiv.c
@@ -37,9 +37,7 @@ struct fc_lport *libfc_vport_create(struct fc_vport *vport, int privsize)
37 37
38 vn_port = libfc_host_alloc(shost->hostt, privsize); 38 vn_port = libfc_host_alloc(shost->hostt, privsize);
39 if (!vn_port) 39 if (!vn_port)
40 goto err_out; 40 return vn_port;
41 if (fc_exch_mgr_list_clone(n_port, vn_port))
42 goto err_put;
43 41
44 vn_port->vport = vport; 42 vn_port->vport = vport;
45 vport->dd_data = vn_port; 43 vport->dd_data = vn_port;
@@ -49,11 +47,6 @@ struct fc_lport *libfc_vport_create(struct fc_vport *vport, int privsize)
49 mutex_unlock(&n_port->lp_mutex); 47 mutex_unlock(&n_port->lp_mutex);
50 48
51 return vn_port; 49 return vn_port;
52
53err_put:
54 scsi_host_put(vn_port->host);
55err_out:
56 return NULL;
57} 50}
58EXPORT_SYMBOL(libfc_vport_create); 51EXPORT_SYMBOL(libfc_vport_create);
59 52