From nobody Wed Apr 16 11:38:49 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551770107927754.175143164286; Mon, 4 Mar 2019 23:15:07 -0800 (PST) Received: from localhost ([127.0.0.1]:38615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h14I4-0004Hn-TI for importer@patchew.org; Tue, 05 Mar 2019 02:15:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43463) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h14G6-00032E-J5 for qemu-devel@nongnu.org; Tue, 05 Mar 2019 02:13:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h14G5-0000ky-1l for qemu-devel@nongnu.org; Tue, 05 Mar 2019 02:13:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58130) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h14G0-0000hp-V5 for qemu-devel@nongnu.org; Tue, 05 Mar 2019 02:13:00 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF7B3307E040; Tue, 5 Mar 2019 07:12:54 +0000 (UTC) Received: from jason-ThinkPad-T430s.redhat.com (ovpn-12-234.pek2.redhat.com [10.72.12.234]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09AF661B8D; Tue, 5 Mar 2019 07:12:48 +0000 (UTC) From: Jason Wang To: qemu-devel@nongnu.org, peter.maydell@linaro.org Date: Tue, 5 Mar 2019 15:12:16 +0800 Message-Id: <1551769940-22739-10-git-send-email-jasowang@redhat.com> In-Reply-To: <1551769940-22739-1-git-send-email-jasowang@redhat.com> References: <1551769940-22739-1-git-send-email-jasowang@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 05 Mar 2019 07:12:55 +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 V2 09/13] net: Add a network device specific self-announcement ability 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: Vladislav Yasevich , Jason Wang , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Dr. David Alan Gilbert" Some network devices have a capability to do self announcements (ex: virtio-net). Add infrastructure that would allow devices to expose this ability. Signed-off-by: Vladislav Yasevich Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Michael S. Tsirkin Signed-off-by: Jason Wang --- include/net/net.h | 2 ++ net/announce.c | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 075cc01..acf0451 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -60,6 +60,7 @@ typedef int (SetVnetLE)(NetClientState *, bool); typedef int (SetVnetBE)(NetClientState *, bool); typedef struct SocketReadState SocketReadState; typedef void (SocketReadStateFinalize)(SocketReadState *rs); +typedef void (NetAnnounce)(NetClientState *); =20 typedef struct NetClientInfo { NetClientDriver type; @@ -80,6 +81,7 @@ typedef struct NetClientInfo { SetVnetHdrLen *set_vnet_hdr_len; SetVnetLE *set_vnet_le; SetVnetBE *set_vnet_be; + NetAnnounce *announce; } NetClientInfo; =20 struct NetClientState { diff --git a/net/announce.c b/net/announce.c index 13ad9c2..070f37a 100644 --- a/net/announce.c +++ b/net/announce.c @@ -102,6 +102,11 @@ static void qemu_announce_self_iter(NICState *nic, voi= d *opaque) len =3D announce_self_create(buf, nic->conf->macaddr.a); =20 qemu_send_packet_raw(qemu_get_queue(nic), buf, len); + + /* if the NIC provides it's own announcement support, use it as well */ + if (nic->ncs->info->announce) { + nic->ncs->info->announce(nic->ncs); + } } static void qemu_announce_self_once(void *opaque) { --=20 2.5.0