diff options
author | Vasu Dev <vasu.dev@intel.com> | 2011-02-25 18:03:01 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2011-02-28 19:31:53 -0500 |
commit | 72fa396bf57b31e8e2a401a21a3a088c0cc6b043 (patch) | |
tree | c4094d3f8db3265dd122952867c1e8ff4e6abb63 /drivers/scsi/fcoe | |
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')
-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 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); |