From patchwork Fri Feb 22 14:55:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Wang X-Patchwork-Id: 1046964 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 445ZZC2YPMz9s9T for ; Sat, 23 Feb 2019 02:12:03 +1100 (AEDT) Received: from localhost ([127.0.0.1]:52396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxCUb-0003CO-7N for incoming@patchwork.ozlabs.org; Fri, 22 Feb 2019 10:12:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:34801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gxCHG-0000QT-TW for qemu-devel@nongnu.org; Fri, 22 Feb 2019 09:58:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gxCF7-0007kU-EP for qemu-devel@nongnu.org; Fri, 22 Feb 2019 09:56:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51238) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gxCF7-0006j9-2x for qemu-devel@nongnu.org; Fri, 22 Feb 2019 09:56:01 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EDE86305B889; Fri, 22 Feb 2019 14:55:47 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-32.pek2.redhat.com [10.72.12.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD69B1A7CD; Fri, 22 Feb 2019 14:55:43 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Fri, 22 Feb 2019 22:55:15 +0800 Message-Id: <1550847320-25110-9-git-send-email-jasowang@redhat.com> In-Reply-To: <1550847320-25110-1-git-send-email-jasowang@redhat.com> References: <1550847320-25110-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 22 Feb 2019 14:55:48 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 08/13] qmp: Add announce-self command 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: Jason Wang , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: "Dr. David Alan Gilbert" Add a qmp command that can trigger guest announcements. It uses its own announce-timer instance, and parameters passed to it explicitly in the command. Like most qmp commands, it's in the main thread/bql, so there's no racing with any outstanding timer. Based on work of Germano Veit Michel and Vladislav Yasevich Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang --- net/announce.c | 7 +++++++ qapi/net.json | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/net/announce.c b/net/announce.c index 070f37a..91e9a6e 100644 --- a/net/announce.c +++ b/net/announce.c @@ -12,6 +12,7 @@ #include "net/net.h" #include "qapi/clone-visitor.h" #include "qapi/qapi-visit-net.h" +#include "qapi/qapi-commands-net.h" #include "trace.h" int64_t qemu_announce_timer_step(AnnounceTimer *timer) @@ -131,3 +132,9 @@ void qemu_announce_self(AnnounceTimer *timer, AnnounceParameters *params) qemu_announce_timer_del(timer); } } + +void qmp_announce_self(AnnounceParameters *params, Error **errp) +{ + static AnnounceTimer announce_timer; + qemu_announce_self(&announce_timer, params); +} diff --git a/qapi/net.json b/qapi/net.json index 5face0c..c093087 100644 --- a/qapi/net.json +++ b/qapi/net.json @@ -707,3 +707,23 @@ 'max': 'int', 'rounds': 'int', 'step': 'int' } } + +## +# @announce-self: +# +# Trigger generation of broadcast RARP frames to update network switches. +# This can be useful when network bonds fail-over the active slave. +# +# @params: AnnounceParameters giving timing and repetition count of announce +# +# Example: +# +# -> { "execute": "announce-self" +# "arguments": { "params:" { +# "initial": 50, "max": 550, "rounds": 10, "step": 50 } } } +# <- { "return": {} } +# +# Since: 4.0 +## +{ 'command': 'announce-self', + 'data' : {'params': 'AnnounceParameters'} }