From 283c7c63f5c56c4d0340fb39093fb47e75cb122e Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Thu, 8 Oct 2009 19:58:30 +0100 Subject: net: allow NICs to be connected to netdevs Introduce a 'peer' member to VLANClientState as an alternative to a vlan. The idea being that packets are transfered directly from peer clients rather than going through a vlan. Patchworks-ID: 35516 Signed-off-by: Mark McLoughlin Signed-off-by: Anthony Liguori --- hw/dp8393x.c | 3 ++- hw/etraxfs_eth.c | 3 ++- hw/mcf_fec.c | 3 ++- hw/mipsnet.c | 5 +++-- hw/qdev.c | 6 ++++-- hw/usb-net.c | 3 ++- hw/xen_nic.c | 2 +- 7 files changed, 16 insertions(+), 9 deletions(-) (limited to 'hw') diff --git a/hw/dp8393x.c b/hw/dp8393x.c index 067831d1dc..e4caab02cf 100644 --- a/hw/dp8393x.c +++ b/hw/dp8393x.c @@ -889,7 +889,8 @@ void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift, s->watchdog = qemu_new_timer(vm_clock, dp8393x_watchdog, s); s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */ - s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, + s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, + nd->model, nd->name, nic_can_receive, nic_receive, NULL, nic_cleanup, s); diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c index 54786c5e97..a411dab0dd 100644 --- a/hw/etraxfs_eth.c +++ b/hw/etraxfs_eth.c @@ -590,7 +590,8 @@ void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr) eth->ethregs = cpu_register_io_memory(eth_read, eth_write, eth); cpu_register_physical_memory (base, 0x5c, eth->ethregs); - eth->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, + eth->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, + nd->model, nd->name, eth_can_receive, eth_receive, NULL, eth_cleanup, eth); eth->vc->opaque = eth; diff --git a/hw/mcf_fec.c b/hw/mcf_fec.c index f6d2bab12d..f9f437af67 100644 --- a/hw/mcf_fec.c +++ b/hw/mcf_fec.c @@ -462,7 +462,8 @@ void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) mcf_fec_writefn, s); cpu_register_physical_memory(base, 0x400, s->mmio_index); - s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, + s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, + nd->model, nd->name, mcf_fec_can_receive, mcf_fec_receive, NULL, mcf_fec_cleanup, s); memcpy(s->macaddr, nd->macaddr, 6); diff --git a/hw/mipsnet.c b/hw/mipsnet.c index e98c57699b..ea8b570795 100644 --- a/hw/mipsnet.c +++ b/hw/mipsnet.c @@ -262,8 +262,9 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) s->io_base = base; s->irq = irq; - if (nd && nd->vlan) { - s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, + if (nd) { + s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, + nd->model, nd->name, mipsnet_can_receive, mipsnet_receive, NULL, mipsnet_cleanup, s); } else { diff --git a/hw/qdev.c b/hw/qdev.c index 906e897554..20f931c1c6 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -370,8 +370,10 @@ VLANClientState *qdev_get_vlan_client(DeviceState *dev, { NICInfo *nd = dev->nd; assert(nd); - nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, can_receive, - receive, receive_iov, cleanup, opaque); + nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, + nd->model, nd->name, + can_receive, receive, receive_iov, + cleanup, opaque); return nd->vc; } diff --git a/hw/usb-net.c b/hw/usb-net.c index b33e32927c..5c753e0872 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1460,7 +1460,8 @@ USBDevice *usb_net_init(NICInfo *nd) memcpy(s->mac, nd->macaddr, 6); - s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->model, nd->name, + s->vc = nd->vc = qemu_new_vlan_client(nd->vlan, nd->netdev, + nd->model, nd->name, usbnet_can_receive, usbnet_receive, NULL, diff --git a/hw/xen_nic.c b/hw/xen_nic.c index c9e91999e4..b09b48a22f 100644 --- a/hw/xen_nic.c +++ b/hw/xen_nic.c @@ -301,7 +301,7 @@ static int net_init(struct XenDevice *xendev) return -1; vlan = qemu_find_vlan(netdev->xendev.dev, 1); - netdev->vs = qemu_new_vlan_client(vlan, "xen", NULL, + netdev->vs = qemu_new_vlan_client(vlan, NULL, "xen", NULL, net_rx_ok, net_rx_packet, NULL, NULL, netdev); snprintf(netdev->vs->info_str, sizeof(netdev->vs->info_str), -- cgit v1.2.3