Lines Matching defs:fcf
29 * should insulate the loss of a fcf.
37 " insulate the loss of a fcf. Once this value is"
38 " exceeded, the fcf is removed.");
115 static int fcoe_fcf_set_dev_loss_tmo(struct fcoe_fcf_device *fcf,
118 if ((fcf->state == FCOE_FCF_STATE_UNKNOWN) ||
119 (fcf->state == FCOE_FCF_STATE_DISCONNECTED) ||
120 (fcf->state == FCOE_FCF_STATE_DELETED))
128 fcoe_fcf_dev_loss_tmo(fcf) = val;
153 struct fcoe_fcf_device *fcf = dev_to_fcf(dev); \
154 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf); \
156 ctlr->f->get_fcoe_fcf_##field(fcf); \
158 cast fcoe_fcf_##field(fcf)); \
175 struct fcoe_fcf_device *fcf = dev_to_fcf(dev); \
176 return snprintf(buf, sz, format_string, cast fcoe_fcf_##field(fcf)); \
191 static FCOE_DEVICE_ATTR(fcf, field, S_IRUGO, \
196 static FCOE_DEVICE_ATTR(fcf, field, S_IRUGO, \
206 static FCOE_DEVICE_ATTR(fcf, field, S_IRUGO, \
248 struct fcoe_fcf_device *fcf = dev_to_fcf(dev);
250 name = get_fcoe_fcf_state_name(fcf->state);
255 static FCOE_DEVICE_ATTR(fcf, state, S_IRUGO, show_fcf_state, NULL);
497 struct fcoe_fcf_device *fcf;
507 list_for_each_entry(fcf, &ctlr->fcfs, peers)
508 fcoe_fcf_set_dev_loss_tmo(fcf, val);
540 struct fcoe_fcf_device *fcf = dev_to_fcf(dev);
548 rc = fcoe_fcf_set_dev_loss_tmo(fcf, val);
553 static FCOE_DEVICE_ATTR(fcf, dev_loss_tmo, S_IRUGO | S_IWUSR,
639 * fcoe_fcf_device_release() - Release the FIP fcf memory
640 * @dev: Pointer to the fcf's embedded device
642 * Called when the last FIP fcf reference is released.
646 struct fcoe_fcf_device *fcf = dev_to_fcf(dev);
647 kfree(fcf);
874 struct fcoe_fcf_device *fcf, *next;
877 list_for_each_entry_safe(fcf, next,
879 list_del(&fcf->peers);
880 fcf->state = FCOE_FCF_STATE_DELETED;
881 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work);
898 * @work: The FIP fcf's embedded work struct
900 * It is expected that the fcf has been removed from
905 struct fcoe_fcf_device *fcf =
907 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf);
914 if (!cancel_delayed_work(&fcf->dev_loss_work))
917 device_unregister(&fcf->dev);
921 * fip_timeout_deleted_fcf() - Delete a fcf when the devloss timer fires
922 * @work: The FIP fcf's embedded work struct
924 * Removes the fcf from the FIP ctlr's list of fcfs and
929 struct fcoe_fcf_device *fcf =
931 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf);
936 * If the fcf is deleted or reconnected before the timer
939 * cancel deleting the fcf.
941 if (fcf->state != FCOE_FCF_STATE_DISCONNECTED)
944 dev_printk(KERN_ERR, &fcf->dev,
945 "FIP fcf connection time out: removing fcf\n");
947 list_del(&fcf->peers);
948 fcf->state = FCOE_FCF_STATE_DELETED;
949 fcoe_ctlr_device_queue_work(ctlr, &fcf->delete_work);
956 * fcoe_fcf_device_delete() - Delete a FIP fcf
957 * @fcf: Pointer to the fcf which is to be deleted
959 * Queues the FIP fcf on the devloss workqueue
961 * Expects the ctlr_attrs mutex to be held for fcf
964 void fcoe_fcf_device_delete(struct fcoe_fcf_device *fcf)
966 struct fcoe_ctlr_device *ctlr = fcoe_fcf_dev_to_ctlr_dev(fcf);
967 int timeout = fcf->dev_loss_tmo;
969 if (fcf->state != FCOE_FCF_STATE_CONNECTED)
972 fcf->state = FCOE_FCF_STATE_DISCONNECTED;
979 fcf->priv = NULL;
981 fcoe_ctlr_device_queue_devloss_work(ctlr, &fcf->dev_loss_work,
996 struct fcoe_fcf_device *fcf;
999 list_for_each_entry(fcf, &ctlr->fcfs, peers) {
1000 if (fcoe_fcf_device_match(new_fcf, fcf)) {
1001 if (fcf->state == FCOE_FCF_STATE_CONNECTED)
1002 return fcf;
1004 fcf->state = FCOE_FCF_STATE_CONNECTED;
1006 if (!cancel_delayed_work(&fcf->dev_loss_work))
1009 return fcf;
1013 fcf = kzalloc(sizeof(struct fcoe_fcf_device), GFP_ATOMIC);
1014 if (unlikely(!fcf))
1017 INIT_WORK(&fcf->delete_work, fcoe_fcf_device_final_delete);
1018 INIT_DELAYED_WORK(&fcf->dev_loss_work, fip_timeout_deleted_fcf);
1020 fcf->dev.parent = &ctlr->dev;
1021 fcf->dev.bus = &fcoe_bus_type;
1022 fcf->dev.type = &fcoe_fcf_device_type;
1023 fcf->id = atomic_inc_return(&fcf_num) - 1;
1024 fcf->state = FCOE_FCF_STATE_UNKNOWN;
1026 fcf->dev_loss_tmo = ctlr->fcf_dev_loss_tmo;
1028 dev_set_name(&fcf->dev, "fcf_%d", fcf->id);
1030 fcf->fabric_name = new_fcf->fabric_name;
1031 fcf->switch_name = new_fcf->switch_name;
1032 fcf->fc_map = new_fcf->fc_map;
1033 fcf->vfid = new_fcf->vfid;
1034 memcpy(fcf->mac, new_fcf->mac, ETH_ALEN);
1035 fcf->priority = new_fcf->priority;
1036 fcf->fka_period = new_fcf->fka_period;
1037 fcf->selected = new_fcf->selected;
1039 error = device_register(&fcf->dev);
1041 put_device(&fcf->dev);
1045 fcf->state = FCOE_FCF_STATE_CONNECTED;
1046 list_add_tail(&fcf->peers, &ctlr->fcfs);
1048 return fcf;