From patchwork Tue Mar 4 18:22:50 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonios Motakis X-Patchwork-Id: 326433 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 42A712C0096 for ; Wed, 5 Mar 2014 05:30:08 +1100 (EST) Received: from localhost ([::1]:47355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKu6P-0005gc-Na for incoming@patchwork.ozlabs.org; Tue, 04 Mar 2014 13:30:05 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53024) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKu5d-0005Gj-K9 for qemu-devel@nongnu.org; Tue, 04 Mar 2014 13:29:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKu5X-00066J-HN for qemu-devel@nongnu.org; Tue, 04 Mar 2014 13:29:17 -0500 Received: from mail-wg0-f43.google.com ([74.125.82.43]:37413) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKu5X-000648-CJ for qemu-devel@nongnu.org; Tue, 04 Mar 2014 13:29:11 -0500 Received: by mail-wg0-f43.google.com with SMTP id x13so4346203wgg.14 for ; Tue, 04 Mar 2014 10:28:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sVbH6FvQQAe1d9Wh5p1Iyp6r3lolS2kiVk47JjlDpek=; b=KbIG6JsJIZ6P1YN+7cs051EzecqyQx44hpJr2/FYF6nkA6v5ecQM7PTKk2P2FrZrmn IdbBv1W3APKny9mMonnEjViO91a7V1YIRFFVqEH8woKBm5aU0vEoK5T73MCyvGLQlvIO z/EbnqJt434BJBO50Yh39Vz3F0nFq0dmMyUCnJ1omJ486pIn+2I25irGUu1WZv36QITM ubR2gFPBklJqwfwHStX1eTuSIY2FPNKux5/mg3/kXeDfW7o9o7zOO5F68wndUW5mPKK8 YdksOlzNJIc2KfQutYPhV1i18xiTy9Pph3wPYIgShKgrmILpWg9y+/ApICJJIZZNHQ5e T3EQ== X-Gm-Message-State: ALoCoQmEpRSStgcrJv2mMhOPTz6y4eeZlX5S7lzfmg8EuuaVUxV23AuepKKH0d8eVW4MKmvxEe2y X-Received: by 10.194.203.200 with SMTP id ks8mr1338354wjc.61.1393957416691; Tue, 04 Mar 2014 10:23:36 -0800 (PST) Received: from localhost.localdomain (home.tvelocity.eu. [82.67.68.96]) by mx.google.com with ESMTPSA id br10sm55666369wjb.3.2014.03.04.10.23.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 04 Mar 2014 10:23:35 -0800 (PST) From: Antonios Motakis To: qemu-devel@nongnu.org, snabb-devel@googlegroups.com Date: Tue, 4 Mar 2014 19:22:50 +0100 Message-Id: <1393957383-16685-8-git-send-email-a.motakis@virtualopensystems.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1393957383-16685-1-git-send-email-a.motakis@virtualopensystems.com> References: <1393957383-16685-1-git-send-email-a.motakis@virtualopensystems.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 74.125.82.43 Cc: lukego@gmail.com, Antonios Motakis , tech@virtualopensystems.com, n.nikolaev@virtualopensystems.com, mst@redhat.com Subject: [Qemu-devel] [PATCH v9 07/20] vhost_net should call the poll callback only when it is set 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 The poll callback needs to be called when bringing up or down the vhost_net instance. As it is not mandatory for an NetClient to implement it, invoke it only when it is set. Signed-off-by: Antonios Motakis Signed-off-by: Nikolay Nikolaev --- hw/net/vhost_net.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index a1de2f4..2fa872b 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -166,7 +166,10 @@ static int vhost_net_start_one(struct vhost_net *net, goto fail_start; } - net->nc->info->poll(net->nc, false); + if (net->nc->info->poll) { + net->nc->info->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) { @@ -183,7 +186,9 @@ fail: int r = ioctl(net->dev.control, VHOST_NET_SET_BACKEND, &file); assert(r >= 0); } - net->nc->info->poll(net->nc, true); + if (net->nc->info->poll) { + net->nc->info->poll(net->nc, true); + } vhost_dev_stop(&net->dev, dev); fail_start: vhost_dev_disable_notifiers(&net->dev, dev); @@ -204,7 +209,9 @@ static void vhost_net_stop_one(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); + if (net->nc->info->poll) { + net->nc->info->poll(net->nc, true); + } vhost_dev_stop(&net->dev, dev); vhost_dev_disable_notifiers(&net->dev, dev); }