qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>
Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com,
	lizhijian@cn.fujitsu.com, jasowang@redhat.com,
	qemu-devel@nongnu.org, mrhines@linux.vnet.ibm.com,
	Luiz Capitulino <lcapitulino@redhat.com>,
	stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v8 03/11] netfilter: add netfilter_{add|del} commands
Date: Mon, 31 Aug 2015 09:36:34 +0800	[thread overview]
Message-ID: <55E3AFA2.1040702@cn.fujitsu.com> (raw)
In-Reply-To: <87k2sfabku.fsf@blackfin.pond.sub.org>

On 08/28/2015 07:37 PM, Markus Armbruster wrote:
> Eric Blake <eblake@redhat.com> writes:
>
>> On 08/26/2015 09:17 AM, Markus Armbruster wrote:
>>> Only reviewing QAPI/QMP and HMP interface parts for now.
>>>
>>> I apologize for not having reviewed this series earlier.  v8 is awfully
>>> late for the kind of review comments I have.
>>
>> And I've also been behind the curve, intending to review this since it
>> touches API, but not getting there yet.
>>
>>
>>>> +##
>>>> +{ 'command': 'netfilter_add',
>>>> +  'data': {
>>>> +    'type': 'str',
>>>> +    'id':   'str',
>>>> +    'netdev': 'str',
>>>> +    '*chain': 'str',
>>>> +    '*props': '**'}, 'gen': false }
>>>
>>> I figure you're merely following netdev_add precedence here (can't fault
>>> you for that), but netdev_add cheats, and we shouldn't add more cheats.
>>>
>>> First, 'gen': false is best avoided.  It suppresses the generated
>>> marshaller, and that lets you cheat.  There are cases where we can't do
>>> without, but I don't think this is one.
>>>
>>> When we suppress the generated marshaller, 'data' is at best a
>>> declaration of intent; the code can do something else entirely.  For
>>> instance, netdev_add declares
>>>
>>>      { 'command': 'netdev_add',
>>>        'data': {'type': 'str', 'id': 'str', '*props': '**'},
>>>        'gen': false }
>>>
>>> but the '*props' part is a bald-faced lie: it doesn't take a 'props'
>>> argument.  See
>>> http://lists.gnu.org/archive/html/qemu-devel/2015-08/msg00460.html
>>> and maybe even slides 37-38 of
>>> https://events.linuxfoundation.org/sites/events/files/slides/armbru-qemu-introspection.pdf
>>>
>>> I didn't check your code, but I suspect yours is a lie, too.
>>>
>>> I intend to clean up netdev_add, hopefully soon.
>>>
>>> You should use a proper QAPI data type here.  I guess the flat union I
>>> sketched in my reply to PATCH 2 would do nicely, except we don't support
>>> commands with union type data, yet.  I expect to add support to clean up
>>> netdev_del.
>>
>> In fact, I've already proposed adding such support:
>>
>> http://thread.gmane.org/gmane.comp.emulators.qemu/356265/focus=356291
>
> In my review queue.  Which has become sickeningly long again...
>
>>>
>>> If you don't want to wait for that (understandable!), then I suggest you
>>> keep 'NetFilter' a struct type for now, use it as command data here, and
>>> we convert it to a flat union later.  Must be done before the release,
>>> to avoid backward incompatibility.
>>>
>>> Then this becomes something like:
>>>
>>>      { 'command': 'netfilter-add', 'data': 'NetFilter' }
>>
>> or use NetFilter as a union, but have the command be:
>>
>> { 'command': 'netfilter-add',
>>    'data': { 'data': 'NetFilter' } }
>>
>> where you have to pass an extra layer of nesting at the QMP layer.
>>
>>>
>>> If you need the command to take arguments you don't want to put into
>>> NetFilter for some reason, I can help you achieve that cleanly.
>>
>> In fact, having the 'NetFilter' union be a single argument of a larger
>> struct makes that larger struct the nice place to stick any additional
>> arguments that don't need to be part of the union.
>
> To make progress, I suggest you try the following:
>
> 1. Make NetFilter a flat union, as I suggested in my review of PATCH 2.
>
> 2. Use Eric's idea above, because it avoids the dependency on code
>     that's still under review.
>
> Drawback: extra layer of nesting.  Ugly, but not the end of the world,
> and we still have a chance to peel it off before the next release.

Thanks for the explanation, I will try to see if I can fully understand
your point.

>
> [...]
> .
>

-- 
Thanks,
Yang.

  reply	other threads:[~2015-08-31  1:36 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-26  9:59 [Qemu-devel] [PATCH v8 00/11] Add a netfilter object and netbuffer filter Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 01/11] net: add a new object netfilter Yang Hongyang
2015-08-26 14:04   ` Markus Armbruster
2015-08-27  2:34     ` Yang Hongyang
2015-08-28 11:29       ` Markus Armbruster
2015-08-31  1:31         ` Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 02/11] init/cleanup of netfilter object Yang Hongyang
2015-08-26 13:13   ` Thomas Huth
2015-08-26 14:41   ` Markus Armbruster
2015-08-26 15:31     ` Eric Blake
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 03/11] netfilter: add netfilter_{add|del} commands Yang Hongyang
2015-08-26 15:17   ` Markus Armbruster
2015-08-26 15:37     ` Eric Blake
2015-08-28 11:37       ` Markus Armbruster
2015-08-31  1:36         ` Yang Hongyang [this message]
2015-08-31  7:08           ` Markus Armbruster
2015-08-31  9:01             ` Yang Hongyang
2015-08-31 14:53               ` Eric Blake
2015-09-01  1:24                 ` Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 04/11] netfilter: hook packets before net queue send Yang Hongyang
2015-08-27 14:35   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 05/11] move out net queue structs define Yang Hongyang
2015-08-27 14:38   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 06/11] netfilter: add an API to pass the packet to next filter Yang Hongyang
2015-08-27 15:11   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 07/11] netfilter: print filter info associate with the netdev Yang Hongyang
2015-08-27 14:46   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 08/11] net/queue: export qemu_net_queue_append_iov Yang Hongyang
2015-08-27 15:05   ` Thomas Huth
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 09/11] netfilter: add a netbuffer filter Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 10/11] filter/buffer: update command description and help Yang Hongyang
2015-08-26 15:55   ` Markus Armbruster
2015-08-27  2:42     ` Yang Hongyang
2015-08-28 11:42       ` Markus Armbruster
2015-08-31  1:30         ` Yang Hongyang
2015-08-26  9:59 ` [Qemu-devel] [PATCH v8 11/11] tests: add test cases for netfilter object Yang Hongyang
2015-08-26 15:58 ` [Qemu-devel] [PATCH v8 00/11] Add a netfilter object and netbuffer filter Markus Armbruster
2015-08-27  2:25   ` Yang Hongyang
2015-08-27  1:05 ` Thomas Huth
2015-08-27  2:24   ` Yang Hongyang
2015-08-27  3:15 ` Jason Wang
2015-08-31  1:43   ` Yang Hongyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55E3AFA2.1040702@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=armbru@redhat.com \
    --cc=eblake@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=mrhines@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).