From: Hannes Reinecke Date: Fri, 15 Sep 2017 11:12:13 +0000 (+0200) Subject: scsi: fcoe: separate out fcoe_vport_remove() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=6f7f74abaec12af6becf0a471d5968bce2f389b6;p=openwrt%2Fstaging%2Fblogic.git 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 Reviewed-by: Lee Duncan Acked-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen --- 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); static void fcoe_set_vport_symbolic_name(struct fc_vport *); static void fcoe_set_port_id(struct fc_lport *, u32, struct fc_frame *); static void fcoe_fcf_get_vlan_id(struct fcoe_fcf_device *); - +static void fcoe_vport_remove(struct fc_lport *); static struct fcoe_sysfs_function_template fcoe_sysfs_templ = { .set_fcoe_ctlr_mode = fcoe_ctlr_mode, @@ -2103,30 +2103,10 @@ static void fcoe_destroy_work(struct work_struct *work) struct fcoe_ctlr *ctlr; struct fcoe_port *port; struct fcoe_interface *fcoe; - struct Scsi_Host *shost; - struct fc_host_attrs *fc_host; - unsigned long flags; - struct fc_vport *vport; - struct fc_vport *next_vport; port = container_of(work, struct fcoe_port, destroy_work); - shost = port->lport->host; - fc_host = shost_to_fc_host(shost); - - /* Loop through all the vports and mark them for deletion */ - spin_lock_irqsave(shost->host_lock, flags); - list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) { - if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) { - continue; - } else { - vport->flags |= FC_VPORT_DELETING; - queue_work(fc_host_work_q(shost), - &vport->vport_delete_work); - } - } - spin_unlock_irqrestore(shost->host_lock, flags); - flush_workqueue(fc_host_work_q(shost)); + fcoe_vport_remove(port->lport); mutex_lock(&fcoe_config_mutex); @@ -2746,6 +2726,37 @@ static int fcoe_vport_destroy(struct fc_vport *vport) return 0; } +/** + * fcoe_vport_remove() - remove attached vports + * @lport: lport for which the vports should be removed + */ +static void fcoe_vport_remove(struct fc_lport *lport) +{ + struct Scsi_Host *shost; + struct fc_host_attrs *fc_host; + unsigned long flags; + struct fc_vport *vport; + struct fc_vport *next_vport; + + shost = lport->host; + fc_host = shost_to_fc_host(shost); + + /* Loop through all the vports and mark them for deletion */ + spin_lock_irqsave(shost->host_lock, flags); + list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) { + if (vport->flags & (FC_VPORT_DEL | FC_VPORT_CREATING)) { + continue; + } else { + vport->flags |= FC_VPORT_DELETING; + queue_work(fc_host_work_q(shost), + &vport->vport_delete_work); + } + } + spin_unlock_irqrestore(shost->host_lock, flags); + + flush_workqueue(fc_host_work_q(shost)); +} + /** * fcoe_vport_disable() - change vport state * @vport: vport to bring online/offline