From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56990) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeJ0a-0003aw-Kc for qemu-devel@nongnu.org; Tue, 22 Sep 2015 04:33:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZeJ0V-0007L9-G1 for qemu-devel@nongnu.org; Tue, 22 Sep 2015 04:33:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59148) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZeJ0V-0007Kx-4J for qemu-devel@nongnu.org; Tue, 22 Sep 2015 04:32:59 -0400 References: <1442405768-23019-1-git-send-email-yanghy@cn.fujitsu.com> <1442405768-23019-13-git-send-email-yanghy@cn.fujitsu.com> <56010511.2040303@redhat.com> <56010C59.1040903@cn.fujitsu.com> From: Jason Wang Message-ID: <56011234.4040306@redhat.com> Date: Tue, 22 Sep 2015 16:32:52 +0800 MIME-Version: 1.0 In-Reply-To: <56010C59.1040903@cn.fujitsu.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v11 12/12] netfilter: add multiqueue support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Yang Hongyang , qemu-devel@nongnu.org Cc: thuth@redhat.com, zhang.zhanghailiang@huawei.com, lizhijian@cn.fujitsu.com, armbru@redhat.com, Yang Hongyang , stefanha@redhat.com On 09/22/2015 04:07 PM, Yang Hongyang wrote: > On 09/22/2015 03:36 PM, Jason Wang wrote: >> >> >> On 09/16/2015 08:16 PM, Yang Hongyang wrote: >>> From: Yang Hongyang >>> >>> add multiqueue support, if there's multiqueue, we add multi netfilter >>> objects, other netfilter objects is the child of the first added >>> netfilter >>> object. So when we delete a netfilter, the other netfilter objects we >>> added will be automatically deleted. >>> >>> Signed-off-by: Yang Hongyang >>> --- >>> v11: initial patch >>> --- >>> net/filter.c | 86 >>> +++++++++++++++++++++++++++++++++++++++++++++++++++++++----- >>> 1 file changed, 79 insertions(+), 7 deletions(-) >>> >>> diff --git a/net/filter.c b/net/filter.c >>> index aea619a..cc27528 100644 >>> --- a/net/filter.c >>> +++ b/net/filter.c >>> @@ -142,16 +142,25 @@ static void netfilter_finalize(Object *obj) >>> g_free(nf->name); >>> } >>> >>> +static void proptb_free_val_func(gpointer data) >>> +{ >>> + g_free(data); >>> +} >>> + >>> static void netfilter_complete(UserCreatable *uc, Error **errp) >>> { >>> - NetFilterState *nf = NETFILTER(uc); >>> + NetFilterState *nf = NETFILTER(uc), *nfq = NULL; >>> NetClientState *ncs[MAX_QUEUE_NUM]; >>> - NetFilterClass *nfc = NETFILTER_GET_CLASS(uc); >>> - int queues; >>> + NetFilterClass *nfc = NETFILTER_GET_CLASS(uc), *nfqc = NULL; >>> + int queues, i; >>> Error *local_err = NULL; >>> - char *str, *info; >>> + char *str, *info, *name; >>> ObjectProperty *prop; >>> StringOutputVisitor *ov; >>> + Object *obj = NULL; >>> + GHashTable *proptable = NULL; >>> + GHashTableIter iter; >>> + gpointer key, value; >>> >>> if (!nf->netdev_id) { >>> error_setg(errp, "Parameter 'netdev' is required"); >>> @@ -165,9 +174,6 @@ static void netfilter_complete(UserCreatable >>> *uc, Error **errp) >>> error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "netdev", >>> "a network backend id"); >>> return; >>> - } else if (queues > 1) { >>> - error_setg(errp, "Multi queue is not supported"); >>> - return; >>> } >>> >>> if (get_vhost_net(ncs[0])) { >>> @@ -187,6 +193,17 @@ static void netfilter_complete(UserCreatable >>> *uc, Error **errp) >>> } >>> QTAILQ_INSERT_TAIL(&nf->netdev->filters, nf, next); >>> >>> + if (queues > 1) { >>> + /* >>> + * Store the properties of the filter except "type" property. >>> + * When there's multiqueue, we will create a new filter object >>> + * of the same type and same properties. this hashtable is >>> used >>> + * to set newly created object properties. >>> + */ >>> + proptable = g_hash_table_new_full(NULL, NULL, NULL, >>> + proptb_free_val_func); >>> + } >> >> I'm thinking whether or not duplicate all the properties in each >> netfilters is a good method. Maybe we can have a another ojbect with >> array of pointers to NetFilter objects embedded? Another question is >> whether or not we need to do this at this level. Maybe we can make the >> necessary Netfilter multiqueue aware. E.g let buffer filter to have >> multiqueue also? Then you may only need a single timer? > > Sorry I don't get it at first. I also thought about make the buffer > filter to > have multiqueue, but there comes problem, how to distinguish which queue > we should go in when receive the packet, we need to add a mechanism to > distinguish which queue belongs to which net client's queue, that will > be more complex, while current multiqueue implementation of net clients > is multiple net clients with the same name, current solution is the > simplest > solution I can think of... I'm not sure I get this. But there's a queue_index filed in each NetClientState which may help in this case.