Lines Matching refs:ctlr
141 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); \
142 if (ctlr->f->get_fcoe_ctlr_##field) \
143 ctlr->f->get_fcoe_ctlr_##field(ctlr); \
145 cast fcoe_ctlr_##field(ctlr)); \
154 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); \
155 if (ctlr->f->get_fcoe_fcf_##field) \
156 ctlr->f->get_fcoe_fcf_##field(fcf); \
166 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); \
167 return snprintf(buf, sz, format_string, cast fcoe_ctlr_##field(ctlr)); \
181 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
186 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
201 static FCOE_DEVICE_ATTR(ctlr, field, S_IRUGO, \
262 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in show_ctlr_mode() local
265 name = get_fcoe_ctlr_mode_name(ctlr->mode); in show_ctlr_mode()
276 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_mode() local
289 switch (ctlr->enabled) { in store_ctlr_mode()
291 LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled.\n"); in store_ctlr_mode()
294 if (!ctlr->f->set_fcoe_ctlr_mode) { in store_ctlr_mode()
295 LIBFCOE_SYSFS_DBG(ctlr, in store_ctlr_mode()
300 ctlr->mode = fcoe_parse_mode(mode); in store_ctlr_mode()
301 if (ctlr->mode == FIP_CONN_TYPE_UNKNOWN) { in store_ctlr_mode()
302 LIBFCOE_SYSFS_DBG(ctlr, "Unknown mode %s provided.\n", in store_ctlr_mode()
307 ctlr->f->set_fcoe_ctlr_mode(ctlr); in store_ctlr_mode()
308 LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.\n", buf); in store_ctlr_mode()
313 LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.\n"); in store_ctlr_mode()
318 static FCOE_DEVICE_ATTR(ctlr, mode, S_IRUGO | S_IWUSR,
325 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_enabled() local
336 switch (ctlr->enabled) { in store_ctlr_enabled()
340 ctlr->enabled = FCOE_CTLR_DISABLED; in store_ctlr_enabled()
345 ctlr->enabled = FCOE_CTLR_ENABLED; in store_ctlr_enabled()
351 rc = ctlr->f->set_fcoe_ctlr_enabled(ctlr); in store_ctlr_enabled()
370 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_enum_name_search() local
373 name = get_fcoe_ctlr_enabled_state_name(ctlr->enabled); in fcoe_enum_name_search()
380 static FCOE_DEVICE_ATTR(ctlr, enabled, S_IRUGO | S_IWUSR,
388 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_ctlr_fip_resp() local
389 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr); in store_ctlr_fip_resp()
412 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in show_ctlr_fip_resp() local
413 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr); in show_ctlr_fip_resp()
418 static FCOE_DEVICE_ATTR(ctlr, fip_vlan_responder, S_IRUGO | S_IWUSR,
442 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in store_ctlr_r_a_tov() local
447 return fcoe_ctlr_var_store(&ctlr->lp->r_a_tov, buf, count); in store_ctlr_r_a_tov()
456 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in show_ctlr_r_a_tov() local
458 return sprintf(buf, "%d\n", ctlr->lp->r_a_tov); in show_ctlr_r_a_tov()
461 static FCOE_DEVICE_ATTR(ctlr, r_a_tov, S_IRUGO | S_IWUSR,
469 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in store_ctlr_e_d_tov() local
474 return fcoe_ctlr_var_store(&ctlr->lp->e_d_tov, buf, count); in store_ctlr_e_d_tov()
483 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev); in show_ctlr_e_d_tov() local
485 return sprintf(buf, "%d\n", ctlr->lp->e_d_tov); in show_ctlr_e_d_tov()
488 static FCOE_DEVICE_ATTR(ctlr, e_d_tov, S_IRUGO | S_IWUSR,
496 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in store_private_fcoe_ctlr_fcf_dev_loss_tmo() local
505 fcoe_ctlr_fcf_dev_loss_tmo(ctlr) = val; in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
506 mutex_lock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
507 list_for_each_entry(fcf, &ctlr->fcfs, peers) in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
509 mutex_unlock(&ctlr->lock); in store_private_fcoe_ctlr_fcf_dev_loss_tmo()
513 static FCOE_DEVICE_ATTR(ctlr, fcf_dev_loss_tmo, S_IRUGO | S_IWUSR,
634 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev); in fcoe_ctlr_device_release() local
635 kfree(ctlr); in fcoe_ctlr_device_release()
693 static void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_work() argument
695 if (!fcoe_ctlr_work_q(ctlr)) { in fcoe_ctlr_device_flush_work()
698 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_work()
703 flush_workqueue(fcoe_ctlr_work_q(ctlr)); in fcoe_ctlr_device_flush_work()
714 static int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_work() argument
717 if (unlikely(!fcoe_ctlr_work_q(ctlr))) { in fcoe_ctlr_device_queue_work()
720 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_work()
726 return queue_work(fcoe_ctlr_work_q(ctlr), work); in fcoe_ctlr_device_queue_work()
733 static void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr) in fcoe_ctlr_device_flush_devloss() argument
735 if (!fcoe_ctlr_devloss_work_q(ctlr)) { in fcoe_ctlr_device_flush_devloss()
738 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_flush_devloss()
743 flush_workqueue(fcoe_ctlr_devloss_work_q(ctlr)); in fcoe_ctlr_device_flush_devloss()
755 static int fcoe_ctlr_device_queue_devloss_work(struct fcoe_ctlr_device *ctlr, in fcoe_ctlr_device_queue_devloss_work() argument
759 if (unlikely(!fcoe_ctlr_devloss_work_q(ctlr))) { in fcoe_ctlr_device_queue_devloss_work()
762 "when no workqueue created.\n", ctlr->id); in fcoe_ctlr_device_queue_devloss_work()
768 return queue_delayed_work(fcoe_ctlr_devloss_work_q(ctlr), work, delay); in fcoe_ctlr_device_queue_devloss_work()
797 struct fcoe_ctlr_device *ctlr; in fcoe_ctlr_device_add() local
800 ctlr = kzalloc(sizeof(struct fcoe_ctlr_device) + priv_size, in fcoe_ctlr_device_add()
802 if (!ctlr) in fcoe_ctlr_device_add()
805 ctlr->id = atomic_inc_return(&ctlr_num) - 1; in fcoe_ctlr_device_add()
806 ctlr->f = f; in fcoe_ctlr_device_add()
807 ctlr->mode = FIP_CONN_TYPE_FABRIC; in fcoe_ctlr_device_add()
808 INIT_LIST_HEAD(&ctlr->fcfs); in fcoe_ctlr_device_add()
809 mutex_init(&ctlr->lock); in fcoe_ctlr_device_add()
810 ctlr->dev.parent = parent; in fcoe_ctlr_device_add()
811 ctlr->dev.bus = &fcoe_bus_type; in fcoe_ctlr_device_add()
812 ctlr->dev.type = &fcoe_ctlr_device_type; in fcoe_ctlr_device_add()
814 ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo; in fcoe_ctlr_device_add()
816 snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name), in fcoe_ctlr_device_add()
817 "ctlr_wq_%d", ctlr->id); in fcoe_ctlr_device_add()
818 ctlr->work_q = create_singlethread_workqueue( in fcoe_ctlr_device_add()
819 ctlr->work_q_name); in fcoe_ctlr_device_add()
820 if (!ctlr->work_q) in fcoe_ctlr_device_add()
823 snprintf(ctlr->devloss_work_q_name, in fcoe_ctlr_device_add()
824 sizeof(ctlr->devloss_work_q_name), in fcoe_ctlr_device_add()
825 "ctlr_dl_wq_%d", ctlr->id); in fcoe_ctlr_device_add()
826 ctlr->devloss_work_q = create_singlethread_workqueue( in fcoe_ctlr_device_add()
827 ctlr->devloss_work_q_name); in fcoe_ctlr_device_add()
828 if (!ctlr->devloss_work_q) in fcoe_ctlr_device_add()
831 dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id); in fcoe_ctlr_device_add()
832 error = device_register(&ctlr->dev); in fcoe_ctlr_device_add()
834 destroy_workqueue(ctlr->devloss_work_q); in fcoe_ctlr_device_add()
835 destroy_workqueue(ctlr->work_q); in fcoe_ctlr_device_add()
836 put_device(&ctlr->dev); in fcoe_ctlr_device_add()
840 return ctlr; 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()
1046 list_add_tail(&fcf->peers, &ctlr->fcfs); in fcoe_fcf_device_add()