From patchwork Tue Jun 7 13:00:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Lieven X-Patchwork-Id: 9161201 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8347F60572 for ; Tue, 7 Jun 2016 13:28:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70FD92656B for ; Tue, 7 Jun 2016 13:28:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 65B5F27248; Tue, 7 Jun 2016 13:28:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 483872656B for ; Tue, 7 Jun 2016 13:28:34 +0000 (UTC) Received: from localhost ([::1]:49731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAH3Z-0001XP-DS for patchwork-qemu-devel@patchwork.kernel.org; Tue, 07 Jun 2016 09:28:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAGcP-0001UC-Km for qemu-devel@nongnu.org; Tue, 07 Jun 2016 09:00:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bAGcJ-00042P-9M for qemu-devel@nongnu.org; Tue, 07 Jun 2016 09:00:28 -0400 Received: from mx-v6.kamp.de ([2a02:248:0:51::16]:33897 helo=mx01.kamp.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bAGcI-0003zV-Vt for qemu-devel@nongnu.org; Tue, 07 Jun 2016 09:00:23 -0400 Received: (qmail 13139 invoked by uid 89); 7 Jun 2016 13:00:19 -0000 Received: from [195.62.97.28] by client-16-kamp (envelope-from , uid 89) with qmail-scanner-2010/03/19-MF (clamdscan: 0.99.2/21686. hbedv: 8.3.40.36/7.12.97.232. avast: 1.2.2/16060700. spamassassin: 3.4.1. Clear:RC:1(195.62.97.28):. Processed in 0.097698 secs); 07 Jun 2016 13:00:19 -0000 Received: from smtp.kamp.de (HELO submission.kamp.de) ([195.62.97.28]) by mx01.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted); 7 Jun 2016 13:00:18 -0000 X-GL_Whitelist: yes Received: (qmail 2083 invoked from network); 7 Jun 2016 13:00:18 -0000 Received: from lieven-pc.kamp-intra.net (HELO lieven-pc) (relay@kamp.de@::ffff:172.21.12.60) by submission.kamp.de with ESMTPS (DHE-RSA-AES256-GCM-SHA384 encrypted) ESMTPA; 7 Jun 2016 13:00:18 -0000 Received: by lieven-pc (Postfix, from userid 1000) id 5038E207D5; Tue, 7 Jun 2016 15:00:16 +0200 (CEST) From: Peter Lieven To: qemu-devel@nongnu.org Date: Tue, 7 Jun 2016 15:00:08 +0200 Message-Id: <1465304408-16545-1-git-send-email-pl@kamp.de> X-Mailer: git-send-email 1.9.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a02:248:0:51::16 Subject: [Qemu-devel] [PATCH V2] net: fix qemu_announce_self not emitting packets X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: s.priebe@profihost.ag, jasowang@redhat.com, Peter Lieven , qemu-stable@nongnu.org, pbonzini@redhat.com, hongyang.yang@easystack.cn Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP commit fefe2a78 accidently dropped the code path for injecting raw packets. This feature is needed for sending gratuitous ARPs after an incoming migration has completed. The result is increased network downtime for vservers where the network card is not virtio-net with the VIRTIO_NET_F_GUEST_ANNOUNCE feature. Fixes: fefe2a78abde932e0f340b21bded2c86def1d242 Cc: qemu-stable@nongnu.org Cc: hongyang.yang@easystack.cn Signed-off-by: Peter Lieven --- v1->v2: assert that only raw packets with a plain buffer come in. [Paolo] net/net.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/net/net.c b/net/net.c index 5f3e5a9..5e1b5fa 100644 --- a/net/net.c +++ b/net/net.c @@ -714,6 +714,11 @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender, NetClientState *nc = opaque; int ret; + /* we currently only support sending raw packets via qemu_send_packet_raw. + * If we want generic raw iov support we need to implement something like + * .receive_raw_iov in NetClientInfo first. */ + assert(!(flags & QEMU_NET_PACKET_FLAG_RAW) || iovcnt == 1); + if (nc->link_down) { return iov_size(iov, iovcnt); } @@ -722,7 +727,10 @@ ssize_t qemu_deliver_packet_iov(NetClientState *sender, return 0; } - if (nc->info->receive_iov) { + if (flags & QEMU_NET_PACKET_FLAG_RAW && nc->info->receive_raw) { + /* this is required for qemu_announce_self() */ + ret = nc->info->receive_raw(nc, iov[0].iov_base, iov[0].iov_len); + } else if (nc->info->receive_iov) { ret = nc->info->receive_iov(nc, iov, iovcnt); } else { ret = nc_sendv_compat(nc, iov, iovcnt, flags);