diff mbox series

[V4,2/3] net/filter: Remove vnet_hdr from filter-rewriter

Message ID 20211026181730.3102184-3-chen.zhang@intel.com (mailing list archive)
State New, archived
Headers show
Series net/filter: Optimize filters vnet_hdr support | expand

Commit Message

Zhang Chen Oct. 26, 2021, 6:17 p.m. UTC
Make the vnet header a necessary part of filter transfer protocol.
So we need remove the module switch here.

Signed-off-by: Zhang Chen <chen.zhang@intel.com>
---
 net/filter-rewriter.c | 26 +-------------------------
 qemu-options.hx       |  6 +++---
 2 files changed, 4 insertions(+), 28 deletions(-)
diff mbox series

Patch

diff --git a/net/filter-rewriter.c b/net/filter-rewriter.c
index cb3a96cde1..acc09f20fa 100644
--- a/net/filter-rewriter.c
+++ b/net/filter-rewriter.c
@@ -34,7 +34,6 @@  struct RewriterState {
     NetQueue *incoming_queue;
     /* hashtable to save connection */
     GHashTable *connection_track_table;
-    bool vnet_hdr;
     bool failover_mode;
 };
 
@@ -266,9 +265,7 @@  static ssize_t colo_rewriter_receive_iov(NetFilterState *nf,
 
     iov_to_buf(iov, iovcnt, 0, buf, size);
 
-    if (s->vnet_hdr) {
-        vnet_hdr_len = nf->netdev->vnet_hdr_len;
-    }
+    vnet_hdr_len = nf->netdev->vnet_hdr_len;
 
     pkt = packet_new_nocopy(buf, size, vnet_hdr_len);
 
@@ -395,27 +392,10 @@  static void colo_rewriter_setup(NetFilterState *nf, Error **errp)
     s->incoming_queue = qemu_new_net_queue(qemu_netfilter_pass_to_next, nf);
 }
 
-static bool filter_rewriter_get_vnet_hdr(Object *obj, Error **errp)
-{
-    RewriterState *s = FILTER_REWRITER(obj);
-
-    return s->vnet_hdr;
-}
-
-static void filter_rewriter_set_vnet_hdr(Object *obj,
-                                         bool value,
-                                         Error **errp)
-{
-    RewriterState *s = FILTER_REWRITER(obj);
-
-    s->vnet_hdr = value;
-}
-
 static void filter_rewriter_init(Object *obj)
 {
     RewriterState *s = FILTER_REWRITER(obj);
 
-    s->vnet_hdr = false;
     s->failover_mode = FAILOVER_MODE_OFF;
 }
 
@@ -423,10 +403,6 @@  static void colo_rewriter_class_init(ObjectClass *oc, void *data)
 {
     NetFilterClass *nfc = NETFILTER_CLASS(oc);
 
-    object_class_property_add_bool(oc, "vnet_hdr_support",
-                                   filter_rewriter_get_vnet_hdr,
-                                   filter_rewriter_set_vnet_hdr);
-
     nfc->setup = colo_rewriter_setup;
     nfc->cleanup = colo_rewriter_cleanup;
     nfc->receive_iov = colo_rewriter_receive_iov;
diff --git a/qemu-options.hx b/qemu-options.hx
index 38c03812a7..6d3b7ab8a0 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4958,12 +4958,12 @@  SRST
         id can not be the same. we can just use indev or outdev, but at
         least one of indev or outdev need to be specified.
 
-    ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx,[vnet_hdr_support][,position=head|tail|id=<id>][,insert=behind|before]``
+    ``-object filter-rewriter,id=id,netdev=netdevid,queue=all|rx|tx[,position=head|tail|id=<id>][,insert=behind|before]``
         Filter-rewriter is a part of COLO project.It will rewrite tcp
         packet to secondary from primary to keep secondary tcp
         connection,and rewrite tcp packet to primary from secondary make
-        tcp packet can be handled by client.if it has the
-        vnet\_hdr\_support flag, we can parse packet with vnet header.
+        tcp packet can be handled by client. Filter-rewriter support
+        parse packet with vnet header.
 
         usage: colo secondary: -object
         filter-redirector,id=f1,netdev=hn0,queue=tx,indev=red0 -object