From patchwork Thu Oct 22 16:43:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark McLoughlin X-Patchwork-Id: 36737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 299A9B7BAA for ; Fri, 23 Oct 2009 05:23:58 +1100 (EST) Received: from localhost ([127.0.0.1]:36186 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N12KJ-0004ix-68 for incoming@patchwork.ozlabs.org; Thu, 22 Oct 2009 14:23:55 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N11gj-0008TB-9x for qemu-devel@nongnu.org; Thu, 22 Oct 2009 13:43:01 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N11gL-0008Io-0e for qemu-devel@nongnu.org; Thu, 22 Oct 2009 13:42:42 -0400 Received: from [199.232.76.173] (port=53793 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N11gK-0008AH-Q9 for qemu-devel@nongnu.org; Thu, 22 Oct 2009 13:42:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:28708) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N11e1-0003JQ-5s for qemu-devel@nongnu.org; Thu, 22 Oct 2009 13:40:13 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9MGjiQJ007096 for ; Thu, 22 Oct 2009 12:45:44 -0400 Received: from blaa.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9MGjhGZ008542; Thu, 22 Oct 2009 12:45:43 -0400 Received: by blaa.localdomain (Postfix, from userid 500) id 9D01545B46; Thu, 22 Oct 2009 17:43:50 +0100 (IST) From: Mark McLoughlin To: qemu-devel@nongnu.org Date: Thu, 22 Oct 2009 17:43:42 +0100 Message-Id: <1256229830-28066-12-git-send-email-markmc@redhat.com> In-Reply-To: <1256229830-28066-1-git-send-email-markmc@redhat.com> References: <1256229830-28066-1-git-send-email-markmc@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Mark McLoughlin Subject: [Qemu-devel] [PATCH 11/19] net: add receive_raw parameter to qemu_new_vlan_client() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Trivial patch to allow supplying a receive_raw function. A future cleanup should combine this function pointer parameters into a table. Signed-off-by: Mark McLoughlin --- hw/dp8393x.c | 2 +- hw/etraxfs_eth.c | 2 +- hw/mcf_fec.c | 2 +- hw/mipsnet.c | 2 +- hw/qdev.c | 3 ++- hw/usb-net.c | 2 +- hw/xen_nic.c | 2 +- net.c | 14 ++++++++------ net.h | 1 + tap-win32.c | 2 +- 10 files changed, 18 insertions(+), 14 deletions(-) diff --git a/hw/dp8393x.c b/hw/dp8393x.c index 5622170..ae8b16e 100644 --- a/hw/dp8393x.c +++ b/hw/dp8393x.c @@ -892,7 +892,7 @@ void dp83932_init(NICInfo *nd, target_phys_addr_t base, int it_shift, s->vc = nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, nd->vlan, nd->netdev, nd->model, nd->name, - nic_can_receive, nic_receive, NULL, + nic_can_receive, nic_receive, NULL, NULL, nic_cleanup, s); qemu_format_nic_info_str(s->vc, nd->macaddr); diff --git a/hw/etraxfs_eth.c b/hw/etraxfs_eth.c index 2a583a3..ffe7082 100644 --- a/hw/etraxfs_eth.c +++ b/hw/etraxfs_eth.c @@ -594,7 +594,7 @@ void *etraxfs_eth_init(NICInfo *nd, target_phys_addr_t base, int phyaddr) nd->vlan, nd->netdev, nd->model, nd->name, eth_can_receive, eth_receive, - NULL, eth_cleanup, eth); + NULL, NULL, eth_cleanup, eth); eth->vc->opaque = eth; eth->vc->link_status_changed = eth_set_link; diff --git a/hw/mcf_fec.c b/hw/mcf_fec.c index 0567bcd..9f0d0f4 100644 --- a/hw/mcf_fec.c +++ b/hw/mcf_fec.c @@ -466,7 +466,7 @@ void mcf_fec_init(NICInfo *nd, target_phys_addr_t base, qemu_irq *irq) nd->vlan, nd->netdev, nd->model, nd->name, mcf_fec_can_receive, mcf_fec_receive, - NULL, mcf_fec_cleanup, s); + NULL, NULL, mcf_fec_cleanup, s); memcpy(s->macaddr, nd->macaddr, 6); qemu_format_nic_info_str(s->vc, s->macaddr); } diff --git a/hw/mipsnet.c b/hw/mipsnet.c index d32099f..65e1d59 100644 --- a/hw/mipsnet.c +++ b/hw/mipsnet.c @@ -267,7 +267,7 @@ void mipsnet_init (int base, qemu_irq irq, NICInfo *nd) nd->vlan, nd->netdev, nd->model, nd->name, mipsnet_can_receive, mipsnet_receive, - NULL, mipsnet_cleanup, s); + NULL, NULL, mipsnet_cleanup, s); } else { s->vc = NULL; } diff --git a/hw/qdev.c b/hw/qdev.c index bc3a0d5..38ac037 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -373,7 +373,8 @@ VLANClientState *qdev_get_vlan_client(DeviceState *dev, nd->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, nd->vlan, nd->netdev, nd->model, nd->name, - can_receive, receive, receive_iov, + can_receive, receive, + NULL, receive_iov, cleanup, opaque); return nd->vc; } diff --git a/hw/usb-net.c b/hw/usb-net.c index 2393812..9c6549c 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1465,7 +1465,7 @@ USBDevice *usb_net_init(NICInfo *nd) nd->model, nd->name, usbnet_can_receive, usbnet_receive, - NULL, + NULL, NULL, usbnet_cleanup, s); qemu_format_nic_info_str(s->vc, s->mac); diff --git a/hw/xen_nic.c b/hw/xen_nic.c index 2a179f0..75599d6 100644 --- a/hw/xen_nic.c +++ b/hw/xen_nic.c @@ -303,7 +303,7 @@ static int net_init(struct XenDevice *xendev) vlan = qemu_find_vlan(netdev->xendev.dev, 1); netdev->vs = qemu_new_vlan_client(NET_CLIENT_TYPE_NIC, vlan, NULL, "xen", NULL, - net_rx_ok, net_rx_packet, NULL, + net_rx_ok, net_rx_packet, NULL, NULL, NULL, netdev); snprintf(netdev->vs->info_str, sizeof(netdev->vs->info_str), "nic: xenbus vif macaddr=%s", netdev->mac); diff --git a/net.c b/net.c index 50d2f83..56d9de7 100644 --- a/net.c +++ b/net.c @@ -319,6 +319,7 @@ VLANClientState *qemu_new_vlan_client(net_client_type type, const char *name, NetCanReceive *can_receive, NetReceive *receive, + NetReceive *receive_raw, NetReceiveIOV *receive_iov, NetCleanup *cleanup, void *opaque) @@ -335,6 +336,7 @@ VLANClientState *qemu_new_vlan_client(net_client_type type, vc->name = assign_name(vc, model); vc->can_receive = can_receive; vc->receive = receive; + vc->receive_raw = receive_raw; vc->receive_iov = receive_iov; vc->cleanup = cleanup; vc->opaque = opaque; @@ -900,7 +902,7 @@ static int net_slirp_init(VLANState *vlan, const char *model, s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_SLIRP, vlan, NULL, model, name, NULL, - slirp_receive, NULL, + slirp_receive, NULL, NULL, net_slirp_cleanup, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "net=%s, restricted=%c", inet_ntoa(net), restricted ? 'y' : 'n'); @@ -1538,7 +1540,7 @@ static TAPState *net_tap_fd_init(VLANState *vlan, s->using_vnet_hdr = 0; s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_TAP, vlan, NULL, model, name, NULL, - tap_receive, tap_receive_iov, + tap_receive, NULL, tap_receive_iov, tap_cleanup, s); tap_read_poll(s, 1); return s; @@ -1898,7 +1900,7 @@ static int net_vde_init(VLANState *vlan, const char *model, } s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_VDE, vlan, NULL, model, name, NULL, - vde_receive, NULL, + vde_receive, NULL, NULL, vde_cleanup, s); qemu_set_fd_handler(vde_datafd(s->vde), vde_to_qemu, NULL, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "sock=%s,fd=%d", @@ -2139,7 +2141,7 @@ static NetSocketState *net_socket_fd_init_dgram(VLANState *vlan, s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_SOCKET, vlan, NULL, model, name, NULL, - net_socket_receive_dgram, NULL, + net_socket_receive_dgram, NULL, NULL, net_socket_cleanup, s); qemu_set_fd_handler(s->fd, net_socket_send_dgram, NULL, s); @@ -2169,7 +2171,7 @@ static NetSocketState *net_socket_fd_init_stream(VLANState *vlan, s->fd = fd; s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_SOCKET, vlan, NULL, model, name, NULL, - net_socket_receive, NULL, + net_socket_receive, NULL, NULL, net_socket_cleanup, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "socket: fd=%d", fd); @@ -2452,7 +2454,7 @@ static int net_dump_init(VLANState *vlan, const char *device, s->pcap_vc = qemu_new_vlan_client(NET_CLIENT_TYPE_DUMP, vlan, NULL, device, name, NULL, - dump_receive, NULL, + dump_receive, NULL, NULL, net_dump_cleanup, s); snprintf(s->pcap_vc->info_str, sizeof(s->pcap_vc->info_str), "dump to %s (len=%d)", filename, len); diff --git a/net.h b/net.h index 53d813c..6255e2b 100644 --- a/net.h +++ b/net.h @@ -62,6 +62,7 @@ VLANClientState *qemu_new_vlan_client(net_client_type type, const char *name, NetCanReceive *can_receive, NetReceive *receive, + NetReceive *receive_raw, NetReceiveIOV *receive_iov, NetCleanup *cleanup, void *opaque); diff --git a/tap-win32.c b/tap-win32.c index e2bac3e..7d92df2 100644 --- a/tap-win32.c +++ b/tap-win32.c @@ -680,7 +680,7 @@ int tap_win32_init(VLANState *vlan, const char *model, s->vc = qemu_new_vlan_client(NET_CLIENT_TYPE_TAP, vlan, NULL, model, name, NULL, tap_receive, - NULL, tap_cleanup, s); + NULL, NULL, tap_cleanup, s); snprintf(s->vc->info_str, sizeof(s->vc->info_str), "tap: ifname=%s", ifname);