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
348 switch (ctlr->enabled) { in store_ctlr_enabled()
352 ctlr->enabled = FCOE_CTLR_DISABLED; in store_ctlr_enabled()
357 ctlr->enabled = FCOE_CTLR_ENABLED; in store_ctlr_enabled()
363 rc = ctlr->f->set_fcoe_ctlr_enabled(ctlr); in store_ctlr_enabled()
382 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_enum_name_search() local
385 name = get_fcoe_ctlr_enabled_state_name(ctlr->enabled); in fcoe_enum_name_search()
392 static FCOE_DEVICE_ATTR(ctlr, enabled, S_IRUGO | S_IWUSR,
400 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_fip_resp() local
401 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr); in store_ctlr_fip_resp()
424 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in show_ctlr_fip_resp() local
425 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr); in show_ctlr_fip_resp()
430 static FCOE_DEVICE_ATTR(ctlr, fip_vlan_responder, S_IRUGO | S_IWUSR,
454 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in store_ctlr_r_a_tov() local
459 return fcoe_ctlr_var_store(&ctlr->lp->r_a_tov, buf, count); in store_ctlr_r_a_tov()
468 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in show_ctlr_r_a_tov() local
470 return sprintf(buf, "%d\n", ctlr->lp->r_a_tov); in show_ctlr_r_a_tov()
473 static FCOE_DEVICE_ATTR(ctlr, r_a_tov, S_IRUGO | S_IWUSR,
481 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in store_ctlr_e_d_tov() local
486 return fcoe_ctlr_var_store(&ctlr->lp->e_d_tov, buf, count); in store_ctlr_e_d_tov()
495 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in show_ctlr_e_d_tov() local
497 return sprintf(buf, "%d\n", ctlr->lp->e_d_tov); in show_ctlr_e_d_tov()
500 static FCOE_DEVICE_ATTR(ctlr, e_d_tov, S_IRUGO | S_IWUSR,
508 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_private_fcoe_ctlr_fcf_dev_loss_tmo() local
517 fcoe_ctlr_fcf_dev_loss_tmo(ctlr) = val; in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
518 mutex_lock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
519 list_for_each_entry(fcf, &ctlr->fcfs, peers) in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
521 mutex_unlock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
525 static FCOE_DEVICE_ATTR(ctlr, fcf_dev_loss_tmo, S_IRUGO | S_IWUSR,
646 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_ctlr_device_release() local
647 kfree(ctlr); in fcoe_ctlr_device_release()
694 static void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_work() argument
696 if (!fcoe_ctlr_work_q(ctlr)) { in fcoe_ctlr_device_flush_work()
699 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_work()
704 flush_workqueue(fcoe_ctlr_work_q(ctlr)); in fcoe_ctlr_device_flush_work()
715 static int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_work() argument
718 if (unlikely(!fcoe_ctlr_work_q(ctlr))) { in fcoe_ctlr_device_queue_work()
721 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_work()
727 return queue_work(fcoe_ctlr_work_q(ctlr), work); in fcoe_ctlr_device_queue_work()
734 static void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_devloss() argument
736 if (!fcoe_ctlr_devloss_work_q(ctlr)) { in fcoe_ctlr_device_flush_devloss()
739 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_devloss()
744 flush_workqueue(fcoe_ctlr_devloss_work_q(ctlr)); in fcoe_ctlr_device_flush_devloss()
756 static int fcoe_ctlr_device_queue_devloss_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_devloss_work() argument
760 if (unlikely(!fcoe_ctlr_devloss_work_q(ctlr))) { in fcoe_ctlr_device_queue_devloss_work()
763 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_devloss_work()
769 return queue_delayed_work(fcoe_ctlr_devloss_work_q(ctlr), work, delay); in fcoe_ctlr_device_queue_devloss_work()
798 struct fcoe_ctlr_device *ctlr; in fcoe_ctlr_device_add() local
801 ctlr = kzalloc(sizeof(struct fcoe_ctlr_device) + priv_size, in fcoe_ctlr_device_add()
803 if (!ctlr) in fcoe_ctlr_device_add()
806 ctlr->id = atomic_inc_return(&ctlr_num) - 1; in fcoe_ctlr_device_add()
807 ctlr->f = f; in fcoe_ctlr_device_add()
808 ctlr->mode = FIP_CONN_TYPE_FABRIC; in fcoe_ctlr_device_add()
809 INIT_LIST_HEAD(&ctlr->fcfs); in fcoe_ctlr_device_add()
810 mutex_init(&ctlr->lock); in fcoe_ctlr_device_add()
811 ctlr->dev.parent = parent; in fcoe_ctlr_device_add()
812 ctlr->dev.bus = &fcoe_bus_type; in fcoe_ctlr_device_add()
813 ctlr->dev.type = &fcoe_ctlr_device_type; in fcoe_ctlr_device_add()
815 ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo; in fcoe_ctlr_device_add()
817 snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name), in fcoe_ctlr_device_add()
818 "ctlr_wq_%d", ctlr->id); in fcoe_ctlr_device_add()
819 ctlr->work_q = create_singlethread_workqueue( in fcoe_ctlr_device_add()
820 ctlr->work_q_name); in fcoe_ctlr_device_add()
821 if (!ctlr->work_q) in fcoe_ctlr_device_add()
824 snprintf(ctlr->devloss_work_q_name, in fcoe_ctlr_device_add()
825 sizeof(ctlr->devloss_work_q_name), in fcoe_ctlr_device_add()
826 "ctlr_dl_wq_%d", ctlr->id); in fcoe_ctlr_device_add()
827 ctlr->devloss_work_q = create_singlethread_workqueue( in fcoe_ctlr_device_add()
828 ctlr->devloss_work_q_name); in fcoe_ctlr_device_add()
829 if (!ctlr->devloss_work_q) in fcoe_ctlr_device_add()
832 dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id); in fcoe_ctlr_device_add()
833 error = device_register(&ctlr->dev); in fcoe_ctlr_device_add()
837 return ctlr; in fcoe_ctlr_device_add()
840 destroy_workqueue(ctlr->devloss_work_q); in fcoe_ctlr_device_add()
841 ctlr->devloss_work_q = NULL; in fcoe_ctlr_device_add()
843 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_add()
844 ctlr->work_q = NULL; in fcoe_ctlr_device_add()
846 kfree(ctlr); in fcoe_ctlr_device_add()
872 void fcoe_ctlr_device_delete(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_delete() argument
876 mutex_lock(&ctlr->lock); in fcoe_ctlr_device_delete()
878 &ctlr->fcfs, peers) { in fcoe_ctlr_device_delete()
881 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work); in fcoe_ctlr_device_delete()
883 mutex_unlock(&ctlr->lock); in fcoe_ctlr_device_delete()
885 fcoe_ctlr_device_flush_work(ctlr); in fcoe_ctlr_device_delete()
887 destroy_workqueue(ctlr->devloss_work_q); in fcoe_ctlr_device_delete()
888 ctlr->devloss_work_q = NULL; in fcoe_ctlr_device_delete()
889 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_delete()
890 ctlr->work_q = NULL; in fcoe_ctlr_device_delete()
892 device_unregister(&ctlr->dev); in fcoe_ctlr_device_delete()
907 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fcoe_fcf_device_final_delete() local
915 fcoe_ctlr_device_flush_devloss(ctlr); in fcoe_fcf_device_final_delete()
931 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fip_timeout_deleted_fcf() local
933 mutex_lock(&ctlr->lock); in fip_timeout_deleted_fcf()
949 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work); in fip_timeout_deleted_fcf()
952 mutex_unlock(&ctlr->lock); in fip_timeout_deleted_fcf()
966 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); in fcoe_fcf_device_delete() local
981 fcoe_ctlr_device_queue_devloss_work(ctlr, &fcf->dev_loss_work, in fcoe_fcf_device_delete()
993 struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr, in fcoe_fcf_device_add() argument
999 list_for_each_entry(fcf, &ctlr->fcfs, peers) { in fcoe_fcf_device_add()
1007 fcoe_ctlr_device_flush_devloss(ctlr); in fcoe_fcf_device_add()
1020 fcf->dev.parent = &ctlr->dev; in fcoe_fcf_device_add()
1026 fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo; in fcoe_fcf_device_add()
1044 list_add_tail(&fcf->peers, &ctlr->fcfs); in fcoe_fcf_device_add()