All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter
@ 2017-05-12  1:35 Zhang Chen
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 1/3] net/filter-mirror.c: Remove duplicate check code Zhang Chen
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Zhang Chen @ 2017-05-12  1:35 UTC (permalink / raw)
  To: qemu devel, Jason Wang; +Cc: Zhang Chen, zhanghailiang

Fix some duplicate codes and remove unused codes.

Zhang Chen (3):
  net/filter-mirror.c: Remove duplicate check code.
  net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle
  net/filter-rewriter: Remove unused option in filter-rewirter

 net/filter-mirror.c | 35 ++++++++++++++++-------------------
 qemu-options.hx     |  3 ++-
 2 files changed, 18 insertions(+), 20 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 1/3] net/filter-mirror.c: Remove duplicate check code.
  2017-05-12  1:35 [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Zhang Chen
@ 2017-05-12  1:35 ` Zhang Chen
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 2/3] net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle Zhang Chen
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2017-05-12  1:35 UTC (permalink / raw)
  To: qemu devel, Jason Wang; +Cc: Zhang Chen, zhanghailiang

The s->outdev have checked in filter_mirror_set_outdev().

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 net/filter-mirror.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index 72fa7c2..fd0322f 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -194,12 +194,6 @@ static void filter_mirror_setup(NetFilterState *nf, Error **errp)
     MirrorState *s = FILTER_MIRROR(nf);
     Chardev *chr;
 
-    if (!s->outdev) {
-        error_setg(errp, "filter mirror needs 'outdev' "
-                   "property set");
-        return;
-    }
-
     chr = qemu_chr_find(s->outdev);
     if (chr == NULL) {
         error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 2/3] net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle
  2017-05-12  1:35 [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Zhang Chen
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 1/3] net/filter-mirror.c: Remove duplicate check code Zhang Chen
@ 2017-05-12  1:35 ` Zhang Chen
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 3/3] net/filter-rewriter: Remove unused option in filter-rewirter Zhang Chen
  2017-05-15  3:14 ` [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Jason Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2017-05-12  1:35 UTC (permalink / raw)
  To: qemu devel, Jason Wang; +Cc: Zhang Chen, zhanghailiang

Because filter_mirror_receive_iov() and filter_redirector_receive_iov()
both use the filter_mirror_send() to send packet, so I change
filter_mirror_send() to filter_send() that looks more common.
And fix some codestyle.

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 net/filter-mirror.c | 29 ++++++++++++++++-------------
 1 file changed, 16 insertions(+), 13 deletions(-)

diff --git a/net/filter-mirror.c b/net/filter-mirror.c
index fd0322f..8b1b069 100644
--- a/net/filter-mirror.c
+++ b/net/filter-mirror.c
@@ -43,9 +43,9 @@ typedef struct MirrorState {
     SocketReadState rs;
 } MirrorState;
 
-static int filter_mirror_send(CharBackend *chr_out,
-                              const struct iovec *iov,
-                              int iovcnt)
+static int filter_send(CharBackend *chr_out,
+                       const struct iovec *iov,
+                       int iovcnt)
 {
     int ret = 0;
     ssize_t size = 0;
@@ -141,9 +141,9 @@ static ssize_t filter_mirror_receive_iov(NetFilterState *nf,
     MirrorState *s = FILTER_MIRROR(nf);
     int ret;
 
-    ret = filter_mirror_send(&s->chr_out, iov, iovcnt);
+    ret = filter_send(&s->chr_out, iov, iovcnt);
     if (ret) {
-        error_report("filter_mirror_send failed(%s)", strerror(-ret));
+        error_report("filter mirror send failed(%s)", strerror(-ret));
     }
 
     /*
@@ -164,9 +164,9 @@ static ssize_t filter_redirector_receive_iov(NetFilterState *nf,
     int ret;
 
     if (qemu_chr_fe_get_driver(&s->chr_out)) {
-        ret = filter_mirror_send(&s->chr_out, iov, iovcnt);
+        ret = filter_send(&s->chr_out, iov, iovcnt);
         if (ret) {
-            error_report("filter_mirror_send failed(%s)", strerror(-ret));
+            error_report("filter redirector send failed(%s)", strerror(-ret));
         }
         return iov_size(iov, iovcnt);
     } else {
@@ -286,8 +286,9 @@ static char *filter_redirector_get_indev(Object *obj, Error **errp)
     return g_strdup(s->indev);
 }
 
-static void
-filter_redirector_set_indev(Object *obj, const char *value, Error **errp)
+static void filter_redirector_set_indev(Object *obj,
+                                        const char *value,
+                                        Error **errp)
 {
     MirrorState *s = FILTER_REDIRECTOR(obj);
 
@@ -302,8 +303,9 @@ static char *filter_mirror_get_outdev(Object *obj, Error **errp)
     return g_strdup(s->outdev);
 }
 
-static void
-filter_mirror_set_outdev(Object *obj, const char *value, Error **errp)
+static void filter_mirror_set_outdev(Object *obj,
+                                     const char *value,
+                                     Error **errp)
 {
     MirrorState *s = FILTER_MIRROR(obj);
 
@@ -323,8 +325,9 @@ static char *filter_redirector_get_outdev(Object *obj, Error **errp)
     return g_strdup(s->outdev);
 }
 
-static void
-filter_redirector_set_outdev(Object *obj, const char *value, Error **errp)
+static void filter_redirector_set_outdev(Object *obj,
+                                         const char *value,
+                                         Error **errp)
 {
     MirrorState *s = FILTER_REDIRECTOR(obj);
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PATCH 3/3] net/filter-rewriter: Remove unused option in filter-rewirter
  2017-05-12  1:35 [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Zhang Chen
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 1/3] net/filter-mirror.c: Remove duplicate check code Zhang Chen
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 2/3] net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle Zhang Chen
@ 2017-05-12  1:35 ` Zhang Chen
  2017-05-12 17:43   ` Eric Blake
  2017-05-15  3:14 ` [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Jason Wang
  3 siblings, 1 reply; 7+ messages in thread
From: Zhang Chen @ 2017-05-12  1:35 UTC (permalink / raw)
  To: qemu devel, Jason Wang; +Cc: Zhang Chen, zhanghailiang

Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
---
 qemu-options.hx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 70c0ded..f5e088e 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -4038,7 +4038,8 @@ Create a filter-redirector we need to differ outdev id from indev id, 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.
 
-@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},rewriter-mode=@var{mode}[,queue=@var{all|rx|tx}]
+@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},
+[,queue=@var{all|rx|tx}]
 
 Filter-rewriter is a part of COLO project.It will rewrite tcp packet to
 secondary from primary to keep secondary tcp connection,and rewrite
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] net/filter-rewriter: Remove unused option in filter-rewirter
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 3/3] net/filter-rewriter: Remove unused option in filter-rewirter Zhang Chen
@ 2017-05-12 17:43   ` Eric Blake
  2017-05-15  5:32     ` Zhang Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Blake @ 2017-05-12 17:43 UTC (permalink / raw)
  To: Zhang Chen, qemu devel, Jason Wang; +Cc: zhanghailiang

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

On 05/11/2017 08:35 PM, Zhang Chen wrote:
> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>

In the subject: s/rewirter/rewriter/

> ---
>  qemu-options.hx | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 70c0ded..f5e088e 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -4038,7 +4038,8 @@ Create a filter-redirector we need to differ outdev id from indev id, 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.
>  
> -@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},rewriter-mode=@var{mode}[,queue=@var{all|rx|tx}]
> +@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},
> +[,queue=@var{all|rx|tx}]

Texinfo sources have restrictions on how line-wrapping works, and it's
not always consistent.  It's probably best to stick with the long line,
if you haven't actually validated that the rendered documentation is not
broken when you split the line.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter
  2017-05-12  1:35 [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Zhang Chen
                   ` (2 preceding siblings ...)
  2017-05-12  1:35 ` [Qemu-devel] [PATCH 3/3] net/filter-rewriter: Remove unused option in filter-rewirter Zhang Chen
@ 2017-05-15  3:14 ` Jason Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Jason Wang @ 2017-05-15  3:14 UTC (permalink / raw)
  To: Zhang Chen, qemu devel; +Cc: zhanghailiang



On 2017年05月12日 09:35, Zhang Chen wrote:
> Fix some duplicate codes and remove unused codes.
>
> Zhang Chen (3):
>    net/filter-mirror.c: Remove duplicate check code.
>    net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle
>    net/filter-rewriter: Remove unused option in filter-rewirter
>
>   net/filter-mirror.c | 35 ++++++++++++++++-------------------
>   qemu-options.hx     |  3 ++-
>   2 files changed, 18 insertions(+), 20 deletions(-)
>

Looks good to me, just need to address Eric's comment on patch 3.

Thanks

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PATCH 3/3] net/filter-rewriter: Remove unused option in filter-rewirter
  2017-05-12 17:43   ` Eric Blake
@ 2017-05-15  5:32     ` Zhang Chen
  0 siblings, 0 replies; 7+ messages in thread
From: Zhang Chen @ 2017-05-15  5:32 UTC (permalink / raw)
  To: Eric Blake, qemu devel, Jason Wang; +Cc: zhangchen.fnst, zhanghailiang



On 05/13/2017 01:43 AM, Eric Blake wrote:
> On 05/11/2017 08:35 PM, Zhang Chen wrote:
>> Signed-off-by: Zhang Chen <zhangchen.fnst@cn.fujitsu.com>
> In the subject: s/rewirter/rewriter/

OK.

>> ---
>>   qemu-options.hx | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/qemu-options.hx b/qemu-options.hx
>> index 70c0ded..f5e088e 100644
>> --- a/qemu-options.hx
>> +++ b/qemu-options.hx
>> @@ -4038,7 +4038,8 @@ Create a filter-redirector we need to differ outdev id from indev id, 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.
>>   
>> -@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},rewriter-mode=@var{mode}[,queue=@var{all|rx|tx}]
>> +@item -object filter-rewriter,id=@var{id},netdev=@var{netdevid},
>> +[,queue=@var{all|rx|tx}]
> Texinfo sources have restrictions on how line-wrapping works, and it's
> not always consistent.  It's probably best to stick with the long line,
> if you haven't actually validated that the rendered documentation is not
> broken when you split the line.

OK, I will change it to a long line.

Thanks
Zhang Chen


-- 
Thanks
Zhang Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-05-15  5:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-12  1:35 [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Zhang Chen
2017-05-12  1:35 ` [Qemu-devel] [PATCH 1/3] net/filter-mirror.c: Remove duplicate check code Zhang Chen
2017-05-12  1:35 ` [Qemu-devel] [PATCH 2/3] net/filter-mirror.c: Rename filter_mirror_send() and fix codestyle Zhang Chen
2017-05-12  1:35 ` [Qemu-devel] [PATCH 3/3] net/filter-rewriter: Remove unused option in filter-rewirter Zhang Chen
2017-05-12 17:43   ` Eric Blake
2017-05-15  5:32     ` Zhang Chen
2017-05-15  3:14 ` [Qemu-devel] [PATCH 0/3] Optimize filter-mirror and filter-rewriter Jason Wang

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.