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, zhang.zhanghailiang@huawei.com,
	lizhijian@cn.fujitsu.com, eddie.dong@intel.com,
	mrhines@linux.vnet.ibm.com, stefanha@redhat.com
Subject: Re: [Qemu-devel] [PATCH v4 04/11] net: delete netfilter object when delete netdev
Date: Thu, 6 Aug 2015 16:44:57 +0800	[thread overview]
Message-ID: <55C31E89.9030809@cn.fujitsu.com> (raw)
In-Reply-To: <55C3083F.70904@redhat.com>



On 08/06/2015 03:09 PM, Jason Wang wrote:
>
>
> On 08/04/2015 04:30 PM, Yang Hongyang wrote:
>> When we delete the netdev, we also delete the netfilter object
>> attached to it, because if the netdev is removed, the filters
>> which attached to it is useless.
>>
>> Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
>
> Please squash this into patch 3. (otherwise you're fixing a bug
> introduced by patch 3).
>
>> ---
>>   include/net/filter.h |  1 +
>>   net/filter.c         |  2 +-
>>   net/net.c            | 14 ++++++++++++++
>>   3 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/net/filter.h b/include/net/filter.h
>> index 8eff85a..c146be2 100644
>> --- a/include/net/filter.h
>> +++ b/include/net/filter.h
>> @@ -50,6 +50,7 @@ NetFilterState *qemu_new_net_filter(NetFilterInfo *info,
>>                                       const char *model,
>>                                       const char *name,
>>                                       int chain);
>> +void qemu_del_net_filter(NetFilterState *nf);
>>   void netfilter_add(QemuOpts *opts, Error **errp);
>>   void qmp_netfilter_add(QDict *qdict, QObject **ret, Error **errp);
>>
>> diff --git a/net/filter.c b/net/filter.c
>> index 54a5c06..24ec4e1 100644
>> --- a/net/filter.c
>> +++ b/net/filter.c
>> @@ -57,7 +57,7 @@ static void qemu_cleanup_net_filter(NetFilterState *nf)
>>       g_free(nf);
>>   }
>>
>> -static void qemu_del_net_filter(NetFilterState *nf)
>> +void qemu_del_net_filter(NetFilterState *nf)
>>   {
>>       /* handle multi queue? */
>>       qemu_cleanup_net_filter(nf);
>> diff --git a/net/net.c b/net/net.c
>> index d9b70cd..03b2296 100644
>> --- a/net/net.c
>> +++ b/net/net.c
>> @@ -28,6 +28,7 @@
>>   #include "hub.h"
>>   #include "net/slirp.h"
>>   #include "net/eth.h"
>> +#include "net/filter.h"
>>   #include "util.h"
>>
>>   #include "monitor/monitor.h"
>> @@ -385,6 +386,8 @@ void qemu_del_net_client(NetClientState *nc)
>>   {
>>       NetClientState *ncs[MAX_QUEUE_NUM];
>>       int queues, i;
>> +    NetFilterState *nf, *next;
>> +    QemuOpts *opts;
>>
>>       assert(nc->info->type != NET_CLIENT_OPTIONS_KIND_NIC);
>>
>> @@ -396,6 +399,17 @@ void qemu_del_net_client(NetClientState *nc)
>>                                             MAX_QUEUE_NUM);
>>       assert(queues != 0);
>>
>> +    /*
>> +     * we delete/free the netfilter object attached to this netdev
>> +     * multiqueue netfilter is not supported now, so only delete
>> +     * nc->filters is enough.
>> +     */
>
> The comment is not correct since for multiqueue, each NetClientState is
> a queue. I think you can just remove above.

But in this function qemu_del_net_client(), it will find all ncs with the
same name (which I thought is multiqueue), and then delete those netclients.

is it ok to move this chunk to qemu_cleanup_net_client()? because in
qemu_cleanup_net_client(), we don't need to deal with multiqueue.

>
>> +    QTAILQ_FOREACH_SAFE(nf, &nc->filters, next, next) {
>> +        opts = qemu_opts_find(qemu_find_opts_err("netfilter", NULL), nf->name);
>> +        qemu_del_net_filter(nf);
>> +        qemu_opts_del(opts);
>> +    }
>> +
>>       /* If there is a peer NIC, delete and cleanup client, but do not free. */
>>       if (nc->peer && nc->peer->info->type == NET_CLIENT_OPTIONS_KIND_NIC) {
>>           NICState *nic = qemu_get_nic(nc->peer);
>
> .
>

-- 
Thanks,
Yang.

  parent reply	other threads:[~2015-08-06  8:45 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-04  8:30 [Qemu-devel] [PATCH v4 00/11] For QEMU 2.5: Add a netfilter object and netbuffer filter Yang Hongyang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 01/11] net: add a new object netfilter Yang Hongyang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 02/11] init/cleanup of netfilter object Yang Hongyang
2015-08-06  7:07   ` Jason Wang
2015-08-06  7:22     ` Yang Hongyang
2015-08-06  7:29       ` Jason Wang
2015-08-06  7:35         ` Yang Hongyang
2015-08-06  7:43           ` Jason Wang
2015-08-06  7:50             ` Yang Hongyang
2015-08-06  7:53               ` Jason Wang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 03/11] netfilter: add netfilter_{add|del} commands Yang Hongyang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 04/11] net: delete netfilter object when delete netdev Yang Hongyang
2015-08-06  7:09   ` Jason Wang
2015-08-06  7:22     ` Yang Hongyang
2015-08-06  8:44     ` Yang Hongyang [this message]
2015-08-06  9:14       ` Jason Wang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 05/11] netfilter: hook packets before net queue send Yang Hongyang
2015-08-06  7:13   ` Jason Wang
2015-08-06  7:28     ` Yang Hongyang
2015-08-06  7:37       ` Jason Wang
2015-08-06  7:58         ` Yang Hongyang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 06/11] netfilter: add an API to pass the packet to next filter Yang Hongyang
2015-08-06  7:16   ` Jason Wang
2015-08-06  7:29     ` Yang Hongyang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 07/11] net/queue: export qemu_net_queue_append_iov Yang Hongyang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 08/11] move out net queue structs define Yang Hongyang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 09/11] netfilter: add a netbuffer filter Yang Hongyang
2015-08-06  7:21   ` Jason Wang
2015-08-06  8:19     ` Yang Hongyang
2015-08-06  9:09       ` Jason Wang
2015-08-06  9:23         ` Yang Hongyang
2015-08-06  9:35           ` Jason Wang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 10/11] filter/buffer: update command description and help Yang Hongyang
2015-08-06  7:22   ` Jason Wang
2015-08-06  7:31     ` Yang Hongyang
2015-08-06  7:39       ` Jason Wang
2015-08-04  8:30 ` [Qemu-devel] [PATCH v4 11/11] tests: add test cases for netfilter object 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=55C31E89.9030809@cn.fujitsu.com \
    --to=yanghy@cn.fujitsu.com \
    --cc=eddie.dong@intel.com \
    --cc=jasowang@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 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.