On 03/08/2016 04:04 PM, Yang Hongyang wrote:
Hi Chen, What's the motivation that you want to change this name? The function actually is not intent to iterate every filter.
Right. but this function isn't always pass packet to *a* next filter. Actually, it iterates filters until the packet is stolen(filter receiving handler return non-zero). In other words, packet could be handled by several filters at this function. BTW, it's difficult to determine what name is better. Thanks Li Zhijian
On Mon, Mar 7, 2016 at 6:03 PM, Zhang Chen <zhangchen.f...@cn.fujitsu.com <mailto:zhangchen.f...@cn.fujitsu.com>> wrote: This API will iterate the filters attached to netdev Signed-off-by: Zhang Chen <zhangchen.f...@cn.fujitsu.com <mailto:zhangchen.f...@cn.fujitsu.com>> Signed-off-by: Wen Congyang <we...@cn.fujitsu.com <mailto:we...@cn.fujitsu.com>> Signed-off-by: Li Zhijian <lizhij...@cn.fujitsu.com <mailto:lizhij...@cn.fujitsu.com>> --- include/net/filter.h | 10 +++++----- net/filter-buffer.c | 2 +- net/filter.c | 12 ++++++------ 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/net/filter.h b/include/net/filter.h index 5639976..ab00d54 100644 --- a/include/net/filter.h +++ b/include/net/filter.h @@ -67,10 +67,10 @@ ssize_t qemu_netfilter_receive(NetFilterState *nf, NetPacketSent *sent_cb); /* pass the packet to the next filter */ -ssize_t qemu_netfilter_pass_to_next(NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - void *opaque); +ssize_t qemu_netfilter_iterate(NetClientState *sender, + unsigned flags, + const struct iovec *iov, + int iovcnt, + void *opaque); #endif /* QEMU_NET_FILTER_H */ diff --git a/net/filter-buffer.c b/net/filter-buffer.c index 12ad2e3..a74f8c8 100644 --- a/net/filter-buffer.c +++ b/net/filter-buffer.c @@ -114,7 +114,7 @@ static void filter_buffer_setup(NetFilterState *nf, Error **errp) return; } - s->incoming_queue = qemu_new_net_queue(qemu_netfilter_pass_to_next, nf); + s->incoming_queue = qemu_new_net_queue(qemu_netfilter_iterate, nf); if (s->interval) { timer_init_us(&s->release_timer, QEMU_CLOCK_VIRTUAL, filter_buffer_release_timer, nf); diff --git a/net/filter.c b/net/filter.c index d2a514e..7c504c3 100644 --- a/net/filter.c +++ b/net/filter.c @@ -50,11 +50,11 @@ static NetFilterState *netfilter_next(NetFilterState *nf, return next; } -ssize_t qemu_netfilter_pass_to_next(NetClientState *sender, - unsigned flags, - const struct iovec *iov, - int iovcnt, - void *opaque) +ssize_t qemu_netfilter_iterate(NetClientState *sender, + unsigned flags, + const struct iovec *iov, + int iovcnt, + void *opaque) { int ret = 0; int direction; @@ -80,7 +80,7 @@ ssize_t qemu_netfilter_pass_to_next(NetClientState *sender, next = netfilter_next(nf, direction); while (next) { /* - * if qemu_netfilter_pass_to_next been called, means that + * if qemu_netfilter_iterate been called, means that * the packet has been hold by filter and has already retured size * to the sender, so sent_cb shouldn't be called later, just * pass NULL to next. -- 1.9.1 -- Thanks, Yang