Revision bb6e6364
b/hw/dp8393x.c | ||
---|---|---|
889 | 889 |
s->watchdog = qemu_new_timer(vm_clock, dp8393x_watchdog, s); |
890 | 890 |
s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */ |
891 | 891 |
|
892 |
s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, |
|
892 |
s->vc = nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, |
|
893 |
nd->vlan, nd->netdev, |
|
893 | 894 |
nd->model, nd->name, |
894 | 895 |
nic_can_receive, nic_receive, NULL, |
895 | 896 |
nic_cleanup, s); |
b/hw/etraxfs_eth.c | ||
---|---|---|
590 | 590 |
eth->ethregs = cpu_register_io_memory(eth_read, eth_write, eth); |
591 | 591 |
cpu_register_physical_memory (base, 0x5c, eth->ethregs); |
592 | 592 |
|
593 |
eth->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, |
|
593 |
eth->vc = nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, |
|
594 |
nd->vlan, nd->netdev, |
|
594 | 595 |
nd->model, nd->name, |
595 | 596 |
eth_can_receive, eth_receive, |
596 | 597 |
NULL, eth_cleanup, eth); |
b/hw/mcf_fec.c | ||
---|---|---|
462 | 462 |
mcf_fec_writefn, s); |
463 | 463 |
cpu_register_physical_memory(base, 0x400, s->mmio_index); |
464 | 464 |
|
465 |
s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, |
|
465 |
s->vc = nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, |
|
466 |
nd->vlan, nd->netdev, |
|
466 | 467 |
nd->model, nd->name, |
467 | 468 |
mcf_fec_can_receive, mcf_fec_receive, |
468 | 469 |
NULL, mcf_fec_cleanup, s); |
b/hw/mipsnet.c | ||
---|---|---|
263 | 263 |
s->io_base = base; |
264 | 264 |
s->irq = irq; |
265 | 265 |
if (nd) { |
266 |
s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, |
|
266 |
s->vc = nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, |
|
267 |
nd->vlan, nd->netdev, |
|
267 | 268 |
nd->model, nd->name, |
268 | 269 |
mipsnet_can_receive, mipsnet_receive, |
269 | 270 |
NULL, mipsnet_cleanup, s); |
b/hw/usb-net.c | ||
---|---|---|
1460 | 1460 |
|
1461 | 1461 |
memcpy(s->mac, nd->macaddr, 6); |
1462 | 1462 |
|
1463 |
s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, |
|
1463 |
s->vc = nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, |
|
1464 |
nd->vlan, nd->netdev, |
|
1464 | 1465 |
nd->model, nd->name, |
1465 | 1466 |
usbnet_can_receive, |
1466 | 1467 |
usbnet_receive, |
b/hw/xen_nic.c | ||
---|---|---|
301 | 301 |
return -1; |
302 | 302 |
|
303 | 303 |
vlan = qemu_find_vlan(netdev->xendev.dev, 1); |
304 |
netdev->vs = qemu_new_vlan_client(vlan, NULL, "xen", NULL, |
|
304 |
netdev->vs = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, |
|
305 |
vlan, NULL, "xen", NULL, |
|
305 | 306 |
net_rx_ok, net_rx_packet, NULL, |
306 | 307 |
NULL, netdev); |
307 | 308 |
snprintf(netdev->vs->info_str, sizeof(netdev->vs->info_str), |
b/net.c | ||
---|---|---|
325 | 325 |
int iovcnt, |
326 | 326 |
void *opaque); |
327 | 327 |
|
328 |
VLANClientState *qemu_new_vlan_client(VLANState *vlan, |
|
328 |
VLANClientState *qemu_new_vlan_client(net_client_type type, |
|
329 |
VLANState *vlan, |
|
329 | 330 |
VLANClientState *peer, |
330 | 331 |
const char *model, |
331 | 332 |
const char *name, |
... | ... | |
339 | 340 |
|
340 | 341 |
vc = qemu_mallocz(sizeof(VLANClientState)); |
341 | 342 |
|
343 |
vc->type = type; |
|
342 | 344 |
vc->model = qemu_strdup(model); |
343 | 345 |
if (name) |
344 | 346 |
vc->name = qemu_strdup(name); |
... | ... | |
880 | 882 |
} |
881 | 883 |
#endif |
882 | 884 |
|
883 |
s->vc = qemu_new_vlan_client(vlan, NULL, model, name, NULL, |
|
885 |
s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_SLIRP, |
|
886 |
vlan, NULL, model, name, NULL, |
|
884 | 887 |
slirp_receive, NULL, |
885 | 888 |
net_slirp_cleanup, s); |
886 | 889 |
snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
... | ... | |
1486 | 1489 |
s = qemu_mallocz(sizeof(TAPState)); |
1487 | 1490 |
s->fd = fd; |
1488 | 1491 |
s->has_vnet_hdr = vnet_hdr != 0; |
1489 |
s->vc = qemu_new_vlan_client(vlan, NULL, model, name, NULL, |
|
1492 |
s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_TAP, |
|
1493 |
vlan, NULL, model, name, NULL, |
|
1490 | 1494 |
tap_receive, tap_receive_iov, |
1491 | 1495 |
tap_cleanup, s); |
1492 | 1496 |
tap_read_poll(s, 1); |
... | ... | |
1845 | 1849 |
free(s); |
1846 | 1850 |
return -1; |
1847 | 1851 |
} |
1848 |
s->vc = qemu_new_vlan_client(vlan, NULL, model, name, NULL, |
|
1852 |
s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_VDE, |
|
1853 |
vlan, NULL, model, name, NULL, |
|
1849 | 1854 |
vde_receive, NULL, |
1850 | 1855 |
vde_cleanup, s); |
1851 | 1856 |
qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s); |
... | ... | |
2085 | 2090 |
s = qemu_mallocz(sizeof(NetSocketState)); |
2086 | 2091 |
s->fd = fd; |
2087 | 2092 |
|
2088 |
s->vc = qemu_new_vlan_client(vlan, NULL, model, name, NULL, |
|
2093 |
s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_SOCKET, |
|
2094 |
vlan, NULL, model, name, NULL, |
|
2089 | 2095 |
net_socket_receive_dgram, NULL, |
2090 | 2096 |
net_socket_cleanup, s); |
2091 | 2097 |
qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s); |
... | ... | |
2114 | 2120 |
NetSocketState *s; |
2115 | 2121 |
s = qemu_mallocz(sizeof(NetSocketState)); |
2116 | 2122 |
s->fd = fd; |
2117 |
s->vc = qemu_new_vlan_client(vlan, NULL, model, name, NULL, |
|
2123 |
s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_SOCKET, |
|
2124 |
vlan, NULL, model, name, NULL, |
|
2118 | 2125 |
net_socket_receive, NULL, |
2119 | 2126 |
net_socket_cleanup, s); |
2120 | 2127 |
snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
... | ... | |
2396 | 2403 |
return -1; |
2397 | 2404 |
} |
2398 | 2405 |
|
2399 |
s->pcap_vc = qemu_new_vlan_client(vlan, NULL, device, name, NULL, |
|
2406 |
s->pcap_vc = qemu_new_vlan_client(NET_CLIENT_TYPE_DUMP, |
|
2407 |
vlan, NULL, device, name, NULL, |
|
2400 | 2408 |
dump_receive, NULL, |
2401 | 2409 |
net_dump_cleanup, s); |
2402 | 2410 |
snprintf(s->pcap_vc->info_str, sizeof(s->pcap_vc->info_str), |
b/net.h | ||
---|---|---|
26 | 26 |
|
27 | 27 |
/* VLANs support */ |
28 | 28 |
|
29 |
typedef enum { |
|
30 |
NET_CLIENT_TYPE_NONE, |
|
31 |
NET_CLIENT_TYPE_NIC, |
|
32 |
NET_CLIENT_TYPE_SLIRP, |
|
33 |
NET_CLIENT_TYPE_TAP, |
|
34 |
NET_CLIENT_TYPE_SOCKET, |
|
35 |
NET_CLIENT_TYPE_VDE, |
|
36 |
NET_CLIENT_TYPE_DUMP |
|
37 |
} net_client_type; |
|
38 |
|
|
29 | 39 |
typedef int (NetCanReceive)(VLANClientState *); |
30 | 40 |
typedef ssize_t (NetReceive)(VLANClientState *, const uint8_t *, size_t); |
31 | 41 |
typedef ssize_t (NetReceiveIOV)(VLANClientState *, const struct iovec *, int); |
... | ... | |
33 | 43 |
typedef void (LinkStatusChanged)(VLANClientState *); |
34 | 44 |
|
35 | 45 |
struct VLANClientState { |
46 |
net_client_type type; |
|
36 | 47 |
NetReceive *receive; |
37 | 48 |
NetReceiveIOV *receive_iov; |
38 | 49 |
/* Packets may still be sent if this returns zero. It's used to |
b/tap-win32.c | ||
---|---|---|
677 | 677 |
return -1; |
678 | 678 |
} |
679 | 679 |
|
680 |
s->vc = qemu_new_vlan_client(vlan, NULL, model, name, |
|
680 |
s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_TAP, |
|
681 |
vlan, NULL, model, name, |
|
681 | 682 |
NULL, tap_receive, |
682 | 683 |
NULL, tap_cleanup, s); |
683 | 684 |
|
Also available in: Unified diff