qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v8 02/11] init/cleanup of netfilter object


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v8 02/11] init/cleanup of netfilter object
Date: Wed, 26 Aug 2015 16:41:01 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Only reviewing the QAPI part.

Yang Hongyang <address@hidden> 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 <address@hidden>
> ---
[...]
> 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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]