All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: Jason Wang <jasowang@redhat.com>, qemu-devel@nongnu.org
Cc: thuth@redhat.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH] RFC/net: Add a net filter
Date: Mon, 27 Jul 2015 18:03:53 +0800	[thread overview]
Message-ID: <55B60209.6050401@cn.fujitsu.com> (raw)
In-Reply-To: <55B5F706.3030808@redhat.com>

On 07/27/2015 05:16 PM, Jason Wang wrote:
[...]
>>>>>> I think this won't work for the buffer case? If we want the buffer
>>>>>> case
>>>>>> to work under this, we should modify the generic netdev layer
>>>>>> code, to
>>>>>> check the return value of the filter function call.
>>>>>
>>>>> But checking return value is rather simpler than a new netdev type,
>>>>> isn't it?
>>>>
>>>> But how to implement a plugin which suppose to do the actual work on
>>>> the packets?
>>>
>>> Well, the filter get the packets, so it can do everything it wants.
>>>
>>>> how to configure params related to the plugin? different
>>>> plugins may need different params, implement as another netdev?
>>>
>>> I belive qmp can do this? something like -filter dump,id=f0,len=10000?
>>
>> So you mean implement another object filter?
>
> Yes.
>
>> and the structure is like netdev?
>
> No, it is embedded in netdev.

Ah, I see what you mean, thank you for the patience...
does the command line looks like:
-filter dump,id=f0,len=10000
-netdev tap,XXX,filter=dump

If I need both dump and packets buffering, how will the qmp be?
-filter dump,id=f0,len=10000
-filter buffer,XXX
-netdev tap,XXX,filter=dump:buffer:XXX ?
or
-netdev tap,id=bn0,XXX
-filter dump,id=f0,len=10000,netdev=bn0
-filter buffer,XXX,netdev=bn0 ?

And do you care if we add a filter list to NetClientInfo?
and modify the generic layer to deal with these filters?
E.g, init/cleanup filters, go through these filters, check
for return values, stop call peer's receiving.
This is our main concern at the beginning, we want to avoid
modify the netdev generic layer too much, and do all things
within the filter dev so that this could be a bolt-on
feature. But if you don't care about this, we could simply
implement it as you said.

>
>> That will duplicate some of the netdev layer code.
>
> Not at all, it only cares about how to deal with the packet.
>
>> Implement it as
>> a netdev can reuse the existing netdev design. And current dump is
>> implemented
>> as a netdev right?
>
> Right but it only works for hub, and that's why Thomas wrote his series
> to make it work for all other backends
>
>> even if we simply passing the packets to the filter function before
>> calling nc->info->receive{_raw}(), we might also need to implement as
>> a netdev as dump dose.
>
> Why? The reason why we still keep -netdev dump is for backward
> compatibility. If we only care about using it for new netdevs, we can
> get rid of all netdev stuffs from dump.

Thank you, I see the points.

>
>>
>>>
>>>>
>>>>>
>>>>>> And it is not as
>>>>>> extensible as we abstract the filter function to a netdev, We can
>>>>>> flexibly add/remove/change filter plugins on the fly.
>>>>>
>>>>> I don't see why we lose the flexibility like what I suggested.
>>>>> Actually,
>>>>> implement it through a netdev will complex this. E.g:
>>>>>
>>>>> -netdev tap,id=bn0  # you can use whatever backend as needed
>>>>> -netdev filter,id=f0,backend=bn0,plugin=dump
>>>>> -device e1000,netdev=f0
>>>>>
>>>>> How did you remove filter id=f0? Looks like you need also remove
>>>>> e1000 nic?
>>>>
>>>> No, when remove filter, we restore the connection between network
>>>> backend and
>>>> NIC. Just like filter does not ever exists.
>>>
>>> But e1000's peer is f0. You mean you will modify the peer pointer during
>>> filter removing?
>>
>> Yes.
>>
>>> Sounds scary.
>>>
>>>>
>>>>>
>>>>>
>>>>>
>>>>> .
>>>>>
>>>>
>>>
>>> .
>>>
>>
>
> .
>

-- 
Thanks,
Yang.

  reply	other threads:[~2015-07-27 10:04 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-13  7:39 [Qemu-devel] [PATCH v2 0/5] For QEMU 2.5: Network traffic dumping for -netdev devices Thomas Huth
2015-07-13  7:39 ` [Qemu-devel] [PATCH v2 1/5] net/dump: Add support for receive_iov function Thomas Huth
2015-07-13  7:39 ` [Qemu-devel] [PATCH v2 2/5] net/dump: Move DumpState into NetClientState Thomas Huth
2015-07-13  7:39 ` [Qemu-devel] [PATCH v2 3/5] net/dump: Rework net-dump init functions Thomas Huth
2015-07-13  7:39 ` [Qemu-devel] [PATCH v2 4/5] net/dump: Add dump option for netdev devices Thomas Huth
2015-07-13  7:39 ` [Qemu-devel] [PATCH v2 5/5] qemu options: Add information about dumpfile to help text Thomas Huth
2015-07-22  6:35 ` [Qemu-devel] [PATCH v2 0/5] For QEMU 2.5: Network traffic dumping for -netdev devices Jason Wang
2015-07-22 10:52 ` Yang Hongyang
2015-07-22 10:55   ` [Qemu-devel] [PATCH] RFC/net: Add a net filter Yang Hongyang
2015-07-22 11:06     ` Daniel P. Berrange
2015-07-22 15:16       ` Yang Hongyang
2015-07-22 13:05     ` Thomas Huth
2015-07-22 15:06       ` Yang Hongyang
2015-07-22 13:26     ` Stefan Hajnoczi
2015-07-22 14:57       ` Yang Hongyang
2015-07-23 11:57         ` Stefan Hajnoczi
2015-07-23  5:59     ` Jason Wang
2015-07-27  5:27       ` Yang Hongyang
2015-07-27  6:02         ` Yang Hongyang
2015-07-27  6:39         ` Jason Wang
2015-07-27  7:00           ` Yang Hongyang
2015-07-27  7:31             ` Jason Wang
2015-07-27  7:45               ` Yang Hongyang
2015-07-27  8:01                 ` Jason Wang
2015-07-27  8:39                   ` Yang Hongyang
2015-07-27  9:16                     ` Jason Wang
2015-07-27 10:03                       ` Yang Hongyang [this message]
2015-07-28  3:28                         ` Jason Wang
2015-07-28  4:00                           ` Yang Hongyang
2015-07-28  8:52                             ` Yang Hongyang
2015-07-28  9:19                             ` Yang Hongyang
2015-07-28  9:30                               ` Jason Wang
2015-07-28  9:41                                 ` 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=55B60209.6050401@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.