qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH v11 11/12] netfilter/multiqueue: introduce netfilter


From: Yang Hongyang
Subject: [Qemu-devel] [PATCH v11 11/12] netfilter/multiqueue: introduce netfilter name
Date: Wed, 16 Sep 2015 20:16:07 +0800

From: Yang Hongyang <address@hidden>

We will add multiple netfilter objects when using object_add id=xxx attach
a filter to a multiqueue enabled netdev. The multiple objects should have
different object id, but the filter name should be the same. Introduce
netfilter name to identify the netfilters.

Signed-off-by: Yang Hongyang <address@hidden>
---
v11: initial patch
---
 include/net/filter.h | 1 +
 net/filter.c         | 3 +++
 net/net.c            | 2 +-
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/net/filter.h b/include/net/filter.h
index 3fa80c9..a3060c9 100644
--- a/include/net/filter.h
+++ b/include/net/filter.h
@@ -51,6 +51,7 @@ struct NetFilterState {
     Object parent;
 
     /* protected */
+    char *name;
     char *netdev_id;
     NetClientState *netdev;
     NetFilterChain chain;
diff --git a/net/filter.c b/net/filter.c
index a8adc89..aea619a 100644
--- a/net/filter.c
+++ b/net/filter.c
@@ -138,6 +138,8 @@ static void netfilter_finalize(Object *obj)
     if (nf->netdev && !QTAILQ_EMPTY(&nf->netdev->filters)) {
         QTAILQ_REMOVE(&nf->netdev->filters, nf, next);
     }
+
+    g_free(nf->name);
 }
 
 static void netfilter_complete(UserCreatable *uc, Error **errp)
@@ -173,6 +175,7 @@ static void netfilter_complete(UserCreatable *uc, Error 
**errp)
         return;
     }
 
+    nf->name = object_get_canonical_path_component(OBJECT(nf));
     nf->netdev = ncs[0];
 
     if (nfc->setup) {
diff --git a/net/net.c b/net/net.c
index e8f858d..33d4c99 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1181,7 +1181,7 @@ void print_net_client(Monitor *mon, NetClientState *nc)
     }
     QTAILQ_FOREACH(nf, &nc->filters, next) {
         monitor_printf(mon, "  - %s: type=%s%s\n",
-                       object_get_canonical_path_component(OBJECT(nf)),
+                       nf->name,
                        object_get_typename(OBJECT(nf)),
                        nf->info_str);
     }
-- 
1.9.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]