Commit 463af5349a787160642f023dad10eaf0cb419fb7
1 parent
3471b757
net: add fd_readv() handler to qemu_new_vlan_client() args
This, apparently, is the style we prefer - all VLANClientState should be an argument to qemu_new_vlan_client(). Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Showing
19 changed files
with
40 additions
and
35 deletions
hw/dp8393x.c
... | ... | @@ -888,8 +888,8 @@ void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift, |
888 | 888 | s->watchdog = qemu_new_timer(vm_clock, dp8393x_watchdog, s); |
889 | 889 | s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */ |
890 | 890 | |
891 | - s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, | |
892 | - nic_receive, nic_can_receive, nic_cleanup, s); | |
891 | + s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, nic_can_receive, | |
892 | + nic_receive, NULL, nic_cleanup, s); | |
893 | 893 | |
894 | 894 | qemu_format_nic_info_str(s->vc, nd->macaddr); |
895 | 895 | qemu_register_reset(nic_reset, 0, s); | ... | ... |
hw/e1000.c
... | ... | @@ -1106,8 +1106,8 @@ static void pci_e1000_init(PCIDevice *pci_dev) |
1106 | 1106 | memset(&d->tx, 0, sizeof d->tx); |
1107 | 1107 | |
1108 | 1108 | d->vc = qdev_get_vlan_client(&d->dev.qdev, |
1109 | - e1000_receive, e1000_can_receive, | |
1110 | - e1000_cleanup, d); | |
1109 | + e1000_can_receive, e1000_receive, | |
1110 | + NULL, e1000_cleanup, d); | |
1111 | 1111 | d->vc->link_status_changed = e1000_set_link_status; |
1112 | 1112 | |
1113 | 1113 | qemu_format_nic_info_str(d->vc, macaddr); | ... | ... |
hw/eepro100.c
... | ... | @@ -1766,7 +1766,7 @@ static void nic_init(PCIDevice *pci_dev, uint32_t device) |
1766 | 1766 | nic_reset(s); |
1767 | 1767 | |
1768 | 1768 | s->vc = qdev_get_vlan_client(&d->dev.qdev, |
1769 | - nic_receive, nic_can_receive, | |
1769 | + nic_can_receive, nic_receive, NULL, | |
1770 | 1770 | nic_cleanup, s); |
1771 | 1771 | |
1772 | 1772 | qemu_format_nic_info_str(s->vc, s->macaddr); | ... | ... |
hw/etraxfs_eth.c
... | ... | @@ -593,7 +593,7 @@ void *etraxfs_eth_init(NICInfo *nd, CPUState *env, |
593 | 593 | cpu_register_physical_memory (base, 0x5c, eth->ethregs); |
594 | 594 | |
595 | 595 | eth->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
596 | - eth_receive, eth_can_receive, | |
596 | + eth_can_receive, eth_receive, NULL, | |
597 | 597 | eth_cleanup, eth); |
598 | 598 | eth->vc->opaque = eth; |
599 | 599 | eth->vc->link_status_changed = eth_set_link; | ... | ... |
hw/mcf_fec.c
... | ... | @@ -462,7 +462,7 @@ void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) |
462 | 462 | cpu_register_physical_memory(base, 0x400, s->mmio_index); |
463 | 463 | |
464 | 464 | s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
465 | - mcf_fec_receive, mcf_fec_can_receive, | |
465 | + mcf_fec_can_receive, mcf_fec_receive, NULL, | |
466 | 466 | mcf_fec_cleanup, s); |
467 | 467 | memcpy(s->macaddr, nd->macaddr, 6); |
468 | 468 | qemu_format_nic_info_str(s->vc, s->macaddr); | ... | ... |
hw/mipsnet.c
... | ... | @@ -262,7 +262,7 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) |
262 | 262 | s->irq = irq; |
263 | 263 | if (nd && nd->vlan) { |
264 | 264 | s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
265 | - mipsnet_receive, mipsnet_can_receive, | |
265 | + mipsnet_can_receive, mipsnet_receive, NULL, | |
266 | 266 | mipsnet_cleanup, s); |
267 | 267 | } else { |
268 | 268 | s->vc = NULL; | ... | ... |
hw/musicpal.c
... | ... | @@ -753,7 +753,7 @@ static void mv88w8618_eth_init(SysBusDevice *dev) |
753 | 753 | |
754 | 754 | sysbus_init_irq(dev, &s->irq); |
755 | 755 | s->vc = qdev_get_vlan_client(&dev->qdev, |
756 | - eth_receive, eth_can_receive, | |
756 | + eth_can_receive, eth_receive, NULL, | |
757 | 757 | eth_cleanup, s); |
758 | 758 | s->mmio_index = cpu_register_io_memory(0, mv88w8618_eth_readfn, |
759 | 759 | mv88w8618_eth_writefn, s); | ... | ... |
hw/ne2000.c
... | ... | @@ -757,7 +757,7 @@ void isa_ne2000_init(int base, qemu_irq irq, NICInfo *nd) |
757 | 757 | ne2000_reset(s); |
758 | 758 | |
759 | 759 | s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
760 | - ne2000_receive, ne2000_can_receive, | |
760 | + ne2000_can_receive, ne2000_receive, NULL, | |
761 | 761 | isa_ne2000_cleanup, s); |
762 | 762 | |
763 | 763 | qemu_format_nic_info_str(s->vc, s->macaddr); |
... | ... | @@ -821,7 +821,7 @@ static void pci_ne2000_init(PCIDevice *pci_dev) |
821 | 821 | qdev_get_macaddr(&d->dev.qdev, s->macaddr); |
822 | 822 | ne2000_reset(s); |
823 | 823 | s->vc = qdev_get_vlan_client(&d->dev.qdev, |
824 | - ne2000_receive, ne2000_can_receive, | |
824 | + ne2000_can_receive, ne2000_receive, NULL, | |
825 | 825 | ne2000_cleanup, s); |
826 | 826 | |
827 | 827 | qemu_format_nic_info_str(s->vc, s->macaddr); | ... | ... |
hw/pcnet.c
... | ... | @@ -1952,7 +1952,7 @@ static void pcnet_common_init(DeviceState *dev, PCNetState *s, |
1952 | 1952 | |
1953 | 1953 | qdev_get_macaddr(dev, s->macaddr); |
1954 | 1954 | s->vc = qdev_get_vlan_client(dev, |
1955 | - pcnet_receive, pcnet_can_receive, | |
1955 | + pcnet_can_receive, pcnet_receive, NULL, | |
1956 | 1956 | cleanup, s); |
1957 | 1957 | pcnet_h_reset(s); |
1958 | 1958 | register_savevm("pcnet", -1, 2, pcnet_save, pcnet_load, s); | ... | ... |
hw/qdev.c
... | ... | @@ -258,15 +258,16 @@ void qdev_connect_gpio_out(DeviceState * dev, int n, qemu_irq pin) |
258 | 258 | } |
259 | 259 | |
260 | 260 | VLANClientState *qdev_get_vlan_client(DeviceState *dev, |
261 | - IOReadHandler *fd_read, | |
262 | 261 | IOCanRWHandler *fd_can_read, |
262 | + IOReadHandler *fd_read, | |
263 | + IOReadvHandler *fd_readv, | |
263 | 264 | NetCleanup *cleanup, |
264 | 265 | void *opaque) |
265 | 266 | { |
266 | 267 | NICInfo *nd = dev->nd; |
267 | 268 | assert(nd); |
268 | - return qemu_new_vlan_client(nd->vlan, nd->model, nd->name, | |
269 | - fd_read, fd_can_read, cleanup, opaque); | |
269 | + return qemu_new_vlan_client(nd->vlan, nd->model, nd->name, fd_can_read, | |
270 | + fd_read, fd_readv, cleanup, opaque); | |
270 | 271 | } |
271 | 272 | |
272 | 273 | ... | ... |
hw/rtl8139.c
... | ... | @@ -3475,7 +3475,7 @@ static void pci_rtl8139_init(PCIDevice *dev) |
3475 | 3475 | qdev_get_macaddr(&dev->qdev, s->macaddr); |
3476 | 3476 | rtl8139_reset(s); |
3477 | 3477 | s->vc = qdev_get_vlan_client(&dev->qdev, |
3478 | - rtl8139_receive, rtl8139_can_receive, | |
3478 | + rtl8139_can_receive, rtl8139_receive, NULL, | |
3479 | 3479 | rtl8139_cleanup, s); |
3480 | 3480 | |
3481 | 3481 | qemu_format_nic_info_str(s->vc, s->macaddr); | ... | ... |
hw/smc91c111.c
... | ... | @@ -711,7 +711,7 @@ static void smc91c111_init1(SysBusDevice *dev) |
711 | 711 | smc91c111_reset(s); |
712 | 712 | |
713 | 713 | s->vc = qdev_get_vlan_client(&dev->qdev, |
714 | - smc91c111_receive, smc91c111_can_receive, | |
714 | + smc91c111_can_receive, smc91c111_receive, NULL, | |
715 | 715 | smc91c111_cleanup, s); |
716 | 716 | qemu_format_nic_info_str(s->vc, s->macaddr); |
717 | 717 | /* ??? Save/restore. */ | ... | ... |
hw/stellaris_enet.c
... | ... | @@ -405,8 +405,8 @@ static void stellaris_enet_init(SysBusDevice *dev) |
405 | 405 | qdev_get_macaddr(&dev->qdev, s->macaddr); |
406 | 406 | |
407 | 407 | s->vc = qdev_get_vlan_client(&dev->qdev, |
408 | - stellaris_enet_receive, | |
409 | 408 | stellaris_enet_can_receive, |
409 | + stellaris_enet_receive, NULL, | |
410 | 410 | stellaris_enet_cleanup, s); |
411 | 411 | qemu_format_nic_info_str(s->vc, s->macaddr); |
412 | 412 | ... | ... |
hw/usb-net.c
... | ... | @@ -1458,8 +1458,9 @@ USBDevice *usb_net_init(NICInfo *nd) |
1458 | 1458 | pstrcpy(s->dev.devname, sizeof(s->dev.devname), |
1459 | 1459 | "QEMU USB Network Interface"); |
1460 | 1460 | s->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, |
1461 | - usbnet_receive, | |
1462 | 1461 | usbnet_can_receive, |
1462 | + usbnet_receive, | |
1463 | + NULL, | |
1463 | 1464 | usbnet_cleanup, s); |
1464 | 1465 | |
1465 | 1466 | qemu_format_nic_info_str(s->vc, s->mac); | ... | ... |
hw/virtio-net.c
... | ... | @@ -606,8 +606,8 @@ VirtIODevice *virtio_net_init(DeviceState *dev) |
606 | 606 | qdev_get_macaddr(dev, n->mac); |
607 | 607 | n->status = VIRTIO_NET_S_LINK_UP; |
608 | 608 | n->vc = qdev_get_vlan_client(dev, |
609 | - virtio_net_receive, | |
610 | 609 | virtio_net_can_receive, |
610 | + virtio_net_receive, NULL, | |
611 | 611 | virtio_net_cleanup, n); |
612 | 612 | n->vc->link_status_changed = virtio_net_set_link_status; |
613 | 613 | ... | ... |
hw/xen_nic.c
... | ... | @@ -301,8 +301,8 @@ static int net_init(struct XenDevice *xendev) |
301 | 301 | |
302 | 302 | vlan = qemu_find_vlan(netdev->xendev.dev); |
303 | 303 | netdev->vs = qemu_new_vlan_client(vlan, "xen", NULL, |
304 | - net_rx_packet, net_rx_ok, NULL, | |
305 | - netdev); | |
304 | + net_rx_ok, net_rx_packet, NULL, | |
305 | + NULL, netdev); | |
306 | 306 | snprintf(netdev->vs->info_str, sizeof(netdev->vs->info_str), |
307 | 307 | "nic: xenbus vif macaddr=%s", netdev->mac); |
308 | 308 | ... | ... |
net.c
... | ... | @@ -332,8 +332,9 @@ static char *assign_name(VLANClientState *vc1, const char *model) |
332 | 332 | VLANClientState *qemu_new_vlan_client(VLANState *vlan, |
333 | 333 | const char *model, |
334 | 334 | const char *name, |
335 | - IOReadHandler *fd_read, | |
336 | 335 | IOCanRWHandler *fd_can_read, |
336 | + IOReadHandler *fd_read, | |
337 | + IOReadvHandler *fd_readv, | |
337 | 338 | NetCleanup *cleanup, |
338 | 339 | void *opaque) |
339 | 340 | { |
... | ... | @@ -344,8 +345,9 @@ VLANClientState *qemu_new_vlan_client(VLANState *vlan, |
344 | 345 | vc->name = strdup(name); |
345 | 346 | else |
346 | 347 | vc->name = assign_name(vc, model); |
347 | - vc->fd_read = fd_read; | |
348 | 348 | vc->fd_can_read = fd_can_read; |
349 | + vc->fd_read = fd_read; | |
350 | + vc->fd_readv = fd_readv; | |
349 | 351 | vc->cleanup = cleanup; |
350 | 352 | vc->opaque = opaque; |
351 | 353 | vc->vlan = vlan; |
... | ... | @@ -632,7 +634,7 @@ static int net_slirp_init(VLANState *vlan, const char *model, const char *name, |
632 | 634 | #endif |
633 | 635 | } |
634 | 636 | |
635 | - slirp_vc = qemu_new_vlan_client(vlan, model, name, slirp_receive, | |
637 | + slirp_vc = qemu_new_vlan_client(vlan, model, name, NULL, slirp_receive, | |
636 | 638 | NULL, net_slirp_cleanup, NULL); |
637 | 639 | slirp_vc->info_str[0] = '\0'; |
638 | 640 | slirp_in_use = 1; |
... | ... | @@ -1015,9 +1017,8 @@ static TAPState *net_tap_fd_init(VLANState *vlan, |
1015 | 1017 | |
1016 | 1018 | s = qemu_mallocz(sizeof(TAPState)); |
1017 | 1019 | s->fd = fd; |
1018 | - s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, | |
1019 | - NULL, tap_cleanup, s); | |
1020 | - s->vc->fd_readv = tap_receive_iov; | |
1020 | + s->vc = qemu_new_vlan_client(vlan, model, name, NULL, tap_receive, | |
1021 | + tap_receive_iov, tap_cleanup, s); | |
1021 | 1022 | qemu_set_fd_handler2(s->fd, tap_can_send, tap_send, NULL, s); |
1022 | 1023 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), "fd=%d", fd); |
1023 | 1024 | return s; |
... | ... | @@ -1351,7 +1352,7 @@ static int net_vde_init(VLANState *vlan, const char *model, |
1351 | 1352 | free(s); |
1352 | 1353 | return -1; |
1353 | 1354 | } |
1354 | - s->vc = qemu_new_vlan_client(vlan, model, name, vde_from_qemu, | |
1355 | + s->vc = qemu_new_vlan_client(vlan, model, name, NULL, vde_from_qemu, | |
1355 | 1356 | NULL, vde_cleanup, s); |
1356 | 1357 | qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s); |
1357 | 1358 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d", |
... | ... | @@ -1589,7 +1590,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, |
1589 | 1590 | s = qemu_mallocz(sizeof(NetSocketState)); |
1590 | 1591 | s->fd = fd; |
1591 | 1592 | |
1592 | - s->vc = qemu_new_vlan_client(vlan, model, name, net_socket_receive_dgram, | |
1593 | + s->vc = qemu_new_vlan_client(vlan, model, name, NULL, net_socket_receive_dgram, | |
1593 | 1594 | NULL, net_socket_cleanup, s); |
1594 | 1595 | qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s); |
1595 | 1596 | |
... | ... | @@ -1617,7 +1618,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, |
1617 | 1618 | NetSocketState *s; |
1618 | 1619 | s = qemu_mallocz(sizeof(NetSocketState)); |
1619 | 1620 | s->fd = fd; |
1620 | - s->vc = qemu_new_vlan_client(vlan, model, name, net_socket_receive, | |
1621 | + s->vc = qemu_new_vlan_client(vlan, model, name, NULL, net_socket_receive, | |
1621 | 1622 | NULL, net_socket_cleanup, s); |
1622 | 1623 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), |
1623 | 1624 | "socket: fd=%d", fd); |
... | ... | @@ -1896,7 +1897,7 @@ static int net_dump_init(Monitor *mon, VLANState *vlan, const char *device, |
1896 | 1897 | return -1; |
1897 | 1898 | } |
1898 | 1899 | |
1899 | - s->pcap_vc = qemu_new_vlan_client(vlan, device, name, dump_receive, NULL, | |
1900 | + s->pcap_vc = qemu_new_vlan_client(vlan, device, name, NULL, dump_receive, NULL, | |
1900 | 1901 | net_dump_cleanup, s); |
1901 | 1902 | snprintf(s->pcap_vc->info_str, sizeof(s->pcap_vc->info_str), |
1902 | 1903 | "dump to %s (len=%d)", filename, len); | ... | ... |
net.h
... | ... | @@ -51,8 +51,9 @@ VLANState *qemu_find_vlan(int id); |
51 | 51 | VLANClientState *qemu_new_vlan_client(VLANState *vlan, |
52 | 52 | const char *model, |
53 | 53 | const char *name, |
54 | - IOReadHandler *fd_read, | |
55 | 54 | IOCanRWHandler *fd_can_read, |
55 | + IOReadHandler *fd_read, | |
56 | + IOReadvHandler *fd_readv, | |
56 | 57 | NetCleanup *cleanup, |
57 | 58 | void *opaque); |
58 | 59 | void qemu_del_vlan_client(VLANClientState *vc); |
... | ... | @@ -129,8 +130,9 @@ void net_host_device_remove(Monitor *mon, int vlan_id, const char *device); |
129 | 130 | |
130 | 131 | void qdev_get_macaddr(DeviceState *dev, uint8_t *macaddr); |
131 | 132 | VLANClientState *qdev_get_vlan_client(DeviceState *dev, |
132 | - IOReadHandler *fd_read, | |
133 | 133 | IOCanRWHandler *fd_can_read, |
134 | + IOReadHandler *fd_read, | |
135 | + IOReadvHandler *fd_readv, | |
134 | 136 | NetCleanup *cleanup, |
135 | 137 | void *opaque); |
136 | 138 | ... | ... |
tap-win32.c
... | ... | @@ -684,7 +684,7 @@ int tap_win32_init(VLANState *vlan, const char *model, |
684 | 684 | return -1; |
685 | 685 | } |
686 | 686 | |
687 | - s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, | |
687 | + s->vc = qemu_new_vlan_client(vlan, model, name, NULL, tap_receive, | |
688 | 688 | NULL, tap_cleanup, s); |
689 | 689 | |
690 | 690 | snprintf(s->vc->info_str, sizeof(s->vc->info_str), | ... | ... |