diff options
author | Vasu Dev <vasu.dev@intel.com> | 2011-02-25 15:03:01 -0800 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-02-28 18:31:53 -0600 |
commit | 72fa396bf57b31e8e2a401a21a3a088c0cc6b043 (patch) | |
tree | c4094d3f8db3265dd122952867c1e8ff4e6abb63 /drivers/scsi/fcoe/fcoe.c | |
parent | f31624831a79b9e3f129f6c3b0a1b83903a7b61e (diff) |
[SCSI] fcoe, libfc: initialize EM anchors list and then update npiv EMs
EM anchors list initialization for only master port was not enough to
keep npiv working as described here:-
https://lists.open-fcoe.org/pipermail/devel/2011-January/011063.html
So this patch moves fc_exch_mgr_list_clone to update npiv ports
EMs once EM anchors list initialized.
Also some cleanup, no need to set lport = NULL as that always
get initialized later.
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/fcoe/fcoe.c')
-rw-r--r-- | drivers/scsi/fcoe/fcoe.c | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c index 495456fe452..0b5fbb8940c 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, struct device *parent, int npiv) { struct net_device *netdev = fcoe->netdev; - struct fc_lport *lport = NULL; + struct fc_lport *lport, *n_port; struct fcoe_port *port; + struct Scsi_Host *shost; int rc; /* * parent is only a vport if npiv is 1, @@ -939,13 +940,11 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe, FCOE_NETDEV_DBG(netdev, "Create Interface\n"); - if (!npiv) { - lport = libfc_host_alloc(&fcoe_shost_template, - sizeof(struct fcoe_port)); - } else { - lport = libfc_vport_create(vport, - sizeof(struct fcoe_port)); - } + if (!npiv) + lport = libfc_host_alloc(&fcoe_shost_template, sizeof(*port)); + else + lport = libfc_vport_create(vport, sizeof(*port)); + if (!lport) { FCOE_NETDEV_DBG(netdev, "Could not allocate host structure\n"); rc = -ENOMEM; @@ -998,24 +997,27 @@ static struct fc_lport *fcoe_if_create(struct fcoe_interface *fcoe, goto out_lp_destroy; } - if (!npiv) { - /* - * fcoe_em_alloc() and fcoe_hostlist_add() both - * need to be atomic with respect to other changes to the - * hostlist since fcoe_em_alloc() looks for an existing EM - * instance on host list updated by fcoe_hostlist_add(). - * - * This is currently handled through the fcoe_config_mutex - * begin held. - */ - + /* + * fcoe_em_alloc() and fcoe_hostlist_add() both + * need to be atomic with respect to other changes to the + * hostlist since fcoe_em_alloc() looks for an existing EM + * instance on host list updated by fcoe_hostlist_add(). + * + * This is currently handled through the fcoe_config_mutex + * begin held. + */ + if (!npiv) /* lport exch manager allocation */ rc = fcoe_em_config(lport); - if (rc) { - FCOE_NETDEV_DBG(netdev, "Could not configure the EM " - "for the interface\n"); - goto out_lp_destroy; - } + else { + shost = vport_to_shost(vport); + n_port = shost_priv(shost); + rc = fc_exch_mgr_list_clone(n_port, lport); + } + + if (rc) { + FCOE_NETDEV_DBG(netdev, "Could not configure the EM\n"); + goto out_lp_destroy; } fcoe_interface_get(fcoe); |