Lines Matching refs:ctlr

138 	struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);		\
139 if (ctlr->f->get_fcoe_ctlr_##field) \
140 ctlr->f->get_fcoe_ctlr_##field(ctlr); \
142 cast fcoe_ctlr_##field(ctlr)); \
151 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); \
152 if (ctlr->f->get_fcoe_fcf_##field) \
153 ctlr->f->get_fcoe_fcf_##field(fcf); \
163 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); \
164 return snprintf(buf, sz, format_string, cast fcoe_ctlr_##field(ctlr)); \
178 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
183 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
198 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
247 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in show_ctlr_mode() local
250 name = get_fcoe_ctlr_mode_name(ctlr->mode); in show_ctlr_mode()
261 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_mode() local
268 switch (ctlr->enabled) { in store_ctlr_mode()
270 LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled.\n"); in store_ctlr_mode()
273 if (!ctlr->f->set_fcoe_ctlr_mode) { in store_ctlr_mode()
274 LIBFCOE_SYSFS_DBG(ctlr, in store_ctlr_mode()
281 LIBFCOE_SYSFS_DBG(ctlr, "Unknown mode %s provided.\n", in store_ctlr_mode()
285 ctlr->mode = res; in store_ctlr_mode()
287 ctlr->f->set_fcoe_ctlr_mode(ctlr); in store_ctlr_mode()
288 LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.\n", buf); in store_ctlr_mode()
293 LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.\n"); in store_ctlr_mode()
298 static FCOE_DEVICE_ATTR(ctlr, mode, S_IRUGO | S_IWUSR,
305 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_enabled() local
316 switch (ctlr->enabled) { in store_ctlr_enabled()
320 ctlr->enabled = FCOE_CTLR_DISABLED; in store_ctlr_enabled()
325 ctlr->enabled = FCOE_CTLR_ENABLED; in store_ctlr_enabled()
331 rc = ctlr->f->set_fcoe_ctlr_enabled(ctlr); in store_ctlr_enabled()
350 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_enum_name_search() local
353 name = get_fcoe_ctlr_enabled_state_name(ctlr->enabled); in fcoe_enum_name_search()
360 static FCOE_DEVICE_ATTR(ctlr, enabled, S_IRUGO | S_IWUSR,
368 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_fip_resp() local
369 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr); in store_ctlr_fip_resp()
392 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in show_ctlr_fip_resp() local
393 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr); in show_ctlr_fip_resp()
398 static FCOE_DEVICE_ATTR(ctlr, fip_vlan_responder, S_IRUGO | S_IWUSR,
422 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in store_ctlr_r_a_tov() local
427 return fcoe_ctlr_var_store(&ctlr->lp->r_a_tov, buf, count); in store_ctlr_r_a_tov()
436 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in show_ctlr_r_a_tov() local
438 return sprintf(buf, "%d\n", ctlr->lp->r_a_tov); in show_ctlr_r_a_tov()
441 static FCOE_DEVICE_ATTR(ctlr, r_a_tov, S_IRUGO | S_IWUSR,
449 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in store_ctlr_e_d_tov() local
454 return fcoe_ctlr_var_store(&ctlr->lp->e_d_tov, buf, count); in store_ctlr_e_d_tov()
463 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in show_ctlr_e_d_tov() local
465 return sprintf(buf, "%d\n", ctlr->lp->e_d_tov); in show_ctlr_e_d_tov()
468 static FCOE_DEVICE_ATTR(ctlr, e_d_tov, S_IRUGO | S_IWUSR,
476 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_private_fcoe_ctlr_fcf_dev_loss_tmo() local
485 fcoe_ctlr_fcf_dev_loss_tmo(ctlr) = val; in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
486 mutex_lock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
487 list_for_each_entry(fcf, &ctlr->fcfs, peers) in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
489 mutex_unlock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
493 static FCOE_DEVICE_ATTR(ctlr, fcf_dev_loss_tmo, S_IRUGO | S_IWUSR,
614 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_ctlr_device_release() local
615 kfree(ctlr); in fcoe_ctlr_device_release()
673 static void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_work() argument
675 if (!fcoe_ctlr_work_q(ctlr)) { in fcoe_ctlr_device_flush_work()
678 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_work()
683 flush_workqueue(fcoe_ctlr_work_q(ctlr)); in fcoe_ctlr_device_flush_work()
694 static int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_work() argument
697 if (unlikely(!fcoe_ctlr_work_q(ctlr))) { in fcoe_ctlr_device_queue_work()
700 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_work()
706 return queue_work(fcoe_ctlr_work_q(ctlr), work); in fcoe_ctlr_device_queue_work()
713 static void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_devloss() argument
715 if (!fcoe_ctlr_devloss_work_q(ctlr)) { in fcoe_ctlr_device_flush_devloss()
718 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_devloss()
723 flush_workqueue(fcoe_ctlr_devloss_work_q(ctlr)); in fcoe_ctlr_device_flush_devloss()
735 static int fcoe_ctlr_device_queue_devloss_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_devloss_work() argument
739 if (unlikely(!fcoe_ctlr_devloss_work_q(ctlr))) { in fcoe_ctlr_device_queue_devloss_work()
742 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_devloss_work()
748 return queue_delayed_work(fcoe_ctlr_devloss_work_q(ctlr), work, delay); in fcoe_ctlr_device_queue_devloss_work()
777 struct fcoe_ctlr_device *ctlr; in fcoe_ctlr_device_add() local
780 ctlr = kzalloc(sizeof(struct fcoe_ctlr_device) + priv_size, in fcoe_ctlr_device_add()
782 if (!ctlr) in fcoe_ctlr_device_add()
785 ctlr->id = atomic_inc_return(&ctlr_num) - 1; in fcoe_ctlr_device_add()
786 ctlr->f = f; in fcoe_ctlr_device_add()
787 ctlr->mode = FIP_CONN_TYPE_FABRIC; in fcoe_ctlr_device_add()
788 INIT_LIST_HEAD(&ctlr->fcfs); in fcoe_ctlr_device_add()
789 mutex_init(&ctlr->lock); in fcoe_ctlr_device_add()
790 ctlr->dev.parent = parent; in fcoe_ctlr_device_add()
791 ctlr->dev.bus = &fcoe_bus_type; in fcoe_ctlr_device_add()
792 ctlr->dev.type = &fcoe_ctlr_device_type; in fcoe_ctlr_device_add()
794 ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo; in fcoe_ctlr_device_add()
796 ctlr->work_q = alloc_ordered_workqueue("ctlr_wq_%d", WQ_MEM_RECLAIM, in fcoe_ctlr_device_add()
797 ctlr->id); in fcoe_ctlr_device_add()
798 if (!ctlr->work_q) in fcoe_ctlr_device_add()
801 ctlr->devloss_work_q = alloc_ordered_workqueue("ctlr_dl_wq_%d", in fcoe_ctlr_device_add()
803 ctlr->id); in fcoe_ctlr_device_add()
804 if (!ctlr->devloss_work_q) in fcoe_ctlr_device_add()
807 dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id); in fcoe_ctlr_device_add()
808 error = device_register(&ctlr->dev); in fcoe_ctlr_device_add()
810 destroy_workqueue(ctlr->devloss_work_q); in fcoe_ctlr_device_add()
811 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_add()
812 put_device(&ctlr->dev); in fcoe_ctlr_device_add()
816 return ctlr; in fcoe_ctlr_device_add()
819 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_add()
820 ctlr->work_q = NULL; in fcoe_ctlr_device_add()
822 kfree(ctlr); in fcoe_ctlr_device_add()
848 void fcoe_ctlr_device_delete(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_delete() argument
852 mutex_lock(&ctlr->lock); in fcoe_ctlr_device_delete()
854 &ctlr->fcfs, peers) { in fcoe_ctlr_device_delete()
857 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work); in fcoe_ctlr_device_delete()
859 mutex_unlock(&ctlr->lock); in fcoe_ctlr_device_delete()
861 fcoe_ctlr_device_flush_work(ctlr); in fcoe_ctlr_device_delete()
863 destroy_workqueue(ctlr->devloss_work_q); in fcoe_ctlr_device_delete()
864 ctlr->devloss_work_q = NULL; in fcoe_ctlr_device_delete()
865 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_delete()
866 ctlr->work_q = NULL; in fcoe_ctlr_device_delete()
868 device_unregister(&ctlr->dev); in fcoe_ctlr_device_delete()
883 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fcoe_fcf_device_final_delete() local
891 fcoe_ctlr_device_flush_devloss(ctlr); in fcoe_fcf_device_final_delete()
907 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fip_timeout_deleted_fcf() local
909 mutex_lock(&ctlr->lock); in fip_timeout_deleted_fcf()
925 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work); in fip_timeout_deleted_fcf()
928 mutex_unlock(&ctlr->lock); in fip_timeout_deleted_fcf()
942 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fcoe_fcf_device_delete() local
957 fcoe_ctlr_device_queue_devloss_work(ctlr, &fcf->dev_loss_work, in fcoe_fcf_device_delete()
969 struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr, in fcoe_fcf_device_add() argument
975 list_for_each_entry(fcf, &ctlr->fcfs, peers) { in fcoe_fcf_device_add()
983 fcoe_ctlr_device_flush_devloss(ctlr); in fcoe_fcf_device_add()
996 fcf->dev.parent = &ctlr->dev; in fcoe_fcf_device_add()
1002 fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo; in fcoe_fcf_device_add()
1022 list_add_tail(&fcf->peers, &ctlr->fcfs); in fcoe_fcf_device_add()