Lines Matching full:be
13 static int connect_data_rings(struct backend_info *be,
15 static void connect(struct backend_info *be);
16 static int read_xenbus_vif_flags(struct backend_info *be);
17 static int backend_create_xenvif(struct backend_info *be);
18 static void unregister_hotplug_status_watch(struct backend_info *be);
20 static void set_backend_state(struct backend_info *be,
206 struct backend_info *be = dev_get_drvdata(&xdev->dev); in netback_uevent() local
208 if (!be) in netback_uevent()
211 if (add_uevent_var(env, "script=%s", be->hotplug_script)) in netback_uevent()
214 if (!be->vif) in netback_uevent()
217 return add_uevent_var(env, "vif=%s", be->vif->dev->name); in netback_uevent()
221 static int backend_create_xenvif(struct backend_info *be) in backend_create_xenvif() argument
225 struct xenbus_device *dev = be->dev; in backend_create_xenvif()
228 if (be->vif != NULL) in backend_create_xenvif()
243 be->vif = vif; in backend_create_xenvif()
244 vif->be = be; in backend_create_xenvif()
250 static void backend_disconnect(struct backend_info *be) in backend_disconnect() argument
252 struct xenvif *vif = be->vif; in backend_disconnect()
264 /* At this point some of the handlers may still be active in backend_disconnect()
280 static void backend_connect(struct backend_info *be) in backend_connect() argument
282 if (be->vif) in backend_connect()
283 connect(be); in backend_connect()
286 static inline void backend_switch_state(struct backend_info *be, in backend_switch_state() argument
289 struct xenbus_device *dev = be->dev; in backend_switch_state()
292 be->state = state; in backend_switch_state()
297 if (!be->have_hotplug_status_watch) in backend_switch_state()
321 static void set_backend_state(struct backend_info *be, in set_backend_state() argument
324 while (be->state != state) { in set_backend_state()
325 switch (be->state) { in set_backend_state()
331 backend_switch_state(be, XenbusStateInitWait); in set_backend_state()
334 backend_switch_state(be, XenbusStateClosed); in set_backend_state()
344 backend_switch_state(be, XenbusStateInitWait); in set_backend_state()
347 backend_switch_state(be, XenbusStateClosing); in set_backend_state()
356 backend_connect(be); in set_backend_state()
357 backend_switch_state(be, XenbusStateConnected); in set_backend_state()
361 backend_switch_state(be, XenbusStateClosing); in set_backend_state()
372 backend_disconnect(be); in set_backend_state()
373 backend_switch_state(be, XenbusStateClosing); in set_backend_state()
384 backend_switch_state(be, XenbusStateClosed); in set_backend_state()
396 static void read_xenbus_frontend_xdp(struct backend_info *be, in read_xenbus_frontend_xdp() argument
399 struct xenvif *vif = be->vif; in read_xenbus_frontend_xdp()
420 struct backend_info *be = dev_get_drvdata(&dev->dev); in frontend_changed() local
424 be->frontend_state = frontend_state; in frontend_changed()
428 set_backend_state(be, XenbusStateInitWait); in frontend_changed()
435 set_backend_state(be, XenbusStateConnected); in frontend_changed()
439 read_xenbus_frontend_xdp(be, dev); in frontend_changed()
444 set_backend_state(be, XenbusStateClosing); in frontend_changed()
448 set_backend_state(be, XenbusStateClosed); in frontend_changed()
453 set_backend_state(be, XenbusStateClosed); in frontend_changed()
650 static void unregister_hotplug_status_watch(struct backend_info *be) in unregister_hotplug_status_watch() argument
652 if (be->have_hotplug_status_watch) { in unregister_hotplug_status_watch()
653 unregister_xenbus_watch(&be->hotplug_status_watch); in unregister_hotplug_status_watch()
654 kfree(be->hotplug_status_watch.node); in unregister_hotplug_status_watch()
656 be->have_hotplug_status_watch = 0; in unregister_hotplug_status_watch()
663 struct backend_info *be = container_of(watch, in hotplug_status_changed() local
669 str = xenbus_read(XBT_NIL, be->dev->nodename, "hotplug-status", &len); in hotplug_status_changed()
674 xenbus_switch_state(be->dev, be->state); in hotplug_status_changed()
677 unregister_hotplug_status_watch(be); in hotplug_status_changed()
682 static int connect_ctrl_ring(struct backend_info *be) in connect_ctrl_ring() argument
684 struct xenbus_device *dev = be->dev; in connect_ctrl_ring()
685 struct xenvif *vif = be->vif; in connect_ctrl_ring()
724 static void connect(struct backend_info *be) in connect() argument
727 struct xenbus_device *dev = be->dev; in connect()
746 err = xen_net_read_mac(dev, be->vif->fe_dev_addr); in connect()
753 xen_unregister_watchers(be->vif); in connect()
754 xen_register_watchers(dev, be->vif); in connect()
755 read_xenbus_vif_flags(be); in connect()
757 err = connect_ctrl_ring(be); in connect()
764 be->vif->queues = vzalloc(array_size(requested_num_queues, in connect()
766 if (!be->vif->queues) { in connect()
772 be->vif->num_queues = requested_num_queues; in connect()
773 be->vif->stalled_queues = requested_num_queues; in connect()
776 queue = &be->vif->queues[queue_index]; in connect()
777 queue->vif = be->vif; in connect()
780 be->vif->dev->name, queue->id); in connect()
787 * earlier queues can be destroyed using the regular in connect()
790 be->vif->num_queues = queue_index; in connect()
798 err = connect_data_rings(be, queue); in connect()
806 be->vif->num_queues = queue_index; in connect()
812 xenvif_debugfs_addif(be->vif); in connect()
819 netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); in connect()
820 netif_set_real_num_rx_queues(be->vif->dev, requested_num_queues); in connect()
823 xenvif_carrier_on(be->vif); in connect()
825 unregister_hotplug_status_watch(be); in connect()
826 err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, NULL, in connect()
830 be->have_hotplug_status_watch = 1; in connect()
832 netif_tx_wake_all_queues(be->vif->dev); in connect()
837 if (be->vif->num_queues > 0) in connect()
838 xenvif_disconnect_data(be->vif); /* Clean up existing queues */ in connect()
839 for (queue_index = 0; queue_index < be->vif->num_queues; ++queue_index) in connect()
840 xenvif_deinit_queue(&be->vif->queues[queue_index]); in connect()
841 vfree(be->vif->queues); in connect()
842 be->vif->queues = NULL; in connect()
843 be->vif->num_queues = 0; in connect()
844 xenvif_disconnect_ctrl(be->vif); in connect()
849 static int connect_data_rings(struct backend_info *be, in connect_data_rings() argument
852 struct xenbus_device *dev = be->dev; in connect_data_rings()
929 static int read_xenbus_vif_flags(struct backend_info *be) in read_xenbus_vif_flags() argument
931 struct xenvif *vif = be->vif; in read_xenbus_vif_flags()
932 struct xenbus_device *dev = be->dev; in read_xenbus_vif_flags()
955 be->vif->drain_timeout = msecs_to_jiffies(30); in read_xenbus_vif_flags()
956 be->vif->stall_timeout = 0; in read_xenbus_vif_flags()
975 read_xenbus_frontend_xdp(be, dev); in read_xenbus_vif_flags()
982 struct backend_info *be = dev_get_drvdata(&dev->dev); in netback_remove() local
984 unregister_hotplug_status_watch(be); in netback_remove()
986 if (be->vif) { in netback_remove()
988 backend_disconnect(be); in netback_remove()
989 xenvif_free(be->vif); in netback_remove()
990 be->vif = NULL; in netback_remove()
992 kfree(be->hotplug_script); in netback_remove()
993 kfree(be); in netback_remove()
1009 struct backend_info *be = kzalloc(sizeof(*be), GFP_KERNEL); in netback_probe() local
1011 if (!be) { in netback_probe()
1017 be->dev = dev; in netback_probe()
1018 dev_set_drvdata(&dev->dev, be); in netback_probe()
1130 backend_switch_state(be, XenbusStateInitWait); in netback_probe()
1139 be->hotplug_script = script; in netback_probe()
1142 err = backend_create_xenvif(be); in netback_probe()