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()
646 static void unregister_hotplug_status_watch(struct backend_info *be) in unregister_hotplug_status_watch() argument
648 if (be->have_hotplug_status_watch) { in unregister_hotplug_status_watch()
649 unregister_xenbus_watch(&be->hotplug_status_watch); in unregister_hotplug_status_watch()
650 kfree(be->hotplug_status_watch.node); in unregister_hotplug_status_watch()
652 be->have_hotplug_status_watch = 0; in unregister_hotplug_status_watch()
659 struct backend_info *be = container_of(watch, in hotplug_status_changed() local
665 str = xenbus_read(XBT_NIL, be->dev->nodename, "hotplug-status", &len); in hotplug_status_changed()
670 xenbus_switch_state(be->dev, be->state); in hotplug_status_changed()
673 unregister_hotplug_status_watch(be); in hotplug_status_changed()
674 xenbus_rm(XBT_NIL, be->dev->nodename, "hotplug-status"); in hotplug_status_changed()
679 static int connect_ctrl_ring(struct backend_info *be) in connect_ctrl_ring() argument
681 struct xenbus_device *dev = be->dev; in connect_ctrl_ring()
682 struct xenvif *vif = be->vif; in connect_ctrl_ring()
721 static void connect(struct backend_info *be) in connect() argument
724 struct xenbus_device *dev = be->dev; in connect()
743 err = xen_net_read_mac(dev, be->vif->fe_dev_addr); in connect()
750 xen_unregister_watchers(be->vif); in connect()
751 xen_register_watchers(dev, be->vif); in connect()
752 read_xenbus_vif_flags(be); in connect()
754 err = connect_ctrl_ring(be); in connect()
761 be->vif->queues = vzalloc(array_size(requested_num_queues, in connect()
763 if (!be->vif->queues) { in connect()
769 be->vif->num_queues = requested_num_queues; in connect()
770 be->vif->stalled_queues = requested_num_queues; in connect()
773 queue = &be->vif->queues[queue_index]; in connect()
774 queue->vif = be->vif; in connect()
777 be->vif->dev->name, queue->id); in connect()
784 * earlier queues can be destroyed using the regular in connect()
787 be->vif->num_queues = queue_index; in connect()
795 err = connect_data_rings(be, queue); in connect()
803 be->vif->num_queues = queue_index; in connect()
809 xenvif_debugfs_addif(be->vif); in connect()
816 netif_set_real_num_tx_queues(be->vif->dev, requested_num_queues); in connect()
817 netif_set_real_num_rx_queues(be->vif->dev, requested_num_queues); in connect()
820 xenvif_carrier_on(be->vif); in connect()
822 unregister_hotplug_status_watch(be); in connect()
823 err = xenbus_watch_pathfmt(dev, &be->hotplug_status_watch, in connect()
827 be->have_hotplug_status_watch = 1; in connect()
829 netif_tx_wake_all_queues(be->vif->dev); in connect()
834 if (be->vif->num_queues > 0) in connect()
835 xenvif_disconnect_data(be->vif); /* Clean up existing queues */ in connect()
836 for (queue_index = 0; queue_index < be->vif->num_queues; ++queue_index) in connect()
837 xenvif_deinit_queue(&be->vif->queues[queue_index]); in connect()
838 vfree(be->vif->queues); in connect()
839 be->vif->queues = NULL; in connect()
840 be->vif->num_queues = 0; in connect()
841 xenvif_disconnect_ctrl(be->vif); in connect()
846 static int connect_data_rings(struct backend_info *be, in connect_data_rings() argument
849 struct xenbus_device *dev = be->dev; in connect_data_rings()
927 static int read_xenbus_vif_flags(struct backend_info *be) in read_xenbus_vif_flags() argument
929 struct xenvif *vif = be->vif; in read_xenbus_vif_flags()
930 struct xenbus_device *dev = be->dev; in read_xenbus_vif_flags()
953 be->vif->drain_timeout = msecs_to_jiffies(30); in read_xenbus_vif_flags()
954 be->vif->stall_timeout = 0; in read_xenbus_vif_flags()
973 read_xenbus_frontend_xdp(be, dev); in read_xenbus_vif_flags()
980 struct backend_info *be = dev_get_drvdata(&dev->dev); in netback_remove() local
982 unregister_hotplug_status_watch(be); in netback_remove()
983 if (be->vif) { in netback_remove()
985 backend_disconnect(be); in netback_remove()
986 xenvif_free(be->vif); in netback_remove()
987 be->vif = NULL; in netback_remove()
989 kfree(be->hotplug_script); in netback_remove()
990 kfree(be); in netback_remove()
1007 struct backend_info *be = kzalloc(sizeof(*be), GFP_KERNEL); in netback_probe() local
1009 if (!be) { in netback_probe()
1015 be->dev = dev; in netback_probe()
1016 dev_set_drvdata(&dev->dev, be); in netback_probe()
1128 backend_switch_state(be, XenbusStateInitWait); in netback_probe()
1137 be->hotplug_script = script; in netback_probe()
1140 err = backend_create_xenvif(be); in netback_probe()