From: Yang Hongyang <yanghy@cn.fujitsu.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com,
lizhijian@cn.fujitsu.com, jasowang@redhat.com,
qemu-devel@nongnu.org, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v11 02/12] init/cleanup of netfilter object
Date: Fri, 25 Sep 2015 09:13:00 +0800 [thread overview]
Message-ID: <56049F9C.5090900@cn.fujitsu.com> (raw)
In-Reply-To: <8737y4nizg.fsf@blackfin.pond.sub.org>
On 09/24/2015 07:40 PM, Markus Armbruster wrote:
> Yang Hongyang <yanghy@cn.fujitsu.com> writes:
>
>> On 09/24/2015 04:41 PM, Markus Armbruster wrote:
>>> Yang Hongyang <yanghy@cn.fujitsu.com> writes:
>>>
>>>> Add a netfilter object based on QOM.
>>>>
>>>> A netfilter is attached to a netdev, captures all network packets
>>>> that pass through the netdev. When we delete the netdev, we also
>>>> delete the netfilter object attached to it, because if the netdev is
>>>> removed, the filter which attached to it is useless.
>>>>
>>>> QTAILQ_ENTRY next used by netdev, filter belongs to the specific netdev is
>>>> in this queue.
>>>
>>> I don't get this paragraph. Not sure it's needed.
>>>
>>>> Also init delayed object after net_init_clients, because netfilters need
>>>> to be initialized after net clients initialized.
>>>
>>> A paragraph starting with "Also" in a commit message is a pretty good
>>> sign the patch should be split :)
>>>
>>>>
>>>> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
>>>> ---
>>>> v11: no need to free nf->netdev_id, it will be auto freeed while object deleted
>>>> remove global_list net_filters, will add back when needed
>>>> v10: use QOM for netfilter
>>>> v9: use flat union instead of simple union in QAPI schema
>>>> v8: include vhost_net header
>>>> v7: add check for vhost
>>>> fix error propagate bug
>>>> v6: add multiqueue support (net_filter_init1)
>>>> v5: remove model from NetFilterState
>>>> add a sent_cb param to receive_iov API
>>>> ---
>>>> include/net/filter.h | 60 +++++++++++++++++++++
>>>> include/net/net.h | 1 +
>>>> include/qemu/typedefs.h | 1 +
>>>> net/Makefile.objs | 1 +
>>>> net/filter.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++++
>>>> net/net.c | 7 +++
>>>> qapi-schema.json | 18 +++++++
>>>> vl.c | 13 ++---
>>>> 8 files changed, 233 insertions(+), 6 deletions(-)
>>>> create mode 100644 include/net/filter.h
>>>> create mode 100644 net/filter.c
>>>>
>>>> diff --git a/include/net/filter.h b/include/net/filter.h
>>>> new file mode 100644
>>>> index 0000000..226f2f7
>>>> --- /dev/null
>>>> +++ b/include/net/filter.h
>>>> @@ -0,0 +1,60 @@
>>>> +/*
>>>> + * Copyright (c) 2015 FUJITSU LIMITED
>>>> + * Author: Yang Hongyang <yanghy@cn.fujitsu.com>
>>>> + *
>>>> + * This work is licensed under the terms of the GNU GPL, version 2 or
>>>> + * later. See the COPYING file in the top-level directory.
>>>> + */
>>>> +
>>>> +#ifndef QEMU_NET_FILTER_H
>>>> +#define QEMU_NET_FILTER_H
>>>> +
>>>> +#include "qom/object.h"
>>>> +#include "qemu-common.h"
>>>> +#include "qemu/typedefs.h"
>>>> +#include "net/queue.h"
>>>> +
>>>> +#define TYPE_NETFILTER "netfilter"
>>>> +#define NETFILTER(obj) \
>>>> + OBJECT_CHECK(NetFilterState, (obj), TYPE_NETFILTER)
>>>> +#define NETFILTER_GET_CLASS(obj) \
>>>> + OBJECT_GET_CLASS(NetFilterClass, (obj), TYPE_NETFILTER)
>>>> +#define NETFILTER_CLASS(klass) \
>>>> + OBJECT_CLASS_CHECK(NetFilterClass, (klass), TYPE_NETFILTER)
>>>> +
>>>> +typedef void (FilterSetup) (NetFilterState *nf, Error **errp);
>>>> +typedef void (FilterCleanup) (NetFilterState *nf);
>>>> +/*
>>>> + * Return:
>>>> + * 0: finished handling the packet, we should continue
>>>> + * size: filter stolen this packet, we stop pass this packet further
>>>> + */
>>>> +typedef ssize_t (FilterReceiveIOV)(NetFilterState *nc,
>>>> + NetClientState *sender,
>>>> + unsigned flags,
>>>> + const struct iovec *iov,
>>>> + int iovcnt,
>>>> + NetPacketSent *sent_cb);
>>>> +
>>>> +struct NetFilterClass {
>>>> + ObjectClass parent_class;
>>>> +
>>>> + FilterSetup *setup;
>>>> + FilterCleanup *cleanup;
>>>> + FilterReceiveIOV *receive_iov;
>>>> +};
>>>> +typedef struct NetFilterClass NetFilterClass;
>>>
>>> Not splitting the declaration is more concise:
>>>
>>> typedef struct {
>>> ObjectClass parent_class;
>>> FilterSetup *setup;
>>> FilterCleanup *cleanup;
>>> FilterReceiveIOV *receive_iov;
>>> } NetFilterClass;
>>>
>>> Are any of the methods optional? If yes, please add suitable comments.
>>
>> Hi Markus, I split it because the checkpatch.pl told me to do so...
>
> Understand. However, it's a recent change to checkpatch.pl that's going
> to be reverted:
> Message-ID: <55FAEB33.50809@redhat.com>
> http://lists.gnu.org/archive/html/qemu-devel/2015-09/msg04644.html
Thanks for the information.
>
> [...]
> .
>
--
Thanks,
Yang.
next prev parent reply other threads:[~2015-09-25 1:13 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-16 12:15 [Qemu-devel] [PATCH v11 00/12] Add a netfilter object and netbuffer filter Yang Hongyang
2015-09-16 12:15 ` [Qemu-devel] [PATCH v11 01/12] qmp: delete qemu opts when delete an object Yang Hongyang
2015-09-24 7:43 ` Markus Armbruster
2015-09-24 8:35 ` Yang Hongyang
2015-09-24 9:42 ` Markus Armbruster
2015-09-24 9:59 ` Yang Hongyang
2015-09-24 11:35 ` Markus Armbruster
2015-09-25 1:11 ` Yang Hongyang
2015-09-24 10:06 ` Yang Hongyang
2015-09-24 11:36 ` Markus Armbruster
2015-09-25 1:12 ` Yang Hongyang
2015-09-25 6:40 ` Jason Wang
2015-09-16 12:15 ` [Qemu-devel] [PATCH v11 02/12] init/cleanup of netfilter object Yang Hongyang
2015-09-16 21:09 ` Eric Blake
2015-09-17 1:23 ` Yang Hongyang
2015-09-17 16:09 ` Eric Blake
2015-09-18 1:14 ` Yang Hongyang
2015-09-24 8:41 ` Markus Armbruster
2015-09-24 8:47 ` Yang Hongyang
2015-09-24 11:40 ` Markus Armbruster
2015-09-25 1:13 ` Yang Hongyang [this message]
2015-09-24 8:57 ` Yang Hongyang
2015-09-24 11:52 ` Markus Armbruster
2015-09-25 6:45 ` Jason Wang
2015-09-25 14:10 ` Markus Armbruster
2015-09-28 5:47 ` Jason Wang
2015-09-28 5:53 ` Yang Hongyang
2015-09-16 12:15 ` [Qemu-devel] [PATCH v11 03/12] netfilter: hook packets before net queue send Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 04/12] net: merge qemu_deliver_packet and qemu_deliver_packet_iov Yang Hongyang
2015-09-22 7:30 ` Jason Wang
2015-09-22 7:44 ` Yang Hongyang
2015-09-22 8:14 ` Jason Wang
2015-09-22 8:21 ` Yang Hongyang
2015-09-22 9:19 ` Jason Wang
2015-09-22 9:26 ` Yang Hongyang
2015-09-22 9:42 ` Jason Wang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 05/12] net/queue: introduce NetQueueDeliverFunc Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 06/12] netfilter: add an API to pass the packet to next filter Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 07/12] netfilter: print filter info associate with the netdev Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 08/12] net/queue: export qemu_net_queue_append_iov Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 09/12] netfilter: add a netbuffer filter Yang Hongyang
2015-09-24 9:12 ` Markus Armbruster
2015-09-25 7:18 ` Yang Hongyang
2015-09-25 8:18 ` Jason Wang
2015-09-25 15:13 ` Markus Armbruster
2015-09-25 15:07 ` Markus Armbruster
2015-09-28 6:12 ` Jason Wang
2015-09-28 7:38 ` Markus Armbruster
2015-09-28 6:42 ` Yang Hongyang
2015-09-25 8:03 ` Yang Hongyang
2015-09-25 8:18 ` Thomas Huth
2015-09-25 8:22 ` Yang Hongyang
2015-09-25 15:26 ` Markus Armbruster
2015-09-28 6:40 ` Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 10/12] tests: add test cases for netfilter object Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 11/12] netfilter/multiqueue: introduce netfilter name Yang Hongyang
2015-09-16 12:16 ` [Qemu-devel] [PATCH v11 12/12] netfilter: add multiqueue support Yang Hongyang
2015-09-22 7:36 ` Jason Wang
2015-09-22 7:49 ` Yang Hongyang
2015-09-22 8:31 ` Jason Wang
2015-09-22 8:35 ` Yang Hongyang
2015-09-22 9:19 ` Jason Wang
2015-09-22 8:07 ` Yang Hongyang
2015-09-22 8:32 ` Jason Wang
2015-09-22 8:43 ` Yang Hongyang
2015-09-22 9:30 ` Jason Wang
2015-09-22 9:47 ` Yang Hongyang
2015-09-22 7:39 ` [Qemu-devel] [PATCH v11 00/12] Add a netfilter object and netbuffer filter Jason Wang
2015-09-22 7:59 ` Yang Hongyang
2015-09-24 4:22 ` Jason Wang
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=56049F9C.5090900@cn.fujitsu.com \
--to=yanghy@cn.fujitsu.com \
--cc=armbru@redhat.com \
--cc=jasowang@redhat.com \
--cc=lizhijian@cn.fujitsu.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 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.