Lines Matching full:hub

2  * Hub net client
20 #include "hub.h"
26 * A hub broadcasts incoming packets to all its ports except the source port.
35 NetHub *hub; member
48 static ssize_t net_hub_receive(NetHub *hub, NetHubPort *source_port, in net_hub_receive() argument
53 QLIST_FOREACH(port, &hub->ports, next) { in net_hub_receive()
63 static ssize_t net_hub_receive_iov(NetHub *hub, NetHubPort *source_port, in net_hub_receive_iov() argument
69 QLIST_FOREACH(port, &hub->ports, next) { in net_hub_receive_iov()
81 NetHub *hub; in net_hub_new() local
83 hub = g_malloc(sizeof(*hub)); in net_hub_new()
84 hub->id = id; in net_hub_new()
85 hub->num_ports = 0; in net_hub_new()
86 QLIST_INIT(&hub->ports); in net_hub_new()
88 QLIST_INSERT_HEAD(&hubs, hub, next); in net_hub_new()
90 return hub; in net_hub_new()
97 NetHub *hub = src_port->hub; in net_hub_port_can_receive() local
99 QLIST_FOREACH(port, &hub->ports, next) { in net_hub_port_can_receive()
117 return net_hub_receive(port->hub, port, buf, len); in net_hub_port_receive()
125 return net_hub_receive_iov(port->hub, port, iov, iovcnt); in net_hub_port_receive_iov()
144 static NetHubPort *net_hub_port_new(NetHub *hub, const char *name, in net_hub_port_new() argument
149 int id = hub->num_ports++; in net_hub_port_new()
154 "hub%dport%d", hub->id, id); in net_hub_port_new()
158 nc = qemu_new_net_client(&net_hub_port_info, hubpeer, "hub", name); in net_hub_port_new()
161 port->hub = hub; in net_hub_port_new()
163 QLIST_INSERT_HEAD(&hub->ports, port, next); in net_hub_port_new()
169 * Create a port on a given hub
170 * @hub_id: Number of the hub
174 * If there is no existing hub with the given id then a new hub is created.
179 NetHub *hub; in net_hub_add_port() local
182 QLIST_FOREACH(hub, &hubs, next) { in net_hub_add_port()
183 if (hub->id == hub_id) { in net_hub_add_port()
188 if (!hub) { in net_hub_add_port()
189 hub = net_hub_new(hub_id); in net_hub_add_port()
192 port = net_hub_port_new(hub, name, hubpeer); in net_hub_add_port()
197 * Print hub configuration
201 NetHub *hub; in net_hub_info() local
204 QLIST_FOREACH(hub, &hubs, next) { in net_hub_info()
205 monitor_printf(mon, "hub %d\n", hub->id); in net_hub_info()
206 QLIST_FOREACH(port, &hub->ports, next) { in net_hub_info()
219 * Get the hub id that a client is connected to
221 * @id: Pointer for hub id output, may be NULL
237 *id = port->hub->id; in net_hub_id_for_client()
266 * Warn if hub configurations are likely wrong
270 NetHub *hub; in net_hub_check_clients() local
274 QLIST_FOREACH(hub, &hubs, next) { in net_hub_check_clients()
277 QLIST_FOREACH(port, &hub->ports, next) { in net_hub_check_clients()
280 warn_report("hub port %s has no peer", port->nc.name); in net_hub_check_clients()
302 warn_report("hub %d with no nics", hub->id); in net_hub_check_clients()
305 warn_report("hub %d is not connected to host network", hub->id); in net_hub_check_clients()
316 QLIST_FOREACH(port, &source_port->hub->ports, next) { in net_hub_flush()