aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2017-09-15 07:12:13 -0400
committerMartin K. Petersen <martin.petersen@oracle.com>2017-09-15 15:44:25 -0400
commit6f7f74abaec12af6becf0a471d5968bce2f389b6 (patch)
treeb9acf5506b763bd4ceeb2676b14516ccb2125188
parent9eed785b02fec925fd6ed7272ad774a803647758 (diff)
scsi: fcoe: separate out fcoe_vport_remove()
Separate out fcoe_vport_remove() from fcoe_destroy_work(). Required for the next patch. Signed-off-by: Hannes Reinecke <hare@suse.com> Reviewed-by: Lee Duncan <lduncan@suse.com> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r--drivers/scsi/fcoe/fcoe.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index 135bdcfea7eb..617348fa4e86 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -155,7 +155,7 @@ static int fcoe_vport_disable(struct fc_vport *, bool disable);
155static void fcoe_set_vport_symbolic_name(struct fc_vport *); 155static void fcoe_set_vport_symbolic_name(struct fc_vport *);
156static void fcoe_set_port_id(struct fc_lport *, u32, struct fc_frame *); 156static void fcoe_set_port_id(struct fc_lport *, u32, struct fc_frame *);
157static void fcoe_fcf_get_vlan_id(struct fcoe_fcf_device *); 157static void fcoe_fcf_get_vlan_id(struct fcoe_fcf_device *);
158 158static void fcoe_vport_remove(struct fc_lport *);
159 159
160static struct fcoe_sysfs_function_template fcoe_sysfs_templ = { 160static struct fcoe_sysfs_function_template fcoe_sysfs_templ = {
161 .set_fcoe_ctlr_mode = fcoe_ctlr_mode, 161 .set_fcoe_ctlr_mode = fcoe_ctlr_mode,
@@ -2103,30 +2103,10 @@ static void fcoe_destroy_work(struct work_struct *work)
2103 struct fcoe_ctlr *ctlr; 2103 struct fcoe_ctlr *ctlr;
2104 struct fcoe_port *port; 2104 struct fcoe_port *port;
2105 struct fcoe_interface *fcoe; 2105 struct fcoe_interface *fcoe;
2106 struct Scsi_Host *shost;
2107 struct fc_host_attrs *fc_host;
2108 unsigned long flags;
2109 struct fc_vport *vport;
2110 struct fc_vport *next_vport;
2111 2106
2112 port = container_of(work, struct fcoe_port, destroy_work); 2107 port = container_of(work, struct fcoe_port, destroy_work);
2113 shost = port->lport->host;
2114 fc_host = shost_to_fc_host(shost);
2115
2116 /* Loop through all the vports and mark them for deletion */
2117 spin_lock_irqsave(shost->host_lock, flags);
2118 list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) {
2119 if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) {
2120 continue;
2121 } else {
2122 vport->flags |= FC_VPORT_DELETING;
2123 queue_work(fc_host_work_q(shost),
2124 &vport->vport_delete_work);
2125 }
2126 }
2127 spin_unlock_irqrestore(shost->host_lock, flags);
2128 2108
2129 flush_workqueue(fc_host_work_q(shost)); 2109 fcoe_vport_remove(port->lport);
2130 2110
2131 mutex_lock(&fcoe_config_mutex); 2111 mutex_lock(&fcoe_config_mutex);
2132 2112
@@ -2747,6 +2727,37 @@ static int fcoe_vport_destroy(struct fc_vport *vport)
2747} 2727}
2748 2728
2749/** 2729/**
2730 * fcoe_vport_remove() - remove attached vports
2731 * @lport: lport for which the vports should be removed
2732 */
2733static void fcoe_vport_remove(struct fc_lport *lport)
2734{
2735 struct Scsi_Host *shost;
2736 struct fc_host_attrs *fc_host;
2737 unsigned long flags;
2738 struct fc_vport *vport;
2739 struct fc_vport *next_vport;
2740
2741 shost = lport->host;
2742 fc_host = shost_to_fc_host(shost);
2743
2744 /* Loop through all the vports and mark them for deletion */
2745 spin_lock_irqsave(shost->host_lock, flags);
2746 list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) {
2747 if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) {
2748 continue;
2749 } else {
2750 vport->flags |= FC_VPORT_DELETING;
2751 queue_work(fc_host_work_q(shost),
2752 &vport->vport_delete_work);
2753 }
2754 }
2755 spin_unlock_irqrestore(shost->host_lock, flags);
2756
2757 flush_workqueue(fc_host_work_q(shost));
2758}
2759
2760/**
2750 * fcoe_vport_disable() - change vport state 2761 * fcoe_vport_disable() - change vport state
2751 * @vport: vport to bring online/offline 2762 * @vport: vport to bring online/offline
2752 * @disable: should the vport be disabled? 2763 * @disable: should the vport be disabled?