All of lore.kernel.org
 help / color / mirror / Atom feed
From: zhanghailiang <zhang.zhanghailiang@huawei.com>
To: Yang Hongyang <yanghy@cn.fujitsu.com>, qemu-devel@nongnu.org
Cc: thuth@redhat.com, jasowang@redhat.com,
	peter.huangpeng@huawei.com, mrhines@linux.vnet.ibm.com,
	stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH 0/9] For QEMU 2.5: Add a net filter and a netbuffer plugin based on the filter
Date: Sat, 25 Jul 2015 13:06:28 +0800	[thread overview]
Message-ID: <55B31954.9000406@huawei.com> (raw)
In-Reply-To: <1437735359-17415-1-git-send-email-yanghy@cn.fujitsu.com>

On 2015/7/24 18:55, Yang Hongyang wrote:
> This patch add a net filter between network backend and NIC devices.
> All packets will pass by this filter.
> Also implement a netbuffer plugin for example, the netbuffer plugin
> could be used by VM FT solutions like Macrocheckpointing,
> to buffer/release packets.
> Based on this, dump plugin could be easily implemented.
>
> I've done some simple tests on this series,
> backend, tap,user
> NIC, e1000,virtio-net
>
> There's still some missing functions to be done, I've posted this
> early in order to gain more comments, thank you!
>
> TODO:
>    multiqueue support.
>
>                  +--------------+       +-------------+
>    +----------+  |    filter    |       |frontend(NIC)|
>    |      peer+-->              |       |             |
>    | network  <--+backend       <-------+ peer        |
>    | backend  |  |         peer +------->             |
>    +----------+  +--------------+       +-------------+
>
> Usage:
>    -netdev tap,id=bn0  # you can use whatever backend as needed
>    -netdev filter,id=f0,backend=bn0
>    -netdev filter-<plugin>,id=p0,filter=f0
>    -device e1000,netdev=f0

Have you considered Daniel's suggestion ? Using the bellow style:
   -netfilter id=f0,plugin=dump
   -netdev tap,id=bn0,filter=f0
   -device e1000,netdev=bn0

Considering the filter as a new 'netdev' seems to be unreasonable,
Whenever we add a new plugin, we have to add a new member to
'NetClientOptions', there will be lots of 'filter' objects in NetClientOptions
area. Besides when we want to describe a net device with several filter plugin for VM,
it will become like:
    -netdev tap,id=bn0
    -netdev filter,id=f0,backend=bn0
    -netdev filter-<plugin-0>,id=p0,filter=f0
    -netdev filter-<plugin-1>,id=p1,filter=f1
    ... ...
    -device e1000,netdev=f0
Which is a little verbose for 'netdev' option.
We'd better come to an agreement on the command line style for net filter :)

Cc: Daniel P. Berrange <berrange@redhat.com>

Thanks,
zhanghailiang

> NOTE:
>    You can attach multiple plugins to the filter, dynamically add/remove
> filter and filter-<plugin>.
>
> The netbuffer plugin:
> Usage:
>    -netdev tap,id=bn0  # you can use whatever backend as needed
>    -netdev filter,id=f0,backend=bn0
>    -netdev filter-buffer,id=p0,filter=f0
>    -device e1000,netdev=f0
>
> Will supply a public API to release the buffer. But there's no
> callers currently.
> To test this feature, it's quite simple, just use
> netdev_add filter-buffer,id=p0,filter=f0
> to buffer packets,
> netdev_del p0
> will release packets.
>
> You can also implement whatever plugin you needed based on this filter.
>
> Yang Hongyang (9):
>    netdev: Add a net filter
>    virtio-net: add filter support
>    filter: remove plugins when remove filter
>    filter: remove filter before remove network backend
>    filter: add netbuffer plugin
>    introduce qemu_find_net_clients_by_model
>    net/queue: export qemu_net_queue_append
>    move out net queue structs define
>    add a public api to release buffer
>
>   hw/net/virtio-net.c  |  17 ++-
>   include/net/filter.h |  21 ++++
>   include/net/net.h    |   5 +
>   include/net/queue.h  |  26 ++++
>   net/Makefile.objs    |   2 +
>   net/clients.h        |   6 +
>   net/filter-buffer.c  | 185 ++++++++++++++++++++++++++++
>   net/filter.c         | 331 +++++++++++++++++++++++++++++++++++++++++++++++++++
>   net/net.c            |  51 +++++++-
>   net/queue.c          |  31 +----
>   qapi-schema.json     |  40 ++++++-
>   11 files changed, 679 insertions(+), 36 deletions(-)
>   create mode 100644 include/net/filter.h
>   create mode 100644 net/filter-buffer.c
>   create mode 100644 net/filter.c
>

  parent reply	other threads:[~2015-07-25  5:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-24 10:55 [Qemu-devel] [PATCH 0/9] For QEMU 2.5: Add a net filter and a netbuffer plugin based on the filter Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 1/9] netdev: Add a net filter Yang Hongyang
2015-07-27 12:38   ` Thomas Huth
2015-07-27 13:15     ` Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 2/9] virtio-net: add filter support Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 3/9] filter: remove plugins when remove filter Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 4/9] filter: remove filter before remove network backend Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 5/9] filter: add netbuffer plugin Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 6/9] introduce qemu_find_net_clients_by_model Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 7/9] net/queue: export qemu_net_queue_append Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 8/9] move out net queue structs define Yang Hongyang
2015-07-24 10:55 ` [Qemu-devel] [PATCH 9/9] add a public api to release buffer Yang Hongyang
2015-07-25  5:06 ` zhanghailiang [this message]
2015-07-26 14:13   ` [Qemu-devel] [PATCH 0/9] For QEMU 2.5: Add a net filter and a netbuffer plugin based on the filter Yang Hongyang
2015-07-27 10:32     ` Daniel P. Berrange
2015-07-27 13:23       ` Yang Hongyang
2015-07-27  4:53 ` Jason Wang
2015-07-27  5:01   ` Yang Hongyang
2015-07-29 10:34 ` 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=55B31954.9000406@huawei.com \
    --to=zhang.zhanghailiang@huawei.com \
    --cc=jasowang@redhat.com \
    --cc=mrhines@linux.vnet.ibm.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=yanghy@cn.fujitsu.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.