Lines Matching refs:ctlr

153 	struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);		\
154 if (ctlr->f->get_fcoe_ctlr_##field) \
155 ctlr->f->get_fcoe_ctlr_##field(ctlr); \
157 cast fcoe_ctlr_##field(ctlr)); \
166 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); \
167 if (ctlr->f->get_fcoe_fcf_##field) \
168 ctlr->f->get_fcoe_fcf_##field(fcf); \
178 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); \
179 return snprintf(buf, sz, format_string, cast fcoe_ctlr_##field(ctlr)); \
193 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
198 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
213 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
274 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in show_ctlr_mode() local
277 name = get_fcoe_ctlr_mode_name(ctlr->mode); in show_ctlr_mode()
288 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_mode() local
301 switch (ctlr->enabled) { in store_ctlr_mode()
303 LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled.\n"); in store_ctlr_mode()
306 if (!ctlr->f->set_fcoe_ctlr_mode) { in store_ctlr_mode()
307 LIBFCOE_SYSFS_DBG(ctlr, in store_ctlr_mode()
312 ctlr->mode = fcoe_parse_mode(mode); in store_ctlr_mode()
313 if (ctlr->mode == FIP_CONN_TYPE_UNKNOWN) { in store_ctlr_mode()
314 LIBFCOE_SYSFS_DBG(ctlr, "Unknown mode %s provided.\n", in store_ctlr_mode()
319 ctlr->f->set_fcoe_ctlr_mode(ctlr); in store_ctlr_mode()
320 LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.\n", buf); in store_ctlr_mode()
325 LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.\n"); in store_ctlr_mode()
330 static FCOE_DEVICE_ATTR(ctlr, mode, S_IRUGO | S_IWUSR,
337 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_enabled() local
340 switch (ctlr->enabled) { in store_ctlr_enabled()
344 ctlr->enabled = FCOE_CTLR_DISABLED; in store_ctlr_enabled()
349 ctlr->enabled = FCOE_CTLR_ENABLED; in store_ctlr_enabled()
355 rc = ctlr->f->set_fcoe_ctlr_enabled(ctlr); in store_ctlr_enabled()
374 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_enum_name_search() local
377 name = get_fcoe_ctlr_enabled_state_name(ctlr->enabled); in fcoe_enum_name_search()
384 static FCOE_DEVICE_ATTR(ctlr, enabled, S_IRUGO | S_IWUSR,
393 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_private_fcoe_ctlr_fcf_dev_loss_tmo() local
402 fcoe_ctlr_fcf_dev_loss_tmo(ctlr) = val; in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
403 mutex_lock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
404 list_for_each_entry(fcf, &ctlr->fcfs, peers) in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
406 mutex_unlock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
410 static FCOE_DEVICE_ATTR(ctlr, fcf_dev_loss_tmo, S_IRUGO | S_IWUSR,
528 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_ctlr_device_release() local
529 kfree(ctlr); in fcoe_ctlr_device_release()
576 static void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_work() argument
578 if (!fcoe_ctlr_work_q(ctlr)) { in fcoe_ctlr_device_flush_work()
581 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_work()
586 flush_workqueue(fcoe_ctlr_work_q(ctlr)); in fcoe_ctlr_device_flush_work()
597 static int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_work() argument
600 if (unlikely(!fcoe_ctlr_work_q(ctlr))) { in fcoe_ctlr_device_queue_work()
603 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_work()
609 return queue_work(fcoe_ctlr_work_q(ctlr), work); in fcoe_ctlr_device_queue_work()
616 static void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_devloss() argument
618 if (!fcoe_ctlr_devloss_work_q(ctlr)) { in fcoe_ctlr_device_flush_devloss()
621 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_devloss()
626 flush_workqueue(fcoe_ctlr_devloss_work_q(ctlr)); in fcoe_ctlr_device_flush_devloss()
638 static int fcoe_ctlr_device_queue_devloss_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_devloss_work() argument
642 if (unlikely(!fcoe_ctlr_devloss_work_q(ctlr))) { in fcoe_ctlr_device_queue_devloss_work()
645 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_devloss_work()
651 return queue_delayed_work(fcoe_ctlr_devloss_work_q(ctlr), work, delay); in fcoe_ctlr_device_queue_devloss_work()
680 struct fcoe_ctlr_device *ctlr; in fcoe_ctlr_device_add() local
683 ctlr = kzalloc(sizeof(struct fcoe_ctlr_device) + priv_size, in fcoe_ctlr_device_add()
685 if (!ctlr) in fcoe_ctlr_device_add()
688 ctlr->id = atomic_inc_return(&ctlr_num) - 1; in fcoe_ctlr_device_add()
689 ctlr->f = f; in fcoe_ctlr_device_add()
690 ctlr->mode = FIP_CONN_TYPE_FABRIC; in fcoe_ctlr_device_add()
691 INIT_LIST_HEAD(&ctlr->fcfs); in fcoe_ctlr_device_add()
692 mutex_init(&ctlr->lock); in fcoe_ctlr_device_add()
693 ctlr->dev.parent = parent; in fcoe_ctlr_device_add()
694 ctlr->dev.bus = &fcoe_bus_type; in fcoe_ctlr_device_add()
695 ctlr->dev.type = &fcoe_ctlr_device_type; in fcoe_ctlr_device_add()
697 ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo; in fcoe_ctlr_device_add()
699 snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name), in fcoe_ctlr_device_add()
700 "ctlr_wq_%d", ctlr->id); in fcoe_ctlr_device_add()
701 ctlr->work_q = create_singlethread_workqueue( in fcoe_ctlr_device_add()
702 ctlr->work_q_name); in fcoe_ctlr_device_add()
703 if (!ctlr->work_q) in fcoe_ctlr_device_add()
706 snprintf(ctlr->devloss_work_q_name, in fcoe_ctlr_device_add()
707 sizeof(ctlr->devloss_work_q_name), in fcoe_ctlr_device_add()
708 "ctlr_dl_wq_%d", ctlr->id); in fcoe_ctlr_device_add()
709 ctlr->devloss_work_q = create_singlethread_workqueue( in fcoe_ctlr_device_add()
710 ctlr->devloss_work_q_name); in fcoe_ctlr_device_add()
711 if (!ctlr->devloss_work_q) in fcoe_ctlr_device_add()
714 dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id); in fcoe_ctlr_device_add()
715 error = device_register(&ctlr->dev); in fcoe_ctlr_device_add()
719 return ctlr; in fcoe_ctlr_device_add()
722 destroy_workqueue(ctlr->devloss_work_q); in fcoe_ctlr_device_add()
723 ctlr->devloss_work_q = NULL; in fcoe_ctlr_device_add()
725 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_add()
726 ctlr->work_q = NULL; in fcoe_ctlr_device_add()
728 kfree(ctlr); in fcoe_ctlr_device_add()
754 void fcoe_ctlr_device_delete(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_delete() argument
758 mutex_lock(&ctlr->lock); in fcoe_ctlr_device_delete()
760 &ctlr->fcfs, peers) { in fcoe_ctlr_device_delete()
763 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work); in fcoe_ctlr_device_delete()
765 mutex_unlock(&ctlr->lock); in fcoe_ctlr_device_delete()
767 fcoe_ctlr_device_flush_work(ctlr); in fcoe_ctlr_device_delete()
769 destroy_workqueue(ctlr->devloss_work_q); in fcoe_ctlr_device_delete()
770 ctlr->devloss_work_q = NULL; in fcoe_ctlr_device_delete()
771 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_delete()
772 ctlr->work_q = NULL; in fcoe_ctlr_device_delete()
774 device_unregister(&ctlr->dev); in fcoe_ctlr_device_delete()
789 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fcoe_fcf_device_final_delete() local
797 fcoe_ctlr_device_flush_devloss(ctlr); in fcoe_fcf_device_final_delete()
813 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fip_timeout_deleted_fcf() local
815 mutex_lock(&ctlr->lock); in fip_timeout_deleted_fcf()
831 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work); in fip_timeout_deleted_fcf()
834 mutex_unlock(&ctlr->lock); in fip_timeout_deleted_fcf()
848 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fcoe_fcf_device_delete() local
863 fcoe_ctlr_device_queue_devloss_work(ctlr, &fcf->dev_loss_work, in fcoe_fcf_device_delete()
875 struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr, in fcoe_fcf_device_add() argument
881 list_for_each_entry(fcf, &ctlr->fcfs, peers) { in fcoe_fcf_device_add()
889 fcoe_ctlr_device_flush_devloss(ctlr); in fcoe_fcf_device_add()
902 fcf->dev.parent = &ctlr->dev; in fcoe_fcf_device_add()
908 fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo; in fcoe_fcf_device_add()
926 list_add_tail(&fcf->peers, &ctlr->fcfs); in fcoe_fcf_device_add()