Received: from eggs.gnu.org ([2001:4830:134:3::10]:34212) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUbsy-0004N1-8N for qemu-devel@nongnu.org; Wed, 26 Aug 2015 10:41:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUbsv-0004Oi-1p for qemu-devel@nongnu.org; Wed, 26 Aug 2015 10:41:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUbsu-0004Nq-TZ for qemu-devel@nongnu.org; Wed, 26 Aug 2015 10:41:04 -0400 From: Markus Armbruster References: <1440583182-5828-1-git-send-email-yanghy@cn.fujitsu.com> <1440583182-5828-3-git-send-email-yanghy@cn.fujitsu.com> Date: Wed, 26 Aug 2015 16:41:01 +0200 In-Reply-To: <1440583182-5828-3-git-send-email-yanghy@cn.fujitsu.com> (Yang Hongyang's message of "Wed, 26 Aug 2015 17:59:33 +0800") Message-ID: <87zj1em7sy.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v8 02/11] init/cleanup of netfilter object List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Hongyang Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com, lizhijian@cn.fujitsu.com, jasowang@redhat.com, qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com, stefanha@redhat.com Only reviewing the QAPI part. Yang Hongyang writes: > QTAILQ_ENTRY global_list but used by filter layer, so that we can > manage all filters together. > QTAILQ_ENTRY next used by netdev, filter belongs to the specific netdev is > in this queue. > This is mostly the same with init/cleanup of netdev object. > > Signed-off-by: Yang Hongyang > --- [...] > diff --git a/qapi-schema.json b/qapi-schema.json > index 4342a08..d7fb578 100644 > --- a/qapi-schema.json > +++ b/qapi-schema.json > @@ -2537,6 +2537,43 @@ > 'opts': 'NetClientOptions' } } > > ## > +# @NetFilterOptions > +# > +# A discriminated record of network filters. > +# > +# Since 2.5 > +# > +## > +{ 'union': 'NetFilterOptions', > + 'data': { } } > + > +## > +# @NetFilter > +# > +# Captures the packets of a network backend. > +# > +# @id: identifier for monitor commands > +# > +# @netdev: the network backend it attached to > +# > +# @chain: #optional accept "in","out","all", if not specified, default is "all" > +# "in" means this filter will receive packets sent to the @netdev > +# "out" means this filter will receive packets sent from the @netdev > +# "all" means this filter will receive packets both sent to/from > +# the @netdev > +# > +# @opts: filter type specific properties > +# > +# Since 2.5 > +## > +{ 'struct': 'NetFilter', > + 'data': { > + 'id': 'str', > + 'netdev': 'str', > + '*chain': 'str', > + 'opts': 'NetFilterOptions' } } > + > +## > # @InetSocketAddress > # > # Captures a socket address or address range in the Internet namespace. Let's make this a flat union instead, to reduce nesting, and therefore memory allocations and indirections. Something like { 'enum': 'NetFilterType', 'data': [] } { 'struct': NetFilterBase', 'data': { 'id': 'str', 'netdev': 'str', '*chain': 'str', 'type': 'NetFilterType' { 'union': 'NetFilter', 'base': 'NetFilterBase', 'discriminator': 'type', 'data': { } } I hope to reduce the notational overhead of such flat unions in the near future. Not sure empty unions actually work. If they don't, you can either squash adding members into this patch, or add a dummy member, and drop it when you add the real ones.