From patchwork Thu Oct 18 14:56:52 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 192346 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CE0922C008F for ; Fri, 19 Oct 2012 02:02:48 +1100 (EST) Received: from localhost ([::1]:41691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOrcV-0001lg-0I for incoming@patchwork.ozlabs.org; Thu, 18 Oct 2012 11:02:47 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOrc5-00011U-L9 for qemu-devel@nongnu.org; Thu, 18 Oct 2012 11:02:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TOrbz-0004BK-3Q for qemu-devel@nongnu.org; Thu, 18 Oct 2012 11:02:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9605) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TOrby-0004BB-RL for qemu-devel@nongnu.org; Thu, 18 Oct 2012 11:02:15 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9IEv6IY009241 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 18 Oct 2012 10:57:06 -0400 Received: from localhost (ovpn-112-23.ams2.redhat.com [10.36.112.23]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9IEv5Rx023157; Thu, 18 Oct 2012 10:57:05 -0400 From: Stefan Hajnoczi To: Date: Thu, 18 Oct 2012 16:56:52 +0200 Message-Id: <1350572215-2231-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1350572215-2231-1-git-send-email-stefanha@redhat.com> References: <1350572215-2231-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Laszlo Ersek , Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 1/4] net: add public qemu_net_poll() function X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Hajnoczi The NetClientInfo .poll() callback is being called directly by hw/vhost_net.c. Create a public net.c function so callers do not depend on internals. This change is useful because later patches change net internals. Those changes shouldn't affect .poll() callers. Signed-off-by: Stefan Hajnoczi --- hw/vhost_net.c | 6 +++--- net.c | 7 +++++++ net.h | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hw/vhost_net.c b/hw/vhost_net.c index df2c4a3..6737600 100644 --- a/hw/vhost_net.c +++ b/hw/vhost_net.c @@ -160,7 +160,7 @@ int vhost_net_start(struct vhost_net *net, goto fail_start; } - net->nc->info->poll(net->nc, false); + qemu_net_poll(net->nc, false); qemu_set_fd_handler(net->backend, NULL, NULL, NULL); file.fd = net->backend; for (file.index = 0; file.index < net->dev.nvqs; ++file.index) { @@ -177,7 +177,7 @@ fail: int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file); assert(r >= 0); } - net->nc->info->poll(net->nc, true); + qemu_net_poll(net->nc, true); vhost_dev_stop(&net->dev, dev); if (net->dev.acked_features & (1 << VIRTIO_NET_F_MRG_RXBUF)) { tap_set_vnet_hdr_len(net->nc, sizeof(struct virtio_net_hdr)); @@ -197,7 +197,7 @@ void vhost_net_stop(struct vhost_net *net, int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file); assert(r >= 0); } - net->nc->info->poll(net->nc, true); + qemu_net_poll(net->nc, true); vhost_dev_stop(&net->dev, dev); if (net->dev.acked_features & (1 << VIRTIO_NET_F_MRG_RXBUF)) { tap_set_vnet_hdr_len(net->nc, sizeof(struct virtio_net_hdr)); diff --git a/net.c b/net.c index ae4bc0d..eb4f4bf 100644 --- a/net.c +++ b/net.c @@ -466,6 +466,13 @@ qemu_sendv_packet(NetClientState *nc, const struct iovec *iov, int iovcnt) return qemu_sendv_packet_async(nc, iov, iovcnt, NULL); } +void qemu_net_poll(NetClientState *nc, bool enable) +{ + if (nc->info->poll) { + nc->info->poll(nc, enable); + } +} + NetClientState *qemu_find_netdev(const char *id) { NetClientState *nc; diff --git a/net.h b/net.h index 04fda1d..763f926 100644 --- a/net.h +++ b/net.h @@ -111,6 +111,8 @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender, int iovcnt, void *opaque); +void qemu_net_poll(NetClientState *nc, bool enable); + void print_net_client(Monitor *mon, NetClientState *nc); void do_info_network(Monitor *mon);