From: Yang Hongyang <address@hidden>
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 <address@hidden>
---
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);
+ }