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);
265 name = get_fcoe_ctlr_mode_name(ctlr->mode);
276 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
289 switch (ctlr->enabled) {
291 LIBFCOE_SYSFS_DBG(ctlr, "Cannot change mode when enabled.\n");
294 if (!ctlr->f->set_fcoe_ctlr_mode) {
295 LIBFCOE_SYSFS_DBG(ctlr,
300 ctlr->mode = fcoe_parse_mode(mode);
301 if (ctlr->mode == FIP_CONN_TYPE_UNKNOWN) {
302 LIBFCOE_SYSFS_DBG(ctlr, "Unknown mode %s provided.\n",
307 ctlr->f->set_fcoe_ctlr_mode(ctlr);
308 LIBFCOE_SYSFS_DBG(ctlr, "Mode changed to %s.\n", buf);
313 LIBFCOE_SYSFS_DBG(ctlr, "Mode change not supported.\n");
318 static FCOE_DEVICE_ATTR(ctlr, mode, S_IRUGO | S_IWUSR,
325 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
336 switch (ctlr->enabled) {
340 ctlr->enabled = FCOE_CTLR_DISABLED;
345 ctlr->enabled = FCOE_CTLR_ENABLED;
351 rc = ctlr->f->set_fcoe_ctlr_enabled(ctlr);
370 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
373 name = get_fcoe_ctlr_enabled_state_name(ctlr->enabled);
380 static FCOE_DEVICE_ATTR(ctlr, enabled, S_IRUGO | S_IWUSR,
388 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
389 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr);
412 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
413 struct fcoe_ctlr *fip = fcoe_ctlr_device_priv(ctlr);
418 static FCOE_DEVICE_ATTR(ctlr, fip_vlan_responder, S_IRUGO | S_IWUSR,
442 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev);
447 return fcoe_ctlr_var_store(&ctlr->lp->r_a_tov, buf, count);
456 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev);
458 return sprintf(buf, "%d\n", ctlr->lp->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);
474 return fcoe_ctlr_var_store(&ctlr->lp->e_d_tov, buf, count);
483 struct fcoe_ctlr *ctlr = fcoe_ctlr_device_priv(ctlr_dev);
485 return sprintf(buf, "%d\n", ctlr->lp->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);
505 fcoe_ctlr_fcf_dev_loss_tmo(ctlr) = val;
506 mutex_lock(&ctlr->lock);
507 list_for_each_entry(fcf, &ctlr->fcfs, peers)
509 mutex_unlock(&ctlr->lock);
513 static FCOE_DEVICE_ATTR(ctlr, fcf_dev_loss_tmo, S_IRUGO | S_IWUSR,
627 * fcoe_ctlr_device_release() - Release the FIP ctlr memory
628 * @dev: Pointer to the FIP ctlr's embedded device
630 * Called when the last FIP ctlr reference is released.
634 struct fcoe_ctlr_device *ctlr = dev_to_ctlr(dev);
635 kfree(ctlr);
690 * fcoe_ctlr_device_flush_work() - Flush a FIP ctlr's workqueue
691 * @ctlr: Pointer to the FIP ctlr whose workqueue is to be flushed
693 static void fcoe_ctlr_device_flush_work(struct fcoe_ctlr_device *ctlr)
695 if (!fcoe_ctlr_work_q(ctlr)) {
698 "when no workqueue created.\n", ctlr->id);
703 flush_workqueue(fcoe_ctlr_work_q(ctlr));
707 * fcoe_ctlr_device_queue_work() - Schedule work for a FIP ctlr's workqueue
708 * @ctlr: Pointer to the FIP ctlr who owns the devloss workqueue
714 static int fcoe_ctlr_device_queue_work(struct fcoe_ctlr_device *ctlr,
717 if (unlikely(!fcoe_ctlr_work_q(ctlr))) {
720 "when no workqueue created.\n", ctlr->id);
726 return queue_work(fcoe_ctlr_work_q(ctlr), work);
730 * fcoe_ctlr_device_flush_devloss() - Flush a FIP ctlr's devloss workqueue
731 * @ctlr: Pointer to FIP ctlr whose workqueue is to be flushed
733 static void fcoe_ctlr_device_flush_devloss(struct fcoe_ctlr_device *ctlr)
735 if (!fcoe_ctlr_devloss_work_q(ctlr)) {
738 "when no workqueue created.\n", ctlr->id);
743 flush_workqueue(fcoe_ctlr_devloss_work_q(ctlr));
747 * fcoe_ctlr_device_queue_devloss_work() - Schedule work for a FIP ctlr's devloss workqueue
748 * @ctlr: Pointer to the FIP ctlr who owns the devloss workqueue
755 static int fcoe_ctlr_device_queue_devloss_work(struct fcoe_ctlr_device *ctlr,
759 if (unlikely(!fcoe_ctlr_devloss_work_q(ctlr))) {
762 "when no workqueue created.\n", ctlr->id);
768 return queue_delayed_work(fcoe_ctlr_devloss_work_q(ctlr), work, delay);
783 * fcoe_ctlr_device_add() - Add a FIP ctlr to sysfs
789 * This routine allocates a FIP ctlr object with some additional memory
790 * for the LLD. The FIP ctlr is initialized, added to sysfs and then
797 struct fcoe_ctlr_device *ctlr;
800 ctlr = kzalloc(sizeof(struct fcoe_ctlr_device) + priv_size,
802 if (!ctlr)
805 ctlr->id = atomic_inc_return(&ctlr_num) - 1;
806 ctlr->f = f;
807 ctlr->mode = FIP_CONN_TYPE_FABRIC;
808 INIT_LIST_HEAD(&ctlr->fcfs);
809 mutex_init(&ctlr->lock);
810 ctlr->dev.parent = parent;
811 ctlr->dev.bus = &fcoe_bus_type;
812 ctlr->dev.type = &fcoe_ctlr_device_type;
814 ctlr->fcf_dev_loss_tmo = fcoe_fcf_dev_loss_tmo;
816 snprintf(ctlr->work_q_name, sizeof(ctlr->work_q_name),
817 "ctlr_wq_%d", ctlr->id);
818 ctlr->work_q = create_singlethread_workqueue(
819 ctlr->work_q_name);
820 if (!ctlr->work_q)
823 snprintf(ctlr->devloss_work_q_name,
824 sizeof(ctlr->devloss_work_q_name),
825 "ctlr_dl_wq_%d", ctlr->id);
826 ctlr->devloss_work_q = create_singlethread_workqueue(
827 ctlr->devloss_work_q_name);
828 if (!ctlr->devloss_work_q)
831 dev_set_name(&ctlr->dev, "ctlr_%d", ctlr->id);
832 error = device_register(&ctlr->dev);
834 destroy_workqueue(ctlr->devloss_work_q);
835 destroy_workqueue(ctlr->work_q);
836 put_device(&ctlr->dev);
840 return ctlr;
843 destroy_workqueue(ctlr->work_q);
844 ctlr->work_q = NULL;
846 kfree(ctlr);
853 * fcoe_ctlr_device_delete() - Delete a FIP ctlr and its subtree from sysfs
854 * @ctlr: A pointer to the ctlr to be deleted
856 * Deletes a FIP ctlr and any fcfs attached
860 * The ctlr is detached from sysfs and it's resources
872 void fcoe_ctlr_device_delete(struct fcoe_ctlr_device *ctlr)
876 mutex_lock(&ctlr->lock);
878 &ctlr->fcfs, peers) {
881 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work);
883 mutex_unlock(&ctlr->lock);
885 fcoe_ctlr_device_flush_work(ctlr);
887 destroy_workqueue(ctlr->devloss_work_q);
888 ctlr->devloss_work_q = NULL;
889 destroy_workqueue(ctlr->work_q);
890 ctlr->work_q = NULL;
892 device_unregister(&ctlr->dev);
901 * the FIP ctlr's list before calling this routine.
907 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf);
915 fcoe_ctlr_device_flush_devloss(ctlr);
924 * Removes the fcf from the FIP ctlr's list of fcfs and
931 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf);
933 mutex_lock(&ctlr->lock);
949 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work);
952 mutex_unlock(&ctlr->lock);
966 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf);
981 fcoe_ctlr_device_queue_devloss_work(ctlr, &fcf->dev_loss_work,
988 * @ctlr: The fcoe_ctlr_device that will be the fcoe_fcf_device parent
991 * Expects to be called with the ctlr->lock held
993 struct fcoe_fcf_device *fcoe_fcf_device_add(struct fcoe_ctlr_device *ctlr,
999 list_for_each_entry(fcf, &ctlr->fcfs, peers) {
1007 fcoe_ctlr_device_flush_devloss(ctlr);
1020 fcf->dev.parent = &ctlr->dev;
1026 fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo;
1046 list_add_tail(&fcf->peers, &ctlr->fcfs);